summaryrefslogtreecommitdiff
path: root/cesar/cp
diff options
context:
space:
mode:
authorschodet2008-08-29 14:52:33 +0000
committerschodet2008-08-29 14:52:33 +0000
commit61addbb1e20e382581c3bee165b8c253adb69d84 (patch)
treef106646632de478a1bc08b12a043f83336435e98 /cesar/cp
parent1b5b41d79cf71a1d5a784576aa1fa9d9bd704a71 (diff)
* cp2 -> cp:
- renamed. git-svn-id: svn+ssh://pessac/svn/cesar/trunk@2798 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/cp')
-rw-r--r--cesar/cp/Module6
-rw-r--r--cesar/cp/beacon/Module4
-rw-r--r--cesar/cp/beacon/beacon.h146
-rw-r--r--cesar/cp/beacon/beacon_desc.h43
-rw-r--r--cesar/cp/beacon/defs.h105
-rw-r--r--cesar/cp/beacon/doc/Makefile19
-rw-r--r--cesar/cp/beacon/doc/add-to-sched.sdl5
-rw-r--r--cesar/cp/beacon/doc/beacon-spec.odtbin0 -> 141976 bytes
-rw-r--r--cesar/cp/beacon/doc/beacon-study.odtbin0 -> 452327 bytes
-rw-r--r--cesar/cp/beacon/doc/beacons.xmi712
-rw-r--r--cesar/cp/beacon/doc/bentry_mgr.odtbin0 -> 181878 bytes
-rw-r--r--cesar/cp/beacon/doc/bentry_mgr.sdl47
-rw-r--r--cesar/cp/beacon/doc/discover-need-to-request.dot18
-rw-r--r--cesar/cp/beacon/doc/discover-process.sdl10
-rw-r--r--cesar/cp/beacon/doc/processingbeacon.sdl21
-rw-r--r--cesar/cp/beacon/doc/receivebeacon.sdl5
-rw-r--r--cesar/cp/beacon/inc/beacon.h252
-rw-r--r--cesar/cp/beacon/inc/beacon_discover.h89
-rw-r--r--cesar/cp/beacon/inc/beacon_work.h79
-rw-r--r--cesar/cp/beacon/inc/bentry.h234
-rw-r--r--cesar/cp/beacon/inc/bentry_msg.h228
-rw-r--r--cesar/cp/beacon/inc/bentry_size.h85
-rw-r--r--cesar/cp/beacon/inc/common.h68
-rw-r--r--cesar/cp/beacon/ntb/Module1
-rw-r--r--cesar/cp/beacon/ntb/doc/ntb_clock_sync.odtbin0 -> 174674 bytes
-rw-r--r--cesar/cp/beacon/ntb/doc/ntb_clock_sync.xmi370
-rw-r--r--cesar/cp/beacon/ntb/inc/ntb_clock_utils.h75
-rw-r--r--cesar/cp/beacon/ntb/ntb_clock_sync.h267
-rw-r--r--cesar/cp/beacon/ntb/src/ntb_clock_sync.c637
-rw-r--r--cesar/cp/beacon/src/beacon.c1003
-rw-r--r--cesar/cp/beacon/src/beacon_discover.c157
-rw-r--r--cesar/cp/beacon/src/bentry.c201
-rw-r--r--cesar/cp/beacon/src/bentry_msg.c512
-rw-r--r--cesar/cp/beacon/src/common.c53
-rw-r--r--cesar/cp/beacon/test/Makefile43
-rw-r--r--cesar/cp/beacon/test/doc/Makefile20
-rw-r--r--cesar/cp/beacon/test/doc/beacon-discover.txt129
-rw-r--r--cesar/cp/beacon/test/doc/beacon.txt42
-rw-r--r--cesar/cp/beacon/test/doc/bentry.txt220
-rw-r--r--cesar/cp/beacon/test/doc/default-schedules.txt44
-rw-r--r--cesar/cp/beacon/test/doc/recv-beacon.txt81
-rw-r--r--cesar/cp/beacon/test/doc/send-beacon.txt85
-rw-r--r--cesar/cp/beacon/test/ecos.ecc.sh5
-rw-r--r--cesar/cp/beacon/test/overide/cp_fsm_defs.h40
-rw-r--r--cesar/cp/beacon/test/src/beacon.c176
-rw-r--r--cesar/cp/beacon/test/src/bentry.c1394
-rw-r--r--cesar/cp/beacon/test/src/bw_stub.c221
-rw-r--r--cesar/cp/beacon/test/src/ca_stub.c57
-rw-r--r--cesar/cp/beacon/test/src/cco_send_central_beacon.c669
-rw-r--r--cesar/cp/beacon/test/src/cl_stub.c88
-rw-r--r--cesar/cp/beacon/test/src/core_stub.c28
-rw-r--r--cesar/cp/beacon/test/src/default-sched.c478
-rw-r--r--cesar/cp/beacon/test/src/discover.c342
-rw-r--r--cesar/cp/beacon/test/src/fsm_stub.c41
-rw-r--r--cesar/cp/beacon/test/src/hal_timer_stub.c103
-rw-r--r--cesar/cp/beacon/test/src/interface_stub.c47
-rw-r--r--cesar/cp/beacon/test/src/ntb_stub.c22
-rw-r--r--cesar/cp/beacon/test/src/region_stub.c99
-rw-r--r--cesar/cp/beacon/test/src/sta_receive_central_beacon.c600
-rw-r--r--cesar/cp/cco/action/Module1
-rw-r--r--cesar/cp/cco/action/cco_action.h115
-rw-r--r--cesar/cp/cco/action/cco_conn/Module1
-rw-r--r--cesar/cp/cco/action/cco_conn/cco_action.h515
-rwxr-xr-xcesar/cp/cco/action/cco_conn/doc/CCo Con.odtbin0 -> 304722 bytes
-rw-r--r--cesar/cp/cco/action/cco_conn/doc/cco_conn.xmi1755
-rw-r--r--cesar/cp/cco/action/cco_conn/inc/cco_action.h33
-rw-r--r--cesar/cp/cco/action/cco_conn/src/action.c330
-rw-r--r--cesar/cp/cco/action/cco_conn/test/Makefile12
-rw-r--r--cesar/cp/cco/action/cco_conn/test/ecos.ecc.sh5
-rw-r--r--cesar/cp/cco/action/cco_conn/test/overide/cp_fsm_defs.h38
-rw-r--r--cesar/cp/cco/action/cco_conn/test/src/cco_action_conn_test.c144
-rw-r--r--cesar/cp/cco/action/cco_conn/test/src/fsm_stub.c29
-rw-r--r--cesar/cp/cco/action/cco_conn/test/src/msg_stub.c463
-rw-r--r--cesar/cp/cco/action/doc/Makefile19
-rw-r--r--cesar/cp/cco/action/doc/assoc_procedure.sdl15
-rw-r--r--cesar/cp/cco/action/doc/auth_procedure.sdl4
-rw-r--r--cesar/cp/cco/action/doc/cco_action.odtbin0 -> 203194 bytes
-rw-r--r--cesar/cp/cco/action/doc/cco_action.xmi347
-rw-r--r--cesar/cp/cco/action/doc/leave.sdl5
-rw-r--r--cesar/cp/cco/action/doc/snid.sdl3
-rw-r--r--cesar/cp/cco/action/doc/tei.sdl14
-rw-r--r--cesar/cp/cco/action/inc/cco_action.h77
-rw-r--r--cesar/cp/cco/action/src/cco_action.c560
-rw-r--r--cesar/cp/cco/action/test/Makefile18
-rw-r--r--cesar/cp/cco/action/test/doc/Makefile20
-rw-r--r--cesar/cp/cco/action/test/doc/cco_action.txt170
-rw-r--r--cesar/cp/cco/action/test/ecos.ecc.sh5
-rw-r--r--cesar/cp/cco/action/test/overide/cp_fsm_defs.h38
-rw-r--r--cesar/cp/cco/action/test/src/action-test.c909
-rw-r--r--cesar/cp/cco/action/test/src/action_gen_nek.c263
-rw-r--r--cesar/cp/cco/action/test/src/fsm_stub.c29
-rw-r--r--cesar/cp/cco/action/test/src/garbage.c277
-rw-r--r--cesar/cp/cco/action/test/src/secu_stub.c32
-rw-r--r--cesar/cp/cco/bw/Module1
-rw-r--r--cesar/cp/cco/bw/bw.h360
-rw-r--r--cesar/cp/cco/bw/bw_lib_alloc.h82
-rw-r--r--cesar/cp/cco/bw/bw_prio_heap.h121
-rwxr-xr-xcesar/cp/cco/bw/doc/Bandwidth_Manager.odtbin0 -> 538219 bytes
-rw-r--r--cesar/cp/cco/bw/doc/bw.xmi1265
-rw-r--r--cesar/cp/cco/bw/inc/bw.h134
-rw-r--r--cesar/cp/cco/bw/inc/bw_prio_heap.h58
-rw-r--r--cesar/cp/cco/bw/src/bw.c1135
-rw-r--r--cesar/cp/cco/bw/src/bw_lib_alloc.c181
-rw-r--r--cesar/cp/cco/bw/src/bw_prio_heap.c225
-rw-r--r--cesar/cp/cco/bw/test/Makefile17
-rw-r--r--cesar/cp/cco/bw/test/bandwidth manager - test plan.odsbin0 -> 16461 bytes
-rw-r--r--cesar/cp/cco/bw/test/ecos.ecc.sh5
-rw-r--r--cesar/cp/cco/bw/test/overide/cp_fsm_defs.h38
-rw-r--r--cesar/cp/cco/bw/test/src/bw_list_alloc_test.c103
-rw-r--r--cesar/cp/cco/bw/test/src/bw_prio_heap_test.c319
-rw-r--r--cesar/cp/cco/bw/test/src/bw_test.c1277
-rw-r--r--cesar/cp/cco/bw/test/src/cl_stub.c86
-rw-r--r--cesar/cp/cco/bw/test/src/fsm_stub.c29
-rw-r--r--cesar/cp/cco/bw/test/src/msg_stub.c233
-rw-r--r--cesar/cp/cco/bw/test/src/pwl_stub.c32
-rwxr-xr-xcesar/cp/cco/region/doc/Region_Manager.odtbin0 -> 239806 bytes
-rw-r--r--cesar/cp/cco/region/doc/region.xmi441
-rw-r--r--cesar/cp/cco/region/inc/region.h151
-rw-r--r--cesar/cp/cco/region/region.h278
-rw-r--r--cesar/cp/cl_interf/Module1
-rw-r--r--cesar/cp/cl_interf/cl_interf.h91
-rw-r--r--cesar/cp/cl_interf/doc/cl-interf.xmi221
-rw-r--r--cesar/cp/cl_interf/doc/cp_cl_interf.odtbin0 -> 102411 bytes
-rw-r--r--cesar/cp/cl_interf/inc/cl_interf.h46
-rw-r--r--cesar/cp/cl_interf/inc/cl_interf_msg.h47
-rw-r--r--cesar/cp/cl_interf/inc/context.h51
-rw-r--r--cesar/cp/cl_interf/src/cl_interf.c368
-rw-r--r--cesar/cp/cl_interf/test/Makefile13
-rw-r--r--cesar/cp/cl_interf/test/doc/Makefile20
-rw-r--r--cesar/cp/cl_interf/test/doc/cl-interf.txt81
-rw-r--r--cesar/cp/cl_interf/test/ecos.ecc.sh5
-rw-r--r--cesar/cp/cl_interf/test/overide/cp_fsm_defs.h38
-rw-r--r--cesar/cp/cl_interf/test/src/cl_stub.c88
-rw-r--r--cesar/cp/cl_interf/test/src/fsm_stub.c29
-rw-r--r--cesar/cp/cl_interf/test/src/test-cl-interf.c511
-rw-r--r--cesar/cp/conn/Module1
-rw-r--r--cesar/cp/conn/conn.h221
-rw-r--r--cesar/cp/conn/conn_mgr.h640
-rw-r--r--cesar/cp/conn/doc/conn.odtbin0 -> 280499 bytes
-rw-r--r--cesar/cp/conn/doc/conn.xmi1285
-rw-r--r--cesar/cp/conn/inc/conn.h48
-rw-r--r--cesar/cp/conn/inc/link.h38
-rw-r--r--cesar/cp/conn/link.h276
-rw-r--r--cesar/cp/conn/src/conn.c216
-rw-r--r--cesar/cp/conn/src/conn_mgr.c457
-rw-r--r--cesar/cp/conn/src/link.c101
-rw-r--r--cesar/cp/conn/test/Makefile14
-rw-r--r--cesar/cp/conn/test/ecos.ecc.sh5
-rw-r--r--cesar/cp/conn/test/overide/cp_fsm_defs.h38
-rw-r--r--cesar/cp/conn/test/src/conn_mgr_test.c95
-rw-r--r--cesar/cp/conn/test/src/conn_test.c300
-rw-r--r--cesar/cp/conn/test/src/fsm_stub.c29
-rw-r--r--cesar/cp/conn/test/src/msg_stub.c246
-rw-r--r--cesar/cp/conn/test/src/pwl_stub.c73
-rw-r--r--cesar/cp/cp.h39
-rw-r--r--cesar/cp/defs.h93
-rw-r--r--cesar/cp/doc/Makefile48
-rw-r--r--cesar/cp/doc/archi.txt480
-rw-r--r--cesar/cp/doc/cp.xmi123
-rw-r--r--cesar/cp/doc/cp_archi.odtbin0 -> 285983 bytes
-rw-r--r--cesar/cp/doc/mme_rx_handle.svg455
-rw-r--r--cesar/cp/doc/overview.svg521
-rw-r--r--cesar/cp/fsm/Module37
-rw-r--r--cesar/cp/fsm/forward.h19
-rw-r--r--cesar/cp/fsm/fsm.h78
-rw-r--r--cesar/cp/fsm/inc/context.h43
-rw-r--r--cesar/cp/fsm/inc/events.h99
-rw-r--r--cesar/cp/fsm/inc/tables.h36
-rw-r--r--cesar/cp/fsm/src/events.c230
-rw-r--r--cesar/cp/fsm/src/fsm.c186
-rw-r--r--cesar/cp/fsm/src/fsm/cp.conf6
-rw-r--r--cesar/cp/fsm/src/fsm/cp.fsm178
-rw-r--r--cesar/cp/fsm/src/fsm/template_defs.h52
-rw-r--r--cesar/cp/fsm/src/fsm/template_tables.h32
-rw-r--r--cesar/cp/fsm/src/tables.c21
-rw-r--r--cesar/cp/fsm/test/utest/Config1
-rw-r--r--cesar/cp/fsm/test/utest/Makefile17
-rw-r--r--cesar/cp/fsm/test/utest/inc/scenario_defs.h97
-rw-r--r--cesar/cp/fsm/test/utest/override/cp2/fsm/src/fsm/cp.fsm72
-rw-r--r--cesar/cp/fsm/test/utest/override/cp2/inc/context.h25
-rw-r--r--cesar/cp/fsm/test/utest/src/actions.c35
-rw-r--r--cesar/cp/fsm/test/utest/src/fsm_stub.c205
-rw-r--r--cesar/cp/fsm/test/utest/src/test_fsm.c322
-rw-r--r--cesar/cp/inc/context.h117
-rw-r--r--cesar/cp/mme.h326
-rw-r--r--cesar/cp/msg/Module1
-rw-r--r--cesar/cp/msg/inc/cc_assoc.h64
-rw-r--r--cesar/cp/msg/inc/cc_leave.h33
-rw-r--r--cesar/cp/msg/inc/cc_set_tei_map.h51
-rw-r--r--cesar/cp/msg/inc/cc_who_ru.h28
-rw-r--r--cesar/cp/msg/inc/cm_get_key.h59
-rw-r--r--cesar/cp/msg/inc/cm_key.h28
-rw-r--r--cesar/cp/msg/inc/cm_mme_error.h39
-rw-r--r--cesar/cp/msg/inc/cm_set_key.h50
-rw-r--r--cesar/cp/msg/inc/context.h28
-rw-r--r--cesar/cp/msg/inc/msg.h55
-rw-r--r--cesar/cp/msg/inc/msg_cc.h364
-rw-r--r--cesar/cp/msg/inc/msg_cm.h203
-rw-r--r--cesar/cp/msg/inc/msg_drv.h177
-rw-r--r--cesar/cp/msg/msg.h188
-rw-r--r--cesar/cp/msg/src/mme.c109
-rw-r--r--cesar/cp/msg/src/msg.c764
-rw-r--r--cesar/cp/msg/src/msg_cc.c828
-rw-r--r--cesar/cp/msg/src/msg_cm.c543
-rw-r--r--cesar/cp/msg/test/Makefile20
-rw-r--r--cesar/cp/msg/test/doc/Makefile20
-rw-r--r--cesar/cp/msg/test/doc/read-header.txt69
-rw-r--r--cesar/cp/msg/test/overide/cp2/inc/context.h48
-rw-r--r--cesar/cp/msg/test/overide/cp2/sta/core/core.h18
-rw-r--r--cesar/cp/msg/test/overide/cp_fsm_defs.h38
-rw-r--r--cesar/cp/msg/test/src/cc_set_tei_map_frag.c261
-rw-r--r--cesar/cp/msg/test/src/cl_stub.c119
-rw-r--r--cesar/cp/msg/test/src/cp_cl_interface_stub.c44
-rw-r--r--cesar/cp/msg/test/src/fsm_stub.c29
-rw-r--r--cesar/cp/msg/test/src/interface_stub.c27
-rw-r--r--cesar/cp/msg/test/src/msg_cc.c646
-rw-r--r--cesar/cp/msg/test/src/msg_cm.c634
-rw-r--r--cesar/cp/msg/test/src/sta_mgr_stub.c67
-rw-r--r--cesar/cp/msg/test/src/test-msg-read-header.c184
-rw-r--r--cesar/cp/pwl/Module1
-rw-r--r--cesar/cp/pwl/doc/pwl.xmi168
-rw-r--r--cesar/cp/pwl/doc/scilab/Makefile15
-rw-r--r--cesar/cp/pwl/doc/scilab/convertc.sce41
-rw-r--r--cesar/cp/pwl/doc/scilab/estimate_acl_freq_decrease.sce50
-rw-r--r--cesar/cp/pwl/doc/scilab/estimate_acl_freq_increase.sce54
-rw-r--r--cesar/cp/pwl/doc/scilab/estimate_acl_stable.sce52
-rw-r--r--cesar/cp/pwl/doc/scilab/src/estimateBP.sce34
-rw-r--r--cesar/cp/pwl/doc/scilab/src/zc_capture.sce19
-rw-r--r--cesar/cp/pwl/doc/scilab/src/zc_capture_decrease.sce21
-rw-r--r--cesar/cp/pwl/doc/scilab/src/zc_capture_increase.sce21
-rw-r--r--cesar/cp/pwl/doc/spec.odtbin0 -> 115628 bytes
-rw-r--r--cesar/cp/pwl/doc/study.odtbin0 -> 118536 bytes
-rw-r--r--cesar/cp/pwl/pwl.h136
-rw-r--r--cesar/cp/pwl/src/pwl.c117
-rw-r--r--cesar/cp/pwl/test/Makefile10
-rw-r--r--cesar/cp/pwl/test/doc/Makefile20
-rw-r--r--cesar/cp/pwl/test/doc/pwl.txt92
-rw-r--r--cesar/cp/pwl/test/ecos.ecc.sh5
-rw-r--r--cesar/cp/pwl/test/inc/result_decrease.h1006
-rw-r--r--cesar/cp/pwl/test/inc/result_increase.h1006
-rw-r--r--cesar/cp/pwl/test/inc/result_stable.h1006
-rw-r--r--cesar/cp/pwl/test/inc/table.h1006
-rw-r--r--cesar/cp/pwl/test/inc/table_decrease.h1006
-rw-r--r--cesar/cp/pwl/test/inc/table_increase.h1006
-rw-r--r--cesar/cp/pwl/test/src/pwl.c344
-rw-r--r--cesar/cp/secu/Module1
-rw-r--r--cesar/cp/secu/aes.h234
-rw-r--r--cesar/cp/secu/defs.h38
-rw-r--r--cesar/cp/secu/inc/pbkdf1.h31
-rw-r--r--cesar/cp/secu/inc/sha256.h25
-rw-r--r--cesar/cp/secu/pbkdf1.h35
-rw-r--r--cesar/cp/secu/secu.h135
-rw-r--r--cesar/cp/secu/sha256.h27
-rw-r--r--cesar/cp/secu/src/aes.c742
-rw-r--r--cesar/cp/secu/src/pbkdf1.c106
-rw-r--r--cesar/cp/secu/src/secu.c140
-rw-r--r--cesar/cp/secu/src/sha256.c278
-rw-r--r--cesar/cp/secu/test/Makefile10
-rw-r--r--cesar/cp/secu/test/host-Makefile19
-rw-r--r--cesar/cp/secu/test/sparc-Makefile15
-rw-r--r--cesar/cp/secu/test/sparc-ecos.ecc.sh5
-rw-r--r--cesar/cp/secu/test/src/test-aes.c127
-rw-r--r--cesar/cp/secu/test/src/test-nmk.c138
-rw-r--r--cesar/cp/secu/test/src/test-prun.c211
-rw-r--r--cesar/cp/secu/test/src/test-sha2.c87
-rw-r--r--cesar/cp/secu/test/utest/Makefile7
-rw-r--r--cesar/cp/secu/test/utest/src/test_secu.c28
-rw-r--r--cesar/cp/spoc/Module1
-rw-r--r--cesar/cp/spoc/spoc.h50
-rw-r--r--cesar/cp/spoc/src/spoc.c175
-rw-r--r--cesar/cp/spoc/test/ApproxOrder1ParamMCoeff.sci36
-rw-r--r--cesar/cp/spoc/test/ApproxOrder2ParamMCoeff.sci34
-rw-r--r--cesar/cp/spoc/test/Makefile11
-rw-r--r--cesar/cp/spoc/test/coeff_generation.scilab22
-rw-r--r--cesar/cp/spoc/test/define_spoc_c.h20
-rw-r--r--cesar/cp/spoc/test/get_Approx1.sci21
-rw-r--r--cesar/cp/spoc/test/src/test_coeff_check.c194
-rw-r--r--cesar/cp/src/cp.c40
-rw-r--r--cesar/cp/sta/action/Module1
-rw-r--r--cesar/cp/sta/action/action.h53
-rw-r--r--cesar/cp/sta/action/assoc.h314
-rw-r--r--cesar/cp/sta/action/doc/Makefile47
-rw-r--r--cesar/cp/sta/action/doc/assoc.sdl23
-rw-r--r--cesar/cp/sta/action/doc/cp_sta_action.odtbin0 -> 238110 bytes
-rw-r--r--cesar/cp/sta/action/doc/drv.sdl6
-rw-r--r--cesar/cp/sta/action/doc/poweron.sdl38
-rw-r--r--cesar/cp/sta/action/drv.h188
-rw-r--r--cesar/cp/sta/action/inc/context.h50
-rw-r--r--cesar/cp/sta/action/info.h53
-rw-r--r--cesar/cp/sta/action/key.h101
-rw-r--r--cesar/cp/sta/action/misc.h83
-rw-r--r--cesar/cp/sta/action/poweron.h194
-rw-r--r--cesar/cp/sta/action/src/action.c27
-rw-r--r--cesar/cp/sta/action/src/assoc.c316
-rw-r--r--cesar/cp/sta/action/src/drv.c186
-rw-r--r--cesar/cp/sta/action/src/info.c99
-rw-r--r--cesar/cp/sta/action/src/key.c54
-rw-r--r--cesar/cp/sta/action/src/misc.c36
-rw-r--r--cesar/cp/sta/action/src/poweron.c277
-rw-r--r--cesar/cp/sta/action/test/utest/Makefile17
-rw-r--r--cesar/cp/sta/action/test/utest/inc/scenario_defs.h348
-rw-r--r--cesar/cp/sta/action/test/utest/inc/test_sta_action.h46
-rw-r--r--cesar/cp/sta/action/test/utest/override/cp2/inc/context.h32
-rw-r--r--cesar/cp/sta/action/test/utest/override/cp2/sta/core/core.h17
-rw-r--r--cesar/cp/sta/action/test/utest/src/assoc.c604
-rw-r--r--cesar/cp/sta/action/test/utest/src/dataplane_stub.c42
-rw-r--r--cesar/cp/sta/action/test/utest/src/drv.c344
-rw-r--r--cesar/cp/sta/action/test/utest/src/fsm_stub.c54
-rw-r--r--cesar/cp/sta/action/test/utest/src/info.c565
-rw-r--r--cesar/cp/sta/action/test/utest/src/key.c73
-rw-r--r--cesar/cp/sta/action/test/utest/src/msg_stub.c264
-rw-r--r--cesar/cp/sta/action/test/utest/src/poweron.c472
-rw-r--r--cesar/cp/sta/action/test/utest/src/scenario_actions.c137
-rw-r--r--cesar/cp/sta/action/test/utest/src/test_sta_action.c68
-rw-r--r--cesar/cp/sta/core/Module1
-rw-r--r--cesar/cp/sta/core/core.h153
-rw-r--r--cesar/cp/sta/core/defs.h58
-rw-r--r--cesar/cp/sta/core/doc/sta_core.odtbin0 -> 111336 bytes
-rw-r--r--cesar/cp/sta/core/doc/sta_core.xmi382
-rw-r--r--cesar/cp/sta/core/inc/core.h351
-rw-r--r--cesar/cp/sta/core/src/core.c613
-rw-r--r--cesar/cp/sta/core/test/Makefile21
-rw-r--r--cesar/cp/sta/core/test/ecos.ecc.sh5
-rw-r--r--cesar/cp/sta/core/test/override/cp2/inc/context.h27
-rw-r--r--cesar/cp/sta/core/test/override/cp_fsm_defs.h40
-rw-r--r--cesar/cp/sta/core/test/src/action_stub.c23
-rw-r--r--cesar/cp/sta/core/test/src/beacon_stub.c22
-rw-r--r--cesar/cp/sta/core/test/src/cco_action_stub.c28
-rw-r--r--cesar/cp/sta/core/test/src/core.c200
-rw-r--r--cesar/cp/sta/core/test/src/core_events.c187
-rw-r--r--cesar/cp/sta/core/test/src/core_thread.c196
-rw-r--r--cesar/cp/sta/core/test/src/cp_cl_interf_stub.c44
-rw-r--r--cesar/cp/sta/core/test/src/fsm_stub.c47
-rw-r--r--cesar/cp/sta/core/test/src/pwl_stub.c23
-rw-r--r--cesar/cp/sta/core/test/src/sta_mgr_stub.c27
-rw-r--r--cesar/cp/sta/mgr/Module1
-rw-r--r--cesar/cp/sta/mgr/doc/sta_manager.odtbin0 -> 334839 bytes
-rw-r--r--cesar/cp/sta/mgr/doc/sta_mgr.xmi994
-rw-r--r--cesar/cp/sta/mgr/inc/net.h127
-rw-r--r--cesar/cp/sta/mgr/inc/net_list.h35
-rw-r--r--cesar/cp/sta/mgr/inc/sta.h77
-rw-r--r--cesar/cp/sta/mgr/inc/sta_mgr.h32
-rw-r--r--cesar/cp/sta/mgr/inc/sta_own_data.h82
-rw-r--r--cesar/cp/sta/mgr/net.h399
-rw-r--r--cesar/cp/sta/mgr/net_list.h158
-rw-r--r--cesar/cp/sta/mgr/src/net.c969
-rw-r--r--cesar/cp/sta/mgr/src/net_list.c339
-rw-r--r--cesar/cp/sta/mgr/src/sta.c213
-rw-r--r--cesar/cp/sta/mgr/src/sta_mgr.c290
-rw-r--r--cesar/cp/sta/mgr/src/sta_own_data.c391
-rw-r--r--cesar/cp/sta/mgr/sta.h215
-rw-r--r--cesar/cp/sta/mgr/sta_mgr.h159
-rw-r--r--cesar/cp/sta/mgr/sta_own_data.h301
-rw-r--r--cesar/cp/sta/mgr/test/Makefile22
-rw-r--r--cesar/cp/sta/mgr/test/doc/Makefile20
-rw-r--r--cesar/cp/sta/mgr/test/doc/net.txt190
-rw-r--r--cesar/cp/sta/mgr/test/doc/net_list.txt114
-rw-r--r--cesar/cp/sta/mgr/test/doc/sta.txt44
-rw-r--r--cesar/cp/sta/mgr/test/doc/sta_mgr.txt14
-rw-r--r--cesar/cp/sta/mgr/test/doc/sta_own_data.txt111
-rw-r--r--cesar/cp/sta/mgr/test/overide/cp2/inc/context.h38
-rw-r--r--cesar/cp/sta/mgr/test/overide/cp2/sta/core/core.h22
-rw-r--r--cesar/cp/sta/mgr/test/overide/cp_fsm_defs.h38
-rw-r--r--cesar/cp/sta/mgr/test/src/cl_stub.c119
-rw-r--r--cesar/cp/sta/mgr/test/src/core_stub.c23
-rw-r--r--cesar/cp/sta/mgr/test/src/fsm_stub.c29
-rw-r--r--cesar/cp/sta/mgr/test/src/net_list_test.c499
-rw-r--r--cesar/cp/sta/mgr/test/src/net_test.c1117
-rw-r--r--cesar/cp/sta/mgr/test/src/sta-test.c371
-rw-r--r--cesar/cp/sta/mgr/test/src/sta_mgr_test.c289
-rw-r--r--cesar/cp/sta/mgr/test/src/station_test.c209
-rw-r--r--cesar/cp/test/doc/CP Functionnal test plan.odtbin0 -> 1468924 bytes
-rw-r--r--cesar/cp/test/doc/station_manager_function_call.odtbin0 -> 103138 bytes
-rw-r--r--cesar/cp/test/mme/Config1
-rw-r--r--cesar/cp/test/mme/Makefile14
-rw-r--r--cesar/cp/test/mme/src/test_mme.c174
-rw-r--r--cesar/cp/types.h46
377 files changed, 65107 insertions, 0 deletions
diff --git a/cesar/cp/Module b/cesar/cp/Module
new file mode 100644
index 0000000000..8c8ed74751
--- /dev/null
+++ b/cesar/cp/Module
@@ -0,0 +1,6 @@
+SOURCES:= cp.c
+MODULES:=cp/beacon cp/cco/action cp/cco/bw cp/cl_interf \
+cp/conn cp/fsm cp/msg cp/pwl cp/secu cp/sta/action cp/sta/core \
+cp/sta/mgr
+
+$(call src2obj,cp/src/cp.c,target): $(BASE)/cp/fsm/fsm.h
diff --git a/cesar/cp/beacon/Module b/cesar/cp/beacon/Module
new file mode 100644
index 0000000000..8f40d1b229
--- /dev/null
+++ b/cesar/cp/beacon/Module
@@ -0,0 +1,4 @@
+SOURCES:= beacon.c common.c bentry.c bentry_msg.c beacon_discover.c
+
+$(call src2obj,cp/beacon/src/beacon.c,target): $(BASE)/cp/fsm/fsm.h
+$(call src2obj,cp/beacon/src/beacon.c,host): $(BASE)/cp/fsm/fsm.h
diff --git a/cesar/cp/beacon/beacon.h b/cesar/cp/beacon/beacon.h
new file mode 100644
index 0000000000..16e2d870b4
--- /dev/null
+++ b/cesar/cp/beacon/beacon.h
@@ -0,0 +1,146 @@
+#ifndef cp_beacon_beacon_h
+#define cp_beacon_beacon_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/beacon.h
+ * \brief Beacon module public API.
+ * \ingroup cp_beacon
+ *
+ * Beacon module. Use to generate and read a beacon.
+ */
+
+#include "cp/cp.h"
+#include "cp/defs.h"
+#include "cp/beacon/defs.h"
+#include "cp/beacon/beacon_desc.h"
+
+/**
+ * Function call back prototype.
+ * \param user data the user data provided on the callback function
+ * registration.
+ * \param cb the function to call on the event.
+ *
+ * This will post an event in the FSM.
+ */
+typedef void
+(*cp_beacon_event_cb_t) (void *user_data);
+
+/**
+ * Initialise the beacon module.
+ * \param ctx the module context.
+ */
+void
+cp_beacon_init (cp_t *ctx);
+
+/**
+ * Unitialise the beacon module.
+ * \param ctx the module context.
+ */
+void
+cp_beacon_uninit (cp_t *ctx);
+
+/**
+ * Initialise the function to call each time the beacon module needs to
+ * post an event in the FSM.
+ * \param ctx the module context.
+ * \param user_data The user data to provide on function call.
+ * \param cb Function call back.
+ *
+ * Those events are :
+ * - beacon_timer, on this event the FSM shall call the following
+ * functions.
+ * - CCo : send central beacon
+ * - UCo : send discover beacon
+ * - POND : create_default_schedules
+ * - Sta, Usta : beacon not receive.
+ * - beacon_received
+ */
+void
+cp_beacon_init_event_callback (cp_t *ctx, void *user_data,
+ cp_beacon_event_cb_t cb);
+
+/**
+ * Generate and send a beacon when the station acts as a CCo or Unassociated
+ * CCo.
+ * \param ctx the module context.
+ * \param beacon_type The beacon type to send (central, discover or proxy).
+ *
+ */
+void
+cp_beacon_cco_send_beacon (cp_t *ctx, uint beacon_type);
+
+/**
+ * Generate and send a discover beacon.
+ * \param ctx the module context.
+ *
+ */
+extern inline void
+cp_beacon_cco_send_central_beacon (cp_t *ctx)
+{
+ cp_beacon_cco_send_beacon (ctx,
+ CP_BEACON_CENTRAL_BEACON);
+}
+
+/**
+ * Generate and send a discover beacon.
+ * \param ctx the module context.
+ *
+ */
+extern inline void
+cp_beacon_cco_send_discover_beacon (cp_t *ctx)
+{
+ cp_beacon_cco_send_beacon (ctx,
+ CP_BEACON_DISCOVER_BEACON);
+}
+
+/**
+ * Create default schedules and provide it to the Channel Access.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_beacon_create_default_schedules (cp_t *ctx);
+
+/**
+ * This function is only called when the station is acting as a CCo.
+ * \param ctx the module context.
+ * \param snid The new SNID.
+ *
+ * It allows the beacon module to put the change SNID bentry in the central
+ * beacon. Once the count down of the SNID reach 1, the SNID is inserted
+ * in the station own data and in the mac config
+ */
+void
+cp_beacon_change_snid (cp_t *ctx, u8 snid);
+
+/**
+ * Process the first beacon in the received list.
+ * \param ctx the control plane context.
+ */
+void
+cp_beacon_get_and_process_beacon (cp_t *ctx);
+
+/**
+ * Process a tracked network using the central beacon or the proxy beacon.
+ * \param ctx the CP module context.
+ * \param beacon the beacon received and tracked.
+ */
+void
+cp_beacon_process_tracked_avln (cp_t *ctx, cp_beacon_desc_t *beacon);
+
+/**
+ * Function to call once the beacon has not been received.
+ * \param ctx the module context.
+ *
+ * The beacon timer has expired and this function had been called by the FSM.
+ */
+void
+cp_beacon_beacon_not_received (cp_t *ctx);
+
+#endif /* cp_beacon_beacon_h */
diff --git a/cesar/cp/beacon/beacon_desc.h b/cesar/cp/beacon/beacon_desc.h
new file mode 100644
index 0000000000..40c5e50586
--- /dev/null
+++ b/cesar/cp/beacon/beacon_desc.h
@@ -0,0 +1,43 @@
+#ifndef cp_beacon_beacon_desc_h
+#define cp_beacon_beacon_desc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/beacon_desc.h
+ * \brief Beacon object description.
+ * \ingroup cp_beacon
+ *
+ */
+
+#include "mac/pbproc/pbproc.h"
+
+struct cp_beacon_payload_t
+{
+ /** Beacon payload. */
+ u8 beacon_mpdu_payload [8];
+ u8 nbe;
+ /** First bentry. */
+ u8 bmis[119];
+ /** Frame control. */
+ pbproc_rx_beacon_params_t fc;
+};
+typedef struct cp_beacon_payload_t cp_beacon_payload_t;
+
+struct cp_beacon_desc_t
+{
+ /** Not use. */
+ struct cp_beacon_desc_t *next;
+ /** Beacon payload. */
+ cp_beacon_payload_t *payload;
+ /** Beacon nid first four bytes. */
+ uint nid_msb;
+};
+typedef struct cp_beacon_desc_t cp_beacon_desc_t;
+
+
+#endif /* cp_beacon_beacon_desc_h */
diff --git a/cesar/cp/beacon/defs.h b/cesar/cp/beacon/defs.h
new file mode 100644
index 0000000000..b0f66c4754
--- /dev/null
+++ b/cesar/cp/beacon/defs.h
@@ -0,0 +1,105 @@
+#ifndef cp_beacon_defs_h
+#define cp_beacon_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/defs.h
+ * \brief Definition of all enums and types
+ * \ingroup cp_beacon
+ *
+ */
+
+/** Types of possible beacons. */
+enum cp_beacon_types_e
+{
+ CP_BEACON_CENTRAL_BEACON,
+ CP_BEACON_DISCOVER_BEACON,
+ CP_BEACON_PROXY_BEACON,
+ CP_BEACON_TYPE_MAX
+};
+
+/** Hybrid mode. */
+enum cp_beacon_hybrid_mode_e
+{
+ CP_BEACON_HM_AV_ONLY,
+ CP_BEACON_HM_SHARED_CSMA,
+ CP_BEACON_HM_FULLY,
+ CP_BEACON_HM_HYBRID_DELIMITERS,
+ CP_BEACON_HM_MAX
+};
+
+/** Non coordinated mode. */
+enum cp_beacon_non_coordinated_mode_e
+{
+ CP_BEACON_NON_COORDINATED_NETWORK,
+ CP_BEACON_NON_COORDINATED_NETWORK_REPORTED,
+ CP_BEACON_NON_COORDINATED_MAX
+};
+
+/** Power Saving mode. */
+enum cp_beacon_npsm_e
+{
+ CP_BEACON_NPSM_NOT_ACTIVE,
+ CP_BEACON_NPSM_ACTIVE,
+ CP_BEACON_NPSM_MAX
+};
+
+/** Handover in progress. */
+enum cp_beacon_hoip_e
+{
+ CP_BEACON_HOIP_FALSE,
+ CP_BEACON_HOIP_TRUE,
+ CP_BEACON_HOIP_MAX
+};
+
+/** Network mode. */
+enum cp_beacon_nm_e
+{
+ CP_BEACON_NM_UNCOORDINATED,
+ CP_BEACON_NM_COORDINATED,
+ CP_BEACON_NM_CSMA_ONLY,
+ CP_BEACON_NM_MAX
+};
+
+/** CCo Cap. */
+enum cp_beacon_cco_cap_e
+{
+ CP_BEACON_CCO_LEVEL0,
+ CP_BEACON_CCO_LEVEL1,
+ CP_BEACON_CCO_LEVEL2,
+ CP_BEACON_CCO_LEVEL3
+};
+
+/** Bentry header. */
+enum cp_bentry_header_t
+{
+ CP_BENTRY_NON_PERSISTENT_SCHEDULE,
+ CP_BENTRY_PERSISTENT_SCHEDULE,
+ CP_BENTRY_REGIONS,
+ CP_BENTRY_MAC_ADDRESS,
+ CP_BENTRY_DISCOVER,
+ CP_BENTRY_DISCOVER_INFO,
+ CP_BENTRY_BEACON_PERIOD_START_OFFSET,
+ CP_BENTRY_ENCRYPTION_KEY_CHANGE,
+ CP_BENTRY_CCO_HANDOVER,
+ CP_BENTRY_BEACON_RELOCATION,
+ CP_BENTRY_AC_LINE_SYNC_COUNTDOWN,
+ CP_BENTRY_CHANGE_NUMSLOTS,
+ CP_BENTRY_CHANGE_HM,
+ CP_BENTRY_CHANGE_SNID,
+ CP_BENTRY_VENDOR=0xFF
+};
+
+enum cp_beacon_bentry_read_write_e
+{
+ CP_BEACON_BENTRY_READ,
+ CP_BEACON_BENTRY_WRITE
+};
+
+
+#endif /* cp_beacon_defs_h */
diff --git a/cesar/cp/beacon/doc/Makefile b/cesar/cp/beacon/doc/Makefile
new file mode 100644
index 0000000000..aa8dc6af31
--- /dev/null
+++ b/cesar/cp/beacon/doc/Makefile
@@ -0,0 +1,19 @@
+PAGES = receivebeacon processingbeacon bentry_mgr discover-process add-to-sched
+
+TOOLS_DIR = ../../../common/tools
+DOTFLAGS = -Gbgcolor='\#f7f7f7' -Nstyle=filled -Nfillcolor=white
+CONVERTFLAGS = -border 1 -bordercolor '\#d7d7d7'
+
+
+png: $(PAGES:%=%.png)
+ps: $(PAGES:%=%.ps)
+
+%.png: %.ps
+ convert $(CONVERTFLAGS) $< $@
+ rm -f $<
+
+%.ps: %.sdl $(TOOLS_DIR)/sdl.ps $(TOOLS_DIR)/sdl2dot
+ $(TOOLS_DIR)/sdl2dot $< | dot $(DOTFLAGS) -Tps -l $(TOOLS_DIR)/sdl.ps -o $@
+
+clean:
+ rm -f $(PAGES:%=%.png)
diff --git a/cesar/cp/beacon/doc/add-to-sched.sdl b/cesar/cp/beacon/doc/add-to-sched.sdl
new file mode 100644
index 0000000000..7e487ceef5
--- /dev/null
+++ b/cesar/cp/beacon/doc/add-to-sched.sdl
@@ -0,0 +1,5 @@
+(IDLE) -> <cd != 0>
+<cd != 0> -no-> (IDLE)
+<cd != 0> -yes-> <cd <= 3>
+<cd <= 3> -no-> (IDLE)
+<cd <= 3> -yes-> |Add to schedules|
diff --git a/cesar/cp/beacon/doc/beacon-spec.odt b/cesar/cp/beacon/doc/beacon-spec.odt
new file mode 100644
index 0000000000..0605b7f14a
--- /dev/null
+++ b/cesar/cp/beacon/doc/beacon-spec.odt
Binary files differ
diff --git a/cesar/cp/beacon/doc/beacon-study.odt b/cesar/cp/beacon/doc/beacon-study.odt
new file mode 100644
index 0000000000..62047077cb
--- /dev/null
+++ b/cesar/cp/beacon/doc/beacon-study.odt
Binary files differ
diff --git a/cesar/cp/beacon/doc/beacons.xmi b/cesar/cp/beacon/doc/beacons.xmi
new file mode 100644
index 0000000000..be471344f3
--- /dev/null
+++ b/cesar/cp/beacon/doc/beacons.xmi
@@ -0,0 +1,712 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-08-28T10:33:16" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.5</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="R9NuP1byDcOU" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eVuCjs6naR38" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="cnaRv3q3OkSQ" isRoot="false" isAbstract="false" name="boolean" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="KOdwl5INaBZH" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3f3c56khsI8l" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="MyoigH80dkxO" isRoot="false" isAbstract="false" name="byte" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nFjMOIdSwg41" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="lmib4oMOmB7Q" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QDR1xMOjZ75y" isRoot="false" isAbstract="false" name="String" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QTe9foTn6zxN" isRoot="false" isAbstract="false" name="cp_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5YxBXuZ7VHyB" isRoot="false" isAbstract="false" name="cp_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="93yNIJC7iLRJ" isRoot="false" isAbstract="false" name="cp_beacon_desc_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="sSOkyZ3vfjJC" isRoot="false" isAbstract="false" name="cp_beacon_desc_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oDq9Iugm7iv1" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QVpFZRIuBTNW" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="o3tgJr755xDL" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qt7va3x0WkF5" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="9VyLxLpjMhQd" isRoot="false" isAbstract="false" name="uint" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="YXjbSuwIn4EL" isRoot="false" isAbstract="false" name="void *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="fJgTLenqU1j3" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="2pjetCZaTBxu" isRoot="false" isAbstract="false" name="u8 *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="lZ62VwEYQKdt" isRoot="false" isAbstract="false" name="mac_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BlYll2hD2fUk" isRoot="false" isAbstract="false" name="pbproc_tx_beacon_params_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="FS9GybcB0p5o" isRoot="false" isAbstract="false" name="mfs_tx_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="MAfpg7Apertx" isRoot="false" isAbstract="false" name="cp_sta_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="MTWZA8u8WYSg" isRoot="false" isAbstract="false" name="cp_net_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ohGDMWCtIAFk" isRoot="false" isAbstract="false" name="pbproc_tx_beacon_params_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="I9jv9yhyWUaz" isRoot="false" isAbstract="false" name="hal_timer_instance_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="RxxAih1R7pg2" isRoot="false" isAbstract="false" name="cyg_handle_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CtUyy6YUakdg" isRoot="false" isAbstract="false" name="cyg_alarm" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CePeTGkuBf2t" isRoot="false" isAbstract="false" name="cyg_counter" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CGLMN5YS6jdy" isRoot="false" isAbstract="false" name="uint *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="f3gZVQ3FuZSY" isRoot="false" isAbstract="false" name="cp_beacon_event_cb_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ghnnHqGwuwTP" isRoot="false" isAbstract="false" name="cp_beacon_event_cb_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0QZEFHQEiQMq" isRoot="false" isAbstract="false" name="set_node_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ENtuoDkBuZzk" isRoot="false" isAbstract="false" name="set_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="npZAIdUT2QF5" isRoot="false" isAbstract="false" name="set_node_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="yFO1XmG9x3DS" isRoot="false" isAbstract="false" name="set_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZLFbWWdB5CjX" isRoot="false" isAbstract="false" name="cyg_addrword_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="4qLBhCnKB5U1" isRoot="false" isAbstract="false" name="cp_beacon_bentry_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="987UJ7hWCXCk" isRoot="false" isAbstract="false" name="u8 **" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Cgf1eAHBCkYy" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="aXm9AJGoGfHX" isRoot="false" isAbstract="false" name="cp_beacon_work_beacon_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="sqzKWBiy4p2m" isRoot="false" isAbstract="false" name="cp_beacon_common_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="v6WaaUrdS1Jv" isRoot="false" isAbstract="false" name="circular_buffer_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="npXyneDYnGAk" isRoot="false" isAbstract="false" name="cp_tei_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="jPVvvXoCdyei" isRoot="false" isAbstract="false" name="cp_tei_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xVJCfErtFJpQ" isRoot="false" isAbstract="false" name="cp_snid_t" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class comment="Beacon module. Use to generate and read a beacon." isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="NiCCTMNHialM" isRoot="false" isAbstract="false" name="cp_beacon_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Circular buffer of beacons." isSpecification="false" visibility="private" xmi.id="ztR22PRRfzxc" type="sSOkyZ3vfjJC" name="list" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="684" type="sSOkyZ3vfjJC" name="list_tail" />
+ <UML:Attribute comment="table of beacon received." isSpecification="false" visibility="private" xmi.id="oloPbj9IOHgn" type="2pjetCZaTBxu" name="beacon_list[10]" />
+ <UML:Attribute comment="Bentry manager." isSpecification="false" visibility="private" xmi.id="16U2YvTJxiuS" type="l6bOvueVxeym" name="bentry" />
+ <UML:Attribute comment="Central beacon environment." isSpecification="false" visibility="private" xmi.id="mUavKhrt5Qso" type="S9eUo7DcuX3j" name="central" />
+ <UML:Attribute comment="Discover beacon environment." isSpecification="false" visibility="private" xmi.id="ZTjeucQLNU0V" type="S9eUo7DcuX3j" name="discover" />
+ <UML:Attribute comment="Proxy beacon environment." isSpecification="false" visibility="private" xmi.id="ZMhwrhPy4npv" type="S9eUo7DcuX3j" name="proxy" />
+ <UML:Attribute comment="The leon timer to be programmed and awake each beacon periood.
+Each time the timer expires, the function register by the beacon shall post an event in the FSM." isSpecification="false" visibility="private" xmi.id="ZQsAqVucddIr" type="I9jv9yhyWUaz" name="leon_timer" />
+ <UML:Attribute comment="The ecos timer to use when the duration time is too long for the leon timer." isSpecification="false" visibility="private" xmi.id="K3KQrzS1quxo" type="CePeTGkuBf2t" name="ecos_timer" />
+ <UML:Attribute comment="The ecos timer handler." isSpecification="false" visibility="private" xmi.id="0VGYDtEPYc2z" type="RxxAih1R7pg2" name="ecos_timer_handle" />
+ <UML:Attribute comment="The ecos Alarm, It allows ecos to raise an alarm when the timer expires." isSpecification="false" visibility="private" xmi.id="smt2PvthxE7o" type="CtUyy6YUakdg" name="alarm" />
+ <UML:Attribute comment="The alarm handler." isSpecification="false" visibility="private" xmi.id="BXn1RlnPE3yS" type="RxxAih1R7pg2" name="alarm_handle" />
+ <UML:Attribute comment="The function to call on timer expiration." isSpecification="false" visibility="private" xmi.id="Hs122ihhPUUg" type="ghnnHqGwuwTP" name="event_cb" />
+ <UML:Attribute comment="The data to provide on event_cb." isSpecification="false" visibility="private" xmi.id="JiaDc3awYC9a" type="YXjbSuwIn4EL" name="event_user_data" />
+ <UML:Attribute comment="The CA schedule index." isSpecification="false" visibility="private" xmi.id="K8WFXRnPmzVR" type="9VyLxLpjMhQd" name="ca_sched_index" />
+ <UML:Operation comment="Initialise the beacon module." isSpecification="false" isLeaf="false" visibility="public" xmi.id="CA57xXjh1tLI" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Unitialise the beacon module." isSpecification="false" isLeaf="false" visibility="public" xmi.id="L3pJY5PiAveK" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Generate and send a beacon when the station acts as a CCo or Unassociated CCo." isSpecification="false" isLeaf="false" visibility="public" xmi.id="0WCJ0FyuKdd2" isRoot="false" isAbstract="false" isQuery="false" name="cco_send_beacon" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon type to send (central, discover or proxy)." isSpecification="false" visibility="public" xmi.id="OCIItttuQ6DO" value="" type="dEeErjr5mvtk" name="beacon_type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Generate and send a discover beacon." isSpecification="false" isLeaf="false" visibility="public" xmi.id="09aBIX1GwDYC" isRoot="false" isAbstract="true" isQuery="false" name="cco_send_central_beacon" />
+ <UML:Operation comment="Generate and send a discover beacon." isSpecification="false" isLeaf="false" visibility="public" xmi.id="7Q51o9CCSKS6" isRoot="false" isAbstract="true" isQuery="false" name="cco_send_discover_beacon" />
+ <UML:Operation comment="Create default schedules and provide it to the Channel Access." isSpecification="false" isLeaf="false" visibility="public" xmi.id="7A7gOonaDENp" isRoot="false" isAbstract="false" isQuery="false" name="create_default_schedules" />
+ <UML:Operation comment="This function is only called when the station is acting as a CCo. It allows the beacon module to put the change snid bentry in the central beacon.
+Once the count down of the snid reach 1, the snid is inserted in the station own data and in the mac config." isSpecification="false" isLeaf="false" visibility="public" xmi.id="My0G0MlRzsZO" isRoot="false" isAbstract="false" isQuery="false" name="change_snid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The new SNID." isSpecification="false" visibility="public" xmi.id="O2bshvJCONUu" value="" type="oDq9Iugm7iv1" name="snid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Poq0pI6lwlc6" isRoot="false" isAbstract="false" isQuery="false" name="get_and_process_beacon" />
+ <UML:Operation comment="The beacon received from the AVLN. Add the beacon to the list of received beacon, and raise the flag beacon received in STA_CORE." isSpecification="false" isLeaf="false" visibility="private" xmi.id="rOBKdX15uXBI" isRoot="false" isAbstract="false" isQuery="false" name="receive" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon received." isSpecification="false" visibility="public" xmi.id="x8gQXtHc1NIQ" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Verify the conflict of SNID. If the snid corresponds too our SNID and the NID does not match, it shall post a message in the FSM to prevent the CCo Core." isSpecification="false" isLeaf="false" visibility="private" xmi.id="tsreDSBVehfS" isRoot="false" isAbstract="false" isQuery="false" name="detect_snid_conficts" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon's SNID beeing process." isSpecification="false" visibility="public" xmi.id="0ZcfYXFQN44Z" value="" type="oDq9Iugm7iv1" name="beacon_snid" />
+ <UML:Parameter comment="The beacon's NID." isSpecification="false" visibility="public" xmi.id="LmBUNLgNuG0S" value="" type="QVpFZRIuBTNW" name="beacons_nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Verify if the AVLN exists in the sta_mgr. If not it shall create the AVLN with the data provided.
+If the AVLN exists it shall update the AVLN data.
+If the Beacon is from our AVLN and the stei does not correspond to the CCo, it shall update the AVLN in the sta manager and post an event in the FSM." isSpecification="false" isLeaf="false" visibility="private" xmi.id="zv9gFq6tPba0" isRoot="false" isAbstract="false" isQuery="false" name="verify_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon's SNID." isSpecification="false" visibility="public" xmi.id="4UvKFzWb2fud" value="" type="oDq9Iugm7iv1" name="beacon_snid" />
+ <UML:Parameter comment="The beacon's NID." isSpecification="false" visibility="public" xmi.id="XRHYRsuQl36z" value="" type="QVpFZRIuBTNW" name="beacon_nid" />
+ <UML:Parameter comment="The source TEI." isSpecification="false" visibility="public" xmi.id="sBsHkSFow87B" value="" type="o3tgJr755xDL" name="stei" />
+ <UML:Parameter comment="The beacon type." isSpecification="false" visibility="public" xmi.id="7dk7Jfko40MV" value="" type="o3tgJr755xDL" name="beacon_type" />
+ <UML:Parameter comment="The mac address of the station which has sent the beacon (if present in the bentry)." isSpecification="false" visibility="public" xmi.id="qEtZFxY78QMr" value="" type="fJgTLenqU1j3" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="convert the schedules which are in ATU to tck to provide it to the CA." isSpecification="false" isLeaf="false" visibility="private" xmi.id="WjDaBE0E6MWu" isRoot="false" isAbstract="false" isQuery="false" name="schedules_to_ca" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The set containing the schedules." isSpecification="false" visibility="private" xmi.id="qTrEQxuSFHkx" value="" type="ENtuoDkBuZzk" name="set" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Update the hrybrid mode in the station. Update the Mac config and the station own data." isSpecification="false" isLeaf="false" visibility="private" xmi.id="M3yrFjCPpQa3" isRoot="false" isAbstract="false" isQuery="false" name="hybridmode_update" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The new value of the hybrid mode." isSpecification="false" visibility="public" xmi.id="cLesgh82oN2s" value="" type="o3tgJr755xDL" name="hm" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Function call each time a timer expires." isSpecification="false" isLeaf="false" visibility="private" xmi.id="fbZaTgIl6vm5" isRoot="false" isAbstract="false" isQuery="false" name="timer_expires" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The alarm" isSpecification="false" visibility="private" xmi.id="aR3545LVrvsr" value="" type="RxxAih1R7pg2" name="alarm" />
+ <UML:Parameter comment="The CP context." isSpecification="false" visibility="private" xmi.id="t0Gxt23UR4XV" value="" type="ZLFbWWdB5CjX" name="data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the variant fields of the beacon." isSpecification="false" isLeaf="false" visibility="private" xmi.id="7s0yntoKC3vi" isRoot="false" isAbstract="false" isQuery="false" name="xcco_common_part" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon to fill." isSpecification="false" visibility="private" xmi.id="XXrbjb8aZOYS" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The structure to store the data or containing the data." isSpecification="false" visibility="private" xmi.id="3mRAIE5tYRvD" value="" type="aXm9AJGoGfHX" name="data" />
+ <UML:Parameter comment="Read or write the data to/from the beacon.
+Read = true
+write = false." isSpecification="false" visibility="private" xmi.id="7i3l7xWNQeUy" value="" type="cnaRv3q3OkSQ" name="read_write" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Provide the beacon to the CA to be send over the PWL." isSpecification="false" isLeaf="false" visibility="private" xmi.id="zaQX1Lk61lp6" isRoot="false" isAbstract="false" isQuery="false" name="provide_beacon_to_ca" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon to provide to the CA." isSpecification="false" visibility="private" xmi.id="iLT6yv4RxpcH" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The beacon type." isSpecification="false" visibility="private" xmi.id="HxfWjA0gkQDj" value="" type="9VyLxLpjMhQd" name="beacon_type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="Tv64jV1zxtAU" isRoot="false" isAbstract="false" isQuery="false" name="compute_ca_schedules" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Common part." isSpecification="false" visibility="private" xmi.id="I3lFxvj8DVGs" value="" type="sqzKWBiy4p2m" name="common" />
+ <UML:Parameter comment="The hybrid mode." isSpecification="false" visibility="private" xmi.id="VxkQjBIvXmtw" value="" type="o3tgJr755xDL" name="hybrid_mode" />
+ <UML:Parameter comment="The schedules provided from the BW or read in a central beacon." isSpecification="false" visibility="private" xmi.id="2BNzYJvPons1" value="" type="yFO1XmG9x3DS" name="schedules" />
+ <UML:Parameter comment="The becon period start time offset read in a central beacon. 0 if the station is CCo." isSpecification="false" visibility="private" xmi.id="kAIhwELP95oq" value="" type="9VyLxLpjMhQd" name="bpsto" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process the central or proxy beacon." isSpecification="false" isLeaf="false" visibility="private" xmi.id="Er0c4eQx1VrR" isRoot="false" isAbstract="false" isQuery="false" name="process_central_proxy" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon previously received." isSpecification="false" visibility="private" xmi.id="9qpkwgA3yDB0" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The variant fields of the beacon previously read." isSpecification="false" visibility="private" xmi.id="MNc1S97e08H4" value="" type="aXm9AJGoGfHX" name="beacon_vf" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process the discover beacon." isSpecification="false" isLeaf="false" visibility="private" xmi.id="Er0c4eQx1VrR" isRoot="false" isAbstract="false" isQuery="false" name="process_discover" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon previously received." isSpecification="false" visibility="private" xmi.id="9qpkwgA3yDB0" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The variant fields of the beacon previously read." isSpecification="false" visibility="private" xmi.id="MNc1S97e08H4" value="" type="aXm9AJGoGfHX" name="beacon_vf" />
+ <UML:Parameter comment="The network previously added." isSpecification="false" visibility="private" xmi.id="iAy2aNnKGVXd" value="" type="MTWZA8u8WYSg" name="net" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read the regions of the central beacon from another AVLN." isSpecification="false" isLeaf="false" visibility="private" xmi.id="Er0c4eQx1VrR" isRoot="false" isAbstract="false" isQuery="false" name="cp_beacon_process_central_read_regions" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon previously received." isSpecification="false" visibility="private" xmi.id="9qpkwgA3yDB0" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The variant fields of the beacon previously read." isSpecification="false" visibility="private" xmi.id="MNc1S97e08H4" value="" type="aXm9AJGoGfHX" name="beacon_vf" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Generate and send a discover beacon after the request of the" isSpecification="false" isLeaf="false" visibility="public" xmi.id="F0wVjjEaBupg" isRoot="false" isAbstract="false" isQuery="false" name="send_discover" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The central beacon containing the request to send the discover beacon." isSpecification="false" visibility="private" xmi.id="erW1HvYGffbb" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ <UML:Parameter comment="The beacon variant fields read from the central beacon." isSpecification="false" visibility="private" xmi.id="H1maBK7QK1v1" value="" type="6rRf6PlfSsWH" name="beacon_vf" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Function to call once the beacon has not been received.
+The beacon timer has expired and this function had been called by the FSM." isSpecification="false" isLeaf="false" visibility="public" xmi.id="283" isRoot="false" isAbstract="false" isQuery="false" name="beacon_not_received" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="dEeErjr5mvtk" isRoot="false" isAbstract="false" name="cp_beacon_type_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="dEeErjr5mvtk" xmi.id="R6d2pxd3ZrvJ" isRoot="false" isAbstract="false" name="CP_BEACON_CENTRAL_BEACON" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="dEeErjr5mvtk" xmi.id="dyAC3z5U5iUt" isRoot="false" isAbstract="false" name="CP_BEACON_DISCOVER_BEACON" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="dEeErjr5mvtk" xmi.id="HX9OlCAM8KYB" isRoot="false" isAbstract="false" name="CP_BEACON_PROXY_BACON" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Vd2VI0H78FNa" isRoot="false" isAbstract="false" name="cp_pwl_fequency_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="Vd2VI0H78FNa" xmi.id="o1VyuW0O91rP" isRoot="false" isAbstract="false" name="CP_PWL_FREQ_60" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="Vd2VI0H78FNa" xmi.id="WsUNEfH2emyZ" isRoot="false" isAbstract="false" name="CP_PWL_FREQ_50" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" comment="Values possible for the theorical values of the beacon period in ntb ticks." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="WynxBsM8ngv1" isRoot="false" isAbstract="false" name="cp_pwl_bp_t" >
+ <UML:EnumerationLiteral comment="1 000 000 ticks." isSpecification="false" isLeaf="false" visibility="public" namespace="WynxBsM8ngv1" xmi.id="Q2E40q7VmuSv" isRoot="false" isAbstract="false" name="CP_PWL_BP_50" />
+ <UML:EnumerationLiteral comment="833 333 ticks." isSpecification="false" isLeaf="false" visibility="public" namespace="WynxBsM8ngv1" xmi.id="aTaIt9hH9vJA" isRoot="false" isAbstract="false" name="CP_PWL_BP_60" />
+ </UML:Enumeration>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="l6bOvueVxeym" isRoot="false" isAbstract="false" name="cp_beacon_bentry_mgr_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Previous countdown of the Persistent Schedule Bentry." isSpecification="false" visibility="public" xmi.id="EOdPHwR1twjV" type="o3tgJr755xDL" name="persistent_schedule_pscd" />
+ <UML:Attribute comment="Current coutndown of the Persistent Schedule." isSpecification="false" visibility="public" xmi.id="PA5z4i5toSeZ" type="o3tgJr755xDL" name="persistent_schedule_cscd" />
+ <UML:Attribute comment="Encryption key change countdown." isSpecification="false" visibility="public" xmi.id="1T13LxkqNstK" type="o3tgJr755xDL" name="eks_kccd" />
+ <UML:Attribute comment="The key which is bein change. 0 for nek, 1 for nmk." isSpecification="false" visibility="public" xmi.id="xcQqOsUxcJCp" type="cnaRv3q3OkSQ" name="eks_kbc" />
+ <UML:Attribute comment="The eks index to use once the countdown has expired." isSpecification="false" visibility="public" xmi.id="53sSvmksOAhm" type="o3tgJr755xDL" name="eks_neweks" />
+ <UML:Attribute comment="Handover in progress countdown." isSpecification="false" visibility="public" xmi.id="IYlXII8Ij9J4" type="o3tgJr755xDL" name="handover_cd" />
+ <UML:Attribute comment="The new CCo tei. This will be inserted in the bentry until the countdown does not expire." isSpecification="false" visibility="public" xmi.id="19ibSsRkQAGg" type="o3tgJr755xDL" name="handover_newtei" />
+ <UML:Attribute comment="Beacon relocation bentry countdown." isSpecification="false" visibility="public" xmi.id="JZr4x1IdReaa" type="o3tgJr755xDL" name="relocation_cd" />
+ <UML:Attribute comment="The relocation type." isSpecification="false" visibility="public" xmi.id="7pqg6xcIpLK4" type="cnaRv3q3OkSQ" name="relocation_type" />
+ <UML:Attribute comment="Relocation leaving group flag." isSpecification="false" visibility="public" xmi.id="B251tkRCJIEE" type="cnaRv3q3OkSQ" name="relocation_lgf" />
+ <UML:Attribute comment="The relocation in the beacon period. A single value corresponds to 0.32 micro seconds i.e. 0x1 corresponds to 0.32 micro seconds, 2 corresponds to 0.64 micro seconds and so on." isSpecification="false" visibility="public" xmi.id="hSxyi9A0ezgm" type="9VyLxLpjMhQd" name="relocation_rlo" />
+ <UML:Attribute comment="The relocation slot id." isSpecification="false" visibility="public" xmi.id="Pz0c5ut7NSvB" type="o3tgJr755xDL" name="relocation_slotid" />
+ <UML:Attribute comment="The AC line sync countdown." isSpecification="false" visibility="public" xmi.id="JpABk8vPasLH" type="o3tgJr755xDL" name="acl_cd" />
+ <UML:Attribute comment="The AC Line sync reason code." isSpecification="false" visibility="public" xmi.id="0VFeVvQstPSy" type="o3tgJr755xDL" name="acl_reason_code" />
+ <UML:Attribute comment="Numslots change countdown." isSpecification="false" visibility="public" xmi.id="HL3elzp4mzDX" type="o3tgJr755xDL" name="numslot_cd" />
+ <UML:Attribute comment="New number of slots." isSpecification="false" visibility="public" xmi.id="89ugzGxzlAdG" type="o3tgJr755xDL" name="numslots_new" />
+ <UML:Attribute comment="Change Hybrid mode countdown." isSpecification="false" visibility="public" xmi.id="628zPavgtwLe" type="o3tgJr755xDL" name="hm_cd" />
+ <UML:Attribute comment="The new hybrid mode value." isSpecification="false" visibility="public" xmi.id="vAhi8uDG37u1" type="o3tgJr755xDL" name="hm_new" />
+ <UML:Attribute comment="Change snid countdown." isSpecification="false" visibility="public" xmi.id="Nq090cN4cU11" type="o3tgJr755xDL" name="snid_cd" />
+ <UML:Attribute comment="The new snid to change." isSpecification="false" visibility="public" xmi.id="4wfyt0am9HSH" type="xVJCfErtFJpQ" name="snid_new" />
+ <UML:Attribute comment="The discover context." isSpecification="false" visibility="public" xmi.id="dKCSOea5360x" type="tp3zqQkaUmuu" name="discover" />
+ <UML:Operation comment="Initialise the bentry mgr." isSpecification="false" isLeaf="false" visibility="public" xmi.id="HWpi8PJGD7uJ" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Uninitialise the bentry manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="2UZqotuztx0m" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Decrements the countdowns. for each countdown which will expire (value equals 1) an associated event is raise in the FSM." isSpecification="false" isLeaf="false" visibility="public" xmi.id="SMyBTFGYI8yC" isRoot="false" isAbstract="false" isQuery="false" name="countdown" />
+ <UML:Operation comment="Fill or read the bentries in the beacon.
+If shall determine the beacon type by reading it in the beacon payload." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ejdZRcjBmSUA" isRoot="false" isAbstract="false" isQuery="false" name="beacon_read" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon to read or to fill." isSpecification="false" visibility="public" xmi.id="5cTlhTsakHGj" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Write the bentries of the beacon." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Q4ePpX1hkhMj" isRoot="false" isAbstract="false" isQuery="false" name="beacon_write" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The beacon to write." isSpecification="false" visibility="private" xmi.id="JU0Ugk1eIg0p" value="" type="sSOkyZ3vfjJC" name="beacon" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Store the stat in the destination pointer provided." isSpecification="false" isLeaf="false" visibility="public" xmi.id="zxRJBSP3YALr" isRoot="false" isAbstract="false" isQuery="false" name="schedule_data" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="the structure containing the data." isSpecification="false" visibility="private" xmi.id="YONRluIkrh13" value="" type="fgqEbHKwwkrs" name="data" />
+ <UML:Parameter comment="the current index value." isSpecification="false" visibility="private" xmi.id="9R4fZNWC1LRa" value="" type="9VyLxLpjMhQd" name="index" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Schedules index corresponding to the one in the Channel Access." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="S9eUo7DcuX3j" isRoot="false" isAbstract="false" name="cp_beacon_common_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The beacon period start time offset address to provide it to the pbproc." isSpecification="false" visibility="public" xmi.id="ggfRnOp4Wjxb" type="BlYll2hD2fUk" name="bpsto" />
+ <UML:Attribute comment="Number of beacon received." isSpecification="false" visibility="public" xmi.id="EA7KDBs7wYPb" type="9VyLxLpjMhQd" name="nb_beacon_recv" />
+ <UML:Attribute comment="Number of beacon failled." isSpecification="false" visibility="public" xmi.id="1j3sJDPZkkA9" type="9VyLxLpjMhQd" name="nb_beacon_failed" />
+ <UML:Attribute comment="The MFS to send the beacon." isSpecification="false" visibility="public" xmi.id="13P2s4jHWviH" type="FS9GybcB0p5o" name="mfs" />
+ <UML:Attribute comment="The ntb date corresponding to the last date a beacon has been sent or received." isSpecification="false" visibility="public" xmi.id="0aLeQbRRMJzH" type="9VyLxLpjMhQd" name="last_beacon_ntb" />
+ <UML:Operation comment="Initialise the context." isSpecification="false" isLeaf="false" visibility="public" xmi.id="nUEsIQXy51Hu" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Unititliase the context" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WtPraqCWmMmO" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="KyQ6lKdcy6SY" isRoot="false" isAbstract="false" name="cp_beacon_bentry_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Current bentry address." isSpecification="false" visibility="public" xmi.id="RWSpXOSTNtvs" type="2pjetCZaTBxu" name="bentry_addr" />
+ <UML:Attribute comment="The bentry header." isSpecification="false" visibility="public" xmi.id="R4WDRaKjYjpH" type="9VyLxLpjMhQd" name="header" />
+ <UML:Attribute comment="The length in bytes." isSpecification="false" visibility="public" xmi.id="3TrzXJYwpymN" type="9VyLxLpjMhQd" name="length" />
+ <UML:Attribute comment="Read or write the bentry." isSpecification="false" visibility="public" xmi.id="AqJRrcRZSjue" type="cnaRv3q3OkSQ" name="read_write" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="6rRf6PlfSsWH" isRoot="false" isAbstract="false" name="cp_beacon_work_beacon_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The 22 msb bits of the NID." isSpecification="false" visibility="public" xmi.id="xxZKgCnZi49D" type="9VyLxLpjMhQd" name="nid_msb" />
+ <UML:Attribute comment="The NID lsb 32 bits." isSpecification="false" visibility="public" xmi.id="pGO8XAMCSrHL" type="9VyLxLpjMhQd" name="nid_lsb" />
+ <UML:Attribute comment="Hybrid mode." isSpecification="false" visibility="public" xmi.id="wBXYfr0bnXvR" type="o3tgJr755xDL" name="hm" />
+ <UML:Attribute comment="Source TEI." isSpecification="false" visibility="public" xmi.id="ki0Sn8eaO2gv" type="npXyneDYnGAk" name="stei" />
+ <UML:Attribute comment="Beacon type." isSpecification="false" visibility="public" xmi.id="A36csLvnWSLA" type="o3tgJr755xDL" name="bt" />
+ <UML:Attribute comment="Non coordinated network report." isSpecification="false" visibility="public" xmi.id="IJl3rgUbNT18" type="cnaRv3q3OkSQ" name="ncnr" />
+ <UML:Attribute comment="Network power saving mode." isSpecification="false" visibility="public" xmi.id="bfixfOrqPxQI" type="o3tgJr755xDL" name="npsm" />
+ <UML:Attribute comment="Number of slots." isSpecification="false" visibility="public" xmi.id="GM5nmOv4hg5Y" type="9VyLxLpjMhQd" name="num_slots" />
+ <UML:Attribute comment="mask of slots in use." isSpecification="false" visibility="public" xmi.id="Ka7h39nemVZS" type="o3tgJr755xDL" name="slot_usage" />
+ <UML:Attribute comment="Slod identifier." isSpecification="false" visibility="public" xmi.id="sQIHLgXc2aNn" type="o3tgJr755xDL" name="slot_id" />
+ <UML:Attribute comment="The slots number of the network tracking the Power line." isSpecification="false" visibility="public" xmi.id="wIrewxAGVGwY" type="o3tgJr755xDL" name="aclss" />
+ <UML:Attribute comment="Handover in progress." isSpecification="false" visibility="public" xmi.id="NjA9Djb58rKT" type="cnaRv3q3OkSQ" name="hoip" />
+ <UML:Attribute comment="The communication on the AVLN shall use the RTS Broadcast flag to communicate." isSpecification="false" visibility="public" xmi.id="Ys5YQSLNkBze" type="cnaRv3q3OkSQ" name="rstbf" />
+ <UML:Attribute comment="Network mode." isSpecification="false" visibility="public" xmi.id="67tbNp7kWFsh" type="o3tgJr755xDL" name="nm" />
+ <UML:Attribute comment="CCo Capability." isSpecification="false" visibility="public" xmi.id="wRm4H7YpxbLL" type="o3tgJr755xDL" name="cco_cap" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="BRZRZeOQHv7A" isRoot="false" isAbstract="false" name="cp_beacon_bentry_msg_t" >
+ <UML:Classifier.feature>
+ <UML:Operation comment="Read or write the bentry header." isSpecification="false" isLeaf="false" visibility="public" xmi.id="o7fQ9q3hFkbG" isRoot="false" isAbstract="false" isQuery="false" name="process_header" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The bentry context." isSpecification="false" visibility="private" xmi.id="MtqwKNO2F2Hq" value="" type="4qLBhCnKB5U1" name="bentry_ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process the schedules.
+The same function reads or write the persistent and non persistent schedules, for the non_persistent boolean provided in parameter indicate which kind of schedule this function will process.
+\Warn This function will not provide the schedules to the Channel Access." isSpecification="false" isLeaf="false" visibility="public" xmi.id="hI0dJNhG5k0K" isRoot="false" isAbstract="false" isQuery="false" name="schedules" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The bentry context." isSpecification="false" visibility="public" xmi.id="1RJ9QnqzvBoJ" value="" type="4qLBhCnKB5U1" name="bentry" />
+ <UML:Parameter comment="The set contaning the allocation or to store the allocations." isSpecification="false" visibility="private" xmi.id="5Es1qaY7f7GG" value="" type="yFO1XmG9x3DS" name="set" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the regions in the beacon. When reading the regions it shall directly update the data in the region manager (only in CCo mode). On the write process it shall get the regions from the region manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="YqHnu25ItGIu" isRoot="false" isAbstract="false" isQuery="false" name="regions" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The bentry context." isSpecification="false" visibility="public" xmi.id="KxFYkXrTUoA0" value="" type="4qLBhCnKB5U1" name="bentry" />
+ <UML:Parameter comment="Read or write processing." isSpecification="false" visibility="public" xmi.id="c4BFTMfzAwm4" value="" type="cnaRv3q3OkSQ" name="read_write" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the mac address in the beacon. If the reading boolean is set, it will store the mac address stocked in the bentry in the parameter provided." isSpecification="false" isLeaf="false" visibility="public" xmi.id="VmmxYwxAz6PS" isRoot="false" isAbstract="false" isQuery="false" name="mac_address" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The bentry context." isSpecification="false" visibility="public" xmi.id="R3PbzBeu01l5" value="" type="4qLBhCnKB5U1" name="bentry" />
+ <UML:Parameter comment="The mac address to store or the variable to set when it is reading a mac address bentry." isSpecification="false" visibility="public" xmi.id="5U85Tr85JaEg" value="" type="lZ62VwEYQKdt" name="mac_address" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write a discover info bentry. It will directly use the data from the sta manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="bKhu6exehnPG" isRoot="false" isAbstract="false" isQuery="false" name="discover_info_bentry" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The bentry start address." isSpecification="false" visibility="public" xmi.id="tPkobIEwu64e" value="" type="4qLBhCnKB5U1" name="bentry" />
+ <UML:Parameter comment="The station source TEI." isSpecification="false" visibility="public" xmi.id="UlVUQIBcren7" value="" type="2pjetCZaTBxu" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write a discover bentry. If write it will request to next station in the station manager to request a discover beacon. This will call the station manager to get the next station corresponding to the station discover variable." isSpecification="false" isLeaf="false" visibility="public" xmi.id="KEv0os0ZbMXQ" isRoot="false" isAbstract="false" isQuery="false" name="discover" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The start of the bentry address." isSpecification="false" visibility="public" xmi.id="h3LbRiIJYORY" value="" type="4qLBhCnKB5U1" name="bentry" />
+ <UML:Parameter comment="The station TEI." isSpecification="false" visibility="private" xmi.id="gyLgR9aeNB0D" value="" type="CGLMN5YS6jdy" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the bpsto. store the address of the bpsto in the bpsto variable of the beacon_common structure data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="bnflIhKyMIae" isRoot="false" isAbstract="false" isQuery="false" name="bpsto" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Bentry start address." isSpecification="false" visibility="public" xmi.id="3KWX3mhF5vTl" value="" type="4qLBhCnKB5U1" name="bentry" />
+ <UML:Parameter comment="To store the address of the beacon period start time offset." isSpecification="false" visibility="public" xmi.id="pmB0a2h9pMs5" value="" type="987UJ7hWCXCk" name="bpsto" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the encryption key change bentry. on write it use the data stored in the context. On read it shall update the context data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="jGZnzqHsYZHh" isRoot="false" isAbstract="false" isQuery="false" name="eks_change" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The start address bentry." isSpecification="false" visibility="public" xmi.id="NtzQjWufJJDh" value="" type="2pjetCZaTBxu" name="bentry" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the CCo Handover bentry. on write it use the data stored in the context. On read it shall update the context data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="jGZnzqHsYZHh" isRoot="false" isAbstract="false" isQuery="false" name="hoip_change" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The start address bentry." isSpecification="false" visibility="public" xmi.id="NtzQjWufJJDh" value="" type="2pjetCZaTBxu" name="bentry" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the beacon relocation bentry. on write it use the data stored in the context. On read it shall update the context data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="jGZnzqHsYZHh" isRoot="false" isAbstract="false" isQuery="false" name="relocation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The start address bentry." isSpecification="false" visibility="public" xmi.id="NtzQjWufJJDh" value="" type="2pjetCZaTBxu" name="bentry" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the beacon AC line bentry. on write it use the data stored in the context. On read it shall update the context data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="jGZnzqHsYZHh" isRoot="false" isAbstract="false" isQuery="false" name="acl" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The start address bentry." isSpecification="false" visibility="public" xmi.id="NtzQjWufJJDh" value="" type="2pjetCZaTBxu" name="bentry" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the change numslots bentry. on write it use the data stored in the context. On read it shall update the context data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="jGZnzqHsYZHh" isRoot="false" isAbstract="false" isQuery="false" name="num_slots_change" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The start address bentry." isSpecification="false" visibility="public" xmi.id="NtzQjWufJJDh" value="" type="2pjetCZaTBxu" name="bentry" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the Hm change. on write it use the data stored in the context. On read it shall update the context data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="jGZnzqHsYZHh" isRoot="false" isAbstract="false" isQuery="false" name="hm_change" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The start address bentry." isSpecification="false" visibility="public" xmi.id="NtzQjWufJJDh" value="" type="2pjetCZaTBxu" name="bentry" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Read or write the Change SNID. on write it use the data stored in the context. On read it shall update the context data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="jGZnzqHsYZHh" isRoot="false" isAbstract="false" isQuery="false" name="snid_change" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The start address bentry." isSpecification="false" visibility="public" xmi.id="NtzQjWufJJDh" value="" type="2pjetCZaTBxu" name="bentry" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tp3zqQkaUmuu" isRoot="false" isAbstract="false" name="cp_beacon_discover_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Last TEI request for a discover beacon." isSpecification="false" visibility="public" xmi.id="vrSezv5Nd5AP" type="npXyneDYnGAk" name="tei_last" />
+ <UML:Attribute comment="The previous discover interval between the one no discover beacon is requested.
+pwl.bp_max_discover / num of station in the AVLN." isSpecification="false" visibility="public" xmi.id="YY3si99WRvcW" type="R9NuP1byDcOU" name="prev_disc_int_bp" />
+ <UML:Attribute comment="The discover interval between the one no discover beacon is requested.
+pwl.bp_max_discover / num of station in the AVLN." isSpecification="false" visibility="public" xmi.id="gQy7ue0hfyV6" type="R9NuP1byDcOU" name="discover_interval_bp" />
+ <UML:Attribute comment="The next discover beacon to request countdown.
+When 0, add a discover bentry.
+If next tei is 0. the CCo shall send a discover beacon." isSpecification="false" visibility="public" xmi.id="3bbggm5KA2P4" type="R9NuP1byDcOU" name="countdown_bp" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="SHU2N6PRCQtz" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Compute the interval in beacon periods." isSpecification="false" isLeaf="false" visibility="public" xmi.id="eNjKLEQ0IyQG" isRoot="false" isAbstract="false" isQuery="false" name="compute_interval" />
+ <UML:Operation comment="Verify if any request shall be done." isSpecification="false" isLeaf="false" visibility="public" xmi.id="PA7gKfvNEW2s" isRoot="false" isAbstract="false" isQuery="false" name="need_to_request" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1343" type="cnaRv3q3OkSQ" />
+ <UML:Parameter comment="The TEI to request.
+0 = The CCo shall send a discover beacon." isSpecification="false" visibility="private" xmi.id="I5AS7ZUmxD4G" value="" type="jPVvvXoCdyei" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fgqEbHKwwkrs" isRoot="false" isAbstract="false" name="cp_beacon_bentry_sched_data_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Countdown value." isSpecification="false" visibility="public" xmi.id="seOtxnUXWz1x" type="9VyLxLpjMhQd" name="cd" />
+ <UML:Attribute comment="Destination to store the value." isSpecification="false" visibility="public" xmi.id="LLw41MYb2l2N" type="CGLMN5YS6jdy" name="dest" />
+ <UML:Attribute comment="Value to use at the end of the countdown." isSpecification="false" visibility="public" xmi.id="zTqaxykpa6jY" type="9VyLxLpjMhQd" name="value_at_end" />
+ <UML:Attribute comment="The current value." isSpecification="false" visibility="public" xmi.id="uB3OA5MTOIWN" type="9VyLxLpjMhQd" name="value" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="47rF58Y2yD87" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="3VELTkGEa9mr" aggregation="none" type="NiCCTMNHialM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yJIHzCz0urB4" aggregation="none" type="Cgf1eAHBCkYy" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="r6p2osooXEU8" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="4YzKNtWPnhHX" aggregation="none" type="l6bOvueVxeym" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="0FOpkzZGnJFz" aggregation="none" type="BRZRZeOQHv7A" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1027" snapy="10" showatts="1" xmi.id="u4iNIXCkUpAT" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="0" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1219" >
+ <widgets>
+ <classwidget usesdiagramfillcolour="0" width="736" showattsigs="601" usesdiagramusefillcolour="0" x="5" y="623" showopsigs="601" linewidth="none" fillcolour="#ffffc0" height="592" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="NiCCTMNHialM" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,50,1,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="450" showattsigs="601" usesdiagramusefillcolour="1" x="17" y="6" showopsigs="601" linewidth="none" fillcolour="none" height="448" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="l6bOvueVxeym" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="262" showattsigs="601" usesdiagramusefillcolour="1" x="761" y="578" showopsigs="601" linewidth="none" fillcolour="none" height="128" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="S9eUo7DcuX3j" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="154" showattsigs="601" usesdiagramusefillcolour="1" x="524" y="280" showopsigs="601" linewidth="none" fillcolour="none" height="88" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="KyQ6lKdcy6SY" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="196" showattsigs="601" usesdiagramusefillcolour="1" x="706" y="267" showopsigs="601" linewidth="none" fillcolour="none" height="264" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="6rRf6PlfSsWH" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="456" showattsigs="601" usesdiagramusefillcolour="1" x="506" y="0" showopsigs="601" linewidth="none" fillcolour="none" height="248" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="BRZRZeOQHv7A" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="291" showattsigs="601" usesdiagramusefillcolour="1" x="16" y="483" showopsigs="601" linewidth="none" fillcolour="none" height="128" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="tp3zqQkaUmuu" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="237" showattsigs="601" usesdiagramusefillcolour="1" x="411" y="503" showopsigs="601" linewidth="none" fillcolour="none" height="88" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="fgqEbHKwwkrs" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="BRZRZeOQHv7A" widgetaid="l6bOvueVxeym" xmi.id="r6p2osooXEU8" linecolor="none" >
+ <linepath>
+ <startpoint startx="467" starty="230" />
+ <endpoint endx="506" endy="124" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="tp3zqQkaUmuu" widgetaid="l6bOvueVxeym" xmi.id="dKCSOea5360x" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="167" starty="454" />
+ <endpoint endx="161" endy="483" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="70" usesdiagramusefillcolour="1" x="163" y="461" linewidth="none" posttext="" role="710" fillcolour="none" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="133" text="discover" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="201" totalcountb="3" indexb="2" linewidth="none" widgetbid="l6bOvueVxeym" widgetaid="NiCCTMNHialM" xmi.id="16U2YvTJxiuS" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="373" starty="623" />
+ <endpoint endx="317" endy="454" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="48" usesdiagramusefillcolour="1" x="319" y="456" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="822" showstereotype="1" text="bentry" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="1" visibilityB="201" totalcountb="4" indexb="1" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="mUavKhrt5Qso" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="741" starty="771" />
+ <endpoint endx="826" endy="706" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="51" usesdiagramusefillcolour="1" x="839" y="708" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="827" showstereotype="1" text="central" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="2" visibilityB="201" totalcountb="4" indexb="2" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="ZTjeucQLNU0V" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="741" starty="919" />
+ <endpoint endx="892" endy="706" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="60" usesdiagramusefillcolour="1" x="873" y="708" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="832" text="discover" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="3" visibilityB="201" totalcountb="4" indexb="3" linewidth="none" widgetbid="S9eUo7DcuX3j" widgetaid="NiCCTMNHialM" xmi.id="ZMhwrhPy4npv" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="741" starty="1067" />
+ <endpoint endx="957" endy="706" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="43" usesdiagramusefillcolour="1" x="912" y="708" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="-" isinstance="0" xmi.id="837" showstereotype="1" text="proxy" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="0mgFoIemQMcL" isRoot="false" isAbstract="false" name="PWL" />
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="lHfwr4V0kP0u" isRoot="false" isAbstract="false" name="FSM" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="u4iNIXCkUpAT" documentation="" uniqueid="1343" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="807" id="u4iNIXCkUpAT" label="diagramme de classes" />
+ <listitem open="0" type="813" id="l6bOvueVxeym" >
+ <listitem open="0" type="814" id="EOdPHwR1twjV" />
+ <listitem open="0" type="814" id="PA5z4i5toSeZ" />
+ <listitem open="0" type="814" id="1T13LxkqNstK" />
+ <listitem open="0" type="814" id="xcQqOsUxcJCp" />
+ <listitem open="0" type="814" id="53sSvmksOAhm" />
+ <listitem open="0" type="814" id="IYlXII8Ij9J4" />
+ <listitem open="0" type="814" id="19ibSsRkQAGg" />
+ <listitem open="0" type="814" id="JZr4x1IdReaa" />
+ <listitem open="0" type="814" id="7pqg6xcIpLK4" />
+ <listitem open="0" type="814" id="B251tkRCJIEE" />
+ <listitem open="0" type="814" id="hSxyi9A0ezgm" />
+ <listitem open="0" type="814" id="Pz0c5ut7NSvB" />
+ <listitem open="0" type="814" id="JpABk8vPasLH" />
+ <listitem open="0" type="814" id="0VFeVvQstPSy" />
+ <listitem open="0" type="814" id="HL3elzp4mzDX" />
+ <listitem open="0" type="814" id="89ugzGxzlAdG" />
+ <listitem open="0" type="814" id="628zPavgtwLe" />
+ <listitem open="0" type="814" id="vAhi8uDG37u1" />
+ <listitem open="0" type="814" id="Nq090cN4cU11" />
+ <listitem open="0" type="814" id="4wfyt0am9HSH" />
+ <listitem open="0" type="814" id="dKCSOea5360x" />
+ <listitem open="0" type="815" id="HWpi8PJGD7uJ" />
+ <listitem open="0" type="815" id="2UZqotuztx0m" />
+ <listitem open="0" type="815" id="SMyBTFGYI8yC" />
+ <listitem open="0" type="815" id="ejdZRcjBmSUA" />
+ <listitem open="0" type="815" id="Q4ePpX1hkhMj" />
+ <listitem open="0" type="815" id="zxRJBSP3YALr" />
+ </listitem>
+ <listitem open="0" type="813" id="BRZRZeOQHv7A" >
+ <listitem open="0" type="815" id="o7fQ9q3hFkbG" />
+ <listitem open="0" type="815" id="hI0dJNhG5k0K" />
+ <listitem open="0" type="815" id="YqHnu25ItGIu" />
+ <listitem open="0" type="815" id="VmmxYwxAz6PS" />
+ <listitem open="0" type="815" id="bKhu6exehnPG" />
+ <listitem open="0" type="815" id="KEv0os0ZbMXQ" />
+ <listitem open="0" type="815" id="bnflIhKyMIae" />
+ <listitem open="0" type="815" id="jGZnzqHsYZHh" />
+ <listitem open="0" type="815" id="jGZnzqHsYZHh" />
+ <listitem open="0" type="815" id="jGZnzqHsYZHh" />
+ <listitem open="0" type="815" id="jGZnzqHsYZHh" />
+ <listitem open="0" type="815" id="jGZnzqHsYZHh" />
+ <listitem open="0" type="815" id="jGZnzqHsYZHh" />
+ <listitem open="0" type="815" id="jGZnzqHsYZHh" />
+ </listitem>
+ <listitem open="1" type="813" id="fgqEbHKwwkrs" >
+ <listitem open="0" type="814" id="seOtxnUXWz1x" />
+ <listitem open="0" type="814" id="LLw41MYb2l2N" />
+ <listitem open="0" type="814" id="zTqaxykpa6jY" />
+ <listitem open="0" type="814" id="uB3OA5MTOIWN" />
+ </listitem>
+ <listitem open="0" type="813" id="KyQ6lKdcy6SY" >
+ <listitem open="0" type="814" id="RWSpXOSTNtvs" />
+ <listitem open="0" type="814" id="R4WDRaKjYjpH" />
+ <listitem open="0" type="814" id="3TrzXJYwpymN" />
+ <listitem open="0" type="814" id="AqJRrcRZSjue" />
+ </listitem>
+ <listitem open="0" type="813" id="S9eUo7DcuX3j" >
+ <listitem open="0" type="814" id="ggfRnOp4Wjxb" />
+ <listitem open="0" type="814" id="EA7KDBs7wYPb" />
+ <listitem open="0" type="814" id="1j3sJDPZkkA9" />
+ <listitem open="0" type="814" id="13P2s4jHWviH" />
+ <listitem open="0" type="814" id="0aLeQbRRMJzH" />
+ <listitem open="0" type="815" id="nUEsIQXy51Hu" />
+ <listitem open="0" type="815" id="WtPraqCWmMmO" />
+ </listitem>
+ <listitem open="0" type="813" id="tp3zqQkaUmuu" >
+ <listitem open="0" type="814" id="vrSezv5Nd5AP" />
+ <listitem open="0" type="814" id="YY3si99WRvcW" />
+ <listitem open="0" type="814" id="gQy7ue0hfyV6" />
+ <listitem open="0" type="814" id="3bbggm5KA2P4" />
+ <listitem open="0" type="815" id="SHU2N6PRCQtz" />
+ <listitem open="0" type="815" id="eNjKLEQ0IyQG" />
+ <listitem open="0" type="815" id="PA7gKfvNEW2s" />
+ </listitem>
+ <listitem open="1" type="813" id="NiCCTMNHialM" >
+ <listitem open="0" type="814" id="ztR22PRRfzxc" />
+ <listitem open="0" type="814" id="684" />
+ <listitem open="0" type="814" id="oloPbj9IOHgn" />
+ <listitem open="0" type="814" id="16U2YvTJxiuS" />
+ <listitem open="0" type="814" id="mUavKhrt5Qso" />
+ <listitem open="0" type="814" id="ZTjeucQLNU0V" />
+ <listitem open="0" type="814" id="ZMhwrhPy4npv" />
+ <listitem open="0" type="814" id="ZQsAqVucddIr" />
+ <listitem open="0" type="814" id="K3KQrzS1quxo" />
+ <listitem open="0" type="814" id="0VGYDtEPYc2z" />
+ <listitem open="0" type="814" id="smt2PvthxE7o" />
+ <listitem open="0" type="814" id="BXn1RlnPE3yS" />
+ <listitem open="0" type="814" id="Hs122ihhPUUg" />
+ <listitem open="0" type="814" id="JiaDc3awYC9a" />
+ <listitem open="0" type="814" id="K8WFXRnPmzVR" />
+ <listitem open="0" type="815" id="CA57xXjh1tLI" />
+ <listitem open="0" type="815" id="L3pJY5PiAveK" />
+ <listitem open="0" type="815" id="0WCJ0FyuKdd2" />
+ <listitem open="0" type="815" id="09aBIX1GwDYC" />
+ <listitem open="0" type="815" id="7Q51o9CCSKS6" />
+ <listitem open="0" type="815" id="7A7gOonaDENp" />
+ <listitem open="0" type="815" id="My0G0MlRzsZO" />
+ <listitem open="0" type="815" id="Poq0pI6lwlc6" />
+ <listitem open="0" type="815" id="rOBKdX15uXBI" />
+ <listitem open="0" type="815" id="tsreDSBVehfS" />
+ <listitem open="0" type="815" id="zv9gFq6tPba0" />
+ <listitem open="0" type="815" id="WjDaBE0E6MWu" />
+ <listitem open="0" type="815" id="M3yrFjCPpQa3" />
+ <listitem open="0" type="815" id="fbZaTgIl6vm5" />
+ <listitem open="0" type="815" id="7s0yntoKC3vi" />
+ <listitem open="0" type="815" id="zaQX1Lk61lp6" />
+ <listitem open="0" type="815" id="Tv64jV1zxtAU" />
+ <listitem open="0" type="815" id="Er0c4eQx1VrR" />
+ <listitem open="0" type="815" id="Er0c4eQx1VrR" />
+ <listitem open="0" type="815" id="Er0c4eQx1VrR" />
+ <listitem open="0" type="815" id="F0wVjjEaBupg" />
+ <listitem open="0" type="815" id="283" />
+ </listitem>
+ <listitem open="0" type="813" id="6rRf6PlfSsWH" >
+ <listitem open="0" type="814" id="xxZKgCnZi49D" />
+ <listitem open="0" type="814" id="pGO8XAMCSrHL" />
+ <listitem open="0" type="814" id="wBXYfr0bnXvR" />
+ <listitem open="0" type="814" id="ki0Sn8eaO2gv" />
+ <listitem open="0" type="814" id="A36csLvnWSLA" />
+ <listitem open="0" type="814" id="IJl3rgUbNT18" />
+ <listitem open="0" type="814" id="bfixfOrqPxQI" />
+ <listitem open="0" type="814" id="GM5nmOv4hg5Y" />
+ <listitem open="0" type="814" id="Ka7h39nemVZS" />
+ <listitem open="0" type="814" id="sQIHLgXc2aNn" />
+ <listitem open="0" type="814" id="wIrewxAGVGwY" />
+ <listitem open="0" type="814" id="NjA9Djb58rKT" />
+ <listitem open="0" type="814" id="Ys5YQSLNkBze" />
+ <listitem open="0" type="814" id="67tbNp7kWFsh" />
+ <listitem open="0" type="814" id="wRm4H7YpxbLL" />
+ </listitem>
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="QDR1xMOjZ75y" />
+ <listitem open="1" type="829" id="cnaRv3q3OkSQ" />
+ <listitem open="1" type="829" id="MyoigH80dkxO" />
+ <listitem open="1" type="829" id="eVuCjs6naR38" />
+ <listitem open="1" type="829" id="v6WaaUrdS1Jv" />
+ <listitem open="1" type="829" id="4qLBhCnKB5U1" />
+ <listitem open="1" type="829" id="sqzKWBiy4p2m" />
+ <listitem open="1" type="829" id="93yNIJC7iLRJ" />
+ <listitem open="1" type="829" id="sSOkyZ3vfjJC" />
+ <listitem open="1" type="829" id="f3gZVQ3FuZSY" />
+ <listitem open="1" type="829" id="ghnnHqGwuwTP" />
+ <listitem open="1" type="829" id="aXm9AJGoGfHX" />
+ <listitem open="1" type="829" id="MTWZA8u8WYSg" />
+ <listitem open="1" type="829" id="xVJCfErtFJpQ" />
+ <listitem open="1" type="829" id="MAfpg7Apertx" />
+ <listitem open="1" type="829" id="QTe9foTn6zxN" />
+ <listitem open="1" type="829" id="5YxBXuZ7VHyB" />
+ <listitem open="1" type="829" id="npXyneDYnGAk" />
+ <listitem open="1" type="829" id="jPVvvXoCdyei" />
+ <listitem open="1" type="829" id="ZLFbWWdB5CjX" />
+ <listitem open="1" type="829" id="CtUyy6YUakdg" />
+ <listitem open="1" type="829" id="CePeTGkuBf2t" />
+ <listitem open="1" type="829" id="RxxAih1R7pg2" />
+ <listitem open="1" type="829" id="3f3c56khsI8l" />
+ <listitem open="1" type="829" id="KOdwl5INaBZH" />
+ <listitem open="1" type="829" id="I9jv9yhyWUaz" />
+ <listitem open="1" type="829" id="R9NuP1byDcOU" />
+ <listitem open="1" type="829" id="lmib4oMOmB7Q" />
+ <listitem open="1" type="829" id="fJgTLenqU1j3" />
+ <listitem open="1" type="829" id="lZ62VwEYQKdt" />
+ <listitem open="1" type="829" id="FS9GybcB0p5o" />
+ <listitem open="1" type="829" id="ohGDMWCtIAFk" />
+ <listitem open="1" type="829" id="BlYll2hD2fUk" />
+ <listitem open="1" type="829" id="0QZEFHQEiQMq" />
+ <listitem open="1" type="829" id="npZAIdUT2QF5" />
+ <listitem open="1" type="829" id="ENtuoDkBuZzk" />
+ <listitem open="1" type="829" id="yFO1XmG9x3DS" />
+ <listitem open="1" type="829" id="nFjMOIdSwg41" />
+ <listitem open="1" type="829" id="oDq9Iugm7iv1" />
+ <listitem open="1" type="829" id="qt7va3x0WkF5" />
+ <listitem open="1" type="829" id="QVpFZRIuBTNW" />
+ <listitem open="1" type="829" id="o3tgJr755xDL" />
+ <listitem open="1" type="829" id="2pjetCZaTBxu" />
+ <listitem open="1" type="829" id="987UJ7hWCXCk" />
+ <listitem open="1" type="829" id="9VyLxLpjMhQd" />
+ <listitem open="1" type="829" id="CGLMN5YS6jdy" />
+ <listitem open="0" type="829" id="Cgf1eAHBCkYy" />
+ <listitem open="1" type="829" id="YXjbSuwIn4EL" />
+ </listitem>
+ <listitem open="0" type="831" id="dEeErjr5mvtk" >
+ <listitem open="0" type="839" id="R6d2pxd3ZrvJ" />
+ <listitem open="0" type="839" id="dyAC3z5U5iUt" />
+ <listitem open="0" type="839" id="HX9OlCAM8KYB" />
+ </listitem>
+ <listitem open="0" type="831" id="WynxBsM8ngv1" >
+ <listitem open="0" type="839" id="Q2E40q7VmuSv" />
+ <listitem open="0" type="839" id="aTaIt9hH9vJA" />
+ </listitem>
+ <listitem open="0" type="831" id="Vd2VI0H78FNa" >
+ <listitem open="0" type="839" id="o1VyuW0O91rP" />
+ <listitem open="0" type="839" id="WsUNEfH2emyZ" />
+ </listitem>
+ </listitem>
+ <listitem open="0" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="lHfwr4V0kP0u" />
+ <listitem open="1" type="811" id="0mgFoIemQMcL" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/beacon/doc/bentry_mgr.odt b/cesar/cp/beacon/doc/bentry_mgr.odt
new file mode 100644
index 0000000000..2409538221
--- /dev/null
+++ b/cesar/cp/beacon/doc/bentry_mgr.odt
Binary files differ
diff --git a/cesar/cp/beacon/doc/bentry_mgr.sdl b/cesar/cp/beacon/doc/bentry_mgr.sdl
new file mode 100644
index 0000000000..6730ace54a
--- /dev/null
+++ b/cesar/cp/beacon/doc/bentry_mgr.sdl
@@ -0,0 +1,47 @@
+|regions| -> |persistent schedules|
+|persistent schedules| -> |non persistent schedules|
+|non persistent schedules| -> <CSMA Only>
+
+<CSMA Only> -yes-> |BPSTO|
+|BPSTO| -> <station to discover>
+<CSMA Only> -no-> <station to discover>
+
+<station to discover> -yes-> |discover bentry|
+|discover bentry| -> <key change>
+<station to discover> -no-> <key change>
+
+<key change> -yes-> |encryption key change|
+|encryption key change| -> <handover>
+<key change> -no-> <handover>
+
+<handover> -yes-> |CCo handover|
+|CCo handover| -> <beacon relocation>
+<handover> -no-> <beacon relocation>
+
+<beacon relocation> -yes-> |beacon relocation bentry|
+|beacon relocation bentry| -> <acl sync>
+<beacon relocation> -no-> <acl sync>
+
+<acl sync> -yes-> |AC Line sync|
+|AC Line sync| -> <change numslots>
+<acl sync> -no-> <change numslots>
+
+<change numslots> -yes-> |Change numSlots|
+|Change numSlots| -> <change HM>
+<change numslots> -no-> <change HM>
+
+<change HM> -yes-> |Change HM|
+|Change HM| -> <change SNID>
+<change HM> -no-> <change SNID>
+
+<change SNID> -yes-> |Change SNID|
+|Change SNID| -> <space available>
+<change SNID> -no-> <space available>
+
+<space available> -yes-> |Mac Address|
+|Mac Address| -> <still space available>
+<space available> -no-> |End|
+
+<still space available> -yes-> |Discover bentry|
+|Discover bentry| -> |End|
+<still space available> -no-> |End|
diff --git a/cesar/cp/beacon/doc/discover-need-to-request.dot b/cesar/cp/beacon/doc/discover-need-to-request.dot
new file mode 100644
index 0000000000..d9e15548ec
--- /dev/null
+++ b/cesar/cp/beacon/doc/discover-need-to-request.dot
@@ -0,0 +1,18 @@
+digraph G
+{
+ node [color=lightblue2, style=filled]; "return STA TEI"; "return STA own data TEI"; "return STA next TEI";
+ node [shape=ellipse style=solid];
+
+ IDLE -> "return STA own data TEI" [label="last_tei == 0"];
+ IDLE -> "get first STA" [label = "last_tei == own TEI"];
+ IDLE -> "get STA" [label = "last_tei != own TEI"];
+
+ "get first STA" -> "return STA TEI" [label = "STA != NULL"];
+ "get first STA" -> "return STA own data TEI" [label = "STA == NULL"];
+
+ "get STA" -> "return STA own data TEI" [label = "STA == NULL"];
+ "get STA" -> "get STA next" [label = "STA != NULL"];
+
+ "get STA next" -> "return STA own data TEI" [label = "STA next == NULL"];
+ "get STA next" -> "return STA next TEI" [label = "STA next != NULL"];
+}
diff --git a/cesar/cp/beacon/doc/discover-process.sdl b/cesar/cp/beacon/doc/discover-process.sdl
new file mode 100644
index 0000000000..9ee416e979
--- /dev/null
+++ b/cesar/cp/beacon/doc/discover-process.sdl
@@ -0,0 +1,10 @@
+(need to request) -> |Compute interval|
+|Compute interval| -> <prev_disc_int_bp \n - \n discover_int_bp \n = 0>
+<prev_disc_int_bp \n - \n discover_int_bp \n = 0> -yes-> |Countdown decrease|
+<prev_disc_int_bp \n - \n discover_int_bp \n = 0> -no-> |Adjust Countdown|
+
+|Countdown decrease| -> <countdown lesser than 0>
+|Adjust Countdown| -> <countdown lesser than 0>
+
+<countdown lesser than 0> -yes-> |return true \n TEI = next sta|
+<countdown lesser than 0> -no-> | return false|
diff --git a/cesar/cp/beacon/doc/processingbeacon.sdl b/cesar/cp/beacon/doc/processingbeacon.sdl
new file mode 100644
index 0000000000..f6130d018e
--- /dev/null
+++ b/cesar/cp/beacon/doc/processingbeacon.sdl
@@ -0,0 +1,21 @@
+(idle) -beacon received-> > beacon |
+
+> beacon | -> | Get sta own data |
+
+| Get sta own data | -> <tracked AVLN>
+<tracked AVLN> -yes-> ||NTB sync||
+||NTB sync|| -> | add AVLN |
+
+<tracked AVLN> -no-> | add AVLN |
+| add AVLN | -> < our AVLN >
+
+< our AVLN > -no-> <sta is CCo>
+
+<sta is CCo> -no-> (idle)
+<sta is CCo> -yes-> ||read regions||
+||read regions|| -> (idle)
+
+< our AVLN > -yes-> <beacon type>
+<beacon type> -central beacon-> ||central beacon||
+<beacon type> -discover beacon-> ||discover beacon||
+<beacon type> -proxy beacon-> ||proxy beacon||
diff --git a/cesar/cp/beacon/doc/receivebeacon.sdl b/cesar/cp/beacon/doc/receivebeacon.sdl
new file mode 100644
index 0000000000..c227c6a0a8
--- /dev/null
+++ b/cesar/cp/beacon/doc/receivebeacon.sdl
@@ -0,0 +1,5 @@
+(|receive beacon|)
+
+(|receive beacon|) -> |chain|
+|chain| -> |post event \n beacon received>
+
diff --git a/cesar/cp/beacon/inc/beacon.h b/cesar/cp/beacon/inc/beacon.h
new file mode 100644
index 0000000000..c74f951b0f
--- /dev/null
+++ b/cesar/cp/beacon/inc/beacon.h
@@ -0,0 +1,252 @@
+#ifndef cp_beacon_inc_beacon_h
+#define cp_beacon_inc_beacon_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/cp_beacon_private.h
+ * \brief Beacon private data.
+ * \ingroup cp_beacon
+ *
+ */
+
+#include <cyg/hal/hal_arch.h>
+#include <cyg/kernel/kapi.h>
+
+#include "lib/circular_buffer.h"
+
+// Public ones.
+#include "hal/timer/timer.h"
+#include "cp/sta/mgr/net.h"
+
+// Private ones.
+#include "cp/beacon/inc/bentry.h"
+#include "cp/beacon/inc/common.h"
+#include "cp/beacon/inc/beacon_work.h"
+
+/**
+ * Beacon module. Use to generate and read a beacon.
+ */
+struct cp_beacon_t
+{
+ /** circular list manager for the beacon reception. */
+ cp_beacon_desc_t *list;
+ cp_beacon_desc_t *list_tail;
+
+ /** Bentry manager. */
+ cp_beacon_bentry_mgr_t bentry;
+
+ /**
+ * Central beacon environment.
+ */
+ cp_beacon_common_t central;
+
+ /**
+ * Discover beacon environment.
+ */
+ cp_beacon_common_t discover;
+
+ /**
+ * Proxy beacon environment.
+ */
+ cp_beacon_common_t proxy;
+
+ /**
+ * Schedules index corresponding to the one in the Channel Access.
+ */
+ u16 ca_schedule_index;
+
+ /**
+ * The leon timer to be programmed and awake each beacon period.
+ * Each time the timer expires, the function register by the beacon
+ * shall post an event in the FSM.
+ */
+ hal_timer_instance_t leon_timer;
+
+ /**
+ * The eCos timer to use when the duration time is too long for the
+ * leon timer.
+ */
+ cyg_counter ecos_timer;
+
+ /**
+ * The ecos timer handler.
+ */
+ cyg_handle_t ecos_timer_handle;
+
+ /**
+ * The eCos Alarm, It allows eCos to raise an alarm when the timer
+ * expires.
+ */
+ cyg_alarm alarm;
+
+ /**
+ * The alarm handler.
+ */
+ cyg_handle_t alarm_handle;
+
+ /**
+ * The function to call on timer expiration.
+ */
+ cp_beacon_event_cb_t event_cb;
+
+ /**
+ * The data to provide on event_cb.
+ */
+ void *event_user_data;
+};
+typedef struct cp_beacon_t cp_beacon_t;
+
+/**
+ * The beacon received from the AVLN.
+ * \param ctx the module context.
+ * \param beacon The beacon received.
+ *
+ * Add the beacon to the list of received beacon, and raise the flag
+ * beacon received in STA_CORE
+ */
+void
+cp_beacon_receive (cp_t *ctx, cp_beacon_desc_t * beacon);
+
+/**
+ * Verify the conflict of SNID.
+ * \param ctx the module context.
+ * \param beacon_snid The beacon's SNID beeing process.
+ * \param beacons_nid The beacon's NID.
+ *
+ * If the snid corresponds too our SNID and the NID does not match, it
+ * shall post a message in the FSM to prevent the CCo Core
+ */
+void
+cp_beacon_detect_snid_conficts (cp_beacon_t *ctx, u8 beacon_snid,
+ u64 beacons_nid);
+
+/**
+ * Verify if the AVLN exists in the sta_mgr.
+ * \param ctx the module context.
+ * \param beacon_snid The beacon's SNID.
+ * \param beacon_nid The beacon's NID.
+ * \param stei The source TEI.
+ * \param beacon_type The beacon type.
+ * \param mac_addr The mac address of the station which has sent the
+ * beacon (if present in the bentry).
+ *
+ * If not it shall create the AVLN with the data provided. If the AVLN
+ * exists it shall update the AVLN data. If the Beacon is from our AVLN
+ * and the stei does not correspond to the CCo, it shall update the AVLN
+ * in the sta manager and post an event in the FSM
+ */
+void
+cp_beacon_verify_avln (cp_t *ctx, u8 beacon_snid, u64 beacon_nid,
+ u8 stei, u8 beacon_type, mac_t mac_addr);
+
+/**
+ * Update the hrybrid mode in the station.
+ * \param ctx the module context.
+ * \param hm The new value of the hybrid mode.
+ *
+ * Update the Mac config and the station own data
+ */
+void
+cp_beacon_hybridmode_update (cp_beacon_t *ctx, u8 hm);
+
+/** Timer expires.
+ * \param alarm the alarm provided.
+ * \param data the context.
+ */
+void
+cp_beacon_timer_expires (cyg_handle_t alarm, cyg_addrword_t data);
+
+/**
+ * Fill the payload of the beacon when the STA is acting as CCo or UCCo.
+ * \param ctx the beacon module context
+ * \param beacon the beacon to fill.
+ * \param data The structure containing the data to read and store in the
+ * beacon or to fill when reading it from the beacon.
+ * \param read_write provide the way to use it. True to read, false to write.
+ *
+ * Can be use for
+ * - the Central beacon when acting as a CCo
+ * - the discover beacon when acting as a UCCo.
+ */
+void
+cp_beacon_variant_fields (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *data, bool read_write);
+
+
+/**
+ * Send the beacon over the PWL.
+ * TODO Implement the proxy beacon part
+ *
+ * \param ctx the CP beacon context
+ * \param beacon the beacon to send
+ * \param beacon_type the beacon type.
+ * \param mac_address the station own mac address.
+ */
+void
+cp_beacon_send_beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ uint beacon_type, mac_t mac_address);
+
+
+/** Compute the CA schedules using the allocation defined in the bw module.
+ * \param ctx the CP context.
+ * \param common the beacon context (central, discover, proxy)
+ * \param hybrid_mode the hybrid mode of the medium
+ * \param schedules the schedules computed from the BW or read in the
+ * beacon.
+ * \param bpsto the beacon period start time offset received in a beacon.
+ */
+void
+cp_beacon_compute_ca_schedules (cp_t *ctx, cp_beacon_common_t *common,
+ uint hybrid_mode, set_t *schedules,
+ uint bpsto);
+
+/**
+ * Process a central or proxy beacon.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the beacon received.
+ * \param beacon_vf the variant fields previously read from the beacon.
+ */
+void
+cp_beacon_process_central_proxy (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf);
+
+/**
+ * Process a discover beacon.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the beacon received.
+ * \param beacon_vf the variant fields previously read from the beacon.
+ * \param net the AVLN previously found
+ */
+void
+cp_beacon_process_discover (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf,
+ cp_net_t *net);
+
+/**
+ * Read the regions of the central beacon from another AVLN.
+ *
+ * \param ctx the Module context.
+ * \param beacon the beacon to process.
+ * \param beacon_vf the variant fields previously read.
+ */
+void
+cp_beacon_process_central_read_regions (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf);
+
+/** Generate and send a discover beacon from the central or proxy beacon.
+ * \param ctx the CP context.
+ * \param beacon the central or proxy beacon containing the query.
+ * \param beacon_vf the variant filled read from the beacon.
+ */
+void
+cp_beacon_sta_send_discover_beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t beacon_vf);
+
+#endif /* cp_beacon_inc_beacon_h */
diff --git a/cesar/cp/beacon/inc/beacon_discover.h b/cesar/cp/beacon/inc/beacon_discover.h
new file mode 100644
index 0000000000..dc99f49154
--- /dev/null
+++ b/cesar/cp/beacon/inc/beacon_discover.h
@@ -0,0 +1,89 @@
+#ifndef cp_beacon_inc_beacon_discover_h
+#define cp_beacon_inc_beacon_discover_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/inc/beacon_discover.h
+ * \brief Beacon discover process.
+ * \ingroup cp_beacon
+ *
+ * Function to compute the interval between the one no request shall be done.
+ * In this max discover period, all the station including the CCo shall send a
+ * discover beacon.
+ * For the station their are choose by the CCo using the network of its AVLN.
+ *
+ * \warn At 50Hz only 250 beacon period exists in the interval of Max Discover
+ * Period provided by the HP_AV specification which is equal to 10 seconds.
+ * 10s / 40e-3s = 250.
+ */
+#include "cp/types.h"
+#include "cp/cp.h"
+
+struct cp_beacon_discover_t
+{
+ /**
+ * Last TEI request for a discover beacon.
+ */
+ cp_tei_t tei_last;
+
+ /**
+ * The discover interval between the one no discover beacon is requested.
+ * pwl.bp_max_discover / num of station in the AVLN.
+ */
+ int discover_interval_bp;
+
+ /**
+ * The previous discover interval between the one no discover beacon is
+ * requested.
+ * pwl.bp_max_discover / num of station in the AVLN.
+ */
+ int prev_disc_int_bp;
+
+ /**
+ * The next discover beacon to request countdown. When 0, add a discover
+ * bentry. If next tei is 0. the CCo shall send a discover beacon.
+ */
+ int countdown_bp;
+};
+typedef struct cp_beacon_discover_t cp_beacon_discover_t;
+
+/** Initialise
+ * \param ctx the module context.
+ */
+void
+cp_beacon_discover_init (cp_beacon_discover_t *ctx);
+
+/**
+ * Compute the interval in beacon periods.
+ * \param ctx the module context.
+ *
+ * This function compute the interval between the one no discover beacon shall
+ * be request. If the value compute is 0 it corresponds to a request each
+ * beacon period including the CCo.
+ *
+ * This shall use the value in the PWL module to know how many beacon periods
+ * are available to discover all the station of the AVLN (impossible at 50Hz).
+ * This shall request the number of station in the network (query the station
+ * manager for that) and divide it by discover_period_max_bp in the PWL
+ * module.
+ */
+void
+cp_beacon_discover_compute_interval (cp_t *ctx);
+
+/**
+ * Verify if any request shall be done.
+ * \param ctx the module context.
+ * \param tei The TEI to request. 0 = The CCo shall send a discover beacon.
+ * \return true if a discover bentry shall be added to the beacon, false
+ * otherwise.
+ *
+ */
+bool
+cp_beacon_discover_need_to_request (cp_t *ctx, cp_tei_t * tei);
+
+#endif /* cp_beacon_inc_beacon_discover_h */
diff --git a/cesar/cp/beacon/inc/beacon_work.h b/cesar/cp/beacon/inc/beacon_work.h
new file mode 100644
index 0000000000..4055cf383a
--- /dev/null
+++ b/cesar/cp/beacon/inc/beacon_work.h
@@ -0,0 +1,79 @@
+#ifndef cp_beacon_inc_beacons_work_h
+#define cp_beacon_inc_beacons_work_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/inc/beacons_work.h
+ * \brief Private structure to fill a beacon with the bitstream library.
+ * \ingroup cp_beacon
+ *
+ * The following structures are define to be filled before filling a beacon,
+ * the endianess of the structure and the bits fields does not allow allow to
+ * store the data directly in the beacon.
+ */
+
+/** Mask for the fields of three bits. */
+#define CP_BEACON_MASK_3FIELDS 0x7
+
+/** Mask for the fields of two bits. */
+#define CP_BEACON_MASK_2FIELDS 0x3
+
+/** Beacon type. */
+#define CP_BEACON_WORK_MASK_BT(val) (val & CP_BEACON_MASK_3FIELDS)
+
+/** num slots. */
+#define CP_BEACON_WORK_MASK_NUM_SLOTS(val) (val & CP_BEACON_MASK_3FIELDS)
+
+/** Slots id. */
+#define CP_BEACON_WORK_MASK_SLOT_ID(val) (val & CP_BEACON_MASK_3FIELDS)
+
+/** AC Line synchronization. */
+#define CP_BEACON_WORK_MASK_ACLSS(val) (val & CP_BEACON_MASK_3FIELDS)
+
+/** Netwok mode. */
+#define CP_BEACON_WORK_MASK_NM(val) (val & CP_BEACON_MASK_2FIELDS)
+
+/** CCo mode. */
+#define CP_BEACON_WORK_MASK_CCO_CAP(val) (val & CP_BEACON_MASK_2FIELDS)
+
+struct cp_beacon_work_beacon_t
+{
+ /** nid msb. */
+ uint nid_msb;
+ /** nid lsb. */
+ uint nid_lsb;
+ /** hybrid mode. */
+ u8 hm;
+ /** stei. */
+ u8 stei;
+ /** Beacon type. */
+ u8 bt;
+ /** non coordinated network reported */
+ bool ncnr;
+ /** network network power saving mode. */
+ bool npsm;
+ /** Num slots. */
+ uint num_slots;
+ /** slots usage. */
+ u8 slot_usage;
+ /** slot id. */
+ u8 slot_id;
+ /** AC line cycle synchronization status. */
+ u8 aclss;
+ /** handover in progress. */
+ bool hoip;
+ /** rts broadcast flag. */
+ bool rtsbf;
+ /** Network mode. */
+ u8 nm;
+ /** CCo capability. */
+ u8 cco_cap;
+};
+typedef struct cp_beacon_work_beacon_t cp_beacon_work_beacon_t;
+
+#endif /* cp_beacon_inc_beacons_work_h */
diff --git a/cesar/cp/beacon/inc/bentry.h b/cesar/cp/beacon/inc/bentry.h
new file mode 100644
index 0000000000..3fab96302b
--- /dev/null
+++ b/cesar/cp/beacon/inc/bentry.h
@@ -0,0 +1,234 @@
+#ifndef cp_beacon_beacon_bentry_mgr_h
+#define cp_beacon_beacon_bentry_mgr_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/inc/bentry.h
+ * \brief Bentry processing.
+ * \ingroup cp_beacon
+ *
+ */
+#include "lib/set.h"
+#include "cp/cp.h"
+
+#include "cp/beacon/beacon_desc.h"
+#include "cp/beacon/inc/beacon_discover.h"
+
+/** Information for the countdown.
+ * Use to store data in the schedules. */
+struct cp_beacon_bentry_sched_data_t
+{
+ /** Countdown value. */
+ uint cd;
+ /** Destination to store the value. */
+ uint *dest;
+ /** Value to use at the end of the countdown. */
+ uint value_at_end;
+ /** The current value. */
+ uint value;
+};
+typedef struct cp_beacon_bentry_sched_data_t cp_beacon_bentry_sched_data_t;
+
+/** Bentry context. */
+struct cp_beacon_bentry_t
+{
+ /** The current address. */
+ u8 *bentry_addr;
+
+ /** The header read. */
+ uint header;
+
+ /** The length. */
+ uint length;
+
+ /** Read or write the bentry. */
+ bool read_write;
+
+ /** Number of bytes available to write. */
+ uint space_available;
+};
+typedef struct cp_beacon_bentry_t cp_beacon_bentry_t;
+
+
+struct cp_beacon_bentry_mgr_t
+{
+ /**
+ * Previous countdown of the Persistent Schedule Bentry.
+ */
+ u8 persistent_schedule_pscd;
+
+ /**
+ * Current countdown of the Persistent Schedule.
+ */
+ u8 persistent_schedule_cscd;
+
+ /**
+ * Encryption key change countdown.
+ */
+ u8 eks_kccd;
+
+ /**
+ * The key which is being change. 0 for nek, 1 for nmk.
+ */
+ bool eks_kbc;
+
+ /**
+ * The eks index to use once the countdown has expired.
+ */
+ u8 eks_neweks;
+
+ /**
+ * Handover in progress countdown.
+ */
+ u8 handover_cd;
+
+ /**
+ * The new CCo tei. This will be inserted in the bentry until the
+ * countdown does not expire.
+ */
+ u8 handover_newtei;
+
+ /**
+ * Beacon relocation bentry countdown.
+ */
+ u8 relocation_cd;
+
+ /**
+ * The relocation type.
+ */
+ bool relocation_type;
+
+ /**
+ * Relocation leaving group flag.
+ */
+ bool relocation_lgf;
+
+ /**
+ * The relocation in the beacon period. A single value corresponds
+ * to 0.32 micro seconds i.e. 0x1 corresponds to 0.32 micro seconds,
+ * 2 corresponds to 0.64 micro seconds and so on.
+ */
+ uint relocation_rlo;
+
+ /**
+ * The relocation slot id.
+ */
+ u8 relocation_slotid;
+
+ /**
+ * The AC line sync countdown.
+ */
+ u8 acl_cd;
+
+ /**
+ * The AC Line sync reason code.
+ */
+ u8 acl_reason_code;
+
+ /**
+ * Numslots change countdown.
+ */
+ u8 numslot_cd;
+
+ /**
+ * New number of slots.
+ */
+ u8 numslots_new;
+
+ /**
+ * Change Hybrid mode countdown.
+ */
+ u8 hm_cd;
+
+ /**
+ * The new hybrid mode value.
+ */
+ u8 hm_new;
+
+ /**
+ * Change snid countdown.
+ */
+ u8 snid_cd;
+
+ /**
+ * The new snid to change.
+ */
+ cp_snid_t snid_new;
+
+ /**
+ * Discover context.
+ */
+ cp_beacon_discover_t discover;
+
+ /**
+ * Set of allocation read from the central beacon.
+ */
+ set_t allocations;
+};
+typedef struct cp_beacon_bentry_mgr_t cp_beacon_bentry_mgr_t;
+
+
+/**
+ * Initialise the bentry mgr.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_beacon_bentry_mgr_init (cp_t *ctx);
+
+/**
+ * Uninitialise the bentry manager.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_beacon_bentry_mgr_uninit (cp_t *ctx);
+
+/**
+ * Decrements the countdowns.
+ * \param ctx the module context.
+ *
+ * for each countdown which will expire (value equals 1) an associated
+ * event is raise in the FSM
+ */
+void
+cp_beacon_bentry_mgr_countdown (cp_t *ctx);
+
+/**
+ * read the bentries in the beacon.
+ * \param ctx the module context.
+ * \param beacon the beacon to read or to fill.
+ *
+ * if shall determine the beacon type by reading it in the beacon payload
+ */
+void
+cp_beacon_bentry_mgr_beacon_read (cp_t *ctx, cp_beacon_desc_t * beacon);
+
+/**
+ * Write the bentries in the beacon.
+ * \param ctx the module context.
+ * \param beacon the beacon to read or to fill.
+ * \param beacon_type the beacon type.
+ * \param schedules the set containing the schedules to provide it to the CA
+ * in the future.
+ */
+void
+cp_beacon_bentry_mgr_beacon_write (cp_t *ctx, cp_beacon_desc_t *beacon,
+ uint beacon_type, set_t *schedules);
+
+/**
+ * Store the stat in the destination pointer provided.
+ * \param data_struct the structure containing the data
+ * \param index the current index value.
+ */
+void
+cp_beacon_bentry_mgr_schedule_data (cp_beacon_bentry_sched_data_t *data,
+ uint index);
+
+#endif /* cp_beacon_beacon_bentry_mgr_h */
+
diff --git a/cesar/cp/beacon/inc/bentry_msg.h b/cesar/cp/beacon/inc/bentry_msg.h
new file mode 100644
index 0000000000..7bd5e5fc06
--- /dev/null
+++ b/cesar/cp/beacon/inc/bentry_msg.h
@@ -0,0 +1,228 @@
+#ifndef cp_beacon_inc_bentry_msg_h
+#define cp_beacon_inc_bentry_msg_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/inc/bentry_msg.h
+ * \brief All the function to read or write a bentry in the beacon.
+ * \ingroup cp_beacon
+ *
+ */
+#include "lib/set.h"
+#include "lib/read_word.h"
+#include "lib/bitstream.h"
+#include "string.h"
+
+#include "cp/beacon/defs.h"
+#include "cp/beacon/inc/bentry.h"
+
+/** Discover info bentry structure. */
+struct cp_bentry_discover_info_struct_t
+{
+ bool updated;
+ uint cco_cap;
+ bool proxy_net_cap;
+ bool backup_cco_cap;
+ bool cco_status;
+ bool pco_status;
+ bool backup_cco_status;
+ uint num_dis_sta;
+ uint num_dis_net;
+ bool authentication;
+ bool status_user_ap_cco;
+};
+typedef struct cp_bentry_discover_info_struct_t
+cp_bentry_discover_info_struct_t;
+
+/**
+ * Initialise the discover info structure.
+ * \param ctx the discover info structure.
+ */
+void
+cp_beacon_discover_info_init (cp_bentry_discover_info_struct_t *ctx);
+
+/**
+ * Read or write the bentry header.
+ */
+void
+cp_beacon_bentry_mgr_process_header (cp_beacon_bentry_t *bentry);
+
+/**
+ * Process the schedules.
+ * \param ctx the CP context.
+ * \param bentry The bentry start address.
+ * \param set The set to read or store the schedules.
+ *
+ * The same function reads or write the persistent and non persistent
+ * schedules, for the non_persistent boolean provided in parameter
+ * indicate which kind of schedule this function will process.
+ *
+ * \Warn This function will not provide the schedules to the Channel Access.
+ */
+void
+cp_beacon_bentry_mgr_schedules (cp_t *ctx,
+ cp_beacon_bentry_t *bentry,
+ set_t *set);
+
+/**
+ * Read or write the regions in the beacon.
+ * \param ctx the module context.
+ * \param bentry The bentry address to process.
+ *
+ * When reading the regions it shall directly update the data in the
+ * region manager (only in CCo mode). On the write process it shall get
+ * the regions from the region manager
+ */
+void
+cp_beacon_bentry_mgr_regions (cp_t *ctx, cp_beacon_bentry_t *bentry);
+
+/**
+ * Read or write the mac address in the beacon.
+ * \param bentry The address of the start of the bentry.
+ * \param mac_address The mac address to store or the variable to set when
+ * it is reading a mac address bentry.
+ * \param read_write Read of write process.
+ *
+ * If the reading bool is set, it will store the mac address stocked
+ * in the bentry in the parameter provided
+ */
+void
+cp_beacon_bentry_mgr_mac_address (cp_beacon_bentry_t *bentry,
+ mac_t * mac_address);
+
+/**
+ * Read or write a discover info bentry.
+ * \param bentry The bentry start address.
+ * \param info_struct The info data to fill or use for the bentry.
+ */
+void
+cp_beacon_bentry_mgr_discover_info_bentry (cp_beacon_bentry_t *bentry,
+ cp_bentry_discover_info_struct_t *info_struct);
+
+/**
+ * Read or write a discover bentry.
+ * \param bentry The start of the bentry address.
+ * \param tei the TEI of the station requested.
+ *
+ * If write it will request to next station in the station manager to
+ * request a discover beacon. This will call the station manager to get
+ * the next station corresponding to the station discover variable
+ */
+void
+cp_beacon_bentry_mgr_discover (cp_beacon_bentry_t *bentry, uint *tei);
+
+/**
+ * Read or write the BPSTO.
+ * \param bentry Bentry start address.
+ * \param BPSTO To store the address of the beacon period start time offset.
+ *
+ * store the address of the BPSTO in the BPSTO variable of the beacon_common
+ * structure data
+ */
+void
+cp_beacon_bentry_mgr_bpsto (cp_beacon_bentry_t *bentry,
+ u8 **bpsto);
+
+/**
+ * Read or write the encryption key change bentry.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_eks_change (cp_t *ctx,
+ u8 * bentry, bool read_write);
+
+/**
+ * Read or write the CCo Handover bentry.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_hoip_change (cp_t *ctx,
+ u8 * bentry, bool read_write);
+
+/**
+ * Read or write the beacon relocation bentry.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_relocation (cp_t *ctx,
+ u8 * bentry, bool read_write);
+
+/**
+ * Read or write the beacon AC line bentry.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_acl (cp_t *ctx, u8 * bentry,
+ bool read_write);
+
+/**
+ * Read or write the change numslots bentry.
+ * \param bentry The start address bentry.
+ * \param numslots the variable use to store or to read the number of slots.
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+void
+cp_beacon_bentry_mgr_num_slots_change (cp_beacon_bentry_t *bentry,
+ u8 *numslots);
+
+/**
+ * Read or write the Hm change.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_hm_change (cp_t *ctx, u8 * bentry,
+ bool read_write);
+
+/**
+ * Read or write the Change SNID.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param snid Read or write SNID value.
+ * \param snidcd the SNID countdown
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+void
+cp_beacon_bentry_mgr_snid_change (cp_beacon_bentry_t *bentry,
+ cp_snid_t *snid, uint *snidcd);
+
+
+#endif /* cp_beacon_inc_bentry_msg_h */
diff --git a/cesar/cp/beacon/inc/bentry_size.h b/cesar/cp/beacon/inc/bentry_size.h
new file mode 100644
index 0000000000..778b1bb358
--- /dev/null
+++ b/cesar/cp/beacon/inc/bentry_size.h
@@ -0,0 +1,85 @@
+#ifndef cp_beacon_inc_bentry_size_h
+#define cp_beacon_inc_bentry_size_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/inc/bentry_size.h
+ * \brief Define the size in bytes off all beacon entries.
+ * \ingroup cp_beacon
+ *
+ * Each beacon entries is define here, and all macros necessary to compute the
+ * length of any bentry payload.
+ *
+ * \warn all definition here are in BYTES, to convert in bits use the
+ * BYTES_SIZE_TO_BITS macro define in lib/utils.h
+ */
+
+/* Static size bentry. */
+
+/** Bentry header size. */
+#define CP_BEACON_ENTRY_HEADER 2
+
+/** Mac Address bentry size. */
+#define CP_BEACON_ENTRY_MAC_ADDRESS 6
+
+/** Discover Bentry. */
+#define CP_BEACON_ENTRY_DISCOVER 1
+
+/** Discover Info Bentry. */
+#define CP_BEACON_ENTRY_DISCOVER_INFO 4
+
+/** Beacon Period Start Time Offset. */
+#define CP_BEACON_ENTRY_BPSTO 3
+
+/** Encryption key change. */
+#define CP_BEACON_ENTRY_EKC 2
+
+/** Handover. */
+#define CP_BEACON_ENTRY_HOIP 2
+
+/** Beacon Relocation. */
+#define CP_BEACON_ENTRY_RLO 3
+
+/** AC Line synchronisation. */
+#define CP_BEACON_ENTRY_ACL 2
+
+/** Change Num Slots. */
+#define CP_BEACON_ENTRY_CHANGE_NUMSLOTS 2
+
+/** Change hybrid mode. */
+#define CP_BEACON_ENTRY_CHANGE_HM 1
+
+/** Change SNID. */
+#define CP_BEACON_ENTRY_CHANGE_SNID 1
+
+/* Variable ones. */
+
+/** Define the size in bytes of a SAI with start time. */
+#define CP_BEACON_ENTRY_SCHED_SAI_STPF 4
+
+/** Define the size in bytes of a SAI without start time. */
+#define CP_BEACON_ENTRY_SCHED_SAI_NSTPF 3
+
+/** Define the macro to compute a non persistent schedule bentry. */
+#define CP_BEACON_ENTRY_NON_PERSISTENT_SCHED(sai, nsai) (1 + \
+ (sai * CP_BEACON_ENTRY_SCHED_SAI_STPF) + \
+ (nsai * CP_BEACON_ENTRY_SCHED_SAI_NSTPF))
+
+
+/** Define the macro to compute a persistent schedule bentry. */
+#define CP_BEACON_ENTRY_PERSISTENT_SCHED(sai, nsai) (2 + \
+ (sai * CP_BEACON_ENTRY_SCHED_SAI_STPF) + \
+ (nsai * CP_BEACON_ENTRY_SCHED_SAI_NSTPF))
+
+/** Define the size in bytes of a region definition. */
+#define CP_BEACON_ENTRY_REGION_SIZE 2
+
+/** Define the Macro to compute a region bentry. */
+#define CP_BEACON_ENTRY_REGION(nr) (1 + CP_BEACON_ENTRY_REGION_SIZE * nr)
+
+#endif /* cp_beacon_inc_bentry_size_h */
diff --git a/cesar/cp/beacon/inc/common.h b/cesar/cp/beacon/inc/common.h
new file mode 100644
index 0000000000..868404badd
--- /dev/null
+++ b/cesar/cp/beacon/inc/common.h
@@ -0,0 +1,68 @@
+#ifndef cp_beacon_inc_common_h
+#define cp_beacon_inc_common_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/inc/common.h
+ * \brief Common structure definition.
+ * \ingroup cp_beacon
+ *
+ */
+
+#include "cp/beacon/beacon_desc.h"
+#include "mac/pbproc/pbproc.h"
+
+struct cp_beacon_common_t
+{
+ /**
+ * The beacon period start time offset address to provide it to the
+ * pbproc.
+ */
+ pbproc_tx_beacon_params_t *bpsto;
+
+ /**
+ * Number of beacon received.
+ */
+ uint nb_beacon_recv;
+
+ /**
+ * Number of beacon failled.
+ */
+ uint nb_beacon_failed;
+
+ /**
+ * The MFS to send the beacon.
+ */
+ mfs_tx_t *mfs;
+
+ /**
+ * The ntb date corresponding to the last date a beacon has been sent
+ * or received.
+ */
+ uint last_beacon_ntb;
+};
+typedef struct cp_beacon_common_t cp_beacon_common_t;
+
+
+/**
+ * Initialise the context.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_beacon_common_init (cp_beacon_common_t *ctx);
+
+/**
+ * Uninitialise the context.
+ * \param ctx the module context.
+ * \param cp the CP module context to use the mac store to remove the MFS.
+ */
+void
+cp_beacon_common_uninit (cp_beacon_common_t *ctx, cp_t *cp);
+
+#endif /* cp_beacon_inc_common_h */
diff --git a/cesar/cp/beacon/ntb/Module b/cesar/cp/beacon/ntb/Module
new file mode 100644
index 0000000000..330e1813c7
--- /dev/null
+++ b/cesar/cp/beacon/ntb/Module
@@ -0,0 +1 @@
+SOURCES:=ntb.c
diff --git a/cesar/cp/beacon/ntb/doc/ntb_clock_sync.odt b/cesar/cp/beacon/ntb/doc/ntb_clock_sync.odt
new file mode 100644
index 0000000000..3bad9fd779
--- /dev/null
+++ b/cesar/cp/beacon/ntb/doc/ntb_clock_sync.odt
Binary files differ
diff --git a/cesar/cp/beacon/ntb/doc/ntb_clock_sync.xmi b/cesar/cp/beacon/ntb/doc/ntb_clock_sync.xmi
new file mode 100644
index 0000000000..36c3402893
--- /dev/null
+++ b/cesar/cp/beacon/ntb/doc/ntb_clock_sync.xmi
@@ -0,0 +1,370 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-04-21T12:19:50" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WHsGhr6cL3qV" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1lLAIoXrLdtJ" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BsXuVmQldfSS" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="l2nnsImcbvsP" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Shk6a1xmtUeN" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="G46rjYKTY5EP" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="O01xtrLMY3S6" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5NqwrUH5XNxE" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="tFhSKvrguqen" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="hz7D2ZH5u80l" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="aHp7fmMY11yJ" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vntVp1gw0ZB8" isRoot="false" isAbstract="false" name="cp_reassembly_ctx_t *" elementReference="wuDYnfojrSWv" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oZHHg64PKBaq" isRoot="false" isAbstract="false" name="uint" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DcaQZXHCYAUY" isRoot="false" isAbstract="false" name="cp_sta_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nnvOyvzkSE17" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="J5WdE6USg2qD" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="X7Q5Iud3fXPb" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QPMsbNxuTUYh" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TRzc3eNXqLr1" isRoot="false" isAbstract="false" name="cp_net_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="wuDYnfojrSWv" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Q4TYO2bRfXJq" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="RTeIWtKTDaZV" isRoot="false" isAbstract="false" name="cp_reassembly_ctx_t" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ijh1VCxJQDFs" aggregation="aggregate" type="wuDYnfojrSWv" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="PkTabBSns4DE" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lOuuxnmeWTfz" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="gaI6mWwBGPmp" aggregation="none" type="wuDYnfojrSWv" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ZCdPGqezCWr8" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Jdmn7Pklz2rj" aggregation="none" type="wuDYnfojrSWv" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="Wlvm9faipD73" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="1j2DDsLWV5Ha" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="U1LS2ABYu4J1" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="hthW4mZ5WaGj" aggregation="none" type="wuDYnfojrSWv" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3Vny4m2DHl2U" isRoot="false" isAbstract="false" name="Classes" >
+ <UML:Namespace.ownedElement>
+ <UML:Class comment="NTB sample history (beacon timestamp data and synchronization data being calculated)." isSpecification="false" isLeaf="false" visibility="public" namespace="3Vny4m2DHl2U" xmi.id="QCdiA5hU9IAb" isRoot="false" isAbstract="false" name="ntb_histo_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="k Factor value for &quot;w&quot; weighting constant (w = 1 / 2^k)." isSpecification="false" visibility="public" xmi.id="9PZYdnDFOfZz" type="hz7D2ZH5u80l" name="k" />
+ <UML:Attribute comment="beacon index." isSpecification="false" visibility="public" xmi.id="I2w0DZg3Mq2z" type="hz7D2ZH5u80l" name="beacon" />
+ <UML:Attribute comment="BTS (Beacon Time Stamp) = CCo NTB date in entire ticks." isSpecification="false" visibility="public" xmi.id="2DXPazSjM1H0" type="hz7D2ZH5u80l" name="bts_ticks" />
+ <UML:Attribute comment="LTmr = STAn NTB date in decimal ticks." isSpecification="false" visibility="public" xmi.id="ze320s3xsETH" type="Shk6a1xmtUeN" name="sta_ntb_date_decticks" />
+ <UML:Attribute comment="LTmr = STAn NTB date in entire ticks." isSpecification="false" visibility="public" xmi.id="oQkVnlklYCyk" type="hz7D2ZH5u80l" name="sta_ntb_date_ticks" />
+ <UML:Attribute comment="PHY LTmr = STA1 25Mhz PHY date (not corrected) in decimal ticks." isSpecification="false" visibility="public" xmi.id="HiveU00Ud1Ud" type="Shk6a1xmtUeN" name="sta_phy_date_decticks" />
+ <UML:Attribute comment="PHY LTmr = STA1 25Mhz PHY date (not corrected) in entire ticks." isSpecification="false" visibility="public" xmi.id="tVZmk23YSl2D" type="hz7D2ZH5u80l" name="sta_phy_date_ticks" />
+ <UML:Attribute comment="FreqError." isSpecification="false" visibility="public" xmi.id="PZbDOoBbG3Ga" type="Shk6a1xmtUeN" name="sta_hpav_frequ_error" />
+ <UML:Attribute comment="Offset calculated by formula from paragraph 5.5 of HP_AV specification." isSpecification="false" visibility="public" xmi.id="vu1sNip10eTF" type="tGaBn52o26ZT" name="sta_hpav_offset" />
+ <UML:Attribute comment="Offset of NTB STA clock relative to CCo clock." isSpecification="false" visibility="public" xmi.id="12iP2IX4iuZV" type="tGaBn52o26ZT" name="sta_offset" />
+ <UML:Attribute comment="STAn NTB date derive from CCo NTB in entire ticks." isSpecification="false" visibility="public" xmi.id="TJBC2d791ceG" type="O01xtrLMY3S6" name="sta_deriv_from_cco_ntb_ticks" />
+ <UML:Attribute comment="STA NTB date relative derive from CCo NTB in entire ticks." isSpecification="false" visibility="public" xmi.id="uph521FYdhgf" type="O01xtrLMY3S6" name="sta_relative_deriv_from_cco_ntb_ticks" />
+ <UML:Attribute comment="STAn current numerator for PHY_Clk divisor." isSpecification="false" visibility="public" xmi.id="aWuXmeAj2r8J" type="hz7D2ZH5u80l" name="sta_numerator" />
+ <UML:Attribute comment="STAn current STA_Clk frenquency in Hz." isSpecification="false" visibility="public" xmi.id="0i5d3BEMdYEu" type="Shk6a1xmtUeN" name="sta_clk_frequ" />
+ <UML:Attribute comment="Predicted value of CCo NTB date [next BTS] at next beacon (in entire ticks)." isSpecification="false" visibility="public" xmi.id="lg26NjLnDlUL" type="hz7D2ZH5u80l" name="sta_predict_next_bts_ticks" />
+ <UML:Attribute comment="Predicted value of STAn NTB date at next beacon if no correction (in entire ticks)." isSpecification="false" visibility="public" xmi.id="YLi6zEQnge4L" type="hz7D2ZH5u80l" name="sta_predict_next_sta_ticks" />
+ <UML:Attribute comment="Predicted error of STAn NTB date at next beacon (compared to next BTS value) if no correction (in entire ticks)." isSpecification="false" visibility="public" xmi.id="BXmpzfZGDcVv" type="O01xtrLMY3S6" name="sta_predict_error_of_next_sta_ticks" />
+ <UML:Attribute comment="STAn STA clock should be adjusted to (in Hz)." isSpecification="false" visibility="public" xmi.id="HMot9TL3ZMNJ" type="Shk6a1xmtUeN" name="sta_clk_frequ_should_be" />
+ <UML:Attribute comment="For max. derive of 25 ticks (25 ticks = 1 ppm @ 25Mhz), STAn STA/PHY clock ratio should be adjusted to (decimal numerator)." isSpecification="false" visibility="public" xmi.id="Vq6eEbIzxkV1" type="Shk6a1xmtUeN" name="sta_decimal_numerator_should_be" />
+ <UML:Attribute comment="STAn STA/PHY clock ratio should be adjusted to (pure integer numerator)." isSpecification="false" visibility="public" xmi.id="fSsc3eyAlMjO" type="hz7D2ZH5u80l" name="sta_integer_numerator_should_be" />
+ <UML:Attribute comment="STAn STA clock will be adjusted to (in Hz)." isSpecification="false" visibility="public" xmi.id="kfcOO2lh80fL" type="Shk6a1xmtUeN" name="sta_clk_frequ_will_be" />
+ <UML:Attribute comment="NTB date estimation in decimal ticks." isSpecification="false" visibility="public" xmi.id="rrov4443oTJh" type="Shk6a1xmtUeN" name="sta_ntb_estimated_decticks" />
+ <UML:Attribute comment="NTB date estimation in entire ticks." isSpecification="false" visibility="public" xmi.id="iAanwTF1WWI6" type="hz7D2ZH5u80l" name="sta_ntb_estimated_ticks" />
+ <UML:Attribute comment="STA clk freq sync ratio." isSpecification="false" visibility="public" xmi.id="MIx3EeGHnNhx" type="Shk6a1xmtUeN" name="sta_clk_frequ_sync_ratio" />
+ <UML:Attribute comment="count of samples for calculating the average of derive." isSpecification="false" visibility="public" xmi.id="JMKXRzfkAe0M" type="hz7D2ZH5u80l" name="sta_count_samples_for_average_deriv" />
+ <UML:Operation comment="Store into NTB histo the BTS, SYS_Ltmr and STA_Ltmr timestamp data of the received beacon." isSpecification="false" isLeaf="false" visibility="public" xmi.id="heL2xof0ahkF" isRoot="false" isAbstract="false" isQuery="false" name="record_sample" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fT6xnWlPyZed" value="" type="hz7D2ZH5u80l" name="beacon_bts" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WloebbNBjZsK" value="" type="hz7D2ZH5u80l" name="beacon_sys_ltmr" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wejvRpEVnOj3" value="" type="hz7D2ZH5u80l" name="beacon_sta_ltmr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Reset the NTB history data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="3UBqgc2KKU2C" isRoot="false" isAbstract="false" isQuery="false" name="reset_histo" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="contexte NTB" isSpecification="false" isLeaf="false" visibility="public" namespace="3Vny4m2DHl2U" xmi.id="L2ASUCoHdFZ0" isRoot="false" isAbstract="false" name="ntb_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="count of beacons" isSpecification="false" visibility="public" xmi.id="tcysk13dBnvN" type="v2bgoPxiwYdm" name="beacon_count" />
+ <UML:Attribute comment="NTB sample history (beacon timestamp data and synchronization data being calculated)" isSpecification="false" visibility="public" xmi.id="8nLnUu53vPCa" type="ysHmdByyGThj" name="histo" />
+ <UML:Operation comment="Synchronize local clock to be as close as possible to estimated value of the NTB clock reference (and update the NTB offset in the MAC Config).
+
+pointer to NTB context (ntb_t *ntb_ctx) is needed and found in the CP context passed in argument
+local STA clock is synchronized by adjusting its clock divisor as needed,
+depending on
+
+ - current beacon timestamp (BTS),
+ - SYS-base local receive time of current beacon (SYS LTmr, based on 25 Mhz local clock frequency not adjusted onto CCo clock frequency),
+ - STA-base local receive time of current beacon (STA LTmr, based on 25 Mhz local clock frequency adjusted onto CCo clock frequency)." isSpecification="false" isLeaf="false" visibility="public" xmi.id="bxBBvbAGs7Q5" isRoot="false" isAbstract="false" isQuery="false" name="clk_sync" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="current beacon timestamp (BTS)" isSpecification="false" visibility="private" xmi.id="T1X9Lf2gB76e" value="" type="hz7D2ZH5u80l" name="beacon_bts" />
+ <UML:Parameter comment="SYS local time captured when receiving beacon" isSpecification="false" visibility="private" xmi.id="kNcqVA8WLyXP" value="" type="hz7D2ZH5u80l" name="beacon_sys_ltmr" />
+ <UML:Parameter comment="STA local time captured when receiving beacon" isSpecification="false" visibility="private" xmi.id="1cD3Csl3or7J" value="" type="hz7D2ZH5u80l" name="beacon_sta_ltmr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initialise the NTB clock synchronization manager.
+
+following contexts are needed and found in the CP context passed in argument
+pointer to phy context (phy_t *phy_ctx)
+pointer to mac config (mac_config_t *mac_config)
+returned pointer to allocated ntb context shall be saved in the CP context
+by the calling application to be retrieved through the CP context pointer
+passed in argument to other NTB API function calls" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qHxkg2dtESUh" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Uninitialise the NTB clock synchronization manager.
+
+reset the history of beacon timestamps / NTB data samples
+free the NTB context allocated at init()" isSpecification="false" isLeaf="false" visibility="public" xmi.id="2gQknmKqTzYm" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Set or update NTB offset in the MAC Config." isSpecification="false" isLeaf="false" visibility="private" xmi.id="qKwzHvkVkXXm" isRoot="false" isAbstract="false" isQuery="false" name="update_offset_in_mac_config" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="offset between NTB date (CCo date) and NTB_STA date (station date)" isSpecification="false" visibility="private" xmi.id="qZhzkTw8B1b2" value="" type="O01xtrLMY3S6" name="offset" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Calculate the number of beacons lost (if any) between 2 beacons received." isSpecification="false" isLeaf="false" visibility="private" xmi.id="6HEYTNnWQoGE" isRoot="false" isAbstract="false" isQuery="false" name="get_count_of_lost_beacons" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Qoevq3nkC9QA" type="hz7D2ZH5u80l" />
+ <UML:Parameter comment="difference of BTS timestamp between 2 last received beacons" isSpecification="false" visibility="private" xmi.id="4meWZ9OS6ujN" value="" type="hz7D2ZH5u80l" name="delta_ticks" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="8xImlyaBNYwN" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BrwecS9YABMu" aggregation="aggregate" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="VBJhhFw0jHok" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="fVlZqtZMrzdT" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="qIE10bnCQkq2" aggregation="aggregate" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="CyZK9vEc7YJo" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="2uIgsGr4ejEG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lGoUVbFLtRKs" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="074QpuQ0szKz" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="0UqhrhEJ8WDS" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="tXc03vmm9bHc" aggregation="aggregate" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="AUv1vDtvLxJ8" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="HgZ8mwwYQvS4" isRoot="false" isAbstract="false" name="sta_hpav_offset" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tGaBn52o26ZT" isRoot="false" isAbstract="false" name="signed long long" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Vd6MhjybKlo7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="2sGLqXUeFaIu" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zwQtCwoOEWf6" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="v2bgoPxiwYdm" isRoot="false" isAbstract="false" name="unsigned long long" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="XJ9zosl58k58" isRoot="false" isAbstract="true" name="pratic_registers_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="LfHLbsrMkSNd" initialValue="1000000" type="hz7D2ZH5u80l" name="clock_divisor_numerator" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="XevhFJolmvE4" initialValue="3000000" type="hz7D2ZH5u80l" name="clock_divisor_denominator" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="S1YLpeJh4oXt" isRoot="false" isAbstract="false" name="mac_config_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="c9zEMmXQs8UX" type="hz7D2ZH5u80l" name="ntb_offset_tck" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="JD1yKqZUviuE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="sZ5p2na3yxGi" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="cOQEt13LQDzM" aggregation="none" type="S1YLpeJh4oXt" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Dv7QUbCmB2YY" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="1jkNW14OY8Bb" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="vlctisaLG0Z8" aggregation="none" type="XJ9zosl58k58" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ysHmdByyGThj" isRoot="false" isAbstract="false" name="ntb_histo_t" />
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1016" snapy="10" showatts="1" xmi.id="bZ62yFKbgidF" documentation="25Mhz clock management and synchronization functions.
+
+NTB clock management module initialisation
+
+Synchronize local STA clock by adjusting its clock divisor as needed
+(and set or update the NTB offset in the MAC Config)" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="702" showattsigs="601" x="19" fillcolor="#ffffc0" y="23" showopsigs="601" linewidth="none" height="448" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="QCdiA5hU9IAb" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="665" showattsigs="601" x="19" fillcolor="#ffffc0" y="675" showopsigs="601" linewidth="none" height="128" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="L2ASUCoHdFZ0" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="351" showattsigs="601" x="379" fillcolor="#ffffc0" y="501" drawascircle="0" showopsigs="601" linewidth="none" height="56" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="XJ9zosl58k58" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,1,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="209" showattsigs="601" x="305" fillcolor="#ffffc0" y="573" showopsigs="601" linewidth="none" height="40" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="S1YLpeJh4oXt" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="4" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="QCdiA5hU9IAb" widgetaid="L2ASUCoHdFZ0" xmi.id="8nLnUu53vPCa" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="185" starty="675" />
+ <endpoint endx="370" endy="471" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="182" fillcolor="none" y="631" linewidth="none" posttext="" role="701" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="2h0JhYPg8s3u" text="1" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="328" fillcolor="none" y="474" linewidth="none" posttext="" role="702" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="IlhRCr4d46cO" text="1" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="47" x="234" fillcolor="none" y="545" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="SC21KDaFzC9f" showstereotype="1" text="histo" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="S1YLpeJh4oXt" widgetaid="L2ASUCoHdFZ0" xmi.id="JD1yKqZUviuE" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="351" starty="675" />
+ <endpoint endx="409" endy="613" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="3" totalcountb="2" indexb="1" linewidth="none" widgetbid="XJ9zosl58k58" widgetaid="L2ASUCoHdFZ0" xmi.id="Dv7QUbCmB2YY" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="517" starty="675" />
+ <endpoint endx="554" endy="557" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="g2RmQlkG6CqM" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="bZ62yFKbgidF" documentation="" uniqueid="Qoevq3nkC9QA" />
+ <listview>
+ <listitem open="1" type="800" label="Vues" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="1" type="803" id="3Vny4m2DHl2U" >
+ <listitem open="0" type="813" id="QCdiA5hU9IAb" >
+ <listitem open="0" type="814" id="9PZYdnDFOfZz" />
+ <listitem open="0" type="814" id="I2w0DZg3Mq2z" />
+ <listitem open="0" type="814" id="2DXPazSjM1H0" />
+ <listitem open="0" type="814" id="ze320s3xsETH" />
+ <listitem open="0" type="814" id="oQkVnlklYCyk" />
+ <listitem open="0" type="814" id="HiveU00Ud1Ud" />
+ <listitem open="0" type="814" id="tVZmk23YSl2D" />
+ <listitem open="0" type="814" id="PZbDOoBbG3Ga" />
+ <listitem open="0" type="814" id="vu1sNip10eTF" />
+ <listitem open="0" type="814" id="12iP2IX4iuZV" />
+ <listitem open="0" type="814" id="TJBC2d791ceG" />
+ <listitem open="0" type="814" id="uph521FYdhgf" />
+ <listitem open="0" type="814" id="aWuXmeAj2r8J" />
+ <listitem open="0" type="814" id="0i5d3BEMdYEu" />
+ <listitem open="0" type="814" id="lg26NjLnDlUL" />
+ <listitem open="0" type="814" id="YLi6zEQnge4L" />
+ <listitem open="0" type="814" id="BXmpzfZGDcVv" />
+ <listitem open="0" type="814" id="HMot9TL3ZMNJ" />
+ <listitem open="0" type="814" id="Vq6eEbIzxkV1" />
+ <listitem open="0" type="814" id="fSsc3eyAlMjO" />
+ <listitem open="0" type="814" id="kfcOO2lh80fL" />
+ <listitem open="0" type="814" id="rrov4443oTJh" />
+ <listitem open="0" type="814" id="iAanwTF1WWI6" />
+ <listitem open="0" type="814" id="MIx3EeGHnNhx" />
+ <listitem open="0" type="814" id="JMKXRzfkAe0M" />
+ <listitem open="0" type="815" id="heL2xof0ahkF" />
+ <listitem open="0" type="815" id="3UBqgc2KKU2C" />
+ </listitem>
+ <listitem open="0" type="813" id="L2ASUCoHdFZ0" >
+ <listitem open="0" type="814" id="tcysk13dBnvN" />
+ <listitem open="0" type="814" id="8nLnUu53vPCa" />
+ <listitem open="0" type="815" id="bxBBvbAGs7Q5" />
+ <listitem open="0" type="815" id="qHxkg2dtESUh" />
+ <listitem open="0" type="815" id="2gQknmKqTzYm" />
+ <listitem open="0" type="815" id="qKwzHvkVkXXm" />
+ <listitem open="0" type="815" id="6HEYTNnWQoGE" />
+ </listitem>
+ </listitem>
+ <listitem open="0" type="807" id="bZ62yFKbgidF" label="diagramme de classes" />
+ <listitem open="0" type="813" id="S1YLpeJh4oXt" >
+ <listitem open="0" type="814" id="c9zEMmXQs8UX" />
+ </listitem>
+ <listitem open="1" type="813" id="ysHmdByyGThj" />
+ <listitem open="0" type="813" id="XJ9zosl58k58" >
+ <listitem open="0" type="814" id="LfHLbsrMkSNd" />
+ <listitem open="0" type="814" id="XevhFJolmvE4" />
+ </listitem>
+ <listitem open="1" type="829" id="tGaBn52o26ZT" />
+ <listitem open="1" type="829" id="HgZ8mwwYQvS4" />
+ <listitem open="1" type="829" id="v2bgoPxiwYdm" />
+ <listitem open="0" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="BsXuVmQldfSS" />
+ <listitem open="1" type="829" id="1lLAIoXrLdtJ" />
+ <listitem open="1" type="829" id="TRzc3eNXqLr1" />
+ <listitem open="1" type="829" id="RTeIWtKTDaZV" />
+ <listitem open="0" type="829" id="vntVp1gw0ZB8" />
+ <listitem open="1" type="829" id="DcaQZXHCYAUY" />
+ <listitem open="1" type="829" id="Shk6a1xmtUeN" />
+ <listitem open="1" type="829" id="l2nnsImcbvsP" />
+ <listitem open="1" type="829" id="WHsGhr6cL3qV" />
+ <listitem open="1" type="829" id="O01xtrLMY3S6" />
+ <listitem open="1" type="829" id="Q4TYO2bRfXJq" />
+ <listitem open="1" type="829" id="G46rjYKTY5EP" />
+ <listitem open="1" type="829" id="aHp7fmMY11yJ" />
+ <listitem open="1" type="829" id="J5WdE6USg2qD" />
+ <listitem open="1" type="829" id="X7Q5Iud3fXPb" />
+ <listitem open="1" type="829" id="QPMsbNxuTUYh" />
+ <listitem open="1" type="829" id="nnvOyvzkSE17" />
+ <listitem open="1" type="829" id="oZHHg64PKBaq" />
+ <listitem open="0" type="829" id="wuDYnfojrSWv" />
+ <listitem open="1" type="829" id="5NqwrUH5XNxE" />
+ <listitem open="1" type="829" id="hz7D2ZH5u80l" />
+ <listitem open="1" type="829" id="tFhSKvrguqen" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="g2RmQlkG6CqM" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/beacon/ntb/inc/ntb_clock_utils.h b/cesar/cp/beacon/ntb/inc/ntb_clock_utils.h
new file mode 100644
index 0000000000..be16f149ac
--- /dev/null
+++ b/cesar/cp/beacon/ntb/inc/ntb_clock_utils.h
@@ -0,0 +1,75 @@
+#ifndef cp_beacon_ntb_inc_ntb_clock_utils_h
+#define cp_beacon_ntb_inc_ntb_clock_utils_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/ntb/inc/ntb_clock_offset.h
+ * \brief NTB clock synchronization utilities
+ * \ingroup cp_beacon
+ *
+ * Set or update in mac_config the 25Mhz clock offset between STA
+ * and another STA selected as NTB clock reference (usually, the CCo shall be
+ * the NTB clock reference for the STAs in the given AVLN)
+ *
+ * Calculate the number of beacons lost (if any) between 2 beacons received
+ *
+ * Reset the NTB history data
+ *
+ * Store into NTB histo the BTS, SYS_Ltmr and STA_Ltmr timestamp data of the received beacon
+ *
+ */
+
+#include "hal/phy/phy.h" /* HAL-PHY functions dedicated to NTB clock management (access to dedicated PRATIC registers) */
+#include "mac/common/config.h"
+
+BEGIN_DECLS
+
+/*
+ * Set or update NTB offset in the MAC Config.
+ *
+ * \param cp_ctx pointer to CP context
+ * \param offset offset between NTB date (CCo date) and NTB_STA date (station date)
+ *
+ * pointer to mac_config context (mac_config_t *mac_config) is needed and found in the CP context passed in argument
+ */
+void
+cp_beacon_ntb_update_offset_in_mac_config( cp_t *cp_ctx, signed long offset );
+
+/*
+ * Calculate the number of beacons lost (if any) between 2 beacons received.
+ *
+ * \param cp_ctx pointer to CP context
+ * \param delta_ticks difference of BTS timestamp between 2 last received beacons
+ *
+ * \return count of lost beacons
+ */
+unsigned long
+cp_beacon_ntb_lost_beacons( cp_t *cp_ctx, unsigned long delta_ticks );
+
+/**
+ * Reset the NTB history data.
+ *
+ * \param cp_ctx pointer to the CP context.
+ */
+void
+cp_beacon_ntb_reset_histo( cp_t * cp_ctx );
+
+/**
+ * Store into NTB histo the BTS, SYS_Ltmr and STA_Ltmr timestamp data of the received beacon.
+ *
+ * \param cp_ctx pointer to the CP context.
+ * \param beacon_bts beacon time stamp
+ * \param beacon_sys_ltmr SYS local time captured when receiving beacon
+ * \param beacon_sta_ltmr STA local time captured when receiving beacon
+ */
+void
+cp_beacon_ntb_record_sample( cp_t * cp_ctx, unsigned long beacon_bts, unsigned long beacon_sys_ltmr, unsigned long beacon_sta_ltmr );
+
+END_DECLS
+
+#endif /* cp_beacon_ntb_inc_ntb_clock_utils_h */
diff --git a/cesar/cp/beacon/ntb/ntb_clock_sync.h b/cesar/cp/beacon/ntb/ntb_clock_sync.h
new file mode 100644
index 0000000000..3defe9ec36
--- /dev/null
+++ b/cesar/cp/beacon/ntb/ntb_clock_sync.h
@@ -0,0 +1,267 @@
+#ifndef cp_beacon_ntb_ntb_clock_sync_h
+# define cp_beacon_ntb_ntb_clock_sync_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/ntb/inc/ntb_clock_sync.h
+ * \brief 25Mhz clock management and synchronization functions.
+ * \ingroup cp_beacon
+ *
+ * NTB clock management module initialisation
+ *
+ * Synchronize local STA clock by adjusting its clock divisor as needed
+ * (and set or update the NTB offset in the MAC Config)
+ *
+ */
+#include "cp/cp.h"
+
+/* HAL-PHY functions dedicated to NTB clock management
+ * (access to dedicated PRATIC registers) */
+# include "hal/phy/phy.h"
+# include "mac/common/config.h"
+
+/* undef it for operational mode! */
+# undef MANUFACTURER_TEST
+// ntb Constants
+
+# define NTB_CCO 0
+# ifdef MANUFACTURER_TEST
+# define NTB_STA1 1
+# define NTB_STA2 2
+# define NTB_SMAX 3 // count of stations (including the CCo)
+# else
+# define NTB_SMAX 2 // count of stations (including the CCo)
+# endif
+
+# define NTB_DEFAULT_OFFSET 0
+// PRATIC default clock ratio numerator
+# define NTB_DEFAULT_NUMERATOR 1000000
+// PRATIC default clock ratio divisor
+# define NTB_DEFAULT_DIVISOR 3000000
+// ideal PHY clock frequency in Hz
+# define NTB_PHY_Clk_theoric 75000000
+// ideal STA clock frequency in Hz (1/3 of PHY clock frequency)
+# define NTB_STA_Clk_theoric 25000000
+// ntb Types
+
+typedef enum
+{
+ /* previous. */
+ prev,
+ /* current. */
+ curr,
+ /* next. */
+ next,
+ e_cnt
+} e_ntb_histo;
+
+struct cp_beacon_ntb_ntb_histo_t
+{
+ /* k Factor value for "w" weighting constant (w = 1 / 2^k). */
+ unsigned long k;
+ /* beacon index. */
+ unsigned long beacon[e_cnt];
+ /* BTS (Beacon Time Stamp) = CCo NTB date in entire ticks. */
+ unsigned long bts_ticks[e_cnt];
+ /* LTmr = STAn NTB date in decimal ticks. */
+ double sta_ntb_date_decticks[e_cnt];
+ /* LTmr = STAn NTB date in entire ticks. */
+ unsigned long sta_ntb_date_ticks[e_cnt];
+ /* PHY LTmr = STA1 25Mhz PHY date (not corrected) in decimal ticks. */
+ double sta_phy_date_decticks[e_cnt];
+ /* PHY LTmr = STA1 25Mhz PHY date (not corrected) in entire ticks. */
+ unsigned long sta_phy_date_ticks[e_cnt];
+ /* FreqError. */
+ double sta_hpav_frequ_error[e_cnt];
+ /* Offset calculated by formula from paragraph 5.5 of
+ * HP_AV specification. */
+ signed long long sta_hpav_offset[e_cnt];
+ /* Offset of NTB STA clock relative to CCo clock. */
+ signed long long sta_offset[e_cnt];
+ /* STAn NTB date derive from CCo NTB in entire ticks. */
+ signed long sta_deriv_from_cco_ntb_ticks[e_cnt];
+ /* STA NTB date relative derive from CCo NTB in entire ticks. */
+ signed long sta_relative_deriv_from_cco_ntb_ticks[e_cnt];
+ /* STAn current numerator for PHY_Clk divisor. */
+ unsigned long sta_numerator[e_cnt];
+ /* STAn current STA_Clk frequency in Hz. */
+ double sta_clk_frequ[e_cnt];
+ /* Predicted value of CCo NTB date [next BTS] at next beacon
+ * (in entire ticks). */
+ unsigned long sta_predict_next_bts_ticks[e_cnt];
+ /* Predicted value of STAn NTB date at next beacon if no correction
+ * (in entire ticks). */
+ unsigned long sta_predict_next_sta_ticks[e_cnt];
+ /* Predicted error of STAn NTB date at next beacon
+ * (compared to next BTS value) if no correction (in entire ticks). */
+ signed long sta_predict_error_of_next_sta_ticks[e_cnt];
+ /* STAn STA clock should be adjusted to (in Hz). */
+ double sta_clk_frequ_should_be[e_cnt];
+ /* For max. derive of 25 ticks (25 ticks = 1 ppm @ 25Mhz),
+ * STAn STA/PHY clock ratio should be adjusted to (decimal numerator). */
+ double sta_decimal_numerator_should_be[e_cnt];
+ /* STAn STA/PHY clock ratio should be adjusted to
+ * (pure integer numerator). */
+ unsigned long sta_integer_numerator_should_be[e_cnt];
+ /* STAn STA clock will be adjusted to (in Hz). */
+ double sta_clk_frequ_will_be[e_cnt];
+ /* NTB date estimation in decimal ticks. */
+ double sta_ntb_estimated_decticks[e_cnt];
+ /* NTB date estimation in entire ticks. */
+ unsigned long sta_ntb_estimated_ticks[e_cnt];
+ double sta_clk_frequ_sync_ratio[e_cnt];
+ //double sta_average_deriv_from_cco_ntb_ticks[e_cnt];
+ unsigned long sta_count_samples_for_average_deriv[e_cnt];
+
+};
+typedef struct cp_beacon_ntb_ntb_histo_t cp_beacon_ntb_ntb_histo_t;
+
+/* ntb context data structure. */
+struct ntb_t
+{
+
+ /* NTB sample history (beacon time stamp data and synchronization
+ * data being calculated). */
+ cp_beacon_ntb_ntb_histo_t ntb_histo;
+
+ /* count of beacons. */
+ unsigned long long beacon_count;
+
+# ifdef MANUFACTURER_TEST
+
+/* Microseconds */
+# define beacon_period_on_50hz_pwl 40000
+/* Microseconds */
+# define beacon_period_on_60hz_pwl 33333
+
+/* Microseconds */
+# define beacon_period beacon_period_on_50hz_pwl
+
+# define simu_duration (60*15) // in seconds
+# define count_of_beacons ((simu_duration * 1000000) / beacon_period)
+
+ /* NTB STA clock frequency in Hz (CCo, STA1, ..., STAn). */
+ double STA_Clk[NTB_SMAX];
+ double beacon_period_decimal_ticks[NTB_SMAX];
+ unsigned long beacon_period_ticks[NTB_SMAX];
+
+ /* PHY clock frequency in Hz (CCo, STA1, ..., STAn). */
+ unsigned long PHY_Clk[NTB_SMAX];
+ /* numerator for PHY clock division factor (CCo, STA1, ..., STAn). */
+ unsigned long numerator[NTB_SMAX];
+ /* divisor for PHY clock division factor (CCo, STA1, ..., STAn). */
+ unsigned long divisor[NTB_SMAX];
+
+ unsigned long current_sta;
+ /* beacon index. */
+ unsigned long beacon[count_of_beacons];
+ signed long sta_cco_offset_ticks[NTB_SMAX - 1];
+ /* CCo NTB date in decimal ticks. */
+ double cco_ntb_date_decticks[NTB_SMAX - 1][count_of_beacons];
+ /* BTS (Beacon Time Stamp) = CCo NTB date in entire ticks. */
+ unsigned long bts_ticks[NTB_SMAX - 1][count_of_beacons];
+ /* STAn NTB date in decimal ticks. */
+ double sta_ntb_date_decticks[NTB_SMAX - 1][count_of_beacons];
+ /* STAn NTB date in entire ticks. */
+ unsigned long sta_ntb_date_ticks[NTB_SMAX - 1][count_of_beacons];
+ /* PHY LTmr = STAn 25Mhz PHY date (not corrected) in decimal ticks. */
+ double sta_phy_date_decticks[NTB_SMAX - 1][count_of_beacons];
+ /* PHY LTmr = STAn 25Mhz PHY date (not corrected) in entire ticks. */
+ unsigned long sta_phy_date_ticks[NTB_SMAX - 1][count_of_beacons];
+ /* STAn NTB date derive from CCo NTB in entire ticks. */
+ signed long sta_deriv_from_cco_ntb_ticks[NTB_SMAX - 1][count_of_beacons];
+ /* STAn NTB date relative derive from CCo NTB in entire ticks. */
+ signed long sta_relative_deriv_from_cco_ntb_ticks[NTB_SMAX -
+ 1][count_of_beacons];
+ /* STAn current numerator for PHY_Clk divisor. */
+ unsigned long sta_numerator[NTB_SMAX - 1][count_of_beacons];
+ /* STAn current STA_Clk frenquency in Hz. */
+ double sta_clk_frequ[NTB_SMAX - 1][count_of_beacons];
+ /* Predicted value of CCo NTB date [next BTS] at next beacon
+ * (in entire ticks). */
+ unsigned long sta_predict_next_bts_ticks[NTB_SMAX - 1][count_of_beacons];
+ /* Predicted value of STAn NTB date at next beacon if no correction
+ * (in entire ticks). */
+ unsigned long sta_predict_next_sta_ticks[NTB_SMAX - 1][count_of_beacons];
+ /* Predicted error of STAn NTB date at next beacon
+ * (compared to next BTS value) if no correction (in entire ticks). */
+ signed long sta_predict_error_of_next_sta_ticks[NTB_SMAX -
+ 1][count_of_beacons];
+ /* STAn STA clock should be adjusted to (in Hz). */
+ double sta_clk_frequ_should_be[NTB_SMAX - 1][count_of_beacons];
+ /* For max. derive of 25 ticks (25 ticks = 1 ppm @ 25Mhz),
+ * STAn STA/PHY clock ratio should be adjusted to (decimal numerator). */
+ double sta_decimal_numerator_should_be[NTB_SMAX - 1][count_of_beacons];
+ /* STAn STA/PHY clock ratio should be adjusted to
+ * (pure integer numerator). */
+ unsigned long sta_integer_numerator_should_be[NTB_SMAX -
+ 1][count_of_beacons];
+ /* STAn STA clock will be adjusted to (in Hz). */
+ double sta_clk_frequ_will_be[NTB_SMAX - 1][count_of_beacons];
+ double sta_clk_frequ_sync_ratio[NTB_SMAX - 1][count_of_beacons];
+# endif
+};
+typedef struct cp_beacon_ntb_t cp_beacon_ntb_t;
+
+BEGIN_DECLS
+/*
+ * NTB clock management module initialisation.
+ *
+ * \param cp_ctx pointer to CP context
+ *
+ * following contexts are needed and found in the CP context passed in argument
+ * pointer to phy context (phy_t *phy_ctx)
+ * pointer to mac config (mac_config_t *mac_config)
+ * returned pointer to allocated ntb context shall be saved in the CP context
+ * by the calling application to be retrieved through the CP context pointer
+ * passed in argument to other NTB API function calls
+ */
+void
+cp_beacon_ntb_init (cp_t * cp_ctx);
+
+/**
+ * Uninitialise the NTB clock synchronization manager.
+ *
+ * \param cp_ctx pointer to CP context.
+ *
+ * reset the history of beacon timestamps / NTB data samples
+ * free the NTB context allocated at init()
+ */
+void
+cp_beacon_ntb_uninit (cp_t * cp_ctx);
+
+/*
+ * Synchronize local clock to be as close as possible to estimated value
+ * of the NTB clock reference.
+ *
+ * \param cp_ctx pointer to CP context
+ * \param beacon_bts beacon time stamp
+ * \param beacon_sys_ltmr SYS local time captured when receiving beacon
+ * \param beacon_sta_ltmr STA local time captured when receiving beacon
+ *
+ * pointer to NTB context (ntb_t *ntb_ctx) is needed and found in the CP
+ * context passed in argument local STA clock is synchronized by adjusting
+ * its clock divisor as needed,
+ * depending on
+ *
+ * - current beacon timestamp (BTS),
+ * - SYS-base local receive time of current beacon
+ * (SYS LTmr, based on 25 Mhz local clock frequency not adjusted onto
+ * CCo clock frequency),
+ * - STA-base local receive time of current beacon
+ * (STA LTmr, based on 25 Mhz local clock frequency adjusted onto CCo
+ * clock frequency).
+ */
+void
+cp_beacon_ntb_clk_sync (cp_t * cp_ctx, unsigned long beacon_bts,
+ unsigned long beacon_sys_ltmr,
+ unsigned long beacon_sta_ltmr);
+
+END_DECLS
+
+#endif /* cp_beacon_ntb_ntb_clock_sync_h */
diff --git a/cesar/cp/beacon/ntb/src/ntb_clock_sync.c b/cesar/cp/beacon/ntb/src/ntb_clock_sync.c
new file mode 100644
index 0000000000..3b546453b0
--- /dev/null
+++ b/cesar/cp/beacon/ntb/src/ntb_clock_sync.c
@@ -0,0 +1,637 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/ntb/src/ntb_clock_sync.c
+ * \brief 25Mhz clock management and synchronization functions.
+ * \ingroup cp_beacon
+ *
+ * NTB clock management module initialisation and uninit
+ *
+ * Synchronize local STA clock by adjusting its clock divisor as needed
+ * (and set or update the NTB offset in the MAC Config)
+ *
+ * NTB clock synchronization utilities
+ *
+ */
+#include "common/std.h"
+#include <stdlib.h>
+#include <stdio.h>
+#include <string.h>
+#include <math.h>
+
+#include "cp/beacon/ntb/ntb_clock_sync.h"
+#include "cp/beacon/ntb/inc/ntb_clock_utils.h"
+
+// Local constants
+#ifdef MANUFACTURER_TEST
+//unsigned long PHY_Clk[] = { 74999997, 74992500, 75000030 }; // PHY clock frequency in Hz (CCo, STA1, STA2)
+unsigned long PHY_Clk[] = { 75001875, /*74998125*/75001875, 75000030 }; // PHY clock frequency in Hz (CCo, STA1, STA2)
+unsigned long numerator[] = { 1000000, 1000000, 1000000 }; // numerator for PHY clock division factor (CCo, STA1, STA2)
+unsigned long divisor[] = { 3000000, 3000000, 3000000 }; // divisor for PHY clock division factor (CCo, STA1, STA2)
+#endif
+
+#define ntb_max_ppm_deriv 1
+//#define ntb_max_ticks_deriv (ntb_max_ppm_deriv * NTB_STA_Clk_theoric / 1000000)
+#define ntb_max_ticks_deriv 0
+
+#define NTB_MAX_SAMPLES_FOR_AVERAGE 100
+#define ntb_kmax 10
+
+#define NTB_FREQU_MIN_25MHZ 24999375.0 // 25 Mhz + 25 ppm
+#define NTB_FREQU_MAX_25MHZ 25000625.0 // 25 Mhz - 25 ppm
+#define PWL_FREQU_MIN_50HZ 47.0 // see EN50160
+#define PWL_FREQU_MAX_50HZ 52.0 // see EN50160
+#define PWL_FREQU_MIN_60HZ 59.0 // TBD
+#define PWL_FREQU_MAX_60HZ 61.0 // TBD
+
+// More local declarations & inits
+
+#ifdef MANUFACTURER_TEST
+double STA_Clk[] = { 0.0, 0.0, 0.0 }; // NTB STA clock frequency in Hz (CCo, STA1, STA2)
+double beacon_period_decimal_ticks[] = { 0.0, 0.0, 0.0 };
+unsigned long beacon_period_ticks[] = { 0, 0, 0 };
+#else
+double STA_Clk[] = { 0.0, 0.0 }; // NTB STA clock frequency in Hz (CCo, STA)
+double beacon_period_decimal_ticks[] = { 0.0, 0.0 };
+unsigned long beacon_period_ticks[] = { 0, 0 };
+#endif
+
+#ifdef MANUFACTURER_TEST
+unsigned long current_sta = 0;
+unsigned long beacon[count_of_beacons]; // beacon index
+signed long sta_cco_offset_ticks[NTB_SMAX-1];
+double cco_ntb_date_decticks[NTB_SMAX-1][count_of_beacons]; // CCo NTB date in decimal ticks
+unsigned long bts_ticks[NTB_SMAX-1][count_of_beacons]; // BTS (Beacon Time Stamp) = CCo NTB date in entire ticks
+double sta_ntb_date_decticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date in decimal ticks
+unsigned long sta_ntb_date_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date in entire ticks
+double sta_phy_date_decticks[NTB_SMAX-1][count_of_beacons]; // PHY LTmr = STAn 25Mhz PHY date (not corrected) in decimal ticks
+unsigned long sta_phy_date_ticks[NTB_SMAX-1][count_of_beacons]; // PHY LTmr = STAn 25Mhz PHY date (not corrected) in entire ticks
+signed long sta_deriv_from_cco_ntb_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date derive from CCo NTB in entire ticks
+signed long sta_relative_deriv_from_cco_ntb_ticks[NTB_SMAX-1][count_of_beacons]; // STAn NTB date relative derive from CCo NTB in entire ticks
+unsigned long sta_numerator[NTB_SMAX-1][count_of_beacons]; // STAn current numerator for PHY_Clk divisor
+double sta_clk_frequ[NTB_SMAX-1][count_of_beacons]; // STAn current STA_Clk frenquency in Hz
+unsigned long sta_predict_next_bts_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted value of CCo NTB date [next BTS] at next beacon (in entire ticks)
+unsigned long sta_predict_next_sta_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted value of STAn NTB date at next beacon if no correction (in entire ticks)
+signed long sta_predict_error_of_next_sta_ticks[NTB_SMAX-1][count_of_beacons]; // Predicted error of STAn NTB date at next beacon (compared to next BTS value) if no correction (in entire ticks)
+double sta_clk_frequ_should_be[NTB_SMAX-1][count_of_beacons]; // STAn STA clock should be adjusted to (in Hz)
+double sta_decimal_numerator_should_be[NTB_SMAX-1][count_of_beacons]; // For max. derive of 25 ticks (25 ticks = 1 ppm @ 25Mhz), STAn STA/PHY clock ratio should be adjusted to (decimal numerator)
+unsigned long sta_integer_numerator_should_be[NTB_SMAX-1][count_of_beacons]; // STAn STA/PHY clock ratio should be adjusted to (pure integer numerator)
+double sta_clk_frequ_will_be[NTB_SMAX-1][count_of_beacons]; // STAn STA clock will be adjusted to (in Hz)
+double sta_clk_frequ_sync_ratio[NTB_SMAX-1][count_of_beacons];
+#endif
+
+/*
+ * Set or update NTB offset in the MAC Config.
+ *
+ * \param cp_ctx pointer to CP context
+ * \param offset offset between NTB date (CCo date) and NTB_STA date (station date)
+ *
+ * pointer to mac_config context (mac_config_t *mac_config) is needed and found in the CP context passed in argument
+ */
+void
+cp_beacon_ntb_update_offset_in_mac_config( cp_t *cp_ctx, signed long offset )
+{
+ dbg_assert_ptr(cp_ctx);
+ dbg_assert_ptr(cp_ctx->mac_config);
+
+ /* update the u32 "ntb_offset_tck" field (NTB offset) in the mac_config_t Struct Reference */
+ cp_ctx->ntb_mac_config->ntb_offset_tck = (unsigned long) offset;
+}
+
+/**
+ * NTB clock management module initialisation.
+ *
+ * \param cp_ctx pointer to CP context
+ *
+ * \return pointer to ntb_t NTB context data structure
+ *
+ * following contexts are needed and found in the CP context passed in argument
+ * pointer to phy context (phy_t *phy_ctx)
+ * pointer to mac config (mac_config_t *mac_config)
+ * returned pointer to allocated ntb context shall be saved in the CP context
+ * by the calling application to be retrieved through the CP context pointer
+ * passed in argument to other NTB API function calls
+ */
+ntb_t *
+cp_beacon_ntb_init( cp_t *cp_ctx )
+{
+ //int i;
+ ntb_t * ntb_ctx;
+
+ dbg_assert_ptr(cp_ctx);
+ dbg_assert_ptr(cp_ctx->phy_ctx);
+ dbg_assert_ptr(cp_ctx->mac_config);
+
+ ntb_ctx = malloc(sizeof(ntb_t));
+ if (ntb_ctx != NULL)
+ {
+ /* reset ntb context data */
+ memset(ntb_ctx,0x00,sizeof(ntb_t));
+
+ /*for (i = 0; i < NTB_SMAX; i++)
+ {
+ ntb_ctx->STA_Clk[i] = 0.0;
+ ntb_ctx->beacon_period_decimal_ticks[i] = 0.0;
+ ntb_ctx->beacon_period_ticks[i] = 0;
+ }*/
+
+ ntb_ctx->beacon_count = 0;
+
+ /* initialize the numerator value in the PRATIC config to its default value (1000000) */
+ phy_clock_set_numerator (ntb_ctx->ntb_phy_ctx, NTB_DEFAULT_NUMERATOR);
+ /* initialize the offset value in the MAC Config to zero by default */
+ ntb_update_offset_in_mac_config(ntb_ctx, NTB_DEFAULT_OFFSET);
+ }
+
+ return ntb_ctx;
+}
+
+/**
+ * Uninitialise the NTB clock synchronization manager.
+ *
+ * \param cp_ctx pointer to CP context.
+ *
+ * reset the history of beacon timestamps / NTB data samples
+ * free the NTB context allocated at init()
+ */
+void
+cp_beacon_ntb_uninit( cp_t * cp_ctx )
+{
+ dbg_assert(cp_ctx);
+ dbg_assert(cp_ctx->ntb_ctx);
+
+ cp_beacon_ntb_reset_histo(cp_ctx);
+ free(cp_ctx->ntb_ctx);
+}
+
+/**
+ * Reset the NTB history data.
+ *
+ * \param cp_ctx pointer to the CP context.
+ */
+void
+cp_beacon_ntb_reset_histo( cp_t * cp_ctx )
+{
+ memset(&(cp_ctx->ntb_ctx.ntb_histo),0x00,sizeof(ntb_histo_t));
+}
+
+/**
+ * Calculate the number of beacons lost (if any) between 2 beacons received.
+ *
+ * \param cp_ctx pointer to the CP context
+ * \param delta_ticks difference of BTS timestamp between 2 last received beacons
+ *
+ * \return count of lost beacons
+ */
+unsigned long
+cp_beacon_ntb_lost_beacons( cp_t * cp_ctx, unsigned long delta_ticks )
+{
+ unsigned long i;
+ unsigned long acl_frequ_min;
+ unsigned long acl_frequ_max;
+
+ /*
+ * TODO : use appropriate min/max ACL (PWL) frequency values depending on
+ * ACL (PWL) frequency that was detected at beacon module initialization...
+ */
+ pwl_frequ_min = PWL_FREQU_MIN_50HZ;
+ pwl_frequ_max = PWL_FREQU_MAX_50HZ;
+
+ /*
+ * Remembering beacon period equals twice the PWL cycle (here in 25 Mhz ticks),
+ * evaluating the count of lost beacons between the two last beacons being received,
+ * by successive cumulative comparisons with min and max theoric values of normal beacon period
+ */
+ for (i = 0; ; i++)
+ {
+ if (
+ ((double)delta_ticks > ((double)(i+1)*((NTB_FREQU_MIN_25MHZ * 2.0) / pwl_frequ_max)))
+ &&
+ ((double)delta_ticks < ((double)(i+1)*((NTB_FREQU_MAX_25MHZ * 2.0) / pwl_frequ_min)))
+ )
+ break;
+ }
+ //if (i > 0) printf("%s(%lu) : %lu lost beacon(s)!!!\n",__FUNCTION__,delta_ticks,i);
+ return i;
+}
+
+/**
+ * Store into NTB histo the BTS, SYS_Ltmr and STA_Ltmr timestamp data of the received beacon.
+ *
+ * \param cp_ctx pointer to the CP context.
+ * \param beacon_bts beacon time stamp
+ * \param beacon_sys_ltmr SYS local time captured when receiving beacon
+ * \param beacon_sta_ltmr STA local time captured when receiving beacon
+ */
+void
+cp_beacon_ntb_record_sample( cp_t * cp_ctx, unsigned long beacon_bts, unsigned long beacon_sys_ltmr, unsigned long beacon_sta_ltmr )
+{
+ dbg_assert_ptr(cp_ctx);
+ dbg_assert_ptr(cp_ctx->ntb_ctx);
+
+ ntb_histo_t * nh = &(cp_ctx->ntb_ctx->ntb_histo);
+
+ // save previous sample values
+ nh->bts_ticks[prev] = nh->bts_ticks[curr];
+ nh->sta_ntb_date_ticks[prev] = nh->sta_ntb_date_ticks[curr];
+ nh->sta_phy_date_ticks[prev] = nh->sta_phy_date_ticks[curr];
+ nh->sta_phy_date_decticks[prev] = nh->sta_phy_date_decticks[curr];
+
+ // store new (current) sample values
+ nh->bts_ticks[curr] = beacon_bts;
+ nh->sta_ntb_date_ticks[curr] = beacon_sta_ltmr;
+ nh->sta_phy_date_ticks[curr] = beacon_sys_ltmr;
+ nh->sta_phy_date_decticks[curr] = beacon_sys_ltmr;
+}
+
+/**
+ * Synchronize local clock to be as close as possible to estimated value
+ * of the NTB clock reference (and update the NTB offset in the MAC Config).
+ *
+ * \param cp_ctx pointer to CP context
+ * \param beacon_bts beacon time stamp
+ * \param beacon_sys_ltmr SYS local time captured when receiving beacon
+ * \param beacon_sta_ltmr STA local time captured when receiving beacon
+ *
+ * pointer to NTB context (ntb_t *ntb_ctx) is needed and found in the CP context passed in argument
+ * local STA clock is synchronized by adjusting its clock divisor as needed,
+ * depending on
+ *
+ * - current beacon timestamp (BTS),
+ * - SYS-base local receive time of current beacon (SYS LTmr, based on 25 Mhz local clock frequency not adjusted onto CCo clock frequency),
+ * - STA-base local receive time of current beacon (STA LTmr, based on 25 Mhz local clock frequency adjusted onto CCo clock frequency).
+ */
+void
+cp_beacon_ntb_clk_sync( cp_t *cp_ctx, unsigned long beacon_bts, unsigned long beacon_sys_ltmr, unsigned long beacon_sta_ltmr )
+{
+ #define cp cp_ctx
+ #define p cp_ctx->ntb_ctx
+ #define nh p->ntb_histo
+
+ unsigned long long i; /* beacon index */
+ double err_freq_ppm;
+ unsigned long delta_bts_ticks;
+ unsigned long lost_beacons_count;
+
+ dbg_assert_ptr(cp);
+ dbg_assert_ptr(cp->phy_ctx);
+ dbg_assert_ptr(cp->mac_config);
+ dbg_assert_ptr(p);
+
+ /* update count of beacons and current beacon index */
+ i = p->beacon_count;
+ p->beacon_count++;
+
+ /* k factor for w weighting constant (w = 1/2^k) */
+ // LOI EXPONENTIELLE
+ nh.k = (int) (kmax+1)*(1-exp(-(i*1.0)/100.0));
+
+ /* save previous sample values and store new (current) sample values */
+ cp_beacon_ntb_record_sample( cp_ctx, beacon_bts, beacon_sys_ltmr, beacon_sta_ltmr );
+
+ /* save other old (previous) values */
+ nh.sta_ntb_date_decticks[prev] = nh.sta_ntb_date_decticks[curr];
+ nh.sta_hpav_frequ_error[prev] = nh.sta_hpav_frequ_error[curr];
+ nh.sta_hpav_offset[prev] = nh.sta_hpav_offset[curr];
+ nh.sta_offset[prev] = nh.sta_offset[curr];
+ nh.sta_numerator[prev] = nh.sta_numerator[curr];
+ nh.sta_numerator[curr] = nh.sta_numerator[next];
+
+ /* compute new current data depending on new current values and, if needed, predict future values */
+ if (i == 0)
+ {
+ nh.bts_ticks[prev] = 0;
+ nh.sta_ntb_date_decticks[prev] = 0;
+ nh.sta_ntb_date_ticks[prev] = 0;
+ nh.sta_phy_date_decticks[prev] = 0;
+ nh.sta_phy_date_ticks[prev] = 0;
+ //nh.sta_cco_offset_ticks[prev] = 0;
+ nh.sta_deriv_from_cco_ntb_ticks[prev] = 0;
+ nh.sta_relative_deriv_from_cco_ntb_ticks[prev] = 0;
+ nh.sta_numerator[prev] = 0;
+ nh.sta_clk_frequ[prev] = 0;
+ nh.sta_predict_next_bts_ticks[prev] = 0;
+ nh.sta_predict_next_sta_ticks[prev] = 0;
+ nh.sta_predict_error_of_next_sta_ticks[prev] = 0;
+ nh.sta_clk_frequ_should_be[prev] = 0;
+ nh.sta_decimal_numerator_should_be[prev] = 0;
+ nh.sta_integer_numerator_should_be[prev] = 0;
+ nh.sta_clk_frequ_will_be[prev] = 0;
+
+ nh.sta_clk_frequ_sync_ratio[prev] = 0;
+ //nh.sta_average_deriv_from_cco_ntb_ticks[prev] = 0;
+ nh.sta_count_samples_for_average_deriv[prev] = 0;
+
+ //nh.sta_cco_offset_ticks[curr] = 0;
+ nh.sta_deriv_from_cco_ntb_ticks[curr] = 0;
+ nh.sta_relative_deriv_from_cco_ntb_ticks[curr] = 0;
+ nh.sta_numerator[curr] = NTB_DEFAULT_NUMERATOR;
+ nh.sta_clk_frequ[curr] = 0;
+ nh.sta_predict_next_bts_ticks[curr] = 0;
+ nh.sta_predict_next_sta_ticks[curr] = 0;
+ nh.sta_predict_error_of_next_sta_ticks[curr] = 0;
+ nh.sta_clk_frequ_should_be[curr] = 0;
+ nh.sta_decimal_numerator_should_be[curr] = 0;
+ nh.sta_integer_numerator_should_be[curr] = 0;
+ nh.sta_clk_frequ_will_be[curr] = 0;
+ nh.sta_clk_frequ_sync_ratio[curr] = 0;
+ nh.sta_count_samples_for_average_deriv[curr] = 0;
+
+ /* only one (first) beacon received, so no sufficient data available to compute clock adjustment */
+ nh.sta_hpav_frequ_error[curr] = 0;
+ nh.sta_hpav_offset[curr] = (signed long long) nh.bts_ticks[curr] - (signed long long) nh.sta_phy_date_ticks[curr];
+
+ //*p_err_freq_ppm = 0.0;
+ err_freq_ppm = 0.0;
+ }
+ else
+ {
+ delta_bts_ticks = nh.bts_ticks[curr] - nh.bts_ticks[prev];
+ lost_beacons_count = ntb_lost_beacons(delta_bts_ticks);
+ //if (lost_beacons_count > 0) printf("%s() : %lu lost beacon(s)\n",__FUNCTION__,lost_beacons_count);
+ if (i == 1)
+ {
+ /* two beacons received, compute/prepare clock adjustment parameters */
+ nh.sta_hpav_frequ_error[curr] = (double)(nh.bts_ticks[curr] - nh.bts_ticks[prev]) / (double)(nh.sta_phy_date_ticks[curr] - nh.sta_phy_date_ticks[prev]) - 1;
+ nh.sta_hpav_offset[curr] = (signed long long) nh.bts_ticks[curr] - (signed long long) nh.sta_phy_date_ticks[curr];
+ }
+ else
+ {
+ /* more than two beacons received, compute/prepare clock adjustment parameters */
+ nh.sta_hpav_frequ_error[curr] = nh.sta_hpav_frequ_error[prev] + (1.0/pow(2.0,nh.k)) * ((double)(nh.bts_ticks[curr] - nh.bts_ticks[prev]) / (double)(nh.sta_phy_date_ticks[curr] - nh.sta_phy_date_ticks[prev]) - 1 - nh.sta_hpav_frequ_error[prev]);
+ /*nh.sta_hpav_offset[curr] = nh.sta_hpav_offset[prev] + nh.sta_hpav_frequ_error[curr] * (nh.sta_ntb_date_ticks[curr] - nh.sta_ntb_date_ticks[prev]) + (1.0/pow(2.0,nh.k)) * ((nh.bts_ticks[curr] - nh.sta_ntb_date_ticks[curr]) - (nh.sta_hpav_offset[prev] + nh.sta_hpav_frequ_error[curr] * (nh.sta_ntb_date_ticks[curr] - nh.sta_ntb_date_ticks[prev])));*/
+ nh.sta_hpav_offset[curr] = (double) nh.sta_hpav_offset[prev] + nh.sta_hpav_frequ_error[curr] * (double)((signed long long)nh.sta_phy_date_ticks[curr] - (signed long long)nh.sta_phy_date_ticks[prev]) + (1.0/pow(2.0,nh.k)) * (double)((signed long long)nh.bts_ticks[curr] - (signed long long)nh.sta_phy_date_ticks[curr]) - ((signed long long)nh.sta_hpav_offset[prev] + nh.sta_hpav_frequ_error[curr] * (double)((signed long long)nh.sta_phy_date_ticks[curr] - (signed long long)nh.sta_phy_date_ticks[prev]));
+ }
+ err_freq_ppm = nh.sta_hpav_frequ_error[curr] * 1000000.0;
+ phy_sysclock_set_freqerror (cp_ctx->phy_ctx, err_freq_ppm);
+ /* At least 2 beacons received, we can compute/estimate STA clock offset & derivation and update the clock divisor factor as needed */
+ //nh.sta_ntb_estimated_decticks[curr] = nh.sta_ntb_date_decticks[curr] + nh.sta_hpav_offset[curr] + nh.sta_hpav_frequ_error[curr] * (nh.sta_ntb_date_decticks[curr] - nh.sta_ntb_date_decticks[prev]);
+ //nh.sta_ntb_estimated_ticks[curr] = nh.sta_ntb_date_ticks[curr] + nh.sta_hpav_offset[curr] + nh.sta_hpav_frequ_error[curr] * (nh.sta_ntb_date_ticks[curr] - nh.sta_ntb_date_ticks[curr-1]);
+ nh.sta_decimal_numerator_should_be[curr] = (double)NTB_DEFAULT_NUMERATOR * (nh.sta_hpav_frequ_error[curr] + 1.0);
+ nh.sta_integer_numerator_should_be[curr] = (signed long)(nh.sta_decimal_numerator_should_be[curr]+0.5);
+ if (nh.sta_integer_numerator_should_be[curr] != nh.sta_numerator[curr])
+ {
+ // update the numerator value in the PRATIC config ! */
+ phy_clock_set_numerator (cp_ctx->phy_ctx, nh.sta_integer_numerator_should_be[curr]);
+ nh.sta_numerator[next] = nh.sta_integer_numerator_should_be[curr];
+ }
+ else
+ {
+ nh.sta_numerator[next] = nh.sta_numerator[curr];
+ }
+ }
+
+ /* offset from adjusted STA clock to NTB clock (NTB clock = CCo clock) */
+ nh.sta_offset[curr] = nh.bts_ticks[curr] - nh.sta_ntb_date_ticks[curr];
+ //nh.sta_offset[curr] = nh.bts_ticks[curr] - nh.sta_phy_date_ticks[curr];
+ //printf ("%d\n", (nh.bts_ticks[curr] - nh.bts[prev]) - (
+ //if (nh.k>=7)
+ //int t;
+ //if (nh.k<3) t=0;
+ //else t = nh.k-3;
+ // nh.sta_offset[curr] = nh.sta_offset[prev] + (1.0/pow(2,nh.k-7))*(nh.sta_offset[curr] - nh.sta_offset[prev]);
+ if (nh.sta_offset[curr] != nh.sta_offset[prev])
+ {
+ /* update the offset value in the MAC Config ! */
+ ntb_update_offset_in_mac_config(ntb_ctx, nh.sta_offset[curr]);
+ nh.sta_offset[next] = nh.sta_offset[curr];
+ }
+ else
+ {
+ nh.sta_offset[next] = nh.sta_offset[prev];
+ }
+
+#ifdef MANUFACTURER_TEST
+ printf("Beacon_%05llu %010lu %010lu %011ld (%05ld) %010lu %010lu %05ld %08.14g %08.14g %02.14g (numer.div=%07lu) [%03lu]\n",
+ i,
+ nh.bts_ticks[curr],
+ nh.sta_ntb_date_ticks[curr],
+ (signed long)((signed long long)nh.sta_ntb_date_ticks[curr]-(signed long long)nh.bts_ticks[curr]),
+ nh.sta_relative_deriv_from_cco_ntb_ticks[curr],
+ nh.sta_predict_next_bts_ticks[curr],
+ nh.sta_predict_next_sta_ticks[curr],
+ nh.sta_predict_error_of_next_sta_ticks[curr],
+ STA_Clk[0],
+ nh.sta_clk_frequ_will_be[curr],
+ nh.sta_clk_frequ_sync_ratio[curr],
+ nh.sta_integer_numerator_should_be[curr],
+ nh.sta_count_samples_for_average_deriv[curr]
+ );
+#else
+ // TODO : this diag trace should be de-activated in operational software
+ diag_printf("Beacon_%05llu (%lu) %010lu %010lu %011ld (%05ld) %010lu %010lu %05ld %08.14g %08.14g %02.14g (numer.div=%07lu) [%03lu] %02.14g\n",
+ i,
+ nh.k,
+ nh.bts_ticks[curr],
+ nh.sta_ntb_date_ticks[curr],
+ (signed long)((signed long long)nh.sta_ntb_date_ticks[curr]-(signed long long)nh.bts_ticks[curr]),
+ nh.sta_relative_deriv_from_cco_ntb_ticks[curr],
+ nh.sta_predict_next_bts_ticks[curr],
+ nh.sta_predict_next_sta_ticks[curr],
+ nh.sta_predict_error_of_next_sta_ticks[curr],
+ STA_Clk[0],
+ nh.sta_clk_frequ_will_be[curr],
+ nh.sta_clk_frequ_sync_ratio[curr],
+ nh.sta_integer_numerator_should_be[curr],
+ nh.sta_count_samples_for_average_deriv[curr],
+ err_freq_ppm//nh.sta_average_deriv_from_cco_ntb_ticks[curr]
+ );
+
+#endif
+
+}
+
+
+#ifdef MANUFACTURER_TEST
+/**
+ * Computing clock synchronization over time & beacons transmitted by CCo and received by STAs...
+ *
+ * \param argc count of arguments
+ * \param argv[1] initial date for CCo
+ * \param argv[2] initial date for STA1
+ * \param argv[3] initial date for STA2
+ *
+ * \return success (0) or failure (-1) status
+ */
+int
+main( int argc, char *argv[] )
+{
+ unsigned long s;
+ unsigned long i;
+ unsigned long cco_ntb_date_begin_ticks = 0;
+ unsigned long sta_ntb_date_begin_ticks[NTB_SMAX-1];
+ phy_t phy_ctx[NTB_SMAX-1];
+ mac_config_t mac_cfg[NTB_SMAX-1];
+ ntb_t * my_ntb_ctx[NTB_SMAX-1];
+
+ ///////////////// Inits... ///////////////////////////////////////
+
+ if (argc > 2)
+ {
+ cco_ntb_date_begin_ticks = atoi(argv[1]);
+ for (s = 0; s < (argc-2); s++)
+ {
+ sta_ntb_date_begin_ticks[s] = atoi(argv[s+2]);
+ }
+ }
+ else
+ {
+ for (s = 0; s < (NTB_SMAX-1); s++)
+ {
+ sta_ntb_date_begin_ticks[s] = 0;
+ }
+ }
+
+ /*for (i = 0; i < (NTB_SMAX-1); i++)
+ {
+ my_ntb_ctx[i] = ntb_init(&phy_ctx[i],&mac_cfg[i]);
+ if (my_ntb_ctx[i] == NULL)
+ {
+ return -1;
+ }
+ }*/
+
+ //for (i = 0; i < NTB_SMAX; i++) s[i] = i + 1;
+
+ for (i = 0; i < NTB_SMAX; i++)
+ {
+ STA_Clk[i] = ((double)PHY_Clk[i] * (double)numerator[i]) / (double)divisor[i];
+ beacon_period_decimal_ticks[i] = (double)(STA_Clk[i] * ((double)beacon_period/1000.0)) / 1000.0;
+ beacon_period_ticks[i] = (signed long)(beacon_period_decimal_ticks[i]);
+ }
+
+ ///////////////// End of Inits /////////////////////////////////////
+
+
+ //// Simulation loop ////
+
+ // for each beacon...
+ for (i = 0; i < count_of_beacons; i++)
+ {
+ // for each STA receiving that beacon...
+ for (s = 0; s < (NTB_SMAX-1); s++)
+ {
+ cco_ntb_date_decticks[s][i] = cco_ntb_date_begin_ticks + ((double)i * beacon_period_decimal_ticks[CCO]);
+ bts_ticks[s][i] = (signed long)(cco_ntb_date_decticks[s][i]);
+ sta_phy_date_decticks[s][i] = sta_ntb_date_begin_ticks[s] + ((double)i * beacon_period_decimal_ticks[s+1]);
+ sta_phy_date_ticks[s][i] = (signed long)(sta_phy_date_decticks[s][i]);
+
+ if (i == 0)
+ {
+ // first beacon...
+ sta_numerator[s][i] = numerator[s+1];
+ sta_clk_frequ[s][i] = STA_Clk[s+1];
+ sta_ntb_date_decticks[s][i] = sta_ntb_date_begin_ticks[s];
+ sta_ntb_date_ticks[s][i] = (signed long)(sta_ntb_date_decticks[s][i]);
+ sta_cco_offset_ticks[s] = (signed long) (sta_ntb_date_ticks[s][i] - bts_ticks[s][i]);
+ sta_predict_next_bts_ticks[s][i] = 0; // N/A => 0 ? Shall be theoritically [current_BTS + theoric_ticks_count_for_beacon_period_at_25mhz] !
+ sta_predict_next_sta_ticks[s][i] = 0; // N/A => 0 ? Shall be theoritically [current_STA_Clk + theoric_ticks_count_for_beacon_period_at_current_STA_Clk_Frequ] !
+ sta_predict_error_of_next_sta_ticks[s][i] = 0; // N/A => 0 ?
+ sta_clk_frequ_should_be[s][i] = sta_clk_frequ[s][i];
+ sta_clk_frequ_sync_ratio[s][i] = sta_clk_frequ_should_be[s][i] / sta_clk_frequ[s][i];
+ sta_decimal_numerator_should_be[s][i] = numerator[s+1];
+ }
+ else
+ {
+ // next beacons...
+ sta_numerator[s][i] = sta_integer_numerator_should_be[s][i-1];
+ sta_clk_frequ[s][i] = sta_clk_frequ_will_be[s][i-1];
+ sta_ntb_date_decticks[s][i] = sta_ntb_date_decticks[s][i-1] + ((sta_clk_frequ_will_be[s][i-1] * ((double)beacon_period/1000.0)) / 1000.0);
+ sta_ntb_date_ticks[s][i] = (signed long)(sta_ntb_date_decticks[s][i]);
+ sta_predict_next_bts_ticks[s][i] = bts_ticks[s][i] + (bts_ticks[s][i] - bts_ticks[s][i-1]);
+ sta_predict_next_sta_ticks[s][i] = sta_ntb_date_ticks[s][i] + (sta_ntb_date_ticks[s][i] - sta_ntb_date_ticks[s][i-1]);
+ sta_predict_error_of_next_sta_ticks[s][i] = (signed long)( sta_predict_next_sta_ticks[s][i]
+ - sta_predict_next_bts_ticks[s][i]
+ - sta_cco_offset_ticks[s]);
+ sta_clk_frequ_should_be[s][i] = (double)((sta_predict_next_bts_ticks[s][i] - (sta_ntb_date_ticks[s][i]-sta_cco_offset_ticks[s])) * 1000) / ((double)beacon_period/1000.0);
+ sta_clk_frequ_sync_ratio[s][i] = sta_clk_frequ_should_be[s][i] / sta_clk_frequ[s][i];
+
+ // detect clock derive and, if needed, compute the clock division factor to adjust the clock frequency...
+ if (abs(sta_predict_error_of_next_sta_ticks[s][i]) < max_ticks_deriv)
+ {
+ sta_decimal_numerator_should_be[s][i] = sta_numerator[s][i];
+ }
+ else
+ {
+ sta_decimal_numerator_should_be[s][i] = ((double)sta_numerator[s][i] * sta_clk_frequ_should_be[s][i]) / sta_clk_frequ[s][i];
+ }
+ }
+ sta_integer_numerator_should_be[s][i] = (signed long)(sta_decimal_numerator_should_be[s][i]+0.5);
+ sta_clk_frequ_will_be[s][i] = ((double)PHY_Clk[s+1] * (double)sta_integer_numerator_should_be[s][i]) / (double)divisor[s+1];
+ sta_deriv_from_cco_ntb_ticks[s][i] = bts_ticks[s][i] - sta_ntb_date_ticks[s][i];
+ sta_relative_deriv_from_cco_ntb_ticks[s][i] = (signed long)((signed long long)sta_ntb_date_ticks[s][i]-(signed long long)bts_ticks[s][i]-(signed long long)sta_cco_offset_ticks[s]);
+
+ }
+ }
+
+ // print simulation data...
+ printf("\n\n");
+ // for each STA...
+ for (s = 0; s < (NTB_SMAX-1); s++)
+ {
+ printf("Results of clock synchronization simulation for STA%lu :\n\n",s+1);
+ // print clock synchronization data for each beacon being received...
+ for (i = 0; i < count_of_beacons; i++)
+ {
+ printf("Beacon_%05lu %010lu %010lu %010lu %011ld (%011ld ; %05ld) %010lu %010lu %05ld %08.14g %08.14g %02.14g (numer.div=%07lu)\n",
+ i,
+ sta_phy_date_ticks[s][i],
+ bts_ticks[s][i],
+ sta_ntb_date_ticks[s][i],
+ (signed long)((signed long long)sta_ntb_date_ticks[s][i]-(signed long long)bts_ticks[s][i]),
+ sta_cco_offset_ticks[s],
+ sta_relative_deriv_from_cco_ntb_ticks[s][i],
+ sta_predict_next_bts_ticks[s][i],
+ sta_predict_next_sta_ticks[s][i],
+ sta_predict_error_of_next_sta_ticks[s][i],
+ STA_Clk[0],
+ sta_clk_frequ_will_be[s][i],
+ sta_clk_frequ_sync_ratio[s][i],
+ sta_integer_numerator_should_be[s][i]
+ );
+ }
+ printf("\n\n");
+ }
+
+ signed long err_ticks;
+ double freq_err_ppm;
+ // compare simulation data with synchronization data computed with independent synchronization function (applying same algorithm)...
+ printf("\n\n");
+ // for each STA...
+ for (s = 0; s < (NTB_SMAX-1); s++)
+ {
+ printf("Compare results of clock synchronization for STA%lu :\n\n",s+1);
+#ifdef MANUFACTURER_TEST
+ current_sta = s+1;
+#endif
+ // new STA => need to init the NTB clock synchro module dedicated to that STA...
+ my_ntb_ctx[s] = ntb_init(&phy_ctx[s],&mac_cfg[s]);
+ if (my_ntb_ctx[s] == NULL)
+ {
+ return -1;
+ }
+ // compare clock synchronization data for each beacon being received...
+ for (i = 0; i < count_of_beacons; i++)
+ {
+#if 0
+ err_ticks = ntb_clk_sync(my_ntb_ctx[s], bts_ticks[s][i], sta_phy_date_ticks[s][i], sta_ntb_date_ticks[s][i], &freq_err_ppm);
+ if (err_ticks != sta_relative_deriv_from_cco_ntb_ticks[s][i])
+ {
+ printf("ntb_clk_sync() for beacon_%05lu on STA%lu revealed %ld tick of relative error for %ld expected by simulation\n",i,s+1,err_ticks,sta_relative_deriv_from_cco_ntb_ticks[s][i]);
+ }
+#else
+ ntb_clk_sync(my_ntb_ctx[s], bts_ticks[s][i], sta_phy_date_ticks[s][i], sta_ntb_date_ticks[s][i]);
+#endif
+ }
+ printf("\n\n");
+ free(my_ntb_ctx[s]);
+ }
+
+ return 0;
+}
+#endif /* MANUFACTURER_TEST */
diff --git a/cesar/cp/beacon/src/beacon.c b/cesar/cp/beacon/src/beacon.c
new file mode 100644
index 0000000000..8cf39f03bc
--- /dev/null
+++ b/cesar/cp/beacon/src/beacon.c
@@ -0,0 +1,1003 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/src/beacon.c
+ * \brief Beacon Module.
+ * \ingroup cp_beacon
+ *
+ * The beacon module is responsible for :
+ * - When the station acts as CCo:
+ * - Create the central beacon.
+ * - Get the discover info from the others stations.
+ */
+#include "common/std.h"
+#include "string.h"
+#include "stdio.h"
+
+#include "lib/read_word.h"
+
+#include "cp/defs.h"
+#include "cp/cp.h"
+#include "cp/fsm/fsm.h"
+#include "cp/beacon/beacon.h"
+#include "cp/cco/bw/bw_lib_alloc.h"
+#include "cp/beacon/ntb/ntb_clock_sync.h"
+
+#include "mac/common/timings.h"
+#include "mac/common/ntb.h"
+
+#include "cp/beacon/inc/beacon.h"
+#include "cp/beacon/inc/beacon_work.h"
+#include "cp/beacon/inc/bentry_msg.h"
+#include "cp/beacon/inc/bentry_size.h"
+#include "cp/inc/context.h"
+
+/**
+ * Initialise the beacon module.
+ * \param ctx the module context.
+ */
+void
+cp_beacon_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ // Initialise the beacon module.
+ memset (&ctx->beacon, 0, sizeof (cp_beacon_t));
+
+ // Initialise the instance of the leon timer.
+ hal_timer_instance_init (ctx->hal_timer, &ctx->beacon.leon_timer,
+ &ctx,
+ (hal_timer_instance_cb_t) cp_beacon_timer_expires);
+
+ // Initialise the eCos timer.
+ cyg_counter_create(&ctx->beacon.ecos_timer_handle,
+ &ctx->beacon.ecos_timer);
+
+ // Create the eCos alarm.
+ cyg_alarm_create (ctx->beacon.ecos_timer_handle,
+ (cyg_alarm_t *) &cp_beacon_timer_expires,
+ (cyg_addrword_t) &ctx,
+ &ctx->beacon.alarm_handle,
+ &ctx->beacon.alarm);
+
+ // Initialise the central beacon common data.
+ cp_beacon_common_init (&ctx->beacon.central);
+ cp_beacon_common_init (&ctx->beacon.discover);
+ cp_beacon_common_init (&ctx->beacon.proxy);
+
+ // Initialise the callback in the interface module.
+ interface_callback_beacon_init (ctx->interface,
+ (interface_beacon_add_cb_t)cp_beacon_receive,
+ ctx);
+}
+
+/**
+ * Uninitialise the beacon module.
+ * \param ctx the module context.
+ */
+void
+cp_beacon_uninit (cp_t *ctx)
+{
+ cp_beacon_desc_t *beacon;
+
+ // Cancel the Hal timer.
+ hal_timer_instance_cancel (ctx->hal_timer, &ctx->beacon.leon_timer);
+ hal_timer_instance_uninit (ctx->hal_timer, &ctx->beacon.leon_timer);
+
+ // destroy the eCos timer.
+ cyg_alarm_disable (ctx->beacon.alarm_handle);
+
+ // destroy the counter.
+ cyg_counter_delete (ctx->beacon.ecos_timer_handle);
+
+ // Release all the beacon in the context.
+ while ((beacon = ctx->beacon.list))
+ {
+ ctx->beacon.list = ctx->beacon.list->next;
+ // Release the current one.
+ blk_release_desc ( (blk_t *) beacon);
+ }
+ ctx->beacon.list_tail = NULL;
+
+ // Uninitialise the central beacon common data.
+ cp_beacon_common_uninit (&ctx->beacon.central, ctx);
+ cp_beacon_common_uninit (&ctx->beacon.discover, ctx);
+ cp_beacon_common_uninit (&ctx->beacon.proxy, ctx);
+}
+
+/**
+ * Generate and send a beacon when the station acts as a CCo or Unassociated
+ * CCo.
+ * \param ctx the module context.
+ * \param beacon_type The beacon type to send (central, discover or proxy).
+ *
+ */
+void
+cp_beacon_cco_send_beacon (cp_t *ctx, uint beacon_type)
+{
+ cp_beacon_desc_t *beacon;
+ u64 nid;
+ set_t schedules;
+ cp_net_t *net;
+ cp_sta_own_data_t *sta;
+ cp_beacon_work_beacon_t data;
+ cp_beacon_common_t *common;
+
+ dbg_assert (ctx);
+ dbg_assert (beacon_type < CP_BEACON_TYPE_MAX);
+
+ // Allocate the resource.
+ beacon = (cp_beacon_desc_t *) blk_alloc_desc ();
+
+ // Get the station AVLN.
+ net = cp_sta_mgr_get_our_avln (ctx);
+ // get the station own data.
+ sta = cp_sta_mgr_get_sta_own_data (ctx);
+
+ // Beacon payload
+ nid = cp_net_get_nid (ctx, net);
+
+ data.nid_msb = nid >> 22;
+ data.nid_lsb = nid;
+ data.hm = sta->hybrid_mode;
+ data.stei = cp_sta_own_data_get_tei (ctx);
+ data.bt = beacon_type;
+ data.ncnr = CP_BEACON_NON_COORDINATED_NETWORK;
+ data.npsm = CP_BEACON_NPSM_NOT_ACTIVE;
+ data.num_slots = 1;
+ data.slot_usage = cp_sta_mgr_get_slot_usage (ctx);
+ data.slot_id = cp_net_get_slot_id (ctx, net);
+ data.aclss = 0;
+ data.hoip = CP_BEACON_HOIP_FALSE;
+ data.rtsbf = false;
+ data.nm = CP_BEACON_NM_CSMA_ONLY;
+ data.cco_cap = CP_CCO_LEVEL;
+
+ cp_beacon_variant_fields (ctx, beacon, &data, false /* Write. */);
+
+ // Fill the bentries.
+ cp_cco_bw_schedules_init (&schedules);
+ cp_beacon_bentry_mgr_beacon_write (ctx, beacon, beacon_type, &schedules);
+
+ if (beacon_type == CP_BEACON_CENTRAL_BEACON)
+ {
+ // Compute the PWL beacon period.
+ cp_pwl_estimate_beacon_period (ctx);
+
+ ctx->pwl.bto[0] = ctx->pwl.bto[1];
+ ctx->pwl.bto[1] = ctx->pwl.bto[2];
+ ctx->pwl.bto[2] = ctx->pwl.bto[3];
+ ctx->pwl.bto[3] = ctx->pwl.bp_ntb - ctx->pwl.per_ntb;
+
+ // Store the value of the beacon period.
+ ctx->pwl.bp_avln_ntb[0] = ctx->pwl.bp_avln_ntb[1];
+ ctx->pwl.bp_avln_ntb[1] = ctx->pwl.per_ntb;
+ ctx->pwl.bp_avln_ntb[2] = ctx->pwl.per_ntb + ctx->pwl.bp_ntb;
+
+ // Provide the schedules for the CA.
+ cp_beacon_compute_ca_schedules (ctx, &ctx->beacon.central,
+ sta->hybrid_mode, &schedules, 0);
+ }
+
+ cp_cco_bw_schedules_uninit (&schedules);
+
+ // Beacon generated. Provide it to the CA.
+ switch (beacon_type)
+ {
+ case CP_BEACON_CENTRAL_BEACON:
+ common = &ctx->beacon.central;
+ break;
+ case CP_BEACON_DISCOVER_BEACON:
+ common = &ctx->beacon.discover;
+ break;
+ case CP_BEACON_PROXY_BEACON:
+ common = &ctx->beacon.proxy;
+ break;
+ default:
+ dbg_assert (beacon_type < CP_BEACON_TYPE_MAX);
+ }
+
+ cp_beacon_send_beacon (ctx, beacon, beacon_type,
+ cp_sta_own_data_get_mac_address(ctx));
+}
+
+/**
+ * Create default schedules and provide it to the Channel Access.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_beacon_create_default_schedules (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ca_beacon_period_t beacon_period[CP_SCHED_BEACON_PERIODS_MAC];
+ ca_schedule_t *ca_sched;
+
+ ca_sched = ca_alloc_get_schedule (ctx->ca,
+ ctx->beacon.ca_schedule_index);
+ ca_sched->allocations_nb = 1;
+ ca_sched->coexistence_mode = 0x2 /* fully hybrid mode. */;
+ ca_sched->nek_switch = 0; //TODO
+
+ ca_sched->allocations[0].end_offset_tck = MAC_ATU_TO_TCK(0xFFF);
+
+ beacon_period[0].start_date = mac_ntb();
+ beacon_period[0].schedule_index = ctx->beacon.ca_schedule_index;
+ beacon_period[1].start_date = MAC_ATU_TO_TCK(0xFFF)
+ + beacon_period[0].start_date;
+ beacon_period[1].schedule_index = ctx->beacon.ca_schedule_index;
+ beacon_period[2].start_date = 2 * MAC_ATU_TO_TCK(0xFFF)
+ + beacon_period[0].start_date;
+ beacon_period[2].schedule_index = ctx->beacon.ca_schedule_index;
+
+ ctx->beacon.ca_schedule_index ++;
+
+ ca_alloc_update_beacon_periods (ctx->ca, beacon_period,
+ CP_SCHED_BEACON_PERIODS_MAC);
+
+ // TODO Program the timer
+}
+
+/**
+ * This function is only called when the station is acting as a CCo.
+ * \param ctx the module context.
+ * \param snid The new SNID.
+ *
+ * It allows the beacon module to put the change snid bentry in the central
+ * beacon. Once the count down of the snid reach 1, the snid is inserted
+ * in the station own data and in the mac config
+ */
+void
+cp_beacon_change_snid (cp_t *ctx, u8 snid)
+{
+ dbg_assert (ctx);
+
+ ctx->beacon.bentry.snid_cd = CP_BENTRY_COUNTDOWN_DEFAULT;
+ ctx->beacon.bentry.snid_new = snid;
+}
+
+/**
+ * The beacon received from the AVLN.
+ * \param ctx the module context.
+ * \param beacon The beacon received.
+ *
+ * Add the beacon to the list of received beacon, and raise the flag
+ * beacon received in STA_CORE
+ */
+void
+cp_beacon_receive (cp_t *ctx, cp_beacon_desc_t * beacon)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+
+ beacon->next = NULL;
+ if (ctx->beacon.list)
+ {
+ ctx->beacon.list_tail->next = beacon;
+ ctx->beacon.list_tail = beacon;
+ }
+ else
+ {
+ ctx->beacon.list = beacon;
+ ctx->beacon.list_tail = beacon;
+ }
+}
+
+/**
+ * Update the hrybrid mode in the station.
+ * \param ctx the module context.
+ * \param hm The new value of the hybrid mode.
+ *
+ * Update the Mac config and the station own data
+ */
+void
+cp_beacon_hybridmode_update (cp_beacon_t *ctx, u8 hm);
+
+/** Timer expires.
+ * \param alarm the alarm provided.
+ * \param data the context.
+ */
+void
+cp_beacon_timer_expires (cyg_handle_t alarm, cyg_addrword_t data)
+{
+ cp_fsm_event_t *event;
+ cp_t *ctx = (cp_t *) data;
+
+ dbg_assert (ctx);
+ dbg_assert (ctx->beacon.event_cb);
+ dbg_assert (ctx->beacon.event_user_data);
+
+ // Post an event in the FSM beacon timer expires.
+ event = cp_fsm_event_bare_new (ctx, CP_FSM_EVENT_TYPE_BEACON_TIMER_EXPIRES);
+ cp_fsm_post (ctx, event);
+}
+
+
+/**
+ * Fill the payload of the beacon when the STA is acting as CCo or UCCo.
+ * \param ctx the beacon module context
+ * \param beacon the beacon to fill.
+ * \param data The structure containing the data to read and store in the
+ * beacon or to fill when reading it from the beacon.
+ * \param read_write provide the way to use it. True to read, false to write.
+ *
+ * Can be use for
+ * - the Central beacon when acting as a CCo
+ * - the discover beacon when acting as a UCCo.
+ */
+void
+cp_beacon_variant_fields (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *data, bool read_write)
+{
+ bitstream_t bitstream;
+
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (data);
+
+ if (read_write == false)
+ beacon->nid_msb = data->nid_msb;
+ else
+ data->nid_msb = beacon->nid_msb;
+
+ bitstream_init (&bitstream, beacon->payload->beacon_mpdu_payload,
+ 8,
+ read_write == true ? BITSTREAM_READ : BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &data->nid_lsb, 22);
+ bitstream_access (&bitstream, &data->hm, 2);
+ bitstream_access (&bitstream, &data->stei, 8);
+ bitstream_access (&bitstream, &data->bt, 3);
+ bitstream_access (&bitstream, &data->ncnr, 1);
+ bitstream_access (&bitstream, &data->npsm, 1);
+ bitstream_access (&bitstream, &data->num_slots, 3);
+ bitstream_access (&bitstream, &data->slot_usage, 8);
+ bitstream_access (&bitstream, &data->slot_id, 3);
+ bitstream_access (&bitstream, &data->aclss, 3);
+ bitstream_access (&bitstream, &data->hoip, 1);
+ bitstream_access (&bitstream, &data->rtsbf, 1);
+ bitstream_access (&bitstream, &data->nm, 2);
+ bitstream_access (&bitstream, &data->cco_cap, 2);
+ bitstream_finalise (&bitstream);
+}
+
+/**
+ * Send the beacon over the PWL.
+ * TODO Implement the proxy beacon part
+ *
+ * \param ctx the cp beacon context
+ * \param beacon the beacon to send
+ * \param beacon_type the beacon type.
+ * \param mac_address the station own mac address.
+ */
+void
+cp_beacon_send_beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ uint beacon_type, mac_t mac_address)
+{
+ mfs_tx_t *mfs_beacon;
+ bool added;
+ cp_beacon_common_t *common;
+
+ dbg_assert (ctx);
+ dbg_assert (ctx->ca);
+ dbg_assert (beacon);
+
+ /* Create the MFS
+ * see http://pessac/cesar/trac/wiki/SoftMacBeacons#BeaconMFS
+ * for more details.
+ */
+ dbg_assert (ctx->mac_store);
+ switch (beacon_type)
+ {
+ case CP_BEACON_CENTRAL_BEACON:
+ mfs_beacon = mac_store_mfs_add_tx (ctx->mac_store, true, false,
+ MAC_LID_SPC_CENTRAL, 0xff, &added);
+ ctx->beacon.central.mfs = mfs_beacon;
+ mfs_beacon->cap = 0x3;
+ common = &ctx->beacon.central;
+ break;
+ case CP_BEACON_DISCOVER_BEACON:
+ mfs_beacon = mac_store_mfs_add_tx (ctx->mac_store, true, false,
+ MAC_LID_DISCOVER, 0xff, &added);
+ ctx->beacon.discover.mfs = mfs_beacon;
+ mfs_beacon->cap = 0x2;
+ common = &ctx->beacon.discover;
+ break;
+ default:
+ dbg_assert (false);
+ }
+
+ dbg_assert (mfs_beacon);
+
+ if (added)
+ {
+ mfs_beacon->beacon = true;
+ mfs_beacon->common.ats = false;
+
+ // Add the mfs to the CA
+ ca_mfs_add (ctx->ca, mfs_beacon);
+ }
+
+ if (beacon_type == CP_BEACON_CENTRAL_BEACON && common->nb_beacon_recv
+ > 0)
+ {
+ ca_mfs_hold (ctx->ca, mfs_beacon);
+ }
+
+ dbg_assert (ctx->interface);
+ interface_beacon_prepare (ctx->interface, (pb_beacon_t *)
+ beacon, mac_address, mfs_beacon,
+ &common->bpsto);
+
+ common->nb_beacon_recv ++;
+ if (!added)
+ blk_release (mfs_beacon);
+}
+
+
+/** Compute the CA schedules using the allocation defined in the bw module.
+ * \param ctx the CP context.
+ * \param common the beacon context (central, discover, proxy)
+ * \param hybrid_mode the hybrid mode of the medium
+ * \param schedules the schedules computed from the BW or read in the
+ * beacon.
+ * \param bpsto the beacon period start time offset received in a beacon.
+ */
+void
+cp_beacon_compute_ca_schedules (cp_t *ctx, cp_beacon_common_t *common,
+ uint hybrid_mode, set_t *schedules,
+ uint bpsto)
+{
+ ca_beacon_period_t beacon_period[CP_SCHED_BEACON_PERIODS_MAC];
+ ca_schedule_t *ca_sched;
+ cp_cco_bw_alloc_t *alloc;
+ uint i;
+ uint sched_index_start;
+ cp_beacon_bentry_sched_data_t snid_change_data;
+ cp_net_t *our_net;
+
+ dbg_assert (ctx);
+ dbg_assert (common);
+ dbg_assert (schedules);
+
+ sched_index_start = ctx->beacon.ca_schedule_index;
+ our_net = cp_sta_mgr_get_our_avln(ctx);
+
+ snid_change_data.cd = ctx->beacon.bentry.snid_cd;
+ snid_change_data.value_at_end = ctx->beacon.bentry.snid_new;
+ snid_change_data.value = cp_net_get_snid (ctx, our_net);
+
+ for (i = 0; i < CP_SCHED_BEACON_PERIODS_MAC; i++)
+ {
+ ca_sched = ca_alloc_get_schedule (ctx->ca,
+ ctx->beacon.ca_schedule_index + i);
+ ca_sched->allocations_nb = 0;
+ ca_sched->coexistence_mode = hybrid_mode;
+ ca_sched->nek_switch = 0; //TODO
+
+ snid_change_data.dest = (uint *)&ca_sched->snid;
+ cp_beacon_bentry_mgr_schedule_data (&snid_change_data, i);
+
+ alloc = cp_cco_bw_schedules_get_first (schedules);
+ while (alloc)
+ {
+ // If the allocation has a start time present flag a hole must be
+ // added before this time.
+ if (alloc->stpf
+ && (MAC_ATU_TO_TCK(alloc->st_atu)
+ != ca_sched->allocations[
+ ca_sched->allocations_nb - 1].end_offset_tck))
+ {
+ ca_sched->allocations[
+ ca_sched->allocations_nb].end_offset_tck =
+ MAC_ATU_TO_TCK(alloc->st_atu);
+ ca_sched->allocations[ca_sched->allocations_nb].glid =
+ MAC_LID_SPC_HOLE;
+ ca_sched->allocations_nb ++;
+ }
+
+ ca_sched->allocations
+ [ca_sched->allocations_nb].end_offset_tck =
+ MAC_ATU_TO_TCK (alloc->et_atu);
+ ca_sched->allocations[ca_sched->allocations_nb].glid =
+ alloc->glid;
+
+ ca_sched->allocations_nb ++;
+ alloc = cp_cco_bw_schedules_get_next (schedules, alloc);
+ }
+
+ // Fill the end of the beacon period with an empty allocation.
+ if (less_mod2p32(ca_sched->allocations
+ [ca_sched->allocations_nb - 1]
+ .end_offset_tck, ctx->pwl.bp_ntb))
+ {
+ ca_sched->allocations[ca_sched->allocations_nb].glid =
+ MAC_LID_SPC_HOLE;
+ ca_sched->allocations
+ [ca_sched->allocations_nb].end_offset_tck =
+ ctx->pwl.bp_ntb;
+ ca_sched->allocations_nb++;
+ }
+ }
+
+ beacon_period[0].start_date = ctx->pwl.bp_avln_ntb[0];
+ beacon_period[0].schedule_index =
+ (ctx->beacon.ca_schedule_index == 0) ? 0 :
+ sched_index_start - 1;
+
+ // ADD the schedule to the CA.
+
+ for (i = 1; i < CP_SCHED_BEACON_PERIODS_MAC; i++)
+ {
+ beacon_period[i].start_date = ctx->pwl.bp_avln_ntb[i]
+ + ctx->pwl.bto[i]
+ - bpsto;
+ beacon_period[i].schedule_index = sched_index_start;
+ sched_index_start ++;
+ }
+
+ ctx->beacon.ca_schedule_index = sched_index_start;
+
+ ca_alloc_update_beacon_periods (ctx->ca, beacon_period,
+ CP_SCHED_BEACON_PERIODS_MAC);
+}
+
+/**
+ * Process the first beacon in the received list.
+ * \param ctx the control plane context.
+ */
+void
+cp_beacon_get_and_process_beacon (cp_t *ctx)
+{
+ cp_beacon_desc_t *beacon;
+ cp_beacon_work_beacon_t beacon_vf;
+ cp_sta_own_data_t *own_sta;
+ cp_net_t *net;
+ cp_net_t *our_net;
+ cp_sta_t *sta;
+ u64 nid;
+ cp_fsm_event_t *event;
+
+ dbg_assert (ctx);
+
+ beacon = ctx->beacon.list;
+ ctx->beacon.list = ctx->beacon.list->next;
+ dbg_check (beacon);
+
+ // Read the variant fields of the beacon.
+ cp_beacon_variant_fields (ctx, beacon, &beacon_vf, true /* Read. */);
+
+ nid = (((u64)beacon_vf.nid_msb) << 22);
+ nid |= beacon_vf.nid_lsb;
+
+ // Verify beacon SNID and NID as the tracked AVLN.
+ own_sta = cp_sta_mgr_get_sta_own_data (ctx);
+ if ((nid == own_sta->nid_track)
+ && (beacon->payload->fc.snid == own_sta->snid_track)
+ && (beacon_vf.bt == CP_BEACON_CENTRAL_BEACON))
+ {
+ cp_beacon_ntb_clk_sync(ctx, beacon->payload->fc.bts,
+ beacon->payload->fc.preamble_date,
+ beacon->payload->fc.preamble_sysdate);
+ }
+
+ // Add the AVLN to the net list.
+ net = cp_sta_mgr_add_avln (ctx, beacon->payload->fc.snid, nid);
+
+ // Add the station to the net.
+ sta = cp_net_sta_add (ctx, net, beacon_vf.stei, 0x0);
+ cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
+ cp_net_sta_set_visible_status (ctx, net, sta,
+ CP_STA_VISIBLE_STATE_VISIBLE);
+
+ // Raise the event in the FSM for station action.
+ event = cp_fsm_event_beacon_new (ctx, CP_FSM_EVENT_TYPE_BEACON,
+ beacon, net, sta);
+ cp_fsm_post (ctx, event);
+
+ // Raise the event in Station Core.
+ cp_sta_core_signal_recv_beacon_event (ctx);
+
+ // Get our network.
+ our_net = cp_sta_mgr_get_our_avln (ctx);
+
+ if (our_net == net)
+ {
+ if ((beacon_vf.bt == CP_BEACON_CENTRAL_BEACON)
+ || (beacon_vf.bt == CP_BEACON_PROXY_BEACON))
+ cp_beacon_process_central_proxy (ctx, beacon, &beacon_vf);
+ else
+ cp_beacon_process_discover (ctx, beacon, &beacon_vf, net);
+ }
+ else if (own_sta->is_cco)
+ {
+ cp_beacon_process_central_read_regions (ctx, beacon, &beacon_vf);
+ }
+ else
+ {
+ // Add the station to the net.
+ if (beacon_vf.bt == CP_BEACON_CENTRAL_BEACON)
+ cp_net_set_cco (ctx, net, beacon_vf.stei);
+
+ if (beacon_vf.bt == CP_BEACON_PROXY_BEACON)
+ cp_net_set_pco (ctx, net, beacon_vf.stei);
+
+ sta->cco_cap = beacon_vf.cco_cap;
+ cp_net_commit_to_dataplane (ctx, net);
+ }
+
+ // Release the beacon.
+ blk_release_desc ((blk_t *) beacon);
+}
+
+/**
+ * Process a central or proxy beacon.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the beacon received.
+ * \param beacon_vf the variant fields previously read from the beacon.
+ */
+void
+cp_beacon_process_central_proxy (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf)
+{
+ cp_beacon_common_t *common;
+ cp_sta_own_data_t *own_data;
+ mac_t mac_address;
+ cp_sta_t *sta;
+ cp_net_t *net;
+ cp_beacon_bentry_t bentry;
+ uint nbe;
+ set_t schedules;
+ uint tei_discover;
+ cp_bentry_discover_info_struct_t info_struct;
+ u8 *bpsto = NULL;
+ cp_snid_t snid;
+ uint snid_cd;
+
+
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (beacon_vf);
+
+ // get the beacon common data.
+ if (beacon_vf->bt == CP_BEACON_CENTRAL_BEACON)
+ {
+ common = &ctx->beacon.central;
+ cp_beacon_bentry_mgr_countdown (ctx);
+ }
+ else if (beacon_vf->bt == CP_BEACON_CENTRAL_BEACON)
+ common = &ctx->beacon.proxy;
+
+ // Increase the counter.
+ common->nb_beacon_recv++;
+ // store the current NTB date.
+ common->last_beacon_ntb = mac_ntb();
+
+ // Verify if the central beacon has been received in the current beacon
+ // period.
+ if ((beacon_vf->bt == CP_BEACON_PROXY_BEACON)
+ && less_mod2p32(ctx->beacon.central.last_beacon_ntb,
+ ctx->pwl.bp_avln_ntb[1]))
+ {
+ // The central beacon of this AVLN has already been processed, it is
+ // not necessary to process it again.
+ return ;
+ }
+
+ // Store the data contained in the variant fields.
+ own_data = cp_sta_mgr_get_sta_own_data (ctx);
+ net = cp_sta_mgr_get_our_avln (ctx);
+
+ // Set Hybrid mode.
+ own_data->hybrid_mode = beacon_vf->hm;
+
+ // Store the slot id in the AVLN.
+ cp_net_set_slot_id_and_usage (ctx, net, beacon_vf->slot_id,
+ beacon_vf->slot_usage);
+
+ // Processing beacon entries.
+ cp_beacon_discover_info_init (&info_struct);
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = beacon->payload->bmis;
+
+ cp_cco_bw_schedules_init (&schedules);
+ for (nbe = beacon->payload->nbe; nbe; nbe --)
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ switch (bentry.header)
+ {
+ case CP_BENTRY_PERSISTENT_SCHEDULE:
+ case CP_BENTRY_NON_PERSISTENT_SCHEDULE:
+ cp_beacon_bentry_mgr_schedules (ctx, &bentry, &schedules);
+ break;
+ case CP_BENTRY_REGIONS:
+ cp_beacon_bentry_mgr_regions (ctx, &bentry);
+ break;
+ case CP_BENTRY_MAC_ADDRESS:
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
+ break;
+ case CP_BENTRY_DISCOVER:
+ cp_beacon_bentry_mgr_discover (&bentry, &tei_discover);
+ break;
+ case CP_BENTRY_DISCOVER_INFO:
+ cp_beacon_bentry_mgr_discover_info_bentry (&bentry, &info_struct);
+ break;
+ case CP_BENTRY_BEACON_PERIOD_START_OFFSET:
+ cp_beacon_bentry_mgr_bpsto (&bentry, &bpsto);
+ break;
+ case CP_BENTRY_ENCRYPTION_KEY_CHANGE:
+ printf ("CP_BENTRY_ENCRYPTION_KEY_CHANGE Not implemented");
+ break;
+ case CP_BENTRY_CCO_HANDOVER:
+ printf ("CP_BENTRY_CCO_HANDOVER Not implemented");
+ break;
+ case CP_BENTRY_BEACON_RELOCATION:
+ printf ("CP_BENTRY_BEACON_RELOCATION Not implemented");
+ break;
+ case CP_BENTRY_AC_LINE_SYNC_COUNTDOWN:
+ printf ("CP_BENTRY_AC_LINE_SYNC_COUNTDOWN Not implemented");
+ break;
+ case CP_BENTRY_CHANGE_NUMSLOTS:
+ printf ("CP_BENTRY_CHANGE_NUMSLOTS Not implemented");
+ break;
+ case CP_BENTRY_CHANGE_HM:
+ printf ("CP_BENTRY_CHANGE_HM Not implemented");
+ break;
+ case CP_BENTRY_CHANGE_SNID:
+ cp_beacon_bentry_mgr_snid_change (&bentry, &snid, &snid_cd);
+ break;
+ case CP_BENTRY_VENDOR:
+ break;
+ default:
+ dbg_assert ((bentry.header > CP_BENTRY_CHANGE_SNID)
+ && (bentry.header < CP_BENTRY_VENDOR));
+ }
+ }
+
+ // Add the station to the net.
+ sta = cp_net_sta_add (ctx, net, beacon_vf->stei, mac_address);
+ cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
+ cp_net_sta_set_visible_status (ctx, net, sta, true);
+
+ // Store the snid.
+ ctx->beacon.bentry.snid_cd = snid_cd;
+ ctx->beacon.bentry.snid_new = snid;
+
+
+ if (beacon_vf->bt == CP_BEACON_CENTRAL_BEACON)
+ cp_net_set_cco (ctx, net, beacon_vf->stei);
+
+ if (beacon_vf->bt == CP_BEACON_PROXY_BEACON)
+ cp_net_set_pco (ctx, net, beacon_vf->stei);
+
+ sta->cco_cap = beacon_vf->cco_cap;
+ sta->pco_cap = info_struct.proxy_net_cap;
+ sta->backup_cco_cap = info_struct.backup_cco_cap;
+ sta->numDisSta = info_struct.num_dis_sta;
+ sta->numDisNet = info_struct.num_dis_net;
+ cp_net_commit_to_dataplane (ctx, net);
+ slab_release (sta);
+
+ // Set the schedules in the station.
+ cp_beacon_compute_ca_schedules (ctx, common, beacon_vf->hm, &schedules,
+ bpsto != NULL ? read_u24_from_word (bpsto)
+ : 0);
+ cp_cco_bw_schedules_uninit (&schedules);
+
+ // If TEI discover corresponds to the current station TEI send a discover
+ // beacon.
+ if (cp_sta_own_data_get_tei (ctx) == tei_discover)
+ cp_beacon_sta_send_discover_beacon (ctx, beacon, *beacon_vf);
+}
+
+/**
+ * Process a discover beacon.
+ *
+ * \param ctx the beacon context.
+ * \param beacon the beacon received.
+ * \param beacon_vf the variant fields previously read from the beacon.
+ * \param net the AVLN previously found
+ */
+void
+cp_beacon_process_discover (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf,
+ cp_net_t *net)
+{
+ uint nbe;
+ uint stop;
+ cp_beacon_bentry_t bentry;
+ mac_t mac_address;
+ cp_bentry_discover_info_struct_t info_struct;
+ cp_sta_t *sta;
+
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (beacon_vf);
+ dbg_assert (net);
+
+ // Increase the counter.
+ ctx->beacon.discover.nb_beacon_recv++;
+ // store the current NTB date.
+ ctx->beacon.discover.last_beacon_ntb = mac_ntb();
+
+
+ // Get the number of beacon entries.
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = beacon->payload->bmis;
+
+ for (nbe = beacon->payload->nbe, stop = 0; nbe && (stop < 2); nbe--)
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ if (bentry.header == CP_BENTRY_MAC_ADDRESS)
+ {
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
+ stop ++;
+ }
+ else if (bentry.header == CP_BENTRY_DISCOVER_INFO)
+ {
+ cp_beacon_bentry_mgr_discover_info_bentry (&bentry, &info_struct);
+ stop ++;
+ }
+ }
+
+ sta = cp_net_sta_add (ctx, net, beacon_vf->stei, mac_address);
+ cp_sta_set_state (sta,
+ (info_struct.authentication == 0) ?
+ CP_STA_STATE_ASSOCIATED : CP_STA_STATE_AUTHENTICATED);
+
+ if (info_struct.cco_status)
+ cp_net_set_cco (ctx, net, beacon_vf->stei);
+ if (info_struct.pco_status)
+ cp_net_set_pco (ctx, net, beacon_vf->stei);
+ sta->is_backup_cco = info_struct.backup_cco_status;
+
+ cp_sta_set_state (sta, true /* visible. */);
+
+ sta->cco_cap = beacon_vf->cco_cap;
+ sta->pco_cap = info_struct.proxy_net_cap;
+ sta->backup_cco_cap = info_struct.backup_cco_cap;
+ sta->numDisSta = info_struct.num_dis_sta;
+ sta->numDisNet = info_struct.num_dis_net;
+ cp_net_commit_to_dataplane (ctx, net);
+
+ slab_release (sta);
+}
+
+
+/**
+ * Read the regions of the central beacon from another AVLN.
+ *
+ * \param ctx the Module context.
+ * \param beacon the beacon to process.
+ * \param beacon_vf the variant fields previously read.
+ */
+void
+cp_beacon_process_central_read_regions (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t *beacon_vf)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (beacon_vf);
+}
+
+/** Generate and send a discover beacon from the central or proxy beacon.
+ * \param ctx the CP context.
+ * \param beacon the central or proxy beacon containing the query.
+ * \param beacon_vf the variant filled read from the beacon.
+ */
+void
+cp_beacon_sta_send_discover_beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_beacon_work_beacon_t beacon_vf)
+{
+ cp_sta_own_data_t *sta;
+ cp_beacon_desc_t *disc_beacon;
+ cp_beacon_bentry_t bentry_read;
+ cp_beacon_bentry_t bentry_write;
+ uint nbe;
+ mac_t mac_address;
+ cp_bentry_discover_info_struct_t info_struct;
+
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+
+ disc_beacon = (cp_beacon_desc_t *) blk_alloc_desc ();
+
+ // Get the station own data.
+ sta = cp_sta_mgr_get_sta_own_data (ctx);
+ beacon_vf.stei = cp_sta_own_data_get_tei (ctx);
+
+ cp_beacon_variant_fields (ctx, disc_beacon, &beacon_vf,
+ false /* Write. */);
+
+ bentry_read.read_write = CP_BEACON_BENTRY_READ;
+ bentry_read.bentry_addr = beacon->payload->bmis;
+
+ bentry_write.read_write = CP_BEACON_BENTRY_WRITE;
+ bentry_write.bentry_addr = disc_beacon->payload->bmis;
+
+ // Store the mac address.
+ mac_address = cp_sta_own_data_get_mac_address (ctx);
+ cp_beacon_bentry_mgr_mac_address (&bentry_write, &mac_address);
+
+ // Store the discover info bentry.
+ cp_beacon_discover_info_init (&info_struct);
+ info_struct.cco_cap= CP_CCO_LEVEL;
+ info_struct.proxy_net_cap= CP_PCO_CAP;
+ info_struct.backup_cco_cap= CP_BACKUP_CCO_CAP;
+ info_struct.cco_status= sta->is_cco;
+ info_struct.pco_status= cp_sta_own_data_get_pco_status(ctx);
+ info_struct.backup_cco_status= false;
+ info_struct.num_dis_sta= cp_sta_mgr_get_num_discovered_stas (ctx);
+ info_struct.num_dis_net= cp_sta_mgr_get_num_discovered_net (ctx);
+ info_struct.authentication= sta->authenticated;
+ info_struct.status_user_ap_cco= false;
+
+ cp_beacon_bentry_mgr_discover_info_bentry (&bentry_write, &info_struct);
+
+ // Search for the following data.
+ for (nbe = beacon->payload->nbe; nbe; nbe--)
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry_read);
+
+ switch (bentry_read.header)
+ {
+ case CP_BENTRY_REGIONS:
+ case CP_BENTRY_PERSISTENT_SCHEDULE:
+ case CP_BENTRY_NON_PERSISTENT_SCHEDULE:
+ case CP_BENTRY_BEACON_PERIOD_START_OFFSET:
+ case CP_BENTRY_CCO_HANDOVER:
+ case CP_BENTRY_BEACON_RELOCATION:
+ case CP_BENTRY_CHANGE_NUMSLOTS:
+ case CP_BENTRY_CHANGE_SNID:
+ bitstream_memcpy (bentry_write.bentry_addr,
+ bentry_read.bentry_addr - CP_BEACON_ENTRY_HEADER,
+ bentry_read.length + CP_BEACON_ENTRY_HEADER);
+ bentry_write.bentry_addr += bentry_read.length +
+ CP_BEACON_ENTRY_HEADER;
+ }
+ }
+
+ cp_beacon_send_beacon (ctx, disc_beacon, CP_BEACON_DISCOVER_BEACON,
+ mac_address);
+}
+
+/**
+ * Process a tracked network using the central beacon or the proxy beacon.
+ * \param ctx the CP module context.
+ * \param beacon the beacon received and tracked.
+ */
+void
+cp_beacon_process_tracked_avln (cp_t *ctx, cp_beacon_desc_t *beacon)
+{
+ cp_beacon_work_beacon_t beacon_vf;
+
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+
+ cp_beacon_variant_fields (ctx, beacon, &beacon_vf, true /* read */);
+
+ cp_beacon_process_central_proxy (ctx, beacon, &beacon_vf);
+}
+
+/**
+ * Function to call once the beacon has not been received.
+ * \param ctx the module context.
+ *
+ * The beacon timer has expired and this function had been called by the FSM.
+ */
+void
+cp_beacon_beacon_not_received (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ // Call the countdown data for the bentries.
+ cp_beacon_bentry_mgr_countdown (ctx);
+}
+
diff --git a/cesar/cp/beacon/src/beacon_discover.c b/cesar/cp/beacon/src/beacon_discover.c
new file mode 100644
index 0000000000..3786532854
--- /dev/null
+++ b/cesar/cp/beacon/src/beacon_discover.c
@@ -0,0 +1,157 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/src/beacon_discover.c
+ * \brief Beacon discover process.
+ * \ingroup cp_beacon
+ *
+ * Function to compute the interval between the one no request shall be done.
+ * In this max discover period, all the station including the CCo shall send a
+ * discover beacon.
+ * For the station their are choose by the CCo using the network of its AVLN.
+ *
+ * \warn At 50Hz only 250 beacon period exists in the interval of Max Discover
+ * Period provided by the HP_AV specification which is equal to 10 seconds.
+ * 10s / 40e-3s = 250.
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "cp/beacon/inc/beacon_discover.h"
+#include "cp/inc/context.h"
+
+/** Initialise
+ * \param ctx the module context.
+ */
+void
+cp_beacon_discover_init (cp_beacon_discover_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (ctx, 0, sizeof (cp_beacon_discover_t));
+}
+
+/**
+ * Compute the interval in beacon periods.
+ * \param ctx the module context.
+ *
+ * This function compute the interval between the one no discover beacon shall
+ * be request. If the value compute is 0 it corresponds to a request each
+ * beacon period including the CCo.
+ *
+ * This shall use the value in the PWL module to know how many beacon periods
+ * are available to discover all the station of the AVLN (impossible at 50Hz).
+ * This shall request the number of station in the network (query the station
+ * manager for that) and divide it by discover_period_max_bp in the PWL
+ * module.
+ */
+void
+cp_beacon_discover_compute_interval (cp_t *ctx)
+{
+ cp_net_t *our_net;
+ dbg_assert (ctx);
+
+ our_net = cp_sta_mgr_get_our_avln (ctx);
+
+ // Store the interval in the previous variable.
+ ctx->beacon.bentry.discover.prev_disc_int_bp =
+ ctx->beacon.bentry.discover.discover_interval_bp;
+
+ // Compute the number of beacon period between to requests.
+ ctx->beacon.bentry.discover.discover_interval_bp =
+ ctx->pwl.discover_period_max_bp
+ / (cp_net_get_num_stas (ctx, our_net) + 1);
+}
+
+/**
+ * Verify if any request shall be done.
+ * \param ctx the module context.
+ * \param tei The TEI to request. 0 = The CCo shall send a discover beacon.
+ * \return true if a discover bentry shall be added to the beacon, false
+ * otherwise.
+ *
+ */
+bool
+cp_beacon_discover_need_to_request (cp_t *ctx, cp_tei_t * tei)
+{
+ cp_beacon_discover_t *discover;
+ cp_net_t *net;
+ cp_sta_own_data_t *own;
+ cp_sta_t *sta;
+ cp_sta_t *sta_next;
+
+ dbg_assert (ctx);
+ dbg_assert (tei);
+ discover = &ctx->beacon.bentry.discover;
+
+ cp_beacon_discover_compute_interval (ctx);
+
+ if (discover->prev_disc_int_bp == discover->discover_interval_bp)
+ {
+ discover->countdown_bp --;
+ }
+ else
+ {
+ discover->countdown_bp -= 1 + (discover->prev_disc_int_bp
+ - discover->discover_interval_bp);
+ }
+
+ // Verify countdown.
+ // see discover-need-to-request.dot file for the machine state in the doc
+ // directory.
+ if (discover->countdown_bp <= 0)
+ {
+ uint own_tei;
+
+ discover->countdown_bp = discover->discover_interval_bp;
+ own = cp_sta_mgr_get_sta_own_data (ctx);
+ own_tei = cp_sta_own_data_get_tei (ctx);
+ net = cp_sta_mgr_get_our_avln (ctx);
+
+ if (discover->tei_last == 0)
+ {
+ *tei = cp_sta_own_data_get_tei (ctx);
+ }
+ else if (discover->tei_last == own_tei)
+ {
+ sta = cp_net_get_first (ctx, net, CP_STA_STATE_ASSOCIATED);
+ if (sta)
+ {
+ *tei = cp_sta_get_tei (sta);
+ slab_release (sta);
+ }
+ else
+ *tei = own_tei;
+ }
+ else
+ {
+ sta = cp_net_get_sta (ctx, net, discover->tei_last);
+ if (sta)
+ {
+ sta_next = cp_net_get_next (ctx, net, sta);
+ if (sta_next)
+ {
+ *tei = cp_sta_get_tei (sta_next);
+ slab_release (sta_next);
+ }
+ else
+ *tei = own_tei;
+ }
+ else
+ *tei = own_tei;
+ }
+
+ discover->tei_last = *tei;
+
+ return true;
+ }
+
+ return false;
+}
+
+
diff --git a/cesar/cp/beacon/src/bentry.c b/cesar/cp/beacon/src/bentry.c
new file mode 100644
index 0000000000..ccc29d02b5
--- /dev/null
+++ b/cesar/cp/beacon/src/bentry.c
@@ -0,0 +1,201 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/src/bentry.c
+ * \brief Bentry manager.
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+#include "common/defs/ethernet.h"
+#include "string.h"
+#include "stdio.h"
+
+#include "lib/read_word.h"
+#include "lib/set.h"
+
+#include "cp/cp.h"
+#include "cp/defs.h"
+#include "cp/beacon/defs.h"
+#include "cp/beacon/beacon.h"
+#include "cp/cco/bw/bw_lib_alloc.h"
+
+#include "cp/inc/context.h"
+#include "cp/beacon/inc/beacon.h"
+#include "cp/beacon/inc/bentry.h"
+#include "cp/beacon/inc/bentry_msg.h"
+#include "cp/beacon/inc/bentry_size.h"
+
+/**
+ * Initialise the bentry mgr.
+ * \param ctx the module context.
+ */
+void
+cp_beacon_bentry_mgr_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (&ctx->beacon.bentry, 0, sizeof (cp_beacon_bentry_mgr_t));
+
+ cp_cco_bw_schedules_init (&ctx->beacon.bentry.allocations);
+}
+
+/**
+ * Uninitialise the bentry manager.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_beacon_bentry_mgr_uninit (cp_t *ctx)
+{
+ dbg_assert (ctx);
+}
+
+/**
+ * Decrements the countdowns.
+ * \param ctx the module context.
+ *
+ * for each countdown which will expire (value equals 1) an associated
+ * event is raise in the FSM
+ */
+void
+cp_beacon_bentry_mgr_countdown (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ /** Change snid countdown. */
+ if(ctx->beacon.bentry.snid_cd)
+ {
+ ctx->beacon.bentry.snid_cd --;
+ if (ctx->beacon.bentry.snid_cd == 0)
+ cp_sta_mgr_update_our_avln_snid(ctx, ctx->beacon.bentry.snid_new);
+ }
+}
+
+/**
+ * Read the bentries in the beacon.
+ * \param ctx the module context.
+ * \param beacon The beacon to read or to fill.
+ *
+ * If shall determine the beacon type by reading it in the beacon payload
+ */
+void
+cp_beacon_bentry_mgr_beacon_read (cp_t *ctx, cp_beacon_desc_t * beacon)
+{
+ cp_beacon_bentry_t bentry;
+
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = beacon->payload->bmis;
+
+ //TODO Define what is really need in the bentries.
+}
+
+/**
+ * Write the bentries in the beacon.
+ * \param ctx the module context.
+ * \param beacon the beacon to read or to fill.
+ * \param beacon_type the beacon type.
+ * \param schedules the set containing the schedules to provide it to the CA
+ * in the future.
+ */
+void
+cp_beacon_bentry_mgr_beacon_write (cp_t *ctx, cp_beacon_desc_t *beacon,
+ uint beacon_type, set_t *schedules)
+{
+ cp_beacon_bentry_t bentry;
+ uint nb_bentries;
+ mac_t mac_address;
+ cp_sta_own_data_t *sta_own_data;
+ set_t current_schedules;
+
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (beacon_type < CP_BEACON_TYPE_MAX);
+ dbg_assert (schedules);
+
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+ bentry.bentry_addr = beacon->payload->bmis;
+ bentry.space_available = sizeof(beacon->payload->bmis);
+
+ //Write regions.
+ cp_beacon_bentry_mgr_regions (ctx, &bentry);
+
+ // Write schedules.
+ cp_cco_bw_schedules_init (&current_schedules);
+ bentry.header = CP_BENTRY_NON_PERSISTENT_SCHEDULE;
+ cp_cco_bw_schedules_prepare (ctx, &current_schedules,
+ CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT);
+ cp_beacon_bentry_mgr_schedules (ctx, &bentry, &current_schedules);
+ cp_cco_bw_schedules_move (schedules, &current_schedules);
+ cp_cco_bw_schedules_uninit (&current_schedules);
+
+ cp_cco_bw_schedules_init (&current_schedules);
+ bentry.header = CP_BENTRY_PERSISTENT_SCHEDULE;
+ cp_cco_bw_schedules_prepare (ctx, &current_schedules,
+ CP_CCO_BW_PERSISTENCE_PERSISTENT);
+ cp_beacon_bentry_mgr_schedules (ctx, &bentry, &current_schedules);
+ cp_cco_bw_schedules_move (schedules, &current_schedules);
+ cp_cco_bw_schedules_uninit (&current_schedules);
+
+ // Mac address
+ sta_own_data = cp_sta_mgr_get_sta_own_data (ctx);
+ mac_address = cp_sta_own_data_get_mac_address (ctx);
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
+
+ // BPSTO
+ cp_beacon_bentry_mgr_bpsto (&bentry, (u8**) &ctx->beacon.central.bpsto);
+
+ if (beacon_type == CP_BEACON_DISCOVER_BEACON)
+ {
+ cp_bentry_discover_info_struct_t info_struct;
+
+ info_struct.updated = true;
+ info_struct.cco_cap = CP_CCO_LEVEL;
+ info_struct.proxy_net_cap = CP_PCO_CAP;
+ info_struct.backup_cco_cap = CP_BACKUP_CCO_CAP;
+ info_struct.cco_status = sta_own_data->is_cco;
+ info_struct.pco_status = cp_sta_own_data_get_pco_status(ctx);
+ info_struct.backup_cco_status = false;
+ info_struct.num_dis_sta = cp_sta_mgr_get_num_discovered_stas (ctx);
+ info_struct.num_dis_net = cp_sta_mgr_get_num_discovered_stas (ctx);
+ info_struct.authentication = sta_own_data->authenticated;
+ info_struct.status_user_ap_cco = false;
+
+ cp_beacon_bentry_mgr_discover_info_bentry (&bentry, &info_struct);
+
+ // Write the quantity of beacon entries.
+ // TODO compute the values once the generation becomes an automaton
+ nb_bentries = 6;
+ }
+ else
+ nb_bentries = 5;
+
+ beacon->payload->nbe = nb_bentries;
+}
+
+/**
+ * Store the stat in the destination pointer provided.
+ * \param data the structure containing the data
+ * \param index the current index value.
+ */
+void
+cp_beacon_bentry_mgr_schedule_data (cp_beacon_bentry_sched_data_t *data,
+ uint index)
+{
+ dbg_assert (data);
+ dbg_assert (data->dest);
+
+ if (data->cd != 0 && (data->cd <= index))
+ *data->dest = data->value_at_end;
+ else
+ *data->dest = data->value;
+}
+
diff --git a/cesar/cp/beacon/src/bentry_msg.c b/cesar/cp/beacon/src/bentry_msg.c
new file mode 100644
index 0000000000..d2bab26347
--- /dev/null
+++ b/cesar/cp/beacon/src/bentry_msg.c
@@ -0,0 +1,512 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/src/bentry_msg.c
+ * \brief All the function to read or write a bentry in the beacon.
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+#include "common/defs/ethernet.h"
+#include "cp/types.h"
+
+#include "cp/cp.h"
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/bw_lib_alloc.h"
+
+#include "cp/inc/context.h"
+#include "cp/beacon/inc/bentry_msg.h"
+#include "cp/beacon/inc/bentry_size.h"
+
+/**
+ * Initialise the discover info structure.
+ * \param ctx the discover info structure.
+ */
+void
+cp_beacon_discover_info_init (cp_bentry_discover_info_struct_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (ctx, 0, sizeof (cp_bentry_discover_info_struct_t));
+}
+
+/**
+ * Read or write the bentry header.
+ */
+void
+cp_beacon_bentry_mgr_process_header (cp_beacon_bentry_t *bentry)
+{
+ dbg_assert (bentry);
+
+ if (bentry->read_write == CP_BEACON_BENTRY_READ)
+ {
+ bentry->header = read_u8_from_word (bentry->bentry_addr);
+ bentry->length = read_u8_from_word (bentry->bentry_addr + 1);
+ }
+ else
+ {
+ *bentry->bentry_addr = bentry->header;
+ *(bentry->bentry_addr +1) = bentry->length;
+ }
+
+ bentry->bentry_addr += CP_BEACON_ENTRY_HEADER;
+ bentry->space_available -= CP_BEACON_ENTRY_HEADER;
+}
+
+/**
+ * Process the schedules.
+ * \param ctx the CP context.
+ * \param bentry The bentry start address.
+ * \param set The set to read or store the schedules.
+ *
+ * The same function reads or write the persistent and non persistent
+ * schedules, for the non_persistent boolean provided in parameter
+ * indicate which kind of schedule this function will process.
+ *
+ * \Warn This function will not provide the schedules to the Channel Access.
+ */
+void
+cp_beacon_bentry_mgr_schedules (cp_t *ctx,
+ cp_beacon_bentry_t *bentry,
+ set_t *set)
+{
+ bitstream_t bitstream;
+ uint ns;
+ uint i;
+ uint unused;
+ uint length;
+ u8 *bentry_start_addr;
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert (ctx);
+ dbg_assert (bentry);
+ dbg_assert (set);
+
+ // If no schedule return.
+ if (set_empty (set) && (bentry->read_write == CP_BEACON_BENTRY_WRITE))
+ return;
+
+ // When writing the schedules are not known until it is written.
+ // For that the start of the bentry address is store here and the length
+ // is computed when necessary.
+ bentry_start_addr = bentry->bentry_addr;
+ length = 0;
+
+ // Jump to the bentry payload.
+ if (bentry->read_write == CP_BEACON_BENTRY_WRITE)
+ bentry->bentry_addr += CP_BEACON_ENTRY_HEADER;
+
+ // Initialise the bitstream
+ bitstream_init (&bitstream, bentry->bentry_addr, 136,
+ (bentry->read_write == CP_BEACON_BENTRY_READ) ?
+ BITSTREAM_READ : BITSTREAM_WRITE);
+
+ if (bentry->header == CP_BENTRY_PERSISTENT_SCHEDULE)
+ {
+ bitstream_access (&bitstream,
+ &ctx->beacon.bentry.persistent_schedule_pscd,
+ 3);
+
+ bitstream_access (&bitstream,
+ &ctx->beacon.bentry.persistent_schedule_cscd,
+ 3);
+
+ /* Reserved */
+ bitstream_access (&bitstream, &unused, 2);
+
+ // Add a byte to the length.
+ length ++;
+ }
+
+ ns = 0;
+ if (bentry->read_write == CP_BEACON_BENTRY_WRITE)
+ ns = cp_cco_bw_get_nb_alloc(ctx, bentry->header ==
+ CP_BENTRY_PERSISTENT_SCHEDULE ?
+ CP_CCO_BW_PERSISTENCE_PERSISTENT :
+ CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT);
+
+ bitstream_access (&bitstream, &ns, 6);
+ unused = 0;
+ bitstream_access (&bitstream, &unused, 2);
+ // Add a byte to the length.
+ length ++;
+
+ for (i = 0; i < ns; i++)
+ {
+ if (bentry->read_write == CP_BEACON_BENTRY_READ)
+ {
+ alloc = blk_alloc();
+ alloc->persistence = CP_BENTRY_PERSISTENT_SCHEDULE ?
+ CP_CCO_BW_PERSISTENCE_PERSISTENT :
+ CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ }
+ else
+ alloc = (i == 0 ? cp_cco_bw_schedules_get_first (set) :
+ cp_cco_bw_schedules_get_next (set, alloc));
+
+ bitstream_access (&bitstream, &alloc->stpf, 1);
+ bitstream_access (&bitstream, &alloc->glid, 7);
+
+ if (alloc->stpf)
+ {
+ bitstream_access (&bitstream, &alloc->st_atu, 12);
+ length += CP_BEACON_ENTRY_SCHED_SAI_STPF;
+ }
+ else
+ length += CP_BEACON_ENTRY_SCHED_SAI_NSTPF;
+
+ bitstream_access (&bitstream, &alloc->et_atu, 12);
+ if (!alloc->stpf)
+ /* Reserved bits. */
+ bitstream_access (&bitstream, &unused, 4);
+
+ if (bentry->read_write == CP_BEACON_BENTRY_READ)
+ cp_cco_bw_schedules_add (set, alloc, false);
+ }
+ bitstream_finalise (&bitstream);
+
+ // Store the header and the length in the bentry header only if writing.
+ if (bentry->read_write == CP_BEACON_BENTRY_WRITE)
+ {
+ bentry->length = length;
+ bentry->bentry_addr = bentry_start_addr;
+ cp_beacon_bentry_mgr_process_header (bentry);
+ }
+
+ bentry->bentry_addr += bentry->length;
+ bentry->space_available -= bentry->length;
+}
+
+/**
+ * Read or write the regions in the beacon.
+ * \param ctx the module context.
+ * \param bentry The bentry address to process.
+ *
+ * When reading the regions it shall directly update the data in the
+ * region manager (only in CCo mode). On the write process it shall get
+ * the regions from the region manager
+ */
+void
+cp_beacon_bentry_mgr_regions (cp_t *ctx, cp_beacon_bentry_t *bentry)
+{
+ uint nr;
+ uint i;
+ bitstream_t bitstream;
+ uint unused;
+ cp_cco_region_inl_alloc_t *region;
+
+ dbg_assert (ctx);
+ dbg_assert (bentry);
+
+ // In this case the header has already been read by the bentry manager.
+ // The only job is to compute the next address of the next bentry.
+ // The region manager does not need this.
+ if (bentry->read_write == CP_BEACON_BENTRY_READ)
+ {
+ nr = read_u8_from_word (bentry->bentry_addr) & BITS_ONES(6);
+
+ // Compute the address
+ bentry->bentry_addr += CP_BEACON_ENTRY_REGION(nr);
+ }
+ else
+ {
+ nr = cp_cco_region_get_nb_region (ctx);
+ bentry->header = CP_BENTRY_REGIONS;
+ bentry->length = CP_BEACON_ENTRY_REGION(nr);
+ cp_beacon_bentry_mgr_process_header (bentry);
+
+ // Initialise the bitstream context.
+ bitstream_init (&bitstream, bentry->bentry_addr,
+ bentry->length, BITSTREAM_WRITE);
+
+ region = cp_cco_region_get_region (ctx);
+ // Write the Number of regions.
+ bitstream_access (&bitstream, &nr, 6);
+
+ // RSVD data.
+ unused = 0;
+ bitstream_access (&bitstream, &unused, 2);
+ for (i = 0; i < nr; i++)
+ {
+ dbg_assert (region);
+ // Write the allocation type.
+ bitstream_access (&bitstream, &region->state, 4);
+ // Write the end time.
+ bitstream_access (&bitstream, &region->et, 12);
+
+ // Get the next one.
+ region = cp_cco_region_get_next_alloc (ctx, region);
+ }
+
+ bitstream_finalise (&bitstream);
+
+ bentry->bentry_addr += bentry->length;
+ }
+
+ bentry->space_available -= bentry->length;
+}
+
+/**
+ * Read or write the mac address in the beacon.
+ * \param bentry The address of the start of the bentry.
+ * \param mac_address The mac address to store or the variable to set when
+ * it is reading a mac address bentry.
+ */
+void
+cp_beacon_bentry_mgr_mac_address (cp_beacon_bentry_t *bentry,
+ mac_t * mac_address)
+{
+ bitstream_t bitstream;
+ dbg_assert (bentry);
+ dbg_assert (mac_address);
+
+ if (bentry->read_write == CP_BEACON_BENTRY_READ)
+ {
+ bitstream_init (&bitstream, bentry->bentry_addr, ETH_MAC_ADDRESS_SIZE,
+ BITSTREAM_READ);
+
+ bitstream_access (&bitstream, mac_address,
+ BYTES_SIZE_TO_BITS(ETH_MAC_ADDRESS_SIZE));
+
+ }
+ else
+ {
+ bentry->header = CP_BENTRY_MAC_ADDRESS;
+ bentry->length = CP_BEACON_ENTRY_MAC_ADDRESS;
+ cp_beacon_bentry_mgr_process_header (bentry);
+
+ bitstream_init (&bitstream, bentry->bentry_addr, ETH_MAC_ADDRESS_SIZE,
+ BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, mac_address,
+ BYTES_SIZE_TO_BITS(ETH_MAC_ADDRESS_SIZE));
+ }
+ bitstream_finalise (&bitstream);
+
+ bentry->bentry_addr += ETH_MAC_ADDRESS_SIZE;
+ bentry->space_available -= bentry->length;
+}
+
+/**
+ * Read or write a discover info bentry.
+ * \param bentry The bentry start address.
+ * \param info_struct The info data to fill or use for the bentry.
+ */
+void
+cp_beacon_bentry_mgr_discover_info_bentry (cp_beacon_bentry_t *bentry,
+ cp_bentry_discover_info_struct_t *info_struct)
+{
+ bitstream_t bitstream;
+ uint unused;
+
+ dbg_assert (bentry);
+ dbg_assert (info_struct);
+
+ if (bentry->read_write == CP_BEACON_BENTRY_WRITE)
+ cp_beacon_bentry_mgr_process_header (bentry);
+
+ bitstream_init (&bitstream, bentry->bentry_addr,
+ CP_BEACON_ENTRY_DISCOVER_INFO,
+ (bentry->read_write == CP_BEACON_BENTRY_READ) ?
+ BITSTREAM_READ : BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, &info_struct->updated, 1);
+ bitstream_access (&bitstream, &info_struct->cco_cap, 2);
+ bitstream_access (&bitstream, &info_struct->proxy_net_cap, 1);
+ bitstream_access (&bitstream, &info_struct->backup_cco_cap, 1);
+ bitstream_access (&bitstream, &info_struct->cco_status, 1);
+ bitstream_access (&bitstream, &info_struct->pco_status, 1);
+ bitstream_access (&bitstream, &info_struct->backup_cco_status, 1);
+ bitstream_access (&bitstream, &info_struct->num_dis_sta, 8);
+ bitstream_access (&bitstream, &info_struct->num_dis_net, 8);
+ bitstream_access (&bitstream, &info_struct->authentication, 1);
+ bitstream_access (&bitstream, &info_struct->status_user_ap_cco, 1);
+
+ //reserved bits.
+ unused = 0;
+ bitstream_access (&bitstream, &unused, 6);
+
+ bitstream_finalise (&bitstream);
+
+ bentry->bentry_addr += CP_BEACON_ENTRY_DISCOVER_INFO;
+}
+
+/**
+ * Read or write a discover bentry.
+ * \param bentry The start of the bentry address.
+ * \param tei the TEI of the station requested.
+ *
+ * If write it will request to next station in the station manager to
+ * request a discover beacon. This will call the station manager to get
+ * the next station corresponding to the station discover variable
+ */
+void
+cp_beacon_bentry_mgr_discover (cp_beacon_bentry_t *bentry, uint *tei)
+{
+ bitstream_t bitstream;
+ dbg_assert (bentry);
+ dbg_assert (tei);
+
+ if (bentry->read_write == CP_BEACON_BENTRY_WRITE)
+ cp_beacon_bentry_mgr_process_header (bentry);
+
+
+ bitstream_init (&bitstream, bentry->bentry_addr,
+ CP_BEACON_ENTRY_DISCOVER,
+ (bentry->read_write == CP_BEACON_BENTRY_READ) ?
+ BITSTREAM_READ : BITSTREAM_WRITE);
+
+ bitstream_access (&bitstream, tei, 8);
+ bitstream_finalise (&bitstream);
+
+ bentry->bentry_addr += CP_BEACON_ENTRY_DISCOVER;
+}
+
+/**
+ * Read or write the BPSTO.
+ * \param bentry Bentry start address.
+ * \param BPSTO To store the address of the beacon period start time offset.
+ *
+ * store the address of the BPSTO in the BPSTO variable of the beacon_common
+ * structure data
+ */
+void
+cp_beacon_bentry_mgr_bpsto (cp_beacon_bentry_t *bentry,
+ u8 **bpsto)
+{
+ dbg_assert (bentry);
+ dbg_assert (bpsto);
+
+ if (bentry->read_write == CP_BEACON_BENTRY_WRITE)
+ {
+ bentry->header = CP_BENTRY_BEACON_PERIOD_START_OFFSET;
+ bentry->length = CP_BEACON_ENTRY_BPSTO;
+ cp_beacon_bentry_mgr_process_header (bentry);
+ }
+
+ *bpsto = bentry->bentry_addr;
+ bentry->bentry_addr += CP_BEACON_ENTRY_BPSTO;
+ bentry->space_available -= bentry->length;
+}
+
+/**
+ * Read or write the encryption key change bentry.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_eks_change (cp_t *ctx,
+ u8 * bentry, bool read_write);
+
+/**
+ * Read or write the CCo Handover bentry.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_hoip_change (cp_t *ctx,
+ u8 * bentry, bool read_write);
+
+/**
+ * Read or write the beacon relocation bentry.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_relocation (cp_t *ctx,
+ u8 * bentry, bool read_write);
+
+/**
+ * Read or write the beacon AC line bentry.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_acl (cp_t *ctx, u8 * bentry,
+ bool read_write);
+
+/**
+ * Read or write the change numslots bentry.
+ * \param bentry The start address bentry.
+ * \param numslots the variable use to store or to read the number of slots.
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+void
+cp_beacon_bentry_mgr_num_slots_change (cp_beacon_bentry_t *bentry,
+ u8 *numslots);
+
+/**
+ * Read or write the Hm change.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param read_write Read or write bool status.
+ * \return \todo fill this
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+u8 *
+cp_beacon_bentry_mgr_hm_change (cp_t *ctx, u8 * bentry,
+ bool read_write);
+
+/**
+ * Read or write the Change SNID.
+ * \param ctx the module context.
+ * \param bentry The start address bentry.
+ * \param snid Read or write SNID value.
+ * \param snidcd the SNID countdown
+ *
+ * on write it use the data stored in the context. On read it shall update
+ * the context data
+ */
+void
+cp_beacon_bentry_mgr_snid_change (cp_beacon_bentry_t *bentry,
+ cp_snid_t *snid, uint *snidcd)
+{
+ bitstream_t bitstream;
+ dbg_assert (bentry);
+ dbg_assert (snid);
+
+ if (bentry->read_write == CP_BEACON_BENTRY_WRITE)
+ cp_beacon_bentry_mgr_process_header (bentry);
+
+ bitstream_init (&bitstream, bentry->bentry_addr,
+ CP_BEACON_ENTRY_CHANGE_SNID,
+ (bentry->read_write == CP_BEACON_BENTRY_WRITE) ?
+ BITSTREAM_WRITE : BITSTREAM_READ);
+
+ bitstream_access (&bitstream, snidcd, 4);
+ bitstream_access (&bitstream, snid, 4);
+
+ bitstream_finalise (&bitstream);
+
+ bentry->bentry_addr += CP_BEACON_ENTRY_CHANGE_SNID;
+}
+
diff --git a/cesar/cp/beacon/src/common.c b/cesar/cp/beacon/src/common.c
new file mode 100644
index 0000000000..30a7b8d9df
--- /dev/null
+++ b/cesar/cp/beacon/src/common.c
@@ -0,0 +1,53 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/src/common.c
+ * \brief Common beacon data functions.
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "cp/cp.h"
+
+#include "cp/inc/context.h"
+#include "cp/beacon/inc/common.h"
+
+/**
+ * Initialise the context.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_beacon_common_init (cp_beacon_common_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (ctx, 0, sizeof (cp_beacon_common_t));
+}
+
+/**
+ * Uninitialise the context.
+ * \param ctx the module context.
+ * \param cp the CP module context to use the mac store to remove the MFS.
+ */
+void
+cp_beacon_common_uninit (cp_beacon_common_t *ctx, cp_t *cp)
+{
+ dbg_assert (ctx);
+
+ if (ctx->mfs)
+ {
+ mac_store_mfs_remove (cp->mac_store, (mfs_t *) ctx->mfs);
+ blk_release (ctx->mfs);
+ }
+
+ memset (ctx, 0, sizeof (cp_beacon_common_t));
+}
+
diff --git a/cesar/cp/beacon/test/Makefile b/cesar/cp/beacon/test/Makefile
new file mode 100644
index 0000000000..5eca0540aa
--- /dev/null
+++ b/cesar/cp/beacon/test/Makefile
@@ -0,0 +1,43 @@
+BASE = ../../..
+
+INCLUDES = cp/beacon/test/overide
+
+ECOS = y
+
+TARGET_PROGRAMS = beacon bentry cco_send_cb sta_recv_cb default_sched \
+ discover-process
+
+beacon_SOURCES = beacon.c hal_timer_stub.c cl_stub.c bw_stub.c region_stub.c \
+ ca_stub.c interface_stub.c ntb_stub.c core_stub.c fsm_stub.c
+beacon_MODULES = lib cp/beacon cp/sta/mgr mac/common cp/cco/bw \
+ cp/pwl
+
+bentry_SOURCES = bentry.c region_stub.c bw_stub.c cl_stub.c ntb_stub.c \
+ core_stub.c interface_stub.c fsm_stub.c
+bentry_MODULES = lib cp/beacon cp/sta/mgr mac/common cp/cco/bw
+
+cco_send_cb_SOURCES = cco_send_central_beacon.c bw_stub.c region_stub.c \
+ cl_stub.c hal_timer_stub.c ntb_stub.c core_stub.c \
+ fsm_stub.c
+cco_send_cb_MODULES = lib cp/beacon cp/sta/mgr mac/common cp/cco/bw \
+ cp/pwl
+
+sta_recv_cb_SOURCES = sta_receive_central_beacon.c bw_stub.c region_stub.c \
+ cl_stub.c hal_timer_stub.c ntb_stub.c core_stub.c \
+ fsm_stub.c
+sta_recv_cb_MODULES = lib cp/beacon cp/sta/mgr mac/common cp/cco/bw \
+ cp/pwl
+
+default_sched_SOURCES= default-sched.c bw_stub.c region_stub.c \
+ cl_stub.c hal_timer_stub.c ntb_stub.c core_stub.c \
+ fsm_stub.c
+default_sched_MODULES = lib cp/beacon cp/sta/mgr mac/common cp/cco/bw \
+ cp/pwl
+
+discover-process_SOURCES= discover.c core_stub.c cl_stub.c fsm_stub.c
+discover-process_MODULES= lib cp/beacon mac/common cp/sta/mgr cp/pwl
+
+
+cp_cco_bw_MODULE_SOURCES = bw_lib_alloc.c
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/beacon/test/doc/Makefile b/cesar/cp/beacon/test/doc/Makefile
new file mode 100644
index 0000000000..03f14d7cb9
--- /dev/null
+++ b/cesar/cp/beacon/test/doc/Makefile
@@ -0,0 +1,20 @@
+PAGES= beacon.txt bentry.txt send-beacon.txt recv-beacon.txt default-schedules.txt beacon-discover.txt
+
+ODT=$(PAGES:%.txt=%.odt)
+HTML=$(PAGES:%.txt=%.html)
+
+all: $(ODT) $(HTML)
+
+odt: $(ODT)
+
+html: $(HTML)
+
+%.odt: %.txt
+ rst2odt.py $< $@
+
+%.html: %.txt
+ rst2html $< $@
+
+clean:
+ rm -f $(ODT)
+ rm -f $(HTML)
diff --git a/cesar/cp/beacon/test/doc/beacon-discover.txt b/cesar/cp/beacon/test/doc/beacon-discover.txt
new file mode 100644
index 0000000000..fef6fa13a3
--- /dev/null
+++ b/cesar/cp/beacon/test/doc/beacon-discover.txt
@@ -0,0 +1,129 @@
+Beacon Discover
+===============
+
+Init
+----
+
+Shall initialise and add all parameters to 0
+
+Compute interval
+----------------
+
+Test 1 : AC Line 50 Hz
+~~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+
+* Initialise the PWL module to correspond to an ACL frequency equal to 50 Hz.
+* Add 3 stations authenticated in the AVLN with TEI 1, 2 and 3.
+
+Result
+ The value computed shall be 250 / 4 = 62.
+
+Test 2 : AC Line 60 Hz
+~~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+
+* Initialise the PWL module to correspond to an ACL frequency equal to 50 Hz.
+* Add 3 stations authenticated in the AVLN with TEI 1, 2 and 3.
+
+Result
+ The value computed shall be 300 / 4 = 75.
+
+Need to request
+---------------
+
+This test shall verify the algorithm.
+
+Test 1 : Stable system
+~~~~~~~~~~~~~~~~~~~~~~
+
+This test is done with three stations in the station manager and it will not be modified.
+The objective is to verify the countdown and the TEI returned by the function.
+
+Environment
+
+* AC Line at 50 Hz.
+
+* Station own data
+
+ * is cco = true
+ * TEI = 1
+
+* Station 1, TEI = 2
+* Station 2, TEI = 3
+* Station 3, TEI = 4
+
+Result
+
+* First shot
+
+ * The first shoot will return true, with TEI == 1.
+ * Countdown shall be equal to 62 beacon periods.
+ * The previous disc interval bp shall be equal to the discover interval bp.
+
+* Second shot
+
+ * shall return false.
+ * Countdown shall be equal to 61 beacon periods.
+ * The previous disc interval bp shall be equal to the discover interval bp.
+
+* Countdown reach 0
+
+ * Shall return true, with TEI == 1 indicate that the CCo shall send a discover beacon.
+ * Countdown shall be equal to 62.
+ * The previous disc interval bp shall be equal to the discover interval bp.
+
+* Countdown reach 0 again
+
+ * Shall return true, with TEI == 2.
+ * Countdown shall be equal to 62.
+ * The previous disc interval bp shall be equal to the discover interval bp.
+
+Test 2 : Variable system (Add or remove STAs)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This test is done with three stations in the station manager and ends with 5.
+The objective is to verify the countdown and the TEI returned by the function.
+
+Environment
+
+* AC Line at 50 Hz.
+
+* Station own data
+
+ * is cco = true
+ * TEI = 1
+
+* Station 1, TEI = 2
+* Station 2, TEI = 3
+* Station 3, TEI = 4
+* and so on...
+
+Result
+
+* First shot : only 3 stations.
+
+ * The first shoot will return false.
+ * Countdown shall be equal to 62 beacon periods.
+ * The previous disc interval bp shall be equal to the discover interval bp.
+
+* Second shot : 5 stations
+
+ * shall return false.
+ * Countdown shall be equal to 40 beacon periods.
+ * The previous disc interval bp = 62
+ * The discover interval bp = 39
+
+* Countdown reach 0
+
+ * Shall return true, with TEI == 1.
+ * Countdown shall be equal to 41.
+ * The previous disc interval bp shall be equal to the discover interval bp.
+
+* Countdown reach 0 again
+
+ * Shall return true, with TEI == 2.
+ * Countdown shall be equal to 41.
+ * The previous disc interval bp shall be equal to the discover interval bp.
diff --git a/cesar/cp/beacon/test/doc/beacon.txt b/cesar/cp/beacon/test/doc/beacon.txt
new file mode 100644
index 0000000000..fc75e07877
--- /dev/null
+++ b/cesar/cp/beacon/test/doc/beacon.txt
@@ -0,0 +1,42 @@
+Beacon test
+===========
+
+Initialise
+----------
+
+At the end of this test, all the variables present in the beacon context shall
+be equal to zero or null for the pointers.
+The hal_timer shall be initialised and the eCos alarm too.
+
+Uninitialise
+------------
+
+The uninit procedure, shall stop the timers and release all the object
+referenced by the beacon module.
+
+ * Stop the HAL timer
+ * Stop the eCos timer
+ * Release all beacon received and not processed yet.
+ * Call the uninit function for the common sub context.
+
+Environment
+ This test shall insert some data in the pointers and the context.
+
+ 1. Add at least two beacon in the received list.
+ 2. Add a central beacon in the central sub context.
+ 3. Add a discover beacon in the discover sub context.
+ 4. Add a proxy beacon in the discover sub context.
+
+Result
+ At the end the beacon module shall not have any referenced on any object.
+ The memory leak test shall be positive i.e. no memory leaks.
+
+Init event call back
+--------------------
+
+Environment
+ call this function with user data context and a function.
+
+Result
+ The envent_cb of the beacon module and the event_user_data shall correspond to the parameter provided.
+
diff --git a/cesar/cp/beacon/test/doc/bentry.txt b/cesar/cp/beacon/test/doc/bentry.txt
new file mode 100644
index 0000000000..de3afda894
--- /dev/null
+++ b/cesar/cp/beacon/test/doc/bentry.txt
@@ -0,0 +1,220 @@
+Bentry
+======
+
+Test the bentry sub module.
+
+init
+----
+
+The init function shall set all the context to 0.
+
+Process Header
+--------------
+
+Read
+ Shall read the header of the bentry and the length of the bentry. It shall return the address of the payload.
+
+Write
+ Shall write the header and the length of the bentry provided in parameters. It shall return the address to write the next bentry.
+
+Mgr Beacon
+----------
+
+Shall write the data necessary to the beacon.
+
+Region
+~~~~~~
+
+Read
+""""
+
+Environment
+ Initialise the region manager, the stubbed function will return two regions.
+
+Result
+ The result only consists to provide the address of the next bentry.
+
+Write
+"""""
+
+Environment
+ Initialise the region manager, the stubbed function will return two regions:
+
++-------------+----------+
+| Region Type | End time |
++-------------+----------+
+| Beacon | 52 |
++-------------+----------+
+| CSMA | 3905 |
++-------------+----------+
+
+Result
+ The address return shall be : 1 byte + 2 * 2 bytes.
+
+ 1 byte for the Number of region.
+
+ 2 bytes per region definition.
+
+ The buffer shall contain the following data:
+
++--------------+-------+-------------------------------+
+| Buffer index | Value | Type |
++--------------+-------+-------------------------------+
+| 0 | 0x2 | Number of region |
++--------------+-------+-------------------------------+
+| 1 | 0x40 | Beacon region |
++--------------+-------+-------------------------------+
+| 2 | 0x03 | 52 * 10.24 us |
++--------------+-------+-------------------------------+
+| 3 | 0x14 | CSMA + first byte of end time |
++--------------+-------+-------------------------------+
+| 4 | 0xF4 | end of the end time region |
++--------------+-------+-------------------------------+
+
+Persistent schedules
+~~~~~~~~~~~~~~~~~~~~
+
+Environment
+ Request some allocation from the bandwidth manager and store it in the beacon payload.
+
++--------+-------+------+------+------+
+| Number | STPF | GLID | ST | ET |
++--------+-------+------+------+------+
+| 1 | true | 1 | 0 | 10 |
++--------+-------+------+------+------+
+| 2 | false | 2 | | 50 |
++--------+-------+------+------+------+
+| 3 | true | 3 | 1500 | 3000 |
++--------+-------+------+------+------+
+
+Result
+ At the end in the beacon payload it shall have 3 sessions of persistent schedules corresponding to the values indicated in the table above.
+
+Non Persistent schedules
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Write
+"""""
+
+Environment
+ Request some allocation from the bandwidth manager and store it in the beacon payload.
+
++--------+-------+------+------+------+
+| Number | STPF | GLID | ST | ET |
++--------+-------+------+------+------+
+| 1 | true | 4 | 50 | 750 |
++--------+-------+------+------+------+
+| 2 | false | 5 | | 850 |
++--------+-------+------+------+------+
+| 3 | true | 6 | 900 | 1500 |
++--------+-------+------+------+------+
+
+Result
+ At the end in the beacon payload it shall have 3 sessions of non persistent schedules corresponding to the values indicated in the table above.
+
+Mac address
+~~~~~~~~~~~
+
+Read
+""""
+
+Store a mac address in with the bitstream in the buffer, and launch the
+function to read the mac address.
+
+Environment
+ Mac address used : 12:32:56:78:9A:BC
+
+Result
+ The buffer shall contain the mac address starting at the index 2.
+
+Write
+"""""
+
+Reads a mac address from the buffer.
+
+Environment
+ Mac address used (and stored in the buffer) : 23:45:67:89:AB:CD
+
+Result
+ The mac address read shall correspond to the mac address used.
+
+Discover bentry
+~~~~~~~~~~~~~~~
+
+Read
+""""
+
+Read a discover bentry.
+This shall read the TEI contained in the discover bentry.
+
+Write
+"""""
+
+Stores the TEI in the bentry.
+
+Discover info bentry
+~~~~~~~~~~~~~~~~~~~~
+
+Stores the element of the structure or read the bentry data and store it in
+the structure.
+
+Beacon Bentry write
+-------------------
+
+Writes a full beacon entries.
+It will use all the data already use in the tests above.
+
+Environment
+ Regions, two regions
+
+ * beacon regions ending at 52 ATU.
+ * CSMA-ONLY ending at 3905 ATU.
+
+ Non Persistent schedules, 3 allocations.
+
++--------+-------+------+------+------+
+| Number | STPF | GLID | ST | ET |
++--------+-------+------+------+------+
+| 1 | true | 4 | 50 | 750 |
++--------+-------+------+------+------+
+| 2 | false | 5 | | 850 |
++--------+-------+------+------+------+
+| 3 | true | 6 | 900 | 1500 |
++--------+-------+------+------+------+
+
+ Persistent schedules, 3 allocations.
+
++--------+-------+------+------+------+
+| Number | STPF | GLID | ST | ET |
++--------+-------+------+------+------+
+| 1 | true | 1 | 0 | 10 |
++--------+-------+------+------+------+
+| 2 | false | 2 | | 50 |
++--------+-------+------+------+------+
+| 3 | true | 3 | 1500 | 3000 |
++--------+-------+------+------+------+
+
+ Mac address, stored in the station own data equals to 12:34:56:78:9A:BC
+
+ BPSTO, corresponding to the address to store the BPSTO.
+
+Schedule data
+-------------
+
+Environment
+ Provide to the function the data structure containing the following data:
+
+* cd = 4
+* destination = a buffer.
+* cd_end_value = 0xA
+* value = 0xB
+
+The objective of the function is to store the value in the destination until the index is lesser than the cd (countdown) and the cd_end_value when the index is equal of greater than the cd.
+
+Result
+
+* First call: destination == value.
+* Second call : destination == value.
+* Third call : destination == value.
+* Fourth call : destination == cd_end_value.
+* Fifth call : destination == cd_end_value.
diff --git a/cesar/cp/beacon/test/doc/default-schedules.txt b/cesar/cp/beacon/test/doc/default-schedules.txt
new file mode 100644
index 0000000000..4b76e6ef9f
--- /dev/null
+++ b/cesar/cp/beacon/test/doc/default-schedules.txt
@@ -0,0 +1,44 @@
+Default Schedules
+=================
+
+The default schedules in the beacon are used only when the station is
+considered as USTA and is in the Power and detect procedure.
+
+The test shall only verify that the schedules programmed in the CA are set and
+if the timer is programmed to post an event in the FSM before the default
+schedules expires.
+
+Test 1 : Station acting as USTA.
+--------------------------------
+
+When the station is acting as unassociated station the default schedules are
+used until a decision to track an AVLN is taken, once this is done, it shall
+use the schedules contained in the central or proxy beacon of this ALVN.
+
+Test 2 : Station acting as UCCo.
+--------------------------------
+
+When the station is acting as UCCo it shall send a discover beacon at most
+each 10 seconds.
+
+The discover beacon shall contain:
+
+* Regions bentry
+
+ * number of regions : 1
+ * regions type : Local CSMA
+ * end time (ATU) : 3906
+
+* Persistent schedules
+
+ * PSCD : 0x7 i.e. valid indefinitely
+ * CSCD : 0x7 i.e. valid indefinitely
+ * NS : 1
+
+ * GLID = 0xFF Broadcast
+ * end time (ATU) : 3906
+
+* Mac Address
+* Discover Info
+* Beacon Period Start Time Offset
+
diff --git a/cesar/cp/beacon/test/doc/recv-beacon.txt b/cesar/cp/beacon/test/doc/recv-beacon.txt
new file mode 100644
index 0000000000..fa54e55523
--- /dev/null
+++ b/cesar/cp/beacon/test/doc/recv-beacon.txt
@@ -0,0 +1,81 @@
+Receive beacon
+==============
+
+Central beacon
+--------------
+
+Read a central beacon containing the following data.
+
+Environment
+~~~~~~~~~~~
+
+Variant fields data:
+
+* nid = 0x12456789ABCDEF
+* hm = 2 i.e. full hybrid mode.
+* stei = 0xA i.e. station own TEI store in the station manager.
+* bt = 0x0 i.e. central beacon.
+* ncnr = 0x0 i.e. non coordinated network.
+* npsm = 0x0 i.e. not in saving mode.
+* num_slots = 0x1 i.e. only this AVLN is present.
+* slot_usage = 0x1, initialise the station manager network.
+* aclss = 0x0 i.e. not track the ACL.
+* hoip = 0x0 i.e. no handover.
+* rstbf = 0x0 i.e. no use.
+* nm = 0x2 i.e. CSMA ONLY
+* cco_cap = CCO_LEVEL defined in the cp/defs.h
+
+Beacon entries:
+
+* Regions:
+
+ * end time : 52, type : beacon region.
+ * end time : 3905, type : CSMA / CA
+
+* Schedules:
+
+ * Persistent schedules:
+
+ * stpf = true, glid = 0xFF, start time (ATU) = 0, end time (ATU) = 52
+ * stpf = false, glid = 0x1, end time (ATU) = 3905
+
+* Mac Address = 00:FF:5F:1A:D0:5A
+* BPSTO = 50.
+
+Station unassociated result
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+.. Warning:: Event post in the FSM not tested yet.
+
+* The AVLN shall be created in the station manager using the SNID and NID in the beacon payload and frame control.
+* The station emitting the beacon shall be added in the station manager in the AVLN previously added.
+* If it is the first Beacon received it shall just post an event in the FSM.
+
+Station associated result
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+* The SNID and NID shall be compared with the one of our AVLN. (No collision in this test).
+* The Station shall be added in the station manager if it does not exists (with the MAC address if it exists in the beacon).
+* The slot id and slot usage shall be store in the network data.
+* The regions are skipped.
+* The schedules are read and provided to the CA.
+
+Station associated SNID change result
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Environment complement
+ This test shall have one more bentry to simulated a previous SNID collision, for that a change SNID beacon entry shall be had with a countdown equal 2.
+ This test shall received two beacon to verify that the event is correctly post in the FSM.
+
+
+* The SNID and NID correspond to the station i.e. no conflict detected.
+* The Station shall be added in the station manager if it does not exists (with the MAC address if it exists in the beacon).
+* The num slots and slot usage shall be store in the network data.
+* The regions are skipped.
+* The schedules are read and provided to the CA.
+
+First beacon
+ The change SNID countdown is set to the value 1.
+
+Second beacon
+ The change SNID countdown is set to the value 0. The new SNID value is store in the station own data.
diff --git a/cesar/cp/beacon/test/doc/send-beacon.txt b/cesar/cp/beacon/test/doc/send-beacon.txt
new file mode 100644
index 0000000000..62d52a2342
--- /dev/null
+++ b/cesar/cp/beacon/test/doc/send-beacon.txt
@@ -0,0 +1,85 @@
+Send Beacon
+===========
+
+Central beacon
+--------------
+
+This function has for job to:
+
+ * Generate a central beacon.
+ * Compute the next for beacon periods.
+ * Provide the beacon to the CA layer.
+ * Compute the schedules to the CA.
+
+Environment
+ Add the elements necessary to generate a full beacon and verify the data generated.
+
+Variant fields data:
+
+ * nid = 0x12456789ABCDEF
+ * hm = 2 i.e. full hybrid mode.
+ * stei = 0xA i.e. station own TEI store in the station manager.
+ * bt = 0x0 i.e. central beacon.
+ * ncnr = 0x0 i.e. non coordinated network.
+ * npsm = 0x0 i.e. not in saving mode.
+ * num_slots = 0x1 i.e. only this AVLN is present.
+ * slot_usage = 0x1, initialise the station manager network.
+ * aclss = 0x0 i.e. not track the ACL.
+ * hoip = 0x0 i.e. no handover.
+ * rstbf = 0x0 i.e. no use.
+ * nm = 0x2 i.e. CSMA ONLY
+ * cco_cap = CCO_LEVEL defined in the cp/defs.h
+
+Beacon entries:
+
+ * Regions:
+
+ * end time : 52, type : beacon region.
+ * end time : 3905, type : CSMA / CA
+
+ * Schedules:
+
+ * Persistent schedules:
+
+ * stpf = true, glid = 0x1, start time (ATU) = 0, end time (ATU) = 10
+ * stpf = false, glid = 0x2, end time (ATU) = 50
+ * stpf = true, glid = 0x3, start time (ATU) = 1500, end time (ATU) = 3000
+
+ * Non persistent schedules:
+
+ * stpf = true, glid = 0x4, start time (ATU) = 50, end time (ATU) = 750
+ * stpf = false, glid = 0x5, end time (ATU) = 850
+ * stpf = true, glid = 0x6, start time (ATU) = 900, end time (ATU) = 1500
+
+ * Mac Address = 12:34:56:78:9A:BC
+ * BPSTO is only the address in the beacon to store the date.
+
+Result
+
+ * The beacon generated shall correspond to the values indicated above.
+ * Beacon period estimated = 1 000 000 ticks i.e. 50 Hz.
+ * Beacon Time Offset = 0 for each one i.e. 50 Hz perfect.
+ * Schedules for the CA :
+
++------+----------------+
+| GLID | end time (TCK) |
++------+----------------+
+| 0x1 | 2560 |
++------+----------------+
+| 0x2 | 12 800 |
++------+----------------+
+| 0x4 | 192 000 |
++------+----------------+
+| 0x5 | 217 600 |
++------+----------------+
+| HOLE | 230 400 |
++------+----------------+
+| 0x6 | 384 000 |
++------+----------------+
+| 0x3 | 768 000 |
++------+----------------+
+| HOLE | 1 000 000 |
++------+----------------+
+
+Discover beacon
+---------------
diff --git a/cesar/cp/beacon/test/ecos.ecc.sh b/cesar/cp/beacon/test/ecos.ecc.sh
new file mode 100644
index 0000000000..8253d98c9a
--- /dev/null
+++ b/cesar/cp/beacon/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/beacon/test/overide/cp_fsm_defs.h b/cesar/cp/beacon/test/overide/cp_fsm_defs.h
new file mode 100644
index 0000000000..e8364b6da9
--- /dev/null
+++ b/cesar/cp/beacon/test/overide/cp_fsm_defs.h
@@ -0,0 +1,40 @@
+#ifndef overide_cp_fsm_defs_h
+#define overide_cp_fsm_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp_fsm_defs.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_all_sta_leaved,
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict,
+ CP_FSM_EVENT_TYPE_BEACON_TIMER_EXPIRES,
+ CP_FSM_EVENT_TYPE_BEACON
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* overide_cp_fsm_defs_h */
diff --git a/cesar/cp/beacon/test/src/beacon.c b/cesar/cp/beacon/test/src/beacon.c
new file mode 100644
index 0000000000..f2ab029508
--- /dev/null
+++ b/cesar/cp/beacon/test/src/beacon.c
@@ -0,0 +1,176 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/beacon.c
+ * \brief Unit test for the beacon module.
+ * \ingroup cp_beacon
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/circular_buffer.h"
+
+#include "mac/common/ntb.h"
+#include "mac/common/store.h"
+
+#include "cp/beacon/beacon.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+/** Common test for the init and uninit function.
+ *
+ * \param test the test object.
+ */
+void
+test_case_beacon_common_init_uninit (test_t test, cp_t *cp)
+{
+ test_begin (test, "verify")
+ {
+ test_fail_if (cp->beacon.event_cb != NULL,
+ "Event call back shall be null");
+ test_fail_if (cp->beacon.event_user_data != NULL,
+ "Event user data shall be null");
+
+ // Central beacon common data.
+ test_fail_if (cp->beacon.central.bpsto != NULL,
+ "beacon BPSTO pointer shall be null");
+ test_fail_if (cp->beacon.central.nb_beacon_recv != 0,
+ "Counter shall be equal to 0");
+ test_fail_if (cp->beacon.central.nb_beacon_failed != 0,
+ "Counter shall be equal to 0");
+ test_fail_if (cp->beacon.central.mfs != NULL,
+ "MFS pointer shall be null");
+
+ // discover beacon common data.
+ test_fail_if (cp->beacon.discover.bpsto != NULL,
+ "beacon BPSTO pointer shall be null");
+ test_fail_if (cp->beacon.discover.nb_beacon_recv != 0,
+ "Counter shall be equal to 0");
+ test_fail_if (cp->beacon.discover.nb_beacon_failed != 0,
+ "Counter shall be equal to 0");
+ test_fail_if (cp->beacon.discover.mfs != NULL,
+ "MFS pointer shall be null");
+
+ // proxy beacon common data.
+ test_fail_if (cp->beacon.proxy.bpsto != NULL,
+ "beacon BPSTO pointer shall be null");
+ test_fail_if (cp->beacon.proxy.nb_beacon_recv != 0,
+ "Counter shall be equal to 0");
+ test_fail_if (cp->beacon.proxy.nb_beacon_failed != 0,
+ "Counter shall be equal to 0");
+ test_fail_if (cp->beacon.proxy.mfs != NULL,
+ "MFS pointer shall be null");
+ }
+ test_end;
+}
+
+/** Initialise
+ *
+ * At the end of this test, all the variables present in the beacon context
+ * shall be equal to zero or null for the pointers.
+ */
+void
+test_case_beacon_init (test_t test)
+{
+ cp_t cp;
+
+ cp_beacon_init (&cp);
+
+ test_case_begin (test, "beacon init");
+
+ test_case_beacon_common_init_uninit (test, &cp);
+}
+
+/** Uninitialise
+ * \param test the test object.
+ *
+ * The uninit procedure, shall stop the timers and release all the object
+ * referenced by the beacon module.
+ *
+ * * Stop the HAL timer
+ * * Stop the eCos timer
+ * * Release all beacon received and not processed yet.
+ * * Call the uninit function for the common sub context.
+ *
+ * Environment
+ * This test shall insert some data in the pointers and the context.
+ *
+ * 1. Add at least two beacon in the received list.
+ * 2. Add a central beacon in the central sub context.
+ * 3. Add a discover beacon in the discover sub context.
+ * 4. Add a proxy beacon in the discover sub context.
+ *
+ * Result
+ * At the end the beacon module shall not have any referenced on any object.
+ */
+void
+test_case_beacon_uninit (test_t test)
+{
+ cp_t cp;
+ bool added;
+
+ test_case_begin (test, "Beacon uninit");
+
+ cp_beacon_init (&cp);
+ cp.mac_store = mac_store_init ();
+
+ // Add a beacon.
+ cp_beacon_receive (&cp, (cp_beacon_desc_t *) blk_alloc_desc ());
+ cp_beacon_receive (&cp, (cp_beacon_desc_t *) blk_alloc_desc ());
+
+ // Add a central beacon.
+ cp.beacon.central.mfs = mac_store_mfs_add_tx (cp.mac_store, true, false,
+ MAC_LID_SPC_CENTRAL,
+ 0xff, &added);
+ cp.beacon.central.mfs->cap = 0x3;
+
+ cp.beacon.discover.mfs = mac_store_mfs_add_tx (cp.mac_store, true, false,
+ MAC_LID_DISCOVER,
+ 0xff, &added);
+ cp.beacon.discover.mfs->cap = 0x2;
+
+ cp.beacon.proxy.mfs = mac_store_mfs_add_tx (cp.mac_store, true, false,
+ 0x1,
+ 0xff, &added);
+
+ cp_beacon_uninit (&cp);
+
+ test_case_beacon_common_init_uninit (test, &cp);
+}
+
+int
+main (void)
+{
+ test_t test;
+ test_init (test, 0, NULL);
+
+ test_case_beacon_init (test);
+ test_case_beacon_uninit (test);
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u32
+phy_clock_get_zero_cross_captured_date (phy_t *ctx)
+{
+ *(uint*) ctx += 1000000;
+ return *(uint*) ctx;
+}
+
diff --git a/cesar/cp/beacon/test/src/bentry.c b/cesar/cp/beacon/test/src/bentry.c
new file mode 100644
index 0000000000..ac80df64b2
--- /dev/null
+++ b/cesar/cp/beacon/test/src/bentry.c
@@ -0,0 +1,1394 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/bentry.c
+ * \brief Unit test for the beacon module.
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+#include "common/defs/ethernet.h"
+
+#include "lib/test.h"
+#include "lib/read_word.h"
+#include "string.h"
+
+#include "cp/cp.h"
+#include "cp/beacon/beacon.h"
+#include "cp/cco/bw/bw_lib_alloc.h"
+
+#include "cp/inc/context.h"
+#include "cp/beacon/inc/bentry_size.h"
+#include "cp/beacon/inc/bentry_msg.h"
+#include "cp/beacon/inc/bentry.h"
+
+
+/** init
+ * \param test the test object.
+ *
+ * The init function shall set all the context to 0.
+ */
+void
+test_case_bentry_init (test_t test)
+{
+ cp_t cp;
+
+ test_case_begin (test, "Init");
+
+ cp_beacon_bentry_mgr_init (&cp);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (cp.beacon.bentry.persistent_schedule_pscd != 0,
+ "Wrong persistent schedule previous countdown");
+ test_fail_if (cp.beacon.bentry.persistent_schedule_cscd != 0,
+ "Wrong persistent schedule countdown");
+ test_fail_if (cp.beacon.bentry.eks_kccd != 0,
+ "Wrong EKS countdown");
+ test_fail_if (cp.beacon.bentry.eks_kbc!= 0,
+ "Wrong EKS key");
+ test_fail_if (cp.beacon.bentry.eks_neweks != 0,
+ "Wrong eks neweks");
+ test_fail_if (cp.beacon.bentry.handover_cd != 0,
+ "Wrong handover countdown");
+ test_fail_if (cp.beacon.bentry.handover_newtei != 0,
+ "Wrong handover new TEI");
+ test_fail_if (cp.beacon.bentry.relocation_cd != 0,
+ "Wrong relocation countdown");
+ test_fail_if (cp.beacon.bentry.relocation_type != 0,
+ "Wrong relocation type");
+ test_fail_if (cp.beacon.bentry.relocation_lgf != 0,
+ "Wrong relocation lgf");
+ test_fail_if (cp.beacon.bentry.relocation_rlo != 0,
+ "Wrong relocation rlo");
+ test_fail_if (cp.beacon.bentry.relocation_slotid != 0,
+ "Wrong relocation slot id");
+ test_fail_if (cp.beacon.bentry.acl_cd != 0,
+ "Wrong ACL cd");
+ test_fail_if (cp.beacon.bentry.acl_reason_code != 0,
+ "Wrong ACL reason code");
+ test_fail_if (cp.beacon.bentry.numslot_cd != 0,
+ "Wrong numslot cd");
+ test_fail_if (cp.beacon.bentry.numslots_new != 0,
+ "Wrong numslot new");
+ test_fail_if (cp.beacon.bentry.hm_cd != 0,
+ "Wrong hybrid mode countdown");
+ test_fail_if (cp.beacon.bentry.hm_new != 0,
+ "Wrong hybrid mode new.");
+ test_fail_if (cp.beacon.bentry.snid_cd != 0,
+ "Wrong SNID countdown");
+ test_fail_if (cp.beacon.bentry.snid_new != 0,
+ "Wrong new SNID");
+ }
+ test_end;
+}
+
+/** Process Header
+ * \param test the test object.
+ *
+ * Read
+ * Shall read the header of the bentry and the length of the bentry. It shall
+ * return the next address of the following bentry.
+ *
+ * Write
+ * Shall write the header and the length of the bentry provided in
+ * parameters. It shall return the address to write the next bentry.
+ */
+void
+test_case_bentry_process_header (test_t test)
+{
+ u8 buffer_test[256] __attribute__((aligned(256)));
+ cp_beacon_bentry_t bentry;
+
+ test_case_begin (test, "Process header");
+
+ buffer_test[0] = CP_BENTRY_REGIONS;
+ buffer_test[1] = 5;
+
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = buffer_test;
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_begin (test, "Read")
+ {
+ test_fail_if (bentry.bentry_addr != &buffer_test[2],
+ "Wrong address returned");
+ test_fail_if (bentry.header != buffer_test[0], "Wrong header");
+ test_fail_if (bentry.length != buffer_test[1], "Wrong length");
+ }
+ test_end;
+
+
+ bentry.header = CP_BENTRY_AC_LINE_SYNC_COUNTDOWN;
+ bentry.length = 7;
+ bentry.bentry_addr = buffer_test;
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_begin (test, "write")
+ {
+ test_fail_if (bentry.bentry_addr != &buffer_test[2],
+ "Wrong address returned");
+ test_fail_if (read_u8_from_word (buffer_test) != bentry.header,
+ "Wrong header");
+ test_fail_if (read_u8_from_word (buffer_test+1) != bentry.length,
+ "Wrong length");
+ }
+ test_end;
+}
+
+/** Mgr Beacon - Region
+ * \param test the test object.
+ *
+ * Read
+ * Environment
+ * Initialise the region manager, the stubbed function will return
+ * two regions.
+ *
+ * Result
+ * The result only consists to provide the address of the next bentry.
+ *
+ * Write
+ * Environment
+ * Initialise the region manager, the stubbed function will return two
+ * regions:
+ *
+ * +-------------+----------+
+ * | Region Type | End time |
+ * +-------------+----------+
+ * | Beacon | 52 |
+ * +-------------+----------+
+ * | CSMA | 3905 |
+ * +-------------+----------+
+ *
+ * Result
+ * The address return shall be : 1 byte + 2 * 2 bytes.
+ * 1 byte for the Number of region.
+ * 2 bytes per region definition.
+ * The buffer shall contain the following data:
+ * +--------------+-------+-------------------------------+
+ * | Buffer index | Value | Type |
+ * +--------------+-------+-------------------------------+
+ * | 0 | 0x2 | Number of region |
+ * +--------------+-------+-------------------------------+
+ * | 1 | 0x40 | Beacon region |
+ * +--------------+-------+-------------------------------+
+ * | 2 | 0x03 | 52 * 10.24 us |
+ * +--------------+-------+-------------------------------+
+ * | 3 | 0x14 | CSMA + first byte of end time |
+ * +--------------+-------+-------------------------------+
+ * | 4 | 0xF4 | end of the end time region |
+ * +--------------+-------+-------------------------------+
+ *
+ */
+void
+test_case_bentry_mgr_region (test_t test)
+{
+ cp_t cp;
+ u8 buffer[256] __attribute__((aligned(256)));
+ bitstream_t bitstream;
+ uint nr;
+ uint data;
+ cp_beacon_bentry_t bentry;
+ cp_cco_region_inl_alloc_t *region;
+
+ test_case_begin (test, "test_case_bentry_mgr_region : Read");
+
+ cp_cco_region_init (&cp);
+
+ region = blk_alloc();
+ region->next = blk_alloc();
+ region->next->next = NULL;
+
+ cp.region.inl_alloc = region;
+ cp.region.nb_region = 2;
+
+ nr = cp.region.nb_region;
+
+ // first region
+ region->et = 52;
+ region->state = CP_CCO_REGION_ALLOC_STATE_BEACON;
+
+ // second one.
+ region->next->et = 3905;
+ region->state = CP_CCO_REGION_ALLOC_STATE_CSMA;
+
+ bitstream_init (&bitstream, buffer,
+ CP_BEACON_ENTRY_REGION(nr),
+ BITSTREAM_WRITE);
+
+ // Write the number of regions.
+ bitstream_access (&bitstream, &nr,
+ BYTES_SIZE_TO_BITS((CP_BEACON_ENTRY_REGION_SIZE)));
+
+ // Write the first region.
+ bitstream_access (&bitstream, &region->state, 4);
+ bitstream_access (&bitstream, &region->et, 12);
+
+ // The second one.
+ bitstream_access (&bitstream, &region->next->state, 4);
+ bitstream_access (&bitstream, &region->next->et, 12);
+ bitstream_finalise (&bitstream);
+
+ // Try to read.
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = buffer;
+ bentry.header = CP_BENTRY_REGIONS;
+ bentry.length = CP_BEACON_ENTRY_REGION(nr);
+ cp_beacon_bentry_mgr_regions (&cp, &bentry);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (bentry.bentry_addr != &buffer[5],
+ "Wrong address returned");
+ }
+ test_end;
+
+ test_case_begin (test, "test_case_bentry_mgr_region : Write");
+
+ bentry.bentry_addr = buffer;
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+ cp_beacon_bentry_mgr_regions (&cp, &bentry);
+
+ test_begin (test, "verify")
+ {
+ bitstream_init (&bitstream, buffer + CP_BEACON_ENTRY_HEADER + 1,
+ CP_BEACON_ENTRY_REGION(nr),
+ BITSTREAM_READ);
+
+ test_fail_if (bentry.bentry_addr != &buffer[7],
+ "Wrong address returned");
+ test_fail_if (read_u8_from_word (buffer) != nr,
+ "Wrong number of sessions.");
+
+
+ bitstream_access (&bitstream, &data, 4);
+ test_fail_if (data != region->state, "Wrong region type");
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != region->et, "Wrong region end time");
+
+ bitstream_access (&bitstream, &data, 4);
+ test_fail_if (data != region->next->state, "Wrong region type");
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != region->next->et, "Wrong region end time");
+
+
+ bitstream_finalise (&bitstream);
+ }
+ test_end;
+
+
+ cp_cco_region_uninit (&cp);
+}
+
+/** Persistent schedules
+ * \param test the test object.
+ *
+ * Environment
+ * Request some allocation from the bandwidth manager and store it in the
+ * beacon payload.
+ *
+ * +--------+-------+------+------+------+
+ * | Number | STPF | GLID | ST | ET |
+ * +--------+-------+------+------+------+
+ * | 1 | true | 1 | 0 | 10 |
+ * +--------+-------+------+------+------+
+ * | 2 | false | 2 | | 50 |
+ * +--------+-------+------+------+------+
+ * | 3 | true | 3 | 1500 | 3000 |
+ * +--------+-------+------+------+------+
+ *
+ * Result
+ * At the end in the beacon payload it shall have 3 sessions of persistent
+ * schedules corresponding to the values indicated in the table above.
+ */
+void
+test_case_bentry_persistent_schedules (test_t test)
+{
+ cp_t cp;
+ set_t set;
+ u8 buffer [256] __attribute__((aligned(256)));
+ bitstream_t bitstream;
+ uint data;
+ cp_cco_bw_alloc_t *alloc;
+ cp_beacon_bentry_t bentry;
+
+ test_case_begin (test, "Persistent schedules : Read");
+
+ cp_cco_bw_init(&cp);
+ cp_cco_bw_schedules_init (&set);
+
+ // Write header.
+ buffer[0] = CP_BENTRY_PERSISTENT_SCHEDULE;
+ buffer[1] = CP_BEACON_ENTRY_NON_PERSISTENT_SCHED (2,1);
+
+ bitstream_init (&bitstream, buffer + CP_BEACON_ENTRY_HEADER,
+ CP_BEACON_ENTRY_NON_PERSISTENT_SCHED (2,1),
+ BITSTREAM_WRITE);
+ // PSCD = 3
+ data = 3;
+ bitstream_access (&bitstream, &data, 3);
+
+ // CSCD = 4
+ data = 4;
+ bitstream_access (&bitstream, &data, 3);
+
+ // RSVD.
+ data = 0;
+ bitstream_access (&bitstream, &data, 2);
+
+ // Number of sessions.
+ data = 3;
+ bitstream_access (&bitstream, &data, 6);
+
+ // RSVD.
+ data = 0;
+ bitstream_access (&bitstream, &data, 2);
+
+
+ // STPF
+ data = true;
+ bitstream_access (&bitstream, &data, 1);
+ // GLID
+ data = 1;
+ bitstream_access (&bitstream, &data, 7);
+ // Start time
+ data = 0;
+ bitstream_access (&bitstream, &data, 12);
+ // End time
+ data = 10;
+ bitstream_access (&bitstream, &data, 12);
+
+ // STPF
+ data = false;
+ bitstream_access (&bitstream, &data, 1);
+ // GLID
+ data = 2;
+ bitstream_access (&bitstream, &data, 7);
+ // End time
+ data = 50;
+ bitstream_access (&bitstream, &data, 12);
+ data = 0;
+ bitstream_access (&bitstream, &data, 4); //RSVD
+
+ // STPF
+ data = true;
+ bitstream_access (&bitstream, &data, 1);
+ // GLID
+ data = 3;
+ bitstream_access (&bitstream, &data, 7);
+ // Start time
+ data = 1500;
+ bitstream_access (&bitstream, &data, 12);
+ // End time
+ data = 3000;
+ bitstream_access (&bitstream, &data, 12);
+
+ bitstream_finalise (&bitstream);
+
+ cp_cco_bw_schedules_init (&set);
+
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = buffer;
+ cp_beacon_bentry_mgr_process_header (&bentry);
+ cp_beacon_bentry_mgr_schedules (&cp, &bentry, &set);
+
+ test_begin (test, "verify data")
+ {
+ // Get the first allocation read.
+ alloc = cp_cco_bw_schedules_get_first
+ (&set);
+
+ test_fail_if (alloc == NULL, "Allocation shall exist");
+ test_fail_if (alloc->stpf != true, "Wrong present start time");
+ test_fail_if (alloc->st_atu != 0, "Wrong start time");
+ test_fail_if (alloc->et_atu != 10, "Wrong end time");
+ test_fail_if (alloc->glid != 1, "Wrong GLID");
+
+ // Get the second allocation read.
+ alloc = cp_cco_bw_schedules_get_next
+ (&set, alloc);
+
+ test_fail_if (alloc == NULL, "Allocation shall exist");
+ test_fail_if (alloc->stpf != false, "Wrong present start time");
+ test_fail_if (alloc->et_atu != 50, "Wrong end time");
+ test_fail_if (alloc->glid != 2, "Wrong GLID");
+
+ // Get the second allocation read.
+ alloc = cp_cco_bw_schedules_get_next
+ (&set, alloc);
+
+ test_fail_if (alloc == NULL, "Allocation shall exist");
+ test_fail_if (alloc->stpf != true, "Wrong present start time");
+ test_fail_if (alloc->st_atu != 1500, "Wrong start time");
+ test_fail_if (alloc->et_atu != 3000, "Wrong end time");
+ test_fail_if (alloc->glid != 3, "Wrong GLID");
+
+ }
+ test_end;
+
+ cp_cco_bw_schedules_uninit (&set);
+ cp_cco_bw_uninit(&cp);
+
+ test_case_begin (test, "Persistent schedules : Write");
+
+ cp_cco_bw_init (&cp);
+ cp_cco_bw_schedules_init (&set);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 1;
+ alloc->st_atu = 0;
+ alloc->et_atu = 10;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = false;
+ alloc->glid = 2;
+ alloc->et_atu = 50;
+ list_init_node (&alloc->node);
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 3;
+ alloc->st_atu = 1500;
+ alloc->et_atu = 3000;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ list_init_node (&alloc->node);
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+
+ // Get the schedules.
+ alloc = cp_cco_bw_get_first_alloc (&cp, CP_CCO_BW_PERSISTENCE_PERSISTENT);
+ while (alloc)
+ {
+ cp_cco_bw_schedules_add (&set, alloc, true);
+ alloc = cp_cco_bw_get_next_alloc (&cp, alloc);
+ }
+
+ cp.beacon.bentry.persistent_schedule_pscd = 0x3;
+ cp.beacon.bentry.persistent_schedule_cscd = 0x4;
+
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+ bentry.header = CP_BENTRY_PERSISTENT_SCHEDULE;
+ bentry.length = CP_BEACON_ENTRY_PERSISTENT_SCHED(2,1);
+ bentry.bentry_addr = buffer;
+ cp_beacon_bentry_mgr_schedules (&cp, &bentry, &set);
+
+ test_begin (test, "reading buffer")
+ {
+ test_fail_if (read_u8_from_word(buffer) !=
+ CP_BENTRY_PERSISTENT_SCHEDULE,
+ "Wrong header type");
+ test_fail_if (read_u8_from_word(buffer + 1) !=
+ CP_BEACON_ENTRY_PERSISTENT_SCHED(2, 1),
+ "Wrong length");
+
+ bitstream_init (&bitstream, buffer + 2, sizeof(buffer), BITSTREAM_READ);
+ // Get the previous schedule.
+ bitstream_access (&bitstream, &data, 3);
+ test_fail_if (data != cp.beacon.bentry.persistent_schedule_pscd,
+ "Wong pscd");
+
+ // Get the current schedule countdown.
+ bitstream_access (&bitstream, &data, 3);
+ test_fail_if (data != cp.beacon.bentry.persistent_schedule_cscd,
+ "Wong cscd");
+
+ // Get the reserved data.
+ bitstream_access (&bitstream, &data, 2);
+
+ // Get the Number of sessions.
+ bitstream_access (&bitstream, &data, 6);
+
+ test_fail_if (data != 3, "Wrong number of sessions");
+
+ // Get the reserved data.
+ bitstream_access (&bitstream, &data, 2);
+
+ // Get the first SAI.
+
+ // Get the stpf
+ bitstream_access (&bitstream, &data, 1);
+ test_fail_if (data != true, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &data, 7);
+ test_fail_if (data != 1, "GLID shall be 1");
+
+ // Get the start time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 0, "Start time shall be 0");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 10, "end time shall be 10");
+
+ // Second SAI.
+
+ // Get the STPF
+ bitstream_access (&bitstream, &data, 1);
+ test_fail_if (data != false, "STPF shall be false");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &data, 7);
+ test_fail_if (data != 2, "GLID shall be 2");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 50, "end time shall be 10");
+ bitstream_access (&bitstream, &data, 4); // RSVD
+
+ // Third one.
+
+ // Get the stpf
+ bitstream_access (&bitstream, &data, 1);
+ test_fail_if (data != true, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &data, 7);
+ test_fail_if (data != 3, "GLID shall be 3");
+
+ // Get the start time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 1500, "Start time shall be 1500");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 3000, "end time shall be 3000");
+ }
+ test_end;
+ bitstream_finalise(&bitstream);
+
+ cp_cco_bw_schedules_uninit (&set);
+ cp_cco_bw_uninit (&cp);
+}
+
+/** Non Persistent schedules
+ * \param test the test object.
+ *
+ * Environment
+ * Request some allocation from the bandwidth manager and store it in the
+ * beacon payload.
+ *
+ * +--------+-------+------+------+------+
+ * | Number | STPF | GLID | ST | ET |
+ * +--------+-------+------+------+------+
+ * | 1 | true | 4 | 50 | 750 |
+ * +--------+-------+------+------+------+
+ * | 2 | false | 5 | | 850 |
+ * +--------+-------+------+------+------+
+ * | 3 | true | 6 | 900 | 1500 |
+ * +--------+-------+------+------+------+
+ *
+ * Result
+ * At the end in the beacon payload it shall have 3 sessions of persistent
+ * schedules corresponding to the values indicated in the table above.
+ */
+void
+test_case_bentry_non_persistent_schedules (test_t test)
+{
+ cp_t cp;
+ set_t set;
+ u8 buffer [256] __attribute__((aligned(256)));
+ bitstream_t bitstream;
+ uint data;
+ cp_cco_bw_alloc_t *alloc;
+ cp_beacon_bentry_t bentry;
+
+ test_case_begin (test, "Non Persistent schedules : Read");
+
+ cp_cco_bw_init (&cp);
+ cp_cco_bw_schedules_init (&set);
+
+ // Write header.
+ buffer[0] = CP_BENTRY_NON_PERSISTENT_SCHEDULE;
+ buffer[1] = CP_BEACON_ENTRY_NON_PERSISTENT_SCHED (2,1);
+
+ bitstream_init (&bitstream, buffer + CP_BEACON_ENTRY_HEADER,
+ CP_BEACON_ENTRY_NON_PERSISTENT_SCHED (2,1),
+ BITSTREAM_WRITE);
+ // Number of sessions.
+ data = 3;
+ bitstream_access (&bitstream, &data, 6);
+
+ // RSVD.
+ data = 0;
+ bitstream_access (&bitstream, &data, 2);
+
+
+ // STPF
+ data = true;
+ bitstream_access (&bitstream, &data, 1);
+ // GLID
+ data = 4;
+ bitstream_access (&bitstream, &data, 7);
+ // Start time
+ data = 50;
+ bitstream_access (&bitstream, &data, 12);
+ // End time
+ data = 750;
+ bitstream_access (&bitstream, &data, 12);
+
+ // STPF
+ data = false;
+ bitstream_access (&bitstream, &data, 1);
+ // GLID
+ data = 5;
+ bitstream_access (&bitstream, &data, 7);
+ // End time
+ data = 850;
+ bitstream_access (&bitstream, &data, 12);
+ data = 0;
+ bitstream_access (&bitstream, &data, 4); // RSVD
+
+ // STPF
+ data = true;
+ bitstream_access (&bitstream, &data, 1);
+ // GLID
+ data = 6;
+ bitstream_access (&bitstream, &data, 7);
+ // Start time
+ data = 900;
+ bitstream_access (&bitstream, &data, 12);
+ // End time
+ data = 1500;
+ bitstream_access (&bitstream, &data, 12);
+
+ bitstream_finalise (&bitstream);
+
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = buffer;
+ cp_beacon_bentry_mgr_process_header (&bentry);
+ cp_beacon_bentry_mgr_schedules (&cp, &bentry, &set);
+
+ test_begin (test, "verify data")
+ {
+ // Get the first allocation read.
+ alloc = cp_cco_bw_schedules_get_first
+ (&set);
+
+ test_fail_if (alloc == NULL, "Allocation shall exist");
+ test_fail_if (alloc->stpf != true, "Wrong present start time");
+ test_fail_if (alloc->st_atu != 50, "Wrong start time");
+ test_fail_if (alloc->et_atu != 750, "Wrong end time");
+ test_fail_if (alloc->glid != 4, "Wrong GLID");
+
+ // Get the second allocation read.
+ alloc = cp_cco_bw_schedules_get_next
+ (&set, alloc);
+
+ test_fail_if (alloc == NULL, "Allocation shall exist");
+ test_fail_if (alloc->stpf != false, "Wrong present start time");
+ test_fail_if (alloc->et_atu != 850, "Wrong end time");
+ test_fail_if (alloc->glid != 5, "Wrong GLID");
+
+ // Get the second allocation read.
+ alloc = cp_cco_bw_schedules_get_next
+ (&set, alloc);
+
+ test_fail_if (alloc == NULL, "Allocation shall exist");
+ test_fail_if (alloc->stpf != true, "Wrong present start time");
+ test_fail_if (alloc->st_atu != 900, "Wrong start time");
+ test_fail_if (alloc->et_atu != 1500, "Wrong end time");
+ test_fail_if (alloc->glid != 6, "Wrong GLID");
+
+ }
+ test_end;
+
+ cp_cco_bw_schedules_uninit (&set);
+ cp_cco_bw_uninit(&cp);
+
+ test_case_begin (test, "Non Persistent schedules : Write");
+
+ cp_cco_bw_init (&cp);
+ cp_cco_bw_schedules_init (&set);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 4;
+ alloc->st_atu = 50;
+ alloc->et_atu = 750;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = false;
+ alloc->glid = 5;
+ alloc->et_atu = 850;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 6;
+ alloc->st_atu = 900;
+ alloc->et_atu = 1500;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+
+ // Get the schedules.
+ alloc = cp_cco_bw_get_first_alloc (&cp,
+ CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT
+ );
+
+ cp_cco_bw_schedules_init (&set);
+ while (alloc)
+ {
+ cp_cco_bw_schedules_add (&set, alloc, true);
+ alloc = cp_cco_bw_get_next_alloc (&cp, alloc);
+ }
+
+
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+ bentry.header = CP_BENTRY_NON_PERSISTENT_SCHEDULE;
+ bentry.bentry_addr = buffer;
+ cp_beacon_bentry_mgr_schedules (&cp, &bentry, &set);
+
+ test_begin (test, "reading buffer")
+ {
+ test_fail_if (read_u8_from_word(buffer) !=
+ CP_BENTRY_NON_PERSISTENT_SCHEDULE,
+ "Wrong header type");
+ test_fail_if (read_u8_from_word(buffer + 1) !=
+ CP_BEACON_ENTRY_NON_PERSISTENT_SCHED(2, 1),
+ "Wrong length");
+
+ bitstream_init (&bitstream, buffer + 2, sizeof(buffer), BITSTREAM_READ);
+ // Get the Number of sessions.
+ bitstream_access (&bitstream, &data, 6);
+
+ test_fail_if (data != 3, "Wrong number of sessions");
+
+ // Get the reserved data.
+ bitstream_access (&bitstream, &data, 2);
+
+ // Get the first SAI.
+
+ // Get the stpf
+ bitstream_access (&bitstream, &data, 1);
+ test_fail_if (data != true, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &data, 7);
+ test_fail_if (data != 4, "GLID shall be 1");
+
+ // Get the start time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 50, "Start time shall be 0");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 750, "end time shall be 10");
+
+ // Second SAI.
+
+ // Get the STPF
+ bitstream_access (&bitstream, &data, 1);
+ test_fail_if (data != false, "STPF shall be false");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &data, 7);
+ test_fail_if (data != 5, "GLID shall be 2");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 850, "end time shall be 10");
+ bitstream_access (&bitstream, &data, 4); // RSVD
+
+ // Third one.
+
+ // Get the stpf
+ bitstream_access (&bitstream, &data, 1);
+ test_fail_if (data != true, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &data, 7);
+ test_fail_if (data != 6, "GLID shall be 3");
+
+ // Get the start time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 900, "Start time shall be 1500");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &data, 12);
+ test_fail_if (data != 1500, "end time shall be 3000");
+ }
+ test_end;
+ bitstream_finalise(&bitstream);
+
+ cp_cco_bw_schedules_uninit (&set);
+ cp_cco_bw_uninit (&cp);
+}
+
+/** Writes a mac address or read it.
+ * \param test the test object.
+ *
+ * Read
+ * Read the mac address stored previously in the buffer.
+ * The read mac address shall be the same as the one in the buffer.
+ *
+ * Write
+ * Stores a mac address to the buffer.
+ * The stored mac address shall be the same as the one provided.
+ */
+void
+test_case_bentry_mac_address (test_t test)
+{
+ cp_beacon_bentry_t bentry;
+ u8 buffer[256] __attribute__((aligned(256)));
+ uint data;
+ mac_t mac_address;
+ bitstream_t bitstream;
+
+ test_case_begin (test, "Mac address : Read");
+
+ bitstream_init (&bitstream, buffer, 10, BITSTREAM_WRITE);
+ data = CP_BENTRY_MAC_ADDRESS;
+ bitstream_access (&bitstream, &data, 8);
+ data = ETH_MAC_ADDRESS_SIZE;
+ bitstream_access (&bitstream, &data, 8);
+
+ mac_address = 0x123456789ABCull;
+ bitstream_access (&bitstream, &mac_address, 48);
+ bitstream_finalise (&bitstream);
+
+ mac_address = 0x0;
+
+ bentry.header = CP_BENTRY_MAC_ADDRESS;
+ bentry.length = ETH_MAC_ADDRESS_SIZE;
+ bentry.bentry_addr = buffer + 2;
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (mac_address != 0x123456789ABCull,
+ "Wrong mac address read");
+ test_fail_if (mac_address != read_u48_from_word (buffer + 2),
+ "Wrong mac address stored");
+ }
+ test_end;
+
+ test_case_begin (test, "Mac address : Write");
+
+ mac_address = 0x23456789ABCDull;
+
+ bentry.bentry_addr = buffer;
+ bentry.header = CP_BENTRY_MAC_ADDRESS;
+ bentry.length = ETH_MAC_ADDRESS_SIZE;
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+
+ cp_beacon_bentry_mgr_mac_address (&bentry, &mac_address);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (read_u8_from_word(buffer) != CP_BENTRY_MAC_ADDRESS,
+ "Wrong bentry header");
+ test_fail_if (read_u8_from_word (buffer + 1) != ETH_MAC_ADDRESS_SIZE,
+ "Wrong bentry length");
+ test_fail_if (read_u48_from_word (buffer + 2) != mac_address,
+ "Wrong mac address");
+ }
+ test_end;
+}
+
+/** Discover bentry
+ * \param test the test object.
+ *
+ * Read
+ *
+ * Read a discover bentry.
+ * This shall read the tei contained in the discover bentry.
+ *
+ * Write
+ *
+ * Stores the tei in the bentry.
+ */
+void
+test_case_bentry_discover (test_t test)
+{
+ uint tei;
+ cp_beacon_bentry_t bentry;
+ u8 buffer[256] __attribute__((aligned(256)));
+
+ test_case_begin (test, "Discover bentry : Read");
+
+ buffer[0] = CP_BENTRY_DISCOVER;
+ buffer[1] = CP_BEACON_ENTRY_DISCOVER;
+ buffer[2] = 0xA;
+ tei = 0;
+
+ bentry.header = CP_BENTRY_DISCOVER;
+ bentry.length = CP_BEACON_ENTRY_DISCOVER;
+ bentry.bentry_addr = buffer + 2;
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ cp_beacon_bentry_mgr_discover (&bentry, &tei);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (tei != buffer[2], "Wrong TEI");
+ test_fail_if (tei != 0xA, "Wrong TEI copied");
+ test_fail_if (bentry.bentry_addr != &buffer[3], "Wrong address");
+ }
+ test_end;
+
+ test_case_begin (test, "Discover bentry : WRITE ");
+
+ tei = 0xC;
+ bentry.bentry_addr = buffer;
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+
+ cp_beacon_bentry_mgr_discover (&bentry, &tei);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (tei != buffer[2], "Wrong TEI");
+ test_fail_if (bentry.bentry_addr != &buffer[3], "Wrong address");
+ }
+ test_end;
+}
+
+/** Discover bentry info
+ * \param test the test object.
+ *
+ * Stores the element of the structure or read the bentry data and
+ * store it in the structure.
+ */
+void
+test_case_bentry_discover_info (test_t test)
+{
+ cp_bentry_discover_info_struct_t info_struct;
+ cp_bentry_discover_info_struct_t info_struct_cmp;
+ cp_beacon_bentry_t bentry;
+ u8 buffer[256] __attribute__((aligned(256)));
+ u8 buffer2[256] __attribute__((aligned(256)));
+ bitstream_t bitstream;
+ uint i;
+
+ test_case_begin (test, "Discover Info : Read");
+
+ bitstream_init (&bitstream, buffer, 200, BITSTREAM_WRITE);
+ bitstream_write (&bitstream, CP_BENTRY_DISCOVER_INFO, 8);
+ bitstream_write (&bitstream, CP_BEACON_ENTRY_DISCOVER_INFO, 8);
+
+ info_struct.updated = true;
+ info_struct.cco_cap = 2;
+ info_struct.proxy_net_cap = true;
+ info_struct.backup_cco_cap = false;
+ info_struct.cco_status = false;
+ info_struct.pco_status = true;
+ info_struct.backup_cco_status = false;
+ info_struct.num_dis_sta = 20;
+ info_struct.num_dis_net = 30;
+ info_struct.authentication = true;
+ info_struct.status_user_ap_cco = false;
+
+ bitstream_access (&bitstream, &info_struct.updated, 1);
+ bitstream_access (&bitstream, &info_struct.cco_cap, 2);
+ bitstream_access (&bitstream, &info_struct.proxy_net_cap, 1);
+ bitstream_access (&bitstream, &info_struct.backup_cco_cap, 1);
+ bitstream_access (&bitstream, &info_struct.cco_status, 1);
+ bitstream_access (&bitstream, &info_struct.pco_status, 1);
+ bitstream_access (&bitstream, &info_struct.backup_cco_status, 1);
+ bitstream_access (&bitstream, &info_struct.num_dis_sta, 8);
+ bitstream_access (&bitstream, &info_struct.num_dis_net, 8);
+ bitstream_access (&bitstream, &info_struct.authentication, 1);
+ bitstream_access (&bitstream, &info_struct.status_user_ap_cco, 1);
+ i = 0;
+ bitstream_access (&bitstream, &i, 6);
+ bitstream_finalise (&bitstream);
+
+ bentry.header = CP_BENTRY_DISCOVER_INFO;
+ bentry.length = CP_BEACON_ENTRY_DISCOVER_INFO;
+ bentry.bentry_addr = buffer + 2;
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+
+ cp_beacon_bentry_mgr_discover_info_bentry (&bentry, &info_struct_cmp);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (info_struct.updated != info_struct.updated,
+ "Wrong update boolean value");
+ test_fail_if (info_struct.cco_cap != info_struct.cco_cap,
+ "Wrong CCO Capability value");
+ test_fail_if (info_struct.proxy_net_cap != info_struct.proxy_net_cap,
+ "Wrong Proxy Cap");
+ test_fail_if (info_struct.backup_cco_cap != info_struct.backup_cco_cap,
+ "Wrong backup cco cap.");
+ test_fail_if (info_struct.cco_status != info_struct.cco_status,
+ "Wrong CCo status");
+ test_fail_if (info_struct.pco_status != info_struct.pco_status,
+ "Wrong PCo status");
+ test_fail_if (info_struct.backup_cco_status !=
+ info_struct.backup_cco_status,
+ "Wrong backup CCo status");
+ test_fail_if (info_struct.num_dis_sta != info_struct.num_dis_sta,
+ "Wrong num dis sta.");
+ test_fail_if (info_struct.num_dis_net != info_struct.num_dis_net,
+ "Wrong num dis net.");
+ test_fail_if (info_struct.authentication != info_struct.authentication,
+ "Wrong authentication status");
+ test_fail_if (info_struct.status_user_ap_cco !=
+ info_struct.status_user_ap_cco,
+ "Wrong status user appointed CCo");
+ }
+ test_end;
+
+ test_case_begin (test, "Discover info : Write");
+
+ bentry.bentry_addr = buffer2;
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+
+ cp_beacon_bentry_mgr_discover_info_bentry (&bentry, &info_struct);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (bitstream_memcmp(buffer, buffer2, 6) != true,
+ "Wrong data");
+ }
+ test_end;
+}
+
+/** BPSTO.
+ * \param test the test object.
+ *
+ * Write, verify that the header and the length are correctly wrote in the
+ * buffer.
+ *
+ * Read, verify that the address return is the address of the BPSTO.
+ */
+void
+test_case_bentry_bpsto (test_t test)
+{
+ u8 buffer[256] __attribute__((aligned(256)));
+ u8 *bpsto;
+ cp_beacon_bentry_t bentry;
+
+ test_case_begin (test, "BPSTO : Read");
+
+ bentry.header = CP_BENTRY_BEACON_PERIOD_START_OFFSET;
+ bentry.length = CP_BEACON_ENTRY_BPSTO;
+ bentry.bentry_addr = buffer;
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+
+ cp_beacon_bentry_mgr_bpsto (&bentry, &bpsto);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (bpsto != &buffer[0], "Wrong BPSTO address");
+ }
+ test_end;
+
+ test_case_begin (test, "BPSTO : Write");
+
+ memset (buffer, 0, 10);
+
+ bentry.bentry_addr = buffer;
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+
+ cp_beacon_bentry_mgr_bpsto (&bentry, &bpsto);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (buffer[0] != CP_BENTRY_BEACON_PERIOD_START_OFFSET,
+ "Wrong header");
+ test_fail_if (buffer[1] != CP_BEACON_ENTRY_BPSTO, "Wrong length");
+ test_fail_if (&buffer[2] != bpsto, "Wrong BPSTO address");
+ }
+ test_end;
+}
+
+/** SNID BENTRY.
+ * \param test the test object.
+ *
+ * Read extract the snid from the beacon.
+ * write writes the snid in the beacon.
+ */
+void
+test_case_bentry_snid (test_t test)
+{
+ cp_beacon_bentry_t bentry;
+ u8 buffer[256] __attribute__((aligned(256)));
+ u8 snid;
+ uint snidcd;
+
+ test_case_begin (test, "Change SNID : Read");
+
+ bentry.header = CP_BENTRY_CHANGE_SNID;
+ bentry.length = CP_BEACON_ENTRY_CHANGE_SNID;
+ bentry.bentry_addr = buffer;
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+
+ *(u8*) buffer = 0xEF;
+
+ cp_beacon_bentry_mgr_snid_change (&bentry, &snid, &snidcd);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (snid != 0xE, "Wrong SNID");
+ test_fail_if (snidcd != 0xF, "Wrong countdown");
+ }
+ test_end;
+
+ test_case_begin (test, "Change SNID : Write");
+
+ bentry.bentry_addr = buffer;
+ bentry.read_write = CP_BEACON_BENTRY_WRITE;
+
+ snid = 0xC;
+ snidcd = 0xA;
+ cp_beacon_bentry_mgr_snid_change (&bentry, &snid, &snidcd);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (read_u8_from_word(buffer + 2) != 0xCA,
+ "Wrong SNID and SNID countdown.");
+ test_fail_if (buffer[0] != CP_BENTRY_CHANGE_SNID,
+ "Wrong SNID header");
+ test_fail_if (buffer[1] != CP_BEACON_ENTRY_CHANGE_SNID,
+ "Wrong SNID bentry length");
+ }
+ test_end;
+}
+
+/** Beacon Bentry write
+ * \param test the test object.
+ *
+ * Writes a full beacon entries.
+ * It will use all the data already use in the tests above.
+ *
+ * Environment
+ * Regions, two regions
+ * * beacon regions ending at 52 ATU.
+ * * CSMA-ONLY ending at 3905 ATU.
+ *
+ * Non Persistent schedules, 3 allocations.
+ * +--------+-------+------+------+------+
+ * | Number | STPF | GLID | ST | ET |
+ * +--------+-------+------+------+------+
+ * | 1 | true | 4 | 50 | 750 |
+ * +--------+-------+------+------+------+
+ * | 2 | false | 5 | | 850 |
+ * +--------+-------+------+------+------+
+ * | 3 | true | 6 | 900 | 1500 |
+ * +--------+-------+------+------+------+
+ *
+ * Persistent schedules, 3 allocations.
+ * +--------+-------+------+------+------+
+ * | Number | STPF | GLID | ST | ET |
+ * +--------+-------+------+------+------+
+ * | 1 | true | 1 | 0 | 10 |
+ * +--------+-------+------+------+------+
+ * | 2 | false | 2 | | 50 |
+ * +--------+-------+------+------+------+
+ * | 3 | true | 3 | 1500 | 3000 |
+ * +--------+-------+------+------+------+
+ *
+ * Mac address, stored in the station own data equals to 12:34:56:78:9A:BC
+ * BPSTO, corresponding to the address to store the BPSTO.
+ */
+void
+test_case_beacon_bentry_writes (test_t test)
+{
+ cp_t cp;
+ mac_config_t mac_config;
+ cp_beacon_desc_t *beacon;
+ cp_sta_own_data_t *sta_own_data;
+ cp_cco_bw_alloc_t *alloc;
+ set_t schedules;
+
+ test_case_begin (test, "Writing the beacon.");
+
+ cp_cco_bw_init (&cp);
+ cp_sta_mgr_init (&cp);
+ cp_cco_region_init (&cp);
+
+ beacon = (cp_beacon_desc_t *) blk_alloc_desc ();
+ cp.mac_config = &mac_config;
+
+ sta_own_data = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_mac_address (&cp , 0x123456789ABCull);
+
+ // Create regions.
+ cp.region.nb_region = 2;
+ cp.region.inl_alloc = blk_alloc();
+ cp.region.inl_alloc->next = blk_alloc();
+ cp.region.inl_alloc->next->next = NULL;
+
+ cp.region.inl_alloc->et = 52;
+ cp.region.inl_alloc->state = CP_CCO_REGION_ALLOC_STATE_BEACON;
+
+ cp.region.inl_alloc->next->et = 3905;
+ cp.region.inl_alloc->next->state = CP_CCO_REGION_ALLOC_STATE_CSMA;
+
+ // Create the schedules.
+ alloc = blk_alloc ();
+ alloc->stpf = true;
+ alloc->glid = 1;
+ alloc->st_atu = 0;
+ alloc->et_atu = 10;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = false;
+ alloc->glid = 2;
+ alloc->et_atu = 50;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 3;
+ alloc->st_atu = 1500;
+ alloc->et_atu = 3000;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 4;
+ alloc->st_atu = 50;
+ alloc->et_atu = 750;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = false;
+ alloc->glid = 5;
+ alloc->et_atu = 850;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 6;
+ alloc->st_atu = 900;
+ alloc->et_atu = 1500;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ test_case_begin (test, "Beacon Writes");
+
+ cp_cco_bw_schedules_init (&schedules);
+ cp_beacon_bentry_mgr_beacon_write (&cp, beacon, CP_BEACON_CENTRAL_BEACON,
+ &schedules);
+
+ // Verify headers.
+ test_begin (test, "verify headers")
+ {
+ test_fail_if (read_u8_from_word (beacon->payload->bmis) !=
+ CP_BENTRY_REGIONS, "Wrong header for regions");
+ test_fail_if (read_u8_from_word (beacon->payload->bmis + 7) !=
+ CP_BENTRY_NON_PERSISTENT_SCHEDULE,
+ "Wrong header for non persistent schedules.");
+ test_fail_if (read_u8_from_word (beacon->payload->bmis + 21) !=
+ CP_BENTRY_PERSISTENT_SCHEDULE,
+ "Wrong header for persistent schedules.");
+ test_fail_if (read_u8_from_word (beacon->payload->bmis + 36) !=
+ CP_BENTRY_MAC_ADDRESS,
+ "Wrong header for Mac Address.");
+ test_fail_if (read_u8_from_word (beacon->payload->bmis + 44) !=
+ CP_BENTRY_BEACON_PERIOD_START_OFFSET,
+ "Wrong header for BPSTO.");
+ }
+ test_end;
+
+ blk_release_desc ((blk_t*) beacon);
+ cp_cco_bw_schedules_uninit (&schedules);
+ cp_cco_bw_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ cp_cco_region_uninit (&cp);
+}
+
+/**
+ * See doc trunk/cesar/cp/beacon/test/doc/bentry.txt
+ * or wiki : [wiki:UT-CPM1-BEACON-bentry]
+ * \param test the test object.
+ */
+void
+test_case_bentry_mgr_schedule_data (test_t test)
+{
+ cp_beacon_bentry_sched_data_t data;
+ uint buffer[6];
+ uint i;
+
+ test_case_begin (test, "Schedule data");
+
+ data.cd = 4;
+ data.value_at_end = 0xB;
+ data.value = 0xA;
+
+ for (i = 0; i < 5; i++)
+ {
+ data.dest = &buffer[i];
+ cp_beacon_bentry_mgr_schedule_data (&data, i);
+ }
+
+ test_begin (test, "verify")
+ {
+ for (i = 0; i < 5; i++)
+ {
+ if (i <= 3)
+ test_fail_if (buffer[i] != data.value, "Wrong buffer value");
+ else
+ test_fail_if (buffer[i] != data.value_at_end,
+ "Wrong buffer value");
+ }
+ }
+ test_end;
+}
+
+int
+main (void)
+{
+ test_t test;
+ test_init (test, 0, NULL);
+
+ test_case_bentry_init (test);
+ test_case_bentry_process_header (test);
+ test_case_bentry_mgr_region (test);
+ test_case_bentry_persistent_schedules (test);
+ test_case_bentry_non_persistent_schedules (test);
+ test_case_bentry_mac_address (test);
+ test_case_bentry_discover (test);
+ test_case_bentry_discover_info (test);
+ test_case_bentry_bpsto (test);
+ test_case_bentry_snid (test);
+ test_case_beacon_bentry_writes (test);
+ test_case_bentry_mgr_schedule_data (test);
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/beacon/test/src/bw_stub.c b/cesar/cp/beacon/test/src/bw_stub.c
new file mode 100644
index 0000000000..5ec6f482a7
--- /dev/null
+++ b/cesar/cp/beacon/test/src/bw_stub.c
@@ -0,0 +1,221 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test/src/bw.c
+ * \brief BW stub
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+
+#include "lib/list.h"
+#include "cp/cco/bw/bw.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "string.h"
+
+/**
+ * Init of the BW manager.
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_init (cp_t* ctx)
+{
+ dbg_assert (ctx);
+
+ memset (&ctx->bw, 0, sizeof (cp_cco_bw_t));
+
+ list_init (&ctx->bw.finalised_schedule);
+}
+
+/**
+ * uninit the bandwidth manager allocations.
+ * \param ctx control plane context
+ *
+ */
+void
+cp_cco_bw_uninit (cp_t* ctx)
+{
+ uint persistence;
+ cp_cco_bw_alloc_t *alloc;
+ dbg_assert (ctx);
+
+
+ persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ while (!list_empty (&ctx->bw.finalised_schedule))
+ {
+ alloc = cp_cco_bw_get_first_alloc (ctx, persistence);
+ if (alloc)
+ cp_cco_bw_alloc_remove (ctx, alloc);
+ else
+ persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ }
+}
+
+/**
+ * Return the first element of schedule persistent or not
+ * persistent.
+ * \param ctx Control Plane Context
+ * \param persistence persistent or not persistent
+ * \return the first element of the schedule
+ *
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc (cp_t *ctx, cp_cco_bw_persistence_t persistence)
+{
+ list_node_t *node;
+ cp_cco_bw_alloc_t *alloc;
+
+ if (list_empty (&ctx->bw.finalised_schedule))
+ return NULL;
+
+ node = list_begin (&ctx->bw.finalised_schedule);
+
+ while (node != list_end(&ctx->bw.finalised_schedule))
+ {
+ alloc = PARENT_OF (cp_cco_bw_alloc_t, node, node);
+
+ if (persistence == alloc->persistence)
+ return alloc;
+ else
+ node = list_next (node);
+ }
+
+ return NULL;
+}
+
+/**
+ * Return the next allocation persistent or not
+ * \param ctx control plane context
+ * \param prev_alloc previous allocation
+ * \return the next allocation
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc (cp_t *ctx, cp_cco_bw_alloc_t *prev_alloc)
+{
+ list_node_t *node;
+ cp_cco_bw_alloc_t *alloc;
+
+ node = &prev_alloc->node;
+
+ while (node != list_end(&ctx->bw.finalised_schedule))
+ {
+ node = list_next (node);
+
+ if (node == list_end(&ctx->bw.finalised_schedule))
+ return NULL;
+
+ alloc = PARENT_OF (cp_cco_bw_alloc_t, node, node);
+
+ if (prev_alloc->persistence == alloc->persistence)
+ return alloc;
+ else
+ node = list_next (node);
+ }
+
+ return NULL;
+}
+
+
+/**
+ * Return the number of allocation persistent or not
+ * \param ctx control plane context
+ * \param persistence persistent or not persistent
+ * \return return the number of allocation
+ *
+ */
+u16
+cp_cco_bw_get_nb_alloc(cp_t *ctx, cp_cco_bw_persistence_t persistence)
+{
+ dbg_assert (ctx);
+
+ if(persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ return ctx->bw.nb_alloc_pers_finalised;
+ else
+ return ctx->bw.nb_alloc_no_pers_finalised;
+}
+
+/** Add an allocation
+ * \param ctx the control plane context.
+ * \param alloc the allocation.
+ */
+void
+cp_cco_bw_alloc_add (cp_t *ctx, cp_cco_bw_alloc_t *alloc)
+{
+ dbg_assert (ctx);
+ dbg_assert (alloc);
+
+ list_init_node (&alloc->node);
+ list_push (&ctx->bw.finalised_schedule, &alloc->node);
+
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_finalised ++;
+ else
+ ctx->bw.nb_alloc_no_pers_finalised ++;
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_alloc_get(cp_t *ctx, u16 cid)
+{
+ cp_cco_bw_alloc_t* alloc;
+
+ alloc = PARENT_OF(cp_cco_bw_alloc_t, node,
+ list_begin(&ctx->bw.actual_schedule));
+
+ while(PARENT_OF(cp_cco_bw_alloc_t, node ,&alloc->node)->cid != cid)
+ alloc = PARENT_OF(cp_cco_bw_alloc_t, node, list_next(&alloc->node));
+
+ /*We reached the last alloc and didn't find the one we need*/
+ if(alloc->cid != cid)
+ alloc = NULL;
+
+ return alloc;
+}
+
+/** Remove an allocation
+ * \param ctx the control plane context.
+ * \param alloc the allocation.
+ */
+void
+cp_cco_bw_alloc_remove_cid (cp_t *ctx, u16 cid)
+{
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert (ctx);
+
+ alloc = cp_cco_bw_alloc_get(ctx, cid);
+
+ list_remove (&ctx->bw.finalised_schedule, &alloc->node);
+
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_finalised --;
+ else
+ ctx->bw.nb_alloc_no_pers_finalised --;
+
+ blk_release (alloc);
+}
+
+void
+cp_cco_bw_alloc_remove(cp_t *ctx, cp_cco_bw_alloc_t *alloc)
+{
+ dbg_assert (ctx);
+ dbg_assert (alloc);
+
+ list_remove (&ctx->bw.finalised_schedule, &alloc->node);
+
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_finalised --;
+ else
+ ctx->bw.nb_alloc_no_pers_finalised --;
+
+ blk_release (alloc);
+}
diff --git a/cesar/cp/beacon/test/src/ca_stub.c b/cesar/cp/beacon/test/src/ca_stub.c
new file mode 100644
index 0000000000..9ec7775696
--- /dev/null
+++ b/cesar/cp/beacon/test/src/ca_stub.c
@@ -0,0 +1,57 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/test/central_beacon/src/ca_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "mac/ca/ca.h"
+
+static ca_schedule_t sched;
+
+ca_schedule_t *
+ca_alloc_get_schedule (ca_t *ctx, uint index)
+{
+ return &sched;
+}
+
+void
+ca_alloc_update_beacon_periods (ca_t *ctx,
+ ca_beacon_period_t *beacon_periods,
+ uint beacon_periods_nb)
+{
+}
+
+
+bool
+ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs)
+{
+ return true;
+}
+
+void
+ca_mfs_add (ca_t *ctx, mfs_tx_t *mfs)
+{
+ dbg_assert (ctx);
+ dbg_assert (mfs);
+}
+
+
+void
+ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs)
+{
+}
+
+void
+ca_mfs_hold (ca_t *ctx, mfs_tx_t *mfs)
+{
+}
diff --git a/cesar/cp/beacon/test/src/cco_send_central_beacon.c b/cesar/cp/beacon/test/src/cco_send_central_beacon.c
new file mode 100644
index 0000000000..0ae54481c1
--- /dev/null
+++ b/cesar/cp/beacon/test/src/cco_send_central_beacon.c
@@ -0,0 +1,669 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/test/src/cco.c
+ * \brief Test the generation of a central beacon.
+ * \ingroup cp_beacon
+ *
+ *
+ * Send Beacon : Central beacon
+ *
+ * This function has for job to:
+ *
+ * * Generate a central beacon.
+ * * Compute the next for beacon periods.
+ * * Provide the beacon to the CA layer.
+ * * Compute the schedules to the CA.
+ *
+ * Environment
+ * Add the elements necessary to generate a full beacon and verify the data
+ * generated.
+ *
+ * Variant fields data:
+ *
+ * * nid = 0x12456789ABCDEF
+ * * hm = 2 i.e. full hybrid mode.
+ * * stei = 0xA i.e. station own TEI store in the station manager.
+ * * bt = 0x0 i.e. central beacon.
+ * * ncnr = 0x0 i.e. non coordinated network.
+ * * npsm = 0x0 i.e. not in saving mode.
+ * * num_slots = 0x1 i.e. only this AVLN is present.
+ * * slot_usage = 0x1, initialise the station manager network.
+ * * aclss = 0x0 i.e. not track the ACL.
+ * * hoip = 0x0 i.e. no handover.
+ * * rstbf = 0x0 i.e. no use.
+ * * nm = 0x2 i.e. CSMA ONLY
+ * * cco_cap = CCO_LEVEL defined in the cp/defs.h
+ *
+ * Beacon entries:
+ *
+ * * Regions:
+ *
+ * * end time : 52, type : beacon region.
+ * * end time : 3905, type : CSMA / CA
+ *
+ * * Schedules:
+ *
+ * * Persistent schedules:
+ *
+ * * stpf = true, glid = 0x1, start time (ATU) = 0, end time (ATU) = 10
+ * * stpf = false, glid = 0x2, end time (ATU) = 50
+ * * stpf = true, glid = 0x3, start time (ATU) = 1500, end time (ATU) =
+ * 3000
+ *
+ * * Non persistent schedules:
+ *
+ * * stpf = true, glid = 0x4, start time (ATU) = 50, end time (ATU) =
+ * 750
+ * * stpf = false, glid = 0x5, end time (ATU) = 850
+ * * stpf = true, glid = 0x6, start time (ATU) = 900, end time (ATU) =
+ * 1500
+ *
+ * * Mac Address = 12:34:56:78:9A:BC
+ * * BPSTO is only the address in the beacon to store the date.
+ *
+ * Result
+ *
+ * * The beacon generated shall correspond to the values indicated above.
+ * * Beacon period estimated = 1 000 000 ticks i.e. 50 Hz.
+ * * Beacon Time Offset = 0 for each one i.e. 50 Hz perfect.
+ * * Schedules for the CA :
+ *
+ * +------+----------------+
+ * | GLID | end time (TCK) |
+ * +------+----------------+
+ * | 0x1 | 2560 |
+ * +------+----------------+
+ * | 0x2 | 12 800 |
+ * +------+----------------+
+ * | 0x4 | 192 000 |
+ * +------+----------------+
+ * | 0x5 | 217 600 |
+ * +------+----------------+
+ * | HOLE | 230 400 |
+ * +------+----------------+
+ * | 0x6 | 384 000 |
+ * +------+----------------+
+ * | 0x3 | 768 000 |
+ * +------+----------------+
+ * | HOLE | 999 680 |
+ * +------+----------------+
+ * | HOLE | 1 000 000 |
+ * +------+----------------+
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/circular_buffer.h"
+#include "lib/read_word.h"
+
+#include "mac/common/ntb.h"
+#include "mac/common/store.h"
+
+#include "cp/beacon/beacon.h"
+#include "cp/beacon/inc/bentry_size.h"
+#include "cp/beacon/inc/bentry_msg.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "mac/ca/ca.h"
+
+static ca_schedule_t sched;
+static ca_schedule_t sched_verify;
+static test_t test;
+static cp_t cp;
+
+void
+test_case_send_beacon (void)
+{
+ cp_net_t *net;
+ cp_sta_own_data_t *own;
+ mac_config_t mac_config;
+ cp_cco_bw_alloc_t *alloc;
+ uint phy = 0;
+
+ cp_beacon_init (&cp);
+ cp_sta_mgr_init (&cp);
+ cp_pwl_init (&cp);
+ cp_cco_region_init (&cp);
+ cp_cco_bw_init (&cp);
+ cp_pwl_init (&cp);
+ mac_ntb_init ((phy_t *) &phy, &mac_config);
+
+ cp.mac_config = &mac_config;
+ cp.phy = (phy_t *) &phy;
+
+ // Just use here to pass the dbg_assert on the CA. All the CA function
+ // used by the beacon module are stubbed bellow.
+ cp.ca = (ca_t *) &phy;
+
+ // The same procedure as the CA, the interface functions are stubbed in
+ // the interface_stub.c file.
+ cp.interface = (interface_t *) &phy;
+
+ cp.mac_store = mac_store_init ();
+
+ test_case_begin (test, "Send central beacon");
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ own = cp_sta_mgr_get_sta_own_data (&cp);
+
+ cp_net_set_slot_id_and_usage (&cp, net, 0x7, 10);
+ cp_sta_own_data_set_tei (&cp, 0xB);
+
+ // Create the regions.
+ cp.region.nb_region = 2;
+ cp.region.inl_alloc = blk_alloc();
+ cp.region.inl_alloc->next = blk_alloc();
+ cp.region.inl_alloc->next->next = NULL;
+
+ cp.region.inl_alloc->et = 52;
+ cp.region.inl_alloc->state = CP_CCO_REGION_ALLOC_STATE_BEACON;
+
+ cp.region.inl_alloc->next->et = 3905;
+ cp.region.inl_alloc->next->state = CP_CCO_REGION_ALLOC_STATE_CSMA;
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 1;
+ alloc->st_atu = 0;
+ alloc->et_atu = 10;
+ alloc->persistence = true;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ alloc = blk_alloc();
+ alloc->stpf = false;
+ alloc->glid = 2;
+ alloc->et_atu = 50;
+ alloc->persistence = true;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 3;
+ alloc->st_atu = 1500;
+ alloc->et_atu = 3000;
+ alloc->persistence = true;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 4;
+ alloc->st_atu = 50;
+ alloc->et_atu = 750;
+ alloc->persistence = false;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ alloc = blk_alloc();
+ alloc->stpf = false;
+ alloc->glid = 5;
+ alloc->et_atu = 850;
+ alloc->persistence = false;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ alloc = blk_alloc();
+ alloc->stpf = true;
+ alloc->glid = 6;
+ alloc->st_atu = 900;
+ alloc->et_atu = 1500;
+ alloc->persistence = false;
+ cp_cco_bw_alloc_add (&cp, alloc);
+
+ // Initialise the PWL module to 50Hz.
+ *((cp_pwl_frequency_t *) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t *) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint *) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+ cp.pwl.date_ntb [0] = cp.pwl.bp_ntb;
+
+
+ /* Initialise the verification variables. */
+
+ // Schedules see the table above.
+ sched_verify.allocations[0].end_offset_tck = 2560;
+ sched_verify.allocations[0].glid = 0x1;
+ sched_verify.allocations[1].end_offset_tck = 12800;
+ sched_verify.allocations[1].glid = 0x2;
+ sched_verify.allocations[2].end_offset_tck = 192000;
+ sched_verify.allocations[2].glid = 0x4;
+ sched_verify.allocations[3].end_offset_tck = 217600;
+ sched_verify.allocations[3].glid = 0x5;
+ sched_verify.allocations[4].end_offset_tck = 230400;
+ sched_verify.allocations[4].glid = MAC_LID_SPC_HOLE;
+ sched_verify.allocations[5].end_offset_tck = 384000;
+ sched_verify.allocations[5].glid = 0x6;
+ sched_verify.allocations[6].end_offset_tck = 768000;
+ sched_verify.allocations[6].glid = 0x3;
+ sched_verify.allocations[7].end_offset_tck = 1000000;
+ sched_verify.allocations[7].glid = MAC_LID_SPC_HOLE;
+ sched_verify.allocations_nb = 8;
+
+ cp_beacon_cco_send_beacon (&cp, CP_BEACON_CENTRAL_BEACON);
+
+ cp_cco_bw_uninit (&cp);
+ cp_cco_region_uninit (&cp);
+ cp_pwl_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ cp_beacon_uninit (&cp);
+ mac_store_uninit (cp.mac_store);
+}
+
+int
+main (void)
+{
+ test_init (test, 0, NULL);
+
+ test_case_send_beacon ();
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u32
+phy_clock_get_zero_cross_captured_date (phy_t *ctx)
+{
+ *(uint*) ctx += 1000000;
+ return *(uint*) ctx;
+}
+
+
+ca_schedule_t *
+ca_alloc_get_schedule (ca_t *ctx, uint index)
+{
+ return &sched;
+}
+
+void
+ca_alloc_update_beacon_periods (ca_t *ctx,
+ ca_beacon_period_t *beacon_periods,
+ uint beacon_periods_nb)
+{
+ uint i;
+
+ test_begin (test, "CA, Update beacon periods")
+ {
+ test_fail_if (beacon_periods_nb != 3, "Wrong number of beacon periods");
+
+ for (i = 0; i < beacon_periods_nb; i++)
+ {
+ test_fail_if (beacon_periods[i].start_date !=
+ cp.pwl.bp_avln_ntb[i], "Wrong Beacon start time");
+ }
+ }
+ test_end;
+
+ test_begin (test, "CA, Verify schedules")
+ {
+ test_fail_if (sched.allocations_nb != sched_verify.allocations_nb,
+ "Wrong quantity of schedules.");
+
+ for (i = 0; i < sched.allocations_nb; i++)
+ {
+ test_fail_if (sched.allocations[i].end_offset_tck !=
+ sched_verify.allocations[i].end_offset_tck,
+ "Wrong schedule at index %d", i);
+ }
+ }
+ test_end;
+}
+
+
+bool
+ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs)
+{
+ return true;
+}
+
+void
+ca_mfs_add (ca_t *ctx, mfs_tx_t *mfs)
+{
+ dbg_assert (mfs);
+}
+
+
+void
+ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs)
+{
+}
+
+void
+ca_mfs_hold (ca_t *ctx, mfs_tx_t *mfs)
+{
+}
+
+/**
+ * Sends a beacon, the interface will provide it to the SAR.
+ * \param ctx the interface context.
+ * \param beacon the beacon to send.
+ * \param the source mac address.
+ * \param beacon_mfs the mfs to use to send the beacon.
+ * \param bto_bpsto the four bto to use for the beacon and the bpsto address
+ * to be stamp by the pbproc.
+ */
+void
+interface_beacon_prepare (interface_t *ctx, pb_beacon_t *beacon, mac_t
+ mac_address, mfs_tx_t *beacon_mfs, void *bto_bpsto)
+{
+ cp_beacon_work_beacon_t data;
+ cp_beacon_work_beacon_t data_verify;
+ cp_sta_own_data_t *sta;
+ cp_net_t *net;
+ cp_beacon_desc_t *myb;
+ cp_beacon_bentry_t bentry;
+ u64 nid;
+ uint bitstr_data;
+ bitstream_t bitstream;
+ //uint st;
+ uint stpf;
+ uint et;
+ uint glid;
+
+ dbg_assert (beacon);
+ myb = (cp_beacon_desc_t *) beacon;
+
+ memset (&data, 0, sizeof (cp_beacon_work_beacon_t));
+ memset (&data_verify, 0, sizeof (cp_beacon_work_beacon_t));
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_sta_mgr_get_sta_own_data (&cp);
+ nid = cp_net_get_nid (&cp, net);
+
+ data.nid_msb = nid >> 22;
+ data.nid_lsb = nid & 0x7FFFFF;
+ data.hm = sta->hybrid_mode;
+ data.stei = cp_sta_own_data_get_tei (&cp);
+ data.bt = CP_BEACON_CENTRAL_BEACON;
+ data.ncnr = CP_BEACON_NON_COORDINATED_NETWORK;
+ data.npsm = CP_BEACON_NPSM_NOT_ACTIVE;
+ data.num_slots = 1;
+ data.slot_usage = cp_sta_mgr_get_slot_usage (&cp);
+ data.slot_id = cp_net_get_slot_id (&cp, net);
+ data.aclss = 0;
+ data.hoip = CP_BEACON_HOIP_FALSE;
+ data.rtsbf = false;
+ data.nm = CP_BEACON_NM_CSMA_ONLY;
+ data.cco_cap = CP_CCO_LEVEL;
+
+
+ cp_beacon_variant_fields (&cp, (cp_beacon_desc_t *) beacon,
+ &data_verify, true /* Read. */);
+
+ test_begin (test, "verify beacon data")
+ {
+ test_fail_if (memcmp(&data, &data_verify,
+ sizeof(cp_beacon_work_beacon_t)),
+ "Wrong nid msb");
+ }
+ test_end;
+
+
+ // Verify beacon entries.
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = myb->payload->bmis;
+
+ test_case_begin (test, "verify beacon entries");
+
+ test_begin (test, "verifying number of bentries")
+ {
+ test_fail_if (myb->payload->nbe != 5, "Wrong number of bentries");
+ }
+ test_end;
+
+ test_begin (test, "Region.")
+ {
+ // Regions.
+ cp_beacon_bentry_mgr_process_header (&bentry);
+ test_fail_if (bentry.header != CP_BENTRY_REGIONS,
+ "Wrong header type");
+ test_fail_if (bentry.length != CP_BEACON_ENTRY_REGION (2),
+ "Wrong number of regions");
+ test_fail_if (bentry.length != 2*2+1,
+ "Wrong length");
+
+ // reading first region.
+ bitstream_init (&bitstream, bentry.bentry_addr, bentry.length,
+ BITSTREAM_READ);
+
+ bitstream_access (&bitstream, &bitstr_data, 6);
+ test_fail_if (bitstr_data != 2, "Wrong number of regions.");
+
+ bitstream_access (&bitstream, &bitstr_data, 2);
+
+ bitstream_access (&bitstream, &bitstr_data, 4);
+ test_fail_if (bitstr_data != CP_CCO_REGION_ALLOC_STATE_BEACON,
+ "Wrong region type for beacon");
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 52, "Wrong region end time");
+
+ bitstream_access (&bitstream, &bitstr_data, 4);
+ test_fail_if (bitstr_data != CP_CCO_REGION_ALLOC_STATE_CSMA,
+ "Wrong region type for CSMA");
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 3905, "Wrong region end time");
+
+ bitstream_finalise (&bitstream);
+ }
+ test_end;
+ bentry.bentry_addr += bentry.length;
+
+ test_begin (test, "Verifying non persistent schedule")
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_fail_if (bentry.header !=
+ CP_BENTRY_NON_PERSISTENT_SCHEDULE,
+ "Wrong header type");
+ test_fail_if (bentry.length !=
+ CP_BEACON_ENTRY_NON_PERSISTENT_SCHED(2, 1),
+ "Wrong length");
+
+ bitstream_init (&bitstream, bentry.bentry_addr, bentry.length,
+ BITSTREAM_READ);
+ // Get the Number of sessions.
+ bitstream_access (&bitstream, &bitstr_data, 6);
+
+ test_fail_if (bitstr_data != 3, "Wrong number of sessions");
+
+ // Get the reserved bits.
+ bitstream_access (&bitstream, &bitstr_data, 2);
+
+ // Get the first SAI.
+ // Get the stpf
+ bitstream_access (&bitstream, &bitstr_data, 1);
+ test_fail_if (bitstr_data != true, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &bitstr_data, 7);
+ test_fail_if (bitstr_data != 4, "GLID shall be 4");
+
+ // Get the start time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 50, "Start time shall be 50");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 750, "end time shall be 750");
+
+ // Second SAI.
+
+ // Get the STPF
+ bitstream_access (&bitstream, &stpf, 1);
+ // Get the GLID.
+ bitstream_access (&bitstream, &glid, 7);
+ // Get the end time.
+ bitstream_access (&bitstream, &et, 12);
+ bitstream_access (&bitstream, &bitstr_data, 4); // RSVD
+
+ test_fail_if (glid != 5, "GLID shall be 5");
+ test_fail_if (stpf != false, "STPF shall be false");
+ test_fail_if (et != 850, "end time shall be 10");
+
+ // Third one.
+
+ // Get the stpf
+ bitstream_access (&bitstream, &bitstr_data, 1);
+ test_fail_if (bitstr_data != true, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &bitstr_data, 7);
+ test_fail_if (bitstr_data != 6, "GLID shall be 3");
+
+ // Get the start time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 900, "Start time shall be 900");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 1500, "end time shall be 3000");
+ }
+ test_end;
+ bentry.bentry_addr += bentry.length;
+
+ test_begin (test, "Verifying non persistent schedules")
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_fail_if (bentry.header !=
+ CP_BENTRY_PERSISTENT_SCHEDULE,
+ "Wrong header type");
+ test_fail_if (bentry.length !=
+ CP_BEACON_ENTRY_PERSISTENT_SCHED(2, 1),
+ "Wrong length");
+
+ bitstream_init (&bitstream, bentry.bentry_addr, bentry.length,
+ BITSTREAM_READ);
+
+ // Get the previous schedule.
+ bitstream_access (&bitstream, &bitstr_data, 3);
+ test_fail_if (bitstr_data != cp.beacon.bentry.persistent_schedule_pscd,
+ "Wong pscd");
+
+ // Get the current schedule countdown.
+ bitstream_access (&bitstream, &bitstr_data, 3);
+ test_fail_if (bitstr_data != cp.beacon.bentry.persistent_schedule_cscd,
+ "Wong cscd");
+
+ // Get the reserved bitstr_data.
+ bitstream_access (&bitstream, &bitstr_data, 2);
+
+ // Get the Number of sessions.
+ bitstream_access (&bitstream, &bitstr_data, 6);
+
+ test_fail_if (bitstr_data != 3, "Wrong number of sessions");
+
+ // Get the reserved bitstr_data.
+ bitstream_access (&bitstream, &bitstr_data, 2);
+
+ // Get the first SAI.
+
+ // Get the stpf
+ bitstream_access (&bitstream, &bitstr_data, 1);
+ test_fail_if (bitstr_data != true, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &bitstr_data, 7);
+ test_fail_if (bitstr_data != 1, "GLID shall be 1");
+
+ // Get the start time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 0, "Start time shall be 0");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 10, "end time shall be 10");
+
+ // Second SAI.
+
+ // Get the STPF
+ bitstream_access (&bitstream, &bitstr_data, 1);
+ test_fail_if (bitstr_data != false, "STPF shall be false");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &bitstr_data, 7);
+ test_fail_if (bitstr_data != 2, "GLID shall be 2");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 50, "end time shall be 10");
+ bitstream_access (&bitstream, &bitstr_data, 4); // RSVD
+
+ // Third one.
+
+ // Get the stpf
+ bitstream_access (&bitstream, &bitstr_data, 1);
+ test_fail_if (bitstr_data != true, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &bitstr_data, 7);
+ test_fail_if (bitstr_data != 3, "GLID shall be 3");
+
+ // Get the start time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 1500, "Start time shall be 1500");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 3000, "end time shall be 3000");
+ }
+ test_end;
+ bentry.bentry_addr += bentry.length;
+
+ test_begin (test, "Mac address")
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_fail_if (bentry.header != CP_BENTRY_MAC_ADDRESS,
+ "Wrong header type");
+ test_fail_if (bentry.length != CP_BEACON_ENTRY_MAC_ADDRESS,
+ "Wrong mac address length");
+ test_fail_if (bentry.length != 6, "Length shall be 6");
+
+ test_fail_if (read_u48_from_word (bentry.bentry_addr) !=
+ cp_sta_own_data_get_mac_address (&cp),
+ "Wrong mac address");
+ }
+ test_end;
+ bentry.bentry_addr += bentry.length;
+
+ test_begin (test, "BPSTO")
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_fail_if (bentry.header != CP_BENTRY_BEACON_PERIOD_START_OFFSET,
+ "Wrong bentry header");
+ test_fail_if (bentry.length != CP_BEACON_ENTRY_BPSTO,
+ "Wrong entry length");
+ }
+ test_end;
+
+ blk_release_desc ((blk_t *) beacon);
+}
+
+/**
+ * Initialise the callbacks functions.
+ * \param ctx the interface context.
+ * \param beacon_add_cb the function to call on beacon reception
+ * \param user_data the data to provide on each callback function.
+ */
+void
+interface_callback_beacon_init (interface_t *ctx,
+ interface_beacon_add_cb_t beacon_add_cb,
+ void *user_data)
+{
+}
+
+
diff --git a/cesar/cp/beacon/test/src/cl_stub.c b/cesar/cp/beacon/test/src/cl_stub.c
new file mode 100644
index 0000000000..1efcdc14e9
--- /dev/null
+++ b/cesar/cp/beacon/test/src/cl_stub.c
@@ -0,0 +1,88 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cl/cl_mactotei.h
+ * \brief mac to tei table interface between the CL and the CP
+ * \ingroup cl
+ *
+ */
+#include "common/std.h"
+#include "cl/cl_mactotei.h"
+
+/**
+ * Create a new table to be filled by the CP.
+ *
+ * \return a pointer to the new block to be fill with the mac to tei table
+ * data
+ */
+cl_mactotei_blk_t *
+cl_mactotei_new (void)
+{
+ return NULL;
+}
+
+/**
+ * Add a new tupple of data to the table.
+ *
+ * \param table the table pointer to add a new mac to tei correspondance.
+ * \param mac_addr the mac addr to add
+ * \param tei the tei corresponding to the STA.
+ * \param tag the CP tag provide to indentifier a network.
+ */
+void cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr,
+ uint tei, uint tag)
+{
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tag)
+{
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag and the tei.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tei the tei to copy.
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tei_and_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tei, u8 tag)
+{
+}
+
+/**
+ * Request the CL to use the new table and remove the old one.
+ *
+ * \param ctx the CL context
+ * \param table the new table to use.
+ */
+void
+cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
+{
+}
+
+/**
+ * Release the complete table from the memory.
+ *
+ * \param ctx the convergence layer context
+ */
+void cl_mactotei_release_table (cl_t *ctx)
+{
+}
+
diff --git a/cesar/cp/beacon/test/src/core_stub.c b/cesar/cp/beacon/test/src/core_stub.c
new file mode 100644
index 0000000000..40acf3a90c
--- /dev/null
+++ b/cesar/cp/beacon/test/src/core_stub.c
@@ -0,0 +1,28 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/core_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/sta/core/core.h"
+
+u32
+cp_sta_core_date_ms (cp_t *cp)
+{
+ return 0;
+}
+
+void
+cp_sta_core_signal_recv_beacon_event(cp_t *cp_ctx)
+{
+}
diff --git a/cesar/cp/beacon/test/src/default-sched.c b/cesar/cp/beacon/test/src/default-sched.c
new file mode 100644
index 0000000000..aed9050dc6
--- /dev/null
+++ b/cesar/cp/beacon/test/src/default-sched.c
@@ -0,0 +1,478 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/test/src/default-sched.c
+ * \brief Beacon Default schedules test.
+ * \ingroup cp_beacon
+ *
+ * See the wiki page [wiki:UT-CPM1-BEACON-default-sched]
+ * or
+ * http://pessac/cesar/trac/wiki/UT-CPM1-BEACON-default-sched
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/circular_buffer.h"
+#include "lib/read_word.h"
+
+#include "mac/common/timings.h"
+
+#include "mac/common/ntb.h"
+#include "mac/common/store.h"
+
+#include "cp/beacon/beacon.h"
+#include "cp/beacon/inc/bentry_size.h"
+#include "cp/beacon/inc/bentry_msg.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "mac/ca/ca.h"
+
+static ca_schedule_t sched;
+static ca_schedule_t sched_verify;
+static test_t test;
+static cp_t cp;
+static mac_t mac_address_test = 0x123456789ABCull;
+static u8 stei_test = 0xA;
+
+void
+test_case_default_sched_usta (void)
+{
+ mac_config_t mac_config;
+ uint phy = 0;
+
+ cp_beacon_init (&cp);
+ cp_sta_mgr_init (&cp);
+ cp_pwl_init (&cp);
+ cp_cco_region_init (&cp);
+ cp_cco_bw_init (&cp);
+ mac_ntb_init ((phy_t *) &phy, &mac_config);
+
+ cp.mac_config = &mac_config;
+ cp.phy = (phy_t *) &phy;
+
+ // Just use here to pass the dbg_assert on the CA. All the CA function
+ // used by the beacon module are stubbed bellow.
+ cp.ca = (ca_t *) &phy;
+
+ // The same procedure as the CA, the interface functions are stubbed in
+ // the interface_stub.c file.
+ cp.interface = (interface_t *) &phy;
+
+ cp.mac_store = mac_store_init ();
+
+ // Initialise the PWL module to 50Hz.
+ cp_pwl_init (&cp);
+ *((cp_pwl_frequency_t*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+
+ cp.pwl.bp_avln_ntb [0] = cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb [1] = 2 * cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb [2] = 3 * cp.pwl.bp_ntb;
+
+
+ // Configure the default schedules verification.
+ sched_verify.allocations_nb = 1;
+ sched_verify.allocations[0].end_offset_tck = MAC_ATU_TO_TCK (0xFFF);
+ sched_verify.allocations[0].glid = 0xFF;
+
+ test_case_begin (test, "Default schedules : Test 1 acting as USTA");
+
+ cp_sta_own_data_set_mac_address (&cp, mac_address_test);
+ cp_beacon_create_default_schedules (&cp);
+
+ cp_cco_bw_uninit (&cp);
+ cp_cco_region_uninit (&cp);
+ cp_pwl_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ cp_beacon_uninit (&cp);
+ mac_store_uninit (cp.mac_store);
+}
+
+void
+test_case_default_sched_ucco (void)
+{
+ cp_beacon_desc_t *beacon;
+ mac_config_t mac_config;
+ uint phy = 0;
+ cp_cco_bw_alloc_t *alloc;
+ cp_sta_own_data_t *own;
+
+ cp_beacon_init (&cp);
+ cp_sta_mgr_init (&cp);
+ cp_pwl_init (&cp);
+ cp_cco_region_init (&cp);
+ cp_cco_bw_init (&cp);
+ mac_ntb_init ((phy_t *) &phy, &mac_config);
+
+ cp.mac_config = &mac_config;
+ cp.phy = (phy_t *) &phy;
+
+ // Just use here to pass the dbg_assert on the CA. All the CA function
+ // used by the beacon module are stubbed bellow.
+ cp.ca = (ca_t *) &phy;
+
+ // The same procedure as the CA, the interface functions are stubbed in
+ // the interface_stub.c file.
+ cp.interface = (interface_t *) &phy;
+
+ cp.mac_store = mac_store_init ();
+
+ // Initialise the PWL module to 50Hz.
+ cp_pwl_init (&cp);
+ *((cp_pwl_frequency_t*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+ cp.pwl.bp_avln_ntb [0] = cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb [1] = 2 * cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb [2] = 3 * cp.pwl.bp_ntb;
+
+ // Configure the default schedules verification.
+ sched_verify.allocations_nb = 1;
+ sched_verify.allocations[0].end_offset_tck = MAC_ATU_TO_TCK(0xFFF);
+ sched_verify.allocations[0].glid = 0xFF;
+
+ // Add a region to simulate the default region.
+
+ test_case_begin (test, "Default schedules : Test 2 acting as UCCO");
+
+ // Create the regions.
+ cp.region.nb_region = 1;
+ cp.region.inl_alloc = blk_alloc();
+ cp.region.inl_alloc->next = NULL;
+
+ cp.region.inl_alloc->et = 3906;
+ cp.region.inl_alloc->state = CP_CCO_REGION_ALLOC_STATE_CSMA;
+
+ // Create the schedules.
+ alloc = blk_alloc();
+ alloc->stpf = false;
+ alloc->glid = 0x7F;
+ alloc->st_atu = 0;
+ alloc->et_atu = 3906;
+ alloc->persistence = true;
+ list_init_node (&alloc->node);
+ list_push (&cp.bw.finalised_schedule, &alloc->node);
+ cp.bw.nb_alloc_pers_finalised = 1;
+
+ cp.beacon.bentry.persistent_schedule_pscd = 7;
+ cp.beacon.bentry.persistent_schedule_cscd = 7;
+
+ beacon = (cp_beacon_desc_t *) blk_alloc_desc ();
+
+ own = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_tei (&cp, stei_test);
+ cp_sta_own_data_set_mac_address (&cp, mac_address_test);
+ own->is_cco = true;
+
+ cp_beacon_cco_send_discover_beacon (&cp);
+
+ blk_release_desc ((blk_t *) beacon);
+
+ cp_cco_bw_uninit (&cp);
+ cp_cco_region_uninit (&cp);
+ cp_pwl_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ cp_beacon_uninit (&cp);
+ mac_store_uninit (cp.mac_store);
+}
+
+int
+main (void)
+{
+ test_init (test, 0, NULL);
+
+ test_case_default_sched_usta ();
+ test_case_default_sched_ucco ();
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u32
+phy_clock_get_zero_cross_captured_date (phy_t *ctx)
+{
+ *(uint*) ctx += 1000000;
+ return *(uint*) ctx;
+}
+
+
+ca_schedule_t *
+ca_alloc_get_schedule (ca_t *ctx, uint index)
+{
+ return &sched;
+}
+
+void
+ca_alloc_update_beacon_periods (ca_t *ctx,
+ ca_beacon_period_t *beacon_periods,
+ uint beacon_periods_nb)
+{
+ uint i;
+ uint bp;
+
+ test_begin (test, "CA, Update beacon periods")
+ {
+ test_fail_if (beacon_periods_nb != 3, "Wrong number of beacon periods");
+
+ for (i = 1; i < beacon_periods_nb; i++)
+ {
+ bp = beacon_periods[i].start_date - beacon_periods[i -
+ 1].start_date;
+ bp = bp / 256;
+ test_fail_if (bp != 0xFFF, "Wrong Beacon start time");
+ }
+ }
+ test_end;
+
+ test_begin (test, "CA, Verify schedules")
+ {
+ test_fail_if (sched.allocations_nb != sched_verify.allocations_nb,
+ "Wrong quantity of schedules.");
+
+ for (i = 0; i < sched.allocations_nb; i++)
+ {
+ test_fail_if (sched.allocations[i].end_offset_tck !=
+ sched_verify.allocations[i].end_offset_tck,
+ "Wrong schedule at index %d", i);
+ }
+ }
+ test_end;
+}
+
+
+bool
+ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs)
+{
+ return true;
+}
+
+void
+ca_mfs_add (ca_t *ctx, mfs_tx_t *mfs)
+{
+ dbg_assert (mfs);
+}
+
+
+void
+ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs)
+{
+}
+
+void
+ca_mfs_hold (ca_t *ctx, mfs_tx_t *mfs)
+{
+}
+
+/**
+ * Sends a beacon, the interface will provide it to the SAR.
+ * \param ctx the interface context.
+ * \param beacon the beacon to send.
+ * \param the source mac address.
+ * \param beacon_mfs the mfs to use to send the beacon.
+ * \param bto_bpsto the four bto to use for the beacon and the bpsto address
+ * to be stamp by the pbproc.
+ */
+void
+interface_beacon_prepare (interface_t *ctx, pb_beacon_t *beacon, mac_t
+ mac_address, mfs_tx_t *beacon_mfs, void *bto_bpsto)
+{
+ cp_beacon_work_beacon_t data;
+ cp_beacon_work_beacon_t data_verify;
+ cp_sta_own_data_t *sta;
+ cp_net_t *net;
+ cp_beacon_desc_t *myb;
+ cp_beacon_bentry_t bentry;
+ u64 nid;
+ uint bitstr_data;
+ bitstream_t bitstream;
+
+ dbg_assert (beacon);
+ myb = (cp_beacon_desc_t *) beacon;
+
+ memset (&data, 0, sizeof (cp_beacon_work_beacon_t));
+ memset (&data_verify, 0, sizeof (cp_beacon_work_beacon_t));
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_sta_mgr_get_sta_own_data (&cp);
+ nid = cp_net_get_nid (&cp, net);
+
+ data.nid_msb = nid >> 22;
+ data.nid_lsb = nid & 0x7FFFFF;
+ data.hm = sta->hybrid_mode;
+ data.stei = cp_sta_own_data_get_tei (&cp);
+ data.bt = CP_BEACON_DISCOVER_BEACON;
+ data.ncnr = CP_BEACON_NON_COORDINATED_NETWORK;
+ data.npsm = CP_BEACON_NPSM_NOT_ACTIVE;
+ data.num_slots = 1;
+ data.slot_usage = cp_sta_mgr_get_slot_usage (&cp);
+ data.slot_id = cp_net_get_slot_id (&cp, net);
+ data.aclss = 0;
+ data.hoip = CP_BEACON_HOIP_FALSE;
+ data.rtsbf = false;
+ data.nm = CP_BEACON_NM_CSMA_ONLY;
+ data.cco_cap = CP_CCO_LEVEL;
+
+
+ cp_beacon_variant_fields (&cp, (cp_beacon_desc_t *) beacon,
+ &data_verify, true /* Read. */);
+
+ test_begin (test, "verify beacon data")
+ {
+ test_fail_if (memcmp(&data, &data_verify,
+ sizeof(cp_beacon_work_beacon_t)));
+ }
+ test_end;
+
+
+ // Verify beacon entries.
+ bentry.read_write = CP_BEACON_BENTRY_READ;
+ bentry.bentry_addr = myb->payload->bmis;
+
+ test_case_begin (test, "verify beacon entries");
+
+ test_begin (test, "verifying number of bentries")
+ {
+ test_fail_if (myb->payload->nbe != 6, "Wrong number of bentries");
+ }
+ test_end;
+
+ test_begin (test, "Region.")
+ {
+ // Regions.
+ cp_beacon_bentry_mgr_process_header (&bentry);
+ test_fail_if (bentry.header != CP_BENTRY_REGIONS,
+ "Wrong header type");
+ test_fail_if (bentry.length != CP_BEACON_ENTRY_REGION (1),
+ "Wrong number of regions");
+
+ // reading first region.
+ bitstream_init (&bitstream, bentry.bentry_addr, bentry.length,
+ BITSTREAM_READ);
+
+ bitstream_access (&bitstream, &bitstr_data, 6);
+ test_fail_if (bitstr_data != 1, "Wrong number of regions.");
+
+ bitstream_access (&bitstream, &bitstr_data, 2);
+
+ bitstream_access (&bitstream, &bitstr_data, 4);
+ test_fail_if (bitstr_data != CP_CCO_REGION_ALLOC_STATE_CSMA,
+ "Wrong region type for beacon");
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 3906, "Wrong region end time");
+
+ bitstream_finalise (&bitstream);
+ }
+ test_end;
+ bentry.bentry_addr += bentry.length;
+
+ test_begin (test, "Verifying persistent schedule")
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_fail_if (bentry.header !=
+ CP_BENTRY_PERSISTENT_SCHEDULE,
+ "Wrong header type");
+ test_fail_if (bentry.length !=
+ CP_BEACON_ENTRY_PERSISTENT_SCHED(0, 1),
+ "Wrong length");
+
+ bitstream_init (&bitstream, bentry.bentry_addr, bentry.length,
+ BITSTREAM_READ);
+
+ // Get PSCD
+ bitstream_access (&bitstream, &bitstr_data, 3);
+ test_fail_if (bitstr_data != 7, "Wrong PSCD");
+
+ bitstream_access (&bitstream, &bitstr_data, 3);
+ test_fail_if (bitstr_data != 7, "Wrong CSCD");
+
+ //RSVD
+ bitstream_access (&bitstream, &bitstr_data, 2);
+
+ // Get the Number of sessions.
+ bitstream_access (&bitstream, &bitstr_data, 6);
+
+ test_fail_if (bitstr_data != 1, "Wrong number of sessions");
+
+ // Get the reserved bits.
+ bitstream_access (&bitstream, &bitstr_data, 2);
+
+ // Get the first SAI.
+ // Get the stpf
+ bitstream_access (&bitstream, &bitstr_data, 1);
+ test_fail_if (bitstr_data != false, "STPF shall be true");
+
+ // Get the GLID.
+ bitstream_access (&bitstream, &bitstr_data, 7);
+ test_fail_if (bitstr_data != 0x7F, "GLID shall be 4");
+
+ // Get the end time.
+ bitstream_access (&bitstream, &bitstr_data, 12);
+ test_fail_if (bitstr_data != 3906, "end time shall be 3906");
+
+ //RSVD
+ bitstream_access (&bitstream, &bitstr_data, 4); // RSVD
+ }
+ test_end;
+ bentry.bentry_addr += bentry.length;
+
+ test_begin (test, "Mac address")
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_fail_if (bentry.header != CP_BENTRY_MAC_ADDRESS,
+ "Wrong header type");
+ test_fail_if (bentry.length != CP_BEACON_ENTRY_MAC_ADDRESS,
+ "Wrong mac address length");
+ test_fail_if (bentry.length != 6, "Length shall be 6");
+
+ test_fail_if (read_u48_from_word (bentry.bentry_addr) !=
+ cp_sta_own_data_get_mac_address (&cp),
+ "Wrong mac address");
+ }
+ test_end;
+ bentry.bentry_addr += bentry.length;
+
+ test_begin (test, "BPSTO")
+ {
+ cp_beacon_bentry_mgr_process_header (&bentry);
+
+ test_fail_if (bentry.header != CP_BENTRY_BEACON_PERIOD_START_OFFSET,
+ "Wrong bentry header");
+ test_fail_if (bentry.length != CP_BEACON_ENTRY_BPSTO,
+ "Wrong entry length");
+ }
+ test_end;
+
+ blk_release_desc ((blk_t *) beacon);
+}
+
+/**
+ * Initialise the callbacks functions.
+ * \param ctx the interface context.
+ * \param beacon_add_cb the function to call on beacon reception
+ * \param user_data the data to provide on each callback function.
+ */
+void
+interface_callback_beacon_init (interface_t *ctx,
+ interface_beacon_add_cb_t beacon_add_cb,
+ void *user_data)
+{
+}
+
diff --git a/cesar/cp/beacon/test/src/discover.c b/cesar/cp/beacon/test/src/discover.c
new file mode 100644
index 0000000000..847a909a68
--- /dev/null
+++ b/cesar/cp/beacon/test/src/discover.c
@@ -0,0 +1,342 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/test/src/discover.c
+ * \brief Test the discover algorithm to request a discover beacon.
+ * \ingroup cp_beacon
+ *
+ * See http://pessac/cesar/trac/wiki/UT-CPM1-BEACON-discover-process
+ * or
+ * [wiki:UT-CPM1-BEACON-discover-process]
+ */
+#include "common/std.h"
+#include "cp/types.h"
+
+#include "lib/test.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "cp/beacon/inc/beacon_discover.h"
+
+static test_t test;
+
+/** Initialise the discover structure.
+ * \param test the test object.
+ */
+void
+test_case_discover_init (test_t test)
+{
+ cp_t cp;
+
+ cp_beacon_discover_init (&cp.beacon.bentry.discover);
+
+ test_case_begin (test, "Discover init");
+
+ test_begin (test, "Verify data")
+ {
+ test_fail_if (cp.beacon.bentry.discover.tei_last != 0,
+ "Wrong TEI last");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 0,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 0,
+ "Wrong prev disc interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 0,
+ "Wrong countdown");
+ }
+ test_end;
+}
+
+/** Compute interval
+ * \param test the test object.
+ */
+void
+test_case_discover_compute_interval (test_t test)
+{
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_own_data_t *own;
+ mac_config_t mac_config;
+
+ cp_sta_mgr_init (&cp);
+ cp.mac_config = &mac_config;
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_sta_add (&cp, net, 2, 2);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 3, 3);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 4, 4);
+ slab_release (sta);
+
+ own = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_tei (&cp, 1);
+
+ test_case_begin (test, "AC Line frequency at 50 Hz");
+
+ cp_beacon_discover_init (&cp.beacon.bentry.discover);
+ cp_pwl_init (&cp);
+
+ *((cp_pwl_frequency_t*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+ *((uint *) &cp.pwl.discover_period_max_bp) = 250;
+
+ cp_beacon_discover_compute_interval (&cp);
+
+ test_begin (test, "Verify data")
+ {
+ test_fail_if (cp.beacon.bentry.discover.tei_last != 0,
+ "Wrong TEI, shall be 0");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 250/4,
+ "Wrong interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 0,
+ "Wrong previous discover interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 0,
+ "Wrong previous discover interval");
+ }
+ test_end;
+
+ cp_pwl_uninit (&cp);
+
+ test_case_begin (test, "AC Line frequency at 60 Hz");
+
+ cp_beacon_discover_init (&cp.beacon.bentry.discover);
+ cp_pwl_init (&cp);
+
+ *((cp_pwl_frequency_t*) &cp.pwl.frequency) = CP_PWL_FREQ_60;
+ *((cp_pwl_bp_t*) &cp.pwl.bp_ntb) = CP_PWL_BP_60;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_60;
+ *((uint *) &cp.pwl.discover_period_max_bp) = 300;
+
+ cp_beacon_discover_compute_interval (&cp);
+
+ test_begin (test, "Verify data")
+ {
+ test_fail_if (cp.beacon.bentry.discover.tei_last != 0,
+ "Wrong TEI, shall be 0");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 300/4,
+ "Wrong interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 0,
+ "Wrong previous discover interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 0,
+ "Wrong previous discover interval");
+ }
+ test_end;
+
+ cp_pwl_uninit (&cp);
+
+ cp_sta_mgr_uninit (&cp);
+}
+
+/** Need to request
+ * \param test the test object.
+ */
+void
+test_case_discover_need_to_request (test_t test)
+{
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_own_data_t *own;
+ cp_tei_t tei;
+ mac_config_t mac_config;
+
+ cp_pwl_init (&cp);
+ cp_sta_mgr_init (&cp);
+
+ *((cp_pwl_frequency_t*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+ *((uint *) &cp.pwl.discover_period_max_bp) = 250;
+
+ cp.mac_config = &mac_config;
+
+ // Add three stations.
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_sta_add (&cp, net, 2, 2);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 3, 3);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 4, 4);
+ slab_release (sta);
+
+ own = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_tei (&cp, 1);
+
+ test_case_begin (test, "Need to request : Test 1 : Stable system");
+ cp_beacon_discover_init (&cp.beacon.bentry.discover);
+
+ test_begin (test, "First shot")
+ {
+ test_fail_if (cp_beacon_discover_need_to_request(&cp, &tei) != false,
+ "No discover beacon shall be requested");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 62,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 0,
+ "Wrong discover prev interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 61,
+ "Wrong discover countdown");
+ }
+ test_end;
+
+ test_begin (test, "Second shot")
+ {
+ test_fail_if (cp_beacon_discover_need_to_request(&cp, &tei) != false,
+ "No discover beacon shall be requested");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 62,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 62,
+ "Wrong discover prev interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 60,
+ "Wrong discover countdown");
+ }
+ test_end;
+
+ // Modifying countdown.
+ cp.beacon.bentry.discover.countdown_bp = 1;
+
+ test_begin (test, "countdown reach 0")
+ {
+ test_fail_if (cp_beacon_discover_need_to_request(&cp, &tei) != true,
+ "A discover beacon shall be requested");
+ test_fail_if (tei != 1, "TEI shall be 1");
+ test_fail_if (cp.beacon.bentry.discover.tei_last != 1,
+ "Wrong last TEI");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 62,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 62,
+ "Wrong discover prev interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 62,
+ "Wrong discover countdown");
+ }
+ test_end;
+
+ // Modifying countdown.
+ cp.beacon.bentry.discover.countdown_bp = 1;
+
+ test_begin (test, "countdown reach 0 again")
+ {
+ test_fail_if (cp_beacon_discover_need_to_request(&cp, &tei) != true,
+ "A discover beacon shall be requested");
+ test_fail_if (tei != 2, "TEI shall be 2");
+ test_fail_if (cp.beacon.bentry.discover.tei_last != 2,
+ "Wrong last TEI");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 62,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 62,
+ "Wrong discover prev interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 62,
+ "Wrong discover countdown");
+ }
+ test_end;
+
+ test_case_begin (test, "Test 2 : Variable system (Add or remove STAs)");
+ cp_beacon_discover_init (&cp.beacon.bentry.discover);
+
+ test_begin (test, "First shot")
+ {
+ test_fail_if (cp_beacon_discover_need_to_request(&cp, &tei) != false,
+ "No discover beacon shall be requested");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 62,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 0,
+ "Wrong discover prev interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 61,
+ "Wrong discover countdown");
+ }
+ test_end;
+
+ // Add two stations more.
+ sta = cp_net_sta_add (&cp, net, 5, 5);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 6, 6);
+ slab_release (sta);
+
+ test_begin (test, "Second shot")
+ {
+ test_fail_if (cp_beacon_discover_need_to_request(&cp, &tei) != false,
+ "No discover beacon shall be requested");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 41,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 62,
+ "Wrong discover prev interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 39,
+ "Wrong discover countdown");
+ }
+ test_end;
+
+ // Modifying countdown.
+ cp.beacon.bentry.discover.countdown_bp = 1;
+
+ test_begin (test, "countdown reach 0")
+ {
+ test_fail_if (cp_beacon_discover_need_to_request(&cp, &tei) != true,
+ "A discover beacon shall be requested");
+ test_fail_if (tei != 1, "TEI shall be 1");
+ test_fail_if (cp.beacon.bentry.discover.tei_last != 1,
+ "Wrong last TEI");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 41,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 41,
+ "Wrong discover prev interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 41,
+ "Wrong discover countdown");
+ }
+ test_end;
+
+ // Modifying countdown.
+ cp.beacon.bentry.discover.countdown_bp = 1;
+
+ test_begin (test, "countdown reach 0 again")
+ {
+ test_fail_if (cp_beacon_discover_need_to_request(&cp, &tei) != true,
+ "A discover beacon shall be requested");
+ test_fail_if (tei != 2, "TEI shall be 2");
+ test_fail_if (cp.beacon.bentry.discover.tei_last != 2,
+ "Wrong last TEI");
+ test_fail_if (cp.beacon.bentry.discover.discover_interval_bp != 41,
+ "Wrong discover interval");
+ test_fail_if (cp.beacon.bentry.discover.prev_disc_int_bp != 41,
+ "Wrong discover prev interval");
+ test_fail_if (cp.beacon.bentry.discover.countdown_bp != 41,
+ "Wrong discover countdown");
+ }
+ test_end;
+
+ cp_sta_mgr_uninit (&cp);
+}
+
+int
+main (void)
+{
+ test_init (test, 0, NULL);
+
+// test_case_discover_init (test);
+// test_case_discover_compute_interval (test);
+ test_case_discover_need_to_request (test);
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u32
+phy_clock_get_zero_cross_captured_date (phy_t *phy)
+{
+ return 0;
+}
+
diff --git a/cesar/cp/beacon/test/src/fsm_stub.c b/cesar/cp/beacon/test/src/fsm_stub.c
new file mode 100644
index 0000000000..f0409b2c28
--- /dev/null
+++ b/cesar/cp/beacon/test/src/fsm_stub.c
@@ -0,0 +1,41 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+#include "lib/slab.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
+
+cp_fsm_event_t *
+cp_fsm_event_beacon_new (cp_t *ctx, cp_fsm_event_type_t type,
+ cp_beacon_desc_t *beacon, cp_net_t *net,
+ cp_sta_t *sta)
+{
+ dbg_assert (sta);
+ slab_release (sta);
+
+ return &fsm_event;
+}
diff --git a/cesar/cp/beacon/test/src/hal_timer_stub.c b/cesar/cp/beacon/test/src/hal_timer_stub.c
new file mode 100644
index 0000000000..ffd9f2f5f7
--- /dev/null
+++ b/cesar/cp/beacon/test/src/hal_timer_stub.c
@@ -0,0 +1,103 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/hal_timer_stub.c
+ * \brief HAL Timer stub for the test.
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+
+#include "hal/timer/timer.h"
+
+
+/**
+ * Initialise software timer.
+ * \param phy the phy context.
+ * \return the newly created context
+ */
+hal_timer_t *
+hal_timer_init (phy_t *phy)
+{
+ return blk_alloc();
+}
+
+/**
+ * Uninitialise the software timer.
+ * \param ctx software timer context
+ *
+ * All timers should be stopped.
+ */
+void
+hal_timer_uninit (hal_timer_t *ctx)
+{
+ dbg_assert (ctx);
+ blk_release (ctx);
+}
+
+/**
+ * Initialise a new timer instance.
+ * \param  ctx  software timer context
+ * \param  instance  instance to initialise
+ * \param  user_data  user data passed to the callback
+ * \param  cb  timer instance callback, called in DSR context
+ *
+ * The instance is initialised to unprogrammed state.
+ */
+void
+hal_timer_instance_init (hal_timer_t *ctx, hal_timer_instance_t *instance,
+ void *user_data, hal_timer_instance_cb_t cb)
+{
+}
+
+/**
+ * Uninitialise a timer instance.
+ * \param  ctx  software timer context
+ * \param  instance  instance to uninitialise
+ *
+ * The timer instance is canceled if necessary.
+ */
+void
+hal_timer_instance_uninit (hal_timer_t *ctx, hal_timer_instance_t *instance)
+{
+}
+
+/**
+ * Program an instance at the given date.
+ * \param  ctx  software timer context
+ * \param  instance  instance to program
+ * \param  date  instance expiration date
+ */
+void
+hal_timer_instance_program (hal_timer_t *ctx,
+ hal_timer_instance_t *instance, u32 date)
+{
+}
+
+/**
+ * Cancel an instance programmation.
+ * \param  ctx  software timer context
+ * \param  instance  instance to cancel
+ */
+void
+hal_timer_instance_cancel (hal_timer_t *ctx, hal_timer_instance_t *instance)
+{
+}
+
+/**
+ * Get the status of the timer instance.
+ *
+ * \return true if the instance is programed.
+ * false if the instance is not programed.
+ */
+bool
+hal_timer_instance_get_status (hal_timer_instance_t *instance)
+{
+ return true;
+}
+
diff --git a/cesar/cp/beacon/test/src/interface_stub.c b/cesar/cp/beacon/test/src/interface_stub.c
new file mode 100644
index 0000000000..0f2b631796
--- /dev/null
+++ b/cesar/cp/beacon/test/src/interface_stub.c
@@ -0,0 +1,47 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/interface_stub.c
+ * \brief interface function stub.
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+
+#include "interface/interface.h"
+
+/**
+ * Sends a beacon, the interface will provide it to the SAR.
+ * \param ctx the interface context.
+ * \param beacon the beacon to send.
+ * \param the source mac address.
+ * \param beacon_mfs the mfs to use to send the beacon.
+ * \param bto_bpsto the four bto to use for the beacon and the bpsto address
+ * to be stamp by the pbproc.
+ */
+void
+interface_beacon_prepare (interface_t *ctx, pb_beacon_t *beacon, mac_t
+ mac_address, mfs_tx_t *beacon_mfs, void *bto_bpsto)
+{
+}
+
+/**
+ * Initialise the callbacks functions.
+ * \param ctx the interface context.
+ * \param beacon_add_cb the function to call on beacon reception
+ * \param user_data the data to provide on each callback function.
+ */
+void
+interface_callback_beacon_init (interface_t *ctx,
+ interface_beacon_add_cb_t beacon_add_cb,
+ void *user_data)
+{
+}
+
+
+
diff --git a/cesar/cp/beacon/test/src/ntb_stub.c b/cesar/cp/beacon/test/src/ntb_stub.c
new file mode 100644
index 0000000000..e608f9c446
--- /dev/null
+++ b/cesar/cp/beacon/test/src/ntb_stub.c
@@ -0,0 +1,22 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/ntb_stuc.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/beacon/ntb/ntb_clock_sync.h"
+
+void
+cp_beacon_ntb_clk_sync( cp_t *cp_ctx, unsigned long beacon_bts, unsigned long beacon_sys_ltmr, unsigned long beacon_sta_ltmr )
+{
+}
diff --git a/cesar/cp/beacon/test/src/region_stub.c b/cesar/cp/beacon/test/src/region_stub.c
new file mode 100644
index 0000000000..7f2159103e
--- /dev/null
+++ b/cesar/cp/beacon/test/src/region_stub.c
@@ -0,0 +1,99 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/region_stub.c
+ * \brief Region manager stub
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+
+#include "cp/defs.h"
+#include "cp/cp.h"
+#include "cp/cco/region/region.h"
+
+#include "cp/inc/context.h"
+
+#include "string.h"
+
+/**
+ * Init region
+ * \param ctx the CP context.
+ */
+void
+cp_cco_region_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (&ctx->region, 0, sizeof(cp_cco_region_t));
+}
+
+/**
+ * Uninit region
+ * \param ctx the CP context.
+ */
+void
+cp_cco_region_uninit(cp_t *ctx)
+{
+ cp_cco_region_inl_alloc_t *current;
+ cp_cco_region_inl_alloc_t *next;
+ dbg_assert (ctx);
+
+ current = ctx->region.inl_alloc;
+ while (current)
+ {
+ next = current->next;
+ blk_release (current);
+ current = next;
+ }
+}
+
+/**
+ * Returns the number of regions
+ * \param ctx the module context.
+ * \return number of regions
+ *
+ */
+u16
+cp_cco_region_get_nb_region (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ctx->region.nb_region;
+}
+
+/**
+ * create the schedule to create the region BENTRY.
+ * \param ctx the module context.
+ *
+ */
+cp_cco_region_inl_alloc_t*
+cp_cco_region_get_region (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ctx->region.inl_alloc;
+}
+
+/**
+ * fonction that returns the next element allocated
+ * \param ctx the module context.
+ * \param actual_alloc actual alloc
+ * \return next allocation
+ */
+cp_cco_region_inl_alloc_t*
+cp_cco_region_get_next_alloc (cp_t *ctx,
+ cp_cco_region_inl_alloc_t* actual_alloc)
+{
+ dbg_assert (ctx);
+ dbg_assert (actual_alloc);
+
+ return actual_alloc->next;
+}
+
+
diff --git a/cesar/cp/beacon/test/src/sta_receive_central_beacon.c b/cesar/cp/beacon/test/src/sta_receive_central_beacon.c
new file mode 100644
index 0000000000..cfca3c44a6
--- /dev/null
+++ b/cesar/cp/beacon/test/src/sta_receive_central_beacon.c
@@ -0,0 +1,600 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/beacon/test/src/sta_receive_central_beacon.c
+ * \brief Test the reception of a beacon.
+ * \ingroup cp_beacon
+ *
+ * See description of the test in the doc/recv-beacon.txt
+ * or execute make in the doc directory to generate the html and odt file.
+ * or see the wiki http://pessac/cesar/trac/wiki/UT-CPM1-BEACON-recv-beacon
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/circular_buffer.h"
+#include "lib/read_word.h"
+
+#include "mac/common/ntb.h"
+#include "mac/common/store.h"
+
+#include "cp/beacon/beacon.h"
+#include "cp/beacon/inc/bentry_size.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "mac/ca/ca.h"
+
+static ca_schedule_t sched[3];
+static ca_schedule_t sched_verify;
+static test_t test;
+static cp_t cp;
+static u64 nid_test = 0x123456789ABCDull;
+static u8 snid_test = 0xD;
+static u8 stei_test = 0xA;
+static u8 slot_id_test = 0x1;
+static u8 slot_usage_test = 0x1;
+static bool snid_change_test = false;
+static bool snid_change_test_second_shot = false;
+
+void
+test_create_beacon (cp_beacon_desc_t *beacon)
+{
+ cp_beacon_work_beacon_t data_work;
+ uint data;
+ mac_t mac_address;
+ bitstream_t bitstream;
+
+ data_work.nid_msb = nid_test >> 22;
+ data_work.nid_lsb = nid_test & 0x7FFFFF;
+ data_work.hm = 0x2;
+ data_work.stei = stei_test;
+ data_work.bt = CP_BEACON_CENTRAL_BEACON;
+ data_work.ncnr = CP_BEACON_NON_COORDINATED_NETWORK;
+ data_work.npsm = CP_BEACON_NPSM_NOT_ACTIVE;
+ data_work.num_slots = 1;
+ data_work.slot_usage = slot_usage_test;
+ data_work.slot_id = slot_id_test;
+ data_work.aclss = 0;
+ data_work.hoip = CP_BEACON_HOIP_FALSE;
+ data_work.rtsbf = false;
+ data_work.nm = CP_BEACON_NM_CSMA_ONLY;
+ data_work.cco_cap = CP_CCO_LEVEL;
+
+ cp_beacon_variant_fields (&cp, beacon, &data_work, false /* write */);
+
+ // number of bentries
+ beacon->payload->nbe = 4;
+ bitstream_init (&bitstream, beacon->payload->bmis, 136,
+ BITSTREAM_WRITE);
+ data = 0x2; // header type : Regions
+ bitstream_access (&bitstream, &data, 8);
+ data = CP_BEACON_ENTRY_REGION (2);
+ bitstream_access (&bitstream, &data, 8);
+
+ data = 0x2; // Number of regions (6 bits + 2 reserved);
+ bitstream_access (&bitstream, &data, 8);
+ data = 0x3; // beacon region
+ bitstream_access (&bitstream, &data, 4);
+ data = 52; // end time ATU
+ bitstream_access (&bitstream, &data, 12);
+ data = 0x2; // Local CSMA
+ bitstream_access (&bitstream, &data, 4);
+ data = 3905; // end time ATU
+ bitstream_access (&bitstream, &data, 12);
+
+ // persistent schedules.
+ data = 0x1; // Header type : Persistent schedules.
+ bitstream_access (&bitstream, &data, 8);
+ data = CP_BEACON_ENTRY_PERSISTENT_SCHED(1,1); // One SAI with stpf.
+ bitstream_access (&bitstream, &data, 8);
+
+ // PSCD
+ data = 7;
+ bitstream_access (&bitstream, &data, 3); // PSCD
+ data = 7;
+ bitstream_access (&bitstream, &data, 3); // CSCD
+ data = 0;
+ bitstream_access (&bitstream, &data, 2); // RSVD
+
+ // NS
+ data = 2;
+ bitstream_access (&bitstream, &data, 8); // NS
+
+ data = true;
+ bitstream_access (&bitstream, &data, 1); // STPF
+ data = 0x7F;
+ bitstream_access (&bitstream, &data, 7); //GLID
+ data = 0;
+ bitstream_access (&bitstream, &data, 12); // start time.
+ data = 52;
+ bitstream_access (&bitstream, &data, 12); // end time.
+
+ data = false;
+ bitstream_access (&bitstream, &data, 1); // STPF
+ data = 0x1;
+ bitstream_access (&bitstream, &data, 7); //GLID
+ data = 3905;
+ bitstream_access (&bitstream, &data, 12); // end time.
+ data = 0;
+ bitstream_access (&bitstream, &data, 4); // RSVD
+
+ sched_verify.allocations_nb = 3;
+ sched_verify.allocations[0].end_offset_tck = 13312;
+ sched_verify.allocations[0].glid = 0xFF;
+ sched_verify.allocations[1].end_offset_tck = 999680;
+ sched_verify.allocations[1].glid = 0x1;
+ sched_verify.allocations[2].end_offset_tck = 1000000;
+ sched_verify.allocations[2].glid = 0x0;
+
+ // Mac address.
+ mac_address = 0x00FF5F1AD05Aull;
+ data = 0x3; // Header : Mac address
+ bitstream_access (&bitstream, &data, 8); // header.
+ data = 6;
+ bitstream_access (&bitstream, &data, 8); // length.
+ bitstream_access (&bitstream, &mac_address, 48); // Mac @
+
+ // BPSTO.
+ data = 0x6;
+ bitstream_access (&bitstream, &data, 8);
+ data = 3;
+ bitstream_access (&bitstream, &data, 8);
+ data = 50;
+ bitstream_access (&bitstream, &data, 24); // BPSTO.
+
+ if (snid_change_test)
+ {
+ beacon->payload->nbe ++;
+
+ //SNID.
+ data = CP_BENTRY_CHANGE_SNID;
+ bitstream_access (&bitstream, &data, 8); // header.
+ data = CP_BEACON_ENTRY_CHANGE_SNID;
+ bitstream_access (&bitstream, &data, 8); // length.
+
+ if (snid_change_test_second_shot)
+ data = 0;
+ else
+ data = 1;
+ bitstream_access (&bitstream, &data, 4); // countdown
+ data = 0xB;
+ bitstream_access (&bitstream, &data, 4); // New SNID.
+ }
+
+ bitstream_finalise (&bitstream);
+
+ // Store the SNID.
+ beacon->payload->fc.snid = snid_test;
+}
+
+void
+test_case_recv_cbeacon_unassociated(void)
+{
+ mac_config_t mac_config;
+ uint phy = 0;
+ cp_beacon_desc_t *beacon;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_t *cco;
+
+ cp_beacon_init (&cp);
+ cp_sta_mgr_init (&cp);
+ cp_pwl_init (&cp);
+ cp_cco_region_init (&cp);
+ cp_cco_bw_init (&cp);
+ mac_ntb_init ((phy_t *) &phy, &mac_config);
+
+ cp.mac_config = &mac_config;
+ cp.phy = (phy_t *) &phy;
+
+ // Just use here to pass the dbg_assert on the CA. All the CA function
+ // used by the beacon module are stubbed bellow.
+ cp.ca = (ca_t *) &phy;
+
+ // The same procedure as the CA, the interface functions are stubbed in
+ // the interface_stub.c file.
+ cp.interface = (interface_t *) &phy;
+
+ cp.mac_store = mac_store_init ();
+
+ // Initialise the PWL module to 50Hz.
+ *((cp_pwl_frequency_t*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+ cp.pwl.date_ntb [0] = cp.pwl.bp_ntb;
+
+ beacon = (cp_beacon_desc_t *) blk_alloc_desc ();
+ test_create_beacon (beacon);
+
+ cp_beacon_receive (&cp, beacon);
+ cp_beacon_get_and_process_beacon (&cp);
+
+ test_case_begin (test, "Receive central beacon");
+
+ test_begin (test, "unassociated sta")
+ {
+ net = cp_sta_mgr_get_avln (&cp, snid_test, nid_test);
+ test_fail_if (net == NULL, "AVLN shall exits");
+
+ sta = cp_net_get_sta (&cp, net, stei_test);
+ test_fail_if (sta == NULL, "Station shall exists");
+
+ // The AVLN shall point to this station because it is the CCo.
+ cco = cp_net_get_cco (&cp, net);
+ test_fail_if (cco != sta, "The station shall be CCo in the AVLN");
+
+ slab_release (cco);
+ slab_release (sta);
+ }
+ test_end;
+
+ cp_cco_bw_uninit (&cp);
+ cp_cco_region_uninit (&cp);
+ cp_pwl_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ cp_beacon_uninit (&cp);
+ mac_store_uninit (cp.mac_store);
+}
+
+
+void
+test_case_recv_cbeacon_associated(void)
+{
+ mac_config_t mac_config;
+ uint phy = 0;
+ cp_beacon_desc_t *beacon;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_t *cco;
+
+ cp_beacon_init (&cp);
+ cp_sta_mgr_init (&cp);
+ cp_pwl_init (&cp);
+ cp_cco_region_init (&cp);
+ cp_cco_bw_init (&cp);
+ mac_ntb_init ((phy_t *) &phy, &mac_config);
+
+ cp.mac_config = &mac_config;
+ cp.phy = (phy_t *) &phy;
+
+ // Just use here to pass the dbg_assert on the CA. All the CA function
+ // used by the beacon module are stubbed bellow.
+ cp.ca = (ca_t *) &phy;
+
+ // The same procedure as the CA, the interface functions are stubbed in
+ // the interface_stub.c file.
+ cp.interface = (interface_t *) &phy;
+
+ cp.mac_store = mac_store_init ();
+
+ // Initialise the PWL module to 50Hz.
+ *((cp_pwl_frequency_t*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+ cp.pwl.bp_avln_ntb[0] = cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb[1] = 2 * cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb[2] = 3 * cp.pwl.bp_ntb;
+
+ // Initialise our AVLN
+ cp_sta_mgr_update_our_avln_nid (&cp, nid_test);
+ cp_sta_mgr_update_our_avln_snid (&cp, snid_test);
+
+ beacon = (cp_beacon_desc_t *) blk_alloc_desc ();
+ test_create_beacon (beacon);
+
+ cp_beacon_receive (&cp, beacon);
+ cp_beacon_get_and_process_beacon (&cp);
+
+ test_case_begin (test, "Receive central beacon");
+
+ test_begin (test, "associated sta")
+ {
+ net = cp_sta_mgr_get_avln (&cp, snid_test, nid_test);
+ test_fail_if (net == NULL, "AVLN shall exits");
+
+ sta = cp_net_get_sta (&cp, net, stei_test);
+ test_fail_if (sta == NULL, "Station shall exist");
+ test_fail_if (cp_sta_get_cco_status (sta) != true,
+ "Station shall be CCo");
+ cco = cp_net_get_cco (&cp, net);
+ test_fail_if (cco != sta, "Station CCo not referred in the net");
+
+ slab_release (sta);
+ slab_release (cco);
+
+ test_fail_if (cp_net_get_slot_id (&cp, net) != slot_id_test,
+ "Wrong slot id");
+ test_fail_if (cp_net_get_slot_usage_mask (&cp, net) != slot_usage_test,
+ "Wrong slot usage mask");
+ }
+ test_end;
+
+ cp_cco_bw_uninit (&cp);
+ cp_cco_region_uninit (&cp);
+ cp_pwl_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ cp_beacon_uninit (&cp);
+ mac_store_uninit (cp.mac_store);
+}
+
+void
+test_case_recv_cbeacon_snid_change (void)
+{
+ mac_config_t mac_config;
+ uint phy = 0;
+ cp_beacon_desc_t *beacon;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_t *cco;
+
+ cp_beacon_init (&cp);
+ cp_sta_mgr_init (&cp);
+ cp_pwl_init (&cp);
+ cp_cco_region_init (&cp);
+ cp_cco_bw_init (&cp);
+ mac_ntb_init ((phy_t *) &phy, &mac_config);
+
+ cp.mac_config = &mac_config;
+ cp.phy = (phy_t *) &phy;
+
+ // Just use here to pass the dbg_assert on the CA. All the CA function
+ // used by the beacon module are stubbed bellow.
+ cp.ca = (ca_t *) &phy;
+
+ // The same procedure as the CA, the interface functions are stubbed in
+ // the interface_stub.c file.
+ cp.interface = (interface_t *) &phy;
+
+ cp.mac_store = mac_store_init ();
+
+ // Initialise the PWL module to 50Hz.
+ *((cp_pwl_frequency_t*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+ cp.pwl.bp_avln_ntb[0] = cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb[1] = 2 * cp.pwl.bp_ntb;
+ cp.pwl.bp_avln_ntb[2] = 3 * cp.pwl.bp_ntb;
+
+ // Initialise our AVLN
+ cp_sta_mgr_update_our_avln_nid (&cp, nid_test);
+ cp_sta_mgr_update_our_avln_snid (&cp, snid_test);
+
+ snid_change_test = true;
+ beacon = (cp_beacon_desc_t *) blk_alloc_desc ();
+
+ test_case_begin (test, "Receive Change SNID");
+ test_create_beacon (beacon);
+
+ cp_beacon_receive (&cp, beacon);
+ cp_beacon_get_and_process_beacon (&cp);
+
+
+ test_begin (test, "associated sta")
+ {
+ net = cp_sta_mgr_get_avln (&cp, snid_test, nid_test);
+ test_fail_if (net == NULL, "AVLN shall exits");
+
+ sta = cp_net_get_sta (&cp, net, stei_test);
+ test_fail_if (sta == NULL, "Station shall exist");
+ test_fail_if (cp_sta_get_cco_status (sta) != true,
+ "Station shall be CCo");
+ cco = cp_net_get_cco (&cp, net);
+ test_fail_if (cco != sta, "Station CCo not referred in the net");
+
+ slab_release (sta);
+ slab_release (cco);
+
+ test_fail_if (cp_net_get_slot_id (&cp, net) != slot_id_test,
+ "Wrong slot id");
+ test_fail_if (cp_net_get_slot_usage_mask (&cp, net) != slot_usage_test,
+ "Wrong slot usage mask");
+ }
+ test_end;
+
+ test_case_begin (test, "Receive SNID Change Beacon effective");
+ snid_change_test_second_shot = true;
+ snid_change_test = true;
+ beacon = (cp_beacon_desc_t *) blk_alloc_desc();
+ test_create_beacon (beacon);
+
+ cp_beacon_receive (&cp, beacon);
+ cp_beacon_get_and_process_beacon (&cp);
+
+ test_begin (test, "associated sta")
+ {
+ net = cp_sta_mgr_get_avln (&cp, 0xb, nid_test);
+ test_fail_if (net == NULL, "AVLN shall exits");
+
+ sta = cp_net_get_sta (&cp, net, stei_test);
+ test_fail_if (sta == NULL, "Station shall exist");
+ test_fail_if (cp_sta_get_cco_status (sta) != true,
+ "Station shall be CCo");
+ cco = cp_net_get_cco (&cp, net);
+ test_fail_if (cco != sta, "Station CCo not referred in the net");
+
+ slab_release (sta);
+ slab_release (cco);
+
+ test_fail_if (cp_net_get_slot_id (&cp, net) != slot_id_test,
+ "Wrong slot id");
+ test_fail_if (cp_net_get_slot_usage_mask (&cp, net) != slot_usage_test,
+ "Wrong slot usage mask");
+ }
+ test_end;
+
+
+ cp_cco_bw_uninit (&cp);
+ cp_cco_region_uninit (&cp);
+ cp_pwl_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ cp_beacon_uninit (&cp);
+ mac_store_uninit (cp.mac_store);
+}
+
+int
+main (void)
+{
+ test_init (test, 0, NULL);
+
+ test_case_recv_cbeacon_unassociated();
+ test_case_recv_cbeacon_associated();
+ test_case_recv_cbeacon_snid_change ();
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u32
+phy_clock_get_zero_cross_captured_date (phy_t *ctx)
+{
+ *(uint*) ctx += 1000000;
+ return *(uint*) ctx;
+}
+
+
+ca_schedule_t *
+ca_alloc_get_schedule (ca_t *ctx, uint index)
+{
+ return &sched[index % 3];
+}
+
+void
+ca_alloc_update_beacon_periods (ca_t *ctx,
+ ca_beacon_period_t *beacon_periods,
+ uint beacon_periods_nb)
+{
+ uint i;
+
+ if (!snid_change_test)
+ {
+ test_begin (test, "CA, Update beacon periods")
+ {
+ test_fail_if (beacon_periods_nb != 3,
+ "Wrong number of beacon periods");
+
+ for (i = 0; i < beacon_periods_nb; i++)
+ {
+ test_fail_if (beacon_periods[i].start_date !=
+ cp.pwl.bp_avln_ntb[i] - (i == 0) ? 0 : 50,
+ "Wrong Beacon start time");
+ }
+ }
+ test_end;
+
+ test_begin (test, "CA, Verify schedules")
+ {
+ test_fail_if (sched[0].allocations_nb
+ != sched_verify.allocations_nb,
+ "Wrong quantity of schedules.");
+
+ for (i = 0; i < sched[0].allocations_nb; i++)
+ {
+ test_fail_if (sched[0].allocations[i].end_offset_tck !=
+ sched_verify.allocations[i].end_offset_tck,
+ "Wrong schedule at index %d", i);
+ }
+ }
+ test_end;
+ }
+ else if (!snid_change_test_second_shot)
+ {
+ uint i;
+ test_begin (test, "verify SNID change")
+ {
+ for (i = 0; i < 3; i++)
+ {
+ if (i < 1)
+ test_fail_if (sched[i].snid != snid_test, "Wrong snid");
+ else
+ test_fail_if (sched[i].snid != 0xB, "Wrong SNID");
+ }
+ }
+ test_end;
+ }
+ else if (snid_change_test_second_shot)
+ {
+ uint i;
+ cp_net_t *net;
+ test_begin (test, "verify SNID change")
+ {
+ for (i = 0; i < 3; i++)
+ {
+ test_fail_if (sched[i].snid != 0xB, "Wrong SNID");
+ }
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ test_fail_if (cp_net_get_snid (&cp, net) != 0xB, "Wrong SNID");
+ }
+ test_end;
+ }
+}
+
+
+bool
+ca_mfs_remove (ca_t *ctx, mfs_tx_t *mfs)
+{
+ return true;
+}
+
+void
+ca_mfs_add (ca_t *ctx, mfs_tx_t *mfs)
+{
+ dbg_assert (mfs);
+}
+
+
+void
+ca_mfs_update (ca_t *ctx, mfs_tx_t *mfs)
+{
+}
+
+void
+ca_mfs_hold (ca_t *ctx, mfs_tx_t *mfs)
+{
+}
+
+/**
+ * Sends a beacon, the interface will provide it to the SAR.
+ * \param ctx the interface context.
+ * \param beacon the beacon to send.
+ * \param the source mac address.
+ * \param beacon_mfs the mfs to use to send the beacon.
+ * \param bto_bpsto the four bto to use for the beacon and the bpsto address
+ * to be stamp by the pbproc.
+ */
+void
+interface_beacon_prepare (interface_t *ctx, pb_beacon_t *beacon, mac_t
+ mac_address, mfs_tx_t *beacon_mfs, void *bto_bpsto)
+{
+ blk_release_desc ((blk_t *) beacon);
+}
+
+/**
+ * Initialise the callbacks functions.
+ * \param ctx the interface context.
+ * \param beacon_add_cb the function to call on beacon reception
+ * \param user_data the data to provide on each callback function.
+ */
+void
+interface_callback_beacon_init (interface_t *ctx,
+ interface_beacon_add_cb_t beacon_add_cb,
+ void *user_data)
+{
+}
+
+
diff --git a/cesar/cp/cco/action/Module b/cesar/cp/cco/action/Module
new file mode 100644
index 0000000000..9cde29712e
--- /dev/null
+++ b/cesar/cp/cco/action/Module
@@ -0,0 +1 @@
+SOURCES := cco_action.c
diff --git a/cesar/cp/cco/action/cco_action.h b/cesar/cp/cco/action/cco_action.h
new file mode 100644
index 0000000000..6931c6700e
--- /dev/null
+++ b/cesar/cp/cco/action/cco_action.h
@@ -0,0 +1,115 @@
+#ifndef cp_cco_action_h
+#define cp_cco_action_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cco/cco_action.h
+ * \brief CCo Public functions.
+ * \ingroup cp_cco
+ *
+ */
+
+#include "cp/cp.h"
+#include "cp/mme.h"
+#include "cp/beacon/beacon.h"
+#include "cp/sta/mgr/sta.h"
+
+/** Forward declaration. */
+typedef struct cp_cco_action_t cp_cco_action_t;
+
+/**
+ * initialisation of CCo action module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cco_action_init (cp_t *ctx);
+
+/**
+ * Uninitialisation of CCo action module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cco_action_uninit (cp_t *ctx);
+
+/**
+ * Change the SNID.
+ * \param ctx the module context.
+ *
+ * It shall request the SNIDs in use from the station manager to choose
+ * one randomly in the available SNIDs
+ */
+void
+cp_cco_action_snid_change (cp_t *ctx);
+
+/**
+ * perform garbage actions of CCo's responsibility.
+ * \param ctx the module context.
+ */
+void
+cp_cco_action_garbage (cp_t *ctx);
+
+/**
+ * generate a new NEK value.
+ * \param ctx the module context.
+ *
+ * NEK shall be used no more than 1 hour, so must be changed after 1
+ * hour for that purpose, NEK expiration date is checked at every occurrence
+ * of the global garbage collector timer and if current NEK expiration
+ * date reached, a new NEK value shall be generated by calling this function
+ */
+void
+cp_cco_action_gen_nek (cp_t *ctx);
+
+/**
+ * manage association of a station.
+ * \param ctx the module context.
+ * \param assoc_req CM_ASSOC.REQ MME msg having being received
+ */
+void
+cp_cco_action_manage_sta_assoc (cp_t *ctx, cp_mme_rx_t * assoc_req);
+
+/**
+ * manage authentication of a station.
+ * \param ctx the module context.
+ * \param get_key_req CM_GET_KEY.REQ MME msg having being decrypted
+ */
+void
+cp_cco_action_manage_sta_auth (cp_t *ctx, cp_mme_rx_t * get_key_req);
+
+/**
+ * manage explicit leave request of a station.
+ * \param ctx the module context.
+ * \param leave_req The MME leave req message.
+ * \param sta provided by the garbage function to send a CC_LEAVE_IND.
+ *
+ * Remove the station from the station manager
+ */
+void
+cp_cco_action_manage_sta_leave (cp_t *ctx, cp_mme_rx_t * leave_req,
+ cp_sta_t *sta);
+
+/**
+ * manage explicit leave request of a station.
+ * \param ctx the module context.
+ * \param leave_req The MME leave req message.
+ *
+ * Remove the station from the station manager
+ */
+extern inline void
+cp_cco_action_manage_sta_leave_req (cp_t *ctx, cp_mme_rx_t * leave_req)
+{
+ dbg_assert (ctx);
+ dbg_assert (leave_req);
+
+ cp_cco_action_manage_sta_leave (ctx, leave_req, NULL);
+}
+
+
+#endif /* cp_cco_action_h */
diff --git a/cesar/cp/cco/action/cco_conn/Module b/cesar/cp/cco/action/cco_conn/Module
new file mode 100644
index 0000000000..cc9223a014
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/Module
@@ -0,0 +1 @@
+SOURCES:=action.c
diff --git a/cesar/cp/cco/action/cco_conn/cco_action.h b/cesar/cp/cco/action/cco_conn/cco_action.h
new file mode 100644
index 0000000000..08a4ccf76b
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/cco_action.h
@@ -0,0 +1,515 @@
+#ifndef cp_cco_action_h
+#define cp_cco_action_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp_cco_action.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "cp/mme.h"
+#include "lib/list.h"
+#include "cp/conn/conn.h"
+
+/**
+ * - Functions reacting to incoming MME related to global connection.
+ * - Treatment of those MME - Storage and validation of the global connections
+ * - Control of the Bandwidth Manager's actions - React to the connections'
+ * states to send IND or CNF MME
+ */
+struct cp_cco_action_conn_t
+{
+ cp_conn_cspec_t *proposed_cspec;
+};
+typedef struct cp_cco_action_conn_t cp_cco_action_conn_t;
+
+/**
+ * Checks the states of the connections. If then need to be warned of changes
+ * on their allocation this function will do so.
+ * \param ctx Control Plane Context
+ *
+ * Checks the states of the connections allocation status.
+ */
+void
+cp_cco_action_mme_glink_send (cp_t *ctx);
+
+/**
+ * Process a CC_LINK_NEW.
+ * \param ctx Control Plane Context
+ * \param mme Incoming mme
+ *
+ * Check the validity of the connection. Add the connection into
+ * the list of connections and the pending allocation list Call the bandwidth
+ * manager to redo the schedule Call cp_cco_action_mme_conn_cnf()
+ */
+void
+cp_cco_action_process_cc_link_new_req (cp_t* ctx, cp_mme_rx_t* mme);
+
+/*Managed by sta action :*/
+void
+cp_cco_action_process_cc_link_new_cnf (cp_t* ctx, cp_mme_rx_t* mme);
+
+/**
+ * Process a CC_LINK_REL.
+ * \param ctx Control Plane Context
+ * \param mme Incoming mme
+ *
+ * Release the connection from the connections list and the pending
+ * allocation list Send the MME that will release the connection Call
+ * the bandwidth manager to redo the schedule
+ */
+void
+cp_cco_action_process_cc_link_rel_req (cp_t* ctx, cp_mme_rx_t* mme);
+
+/*Managed by sta action :*/
+void
+cp_cco_action_process_cc_link_rel_ind (cp_t* ctx, cp_mme_rx_t* mme);
+
+/**
+ * Process a CC_LINK_MOD.
+ * \param ctx Control Plane Context
+ * \param mme Incoming mme
+ *
+ * Check the validity of the modifications Modify the connection's
+ * data Call the schedule function Check if the connection is still in
+ * the schedule Send the MME CNF with the result
+ */
+void
+cp_cco_action_process_cc_link_mod_req (cp_t* ctx, cp_mme_rx_t* mme);
+
+/*Managed by sta action :*/
+void
+cp_cco_action_process_cc_link_mod_cnf (cp_t* ctx, cp_mme_rx_t* mme);
+
+/**
+ * Process a CC_ALLOC_MOVE.
+ * \param ctx Control Plane Context
+ * \param mme Incoming mme
+ *
+ * Check the validity of the connection. Memorise the position of
+ * the allocation Call the function that can allocate a unique connection.
+ * If it has allocated it somewhere else we delete the old allocation
+ * if not we keep the old allocation Send the MME CNF with the result
+ * Add the connection into the list of connections and the pending allocation
+ * list Call the bandwidth manager to redo the schedule Call cp_cco_action_mme_conn_cnf()
+ */
+void
+cp_cco_action_process_cc_alloc_move_req (cp_t* ctx, cp_mme_rx_t* mme);
+
+/*Managed by sta action :*/
+void
+cp_cco_action_process_cc_alloc_move_cnf (cp_t* ctx, cp_mme_rx_t* mme);
+
+/**
+ * Process of a CC_BLE_UPDATE.
+ * \param ctx Control Plane Context.
+ * \param mme Incoming MME
+ *
+ * IND. Actualisation of the BLE of a specific GLID. Call the Bandwidth
+ * Manager to redo the schedule
+ */
+void
+cp_cco_action_process_cc_ble_update_ind (cp_t* ctx, cp_mme_rx_t* mme);
+
+/**
+ * Init function of the CCo.
+ * \param ctx Control Plane Context.
+ *
+ */
+void
+cp_cco_action_init (cp_t* ctx);
+
+/**
+ * Uninit the cco action module (call the uninit function of lower ctx).
+ * \param ctx Control Plane Context.
+ *
+ */
+void
+cp_cco_action_uninit (cp_t *ctx);
+
+/*****************************/
+/* STUBBED FUNCTIONS */
+/*****************************/
+
+/*****************************/
+/**** LINK NEW ****/
+/*****************************/
+
+struct cp_msg_cc_link_new_req_t
+{
+ /** Mac address of the initiating STA */
+ mac_t osa;
+
+ /** Mac address of the terminating STA */
+ mac_t oda;
+
+ /** Connection identifier */
+ u16 cid;
+
+ /** Forward BLE */
+ list_t ble_f;
+
+ /** Reverse BLE */
+ list_t ble_r;
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_new_req_t cp_msg_cc_link_new_req_t;
+
+struct cp_msg_cc_link_new_cnf_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Forward GLID */
+ u8 glid_f;
+
+ /** Reverse GLID */
+ u8 glid_r;
+
+ /** Result */
+ u8 result;
+
+ /** Proposed CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_new_cnf_t cp_msg_cc_link_new_cnf_t;
+
+void
+cp_msg_cc_link_new_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_new_req_t *data);
+bool
+cp_msg_cc_link_new_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_new_req_t *data);
+
+void
+cp_msg_cc_link_new_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_new_cnf_t *data);
+
+bool
+cp_msg_cc_link_new_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_new_cnf_t *data);
+
+/*****************************/
+/**** LINK REL ****/
+/*****************************/
+
+struct cp_msg_cc_link_rel_req_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** TEI of the requesting STA */
+ u8 tei;
+
+ /** Reason code */
+ u8 reason_code;
+
+ /** Violated CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_rel_req_t cp_msg_cc_link_rel_req_t;
+
+struct cp_msg_cc_link_rel_ind_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** MAC address of the STA requesting the release */
+ mac_t mac;
+
+ /** Reason code */
+ u8 reason_code;
+
+ /** Proposed CSPEC */
+ cp_conn_cspec_t *cspec_proposed;
+
+ /** Violated CSPEC */
+ cp_conn_cspec_t *cspec_violated;
+};
+typedef struct cp_msg_cc_link_rel_ind_t cp_msg_cc_link_rel_ind_t;
+
+void
+cp_msg_cc_link_rel_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_rel_req_t *data);
+
+bool
+cp_msg_cc_link_rel_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_rel_req_t *data);
+
+void
+cp_msg_cc_link_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_rel_ind_t *data);
+
+bool
+cp_msg_cc_link_rel_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_rel_ind_t *data);
+
+/*****************************/
+/**** LINK MOD ****/
+/*****************************/
+
+struct cp_msg_cc_link_mod_req_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+
+ /** Forward ble */
+ list_t ble_f;
+
+ /** Reversr ble */
+ list_t ble_r;
+};
+typedef struct cp_msg_cc_link_mod_req_t cp_msg_cc_link_mod_req_t;
+
+struct cp_msg_cc_link_mod_cnf_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Result */
+ u8 result;
+
+ /** Proposed CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_mod_cnf_t cp_msg_cc_link_mod_cnf_t;
+
+void
+cp_msg_cc_link_mod_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_mod_req_t *data);
+
+bool
+cp_msg_cc_link_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_mod_req_t *data);
+
+void
+cp_msg_cc_link_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_mod_cnf_t *data);
+
+bool
+cp_msg_cc_link_mod_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_mod_cnf_t *data);
+/*************************/
+/*** LINK INFO ***/
+/*************************/
+
+struct cp_msg_cc_link_info_req_t
+{
+ /** */
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_info_req_t cp_msg_cc_link_info_req_t;
+
+struct cp_msg_cc_link_info_cnf_t
+{
+ /** */
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_info_cnf_t cp_msg_cc_link_info_cnf_t;
+
+struct cp_msg_cc_link_info_ind_t
+{
+ /** */
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_info_ind_t cp_msg_cc_link_info_ind_t;
+
+struct cp_msg_cc_link_info_rsp_t
+{
+ /** */
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_info_rsp_t cp_msg_cc_link_info_rsp_t;
+
+void
+cp_msg_cc_link_info_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_info_req_t *data);
+
+bool
+cp_msg_cc_link_info_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_info_req_t *data);
+
+void
+cp_msg_cc_link_info_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_info_cnf_t *data);
+
+bool
+cp_msg_cc_link_info_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_info_cnf_t *data);
+
+void
+cp_msg_cc_link_info_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_info_ind_t *data);
+
+bool
+cp_msg_cc_link_info_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_info_ind_t *data);
+
+void
+cp_msg_cc_link_info_rsp_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_info_rsp_t *data);
+
+bool
+cp_msg_cc_link_info_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_info_rsp_t *data);
+
+/*****************************/
+/**** LINK SQZ ****/
+/*****************************/
+
+struct cp_msg_cc_link_sqz_req_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Modified CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_sqz_req_t cp_msg_cc_link_sqz_req_t;
+
+struct cp_msg_cc_link_sqz_cnf_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Result */
+ u8 result;
+
+ /** Proposed CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_cc_link_sqz_cnf_t cp_msg_cc_link_sqz_cnf_t;
+
+void
+cp_msg_cc_link_sqz_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_sqz_req_t *data);
+
+bool
+cp_msg_cc_link_sqz_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_sqz_req_t *data);
+void
+cp_msg_cc_link_sqz_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_sqz_cnf_t *data);
+bool
+cp_msg_cc_link_sqz_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_sqz_cnf_t *data);
+
+/*****************************/
+/**** BLE UPDATE ****/
+/*****************************/
+
+struct cp_msg_cc_ble_update_ind_t
+{
+ /** GLID */
+ u8 glid;
+
+ /** BLE */
+ list_t ble;
+};
+typedef struct cp_msg_cc_ble_update_ind_t cp_msg_cc_ble_update_ind_t;
+
+void
+cp_msg_cc_ble_update_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_ble_update_ind_t *data);
+bool
+cp_msg_cc_ble_update_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_ble_update_ind_t *data);
+
+/*****************************/
+/**** ALLOC MOVE ****/
+/*****************************/
+
+struct cp_msg_cc_alloc_move_req_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Forward GLID */
+ u8 glid_f;
+
+ /** Reverse GLID */
+ u8 glid_r;
+
+ /** Forward BLE */
+ list_t ble_f;
+
+ /** Reverse BLE */
+ list_t ble_r;
+};
+typedef struct cp_msg_cc_alloc_move_req_t cp_msg_cc_alloc_move_req_t;
+
+struct cp_msg_cc_alloc_move_cnf_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Result */
+ u8 result;
+};
+typedef struct cp_msg_cc_alloc_move_cnf_t cp_msg_cc_alloc_move_cnf_t;
+
+void
+cp_msg_cc_alloc_move_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_alloc_move_req_t *data);
+
+bool
+cp_msg_cc_alloc_move_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_alloc_move_req_t *data);
+void
+cp_msg_cc_alloc_move_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_alloc_move_cnf_t *data);
+bool
+cp_msg_cc_alloc_move_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_alloc_move_cnf_t *data);
+
+#endif /* cp_cco_action_h */
diff --git a/cesar/cp/cco/action/cco_conn/doc/CCo Con.odt b/cesar/cp/cco/action/cco_conn/doc/CCo Con.odt
new file mode 100755
index 0000000000..aed8db1cab
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/doc/CCo Con.odt
Binary files differ
diff --git a/cesar/cp/cco/action/cco_conn/doc/cco_conn.xmi b/cesar/cp/cco/action/cco_conn/doc/cco_conn.xmi
new file mode 100644
index 0000000000..2e98a9400e
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/doc/cco_conn.xmi
@@ -0,0 +1,1755 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-08-06T11:31:34" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="UML Model" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="MSG Module" isRoot="false" isAbstract="false" name="MSG Module" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="CCo Action Module" isRoot="false" isAbstract="false" name="CCo Action Module" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Bandwidth Manager Module" isRoot="false" isAbstract="false" name="Bandwidth Manager Module" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OqFNT55UVzVU" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0widC5QuvWxy" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="irUbdfzRtLuy" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OMTNsx2stiV3" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="luyeQvc8m5hN" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="kfod0hZO32mt" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xmmoTFsE9otX" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="jTfTYNoH0asy" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="HSMJS6CQrwCI" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="C4WJsNrZpU0N" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pocpPVnex8xP" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" comment="Start Time" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="huvuRoPtpoED" isRoot="false" isAbstract="false" name="cp_st_t" />
+ <UML:DataType stereotype="datatype" comment="End Time" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TJR8rTv6HJGr" isRoot="false" isAbstract="false" name="cp_et_t" />
+ <UML:DataType stereotype="datatype" comment="Connection Specification" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZCvyT3nV6461" isRoot="false" isAbstract="false" name="cp_cspec_t*" />
+ <UML:DataType stereotype="datatype" comment="Connection information" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BlOcERrdVcJi" isRoot="false" isAbstract="false" name="cp_cinfo_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nKah2FElYQjf" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" comment="Connection " isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qpL5yhMnv5m5" isRoot="false" isAbstract="false" name="cp_conn_t*" />
+ <UML:DataType stereotype="datatype" comment="Control Plane Context" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3Xrk8GDGycgY" isRoot="false" isAbstract="false" name="cp_t*" />
+ <UML:DataType stereotype="datatype" comment="connection allocation" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="M6xKR1cFPIwW" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_alloc_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" comment="Received MME" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="iSF0bbc1ufLz" isRoot="false" isAbstract="false" name="cp_mme_rx_t*" />
+ <UML:DataType stereotype="datatype" comment="Sending MME" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="rXf3L5yLNrBT" isRoot="false" isAbstract="false" name="cp_mme_tx_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="9kqqNN6qIMaD" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" comment="heap of connection of a specific priority stored regarding their time arrival" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="S1gNUo1cYqQt" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_prio_heap_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="D9PiHaAGBCIb" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qx03D9bX8Zse" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eoUNxGuvIuwA" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_conn_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LMD9GuDpzhxX" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_conn_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" comment="interval of a BLE (time and BLE)" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="l4plA4WjZ5hz" isRoot="false" isAbstract="false" name="cp_ble_interval_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="28emhDJMNjju" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CAMwXARcOr2q" isRoot="false" isAbstract="false" name="cp_cspec_field_status_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0FkJo3kMVDSV" isRoot="false" isAbstract="false" name="cp_link_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="d21ZFkuCFK5X" isRoot="false" isAbstract="false" name="cp_link_cinfo_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="y93NOeEZLD5e" isRoot="false" isAbstract="false" name="cp_link_qmp_t*" elementReference="3QNGiQmMsrXJ" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Z3fT7dhQPy4n" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S3qSyHnpdPGE" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="3zrUNtrbiwjH" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="HtfvGG8l8Yj7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="5NEvecI4g8We" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="PJR0hhFkh4E2" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="3SUL0HC3J5nD" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="x6cf0Ju4g8zI" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="jHMPOr1lARmr" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="2lGX5o190Fyn" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="8zap3oq0sSer" aggregation="composite" type="xnGQ9ti6LKXZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lWvQfsgM71lV" aggregation="none" type="akTdL0BuuMIi" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="mtZJnRKOO7ZU" isRoot="false" isAbstract="false" name="cp_conn_state_t" >
+ <UML:EnumerationLiteral comment="Connection actualy scheduled" isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="OX2HniyXbXoO" isRoot="false" isAbstract="false" name="IN" />
+ <UML:EnumerationLiteral comment="connection just added to the schedule a MME to confirm its presence into the schedule is needed." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="neVJeoamoZ5F" isRoot="false" isAbstract="false" name="ADD" />
+ <UML:EnumerationLiteral comment="Connection out of the schedule. This connection has to be cleared form the list." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="cqyEfU3313Im" isRoot="false" isAbstract="false" name="OUT" />
+ <UML:EnumerationLiteral comment="Connection just released normaly." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="loGfKRYwIW8x" isRoot="false" isAbstract="false" name="REL_NOR" />
+ <UML:EnumerationLiteral comment="Connection just released because of lack of Bandwidth space. " isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="80zKS1hCpxp7" isRoot="false" isAbstract="false" name="REL_BW" />
+ <UML:EnumerationLiteral comment="Connection just released because of connection specification pbs." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="eDMziEWTrzlV" isRoot="false" isAbstract="false" name="REL_CSPEC" />
+ <UML:EnumerationLiteral comment="Connection just released because it requested it." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="zRZGwOSgcWwz" isRoot="false" isAbstract="false" name="REL_REQ" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="t1BwC0faIOY6" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Cv13Ndu7AnVp" aggregation="aggregate" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="d9BkAuG0cV1m" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="X4PpSxvCxRZk" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Wp4WF9XR5YUQ" aggregation="aggregate" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="CMVM709k8IVI" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="vFMsgta757Na" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="AjHkCGWi5YCK" aggregation="aggregate" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ihjlFCBPWhje" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="K35NPMr9taR3" isRoot="false" isAbstract="false" name="Classes" >
+ <UML:Namespace.ownedElement>
+ <UML:Class comment="Allocation of a connection" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="akTdL0BuuMIi" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Start Time of the allocation" isSpecification="false" visibility="public" xmi.id="WHgpgU3HDWsW" type="huvuRoPtpoED" name="st" />
+ <UML:Attribute comment="End Time of the allocation" isSpecification="false" visibility="public" xmi.id="2pv02ohjicc7" type="TJR8rTv6HJGr" name="et" />
+ <UML:Attribute comment="Pointer on the previous allocation" isSpecification="false" visibility="public" xmi.id="6CEonouBntNY" type="M6xKR1cFPIwW" name="prev_conn" />
+ <UML:Attribute comment="Pointer on the next allocation" isSpecification="false" visibility="public" xmi.id="6lmba4wqHNOl" type="M6xKR1cFPIwW" name="next_conn" />
+ <UML:Attribute comment="Persistence of the allocation. Value not defined yet (maybe regarding to the priority)" isSpecification="false" visibility="public" xmi.id="KtVJ3RkxxT7e" type="nKah2FElYQjf" name="presistence" />
+ <UML:Attribute comment="Start time persistent flag" isSpecification="false" visibility="public" xmi.id="dkbxTW5FavZS" type="irUbdfzRtLuy" name="stpf" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="jUHoqZsuISuy" type="9kqqNN6qIMaD" name="glid" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="9UW3dNtE8T9Z" type="qx03D9bX8Zse" name="cid" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="mVY4wQ05uW6V" type="9kqqNN6qIMaD" name="duration_persistence" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="rzhzQqWM5KrC" type="fn3T0g7mCdo8" name="node" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="3oBvIFO8C57d" type="vez0woDacG3c" name="set_node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="Bandwidth Manager Module" comment="Bandwidth Manager Module.
+- Create the schedule
+- Allocate a specific connection
+- finalise and return a schedule (used by the Beacon module only)" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="xnGQ9ti6LKXZ" isRoot="false" isAbstract="false" name="cp_cco_bw_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The actual schedule is the one is motion during the beacon period. It receives modifications regarding on the incoming MMEs. " isSpecification="false" visibility="public" xmi.id="8SVuiaBMFxkG" type="LMD9GuDpzhxX" name="actual_schedule" />
+ <UML:Attribute comment="the finalised schedule is the schedule final given to the Beacon module to be transformed into BENTRYs." isSpecification="false" visibility="public" xmi.id="IvjtyxL96U0O" type="LMD9GuDpzhxX" name="finalised_schedule" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="bMccUjua3QRe" type="tOgMBBDlVoLx" name="prio_heap[CP_CCO_BW_NB_PRIORITY_HEAPS]" />
+ <UML:Attribute comment="Number of persistent allocation in the actual schedule" isSpecification="false" visibility="private" xmi.id="qqpCp7AgWp2f" type="qx03D9bX8Zse" name="nb_alloc_pers_actual" />
+ <UML:Attribute comment="umber of non persistent alloaction in the actual schedule" isSpecification="false" visibility="private" xmi.id="yEOT2jRXwz6c" type="qx03D9bX8Zse" name="nb_alloc_no_pers_actual" />
+ <UML:Attribute comment="Number of persistent allocation in the finalised schedule" isSpecification="false" visibility="private" xmi.id="wHXJuWtlMix9" type="qx03D9bX8Zse" name="nb_alloc_pers_finalised" />
+ <UML:Attribute comment="Number of non persistent alloaction in the finalised schedule" isSpecification="false" visibility="private" xmi.id="o5qKsqxq4MK4" type="qx03D9bX8Zse" name="nb_alloc_no_pers_finalised" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="kZlArwfzKyf6" isRoot="false" isAbstract="false" isQuery="false" name="new_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZMv7zjxAvhNM" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocate a complete Schedule
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="O87gKQtsw1DR" isRoot="false" isAbstract="false" isQuery="false" name="alloc_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="6RTqCXJl2bsz" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocates a unique connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="6r5JBb3UvGb7" isRoot="false" isAbstract="false" isQuery="false" name="alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VpAthpuJcZuj" type="irUbdfzRtLuy" />
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="6m22OgadlX6q" value="" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="SjnLGAlGZvwN" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="8VFn5SRIJtio" isRoot="false" isAbstract="false" isQuery="false" name="finalise_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="X8GAwAWf7KHR" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="uninit the bandwidth manager allocations" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CX7QmGnNQfyu" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Finalise and return the schedule. Fills the free fields with bonus allocation if there is not enough time for CSMA. Otherwise it fills with CSMA." isSpecification="false" isLeaf="false" visibility="public" xmi.id="N8I7BjZIOdlW" isRoot="false" isAbstract="false" isQuery="false" name="get_next_alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="" type="LMD9GuDpzhxX" />
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="2RCfo71rfqbl" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4bO4EM12qaue" value="" type="LMD9GuDpzhxX" name="prev_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Init of the BW manager" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qDTUjKdqN9vB" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="rztSWU4nfOxL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="VNZrMxhseKAs" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LhtoKuOr2e0y" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Clears the connections passing the new states to old and initiating the new to OUT state
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="REvc418qnVEv" isRoot="false" isAbstract="false" isQuery="false" name="clear_conn_state" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3WKGgYni79mL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WlMKMGxlUqNX" isRoot="false" isAbstract="false" isQuery="false" name="set_next_free_time_space
+" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="eMmXZjl1djyO" type="irUbdfzRtLuy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sTLfzZY03sGh" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Uu0wkMRapmDm" value="" type="O1PWAArevDzF" name="prev_alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LlkPcy60zUW8" value="" type="O1PWAArevDzF" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="5NytACfVvOsX" isRoot="false" isAbstract="false" isQuery="false" name="uninit_actual_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MxWKR0S3MCYu" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="2dqv1jTNexf5" isRoot="false" isAbstract="false" isQuery="false" name="get_nb_alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vh1AX1VZcLUd" type="qx03D9bX8Zse" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="x76IKcCEw5lx" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocate at the beginning of the beacon period
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="2vygqejoln43" isRoot="false" isAbstract="false" isQuery="false" name="alloc_beginning" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QEHKJ3HEiGMF" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5ZkoNosn277K" value="" type="qx03D9bX8Zse" name="duration" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8MYqct3sinht" value="" type="9kqqNN6qIMaD" name="glid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="release the finalised schedule when it has been used (triggered by the Beacon module)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="29Uw34J8wOf4" isRoot="false" isAbstract="false" isQuery="false" name="release_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GbMzYAgg33TV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initiate the last ble and checks if the end of the free time has been reached." isSpecification="false" isLeaf="false" visibility="private" xmi.id="42UyQ92giMdG" isRoot="false" isAbstract="false" isQuery="false" name="get_alloc_ble" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZrY2nqzsglS3" type="irUbdfzRtLuy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DYfFa9DyHDdz" value="" type="JO1FHqi41DrK" name="first_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XEG2U9YoXX3m" value="" type="JO1FHqi41DrK" name="last_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NloMydf9BKMj" value="" type="qx03D9bX8Zse" name="nb_pb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5slaPoMkX84U" value="" type="TZfikGiIVwKz" name="alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lhdw1ydTVIBG" value="" type="TZfikGiIVwKz" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Calculate the best allocation time between 2 BLE" isSpecification="false" isLeaf="false" visibility="private" xmi.id="Xml5upZdXAZW" isRoot="false" isAbstract="false" isQuery="false" name="calculation_of_alloc_time" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8AzeT9s00O2m" value="" type="JO1FHqi41DrK" name="first_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ezeuk5xIpiLi" value="" type="JO1FHqi41DrK" name="last_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VuL02tV93UnW" value="" type="qx03D9bX8Zse" name="nb_pb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="34UrkpZDhuEk" value="" type="bfUc1UOFU09C" name="alloc_st" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="njtpBeJnHoNI" value="" type="bfUc1UOFU09C" name="alloc_et" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="D9bu1ncnWTcg" value="" type="TZfikGiIVwKz" name="alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5vRMhocyV7gC" value="" type="TZfikGiIVwKz" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="CCo Action Module" comment="- Functions reacting to incoming MME related to global connection.
+- Treatment of those MME
+- Storage and validation of the global connections
+- Control of the Bandwidth Manager's actions
+- React to the connections' states to send IND or CNF MME
+" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="ySeTGJOMEmYM" isRoot="false" isAbstract="false" name="cp_cco_action_t" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="he8aiM3PdmBs" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Operation comment="Function called after any allocation (complete schedule or single connection allocation)
+Study the state of the connections and send the MME related to those states.
+After sending those MMEs it clears the status.
+" isSpecification="false" isLeaf="false" visibility="private" xmi.id="QNnsMczV4BbV" isRoot="false" isAbstract="false" isQuery="false" name="mme_glink_send" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="Mwcl7hCpINk2" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_NEW.REQ
+
+Check the validity of the connection.
+Add the connection into the list of connections and the pending allocation list
+Call the bandwidth manager to redo the schedule
+Call cp_cco_action_mme_conn_cnf()" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4Jl61qfG7FdR" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_new_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="JQWhk2qSS5T3" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="XgvJotVBjB3x" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_REL.REQ
+
+Release the connection from the connections list and the pending allocation list
+Send the MME that will release the connection
+Call the bandwidth manager to redo the schedule " isSpecification="false" isLeaf="false" visibility="public" xmi.id="kWAzj2FfLSzz" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_rel_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="Ysh6LPKcpqHZ" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="MfPA26ZPsMEE" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_MOD.REQ
+
+Check the validity of the modifications
+Modify the connection's data
+Call the schedule function
+Check if the connection is still in the schedule
+Send the MME CNF with the result" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7f6S84QwyS5a" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="twxoZyefgG9F" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="Js8VgHGBvBVj" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_ALLOC_MOVE.REQ
+
+Check the validity of the connection.
+Memorise the position of the allocation
+Call the function that can allocate a unique connection.
+If it has allocated it somewhere else we delete the old allocation
+if not we keep the old allocation
+Send the MME CNF with the result
+Add the connection into the list of connections and the pending allocation list
+Call the bandwidth manager to redo the schedule
+Call cp_cco_action_mme_conn_cnf()" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VChtJRri78Bp" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_alloc_move_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="K8VzP5bG2Y5Z" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WjCAzMPBDokO" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process of a CC_BLE_UPDATE.IND. Actualisation of the BLE of a specific GLID. Call the Bandwidth Manager to redo the schedule." isSpecification="false" isLeaf="false" visibility="public" xmi.id="seYRAqbe0Jvw" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_ble_update_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="control plane context" isSpecification="false" visibility="private" xmi.id="e4ZuZ9iDlUSB" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming MME" isSpecification="false" visibility="private" xmi.id="7C9DGhT6JzVU" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Init function of the CCo" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DNsf89jKgseb" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="d9I6Xsav4TQb" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Uninit the cco action module (call the uninit function of lower ctx)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tR7lNfHrBJvJ" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Structure of a link." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Dd5IhQuqhODL" isRoot="false" isAbstract="false" name="cp_link_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="RP4g6QESrIGR" type="nKah2FElYQjf" name="status" />
+ <UML:Attribute comment="global link identifier" isSpecification="false" visibility="public" xmi.id="R4lfEOk34S06" type="9kqqNN6qIMaD" name="llid" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="sQEhgV9JJ0Rv" type="9kqqNN6qIMaD" name="glid" />
+ <UML:Attribute comment="connection information" isSpecification="false" visibility="public" xmi.id="y3j2Tj7pa9ls" type="BlOcERrdVcJi" name="cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="naiC13Fgjvwp" type="y93NOeEZLD5e" name="qmp" />
+ <UML:Attribute comment="forward BLE" isSpecification="false" visibility="public" xmi.id="2IFWtWCrXvs0" type="hQ7UEYOzATqF" name="list_ble" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="FMPxocle20Jj" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TS2kQReD1MO2" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ndi6WcvlwJhi" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tQKvOecr4caV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Table that stores the pending connection in order of arrival.
+Each table has a specific priority level assigned (0 to 3).
+It manages the order and return the most prior connection" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="pEl1C68UjFRR" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_heap_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="level of priority of the heap (4 different levels)" isSpecification="false" visibility="public" xmi.id="ooF6vpsKuOw1" type="9kqqNN6qIMaD" name="table_priority_level" />
+ <UML:Attribute comment="first connection of the heap" isSpecification="false" visibility="public" xmi.id="BoTNcsVT3vk5" type="hQ7UEYOzATqF" name="conns" />
+ <UML:Attribute comment="stage of the allocation. Faster to get to the next connection to allocate." isSpecification="false" visibility="public" xmi.id="AhBRVaG2kt6W" type="D9PiHaAGBCIb" name="nb_conn_allocated" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="vlplg1EMIh54" type="D9PiHaAGBCIb" name="nb_conn" />
+ <UML:Operation comment="gets the most prior pending connection return its CID" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BuYs8zIb3uMF" isRoot="false" isAbstract="false" isQuery="false" name="get_most_prior_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qSDgfvHVlaaj" type="9kqqNN6qIMaD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="delete a connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ArL3GjV2Yl6R" isRoot="false" isAbstract="false" isQuery="false" name="del_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="pjWQWF5WMF9W" value="" type="9kqqNN6qIMaD" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="add a connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="YyjQMfR7LmP8" isRoot="false" isAbstract="false" isQuery="false" name="add_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="p5JBnSFxHYyV" value="" type="9kqqNN6qIMaD" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Clears the status of the allocation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="FG15yw3gMB8Z" isRoot="false" isAbstract="false" isQuery="false" name="clear_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hWWrzM6s8tcm" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="uq9DVEHiSGoP" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Cr3X0B4hgaZd" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="udW0X6nRwucP" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6r5Z8twIjzph" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="connection storage regarding to its priority and time arrival." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="niNHo3iBMi93" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_conn_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="connection identifier
+" isSpecification="false" visibility="public" xmi.id="kC9bWRewTRAy" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="me7r6SxasvES" type="irUbdfzRtLuy" name="alloc_status" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="iHTllYAzskuy" type="fn3T0g7mCdo8" name="node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Connection Specification" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="d8mKKcTJhtMZ" isRoot="false" isAbstract="false" name="cp_link_qmp_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Delay Bound" isSpecification="false" visibility="public" xmi.id="gTg5YO0BUnWp" type="D9PiHaAGBCIb" name="delay" />
+ <UML:Attribute comment="jitter bound" isSpecification="false" visibility="public" xmi.id="Px64qTbAFKMM" type="D9PiHaAGBCIb" name="jitter" />
+ <UML:Attribute comment="Average MPDU size" isSpecification="false" visibility="public" xmi.id="hmYsthba8Gdh" type="qx03D9bX8Zse" name="av_MPDU_size" />
+ <UML:Attribute comment="Maximum MPDU size" isSpecification="false" visibility="public" xmi.id="eds9OOwnK2pA" type="qx03D9bX8Zse" name="max_MPDU_size" />
+ <UML:Attribute comment="Average data rate" isSpecification="false" visibility="public" xmi.id="TRLilh2QRZHL" type="qx03D9bX8Zse" name="av_data_rate" />
+ <UML:Attribute comment="Minimum data rate" isSpecification="false" visibility="public" xmi.id="nR9txDa68QcP" type="qx03D9bX8Zse" name="min_data_rate" />
+ <UML:Attribute comment="Maximum data rate" isSpecification="false" visibility="public" xmi.id="Cw0z3lDbs9ub" type="qx03D9bX8Zse" name="max_data_rate" />
+ <UML:Attribute comment="Maximum inter-TXOP time" isSpecification="false" visibility="public" xmi.id="8ZogWKRHjaAg" type="qx03D9bX8Zse" name="max_inter_TXOP" />
+ <UML:Attribute comment="Minimum inter TXOP time" isSpecification="false" visibility="public" xmi.id="mlls9LFKFFJI" type="qx03D9bX8Zse" name="min_inter_TXOP" />
+ <UML:Attribute comment="Maximum burst time" isSpecification="false" visibility="public" xmi.id="0UtqdlSmLEQp" type="qx03D9bX8Zse" name="max_burst" />
+ <UML:Attribute comment="Exception Policy" isSpecification="false" visibility="public" xmi.id="Xp6GQEvAxe07" type="9kqqNN6qIMaD" name="exception" />
+ <UML:Attribute comment="Inatictivity interval" isSpecification="false" visibility="public" xmi.id="zFRFUiXUCPJp" type="D9PiHaAGBCIb" name="inactivity" />
+ <UML:Attribute comment="MSDU error rate" isSpecification="false" visibility="public" xmi.id="AlZTxyIUnMlB" type="qx03D9bX8Zse" name="MSDU_error_rate" />
+ <UML:Attribute comment="Convergence Layer SAP Type" isSpecification="false" visibility="public" xmi.id="ZeJWIJbFY2U0" type="9kqqNN6qIMaD" name="CLST" />
+ <UML:Attribute comment="ATS tolerance" isSpecification="false" visibility="public" xmi.id="i0TuNmiXVFzS" type="qx03D9bX8Zse" name="ATS" />
+ <UML:Attribute comment="Smallest Tolerable Average Data rate" isSpecification="false" visibility="public" xmi.id="DHxzcgABIUha" type="qx03D9bX8Zse" name="min_tol_data" />
+ <UML:Attribute comment="Original average Data rate" isSpecification="false" visibility="public" xmi.id="nHpKJIK2Gnub" type="qx03D9bX8Zse" name="ori_av_data_rate" />
+ <UML:Attribute comment="RX window size" isSpecification="false" visibility="public" xmi.id="Xa82q7T1NOyx" type="qx03D9bX8Zse" name="rx_window" />
+ <UML:Attribute comment="Smoothing buffer size" isSpecification="false" visibility="public" xmi.id="498MbnuM4hgM" type="D9PiHaAGBCIb" name="smoothing:24" />
+ <UML:Attribute comment="Bidirectional burst" isSpecification="false" visibility="public" xmi.id="xzMBkEmIptId" type="9kqqNN6qIMaD" name="bidir_burst" />
+ <UML:Attribute comment="Number of TXOPs per beacon" isSpecification="false" visibility="public" xmi.id="ylcJ9bGBiMVJ" type="9kqqNN6qIMaD" name="nb_TXOP" />
+ <UML:Attribute comment="Average number of PBs per TXOP" isSpecification="false" visibility="public" xmi.id="8NdA5IU0HqCz" type="qx03D9bX8Zse" name="av_nb_pb" />
+ <UML:Attribute comment="Maximum number of PBs per TXOP" isSpecification="false" visibility="public" xmi.id="3wFspYTmH35P" type="qx03D9bX8Zse" name="max_nb_pb" />
+ <UML:Attribute comment="Pending PB threshold" isSpecification="false" visibility="public" xmi.id="eKaKe4bmRFvU" type="qx03D9bX8Zse" name="ppb_threshold" />
+ <UML:Attribute comment="Surplus of Bandwidth" isSpecification="false" visibility="public" xmi.id="XPVmEflHbz7P" type="qx03D9bX8Zse" name="surplus_bw" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="cinfo structure" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Q60RU8Qxt2jh" isRoot="false" isAbstract="false" name="cp_link_cinfo_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Validity : 0x00 not valid ; 0x01 valid" isSpecification="false" visibility="public" xmi.id="BCj7uWVLsuTg" type="9kqqNN6qIMaD" name="valid_cinfo" />
+ <UML:Attribute comment="type of connection requested" isSpecification="false" visibility="public" xmi.id="OMIbwSMKXMj1" type="9kqqNN6qIMaD" name="mac_service_t" />
+ <UML:Attribute comment="CAP" isSpecification="false" visibility="public" xmi.id="Eu76mal8u3ho" type="9kqqNN6qIMaD" name="user_priority" />
+ <UML:Attribute comment="Transfer of the ATS to the HLE : 0x00 not 0x01 passed" isSpecification="false" visibility="public" xmi.id="U38zOryr0uB8" type="9kqqNN6qIMaD" name="ats" />
+ <UML:Attribute comment="0x00 no smoothing 0x01 smoothing if possible" isSpecification="false" visibility="public" xmi.id="ZCRPvpA9hHET" type="9kqqNN6qIMaD" name="smoothing" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Structure of a connection. Add, delete, return a link." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="adjwEdq884ob" isRoot="false" isAbstract="false" name="cp_conn_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Connection identifier" isSpecification="false" visibility="public" xmi.id="Iz4rTWTxS3n0" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Attribute comment="Forward link id (global or local)" isSpecification="false" visibility="public" xmi.id="bdStR08xCgmF" type="0FkJo3kMVDSV" name="flink" />
+ <UML:Attribute comment="Reverse link id (local or global)" isSpecification="false" visibility="public" xmi.id="PKGfk5LGn3bJ" type="0FkJo3kMVDSV" name="rlink" />
+ <UML:Attribute comment="connection state" isSpecification="false" visibility="public" xmi.id="q86HxGHLiEfh" type="mtZJnRKOO7ZU" name="old_conn_state" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="WeNEbK4sTNyR" type="Bv4qUQAgGcnc" name="type" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="eptSFkclMxyx" type="F2oiQk9bfCP9" name="conn_info" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="aYoq8ZSkOLCb" type="mtZJnRKOO7ZU" name="new_conn_state" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="cBHp8bzlZhfx" type="9kqqNN6qIMaD" name="request_id" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="lsIYD0TogXRd" type="6sEW3jvdsAQ0" name="osa" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="lNlK5PFoHXMS" type="6sEW3jvdsAQ0" name="oda" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="gr9Y2XYluI6x" type="fLjwr6MNuZXD" name="violated_cspec" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="EKdjKZFyRMXT" type="fLjwr6MNuZXD" name="modified_cspec" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="t3ElLIjycSsT" type="fn3T0g7mCdo8" name="node" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WFqOmNayfDhz" isRoot="false" isAbstract="false" isQuery="false" name="init_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AYmkyfDTs3re" type="qpL5yhMnv5m5" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nuwEETf5Wrrq" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="OPd3dI1QBxcP" isRoot="false" isAbstract="false" isQuery="false" name="add_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OHVu8KiGsV0q" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8BJ0C9eaYFcB" value="" type="qpL5yhMnv5m5" name="conn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="YdZhYB6wQZoX" isRoot="false" isAbstract="false" isQuery="false" name="del_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tVllymc6vt68" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0kiZyIiWvIDR" value="" type="qx03D9bX8Zse" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="RHNsrCNkh8Uf" isRoot="false" isAbstract="false" isQuery="false" name="get_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sJQKu9biFdAR" type="qpL5yhMnv5m5" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s4loxpwyZcVV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vD1oTCGtSbjJ" value="" type="qx03D9bX8Zse" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="n61SEV75ZqtV" isRoot="false" isAbstract="false" isQuery="false" name="check_conn_validity" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SdoXJt4CCUU5" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fnRDPuiI7i5Z" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6GWe4N9kAYvY" value="" type="qpL5yhMnv5m5" name="conn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="d6nqhvGn9kPE" isRoot="false" isAbstract="false" isQuery="false" name="get_free_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="V8MvjMfCSZn1" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8WwG4rmUSb2k" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="S6wdZOiCST19" isRoot="false" isAbstract="false" isQuery="false" name="get_free_llid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yVCOyDYKSRoR" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MHvW1Ik7peOr" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="connection list manager. add, delete, return, modify and check the validity of the connections." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Ffpcevz092To" isRoot="false" isAbstract="false" name="cp_conn_mgr_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="bYj9JToa9uKf" type="hQ7UEYOzATqF" name="conns" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="9kRYzQhfAceh" isRoot="false" isAbstract="false" isQuery="false" name="garbage_conn" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="wiccWDa1IGB0" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_new_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s7Ltc57HQDvY" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wM97NSNHAxte" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="ARdRgpRYumPW" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_new_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rWlFjgoe0vlL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="O8dW5U9Ewkdc" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="X48RoXwe1hti" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_rel_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OfMMb5ixDJRH" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nYThH6Jo8PEu" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="uAWvrOeD1yYc" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_rel_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4EXFXxUITv0k" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zHX7hj0brWVg" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="u7uw5QW7e2LB" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xpTQjR9ijeoO" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NozCISsDZm7f" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Cbkob5zYtRxc" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_mod_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s4KZi6x3uvFD" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="N7OxsTa22Kre" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="OoAFD7r499dr" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_info_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8M19fqn3fxIq" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="37uCEY2U5sbZ" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="yuO7aB8gV7pA" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_info_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ycBbYRRbYMll" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="snFxeqUcjshJ" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="3nxXunhqNtRt" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_add_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IrSpDEa3znyd" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eSDNIueKfbra" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="MYQkPqdgh6Vs" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_add_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="I5vHsrtUH6pZ" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zTte3iEPFd7c" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="TjI8pn05stMj" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kFD1K1YJSQxV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8AtNl00CjGKW" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="4KbuDwdv9pwT" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_mod_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qSkIsimzqfMb" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dKnLb7pdPPXc" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="J9VSwPumre2k" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_rel_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KmjAP3l3MYMv" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dBY2Y3crA7I6" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WCqMot49dnJ3" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_sqz_req_rx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="o368ZQ3DZZD8" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bqxlvFqQPgmE" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="XqLBbcEPfIWF" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_sqz_cnf_rx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="iXQF7dNgRLRN" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YHnywZATPVc0" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="7qNl6tymRO2W" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zNCRgboFrbBl" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="M9nDiyyqHBL5" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0ozdebNMCsR8" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="ble interval values" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="oE5CCxttNgAF" isRoot="false" isAbstract="false" name="cp_ble_interval_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="ble value" isSpecification="false" visibility="public" xmi.id="7MBbDW5Dfddz" type="9kqqNN6qIMaD" name="ble" />
+ <UML:Attribute comment="end time" isSpecification="false" visibility="public" xmi.id="rWKEXa4Lo7W0" type="qx03D9bX8Zse" name="et" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="yi3iuDTAFpl9" type="fn3T0g7mCdo8" name="node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vQr3syDVnjwt" isRoot="false" isAbstract="false" name="Class Diagram" >
+ <UML:Namespace.ownedElement/>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="46" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1785" snapy="10" showatts="1" xmi.id="4HFzWQZSTZhP" documentation="" type="1" showops="1" showpackage="0" name="conn" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1839" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="447" showattsigs="601" x="0" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="360" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Ffpcevz092To" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="386" showattsigs="601" x="541" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="378" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="adjwEdq884ob" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="128" x="1052" fillcolor="#ffffc0" y="113" linewidth="none" height="162" usefillcolor="1" isinstance="0" xmi.id="mtZJnRKOO7ZU" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="149" showattsigs="601" x="361" fillcolor="#ffffc0" y="605" showopsigs="601" linewidth="none" height="117" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Q60RU8Qxt2jh" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="173" showattsigs="601" x="0" fillcolor="#ffffc0" y="407" showopsigs="601" linewidth="none" height="477" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="d8mKKcTJhtMZ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="173" showattsigs="601" x="349" fillcolor="#ffffc0" y="772" showopsigs="601" linewidth="none" height="162" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Dd5IhQuqhODL" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="142" showattsigs="601" x="387" fillcolor="#ffffc0" y="991" showopsigs="601" linewidth="none" height="81" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="oE5CCxttNgAF" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="162" x="587" fillcolor="#ffffc0" y="799" linewidth="none" height="108" usefillcolor="1" isinstance="0" xmi.id="K9Fc7ya6eboZ" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="187" showattsigs="601" x="342" fillcolor="#ffffc0" y="441" showopsigs="601" linewidth="none" height="117" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="fLjwr6MNuZXD" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="adjwEdq884ob" widgetaid="Ffpcevz092To" xmi.id="AnXqp1nebv8V" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="447" starty="180" />
+ <endpoint endx="541" endy="189" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="3" indexb="2" linewidth="none" widgetbid="Dd5IhQuqhODL" widgetaid="adjwEdq884ob" xmi.id="1ZrlQBx4omHB" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="798" starty="378" />
+ <endpoint endx="464" endy="772" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="fLjwr6MNuZXD" widgetaid="adjwEdq884ob" xmi.id="ZLxwL8UTBdI7" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="669" starty="378" />
+ <endpoint endx="435" endy="441" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" visibilityB="200" totalcountb="3" indexb="1" linewidth="none" widgetbid="mtZJnRKOO7ZU" widgetaid="adjwEdq884ob" xmi.id="q86HxGHLiEfh" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="927" starty="126" />
+ <endpoint endx="1052" endy="167" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="117" x="944" fillcolor="none" y="170" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="hZY39ReOzCOM" text="old_conn_state" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" visibilityB="200" totalcountb="3" indexb="2" linewidth="none" widgetbid="mtZJnRKOO7ZU" widgetaid="adjwEdq884ob" xmi.id="aYoq8ZSkOLCb" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="927" starty="252" />
+ <endpoint endx="1052" endy="221" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="124" x="937" fillcolor="none" y="223" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="TOXZoZaWNmBv" text="new_conn_state" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="Q60RU8Qxt2jh" widgetaid="Dd5IhQuqhODL" xmi.id="qzZi0HXSKdRg" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="406" starty="772" />
+ <endpoint endx="435" endy="722" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="443" fillcolor="none" y="788" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="0UiHpihUHFXO" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="435" fillcolor="none" y="741" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="e9neJ90mXVKM" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="Q60RU8Qxt2jh" widgetaid="fLjwr6MNuZXD" xmi.id="ap8aOZNHajls" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="435" starty="558" />
+ <endpoint endx="435" endy="605" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="Dd5IhQuqhODL" widgetaid="d8mKKcTJhtMZ" xmi.id="yR77gv82Dngk" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="173" starty="725" />
+ <endpoint endx="349" endy="853" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" linewidth="none" widgetbid="d8mKKcTJhtMZ" widgetaid="fLjwr6MNuZXD" xmi.id="OlUNXhoPpodj" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="342" starty="499" />
+ <endpoint endx="173" endy="566" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="oE5CCxttNgAF" widgetaid="Dd5IhQuqhODL" xmi.id="VqiqgPP0C8zY" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="435" starty="934" />
+ <endpoint endx="458" endy="991" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="391" fillcolor="none" y="935" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="3sqQf1MdV2sK" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="411" fillcolor="none" y="967" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="lZm0pHPRRC5k" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="K9Fc7ya6eboZ" widgetaid="Dd5IhQuqhODL" xmi.id="yN55b1ltFiLX" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="522" starty="853" />
+ <endpoint endx="587" endy="853" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="64" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1313" snapy="10" showatts="1" xmi.id="Vi7xSEHjGpDi" documentation="" type="1" showops="1" showpackage="0" name="bw" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1347" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="433" showattsigs="601" x="258" fillcolor="#ffffc0" y="489" showopsigs="601" linewidth="none" height="171" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="ySeTGJOMEmYM" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="1309" showattsigs="601" x="0" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="432" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="447" showattsigs="601" x="0" fillcolor="#ffffc0" y="778" showopsigs="601" linewidth="none" height="360" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Ffpcevz092To" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="201" showattsigs="601" x="715" fillcolor="#ffffc0" y="673" showopsigs="601" linewidth="none" height="198" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="pEl1C68UjFRR" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="179" showattsigs="601" x="707" fillcolor="#ffffc0" y="933" showopsigs="601" linewidth="none" height="81" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="niNHo3iBMi93" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="271" showattsigs="601" x="1009" fillcolor="#ffffc0" y="477" showopsigs="601" linewidth="none" height="225" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="akTdL0BuuMIi" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="307" x="985" fillcolor="#ffffc0" y="761" linewidth="none" height="90" usefillcolor="1" isinstance="0" xmi.id="0AFakTbKOjhV" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" linewidth="none" widgetbid="Ffpcevz092To" widgetaid="ySeTGJOMEmYM" xmi.id="U9HR73bnbWVt" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="474" starty="660" />
+ <endpoint endx="298" endy="778" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="5" indexa="4" totalcountb="2" indexb="1" linewidth="none" widgetbid="akTdL0BuuMIi" widgetaid="xnGQ9ti6LKXZ" xmi.id="2lGX5o190Fyn" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="1047" starty="432" />
+ <endpoint endx="1009" endy="589" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="1049" fillcolor="none" y="434" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="2NvVPoo8Na9A" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="15" x="992" fillcolor="none" y="565" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="sYcJkf13jWsH" text="*" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="5" indexa="3" totalcountb="2" indexb="1" linewidth="none" widgetbid="pEl1C68UjFRR" widgetaid="xnGQ9ti6LKXZ" xmi.id="w2GO5CvfhZ6h" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="785" starty="432" />
+ <endpoint endx="815" endy="673" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="767" fillcolor="none" y="434" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="J3rx2sF2FBYd" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="817" fillcolor="none" y="649" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="xMlIwuRoQ158" text="4" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="5" indexb="1" linewidth="none" widgetbid="xnGQ9ti6LKXZ" widgetaid="Ffpcevz092To" xmi.id="iYWkSGRVz8hL" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="149" starty="778" />
+ <endpoint endx="261" endy="432" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="pEl1C68UjFRR" widgetaid="Ffpcevz092To" xmi.id="F2c5R39MF9xW" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="447" starty="958" />
+ <endpoint endx="715" endy="772" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="niNHo3iBMi93" widgetaid="pEl1C68UjFRR" xmi.id="iFQH9XCi3DbL" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="815" starty="871" />
+ <endpoint endx="796" endy="933" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="818" fillcolor="none" y="902" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="g5AOb2ft4Wo6" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="15" x="777" fillcolor="none" y="928" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="P39cChD71xQx" text="*" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="0AFakTbKOjhV" widgetaid="akTdL0BuuMIi" xmi.id="3qIL60CD7SL5" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="1144" starty="702" />
+ <endpoint endx="1138" endy="761" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="2" linewidth="none" widgetbid="xnGQ9ti6LKXZ" widgetaid="ySeTGJOMEmYM" xmi.id="pV8BBjAtfG0U" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="474" starty="489" />
+ <endpoint endx="523" endy="432" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="46" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1785" snapy="10" showatts="1" xmi.id="wDaoEutt1heF" documentation="" type="1" showops="1" showpackage="0" name="cco_action" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1839" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="433" showattsigs="601" x="2" fillcolor="#ffffc0" y="552" showopsigs="601" linewidth="none" height="171" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="ySeTGJOMEmYM" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="1309" showattsigs="601" x="0" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="432" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="447" showattsigs="601" x="622" fillcolor="#ffffc0" y="500" showopsigs="601" linewidth="none" height="360" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Ffpcevz092To" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="ySeTGJOMEmYM" widgetaid="Ffpcevz092To" xmi.id="REz0iVtn4vkj" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="622" starty="680" />
+ <endpoint endx="435" endy="637" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" linewidth="none" widgetbid="xnGQ9ti6LKXZ" widgetaid="Ffpcevz092To" xmi.id="iYWkSGRVz8hL" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="845" starty="500" />
+ <endpoint endx="436" endy="432" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="ySeTGJOMEmYM" widgetaid="xnGQ9ti6LKXZ" xmi.id="LcsLN0ze8QIE" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="436" starty="432" />
+ <endpoint endx="218" endy="552" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Package>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="K9Fc7ya6eboZ" isRoot="false" isAbstract="false" name="cp_link_type_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="15F3QKNkRcLY" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="sSSMYaHXdXb3" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_LOCAL" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="k4qPW77MaXi6" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_GLOBAL" />
+ </UML:Enumeration>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fLjwr6MNuZXD" isRoot="false" isAbstract="false" name="cp_conn_cspec_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="hUapPz7FvDlL" type="qx03D9bX8Zse" name="cspec_len_oct" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="zURtIMQaYz3T" type="d21ZFkuCFK5X" name="f_cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="eU5DT9ejQFbr" type="d21ZFkuCFK5X" name="r_cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="AhzYLwKyyJVB" type="y93NOeEZLD5e" name="f_qmp" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="7Na3g6CkUZ0C" type="y93NOeEZLD5e" name="r_qmp" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0AFakTbKOjhV" isRoot="false" isAbstract="false" name="cp_cco_bw_persistence_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="0AFakTbKOjhV" xmi.id="0sn2w94wHHV1" isRoot="false" isAbstract="false" name="CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT" />
+ <UML:EnumerationLiteral comment="
+" isSpecification="false" isLeaf="false" visibility="public" namespace="0AFakTbKOjhV" xmi.id="HGkt98I7y37u" isRoot="false" isAbstract="false" name="CP_CCO_BW_PERSISTENCE_PERSISTENT" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="SE4drlhQgGnK" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="ppkGqnOUsYsS" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ZVJd07jN8sxL" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5N0jdm3LnaNE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="XBQY8qUvfEBT" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zYys4qIdMbGK" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="b7KNffbX2W2O" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g0hoqe9Mpauv" aggregation="aggregate" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="OMp2Y0VYWTOb" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="fpbgLd4VX8IR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KgEeFVwvTdjH" aggregation="aggregate" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Hrd5PWynsnnP" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="kz0I7IjzeXWP" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="mJxIkJr2z4eC" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Xa70DqFTftW4" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="nVqR2Kp5JL6z" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="NSqFGde0uZGf" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="s6fpAK1hu6f6" aggregation="none" type="Dd5IhQuqhODL" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="FuUBzFE99m1F" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="xuZal3f8VVMj" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="0" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6yjzYycO4HCE" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="aRjAdPOlJ8Zo" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="ZDtUKYYFS7pC" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ASKdvgN2f4zB" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="iFQH9XCi3DbL" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="2bX4qjGQv9sF" aggregation="composite" type="pEl1C68UjFRR" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="hQS8VFKdieGd" aggregation="none" type="niNHo3iBMi93" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="mfAF1Et9RgMb" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Jddwia5i9cn0" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="M3OHBEUqeuy7" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="8NatufiLOVge" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="9GkptyTCa46G" aggregation="none" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fBwonjm7l8Mu" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="1V4Vw7QgAqng" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Mqkyij5sxnhq" aggregation="composite" type="ySeTGJOMEmYM" name="" multiplicity="0" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="k80KB6YqHUc3" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rG6FnLTUU3xX" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="CN8vVVpsJZo2" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="GusEfX4Ng5hr" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="w2GO5CvfhZ6h" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="9DfPiFQucYn6" aggregation="composite" type="xnGQ9ti6LKXZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="1cwJ9kJQcBeI" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Generalization isSpecification="false" child="ySeTGJOMEmYM" visibility="public" namespace="Logical View" xmi.id="he8aiM3PdmBs" parent="xnGQ9ti6LKXZ" discriminator="" name="" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="RdSzOM9ws9pF" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="igfMjLBtYoIE" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4i6eEtkGVeZd" aggregation="none" type="nKah2FElYQjf" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="TjLJsBY0YHzZ" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Ps311fHhLx45" aggregation="composite" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="GDwm2E14u5g8" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="FZnmqkJSolys" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zPOS3v5Sl6Sm" aggregation="composite" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ljU5eWAuj4fj" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="A4CznApzfO14" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="IgnAjSIirf9u" aggregation="composite" type="Dd5IhQuqhODL" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="aCLMJn64Wa9B" aggregation="none" type="nKah2FElYQjf" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5MhNVwbXrStj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="4H3oJiVZMHj6" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="j2mahvSF8nZP" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yGvogmXTI20E" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="YgR5EZEJoH58" aggregation="none" type="pEl1C68UjFRR" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="0ahMrRSaTF88" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yR77gv82Dngk" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="8bLEMvdvZ3yl" aggregation="composite" type="d8mKKcTJhtMZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="cC2QR7YRgGmV" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="qzZi0HXSKdRg" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="hC68PCEYlZk8" aggregation="composite" type="Dd5IhQuqhODL" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="SM1zPzj19lRa" aggregation="none" type="Q60RU8Qxt2jh" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Ytu0ZEZIt40G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="t00XEm2vy61O" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="JFu4meAD0BAP" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yIAhg4g39Wum" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="8tOFfqqWoo32" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="a5vYCwuT9oXt" aggregation="none" type="adjwEdq884ob" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="1ZrlQBx4omHB" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Rg6RpFpy8DBl" aggregation="aggregate" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="1zHpnIpNOkuY" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="SgCGphSMnicE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="eo1nbWf2CjR2" aggregation="none" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yGy5S9qT98Hw" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="4n7CxO4qepqv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="Q4ImpCITyJFZ" aggregation="none" type="pEl1C68UjFRR" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ouZ0d10aFwfh" aggregation="none" type="adjwEdq884ob" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="a1oSjxPd5iaz" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="6V9DbO70SPkH" aggregation="none" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Z3jYKw58of7P" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="VqiqgPP0C8zY" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5zt2cb68iHh" aggregation="composite" type="Dd5IhQuqhODL" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6OfYmQoJRVpl" aggregation="none" type="oE5CCxttNgAF" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="hTFpkGG8AM5T" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="PtsDYxaC2a52" aggregation="composite" type="d8mKKcTJhtMZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Ce8IMNyQkdxU" aggregation="none" type="nKah2FElYQjf" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="U9HR73bnbWVt" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="1jnSEbCbU4m0" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="1MC1wF47sANE" aggregation="none" type="Ffpcevz092To" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="REz0iVtn4vkj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="YJdGxakwJXPV" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6Z6adqacCkb7" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="iYWkSGRVz8hL" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="yfCqoZ2Ktfao" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="DKkWp7zwg3UH" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="eYhdhOxPg2Vx" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="t3r6nTDj6PZu" aggregation="composite" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="waCnFmbT4Kxs" aggregation="none" type="Ffpcevz092To" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="AnXqp1nebv8V" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Pxm60ELsHDy3" aggregation="composite" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g9mmWMfSupE7" aggregation="none" type="adjwEdq884ob" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="8IfFoRAxojCs" isRoot="false" isAbstract="false" name="Sequence diagram" >
+ <UML:Namespace.ownedElement/>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="fHTon9X3gX1E" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_link_new_req_valid" localid="g2KjDIEXFsVO" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="46" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="272" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="120" x="520" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="Ffpcevz092To" decon="0" localid="w4LrTD0CdDEH" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="104" x="717" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" decon="0" localid="g2KjDIEXFsVO" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="277" x="65" fillcolor="none" y="123" operation="4Jl61qfG7FdR" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="256" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="4Jl61qfG7FdR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="405" x="70" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": process_cc_link_new_req(ctx : cp_t*, mme : cp_mme_rx_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="254" x="334" fillcolor="none" y="155" operation="reovd9ZsoNSR" linewidth="none" widgetbid="w4LrTD0CdDEH" height="33" usefillcolor="1" seqnum="" textid="2V22C0q93ByU" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="reovd9ZsoNSR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="301" x="339" fillcolor="none" y="133" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="2V22C0q93ByU" text=": reovd9ZsoNSR" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="254" x="334" fillcolor="none" y="215" operation="PxHXpaAgEwbp" linewidth="none" widgetbid="w4LrTD0CdDEH" height="32" usefillcolor="1" seqnum="" textid="swhpBXfC0iED" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="PxHXpaAgEwbp" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="237" x="339" fillcolor="none" y="193" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="swhpBXfC0iED" text=": PxHXpaAgEwbp" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="443" x="334" fillcolor="none" y="273" operation="O87gKQtsw1DR" linewidth="none" widgetbid="g2KjDIEXFsVO" height="32" usefillcolor="1" seqnum="" textid="grDhZQuFSExg" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="O87gKQtsw1DR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="168" x="339" fillcolor="none" y="251" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="grDhZQuFSExg" text=": alloc_sched(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="50" x="332" fillcolor="none" y="335" operation="QNnsMczV4BbV" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="32" usefillcolor="1" seqnum="" textid="XtFP4RQkGeRn" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="QNnsMczV4BbV" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="203" x="337" fillcolor="none" y="313" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="XtFP4RQkGeRn" text=": mme_glink_send(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="yhmIJA8o3LB5" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_link_new_req_not_valid" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="46" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="120" x="520" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="Ffpcevz092To" decon="0" localid="w4LrTD0CdDEH" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="272" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="277" x="65" fillcolor="none" y="123" operation="4Jl61qfG7FdR" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="89" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="4Jl61qfG7FdR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="405" x="70" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": process_cc_link_new_req(ctx : cp_t*, mme : cp_mme_rx_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="254" x="334" fillcolor="none" y="155" operation="reovd9ZsoNSR" linewidth="none" widgetbid="w4LrTD0CdDEH" height="33" usefillcolor="1" seqnum="" textid="2V22C0q93ByU" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="reovd9ZsoNSR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="301" x="339" fillcolor="none" y="133" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="2V22C0q93ByU" text=": reovd9ZsoNSR" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="ok2jsyqCdw9J" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_link_rel_req" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="0" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="120" x="449" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="Ffpcevz092To" decon="0" localid="w4LrTD0CdDEH" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="104" x="594" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" decon="0" localid="g2KjDIEXFsVO" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="220" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="271" x="19" fillcolor="none" y="123" operation="kWAzj2FfLSzz" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="215" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="kWAzj2FfLSzz" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="395" x="24" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": process_cc_link_rel_req(ctx : cp_t*, mme : cp_mme_rx_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="235" x="282" fillcolor="none" y="160" operation="FXWnEhmm5mhN" linewidth="none" widgetbid="w4LrTD0CdDEH" height="32" usefillcolor="1" seqnum="" textid="swhpBXfC0iED" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="FXWnEhmm5mhN" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="131" x="287" fillcolor="none" y="138" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="swhpBXfC0iED" text=": FXWnEhmm5mhN" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="372" x="282" fillcolor="none" y="222" operation="O87gKQtsw1DR" linewidth="none" widgetbid="g2KjDIEXFsVO" height="32" usefillcolor="1" seqnum="" textid="grDhZQuFSExg" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="O87gKQtsw1DR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="168" x="287" fillcolor="none" y="200" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="grDhZQuFSExg" text=": alloc_sched(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="50" x="280" fillcolor="none" y="286" operation="QNnsMczV4BbV" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="32" usefillcolor="1" seqnum="" textid="XtFP4RQkGeRn" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="QNnsMczV4BbV" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="203" x="285" fillcolor="none" y="264" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="XtFP4RQkGeRn" text=": mme_glink_send(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="zbNIHnq6ICv9" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_link_mod_req_valid" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="0" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="120" x="423" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="Ffpcevz092To" decon="0" localid="w4LrTD0CdDEH" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="104" x="584" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" decon="0" localid="g2KjDIEXFsVO" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="155" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="206" x="19" fillcolor="none" y="123" operation="7f6S84QwyS5a" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="256" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="7f6S84QwyS5a" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="407" x="24" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": process_cc_link_mod_req(ctx : cp_t*, mme : cp_mme_rx_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="274" x="217" fillcolor="none" y="155" operation="reovd9ZsoNSR" linewidth="none" widgetbid="w4LrTD0CdDEH" height="33" usefillcolor="1" seqnum="" textid="2V22C0q93ByU" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="reovd9ZsoNSR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="301" x="222" fillcolor="none" y="133" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="2V22C0q93ByU" text=": reovd9ZsoNSR" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="274" x="217" fillcolor="none" y="215" operation="NKdd4j45iVaX" linewidth="none" widgetbid="w4LrTD0CdDEH" height="32" usefillcolor="1" seqnum="" textid="swhpBXfC0iED" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="NKdd4j45iVaX" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="290" x="222" fillcolor="none" y="193" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="swhpBXfC0iED" text=": NKdd4j45iVaX" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="427" x="217" fillcolor="none" y="273" operation="O87gKQtsw1DR" linewidth="none" widgetbid="g2KjDIEXFsVO" height="32" usefillcolor="1" seqnum="" textid="grDhZQuFSExg" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="O87gKQtsw1DR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="168" x="306" fillcolor="none" y="251" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="grDhZQuFSExg" text=": alloc_sched(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="50" x="215" fillcolor="none" y="335" operation="QNnsMczV4BbV" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="32" usefillcolor="1" seqnum="" textid="XtFP4RQkGeRn" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="QNnsMczV4BbV" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="203" x="220" fillcolor="none" y="313" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="XtFP4RQkGeRn" text=": mme_glink_send(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="jqjnWJ3RcZok" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_link_mod_req_not_valid" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="0" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="120" x="406" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="Ffpcevz092To" decon="0" localid="w4LrTD0CdDEH" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="182" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="233" x="19" fillcolor="none" y="123" operation="7f6S84QwyS5a" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="89" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="7f6S84QwyS5a" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="407" x="24" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": process_cc_link_mod_req(ctx : cp_t*, mme : cp_mme_rx_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="230" x="244" fillcolor="none" y="155" operation="reovd9ZsoNSR" linewidth="none" widgetbid="w4LrTD0CdDEH" height="33" usefillcolor="1" seqnum="" textid="2V22C0q93ByU" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="reovd9ZsoNSR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="301" x="249" fillcolor="none" y="133" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="2V22C0q93ByU" text=": reovd9ZsoNSR" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="So6DeCWo8dXw" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_link_sqz_req_rx_valid" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="0" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="120" x="407" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="Ffpcevz092To" decon="0" localid="w4LrTD0CdDEH" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="104" x="599" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" decon="0" localid="g2KjDIEXFsVO" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="190" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="241" x="19" fillcolor="none" y="123" operation="RfHVkGwVk5ST" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="256" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="RfHVkGwVk5ST" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="420" x="24" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": RfHVkGwVk5ST" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="223" x="252" fillcolor="none" y="155" operation="reovd9ZsoNSR" linewidth="none" widgetbid="w4LrTD0CdDEH" height="33" usefillcolor="1" seqnum="" textid="2V22C0q93ByU" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="reovd9ZsoNSR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="301" x="257" fillcolor="none" y="133" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="2V22C0q93ByU" text=": reovd9ZsoNSR" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="223" x="252" fillcolor="none" y="215" operation="NKdd4j45iVaX" linewidth="none" widgetbid="w4LrTD0CdDEH" height="32" usefillcolor="1" seqnum="" textid="swhpBXfC0iED" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="NKdd4j45iVaX" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="290" x="257" fillcolor="none" y="193" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="swhpBXfC0iED" text=": NKdd4j45iVaX" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="407" x="252" fillcolor="none" y="273" operation="O87gKQtsw1DR" linewidth="none" widgetbid="g2KjDIEXFsVO" height="32" usefillcolor="1" seqnum="" textid="grDhZQuFSExg" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="O87gKQtsw1DR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="168" x="257" fillcolor="none" y="251" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="grDhZQuFSExg" text=": alloc_sched(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="50" x="250" fillcolor="none" y="335" operation="QNnsMczV4BbV" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="32" usefillcolor="1" seqnum="" textid="XtFP4RQkGeRn" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="QNnsMczV4BbV" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="203" x="255" fillcolor="none" y="313" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="XtFP4RQkGeRn" text=": mme_glink_send(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="0erZURpXzgym" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_link_sqz_req_rx_not_valid" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="0" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="120" x="471" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="Ffpcevz092To" decon="0" localid="w4LrTD0CdDEH" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="185" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="236" x="19" fillcolor="none" y="123" operation="RfHVkGwVk5ST" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="89" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="RfHVkGwVk5ST" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="420" x="24" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": RfHVkGwVk5ST" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="292" x="247" fillcolor="none" y="155" operation="reovd9ZsoNSR" linewidth="none" widgetbid="w4LrTD0CdDEH" height="33" usefillcolor="1" seqnum="" textid="2V22C0q93ByU" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="reovd9ZsoNSR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="301" x="252" fillcolor="none" y="133" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="2V22C0q93ByU" text=": reovd9ZsoNSR" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="xd1PHMGXFtVt" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_alloc_move_req" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="0" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="104" x="504" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" decon="0" localid="g2KjDIEXFsVO" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="173" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="224" x="19" fillcolor="none" y="123" operation="VChtJRri78Bp" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="93" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="VChtJRri78Bp" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="422" x="24" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": process_cc_alloc_move_req(ctx : cp_t*, mme : cp_mme_rx_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="329" x="235" fillcolor="none" y="158" operation="6r5JBb3UvGb7" linewidth="none" widgetbid="g2KjDIEXFsVO" height="36" usefillcolor="1" seqnum="" textid="grDhZQuFSExg" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="6r5JBb3UvGb7" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="218" x="240" fillcolor="none" y="136" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="grDhZQuFSExg" text=": alloc(cid : u8, ctx : cp_t*) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="l4MAtt7XrtF1" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_ble_update_ind" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="39" x="0" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="r0ebcYhsDved" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="120" x="468" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="Ffpcevz092To" decon="0" localid="w4LrTD0CdDEH" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="104" x="633" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" decon="0" localid="g2KjDIEXFsVO" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="200" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="251" x="19" fillcolor="none" y="123" operation="seYRAqbe0Jvw" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="216" usefillcolor="1" seqnum="" textid="nLlyGNbJw07g" widgetaid="r0ebcYhsDved" isinstance="0" xmi.id="seYRAqbe0Jvw" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="418" x="24" fillcolor="none" y="101" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nLlyGNbJw07g" text=": process_cc_ble_update_ind(ctx : cp_t*, mme : cp_mme_rx_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="274" x="262" fillcolor="none" y="158" operation="NKdd4j45iVaX" linewidth="none" widgetbid="w4LrTD0CdDEH" height="32" usefillcolor="1" seqnum="" textid="swhpBXfC0iED" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="NKdd4j45iVaX" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="290" x="267" fillcolor="none" y="136" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="swhpBXfC0iED" text=": NKdd4j45iVaX" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="431" x="262" fillcolor="none" y="218" operation="O87gKQtsw1DR" linewidth="none" widgetbid="g2KjDIEXFsVO" height="32" usefillcolor="1" seqnum="" textid="grDhZQuFSExg" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="O87gKQtsw1DR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="168" x="267" fillcolor="none" y="196" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="grDhZQuFSExg" text=": alloc_sched(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="50" x="260" fillcolor="none" y="282" operation="QNnsMczV4BbV" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="32" usefillcolor="1" seqnum="" textid="XtFP4RQkGeRn" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="QNnsMczV4BbV" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="203" x="265" fillcolor="none" y="260" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="XtFP4RQkGeRn" text=": mme_glink_send(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="837" snapy="10" showatts="1" xmi.id="WTr0EIIjIoGN" documentation="" type="3" showops="1" showpackage="0" name="cco_action_cc_link_sqz_req_tx" localid="ay4ioc8tsonO" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="104" x="505" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" decon="0" localid="g2KjDIEXFsVO" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="226" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ySeTGJOMEmYM" decon="0" localid="5ZRolH9OYbCJ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="39" x="32" fillcolor="#ffffc0" y="17" instancename="" linewidth="none" height="63" usefillcolor="1" isinstance="0" xmi.id="pRzkrBbewp0R" decon="0" localid="ay4ioc8tsonO" multipleinstance="0" drawasactor="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="277" x="288" fillcolor="none" y="117" operation="O87gKQtsw1DR" linewidth="none" widgetbid="g2KjDIEXFsVO" height="32" usefillcolor="1" seqnum="" textid="grDhZQuFSExg" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="O87gKQtsw1DR" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="168" x="293" fillcolor="none" y="95" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="grDhZQuFSExg" text=": alloc_sched(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="50" x="286" fillcolor="none" y="213" operation="QNnsMczV4BbV" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="32" usefillcolor="1" seqnum="" textid="XtFP4RQkGeRn" widgetaid="5ZRolH9OYbCJ" isinstance="0" xmi.id="QNnsMczV4BbV" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="203" x="291" fillcolor="none" y="191" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="XtFP4RQkGeRn" text=": mme_glink_send(ctx : cp_t*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="267" x="289" fillcolor="none" y="181" operation="qu2Ac479Q7k0" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="8" usefillcolor="1" seqnum="" textid="6CZqYDJIqvG9" widgetaid="g2KjDIEXFsVO" isinstance="0" xmi.id="qu2Ac479Q7k0" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="420" x="294" fillcolor="none" y="159" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="6CZqYDJIqvG9" text=": qu2Ac479Q7k0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="245" x="51" fillcolor="none" y="101" operation="any operation asking for scheduling" linewidth="none" widgetbid="5ZRolH9OYbCJ" height="163" usefillcolor="1" seqnum="" textid="MdxFt60R459q" widgetaid="ay4ioc8tsonO" isinstance="0" xmi.id="sFO9cMFov5K9" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="249" x="56" fillcolor="none" y="79" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="MdxFt60R459q" text=": any operation asking for scheduling" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ </messages>
+ <associations/>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="F2c5R39MF9xW" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="TwHk9DnnMaYs" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="uDJo2XtcKSFQ" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="O1PWAArevDzF" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t**" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="JSU2EBtENyKy" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_prio_heap_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tOgMBBDlVoLx" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_heap_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fn3T0g7mCdo8" isRoot="false" isAbstract="false" name="list_node_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vez0woDacG3c" isRoot="false" isAbstract="false" name="set_node_t" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="3qIL60CD7SL5" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="NSgzMRVmxQaX" aggregation="composite" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="SxNOhmkKgU0K" aggregation="none" type="0AFakTbKOjhV" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="hQ7UEYOzATqF" isRoot="false" isAbstract="false" name="list_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="JO1FHqi41DrK" isRoot="false" isAbstract="false" name="cp_link_ble_interval_t*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="TZfikGiIVwKz" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bfUc1UOFU09C" isRoot="false" isAbstract="false" name="u16*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Bv4qUQAgGcnc" isRoot="false" isAbstract="false" name="cp_conn_type_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="F2oiQk9bfCP9" isRoot="false" isAbstract="false" name="cp_conn_info_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="6sEW3jvdsAQ0" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3QNGiQmMsrXJ" isRoot="false" isAbstract="false" name="cp_link_qmp_t" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="OlUNXhoPpodj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="aBcLnoJLZtqz" aggregation="aggregate" type="fLjwr6MNuZXD" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Xlw6y6vhwzy6" aggregation="none" type="d8mKKcTJhtMZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="ap8aOZNHajls" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="7FMFEEfoNF88" aggregation="aggregate" type="fLjwr6MNuZXD" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4RTbKKap5Uv1" aggregation="none" type="Q60RU8Qxt2jh" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="g8cNqwVSwwE6" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="aogUocbtpx83" aggregation="aggregate" type="d8mKKcTJhtMZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="9lqU0yd4P6dh" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="ZLxwL8UTBdI7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="QDUThQSGC6i0" aggregation="aggregate" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="iJrVFzZMiNrj" aggregation="none" type="fLjwr6MNuZXD" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yN55b1ltFiLX" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LSliYPNxarOG" aggregation="aggregate" type="Dd5IhQuqhODL" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="HpWUvCScUK7j" aggregation="none" type="K9Fc7ya6eboZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="N6VU8JNOwH9n" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="He301shMKQ2r" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="nPmOFAcWz6yt" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="pV8BBjAtfG0U" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="IPVmjcTyHXwG" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Pdbk4dbp1NBG" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="jiAAt6MpIubW" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="VnkTthKC6pyn" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="PSjexgvMJU6L" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="LcsLN0ze8QIE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="3aaR5dmS62Zr" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="mmKkWrMpTD8p" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="46" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1811" snapy="10" showatts="1" xmi.id="niq745CwWtmB" documentation="CCo action module" type="1" showops="1" showpackage="0" name="class_diagram_cco_conn_global" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1839" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="1309" showattsigs="601" x="498" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="432" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="433" showattsigs="601" x="0" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="171" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="ySeTGJOMEmYM" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="278" showattsigs="601" x="1129" fillcolor="#ffffc0" y="485" showopsigs="601" linewidth="none" height="225" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="akTdL0BuuMIi" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="173" showattsigs="601" x="82" fillcolor="#ffffc0" y="1063" showopsigs="601" linewidth="none" height="162" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Dd5IhQuqhODL" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="128" x="433" fillcolor="#ffffc0" y="585" linewidth="none" height="162" usefillcolor="1" isinstance="0" xmi.id="mtZJnRKOO7ZU" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="201" showattsigs="601" x="618" fillcolor="#ffffc0" y="464" showopsigs="601" linewidth="none" height="198" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="pEl1C68UjFRR" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="179" showattsigs="601" x="872" fillcolor="#ffffc0" y="558" showopsigs="601" linewidth="none" height="81" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="niNHo3iBMi93" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="173" showattsigs="601" x="637" fillcolor="#ffffc0" y="930" showopsigs="601" linewidth="none" height="477" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="d8mKKcTJhtMZ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="149" showattsigs="601" x="425" fillcolor="#ffffc0" y="956" showopsigs="601" linewidth="none" height="117" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Q60RU8Qxt2jh" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="386" showattsigs="601" x="0" fillcolor="#ffffc0" y="598" showopsigs="601" linewidth="none" height="378" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="adjwEdq884ob" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="142" showattsigs="601" x="79" fillcolor="#ffffc0" y="1303" showopsigs="601" linewidth="none" height="81" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="oE5CCxttNgAF" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="447" showattsigs="601" x="0" fillcolor="#ffffc0" y="199" showopsigs="601" linewidth="none" height="360" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Ffpcevz092To" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="307" x="1116" fillcolor="#ffffc0" y="791" linewidth="none" height="90" usefillcolor="1" isinstance="0" xmi.id="0AFakTbKOjhV" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="187" showattsigs="601" x="594" fillcolor="#ffffc0" y="702" showopsigs="601" linewidth="none" height="117" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="fLjwr6MNuZXD" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="162" x="325" fillcolor="#ffffc0" y="1279" linewidth="none" height="108" usefillcolor="1" isinstance="0" xmi.id="K9Fc7ya6eboZ" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="akTdL0BuuMIi" widgetaid="xnGQ9ti6LKXZ" xmi.id="2lGX5o190Fyn" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="934" starty="432" />
+ <endpoint endx="1268" endy="485" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="17" x="925" fillcolor="none" y="434" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="7f960KKU83x1" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="15" x="1261" fillcolor="none" y="460" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="kHBo48ZRYI6V" text="*" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="niNHo3iBMi93" widgetaid="pEl1C68UjFRR" xmi.id="iFQH9XCi3DbL" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="819" starty="596" />
+ <endpoint endx="872" endy="598" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="17" x="902" fillcolor="none" y="625" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="wzrETwXYZgdY" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="15" x="840" fillcolor="none" y="578" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="1x290x8iCKUE" text="*" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="3" indexb="1" linewidth="none" widgetbid="pEl1C68UjFRR" widgetaid="xnGQ9ti6LKXZ" xmi.id="w2GO5CvfhZ6h" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="1370" starty="432" />
+ <endpoint endx="819" endy="530" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="17" x="255" fillcolor="none" y="685" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Q3fyKjREgGS7" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="17" x="826" fillcolor="none" y="474" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="A0gkgHGfEGoD" text="4" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="ySeTGJOMEmYM" widgetaid="xnGQ9ti6LKXZ" xmi.id="5MhNVwbXrStj" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="498" starty="144" />
+ <endpoint endx="433" endy="85" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="Dd5IhQuqhODL" widgetaid="adjwEdq884ob" xmi.id="1ZrlQBx4omHB" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="193" starty="976" />
+ <endpoint endx="168" endy="1063" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="oE5CCxttNgAF" widgetaid="Dd5IhQuqhODL" xmi.id="VqiqgPP0C8zY" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="168" starty="1225" />
+ <endpoint endx="150" endy="1303" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="172" fillcolor="none" y="606" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="DvtNFObdPEbh" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="126" fillcolor="none" y="441" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="w0wcGOkRMO93" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="ySeTGJOMEmYM" widgetaid="Ffpcevz092To" xmi.id="REz0iVtn4vkj" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="223" starty="199" />
+ <endpoint endx="216" endy="171" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="3" indexb="2" linewidth="none" widgetbid="xnGQ9ti6LKXZ" widgetaid="Ffpcevz092To" xmi.id="iYWkSGRVz8hL" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="447" starty="319" />
+ <endpoint endx="498" endy="288" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="adjwEdq884ob" widgetaid="Ffpcevz092To" xmi.id="AnXqp1nebv8V" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="223" starty="559" />
+ <endpoint endx="193" endy="598" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="pEl1C68UjFRR" widgetaid="Ffpcevz092To" xmi.id="F2c5R39MF9xW" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="447" starty="439" />
+ <endpoint endx="618" endy="563" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="0AFakTbKOjhV" widgetaid="akTdL0BuuMIi" xmi.id="3qIL60CD7SL5" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="1268" starty="710" />
+ <endpoint endx="1269" endy="791" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="mtZJnRKOO7ZU" widgetaid="adjwEdq884ob" xmi.id="aYoq8ZSkOLCb" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="386" starty="692" />
+ <endpoint endx="433" endy="666" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="124" x="318" fillcolor="none" y="668" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="fPirfV2qQwBd" text="new_conn_state" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="d8mKKcTJhtMZ" widgetaid="fLjwr6MNuZXD" xmi.id="OlUNXhoPpodj" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="718" starty="819" />
+ <endpoint endx="723" endy="930" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="Q60RU8Qxt2jh" widgetaid="fLjwr6MNuZXD" xmi.id="ap8aOZNHajls" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="656" starty="819" />
+ <endpoint endx="499" endy="956" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="5" indexa="2" visibilityB="200" totalcountb="3" indexb="2" linewidth="none" widgetbid="mtZJnRKOO7ZU" widgetaid="adjwEdq884ob" xmi.id="q86HxGHLiEfh" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="386" starty="749" />
+ <endpoint endx="433" endy="693" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="117" x="325" fillcolor="none" y="695" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="KmGhypPupLX5" text="old_conn_state" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="2" visibilityB="200" totalcountb="3" indexb="1" linewidth="none" widgetbid="fLjwr6MNuZXD" widgetaid="adjwEdq884ob" xmi.id="gr9Y2XYluI6x" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="386" starty="787" />
+ <endpoint endx="594" endy="741" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="116" x="487" fillcolor="none" y="743" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="hFU4dd5I0n7d" text="violated_cspec" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="3" visibilityB="200" totalcountb="3" indexb="2" linewidth="none" widgetbid="fLjwr6MNuZXD" widgetaid="adjwEdq884ob" xmi.id="EKdjKZFyRMXT" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="386" starty="881" />
+ <endpoint endx="594" endy="780" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="121" x="482" fillcolor="none" y="752" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="GATg6eHOOX5N" text="modified_cspec" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="K9Fc7ya6eboZ" widgetaid="Dd5IhQuqhODL" xmi.id="yN55b1ltFiLX" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="255" starty="1144" />
+ <endpoint endx="406" endy="1279" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="pRzkrBbewp0R" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="wDaoEutt1heF" documentation="" uniqueid="mmKkWrMpTD8p" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="1" type="803" id="vQr3syDVnjwt" >
+ <listitem open="0" type="807" id="Vi7xSEHjGpDi" label="bw" />
+ <listitem open="0" type="807" id="wDaoEutt1heF" label="cco_action" />
+ <listitem open="0" type="807" id="niq745CwWtmB" label="class_diagram_cco_conn_global" />
+ <listitem open="0" type="807" id="4HFzWQZSTZhP" label="conn" />
+ </listitem>
+ <listitem open="1" type="803" id="K35NPMr9taR3" >
+ <listitem open="0" type="813" id="oE5CCxttNgAF" >
+ <listitem open="0" type="814" id="7MBbDW5Dfddz" />
+ <listitem open="0" type="814" id="rWKEXa4Lo7W0" />
+ <listitem open="0" type="814" id="yi3iuDTAFpl9" />
+ </listitem>
+ <listitem open="0" type="813" id="ySeTGJOMEmYM" >
+ <listitem open="0" type="815" id="QNnsMczV4BbV" />
+ <listitem open="0" type="815" id="4Jl61qfG7FdR" />
+ <listitem open="0" type="815" id="kWAzj2FfLSzz" />
+ <listitem open="0" type="815" id="7f6S84QwyS5a" />
+ <listitem open="0" type="815" id="VChtJRri78Bp" />
+ <listitem open="0" type="815" id="seYRAqbe0Jvw" />
+ <listitem open="0" type="815" id="DNsf89jKgseb" />
+ <listitem open="0" type="815" id="tR7lNfHrBJvJ" />
+ </listitem>
+ <listitem open="0" type="813" id="akTdL0BuuMIi" >
+ <listitem open="0" type="814" id="WHgpgU3HDWsW" />
+ <listitem open="0" type="814" id="2pv02ohjicc7" />
+ <listitem open="0" type="814" id="6CEonouBntNY" />
+ <listitem open="0" type="814" id="6lmba4wqHNOl" />
+ <listitem open="0" type="814" id="KtVJ3RkxxT7e" />
+ <listitem open="0" type="814" id="dkbxTW5FavZS" />
+ <listitem open="0" type="814" id="jUHoqZsuISuy" />
+ <listitem open="0" type="814" id="9UW3dNtE8T9Z" />
+ <listitem open="0" type="814" id="mVY4wQ05uW6V" />
+ <listitem open="0" type="814" id="rzhzQqWM5KrC" />
+ <listitem open="0" type="814" id="3oBvIFO8C57d" />
+ </listitem>
+ <listitem open="0" type="813" id="niNHo3iBMi93" >
+ <listitem open="0" type="814" id="kC9bWRewTRAy" />
+ <listitem open="0" type="814" id="me7r6SxasvES" />
+ <listitem open="0" type="814" id="iHTllYAzskuy" />
+ </listitem>
+ <listitem open="0" type="813" id="pEl1C68UjFRR" >
+ <listitem open="0" type="814" id="ooF6vpsKuOw1" />
+ <listitem open="0" type="814" id="BoTNcsVT3vk5" />
+ <listitem open="0" type="814" id="AhBRVaG2kt6W" />
+ <listitem open="0" type="814" id="vlplg1EMIh54" />
+ <listitem open="0" type="815" id="BuYs8zIb3uMF" />
+ <listitem open="0" type="815" id="ArL3GjV2Yl6R" />
+ <listitem open="0" type="815" id="YyjQMfR7LmP8" />
+ <listitem open="0" type="815" id="FG15yw3gMB8Z" />
+ <listitem open="0" type="815" id="uq9DVEHiSGoP" />
+ <listitem open="0" type="815" id="udW0X6nRwucP" />
+ </listitem>
+ <listitem open="0" type="813" id="xnGQ9ti6LKXZ" >
+ <listitem open="0" type="814" id="8SVuiaBMFxkG" />
+ <listitem open="0" type="814" id="IvjtyxL96U0O" />
+ <listitem open="0" type="814" id="bMccUjua3QRe" />
+ <listitem open="0" type="814" id="qqpCp7AgWp2f" />
+ <listitem open="0" type="814" id="yEOT2jRXwz6c" />
+ <listitem open="0" type="814" id="wHXJuWtlMix9" />
+ <listitem open="0" type="814" id="o5qKsqxq4MK4" />
+ <listitem open="0" type="815" id="kZlArwfzKyf6" />
+ <listitem open="0" type="815" id="O87gKQtsw1DR" />
+ <listitem open="0" type="815" id="6r5JBb3UvGb7" />
+ <listitem open="0" type="815" id="8VFn5SRIJtio" />
+ <listitem open="0" type="815" id="CX7QmGnNQfyu" />
+ <listitem open="0" type="815" id="N8I7BjZIOdlW" />
+ <listitem open="0" type="815" id="qDTUjKdqN9vB" />
+ <listitem open="0" type="815" id="VNZrMxhseKAs" />
+ <listitem open="0" type="815" id="REvc418qnVEv" />
+ <listitem open="0" type="815" id="WlMKMGxlUqNX" />
+ <listitem open="0" type="815" id="5NytACfVvOsX" />
+ <listitem open="0" type="815" id="2dqv1jTNexf5" />
+ <listitem open="0" type="815" id="2vygqejoln43" />
+ <listitem open="0" type="815" id="29Uw34J8wOf4" />
+ <listitem open="0" type="815" id="42UyQ92giMdG" />
+ <listitem open="0" type="815" id="Xml5upZdXAZW" />
+ </listitem>
+ <listitem open="0" type="813" id="Ffpcevz092To" >
+ <listitem open="0" type="814" id="bYj9JToa9uKf" />
+ <listitem open="0" type="815" id="9kRYzQhfAceh" />
+ <listitem open="0" type="815" id="wiccWDa1IGB0" />
+ <listitem open="0" type="815" id="ARdRgpRYumPW" />
+ <listitem open="0" type="815" id="X48RoXwe1hti" />
+ <listitem open="0" type="815" id="uAWvrOeD1yYc" />
+ <listitem open="0" type="815" id="u7uw5QW7e2LB" />
+ <listitem open="0" type="815" id="Cbkob5zYtRxc" />
+ <listitem open="0" type="815" id="OoAFD7r499dr" />
+ <listitem open="0" type="815" id="yuO7aB8gV7pA" />
+ <listitem open="0" type="815" id="3nxXunhqNtRt" />
+ <listitem open="0" type="815" id="MYQkPqdgh6Vs" />
+ <listitem open="0" type="815" id="TjI8pn05stMj" />
+ <listitem open="0" type="815" id="4KbuDwdv9pwT" />
+ <listitem open="0" type="815" id="J9VSwPumre2k" />
+ <listitem open="0" type="815" id="WCqMot49dnJ3" />
+ <listitem open="0" type="815" id="XqLBbcEPfIWF" />
+ <listitem open="0" type="815" id="7qNl6tymRO2W" />
+ <listitem open="0" type="815" id="M9nDiyyqHBL5" />
+ </listitem>
+ <listitem open="0" type="813" id="adjwEdq884ob" >
+ <listitem open="0" type="814" id="Iz4rTWTxS3n0" />
+ <listitem open="0" type="814" id="bdStR08xCgmF" />
+ <listitem open="0" type="814" id="PKGfk5LGn3bJ" />
+ <listitem open="0" type="814" id="q86HxGHLiEfh" />
+ <listitem open="0" type="814" id="WeNEbK4sTNyR" />
+ <listitem open="0" type="814" id="eptSFkclMxyx" />
+ <listitem open="0" type="814" id="aYoq8ZSkOLCb" />
+ <listitem open="0" type="814" id="cBHp8bzlZhfx" />
+ <listitem open="0" type="814" id="lsIYD0TogXRd" />
+ <listitem open="0" type="814" id="lNlK5PFoHXMS" />
+ <listitem open="0" type="814" id="gr9Y2XYluI6x" />
+ <listitem open="0" type="814" id="EKdjKZFyRMXT" />
+ <listitem open="0" type="814" id="t3ElLIjycSsT" />
+ <listitem open="0" type="815" id="WFqOmNayfDhz" />
+ <listitem open="0" type="815" id="OPd3dI1QBxcP" />
+ <listitem open="0" type="815" id="YdZhYB6wQZoX" />
+ <listitem open="0" type="815" id="RHNsrCNkh8Uf" />
+ <listitem open="0" type="815" id="n61SEV75ZqtV" />
+ <listitem open="0" type="815" id="d6nqhvGn9kPE" />
+ <listitem open="0" type="815" id="S6wdZOiCST19" />
+ </listitem>
+ <listitem open="0" type="813" id="Q60RU8Qxt2jh" >
+ <listitem open="0" type="814" id="BCj7uWVLsuTg" />
+ <listitem open="0" type="814" id="OMIbwSMKXMj1" />
+ <listitem open="0" type="814" id="Eu76mal8u3ho" />
+ <listitem open="0" type="814" id="U38zOryr0uB8" />
+ <listitem open="0" type="814" id="ZCRPvpA9hHET" />
+ </listitem>
+ <listitem open="0" type="813" id="d8mKKcTJhtMZ" >
+ <listitem open="0" type="814" id="gTg5YO0BUnWp" />
+ <listitem open="0" type="814" id="Px64qTbAFKMM" />
+ <listitem open="0" type="814" id="hmYsthba8Gdh" />
+ <listitem open="0" type="814" id="eds9OOwnK2pA" />
+ <listitem open="0" type="814" id="TRLilh2QRZHL" />
+ <listitem open="0" type="814" id="nR9txDa68QcP" />
+ <listitem open="0" type="814" id="Cw0z3lDbs9ub" />
+ <listitem open="0" type="814" id="8ZogWKRHjaAg" />
+ <listitem open="0" type="814" id="mlls9LFKFFJI" />
+ <listitem open="0" type="814" id="0UtqdlSmLEQp" />
+ <listitem open="0" type="814" id="Xp6GQEvAxe07" />
+ <listitem open="0" type="814" id="zFRFUiXUCPJp" />
+ <listitem open="0" type="814" id="AlZTxyIUnMlB" />
+ <listitem open="0" type="814" id="ZeJWIJbFY2U0" />
+ <listitem open="0" type="814" id="i0TuNmiXVFzS" />
+ <listitem open="0" type="814" id="DHxzcgABIUha" />
+ <listitem open="0" type="814" id="nHpKJIK2Gnub" />
+ <listitem open="0" type="814" id="Xa82q7T1NOyx" />
+ <listitem open="0" type="814" id="498MbnuM4hgM" />
+ <listitem open="0" type="814" id="xzMBkEmIptId" />
+ <listitem open="0" type="814" id="ylcJ9bGBiMVJ" />
+ <listitem open="0" type="814" id="8NdA5IU0HqCz" />
+ <listitem open="0" type="814" id="3wFspYTmH35P" />
+ <listitem open="0" type="814" id="eKaKe4bmRFvU" />
+ <listitem open="0" type="814" id="XPVmEflHbz7P" />
+ </listitem>
+ <listitem open="0" type="813" id="Dd5IhQuqhODL" >
+ <listitem open="0" type="814" id="RP4g6QESrIGR" />
+ <listitem open="0" type="814" id="R4lfEOk34S06" />
+ <listitem open="0" type="814" id="sQEhgV9JJ0Rv" />
+ <listitem open="0" type="814" id="y3j2Tj7pa9ls" />
+ <listitem open="0" type="814" id="naiC13Fgjvwp" />
+ <listitem open="0" type="814" id="2IFWtWCrXvs0" />
+ <listitem open="0" type="815" id="FMPxocle20Jj" />
+ <listitem open="0" type="815" id="Ndi6WcvlwJhi" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="803" id="8IfFoRAxojCs" >
+ <listitem open="0" type="810" id="xd1PHMGXFtVt" label="cco_action_cc_alloc_move_req" />
+ <listitem open="0" type="810" id="l4MAtt7XrtF1" label="cco_action_cc_ble_update_ind" />
+ <listitem open="0" type="810" id="jqjnWJ3RcZok" label="cco_action_cc_link_mod_req_not_valid" />
+ <listitem open="0" type="810" id="zbNIHnq6ICv9" label="cco_action_cc_link_mod_req_valid" />
+ <listitem open="0" type="810" id="yhmIJA8o3LB5" label="cco_action_cc_link_new_req_not_valid" />
+ <listitem open="0" type="810" id="fHTon9X3gX1E" label="cco_action_cc_link_new_req_valid" />
+ <listitem open="0" type="810" id="ok2jsyqCdw9J" label="cco_action_cc_link_rel_req" />
+ <listitem open="0" type="810" id="0erZURpXzgym" label="cco_action_cc_link_sqz_req_rx_not_valid" />
+ <listitem open="0" type="810" id="So6DeCWo8dXw" label="cco_action_cc_link_sqz_req_rx_valid" />
+ <listitem open="0" type="810" id="WTr0EIIjIoGN" label="cco_action_cc_link_sqz_req_tx" />
+ </listitem>
+ <listitem open="0" type="813" id="fLjwr6MNuZXD" >
+ <listitem open="0" type="814" id="hUapPz7FvDlL" />
+ <listitem open="0" type="814" id="zURtIMQaYz3T" />
+ <listitem open="0" type="814" id="eU5DT9ejQFbr" />
+ <listitem open="0" type="814" id="AhzYLwKyyJVB" />
+ <listitem open="0" type="814" id="7Na3g6CkUZ0C" />
+ </listitem>
+ <listitem open="1" type="813" id="TZfikGiIVwKz" />
+ <listitem open="1" type="813" id="O1PWAArevDzF" />
+ <listitem open="1" type="813" id="JSU2EBtENyKy" />
+ <listitem open="1" type="813" id="tOgMBBDlVoLx" />
+ <listitem open="1" type="813" id="F2oiQk9bfCP9" />
+ <listitem open="1" type="813" id="Bv4qUQAgGcnc" />
+ <listitem open="1" type="813" id="JO1FHqi41DrK" />
+ <listitem open="1" type="813" id="3QNGiQmMsrXJ" />
+ <listitem open="1" type="813" id="fn3T0g7mCdo8" />
+ <listitem open="1" type="813" id="hQ7UEYOzATqF" />
+ <listitem open="1" type="813" id="6sEW3jvdsAQ0" />
+ <listitem open="1" type="813" id="vez0woDacG3c" />
+ <listitem open="1" type="813" id="bfUc1UOFU09C" />
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="irUbdfzRtLuy" />
+ <listitem open="1" type="829" id="0widC5QuvWxy" />
+ <listitem open="1" type="829" id="l4plA4WjZ5hz" />
+ <listitem open="0" type="829" id="LMD9GuDpzhxX" />
+ <listitem open="0" type="829" id="M6xKR1cFPIwW" />
+ <listitem open="0" type="829" id="S1gNUo1cYqQt" />
+ <listitem open="0" type="829" id="eoUNxGuvIuwA" />
+ <listitem open="1" type="829" id="BlOcERrdVcJi" />
+ <listitem open="1" type="829" id="qpL5yhMnv5m5" />
+ <listitem open="1" type="829" id="CAMwXARcOr2q" />
+ <listitem open="1" type="829" id="ZCvyT3nV6461" />
+ <listitem open="1" type="829" id="TJR8rTv6HJGr" />
+ <listitem open="0" type="829" id="d21ZFkuCFK5X" />
+ <listitem open="1" type="829" id="y93NOeEZLD5e" />
+ <listitem open="1" type="829" id="0FkJo3kMVDSV" />
+ <listitem open="1" type="829" id="iSF0bbc1ufLz" />
+ <listitem open="1" type="829" id="rXf3L5yLNrBT" />
+ <listitem open="1" type="829" id="huvuRoPtpoED" />
+ <listitem open="1" type="829" id="3Xrk8GDGycgY" />
+ <listitem open="1" type="829" id="luyeQvc8m5hN" />
+ <listitem open="1" type="829" id="OMTNsx2stiV3" />
+ <listitem open="1" type="829" id="OqFNT55UVzVU" />
+ <listitem open="1" type="829" id="xmmoTFsE9otX" />
+ <listitem open="1" type="829" id="kfod0hZO32mt" />
+ <listitem open="1" type="829" id="pocpPVnex8xP" />
+ <listitem open="1" type="829" id="qx03D9bX8Zse" />
+ <listitem open="1" type="829" id="D9PiHaAGBCIb" />
+ <listitem open="1" type="829" id="28emhDJMNjju" />
+ <listitem open="1" type="829" id="9kqqNN6qIMaD" />
+ <listitem open="0" type="829" id="nKah2FElYQjf" />
+ <listitem open="1" type="829" id="jTfTYNoH0asy" />
+ <listitem open="1" type="829" id="C4WJsNrZpU0N" />
+ <listitem open="1" type="829" id="HSMJS6CQrwCI" />
+ </listitem>
+ <listitem open="1" type="831" id="0AFakTbKOjhV" >
+ <listitem open="0" type="839" id="0sn2w94wHHV1" />
+ <listitem open="0" type="839" id="HGkt98I7y37u" />
+ </listitem>
+ <listitem open="1" type="831" id="K9Fc7ya6eboZ" >
+ <listitem open="0" type="839" id="15F3QKNkRcLY" />
+ <listitem open="0" type="839" id="sSSMYaHXdXb3" />
+ <listitem open="0" type="839" id="k4qPW77MaXi6" />
+ </listitem>
+ <listitem open="0" type="831" id="mtZJnRKOO7ZU" >
+ <listitem open="0" type="839" id="OX2HniyXbXoO" />
+ <listitem open="0" type="839" id="neVJeoamoZ5F" />
+ <listitem open="0" type="839" id="cqyEfU3313Im" />
+ <listitem open="0" type="839" id="loGfKRYwIW8x" />
+ <listitem open="0" type="839" id="80zKS1hCpxp7" />
+ <listitem open="0" type="839" id="eDMziEWTrzlV" />
+ <listitem open="0" type="839" id="zRZGwOSgcWwz" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="pRzkrBbewp0R" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/cco/action/cco_conn/inc/cco_action.h b/cesar/cp/cco/action/cco_conn/inc/cco_action.h
new file mode 100644
index 0000000000..4e9e50473f
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/inc/cco_action.h
@@ -0,0 +1,33 @@
+#ifndef cp_cco_action_private_h
+#define cp_cco_action_private_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/cp_cco_action_private.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+/**
+ * - Functions reacting to incoming MME related to global connection.
+ * - Treatment of those MME - Storage and validation of the global connections
+ * - Control of the Bandwidth Manager's actions - React to the connections'
+ * states to send IND or CNF MME
+ */
+struct cp_cco_action_private_t
+{
+ /** Public data. */
+ cp_cco_action_t public_data;
+
+};
+typedef struct cp_cco_action_private_t cp_cco_action_private_t;
+
+
+#endif /* cp_cco_action_private_h */
diff --git a/cesar/cp/cco/action/cco_conn/src/action.c b/cesar/cp/cco/action/cco_conn/src/action.c
new file mode 100644
index 0000000000..93326ce549
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/src/action.c
@@ -0,0 +1,330 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cco_action.c
+ * \brief Control the MMEs in relation with the CCo 1
+ * \ingroup cp_cco_action
+ *
+ */
+#include "common/std.h"
+#include "lib/blk.h"
+
+#include "cp/inc/context.h"
+#include "cp/cp.h"
+
+#include "string.h"
+
+#include "lib/list.h"
+
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+#include "cp/conn/conn_mgr.h"
+
+#include "cp/cco/action/cco_conn/cco_action.h"
+
+#include "cp/cco/bw/bw_prio_heap.h"
+#include "cp/cco/bw/inc/bw_prio_heap.h"
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/bw.h"
+
+#include "cl/inc/cl_mactotei.h"
+
+#include "cp/sta/mgr/sta_own_data.h"
+#include "cp/sta/mgr/sta_mgr.h"
+
+void
+cp_cco_action_mme_glink_send (cp_t *ctx)
+{
+ cp_msg_cc_link_new_cnf_t new_cnf;
+ cp_msg_cc_link_rel_ind_t rel_ind;
+
+ cp_cco_bw_prio_conn_t *prior_conn;
+ cp_conn_t *conn;
+ u8 nb_heap = 0;
+
+ while(nb_heap < CP_CCO_BW_NB_PRIORITY_HEAPS)
+ {
+ prior_conn = cp_cco_bw_prio_heap_get_first_conn(ctx->bw.prio_heap[nb_heap]);
+
+ while (prior_conn)
+ {
+ conn = cp_conn_get_conn(ctx, prior_conn->cid);
+
+ if(conn->new_conn_state != CP_CONN_STATE_IN)
+ {
+ if(conn->new_conn_state == CP_CONN_STATE_ADD
+ || conn->new_conn_state == CP_CONN_STATE_OUT)
+ {
+ new_cnf.cid = conn->conn_info.cid;
+ new_cnf.glid_f = conn->flink->glid;
+ new_cnf.glid_r = conn->rlink->glid;
+ new_cnf.cspec = NULL;
+
+ if(conn->new_conn_state == CP_CONN_STATE_ADD)
+ {
+ /*Result success*/
+ new_cnf.result = 0x00;
+ conn->new_conn_state = CP_CONN_STATE_IN;
+ }
+ else if (conn->new_conn_state == CP_CONN_STATE_OUT)
+ {
+ /*Result : not enough bandwidth*/
+ new_cnf.result = 0x01;
+ //TODO init the proposed_cspec
+ //new_cnf.cspec = proposed_cspec;
+ }
+ cp_msg_cc_link_new_cnf_send(ctx, CP_MME_PEER(conn->osa, conn->conn_info.stei), &new_cnf);
+ cp_msg_cc_link_new_cnf_send(ctx, CP_MME_PEER(conn->oda, conn->conn_info.dtei), &new_cnf);
+ }
+ else
+ {
+ rel_ind.cid = conn->conn_info.cid;
+ rel_ind.mac = cp_sta_own_data_get_mac_address(ctx);
+ rel_ind.cspec_proposed = NULL;
+ rel_ind.cspec_violated = NULL;
+
+ if(conn->new_conn_state == CP_CONN_STATE_REL_BW)
+ {
+ /*Result : not enough bandwidth*/
+ rel_ind.reason_code = 0x02;
+ //TODO initiate proposed_cspec
+ //rel_ind.violated_cspec = violated_cspec;
+ }
+ else if(conn->new_conn_state == CP_CONN_STATE_REL_CSPEC)
+ {
+ /*Result : CSPEC problem*/
+ rel_ind.reason_code = 0x01;
+ //TODO initiate the cspec
+ //rel_ind.cspec_violated = cspec;
+ }
+ else if(conn->new_conn_state == CP_CONN_STATE_REL_NOR)
+ {
+ /*Result : Normal release*/
+ rel_ind.reason_code = 0x00;
+ }
+ cp_msg_cc_link_rel_ind_send(ctx, CP_MME_PEER(conn->osa, conn->conn_info.stei), &rel_ind);
+ cp_msg_cc_link_rel_ind_send(ctx, CP_MME_PEER(conn->oda, conn->conn_info.dtei), &rel_ind);
+ }
+ }
+ prior_conn = cp_cco_bw_prio_heap_get_next_conn(ctx->bw.prio_heap[nb_heap], prior_conn);
+
+ if(conn->new_conn_state != CP_CONN_STATE_IN)
+ cp_conn_del_conn(ctx, conn->conn_info.cid);
+ }
+ nb_heap++;
+ }
+}
+
+void
+cp_cco_action_process_cc_link_new_req (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_link_new_req_t received_data;
+ cp_msg_cc_link_new_cnf_t send_data;
+ cp_conn_t *conn;
+ u8 validity;
+
+ cp_msg_cc_link_new_req_receive(ctx, mme, &received_data);
+
+ /*TODO Check if the conn doesn't already exist TODO*/
+ //cp_conn_exist(ctx, cid);
+
+ /** Initiate the new connection */
+ conn = cp_conn_init_conn(ctx);
+
+ conn->osa = received_data.osa;
+ conn->oda = received_data.oda;
+
+ conn->conn_info.cspec.cspec_len_oct = received_data.cspec->cspec_len_oct;
+ conn->conn_info.stei = cl_mactotei_table_find_tei_from_mac(NULL, received_data.osa);
+ conn->conn_info.dtei = cl_mactotei_table_find_tei_from_mac(NULL, received_data.oda);
+
+ /*Forward link info*/
+ conn->flink->cinfo = received_data.cspec->f_cinfo;
+ conn->flink->qmp = received_data.cspec->f_qmp;
+ conn->flink->list_ble = received_data.ble_f;
+ conn->flink->llid = 0;
+ conn->flink->glid = 0;
+ conn->flink->status = CP_LINK_TYPE_LOCAL;
+
+ /*Reverse link info*/
+ conn->rlink->cinfo = received_data.cspec->r_cinfo;
+ conn->rlink->qmp = received_data.cspec->r_qmp;
+ conn->rlink->list_ble = received_data.ble_r;
+ conn->rlink->llid = 0;
+ conn->rlink->glid = 0;
+ conn->rlink->status = CP_LINK_TYPE_LOCAL;
+
+ validity = cp_conn_check_conn_validity(ctx, conn);
+
+ /*Connection Valid*/
+ if(!validity)
+ {
+ /** If the connection is valid we add it */
+ cp_conn_add_conn(ctx, conn);
+
+ /** We reinitiate the allocation*/
+ cp_cco_bw_alloc_sched(ctx);
+
+ /** We check the mme to send*/
+ cp_cco_action_mme_glink_send (ctx);
+ }
+ /*Connection not Valid*/
+ else
+ {
+ send_data.cid = conn->conn_info.cid;
+ send_data.glid_r = 0;
+ send_data.glid_f = 0;
+ send_data.result = validity;
+ send_data.cspec = NULL;
+
+ cp_msg_cc_link_new_cnf_send(ctx, mme->peer,&send_data);
+ }
+
+}
+
+void
+cp_cco_action_process_cc_link_new_cnf (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_link_new_cnf_t received_data;
+
+ cp_msg_cc_link_new_cnf_receive(ctx, mme, &received_data);
+
+}
+
+void
+cp_cco_action_process_cc_link_rel_req (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_link_rel_req_t received_data;
+ cp_msg_cc_link_rel_ind_t send_data;
+
+ cp_msg_cc_link_rel_req_receive(ctx, mme, &received_data);
+
+ /** Initiate the ind mme*/
+ send_data.cid = received_data.cid;
+ send_data.mac = cp_sta_get_mac_address(cp_net_get_sta(ctx,
+ cp_sta_mgr_get_our_avln(ctx),
+ received_data.cid));
+ send_data.reason_code= received_data.reason_code;
+ send_data.cspec_violated = received_data.cspec;
+ send_data.cspec_proposed = NULL;
+
+ /** Delete the connection*/
+ cp_conn_del_conn(ctx, received_data.cid);
+
+ /** Schedule */
+ cp_cco_bw_alloc_sched(ctx);
+
+ /**Check if MME has to be sent*/
+ cp_cco_action_mme_glink_send(ctx);
+
+ /** Send the cnf mme*/
+ cp_msg_cc_link_rel_ind_send(ctx, mme->peer, &send_data);
+}
+
+void
+cp_cco_action_process_cc_link_rel_ind (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_link_rel_ind_t received_data;
+ cp_msg_apcm_conn_rel_ind_t send_ind_data;
+
+ cp_msg_cc_link_rel_ind_receive(ctx, mme, &received_data);
+
+ /* Init the IND to the HLE */
+ send_ind_data.cid = received_data.cid;
+ send_ind_data.reason_code = received_data.reason_code;
+ send_ind_data.releasing_mac_add = mme->peer.mac;
+ send_ind_data.proposed_cspec = NULL;
+ send_ind_data.violated_cspec = received_data.cspec_violated;
+
+ /* Send MME IND to HLE*/
+ cp_msg_apcm_conn_rel_ind_send(ctx,
+ CP_MME_PEER(mme->peer.mac),
+ &send_ind_data);
+
+ /* Release conn */
+ cp_conn_del_conn(ctx, received_data.cid);
+}
+
+/*Maybe part of the conn module*/
+void
+cp_cco_action_process_cc_link_sqz_req_rx (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_link_sqz_req_t received_data;
+
+ cp_msg_cc_link_sqz_req_receive(ctx, mme, &received_data);
+}
+
+void
+cp_cco_action_process_cc_link_sqz_cnf_rx (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_link_sqz_cnf_t received_data;
+
+ cp_msg_cc_link_sqz_cnf_receive(ctx, mme, &received_data);
+}
+
+void
+cp_cco_action_process_cc_link_mod_req (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_link_mod_req_t received_data;
+
+ cp_msg_cc_link_mod_req_receive(ctx, mme, &received_data);
+
+ /** Get acutal allocation */
+// cp_cco_bw_alloc_get_first_txop(ctx, received_data.cid);
+
+ /** Try to allocate else where */
+// cp_cco_bw_alloc(ctx,);
+
+ /** New Allocation found */
+ /** No new allocation found*/
+}
+
+void
+cp_cco_action_process_cc_link_mod_cnf (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_link_mod_cnf_t received_data;
+
+ cp_msg_cc_link_mod_cnf_receive(ctx, mme, &received_data);
+}
+
+void
+cp_cco_action_process_cc_alloc_move_req (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_alloc_move_req_t received_data;
+
+ cp_msg_cc_alloc_move_req_receive(ctx, mme, &received_data);
+}
+
+void
+cp_cco_action_process_cc_alloc_move_cnf (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_alloc_move_cnf_t received_data;
+
+ cp_msg_cc_alloc_move_cnf_receive(ctx, mme, &received_data);
+}
+
+void
+cp_cco_action_process_cc_ble_update_ind (cp_t* ctx, cp_mme_rx_t* mme)
+{
+ cp_msg_cc_ble_update_ind_t received_data;
+
+ cp_msg_cc_ble_update_ind_receive(ctx, mme, &received_data);
+}
+
+void
+cp_cco_action_init (cp_t* ctx)
+{
+}
+
+void
+cp_cco_action_uninit (cp_t *ctx)
+{
+}
+
diff --git a/cesar/cp/cco/action/cco_conn/test/Makefile b/cesar/cp/cco/action/cco_conn/test/Makefile
new file mode 100644
index 0000000000..4674ed897c
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/test/Makefile
@@ -0,0 +1,12 @@
+BASE= ../../../../..
+
+ECOS=y
+INCLUDES=cp/conn/test/overide/
+
+TARGET_PROGRAMS = cco_action_conn_test
+
+cco_action_conn_test_SOURCES = cco_action_conn_test.c msg_stub.c fsm_stub.c
+cco_action_conn_test_MODULES = lib cp/cco/bw cp/cco/action/cco_conn cp/conn cp/sta/mgr mac/common cl
+
+include $(BASE)/common/make/top.mk
+
diff --git a/cesar/cp/cco/action/cco_conn/test/ecos.ecc.sh b/cesar/cp/cco/action/cco_conn/test/ecos.ecc.sh
new file mode 100644
index 0000000000..8253d98c9a
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/cco/action/cco_conn/test/overide/cp_fsm_defs.h b/cesar/cp/cco/action/cco_conn/test/overide/cp_fsm_defs.h
new file mode 100644
index 0000000000..c29fa69e19
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/test/overide/cp_fsm_defs.h
@@ -0,0 +1,38 @@
+#ifndef overide_cp_fsm_defs_h
+#define overide_cp_fsm_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp_fsm_defs.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_all_sta_leaved,
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* overide_cp_fsm_defs_h */
diff --git a/cesar/cp/cco/action/cco_conn/test/src/cco_action_conn_test.c b/cesar/cp/cco/action/cco_conn/test/src/cco_action_conn_test.c
new file mode 100644
index 0000000000..b38b32dd12
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/test/src/cco_action_conn_test.c
@@ -0,0 +1,144 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file bw.c
+ * \brief bandwidth manager module
+ * \ingroup cp_cco_bw
+ *
+ * Control the schedule of the becon period
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/bw.h"
+#include "cp/cco/action/cco_conn/cco_action.h"
+
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/conn_mgr.h"
+
+#include "cp/pwl/pwl.h"
+#include "mac/common/timings.h"
+
+#include "lib/blk.h"
+#include "lib/list.h"
+#include "lib/test.h"
+
+#include <stdio.h>
+
+cp_mme_peer_t link_new_cnf_peer;
+cp_msg_cc_link_new_cnf_t link_new_cnf_data;
+
+cp_mme_peer_t link_rel_ind_peer;
+cp_msg_cc_link_rel_ind_t link_rel_ind_data;
+
+void
+cp_msg_cc_link_new_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_new_cnf_t *data)
+{
+ link_new_cnf_peer = peer;
+ link_new_cnf_data = *data;
+}
+
+void
+cp_msg_cc_link_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_rel_ind_t *data)
+{
+ link_rel_ind_peer = peer;
+ link_rel_ind_data = *data;
+}
+
+void
+test_case_action_init(test_t test, cp_t *ctx)
+{
+ test_case_begin(test, "action init");
+
+ cp_conn_mgr_init(ctx);
+ cp_cco_bw_init(ctx);
+
+ test_begin(test, "action init")
+ {
+ }
+ test_end;
+}
+
+void
+test_case_send_glink_mme(test_t test)
+{
+ cp_t ctx;
+ u16 i;
+
+ test_case_action_init(test, &ctx);
+
+ cp_conn_t *conn[6];
+ cp_conn_t *conn_test;
+
+ test_case_begin(test, "glink mme");
+
+ for(i = 0; i<6 ;i++)
+ {
+ conn[i] = cp_conn_init_conn(&ctx);
+ conn[i]->conn_info.cid = (i+1)*100;
+ conn[i]->flink->cinfo->valid_cinfo = 0x01;
+ conn[i]->flink->qmp->av_nb_pb = 10;
+ conn[i]->flink->qmp->nb_txop = 1;
+ conn[i]->rlink->cinfo->valid_cinfo = 0x00;
+ conn[i]->flink->cinfo->user_priority = 0;
+ conn[i]->rlink->cinfo->user_priority = 0;
+ conn[i]->new_conn_state = CP_CONN_STATE_IN;
+ conn[i]->osa = i+1;
+ conn[i]->oda = i+101;
+ cp_conn_add_conn(&ctx, conn[i]);
+ }
+
+ conn[1]->new_conn_state = CP_CONN_STATE_ADD;
+ conn[2]->new_conn_state = CP_CONN_STATE_OUT;
+ conn[3]->new_conn_state = CP_CONN_STATE_REL_BW;
+ conn[4]->new_conn_state = CP_CONN_STATE_REL_NOR;
+ conn[5]->new_conn_state = CP_CONN_STATE_REL_CSPEC;
+
+ cp_cco_action_mme_glink_send(&ctx);
+ conn_test = cp_conn_get_next_conn(&ctx, conn[1]);
+
+ test_begin(test, "glink mme check ")
+ {
+ test_fail_if(conn[0]->new_conn_state != CP_CONN_STATE_IN,
+ "Wrong new state should be IN");
+ test_fail_if(conn[1]->new_conn_state != CP_CONN_STATE_IN,
+ "Wrong new state should be IN");
+ test_fail_if(conn[2] == conn_test,
+ "There shouldnt be more connections 2");
+ test_fail_if(conn[3] == conn_test,
+ "There shouldnt be more connections 3");
+ test_fail_if(conn[4] == conn_test,
+ "There shouldnt be more connections 4");
+ test_fail_if(conn[5] == conn_test,
+ "There shouldnt be more connections 5");
+ }
+ test_end;
+
+}
+
+int
+main (void){
+ test_t test;
+
+ test_init(test, 0, NULL);
+ test_case_send_glink_mme(test);
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+
+}
diff --git a/cesar/cp/cco/action/cco_conn/test/src/fsm_stub.c b/cesar/cp/cco/action/cco_conn/test/src/fsm_stub.c
new file mode 100644
index 0000000000..849f375270
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/test/src/fsm_stub.c
@@ -0,0 +1,29 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
diff --git a/cesar/cp/cco/action/cco_conn/test/src/msg_stub.c b/cesar/cp/cco/action/cco_conn/test/src/msg_stub.c
new file mode 100644
index 0000000000..bdd3aa078f
--- /dev/null
+++ b/cesar/cp/cco/action/cco_conn/test/src/msg_stub.c
@@ -0,0 +1,463 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file bw.c
+ * \brief bandwidth manager module
+ * \ingroup cp_cco_bw
+ *
+ * Control the schedule of the becon period
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/bw.h"
+#include "cp/cco/action/cco_conn/cco_action.h"
+
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/conn_mgr.h"
+
+#include "cp/pwl/pwl.h"
+#include "mac/common/timings.h"
+
+#include "lib/blk.h"
+#include "lib/list.h"
+#include "lib/test.h"
+
+#include <stdio.h>
+
+void
+cp_msg_cc_link_new_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_new_req_t *data)
+{
+}
+bool
+cp_msg_cc_link_new_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_new_req_t *data)
+{
+ return true;
+}
+
+
+bool
+cp_msg_cc_link_new_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_new_cnf_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cc_link_rel_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_rel_req_t *data)
+{
+}
+
+bool
+cp_msg_cc_link_rel_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_rel_req_t *data)
+{
+ return true;
+}
+
+
+bool
+cp_msg_cc_link_rel_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_rel_ind_t *data)
+{
+ return true;
+}
+bool
+cp_msg_cc_link_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_mod_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cc_link_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_mod_cnf_t *data)
+{
+}
+
+bool
+cp_msg_cc_link_mod_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_mod_cnf_t *data)
+{
+ return true;
+}
+
+
+void
+cp_msg_cc_link_info_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_info_req_t *data)
+{
+}
+
+bool
+cp_msg_cc_link_info_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_info_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cc_link_info_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_info_cnf_t *data)
+{
+}
+
+bool
+cp_msg_cc_link_info_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_info_cnf_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cc_link_info_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_info_ind_t *data)
+{
+}
+
+bool
+cp_msg_cc_link_info_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_info_ind_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cc_link_info_rsp_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_info_rsp_t *data)
+{
+}
+
+bool
+cp_msg_cc_link_info_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_info_rsp_t *data)
+{
+ return true;
+}
+
+
+void
+cp_msg_cc_link_sqz_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_sqz_req_t *data)
+{
+}
+
+bool
+cp_msg_cc_link_sqz_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_sqz_req_t *data)
+{
+ return true;
+}
+void
+cp_msg_cc_link_sqz_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_link_sqz_cnf_t *data)
+{
+}
+bool
+cp_msg_cc_link_sqz_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_link_sqz_cnf_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cc_ble_update_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_ble_update_ind_t *data)
+{
+}
+bool
+cp_msg_cc_ble_update_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_ble_update_ind_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cc_alloc_move_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_alloc_move_req_t *data)
+{
+}
+
+bool
+cp_msg_cc_alloc_move_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_alloc_move_req_t *data)
+{
+ return true;
+}
+void
+cp_msg_cc_alloc_move_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cc_alloc_move_cnf_t *data)
+{
+}
+bool
+cp_msg_cc_alloc_move_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cc_alloc_move_cnf_t *data)
+{
+ return true;
+}
+/*************************/
+/*** CONN NEW ***/
+/*************************/
+
+void
+cp_msg_cm_conn_new_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_new_req_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_new_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_new_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_new_cnf_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_new_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_cnf_t *data)
+{
+ return true;
+}
+
+/*************************/
+/*** CONN REL ***/
+/*************************/
+
+void
+cp_msg_cm_conn_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_rel_ind_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_rel_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_rel_ind_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_rel_rsp_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_rel_rsp_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_rel_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_rel_rsp_t *data)
+{
+ return true;
+}
+
+/*************************/
+/*** CONN MOD ***/
+/*************************/
+
+void
+cp_msg_cm_conn_mod_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_mod_req_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_mod_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_mod_cnf_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_mod_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_mod_cnf_t *data)
+{
+ return true;
+}
+
+/*************************/
+/*** CONN INFO ***/
+/*************************/
+void
+cp_msg_cm_conn_info_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_info_req_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_info_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_info_req_t *data)
+{
+ return true;
+}
+void
+cp_msg_cm_conn_info_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_info_cnf_t *data)
+{
+}
+bool
+cp_msg_cm_conn_info_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_info_cnf_t *data)
+{
+ return true;
+}
+/*************************/
+/*** APCM Family ***/
+/*************************/
+
+/*************************/
+/*** APCM CONN ADD ***/
+/*************************/
+
+bool
+cp_msg_apcm_conn_add_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_req_t *data)
+{
+ return true;
+}
+void
+cp_msg_apcm_conn_add_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_add_cnf_t *data)
+{
+}
+
+void
+cp_msg_apcm_conn_add_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_add_ind_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_add_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_rsp_t *data)
+{
+ return true;
+}
+/*************************/
+/*** APCM CONN REL ***/
+/*************************/
+
+bool
+cp_msg_apcm_conn_rel_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_rel_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_rel_ind_t *data)
+{
+}
+
+void
+cp_msg_apcm_conn_rel_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_rel_cnf_t *data)
+{
+}
+/*************************/
+/*** APCM CONN MOD ***/
+/*************************/
+bool
+cp_msg_apcm_conn_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_mod_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_mod_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_mod_ind_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_mod_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_mod_rsp_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_mod_cnf_t *data)
+{
+}
+
diff --git a/cesar/cp/cco/action/doc/Makefile b/cesar/cp/cco/action/doc/Makefile
new file mode 100644
index 0000000000..e5f5e93bbd
--- /dev/null
+++ b/cesar/cp/cco/action/doc/Makefile
@@ -0,0 +1,19 @@
+PAGES = tei snid assoc_procedure auth_procedure leave
+
+TOOLS_DIR = ../../../../common/tools
+DOTFLAGS = -Gbgcolor='\#f7f7f7' -Nstyle=filled -Nfillcolor=white
+CONVERTFLAGS = -border 1 -bordercolor '\#d7d7d7'
+
+
+png: $(PAGES:%=%.png)
+ps: $(PAGES:%=%.ps)
+
+%.png: %.ps
+ convert $(CONVERTFLAGS) $< $@
+ rm -f $<
+
+%.ps: %.sdl $(TOOLS_DIR)/sdl.ps $(TOOLS_DIR)/sdl2dot
+ $(TOOLS_DIR)/sdl2dot $< | dot $(DOTFLAGS) -Tps -l $(TOOLS_DIR)/sdl.ps -o $@
+
+clean:
+ rm -f $(PAGES:%=%.png)
diff --git a/cesar/cp/cco/action/doc/assoc_procedure.sdl b/cesar/cp/cco/action/doc/assoc_procedure.sdl
new file mode 100644
index 0000000000..898ef270ed
--- /dev/null
+++ b/cesar/cp/cco/action/doc/assoc_procedure.sdl
@@ -0,0 +1,15 @@
+(|CC_ASSOC.REQ|) -join-> |Get TEI|
+(|CC_ASSOC.REQ|) -renew-> |Get STA|
+
+|Get TEI| -> <Valid TEI>
+<Valid TEI> -yes-> |Add station|
+|Add station| -> |CC_ASSOC.CNF \n Succeed|
+|CC_ASSOC.CNF \n Succeed| -> |Send TEI MAP to STA|
+|Send TEI MAP to STA| -> |Send TEI MAP to STAs|
+
+<Valid TEI> -no-> |Add UnAssoc STA|
+|Add UnAssoc STA| -> |CC_ASSOC.CNF \nFailure|
+
+|Get STA| -> |Update TEI Lease|
+|Update TEI Lease| -> |Release STA|
+|Release STA| -> |CC_ASSOC.CNF \nSucceed|
diff --git a/cesar/cp/cco/action/doc/auth_procedure.sdl b/cesar/cp/cco/action/doc/auth_procedure.sdl
new file mode 100644
index 0000000000..bc14ccab05
--- /dev/null
+++ b/cesar/cp/cco/action/doc/auth_procedure.sdl
@@ -0,0 +1,4 @@
+|CM_GET_KEY.REQ| -> <station known>
+<station known> -yes-> |CM_GET_KEY.CNF|
+
+<station known> -no-> |CM_GET_KEY.CNF\nResult = request refused|
diff --git a/cesar/cp/cco/action/doc/cco_action.odt b/cesar/cp/cco/action/doc/cco_action.odt
new file mode 100644
index 0000000000..ed0a3590cb
--- /dev/null
+++ b/cesar/cp/cco/action/doc/cco_action.odt
Binary files differ
diff --git a/cesar/cp/cco/action/doc/cco_action.xmi b/cesar/cp/cco/action/doc/cco_action.xmi
new file mode 100644
index 0000000000..ad3bbf1ee9
--- /dev/null
+++ b/cesar/cp/cco/action/doc/cco_action.xmi
@@ -0,0 +1,347 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-05-21T15:43:17" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WHsGhr6cL3qV" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1lLAIoXrLdtJ" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BsXuVmQldfSS" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="l2nnsImcbvsP" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Shk6a1xmtUeN" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="G46rjYKTY5EP" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="O01xtrLMY3S6" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5NqwrUH5XNxE" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="tFhSKvrguqen" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="hz7D2ZH5u80l" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="aHp7fmMY11yJ" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oZHHg64PKBaq" isRoot="false" isAbstract="false" name="uint" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nnvOyvzkSE17" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="J5WdE6USg2qD" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="X7Q5Iud3fXPb" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QPMsbNxuTUYh" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Q4TYO2bRfXJq" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vofGM4owR1PQ" isRoot="false" isAbstract="false" name="cco_action_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="7IVPdQ5yFmJq" isRoot="false" isAbstract="false" name="tei_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pTgoiQ7YHojW" isRoot="false" isAbstract="false" name="cp_beacon_desc_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CQBdOKlCTu2N" isRoot="false" isAbstract="false" name="mme_rx_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="AdYl289wjpBd" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3JjrtT9nxOIX" isRoot="false" isAbstract="false" name="set_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Kx1VvXVji5mn" isRoot="false" isAbstract="false" name="set_node_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ClVcxKp0dXpU" isRoot="false" isAbstract="false" name="set_node_t *" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="PIGRVoQWdLhk" aggregation="aggregate" type="AdYl289wjpBd" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="DjXUjdEzH0Zj" aggregation="none" type="AdYl289wjpBd" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6A9PNiJm0ZBV" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Nbzzwej7LFb4" aggregation="none" type="AdYl289wjpBd" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="qn17nZqsjxH6" aggregation="aggregate" type="AdYl289wjpBd" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="faqdA16Vd5SX" aggregation="none" type="AdYl289wjpBd" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="hCf3PG5F27Kp" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="e8hN6zSlXIPf" aggregation="none" type="AdYl289wjpBd" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="IVBvZdSGn7HA" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="MLNOShB4qtRw" aggregation="none" type="AdYl289wjpBd" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="8xImlyaBNYwN" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="qtfLA41SYAL5" aggregation="aggregate" type="AdYl289wjpBd" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="nlJZrbjDw5ZM" aggregation="none" type="AdYl289wjpBd" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="fVlZqtZMrzdT" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="mkQabpUPhAlr" aggregation="aggregate" type="AdYl289wjpBd" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="CmHiuanhL7EC" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="2uIgsGr4ejEG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="gwNc1wwlfKME" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="9qeo0PdB9st3" aggregation="none" type="AdYl289wjpBd" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="0UqhrhEJ8WDS" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ShioovyUrM4s" aggregation="aggregate" type="AdYl289wjpBd" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="GydtIx8PomCm" aggregation="none" type="AdYl289wjpBd" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Vd6MhjybKlo7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="9pxGirHAYzwK" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="utmjFqZTmBL4" aggregation="none" type="AdYl289wjpBd" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="JD1yKqZUviuE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8TRuDdhKTeY9" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="VpH1oEJh75OK" aggregation="none" type="AdYl289wjpBd" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Dv7QUbCmB2YY" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="tylf76hFX9Ai" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="kr0BTYKxNcyA" aggregation="none" type="AdYl289wjpBd" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="L2ASUCoHdFZ0" isRoot="false" isAbstract="false" name="cp_cco_action_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The set containing the STA ordered by the TEI lease." isSpecification="false" visibility="private" xmi.id="wJK4orddFvYy" type="3JjrtT9nxOIX" name="tei_lease_expiration" />
+ <UML:Attribute comment="List of the TEI already in use." isSpecification="false" visibility="private" xmi.id="IVOTagMalq8Q" type="oZHHg64PKBaq" name="tei_flags [8]" />
+ <UML:Operation comment="initialisation of CCo action module." isSpecification="false" isLeaf="false" visibility="public" xmi.id="qHxkg2dtESUh" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Uninitialisation of CCo action module." isSpecification="false" isLeaf="false" visibility="public" xmi.id="2gQknmKqTzYm" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Change the SNID.
+It shall request the SNIDs in use from the station manager to choose one randomly in the available SNIDs." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Wf52IeS60CA2" isRoot="false" isAbstract="false" isQuery="false" name="snid_change" />
+ <UML:Operation comment="generate a new NEK value. NEK shall be used no more than 1 hour, so must be changed after 1 hour for that purpose, NEK expiration date is checked at every occurrence of the global garbage collector timer and if current NEK expiration date reached, a new NEK value shall be generated by calling this function
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="RhTqdgLYcIeT" isRoot="false" isAbstract="false" isQuery="false" name="gen_nek" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="security level" isSpecification="false" visibility="private" xmi.id="2OY7BT7QLV4m" value="" type="nnvOyvzkSE17" name="sl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="perform garbage actions of CCo's responsability.
+
+Call the tei_lease_check function.
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TgOyCXvyx6rl" isRoot="false" isAbstract="false" isQuery="false" name="garbage" />
+ <UML:Operation comment="manage association of a station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="SwOagcKvW3p0" isRoot="false" isAbstract="false" isQuery="false" name="manage_sta_assoc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="CM_ASSOC.REQ MME msg having being received" isSpecification="false" visibility="private" xmi.id="189hS5VszsSf" value="" type="CQBdOKlCTu2N" name="assoc_req" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="manage authentication of a station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="PU4v0VmG0hH6" isRoot="false" isAbstract="false" isQuery="false" name="manage_sta_auth" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="CM_GET_KEY.REQ MME msg having being decrypted" isSpecification="false" visibility="private" xmi.id="owYtQQqIsWkd" value="" type="CQBdOKlCTu2N" name="get_key_req" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="manage explicit leave request of a station. Remove the station from the station manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="wZIl1SxKS9HT" isRoot="false" isAbstract="false" isQuery="false" name="manage_sta_leave" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The MME leave req message." isSpecification="false" visibility="private" xmi.id="SQ8diR5NEycA" value="" type="CQBdOKlCTu2N" name="leave_req" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Search for an available TEI in the AVLN list.
+Get the AVLN from the station manager (our AVLN).
+Lookup in the station a hole of TEIs. It no hole is found and no more STAs are available it means that all the TEIs are used in the AVLN.
+\Warn The TEI = 0 is reserved and 255 too." isSpecification="false" isLeaf="false" visibility="private" xmi.id="zsD44qakozbG" isRoot="false" isAbstract="false" isQuery="false" name="tei_compute" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Wr6j2wz4Mytl" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Release a TEI." isSpecification="false" isLeaf="false" visibility="private" xmi.id="pzdLQr60HhdP" isRoot="false" isAbstract="false" isQuery="false" name="tei_release" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The TEI value to release." isSpecification="false" visibility="private" xmi.id="6mggkLl0L6nY" value="" type="nnvOyvzkSE17" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return true if the left node is lesser than the right node. This function shall compare the expuiration lease of the stations." isSpecification="false" isLeaf="false" visibility="private" xmi.id="uUHWZwfWD0Yz" isRoot="false" isAbstract="false" isQuery="false" name="tei_lease_less" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pBa3681kSBrD" type="BsXuVmQldfSS" />
+ <UML:Parameter comment="The left node." isSpecification="false" visibility="private" xmi.id="ft1vqSvak3XH" value="" type="ClVcxKp0dXpU" name="left" />
+ <UML:Parameter comment="The right node." isSpecification="false" visibility="private" xmi.id="SxpSSK1tnd7i" value="" type="ClVcxKp0dXpU" name="right" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Association request data." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="7z9AcGCqg0oV" isRoot="false" isAbstract="false" name="cc_assoc_req_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Request type." isSpecification="false" visibility="public" xmi.id="w9oABNcQk8tU" type="LYg9EevkY5Yi" name="request_type" />
+ <UML:Attribute comment="The NID of the AVLN." isSpecification="false" visibility="public" xmi.id="q1U9qSCXi0ay" type="QPMsbNxuTUYh" name="nid" />
+ <UML:Attribute comment="The Station CCo Capability." isSpecification="false" visibility="public" xmi.id="rwYL7p0EYPAf" type="nnvOyvzkSE17" name="cco_cap" />
+ <UML:Attribute comment="The Station proxy capability." isSpecification="false" visibility="public" xmi.id="DdCYvWsjWLqK" type="nnvOyvzkSE17" name="Proxy_cap" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="LYg9EevkY5Yi" isRoot="false" isAbstract="false" name="cc_assoc_req_request_type_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="LYg9EevkY5Yi" xmi.id="ke44NNWgvApA" isRoot="false" isAbstract="false" name="CC_ASSOC_REQ_NEW" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="LYg9EevkY5Yi" xmi.id="iDwUjrOSWSWr" isRoot="false" isAbstract="false" name="CC_ASSOC_REQ_RENEW" />
+ </UML:Enumeration>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="h7zBSqWEqMgp" isRoot="false" isAbstract="false" name="cc_assoc_cnf_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The result of the previous request." isSpecification="false" visibility="public" xmi.id="k6g55qVry99W" type="iTyn7lva5s2U" name="result" />
+ <UML:Attribute comment="AVLN's NID." isSpecification="false" visibility="public" xmi.id="w8HLJYczfZA6" type="QPMsbNxuTUYh" name="nid" />
+ <UML:Attribute comment="SNID's AVLN." isSpecification="false" visibility="public" xmi.id="PeKEyy1j4fo8" type="J5WdE6USg2qD" name="snid" />
+ <UML:Attribute comment="The station TEI." isSpecification="false" visibility="public" xmi.id="TKzSR9yNFDhZ" type="nnvOyvzkSE17" name="sta_tei" />
+ <UML:Attribute comment="The lease time for the TEI." isSpecification="false" visibility="public" xmi.id="jHWMqeSGHkSF" type="J5WdE6USg2qD" name="lease_time" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="iTyn7lva5s2U" isRoot="false" isAbstract="false" name="cc_assoc_cnf_result_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="iTyn7lva5s2U" xmi.id="ufuBQKP6mNrt" isRoot="false" isAbstract="false" name="SUCCESS" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="iTyn7lva5s2U" xmi.id="3ZQrpdViHOrh" isRoot="false" isAbstract="false" name="FAILURE_TEMPORARY_RESSOURCE_EXHAUSTION" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="iTyn7lva5s2U" xmi.id="DYZb2M95wYuj" isRoot="false" isAbstract="false" name="FAILURE_PERMANENT_RESSOURCE_EXHAUSTION" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="iTyn7lva5s2U" xmi.id="HsihwnbZgPL4" isRoot="false" isAbstract="false" name="FAILURE_OTHER_REASON" />
+ </UML:Enumeration>
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="973" snapy="10" showatts="1" xmi.id="bZ62yFKbgidF" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="844" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="395" showattsigs="601" x="73" fillcolor="#ffffc0" y="56" showopsigs="601" linewidth="none" height="224" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="L2ASUCoHdFZ0" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="303" showattsigs="601" x="37" fillcolor="#ffffc0" y="586" showopsigs="601" linewidth="none" height="88" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="7z9AcGCqg0oV" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="203" x="86" fillcolor="#ffffc0" y="464" linewidth="none" height="64" usefillcolor="1" isinstance="0" xmi.id="LYg9EevkY5Yi" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="209" showattsigs="601" x="417" fillcolor="#ffffc0" y="594" showopsigs="601" linewidth="none" height="104" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="h7zBSqWEqMgp" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="303" x="369" fillcolor="#ffffc0" y="448" linewidth="none" height="96" usefillcolor="1" isinstance="0" xmi.id="iTyn7lva5s2U" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,1,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="LYg9EevkY5Yi" widgetaid="7z9AcGCqg0oV" xmi.id="w9oABNcQk8tU" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="188" starty="586" />
+ <endpoint endx="187" endy="528" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="100" x="189" fillcolor="none" y="530" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="lTFpXPAlnj95" text="request_type" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="iTyn7lva5s2U" widgetaid="h7zBSqWEqMgp" xmi.id="k6g55qVry99W" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="521" starty="594" />
+ <endpoint endx="520" endy="544" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="54" x="522" fillcolor="none" y="546" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="8lQ5tHhbMgmg" text="result" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="g2RmQlkG6CqM" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="bZ62yFKbgidF" documentation="actions of CCo responsability.
+
+CCo action module implements actions of CCo responsability
+
+manage SNID &quot;collisions&quot; (if SNID conflict, a new SNID value shall be chosen)
+
+manage TEI leases (create, suppress, expire)
+
+manage sta association
+
+manage authentication with relevant keys (NEK, NMK) and security-level
+
+Initialisation of SNID &amp; management of SNID conflicts" uniqueid="A09EO9VnalKh" />
+ <listview>
+ <listitem open="1" type="800" label="Vues" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="807" id="bZ62yFKbgidF" label="diagramme de classes" />
+ <listitem open="1" type="813" id="h7zBSqWEqMgp" >
+ <listitem open="0" type="814" id="k6g55qVry99W" />
+ <listitem open="0" type="814" id="w8HLJYczfZA6" />
+ <listitem open="0" type="814" id="PeKEyy1j4fo8" />
+ <listitem open="0" type="814" id="TKzSR9yNFDhZ" />
+ <listitem open="0" type="814" id="jHWMqeSGHkSF" />
+ </listitem>
+ <listitem open="1" type="813" id="7z9AcGCqg0oV" >
+ <listitem open="0" type="814" id="w9oABNcQk8tU" />
+ <listitem open="0" type="814" id="q1U9qSCXi0ay" />
+ <listitem open="0" type="814" id="rwYL7p0EYPAf" />
+ <listitem open="0" type="814" id="DdCYvWsjWLqK" />
+ </listitem>
+ <listitem open="1" type="813" id="L2ASUCoHdFZ0" >
+ <listitem open="0" type="814" id="wJK4orddFvYy" />
+ <listitem open="0" type="814" id="IVOTagMalq8Q" />
+ <listitem open="0" type="815" id="qHxkg2dtESUh" />
+ <listitem open="0" type="815" id="2gQknmKqTzYm" />
+ <listitem open="0" type="815" id="Wf52IeS60CA2" />
+ <listitem open="0" type="815" id="RhTqdgLYcIeT" />
+ <listitem open="0" type="815" id="TgOyCXvyx6rl" />
+ <listitem open="0" type="815" id="SwOagcKvW3p0" />
+ <listitem open="0" type="815" id="PU4v0VmG0hH6" />
+ <listitem open="0" type="815" id="wZIl1SxKS9HT" />
+ <listitem open="0" type="815" id="zsD44qakozbG" />
+ <listitem open="0" type="815" id="pzdLQr60HhdP" />
+ <listitem open="0" type="815" id="uUHWZwfWD0Yz" />
+ </listitem>
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="BsXuVmQldfSS" />
+ <listitem open="1" type="829" id="vofGM4owR1PQ" />
+ <listitem open="1" type="829" id="1lLAIoXrLdtJ" />
+ <listitem open="1" type="829" id="pTgoiQ7YHojW" />
+ <listitem open="1" type="829" id="Shk6a1xmtUeN" />
+ <listitem open="1" type="829" id="l2nnsImcbvsP" />
+ <listitem open="1" type="829" id="WHsGhr6cL3qV" />
+ <listitem open="1" type="829" id="O01xtrLMY3S6" />
+ <listitem open="1" type="829" id="Q4TYO2bRfXJq" />
+ <listitem open="1" type="829" id="CQBdOKlCTu2N" />
+ <listitem open="1" type="829" id="Kx1VvXVji5mn" />
+ <listitem open="1" type="829" id="ClVcxKp0dXpU" />
+ <listitem open="1" type="829" id="3JjrtT9nxOIX" />
+ <listitem open="1" type="829" id="G46rjYKTY5EP" />
+ <listitem open="1" type="829" id="aHp7fmMY11yJ" />
+ <listitem open="1" type="829" id="7IVPdQ5yFmJq" />
+ <listitem open="1" type="829" id="J5WdE6USg2qD" />
+ <listitem open="1" type="829" id="X7Q5Iud3fXPb" />
+ <listitem open="1" type="829" id="QPMsbNxuTUYh" />
+ <listitem open="1" type="829" id="nnvOyvzkSE17" />
+ <listitem open="1" type="829" id="oZHHg64PKBaq" />
+ <listitem open="0" type="829" id="AdYl289wjpBd" />
+ <listitem open="1" type="829" id="5NqwrUH5XNxE" />
+ <listitem open="1" type="829" id="hz7D2ZH5u80l" />
+ <listitem open="1" type="829" id="tFhSKvrguqen" />
+ </listitem>
+ <listitem open="1" type="831" id="iTyn7lva5s2U" >
+ <listitem open="0" type="839" id="ufuBQKP6mNrt" />
+ <listitem open="0" type="839" id="3ZQrpdViHOrh" />
+ <listitem open="0" type="839" id="DYZb2M95wYuj" />
+ <listitem open="0" type="839" id="HsihwnbZgPL4" />
+ </listitem>
+ <listitem open="1" type="831" id="LYg9EevkY5Yi" >
+ <listitem open="0" type="839" id="ke44NNWgvApA" />
+ <listitem open="0" type="839" id="iDwUjrOSWSWr" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="g2RmQlkG6CqM" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/cco/action/doc/leave.sdl b/cesar/cp/cco/action/doc/leave.sdl
new file mode 100644
index 0000000000..75a83c35c5
--- /dev/null
+++ b/cesar/cp/cco/action/doc/leave.sdl
@@ -0,0 +1,5 @@
+|CC_LEAVE.REQ| -> <known station>
+
+<known station> -no-> |End|
+<known station> -yes-> |Remove sta\nfrom sta mgr|
+|Remove sta\nfrom sta mgr| -> |CC_LEAVE.IND|
diff --git a/cesar/cp/cco/action/doc/snid.sdl b/cesar/cp/cco/action/doc/snid.sdl
new file mode 100644
index 0000000000..c8b1edce9a
--- /dev/null
+++ b/cesar/cp/cco/action/doc/snid.sdl
@@ -0,0 +1,3 @@
+(|SNID|) -> |get snid flags \nfrom sta mgr|
+|get snid flags \nfrom sta mgr| -> |Init random|
+|Init random| -> |return SNID|
diff --git a/cesar/cp/cco/action/doc/tei.sdl b/cesar/cp/cco/action/doc/tei.sdl
new file mode 100644
index 0000000000..c372d320b0
--- /dev/null
+++ b/cesar/cp/cco/action/doc/tei.sdl
@@ -0,0 +1,14 @@
+(|TEI Managing|) -> |init counter of word|
+
+|init counter of word| -> |Get first TEI flag word|
+|Get first TEI flag word| -> <TEI Available>
+
+<TEI Available> -yes-> |Set bit in flag TEI word|
+|Set bit in flag TEI word| -> |Return TEI|
+
+<TEI Available> -no-> <counter == max TEI flags Table>
+
+<counter == max TEI flags Table> -yes-> |Return 0|
+<counter == max TEI flags Table> -no-> |get next TEI flag word|
+|get next TEI flag word| -> <TEI Available>
+
diff --git a/cesar/cp/cco/action/inc/cco_action.h b/cesar/cp/cco/action/inc/cco_action.h
new file mode 100644
index 0000000000..d30fa6e7ea
--- /dev/null
+++ b/cesar/cp/cco/action/inc/cco_action.h
@@ -0,0 +1,77 @@
+#ifndef cp_cco_inc_cco_action_h
+#define cp_cco_inc_cco_action_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cco/inc/cco_action.h
+ * \brief CCo private functions.
+ * \ingroup cp_cco
+ *
+ */
+#include "lib/set.h"
+#include "lib/rnd.h"
+
+#include "cp/cco/action/cco_action.h"
+
+#define CP_CCO_ACTION_TEI_FLAGS_ROW 8
+#define CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS 32 /* 32 bits. */
+
+/* Default time lease for associated STA (in minutes.) . */
+#define CP_CCO_ACTION_LEASE_UNASSOC_MIN 0x7 /* 7 minutes. */
+#define CP_CCO_ACTION_LEASE_ASSOC_MIN 0xF /* 15 minutes. */
+#define CP_CCO_ACTION_LEASE_AUTH_MIN 0xB40 /* 48 hours. */
+
+/* Conversion of minutes to eCos ticks. */
+#define MIN_TO_RTC(val) (val * 100)
+
+struct cp_cco_action_t
+{
+ /** TEI in use. */
+ uint tei_flags [CP_CCO_ACTION_TEI_FLAGS_ROW];
+
+ /** Nek. */
+ cp_key_t nek;
+
+ /** Random generator. */
+ lib_rnd_t rnd;
+};
+
+/**
+ * Search for an available TEI in the AVLN list.
+ * \param ctx the module context.
+ * \return return the TEI found.
+ *
+ * Get the AVLN from the station manager (our AVLN). Lookup in the station
+ * a hole of TEIs. It no hole is found and no more STAs are available
+ * it means that all the TEIs are used in the AVLN. \Warn The TEI = 0
+ * is reserved and 255 too
+ */
+u8
+cp_cco_action_tei_compute (cp_cco_action_t *ctx);
+
+/**
+ * Release a TEI.
+ * \param ctx the module context.
+ * \param tei The TEI value to release.
+ *
+ */
+void
+cp_cco_action_tei_release (cp_cco_action_t *ctx, u8 tei);
+
+/**
+ * Return true if the left node is lesser than the right node.
+ * \param left The left node.
+ * \param right The right node.
+ * \return true if left is lesser than right.
+ *
+ * This function shall compare the expiration lease of the stations
+ */
+bool
+cp_cco_action_tei_lease_less (set_node_t * left, set_node_t * right);
+
+#endif /* cp_cco_inc_cco_action_h */
diff --git a/cesar/cp/cco/action/src/cco_action.c b/cesar/cp/cco/action/src/cco_action.c
new file mode 100644
index 0000000000..398fcd91ba
--- /dev/null
+++ b/cesar/cp/cco/action/src/cco_action.c
@@ -0,0 +1,560 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cco/action/src/cco_action.c
+ * \brief CCo Action functions.
+ * \ingroup cp_cco
+ *
+ */
+#include <string.h>
+#include "common/std.h"
+#include "common/defs/homeplugAV.h"
+
+#include "lib/set.h"
+#include "lib/utils.h"
+#include "lib/rnd.h"
+
+#include "common/defs/ethernet.h"
+
+#include "cl/cl_mactotei.h"
+
+#include "mac/common/ntb.h"
+#include "mac/common/timings.h"
+
+#include "cp/defs.h"
+#include "cp/cp.h"
+#include "cp/fsm/fsm.h"
+#include "cp/msg/msg.h"
+
+#include "cp/cco/action/cco_action.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/net.h"
+#include "cp/sta/mgr/sta.h"
+
+#include "cp/beacon/beacon.h"
+
+#include "cp/inc/context.h"
+#include "cp/cco/action/inc/cco_action.h"
+
+/**
+ * Search for an available TEI in the AVLN list.
+ * \param ctx the module context.
+ * \return return the TEI found.
+ *
+ * Get the AVLN from the station manager (our AVLN). Lookup in the station
+ * a hole of TEIs. It no hole is found and no more STAs are available
+ * it means that all the TEIs are used in the AVLN. \Warn The TEI = 0
+ * is reserved and 255 too
+ */
+u8
+cp_cco_action_tei_compute (cp_cco_action_t *ctx)
+{
+ uint flag;
+ uint flag_rot;
+ uint index;
+ uint i;
+ uint tei;
+ dbg_assert (ctx);
+
+ for (index = 0; index < CP_CCO_ACTION_TEI_FLAGS_ROW; index ++)
+ {
+ flag = ~ctx->tei_flags[index];
+ flag_rot = flag;
+ for (i = (index == 0 ? 1 : 0) ;
+ i < sizeof(uint) * 8
+ && ((index == CP_CCO_ACTION_TEI_FLAGS_ROW - 1) ?
+ (flag_rot == 0x80000000 ? 0 : 1) : flag_rot);
+ i++)
+ {
+ flag_rot = flag >> i;
+ tei = flag_rot & BITS_ONES(i);
+ if (tei == true)
+ {
+ // Store the bit in the correct position.
+ flag_rot = (1 << i);
+ ctx->tei_flags[index] |= flag_rot;
+
+ // Compute the TEI value.
+ tei = i + (index * sizeof(uint) * 8) + 1;
+ return tei;
+ }
+ }
+ }
+
+ // No TEI are available.
+ return 0;
+}
+
+/**
+ * Release a TEI.
+ * \param ctx the module context.
+ * \param tei The TEI value to release.
+ */
+void
+cp_cco_action_tei_release (cp_cco_action_t *ctx, u8 tei)
+{
+ uint row;
+
+ dbg_assert (ctx);
+ dbg_assert (tei);
+
+ row = tei / CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS;
+
+ ctx->tei_flags[row] &= ~(1 << ((tei - 1)
+ % CP_CCO_ACTION_TEI_FLAGS_ROW_SIZE_BITS));
+}
+
+
+/**
+ * initialisation of CCo action module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cco_action_init (cp_t *ctx)
+{
+ uint i;
+ dbg_assert (ctx);
+
+ for (i = 0; i < CP_CCO_ACTION_TEI_FLAGS_ROW; i++)
+ ctx->cco_action.tei_flags[i] = 0;
+
+ lib_rnd_init (&ctx->cco_action.rnd, mac_ntb());
+}
+
+/**
+ * Uninitialisation of CCo action module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cco_action_uninit (cp_t *ctx)
+{
+}
+
+/**
+ * Change the SNID.
+ * \param ctx the module context.
+ *
+ * It shall request the SNIDs in use from the station manager to choose
+ * one randomly in the available SNIDs
+ */
+void
+cp_cco_action_snid_change (cp_t *ctx)
+{
+ u16 flags;
+ u16 table [16];
+ uint nb_elem;
+ uint i;
+ dbg_assert (ctx);
+
+ // Get the present flags.
+ flags = ~cp_sta_mgr_get_present_snids (ctx);
+
+ // fill the table.
+ for (i = 0, nb_elem = 0; i < 16; i++)
+ {
+ if ((flags >> i) & true)
+ {
+ table[nb_elem] = i;
+ nb_elem ++;
+ }
+ }
+
+
+ // Chose the new SNID.
+ i = lib_rnd32 (&ctx->cco_action.rnd) % nb_elem;
+
+ // Provide the SNID to the beacon module.
+ cp_beacon_change_snid (ctx, table[i]);
+}
+
+/**
+ * perform garbage actions of CCo's responsibility.
+ * \param ctx the module context.
+ */
+void
+cp_cco_action_garbage (cp_t *ctx)
+{
+ cp_sta_t *sta;
+ cp_sta_t *sta_next;
+ cp_net_t *net;
+ dbg_assert (ctx);
+
+ net = cp_sta_mgr_get_our_avln (ctx);
+
+ sta = cp_net_get_first (ctx, net, CP_STA_STATE_ASSOCIATED);
+ while (sta)
+ {
+ slab_addref (sta);
+ sta_next = cp_net_get_next (ctx, net, sta);
+ if (less_mod2p32(sta->tei_lease_ms, /*cp_sta_core_date_ms (ctx)*/ 0))
+ {
+ // Remove the node from the tei lease.
+ cp_cco_action_manage_sta_leave (ctx, NULL, sta);
+ }
+ slab_release (sta);
+ sta = sta_next;
+ }
+
+ sta = cp_net_get_first (ctx, net, CP_STA_STATE_EXISTS);
+ while (sta)
+ {
+ slab_addref (sta);
+ sta_next = cp_net_get_next (ctx, net, sta);
+ if (less_mod2p32(sta->tei_lease_ms, /*cp_sta_core_date_ms (ctx)*/ 0))
+ {
+ // Remove the node from the tei lease.
+ cp_net_sta_remove (ctx, net, sta);
+ }
+
+ slab_release (sta);
+ sta = sta_next;
+ }
+}
+
+/**
+ * generate a new NEK value.
+ * \param ctx the module context.
+ *
+ * NEK shall be used no more than 1 hour, so must be changed after 1
+ * hour for that purpose, NEK expiration date is checked at every occurrence
+ * of the global garbage collector timer and if current NEK expiration
+ * date reached, a new NEK value shall be generated by calling this function
+ */
+void
+cp_cco_action_gen_nek (cp_t *ctx)
+{
+ u8 key[16];
+ uint random_num;
+ uint i;
+
+ dbg_assert (ctx);
+
+ // Get the key.
+ random_num = lib_rnd32 (&ctx->rnd);
+ cp_secu_aes_generate_key (random_num, key);
+
+ // Set the key.
+ if (ctx->mac_config->nek[0].nek[0] == 0)
+ {
+ for (i = 0; i < 4; i++)
+ ctx->mac_config->nek[0].nek[i] = ((u32*) key)[i];
+
+ // Get the key.
+ random_num = lib_rnd32 (&ctx->rnd);
+ cp_secu_aes_generate_key (random_num, key);
+
+ for (i = 0; i < 4; i++)
+ ctx->mac_config->nek[1].nek[i] = ((u32*) key)[i];
+ }
+ else
+ {
+ ctx->mac_config->nek[0] = ctx->mac_config->nek[1];
+ for (i = 0; i < 4; i++)
+ ctx->mac_config->nek[1].nek[i] = ((u32*) key)[i];
+ }
+}
+
+/**
+ * manage association of a station.
+ * \param ctx the module context.
+ * \param assoc_req CM_ASSOC.REQ MME msg having being received
+ */
+void
+cp_cco_action_manage_sta_assoc (cp_t *ctx, cp_mme_rx_t * assoc_req)
+{
+ cp_msg_cc_assoc_req_t assoc;
+ cp_msg_cc_assoc_cnf_t cnf;
+ cp_sta_t *sta;
+ cp_net_t *net;
+ uint tei;
+
+ dbg_assert (ctx);
+ dbg_assert (assoc_req);
+
+ /* Reading the data in the MME. */
+ cp_msg_cc_assoc_req_receive(ctx, assoc_req, &assoc);
+
+ /* Add the station to the AVLN. */
+ net = cp_sta_mgr_get_our_avln (ctx);
+
+ if (assoc.request_type == CP_MSG_CC_ASSOC_REQ_TYPE_NEW)
+ {
+ // If the station already exists.
+ // Read the mac to TEI table of the CL to get the TEI of the station.
+ tei = cl_mactotei_table_find_tei_from_mac (ctx->cl,
+ assoc_req->peer.mac);
+ if (tei)
+ {
+ // The station already exists.
+ // Remove the station from the AVLN.
+ sta = cp_net_get_sta (ctx, net, tei);
+ cp_cco_action_manage_sta_leave (ctx, NULL, sta);
+ slab_release (sta);
+ }
+
+
+ /* Try to get a TEI. */
+ tei = cp_cco_action_tei_compute (&ctx->cco_action);
+
+ sta = cp_net_sta_add (ctx, net, tei, assoc_req->peer.mac);
+
+ if (tei)
+ {
+ /* Add the TEI lease corresponding to an unassociated STA. */
+ cp_net_commit_to_dataplane (ctx, net);
+ sta->tei_lease_ms =
+ MAC_SEC_TO_MS(CP_CCO_ACTION_LEASE_ASSOC_MIN * 60);
+
+ cnf.result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS;
+ cnf.lease_time_min = CP_CCO_ACTION_LEASE_ASSOC_MIN;
+ }
+ else
+ {
+ cnf.result =
+ CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_TEMPORARY_RESSOURCE_EXHAUSTION;
+ sta->tei_lease_ms =
+ MAC_SEC_TO_MS(CP_CCO_ACTION_LEASE_UNASSOC_MIN * 60);
+ }
+
+ cnf.sta_tei = cp_sta_get_tei (sta);
+ }
+ else if (assoc.request_type == CP_MSG_CC_ASSOC_REQ_TYPE_RENEW)
+ {
+ /* Renew the TEI. */
+ sta = cp_net_get_sta (ctx, net, assoc_req->peer.tei);
+
+ if (sta)
+ {
+ /* Renew the TEI. */
+ sta->tei_lease_ms =
+ MAC_SEC_TO_MS(CP_CCO_ACTION_LEASE_AUTH_MIN * 60);
+
+ cnf.result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS;
+ cnf.sta_tei = cp_sta_get_tei (sta);
+ cnf.lease_time_min = CP_CCO_ACTION_LEASE_AUTH_MIN;
+ }
+ else
+ {
+ cnf.result = CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_OTHER_REASON;
+ cnf.sta_tei = 0;
+ cnf.lease_time_min = 0;
+ }
+ }
+ else
+ dbg_assert (assoc.request_type == CP_MSG_CC_ASSOC_REQ_TYPE_NB);
+
+ /* Finishing to fill the cnf context. */
+ cnf.nid = cp_net_get_nid (ctx, net);
+ cnf.snid = cp_net_get_snid (ctx, net);
+
+ /* Send the answer. */
+ cp_msg_cc_assoc_cnf_send (ctx, &CP_MME_PEER(assoc_req->peer.mac,
+ tei), &cnf);
+ if (tei
+ && assoc.request_type != CP_MSG_CC_ASSOC_REQ_TYPE_RENEW)
+ {
+ // Send the TEI MAPs.
+ cp_mme_tx_t *mme_tx;
+ cp_sta_t *sta_list;
+ cp_mme_peer_t *peer;
+
+ // Send unicast.
+ // It will send all the TEI MAP to the station just associated.
+ peer = &CP_MME_PEER (assoc_req->peer.mac, tei);
+ mme_tx = cp_msg_cc_set_tei_map_ind_send_begin (ctx, peer,
+ CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE,
+ cp_net_get_num_stas (ctx, net));
+
+ sta_list = cp_net_get_first (ctx, net, CP_STA_STATE_ASSOCIATED);
+ while (sta_list)
+ {
+ enum cp_msg_cc_set_tei_map_ind_status_t station_status;
+
+ switch (cp_sta_get_state (sta_list))
+ {
+ case CP_STA_STATE_ASSOCIATED:
+ station_status = CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED;
+ break;
+ case CP_STA_STATE_AUTHENTICATED:
+ station_status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED;
+ break;
+ default:
+ station_status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_DISASSOCIATED;
+ }
+
+ cp_msg_cc_set_tei_map_ind_send_sta (ctx, mme_tx,
+ cp_sta_get_tei (sta_list),
+ cp_sta_get_mac_address (sta_list),
+ station_status);
+
+ sta_list = cp_net_get_next (ctx, net, sta_list);
+ }
+
+ cp_msg_cc_set_tei_map_ind_send_end (ctx, mme_tx);
+
+ // Send broadcast.
+ // Send the TEI and the Mac address of the station just associated to
+ // all the station of the network.
+
+ peer = &CP_MME_PEER (MAC_BROADCAST);
+ mme_tx = cp_msg_cc_set_tei_map_ind_send_begin (ctx, peer,
+ CP_MSG_CC_SET_TEI_MAP_IND_MODE_ADD, 1);
+
+ cp_msg_cc_set_tei_map_ind_send_sta (ctx, mme_tx,
+ cp_sta_get_tei (sta),
+ cp_sta_get_mac_address (sta),
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED);
+
+ cp_msg_cc_set_tei_map_ind_send_end (ctx, mme_tx);
+ }
+
+ /* Release the reference on the station. */
+ slab_release (sta);
+}
+
+/**
+ * manage authentication of a station.
+ * \param ctx the module context.
+ * \param get_key_req CM_GET_KEY.REQ MME msg having being decrypted
+ */
+void
+cp_cco_action_manage_sta_auth (cp_t *ctx, cp_mme_rx_t * get_key_req)
+{
+ cp_msg_cm_get_key_req_t req;
+ cp_msg_cm_get_key_cnf_t cnf;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_own_data_t *own_data;
+ cp_mme_peks_t peks;
+ cp_secu_protocol_run_t prun;
+
+ dbg_assert (ctx);
+ dbg_assert (get_key_req);
+ dbg_assert (get_key_req->peer.tei);
+
+ // get the data in the payload of the mme.
+ cp_msg_cm_get_key_req_receive (ctx, get_key_req, &req);
+
+ // Get the network.
+ net = cp_sta_mgr_get_our_avln (ctx);
+ own_data = cp_sta_mgr_get_sta_own_data (ctx);
+ // Get the station.
+ sta = cp_net_get_sta (ctx, net, get_key_req->peer.tei);
+
+ if (sta)
+ {
+ // The station is now considered as authenticated.
+ cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
+
+ cnf.result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
+
+ if (req.key_type == CP_MSG_KEY_NEK)
+ {
+ cnf.key = ctx->cco_action.nek;
+ }
+ else
+ dbg_assert (req.key_type == CP_MSG_KEY_NEK);
+
+ slab_release (sta);
+ }
+ // Refuse the request.
+ else
+ {
+ cnf.result = CP_MSG_CM_GET_KEY_CNF_RESULT_REQUEST_REFUSED;
+ }
+
+ cnf.key_type = req.key_type;
+ cnf.nid = req.nid;
+ cp_msg_cm_get_key_cnf_send (ctx, &CP_MME_PEER (get_key_req->peer.mac,
+ get_key_req->peer.tei),
+ peks, &prun, &cnf);
+}
+
+/**
+ * manage explicit leave request of a station.
+ * \param ctx the module context.
+ * \param leave_req The MME leave req message.
+ * \param sta provided by the garbage function to send a CC_LEAVE_IND.
+ *
+ * Remove the station from the station manager
+ */
+void
+cp_cco_action_manage_sta_leave (cp_t *ctx, cp_mme_rx_t * leave_req,
+ cp_sta_t *sta)
+{
+ cp_mme_peer_t *peer;
+ cp_net_t *net;
+ cp_mme_tx_t *mme;
+ uint status;
+
+ dbg_assert (ctx);
+
+ /* Get the network of the station. */
+ net = cp_sta_mgr_get_our_avln (ctx);
+
+ // The station has sent a lave request.
+ if (leave_req)
+ {
+ dbg_assert (leave_req->peer.tei);
+
+ /* Get the station. */
+ sta = cp_net_get_sta (ctx, net, leave_req->peer.tei);
+ peer = &CP_MME_PEER (leave_req->peer.mac, leave_req->peer.tei);
+ cp_msg_cc_leave_cnf_send (ctx, peer);
+ }
+ else
+ {
+ peer = &CP_MME_PEER (cp_sta_get_mac_address (sta),
+ cp_sta_get_tei (sta));
+
+ cp_msg_cc_leave_ind_send (ctx, peer,
+ CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
+ cp_net_get_nid(ctx, net));
+ }
+
+ // Send the TEI MAP to the station.
+ peer = &CP_MME_PEER (MAC_BROADCAST);
+
+ switch (cp_sta_get_state (sta))
+ {
+ case CP_STA_STATE_ASSOCIATED:
+ status = CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED;
+ break;
+ case CP_STA_STATE_AUTHENTICATED:
+ status = CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED;
+ break;
+ default:
+ status = CP_MSG_CC_SET_TEI_MAP_IND_STATUS_DISASSOCIATED;
+ }
+
+ mme = cp_msg_cc_set_tei_map_ind_send_begin (ctx, peer,
+ CP_MSG_CC_SET_TEI_MAP_IND_MODE_DELETE,
+ 1);
+ cp_msg_cc_set_tei_map_ind_send_sta (ctx, mme, cp_sta_get_tei (sta),
+ cp_sta_get_mac_address (sta),
+ status);
+ cp_msg_cc_set_tei_map_ind_send_end (ctx, mme);
+
+ // Remove the station.
+ cp_net_sta_remove (ctx, net, sta);
+ cp_net_commit_to_dataplane (ctx, net);
+
+ /* Verify if the network is empty, if it is post an event to the FSM. */
+ if (cp_net_is_empty (ctx, net))
+ {
+ cp_fsm_event_t *event;
+ event = cp_fsm_event_bare_new (ctx,
+ CP_FSM_EVENT_TYPE_all_sta_leaved);
+ cp_fsm_post (ctx, event);
+ }
+}
+
diff --git a/cesar/cp/cco/action/test/Makefile b/cesar/cp/cco/action/test/Makefile
new file mode 100644
index 0000000000..ab02071d3a
--- /dev/null
+++ b/cesar/cp/cco/action/test/Makefile
@@ -0,0 +1,18 @@
+BASE = ../../../..
+
+ECOS = y
+
+INCLUDES = cp/cco/action/test/overide
+
+TARGET_PROGRAMS = action garbage action_gen_nek
+
+action_SOURCES = action-test.c secu_stub.c
+action_MODULES = lib cp/cco/action mac/common cp/sta/mgr cl
+
+garbage_SOURCES = garbage.c fsm_stub.c secu_stub.c
+garbage_MODULES = lib cp/cco/action mac/common cp/sta/mgr cl
+
+action_gen_nek_SOURCES = action_gen_nek.c secu_stub.c fsm_stub.c
+action_gen_nek_MODULES = lib cp/cco/action mac/common cp/sta/mgr cl
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/cco/action/test/doc/Makefile b/cesar/cp/cco/action/test/doc/Makefile
new file mode 100644
index 0000000000..fc8858cbcd
--- /dev/null
+++ b/cesar/cp/cco/action/test/doc/Makefile
@@ -0,0 +1,20 @@
+PAGES= cco_action.txt
+
+ODT=$(PAGES:%.txt=%.odt)
+HTML=$(PAGES:%.txt=%.html)
+
+all: $(ODT) $(HTML)
+
+odt: $(ODT)
+
+html: $(HTML)
+
+%.odt: %.txt
+ rst2odt.py $< $@
+
+%.html: %.txt
+ rst2html $< $@
+
+clean:
+ rm -f $(ODT)
+ rm -f $(HTML)
diff --git a/cesar/cp/cco/action/test/doc/cco_action.txt b/cesar/cp/cco/action/test/doc/cco_action.txt
new file mode 100644
index 0000000000..c844e602df
--- /dev/null
+++ b/cesar/cp/cco/action/test/doc/cco_action.txt
@@ -0,0 +1,170 @@
+CCO Action test
+===============
+
+Initialise
+----------
+
+The initialise procedure shall only initialise the set for the expiration
+process.
+
+At the end of this test the set shall be empty.
+
+Uninitialise
+------------
+
+The uninitialise procedure shall remove the station referenced in the TEI
+lease expiration.
+For that some station shall be added to the station manager and to the
+tei_lease_expiration set.
+
+At the end of this test, the set shall be empty and the memory freed
+correctly.
+
+SNID change
+-----------
+
+Test the procedure to modify the SNID at the beginning of the AVLN, and
+simulating an AVLN SNID collision.
+
+Test 1: Choosing SNID at the beginning.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This shall choose randomly a value of SNID. The random generator is
+initialised with the mac_ntb date.
+
+Environment:
+ * The phy_date override in the test shall always return the same value in order to verify the SNID chosen.
+ * The all range of SNID values shall be available. The flags returned by the override of the get_snids function from the sta manager shall return 0x0.
+
+
+Test 2: Choosing SNID after collision.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This shall choose randomly a value of SNID between the following ones, 2, 3,
+4, 7, 9, 11, 13, 14. So the flag returned by the get_snids function from the
+sta manager shall be not(0x9563) so 0x6A9C.
+
+Once this is done the value of the new SNID shall be provide to the beacon
+module using change_snid function.
+
+Garbage
+-------
+
+The garbage function will call the tei_lease_check function to expire the expired TEI lease in the station of the AVLN.
+
+Normally the clock use for the TEI lease is the eCos time, so it is very
+difficult to modify this timer.
+
+For that a thread shall be added to the test to use the cyg_thread_delay
+eCos's function which can only be called in a thread.
+
+Environment:
+ * Add a thread to use the cyg_thread_delay, this thread will be use for this test case at least.
+ * Add some station with a TEI lease of 5 eCos ticks i.e. 50 ms.
+
+The time between the garbage function call and the time verification of the
+test shall be greater than the 5 eCos ticks.
+
+At the end no more station shall be present i.e. the lease had expired.
+
+Generate key
+------------
+
+Sta association procedure
+-------------------------
+
+Test 1: Receiving a CC_ASSOC.REQ join
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+First station to associate
+ The CCo shall try to associate the station to its AVLN.
+
+ 1. Get an available TEI different from the one of the own Station's TEI.
+ 2. Add the station to the station list (use the station manager).
+ 3. Answer the request.
+
+ At the end of this test, the station shall be present in the station manager
+ list. The station shall be in the associate state.
+
+Second station to associate
+ The CCo tries to associate another station to the AVLN.
+
+ 1. Get an available TEI different from the previous registered station and
+ the own station.
+ 2. Add the station to the station manager list.
+ 3. Answer the request.
+
+ At the end of the test two station shall be present with different TEIs.
+
+No more station can be associate
+ The CCo tries to associate another station to the AVLN, but there are no more TEIs available.
+
+ 1. The CCo tries to get a TEI for the station, the function shall return 0.
+ 2. Add the station to the sta manager as unassociated sta.
+ 3. Answer the request with a failed code.
+
+Test 2: Receiving a CC_ASSOC.REQ renew
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+This shall only verify if the TEI lease is correctly update in the station.
+
+At the end of this test, the station requiring the renew shall have 45
+minutes more before the expiration of the TEI lease.
+
+Test 3: Receiving a CC_ASSOC_REQ join from a associated station
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+At the end the station shall still exists with a different TEI.
+ 1. The station is removed from the AVLN. (a SET_TEI_MAP is send)
+ 2. The station is added in the AVLN (a SET_TEI_MAP is send).
+
+Sta authentication procedure
+----------------------------
+
+this shall only answer with a CM_GET_KEY.CNF message if the station is known.
+
+Test 1: Station is not known.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+ A MME is received with a authentication request and the Station is not known.
+
+Result
+ A MME with the CM_GET_KEY.CNF containing the result "request refused" shall be sent.
+
+Test 2: Station is known.
+~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+ Some station have been added and are associated.
+ A CM_GET_KEY.REQ MME is received from a station.
+
+Result
+ The CCo shall send a answer CM_GET_KEY.CNF with the following data.
+
+ * Result = 0 (guaranteed)
+ * key = 2 (NEK)
+ * NID = 0
+
+STA leaving
+-----------
+
+Station is known
+~~~~~~~~~~~~~~~~
+
+Environment
+ Some station have been added and are associated and authenticated.
+ One of those stations sends a CC_LEAVE.REQ.
+
+Result
+ The station is removed from the station manager.
+ The CCo answers with a CC_LEAVE.IND.
+
+Station is not known
+~~~~~~~~~~~~~~~~~~~~
+
+Environment
+ A CC_LEAVE.REQ is received from a unknown station.
+
+Result
+ The CC_LEAVE.REQ is ignored.
diff --git a/cesar/cp/cco/action/test/ecos.ecc.sh b/cesar/cp/cco/action/test/ecos.ecc.sh
new file mode 100644
index 0000000000..8253d98c9a
--- /dev/null
+++ b/cesar/cp/cco/action/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/cco/action/test/overide/cp_fsm_defs.h b/cesar/cp/cco/action/test/overide/cp_fsm_defs.h
new file mode 100644
index 0000000000..c29fa69e19
--- /dev/null
+++ b/cesar/cp/cco/action/test/overide/cp_fsm_defs.h
@@ -0,0 +1,38 @@
+#ifndef overide_cp_fsm_defs_h
+#define overide_cp_fsm_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp_fsm_defs.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_all_sta_leaved,
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* overide_cp_fsm_defs_h */
diff --git a/cesar/cp/cco/action/test/src/action-test.c b/cesar/cp/cco/action/test/src/action-test.c
new file mode 100644
index 0000000000..30fafa88cb
--- /dev/null
+++ b/cesar/cp/cco/action/test/src/action-test.c
@@ -0,0 +1,909 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/action-test.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "lib/test.h"
+#include "lib/utils.h"
+#include "lib/swap.h"
+#include "lib/read_word.h"
+
+#include "cl/cl_mactotei.h"
+
+#include "common/defs/homeplugAV.h"
+#include "common/defs/ethernet.h"
+
+#include "mac/common/ntb.h"
+
+#include "cp/cp.h"
+#include "cp/fsm/fsm.h"
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta.h"
+
+#include "cp/cco/action/cco_action.h"
+#include "cp/cco/action/inc/cco_action.h"
+
+#include "cp/inc/context.h"
+
+test_t test;
+
+// The value provided to the module beacon.
+u16 snid_compute;
+
+// A Simple counter.
+uint tei_map_cnt;
+
+static cp_fsm_event_t fsm_event;
+static bool fsm_event_posted = false;
+
+/**
+ * Verify TEI lease computing function.
+ * \param test the test object.
+ *
+ * Test 1:
+ * Initialise the TEI flags to the value 0x0124 in the first word.
+ * The TEI return shall be 2.
+ *
+ * Test 2:
+ * Initialise the TEI flags first word to 0xFFFFFFFE.
+ * The second one with 0xFFFFEFFF
+ * The TEI returned shall be 45.
+ *
+ * Test 3:
+ * Initialise the TEI flags first word to 0xFFFFFFFE.
+ * Initialise the TEI flags second word to 0xFFFFFFFF.
+ * Initialise the TEI flags ... word to 0xFFFFFFFF.
+ * Initialise the TEI flags eights word to 0x7FFFFFFF.
+ * The TEI returned shall be 0.
+ */
+void
+test_case_tei_lease_create (test_t test)
+{
+ cp_cco_action_t action;
+ uint tei;
+
+ test_case_begin (test, "TEI Lease create");
+
+ action.tei_flags[0] = 0x0124;
+
+ tei = cp_cco_action_tei_compute (&action);
+
+ test_begin (test, "Test 1")
+ {
+ test_fail_if (tei != 2, "TEI shall be 2");
+ test_fail_if ((action.tei_flags[0] & 0x2) != 2,
+ "TEI bit flag shall be setted");
+ }
+ test_end;
+
+ action.tei_flags[0] = 0xFFFFFFFE;
+ action.tei_flags[1] = 0xFFFFEFFF;
+
+ tei = cp_cco_action_tei_compute (&action);
+
+ test_begin (test, "Test 2")
+ {
+ test_fail_if (tei != 45, "TEI shall be 57");
+ test_fail_if ((action.tei_flags[1] & 0xC) != 12,
+ "TEI bit flag shall be setted");
+ }
+ test_end;
+
+ action.tei_flags[0] = 0xFFFFFFFE;
+ action.tei_flags[1] = 0xFFFFFFFF;
+ action.tei_flags[2] = 0xFFFFFFFF;
+ action.tei_flags[3] = 0xFFFFFFFF;
+ action.tei_flags[4] = 0xFFFFFFFF;
+ action.tei_flags[5] = 0xFFFFFFFF;
+ action.tei_flags[6] = 0xFFFFFFFF;
+ action.tei_flags[7] = 0x7FFFFFFF;
+
+ tei = cp_cco_action_tei_compute (&action);
+
+ test_begin (test, "Test 3")
+ {
+ test_fail_if (tei != 0, "TEI shall be 0");
+ test_fail_if (action.tei_flags[7] != 0x7FFFFFFF,
+ "TEI bit flag shall be setted");
+ }
+ test_end;
+
+}
+
+/**
+ * Verify TEI release function.
+ * \param test the test object.
+ *
+ * Test 1:
+ * Initialise the TEI flags to the value 0x0126 in the first word.
+ * The TEI return shall be 2
+ *
+ * Test 2:
+ * Initialise the TEI flags first word to 0xFFFFFFFE.
+ * The second one with 0xFFFFFFFF
+ * The TEI returned shall be 45.
+ */
+void
+test_case_tei_release (test_t test)
+{
+ cp_cco_action_t action;
+ uint tei;
+
+ test_case_begin (test, "TEI Lease release");
+
+ action.tei_flags[0] = 0x0126;
+
+ //Release TEI 2.
+ cp_cco_action_tei_release (&action, 2);
+
+ // Get TEI.
+ tei = cp_cco_action_tei_compute (&action);
+
+ test_begin (test, "Test 1")
+ {
+ test_fail_if (tei != 2, "TEI shall be 2");
+ test_fail_if ((action.tei_flags[0] & 0x2) != 2,
+ "TEI bit flag shall be setted");
+ }
+ test_end;
+
+ action.tei_flags[0] = 0xFFFFFFFE;
+ action.tei_flags[1] = 0xFFFFFFFF;
+
+ cp_cco_action_tei_release (&action, 45);
+ tei = cp_cco_action_tei_compute (&action);
+
+ test_begin (test, "Test 2")
+ {
+ test_fail_if (tei != 45, "TEI shall be 57");
+ test_fail_if ((action.tei_flags[1] & 0xC) != 12,
+ "TEI bit flag shall be setted");
+ }
+ test_end;
+}
+
+/** Test the initialisation of the cco_action module.
+ * \param test the test object.
+ *
+ * The initialise procedure shall only initialise the set for the expiration
+ * process.
+ * At the end of this test the set shall be empty.
+ */
+void
+test_case_cco_action_init (test_t test)
+{
+ cp_t cp;
+ uint i;
+
+ test_case_begin (test, "Initialise the module.");
+
+ cp_cco_action_init (&cp);
+
+ test_begin (test, "Verify")
+ {
+ for (i = 0; i < 8; i++)
+ {
+ test_fail_if (cp.cco_action.tei_flags[i] != 0,
+ "TEI flags shall be null");
+ }
+ }
+ test_end;
+}
+
+/** Change SNID.
+ * \param test the test object.
+ *
+ * Test the procedure to modify the SNID at the beginning of the AVLN, and
+ * simulating an AVLN SNID collision.
+ *
+ * Test 1: Choosing SNID at the beginning.
+ * This shall choose randomly a value of SNID. The random generator is
+ * initialised with the mac_ntb date.
+ *
+ * Environment:
+ * The phy_date override in the test shall always return the same value
+ * in order to verify the SNID chosen.
+ *
+ * The all range of SNID values shall be available. The flags returned
+ * by the override of the get_snids function from the sta manager shall
+ * return 0x0.
+ *
+ * Test 2: Choosing SNID after collision.
+ *
+ * This shall choose randomly a value of SNID between the following ones,
+ * 2, 3, 4, 7, 9, 11, 13, 14. So the flag returned by the
+ * get_snids function from the sta manager shall be not(0x9563) so 0x6A9C.
+ *
+ * Once this is done the value of the new SNID shall be provide to the beacon
+ * module using change_snid function.
+ */
+void
+test_case_change_snid (test_t test)
+{
+ cp_t cp;
+
+ test_case_begin (test, "change SNID test 1");
+
+ cp_cco_action_init (&cp);
+ cp_sta_mgr_init (&cp);
+
+ cp_cco_action_snid_change (&cp);
+
+ test_begin (test, "Verify SNID chosen")
+ {
+ test_fail_if (snid_compute != 13, "Wrong snid");
+ }
+ test_end;
+
+ test_case_begin (test, "change SNID test 2");
+
+ cp_cco_action_init (&cp);
+
+ /* Adding the AVLN. */
+ cp_sta_mgr_add_avln (&cp, 1, 1);
+ cp_sta_mgr_add_avln (&cp, 5, 2);
+ cp_sta_mgr_add_avln (&cp, 6, 3);
+ cp_sta_mgr_add_avln (&cp, 8, 4);
+ cp_sta_mgr_add_avln (&cp, 10, 5);
+ cp_sta_mgr_add_avln (&cp, 12, 6);
+ cp_sta_mgr_add_avln (&cp, 15, 7);
+
+ cp_cco_action_snid_change (&cp);
+
+ test_begin (test, "Verify SNID chosen")
+ {
+ test_fail_if (snid_compute != 13, "Wrong snid");
+ }
+ test_end;
+
+ cp_sta_mgr_uninit (&cp);
+}
+
+/** Sta association procedure.
+ * \param test the test object.
+ *
+ * Test 1: Receiving a CC_ASSOC.REQ join
+ *
+ * First station to associate
+ * The CCo shall try to associate the station to its AVLN.
+ * 1. Get an available TEI different from the one of the own Station's TEI.
+ * 2. Add the station to the station list (use the station manager).
+ * 3. Answer the request.
+ *
+ * At the end of this test, the station shall be present in the station
+ * manager list. The station shall be in the associate state.
+ *
+ * Second station to associate
+ * The CCo tries to associate another station to the AVLN.
+ *
+ * 1. Get an available TEI different from the previous registered station
+ * and the own station.
+ * 2. Add the station to the station manager list.
+ * 3. Answer the request.
+ *
+ * At the end of the test two station shall be present with different TEIs.
+ *
+ * No more station can be associate
+ * The CCo tries to associate another station to the AVLN, but there are
+ * no more TEIs available.
+ *
+ * 1. The CCo tries to get a TEI for the station, the function shall
+ * return 0.
+ * 2. Add the station to the sta manager as unassociated sta.
+ * 3. Answer the request with a failed code.
+ *
+ * Test 2: Receiving a CC_ASSOC.REQ renew
+ *
+ * This shall only verify if the TEI lease is correctly update in the
+ * station.
+ *
+ * At the end of this test, the station requiring the renew shall have 45
+ * minutes more before the expiration of the TEI lease.
+ *
+ * Test 3: Receiving a CC_ASSOC_REQ join from a associated station.
+ *
+ * At the end the station shall still exists with a different TEI.
+ * 1. The station is removed from the AVLN. (a SET_TEI_MAP is send)
+ * 2. The station is added in the AVLN (a SET_TEI_MAP is send).
+ */
+void
+test_case_sta_assoc_procedure (test_t test)
+{
+ cp_t cp;
+ bitstream_t bitstream;
+ u8 buffer[256] __attribute__((aligned(256)));
+ uint req_type;
+ u64 nid = 12;
+ uint cco_cap = 2;
+ uint pco_cap = true;
+ cp_mme_rx_t mme_rx;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cl_mactotei_blk_t *table;
+
+ cp.cl = blk_alloc ();
+ memset (cp.cl, 0, BLK_SIZE);
+ cp_cco_action_init (&cp);
+ cp_sta_mgr_init (&cp);
+
+ cp_sta_mgr_update_our_avln_nid (&cp, nid);
+
+ test_case_begin (test, "Test 1: Receiving a CC_ASSOC.REQ join");
+
+ // Construct the MME to associate the first station.
+ mme_rx.peer.mac = 2;
+ mme_rx.peer.vlan_tag = 0;
+ mme_rx.peer.tei = 0;
+
+ // Write the request.
+ bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &req_type, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &cco_cap, 8);
+ bitstream_access (&bitstream, &pco_cap, 8);
+ bitstream_finalise (&bitstream);
+
+ // Initialise the MME Rx object.
+ mme_rx.p_mme = buffer;
+ mme_rx.length = 60;
+ bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ);
+
+ cp_cco_action_manage_sta_assoc (&cp, &mme_rx);
+
+ // Second station to add.
+ // Construct the MME to associate the second station.
+ mme_rx.peer.mac = 3;
+ mme_rx.peer.vlan_tag = 0;
+ mme_rx.peer.tei = 0;
+
+
+ // Write the request.
+ bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &req_type, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &cco_cap, 8);
+ bitstream_access (&bitstream, &pco_cap, 8);
+ bitstream_finalise (&bitstream);
+
+ // Initialise the MME Rx object.
+ mme_rx.p_mme = buffer;
+ mme_rx.length = 60;
+ bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ);
+
+ cp_cco_action_manage_sta_assoc (&cp, &mme_rx);
+
+ // The next station can not be associated because the TEIs are already in
+ // use.
+ cp.cco_action.tei_flags[0] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[1] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[2] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[3] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[4] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[5] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[6] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[7] = 0xFFFFFFFF;
+
+ // third station to add.
+ // Construct the MME to associate the third station.
+ mme_rx.peer.mac = 4;
+ mme_rx.peer.vlan_tag = 0;
+ mme_rx.peer.tei = 0;
+
+ // Write the request.
+ bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &req_type, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &cco_cap, 8);
+ bitstream_access (&bitstream, &pco_cap, 8);
+ bitstream_finalise (&bitstream);
+
+ // Initialise the MME Rx object.
+ mme_rx.p_mme = buffer;
+ mme_rx.length = 60;
+ bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ);
+
+ cp_cco_action_manage_sta_assoc (&cp, &mme_rx);
+
+ test_case_begin (test, "Test 2: Receiving a CC_ASSOC.REQ renew");
+
+ // Renew the lease.
+ mme_rx.peer.mac = 2;
+ mme_rx.peer.vlan_tag = 0;
+ mme_rx.peer.tei = 2;
+
+ // Write the request.
+ req_type = CP_MSG_CC_ASSOC_REQ_TYPE_RENEW;
+ bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &req_type, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &cco_cap, 8);
+ bitstream_access (&bitstream, &pco_cap, 8);
+ bitstream_finalise (&bitstream);
+
+ // Initialise the MME Rx object.
+ mme_rx.p_mme = buffer;
+ mme_rx.length = 60;
+ bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ);
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_get_sta (&cp, net, 2);
+ cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
+ slab_release (sta);
+
+ cp_cco_action_manage_sta_assoc (&cp, &mme_rx);
+
+ test_case_begin (test,
+ "Test 3: Receiving a CC_ASSOC_REQ join from a associated station");
+
+ cp.cco_action.tei_flags[0] = 0xF0FFFFFF;
+ cp.cco_action.tei_flags[1] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[2] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[3] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[4] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[5] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[6] = 0xFFFFFFFF;
+ cp.cco_action.tei_flags[7] = 0xFFFFFFFF;
+
+
+ table = cl_mactotei_new ();
+ cl_mactotei_addr_add (table, 0x2, 0x2, 1);
+ cl_mactotei_use_table (cp.cl, table);
+
+ // Construct the MME to associate the first station.
+ mme_rx.peer.mac = 2;
+ mme_rx.peer.vlan_tag = 0;
+ mme_rx.peer.tei = 0;
+
+ req_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW;
+ // Write the request.
+ bitstream_init (&bitstream, buffer + 19, 10, BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &req_type, 8);
+ bitstream_access (&bitstream, &nid, 56);
+ bitstream_access (&bitstream, &cco_cap, 8);
+ bitstream_access (&bitstream, &pco_cap, 8);
+ bitstream_finalise (&bitstream);
+
+ // Initialise the MME Rx object.
+ mme_rx.p_mme = buffer;
+ mme_rx.length = 60;
+ bitstream_init (&mme_rx.bitstream, buffer + 19, 60, BITSTREAM_READ);
+
+ cp_cco_action_manage_sta_assoc (&cp, &mme_rx);
+
+ cp_cco_action_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ blk_release_desc ((blk_t *) table);
+ blk_release (cp.cl);
+}
+
+/** Sta authentication procedure
+ * \param test the test object.
+ *
+ * this shall only answer with a CM_GET_KEY.CNF message if the station is known
+ *
+ * Test 1: Station is not known.
+ * Environment
+ * A MME is received with a authentication request and the Station is not
+ * known.
+ * Result
+ * A MME with the CM_GET_KEY.CNF containing the result "request refused"
+ * shall be sent.
+ *
+ * Test 2: Station is known.
+ *
+ * Environment
+ * Some station have been added and are associated. A CM_GET_KEY.REQ MME
+ * is received from a station.
+ * Result
+ * The CCo shall send a answer CM_GET_KEY.CNF with the following data.
+ *
+ * - Result = 0 (guaranteed)
+ * - key = 2 (NEK)
+ * - NID = 0
+ */
+void
+test_case_sta_authentication (test_t test)
+{
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ mfs_rx_t mfs;
+ bitstream_t bitstream;
+ cp_mme_rx_t mme;
+ u64 data;
+ u8 buffer[1024]__attribute__((aligned(1024)));
+
+ cp_cco_action_init (&cp);
+ cp_sta_mgr_init (&cp);
+
+ // Update the net NID and SNID.
+ cp_sta_mgr_update_our_avln_nid (&cp, 0x1);
+ cp_sta_mgr_update_our_avln_snid (&cp, 0x2);
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+
+ test_case_begin (test, "Sta authentication procedure");
+
+ // Build the MME.
+ bitstream_init (&bitstream, buffer, sizeof(buffer), BITSTREAM_WRITE);
+ // ODA.
+ data = 0x2;
+ bitstream_access (&bitstream, &data, 48);
+ // OSA.
+ data = 0x1;
+ bitstream_access (&bitstream, &data, 48);
+ // Mtype
+ data = swap16 (HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ // MMV.
+ data = HPAV_MMV1;
+ bitstream_access (&bitstream, &data, 8);
+ // MMtype.
+ data = CM_GET_KEY_REQ;
+ bitstream_access (&bitstream, &data, 16);
+ // FMI
+ data = 0;
+ bitstream_access (&bitstream, &data, 16);
+ // Request type.
+ data = 0;
+ bitstream_access (&bitstream, &data, 8);
+ // Request key type.
+ data = CP_MSG_KEY_NEK;
+ bitstream_access (&bitstream, &data, 8);
+ // NID.
+ data = cp_net_get_nid (&cp, net);
+ bitstream_access (&bitstream, &data, 56);
+ // Nonce.
+ data = 0xc;
+ bitstream_access (&bitstream, &data, 32);
+ // PID.
+ data = 0;
+ bitstream_access (&bitstream, &data, 32);
+ // Key.
+ data = 0xA;
+ bitstream_access (&bitstream, &data, 8);
+ bitstream_finalise (&bitstream);
+
+ mme.length = 37;
+ mme.p_mme = buffer;
+ mme.peer.tei = 0xFF;
+
+ cp_cco_action_manage_sta_auth (&cp, &mme);
+
+ mfs.common.tei = 0x1;
+ sta = cp_net_sta_add (&cp, net, mfs.common.tei, 0x1);
+ cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
+ slab_release (sta);
+ cp_cco_action_manage_sta_auth (&cp, &mme);
+
+ cp_sta_mgr_uninit (&cp);
+ cp_cco_action_uninit (&cp);
+}
+
+/** Test the station leaving procedure.
+ * \param test the test object.
+ *
+ * This shall only verify that a message is post in the FSM when the station
+ * leave the AVLN.
+ */
+void
+test_case_sta_leave (test_t test)
+{
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+
+ cp_sta_mgr_init (&cp);
+ cp_cco_action_init (&cp);
+
+ test_case_begin (test, "CCO action : Station leave");
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_sta_add (&cp, net, 0x1, 0x1);
+
+ cp_cco_action_manage_sta_leave (&cp, NULL, sta);
+ slab_release (sta);
+
+ test_begin (test, "Verify the post event")
+ {
+ test_fail_if (fsm_event_posted != true, "FSM Event not posted");
+ }
+ test_end;
+
+ cp_cco_action_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+}
+
+int
+main (void)
+{
+ uint phy;
+ mac_config_t mac_config;
+
+ test_init (test, 0, NULL);
+ mac_ntb_init ((phy_t *) &phy, &mac_config);
+
+ test_case_tei_lease_create (test);
+ test_case_tei_release (test);
+ test_case_cco_action_init (test);
+ test_case_change_snid (test);
+ test_case_sta_assoc_procedure (test);
+ test_case_sta_authentication (test);
+ test_case_sta_leave (test);
+
+ test_case_begin (test, "Memory leaks");
+
+ test_begin (test, "Memory leaks verification")
+ {
+ test_fail_if (blk_check_memory() == false, "Memory not freed");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+void
+cp_beacon_change_snid (cp_t *ctx, u8 snid)
+{
+ snid_compute = snid;
+}
+
+u32
+phy_date (phy_t *phy)
+{
+ return 42;
+}
+
+/**
+ * Begin a CC_SET_TEI_MAP.IND construction.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mode update, add or delete
+ * \param sta_nb number of stations sent
+ * \return the MME being constructed
+ */
+cp_mme_tx_t *
+cp_msg_cc_set_tei_map_ind_send_begin (
+ cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_set_tei_map_ind_mode_t mode, uint sta_nb)
+{
+ return NULL;
+}
+
+/**
+ *
+ * Write a station to a CC_SET_TEI_MAP.IND being constructed.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ * \param tei STA TEI
+ * \param mac STA mac address
+ * \param status STA status
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_sta (
+ cp_t *ctx, cp_mme_tx_t *mme, cp_tei_t tei, mac_t mac,
+ enum cp_msg_cc_set_tei_map_ind_status_t status)
+{
+}
+
+/**
+ * Finalise and send a CC_SET_TEI_MAP.IND message.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_end (cp_t *ctx, cp_mme_tx_t *mme)
+{
+}
+
+/**
+ * Receive a CC_ASSOC.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_assoc_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_req_t *data)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (data);
+
+ bitstream_access (&mme->bitstream, &data->request_type, 8);
+ bitstream_access (&mme->bitstream, &data->nid, 56);
+ bitstream_access (&mme->bitstream, &data->cco_cap, 8);
+ bitstream_access (&mme->bitstream, &data->proxy_cap, 8);
+ bitstream_finalise (&mme->bitstream);
+
+ return true;
+}
+
+/**
+ * Send a CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_assoc_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_cnf_t *data)
+{
+ cp_sta_t *sta;
+ cp_net_t *net;
+
+ dbg_assert (ctx);
+ dbg_assert (data);
+
+ net = cp_sta_mgr_get_our_avln (ctx);
+
+ if (data->sta_tei)
+ sta = cp_net_get_sta (ctx, net, data->sta_tei);
+ else
+ sta = cp_net_get_sta_unassoc (ctx, net, peer->mac);
+
+ test_begin (test, "Verifying CNF Data")
+ {
+ test_fail_if (sta == NULL, "Station shall exists");
+
+ switch (cp_sta_get_state (sta))
+ {
+ case CP_STA_STATE_ASSOCIATED:
+ test_fail_if (data->result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ "Wrong result value");
+ test_fail_if (data->lease_time_min != CP_CCO_ACTION_LEASE_ASSOC_MIN,
+ "Wrong TEI lease time");
+ break;
+ case CP_STA_STATE_AUTHENTICATED:
+ test_fail_if (data->result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ "Wrong result value");
+ test_fail_if (data->lease_time_min != CP_CCO_ACTION_LEASE_AUTH_MIN,
+ "Wrong TEI lease time");
+ break;
+ default:
+ test_fail_if (data->result !=
+ CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_TEMPORARY_RESSOURCE_EXHAUSTION,
+ "Wrong result value");
+ }
+
+ test_fail_if (data->sta_tei != cp_sta_get_tei (sta),
+ "Wrong TEI");
+ test_fail_if (data->nid != cp_net_get_nid (ctx, net),
+ "Wrong NID");
+ test_fail_if (data->snid != cp_net_get_snid (ctx, net),
+ "Wrong SNID");
+ }
+ test_end;
+
+ slab_release(sta);
+}
+
+/**
+ * Receive a CM_GET_KEY.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_get_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_get_key_req_t *data)
+{
+ uint offset;
+ bool vlantag_present;
+ u64 unused;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (mme->p_mme);
+ dbg_assert (mme->length < ETH_PACKET_MAX_SIZE);
+ dbg_assert (data);
+
+ if (read_u16_from_word (mme->p_mme + 12) == swap16(HPAV_MTYPE_MME))
+ vlantag_present = false;
+ else
+ vlantag_present = true;
+
+ // Read the MME.
+ bitstream_init (&mme->bitstream, mme->p_mme, mme->length, BITSTREAM_READ);
+ bitstream_access (&mme->bitstream, &mme->peer.mac, 48);
+ bitstream_access (&mme->bitstream, &unused, 48);
+ if (vlantag_present)
+ bitstream_access (&mme->bitstream, &mme->peer.vlan_tag, 32);
+ bitstream_access (&mme->bitstream, &unused, 16);
+ bitstream_access (&mme->bitstream, &unused, 8);
+ bitstream_access (&mme->bitstream, &unused, 16);
+ bitstream_access (&mme->bitstream, &unused, 16);
+
+ // Read the data in the MME.
+ bitstream_access (&mme->bitstream, &data->relayed, 8);
+ bitstream_access (&mme->bitstream, &data->key_type, 8);
+ bitstream_access (&mme->bitstream, &data->nid, 56);
+
+ if (vlantag_present)
+ offset = 41;
+ else
+ offset = 37;
+
+ memcpy (mme->p_mme + offset, &data->hash_key, mme->length - offset);
+ return true;
+}
+
+/**
+ * Send a CM_GET_KEY.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_get_key_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_get_key_cnf_t *data)
+{
+ dbg_assert (ctx);
+ dbg_assert (data);
+
+ test_begin (test, "Verify data")
+ {
+ test_fail_if (data->result != (peer->tei == 0xFF ?
+ CP_MSG_CM_GET_KEY_CNF_RESULT_REQUEST_REFUSED :
+ CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED),
+ "Wrong result type");
+ }
+ test_end;
+}
+
+/**
+ * Send a CC_LEAVE.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_leave_cnf_send (cp_t *ctx, cp_mme_peer_t *peer)
+{
+}
+
+/**
+ * Send a CC_LEAVE.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param reason reason for the disassociation
+ * \param nid NID
+ */
+void
+cp_msg_cc_leave_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_leave_ind_reason_t reason,
+ cp_nid_t nid)
+{
+}
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+ fsm_event_posted = true;
+}
diff --git a/cesar/cp/cco/action/test/src/action_gen_nek.c b/cesar/cp/cco/action/test/src/action_gen_nek.c
new file mode 100644
index 0000000000..a642791b62
--- /dev/null
+++ b/cesar/cp/cco/action/test/src/action_gen_nek.c
@@ -0,0 +1,263 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/action_gen_nek.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "lib/test.h"
+#include "lib/utils.h"
+#include "lib/swap.h"
+#include "lib/read_word.h"
+
+#include "cl/cl_mactotei.h"
+
+#include "common/defs/homeplugAV.h"
+#include "common/defs/ethernet.h"
+
+#include "mac/common/ntb.h"
+
+#include "cp/cp.h"
+#include "cp/fsm/fsm.h"
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta.h"
+
+#include "cp/cco/action/cco_action.h"
+#include "cp/cco/action/inc/cco_action.h"
+
+#include "cp/inc/context.h"
+#include "stdio.h"
+
+static cp_t cp;
+static test_t test;
+
+void
+test_case_gen_nek (void)
+{
+ uint i;
+ /* Initialise the seed of the random generator. */
+ lib_rnd_init (&cp.rnd, 0x12345678);
+
+ cp_cco_action_gen_nek (&cp);
+
+ test_begin (test, "Verify first shot")
+ {
+ for (i = 0; i < 4; i++)
+ {
+ test_fail_if (cp.mac_config->nek[0].nek[i] != 0xc6979343);
+ test_fail_if (cp.mac_config->nek[1].nek[i] != 0x962d2fa);
+ }
+ }
+ test_end;
+
+ cp_cco_action_gen_nek (&cp);
+
+ test_begin (test, "Verify second shot")
+ {
+ for (i = 0; i < 4; i++)
+ {
+ test_fail_if (cp.mac_config->nek[0].nek[i] != 0x962d2fa);
+ test_fail_if (cp.mac_config->nek[1].nek[i] != 0xa73a24a4);
+ }
+ }
+ test_end;
+
+ cp_cco_action_gen_nek (&cp);
+
+ test_begin (test, "Verify third shot")
+ {
+ for (i = 0; i < 4; i++)
+ {
+ test_fail_if (cp.mac_config->nek[0].nek[i] != 0xa73a24a4);
+ test_fail_if (cp.mac_config->nek[1].nek[i] != 0xe118a180);
+ }
+ }
+ test_end;
+
+ /* Re init the module. */
+ cp.mac_config->nek[0].nek[0] = 0;
+ cp.mac_config->nek[0].nek[1] = 0;
+
+ cp_cco_action_gen_nek (&cp);
+
+ test_begin (test, "Verify after reinit.")
+ {
+ for (i = 0; i < 4; i++)
+ {
+ test_fail_if (cp.mac_config->nek[0].nek[i] != 0xb5475abb);
+ test_fail_if (cp.mac_config->nek[1].nek[i] != 0x64613c7c);
+ }
+ }
+ test_end;
+}
+
+int
+main (void)
+{
+ mac_config_t mac_config;
+
+ test_init (test, 0, NULL);
+
+ cp.mac_config = &mac_config;
+
+ test_case_gen_nek ();
+
+ test_case_begin (test, "Memory leaks");
+
+ test_begin (test, "Memory leaks verification")
+ {
+ test_fail_if (blk_check_memory() == false, "Memory not freed");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+
+}
+
+void
+cp_beacon_change_snid (cp_t *ctx, u8 snid)
+{
+}
+
+u32
+phy_date (phy_t *phy)
+{
+ return 42;
+}
+
+/**
+ * Begin a CC_SET_TEI_MAP.IND construction.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mode update, add or delete
+ * \param sta_nb number of stations sent
+ * \return the MME being constructed
+ */
+cp_mme_tx_t *
+cp_msg_cc_set_tei_map_ind_send_begin (
+ cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_set_tei_map_ind_mode_t mode, uint sta_nb)
+{
+ return NULL;
+}
+
+/**
+ *
+ * Write a station to a CC_SET_TEI_MAP.IND being constructed.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ * \param tei STA TEI
+ * \param mac STA mac address
+ * \param status STA status
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_sta (
+ cp_t *ctx, cp_mme_tx_t *mme, cp_tei_t tei, mac_t mac,
+ enum cp_msg_cc_set_tei_map_ind_status_t status)
+{
+}
+
+/**
+ * Finalise and send a CC_SET_TEI_MAP.IND message.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_end (cp_t *ctx, cp_mme_tx_t *mme)
+{
+}
+
+/**
+ * Receive a CC_ASSOC.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_assoc_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_req_t *data)
+{
+ return true;
+}
+
+/**
+ * Send a CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_assoc_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_cnf_t *data)
+{
+}
+
+/**
+ * Receive a CM_GET_KEY.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_get_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_get_key_req_t *data)
+{
+ return true;
+}
+
+/**
+ * Send a CM_GET_KEY.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_get_key_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_get_key_cnf_t *data)
+{
+}
+
+/**
+ * Send a CC_LEAVE.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_leave_cnf_send (cp_t *ctx, cp_mme_peer_t *peer)
+{
+}
+
+/**
+ * Send a CC_LEAVE.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param reason reason for the disassociation
+ * \param nid NID
+ */
+void
+cp_msg_cc_leave_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_leave_ind_reason_t reason,
+ cp_nid_t nid)
+{
+}
+
diff --git a/cesar/cp/cco/action/test/src/fsm_stub.c b/cesar/cp/cco/action/test/src/fsm_stub.c
new file mode 100644
index 0000000000..849f375270
--- /dev/null
+++ b/cesar/cp/cco/action/test/src/fsm_stub.c
@@ -0,0 +1,29 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
diff --git a/cesar/cp/cco/action/test/src/garbage.c b/cesar/cp/cco/action/test/src/garbage.c
new file mode 100644
index 0000000000..98407ff30f
--- /dev/null
+++ b/cesar/cp/cco/action/test/src/garbage.c
@@ -0,0 +1,277 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/garbage.c
+ * \brief Test the garbage.
+ * \ingroup cp_cco
+ *
+ */
+#include "common/std.h"
+#include "lib/test.h"
+
+#include "mac/common/ntb.h"
+
+#include "cp/cp.h"
+#include "cp/msg/msg.h"
+
+#include "cp/cco/action/cco_action.h"
+#include "cp/cco/action/inc/cco_action.h"
+
+#include "cp/inc/context.h"
+
+#include "stdio.h"
+
+#define TEST_CCO_ACTION_NB_STA 10
+
+cyg_handle_t my_thread_handle;
+cyg_thread my_thread;
+u8 my_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
+
+/** The garbage function will call the tei_lease_check function to expire
+ * the expired TEI lease in the station of the AVLN.
+ *
+ * Environment:
+ *
+ * * Add a thread to use the cyg_thread_delay, this thread will be use
+ * for this test case at least.
+ * * Add some station with a TEI lease of 5 eCos ticks i.e. 50 ms.
+ *
+ * The time between the garbage function call and the time verification
+ * of the test shall be greater than the 5 eCos ticks.
+ *
+ * At the end no more station shall be present i.e. the lease had expired.
+ */
+void
+my_thread_entry (cyg_addrword_t data)
+{
+ cp_sta_t *sta;
+ uint i;
+ test_t test;
+ cp_t cp;
+ cp_net_t *net;
+ mac_config_t mac_config;
+ uint phy;
+
+ mac_ntb_init ((phy_t*) &phy, &mac_config);
+
+ test_init (test, 0, NULL);
+
+ cp_cco_action_init (&cp);
+ cp_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+
+ for (i = 0; i < TEST_CCO_ACTION_NB_STA; i++)
+ {
+ sta = cp_net_sta_add (&cp, net, 0, i + 1);
+ sta->tei_lease_ms = i;
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, i + 1, i + 1);
+ cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
+ sta->tei_lease_ms = i;
+ slab_release (sta);
+ }
+
+ while (cyg_current_time () < 100)
+ {
+ cyg_thread_delay (5);
+ cp_cco_action_garbage (&cp);
+ }
+
+ test_case_begin (test, "Verify garbage result");
+
+ test_begin (test, "verify")
+ {
+ }
+ test_end;
+
+ cp_cco_action_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+
+ test_case_begin (test, "Memory leaks");
+
+ test_begin (test, "Memory leaks verification")
+ {
+ test_fail_if (blk_check_memory() == false, "Memory not freed");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+}
+
+int
+main (void)
+{
+
+ // Create the thread object.
+ cyg_thread_create( 1, my_thread_entry, 0, "garbage", my_thread_stack,
+ CYGNUM_HAL_STACK_SIZE_TYPICAL, &my_thread_handle,
+ &my_thread);
+
+
+ // Activate the thread.
+ cyg_thread_resume (my_thread_handle);
+
+ return 0;
+}
+
+void
+cp_beacon_change_snid (cp_t *ctx, u8 snid)
+{
+}
+
+/**
+ * Send a CC_ASSOC.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_assoc_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_req_t *data)
+{
+}
+
+/**
+ * Receive a CC_ASSOC.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_assoc_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_req_t *data)
+{
+ return true;
+}
+
+/**
+ * Send a CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_assoc_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_cnf_t *data)
+{
+}
+
+/**
+ * Receive a CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_assoc_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_cnf_t *data)
+{
+ return true;
+}
+
+/**
+ * Send a CC_LEAVE.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_leave_cnf_send (cp_t *ctx, cp_mme_peer_t *peer)
+{
+}
+
+/**
+ * Begin a CC_SET_TEI_MAP.IND construction.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mode update, add or delete
+ * \param sta_nb number of stations sent
+ * \return the MME being constructed
+ */
+cp_mme_tx_t *
+cp_msg_cc_set_tei_map_ind_send_begin (
+ cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_set_tei_map_ind_mode_t mode, uint sta_nb)
+{
+ return NULL;
+}
+
+/**
+ *
+ * Write a station to a CC_SET_TEI_MAP.IND being constructed.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ * \param tei STA TEI
+ * \param mac STA mac address
+ * \param status STA status
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_sta (
+ cp_t *ctx, cp_mme_tx_t *mme, cp_tei_t tei, mac_t mac,
+ enum cp_msg_cc_set_tei_map_ind_status_t status)
+{
+}
+
+/**
+ * Finalise and send a CC_SET_TEI_MAP.IND message.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_end (cp_t *ctx, cp_mme_tx_t *mme)
+{
+}
+
+/**
+ * Receive a CM_GET_KEY.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_get_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_get_key_req_t *data)
+{
+ return true;
+}
+
+/**
+ * Send a CM_GET_KEY.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_get_key_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_get_key_cnf_t *data)
+{
+}
+
+/**
+ * Send a CC_LEAVE.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param reason reason for the disassociation
+ * \param nid NID
+ */
+void
+cp_msg_cc_leave_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_leave_ind_reason_t reason,
+ cp_nid_t nid)
+{
+}
diff --git a/cesar/cp/cco/action/test/src/secu_stub.c b/cesar/cp/cco/action/test/src/secu_stub.c
new file mode 100644
index 0000000000..0a14cf3836
--- /dev/null
+++ b/cesar/cp/cco/action/test/src/secu_stub.c
@@ -0,0 +1,32 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/secu_stub.c
+ * \brief The security functions.
+ * \ingroup cp/cco/action
+ *
+ */
+#include "common/std.h"
+
+#include "cp/secu/secu.h"
+
+/**
+ * Generate the AES key.
+ * \param num a random number.
+ * \param output the key generated.
+ */
+void
+cp_secu_aes_generate_key (uint num, u8 *output)
+{
+ uint i;
+ dbg_assert (num);
+ dbg_assert (output);
+
+ for (i = 0; i < 4; i++)
+ ((u32 *) output)[i] = num;
+}
diff --git a/cesar/cp/cco/bw/Module b/cesar/cp/cco/bw/Module
new file mode 100644
index 0000000000..be06c3a4fe
--- /dev/null
+++ b/cesar/cp/cco/bw/Module
@@ -0,0 +1 @@
+SOURCES:=bw_lib_alloc.c bw_prio_heap.c bw.c
diff --git a/cesar/cp/cco/bw/bw.h b/cesar/cp/cco/bw/bw.h
new file mode 100644
index 0000000000..5d1e4580b5
--- /dev/null
+++ b/cesar/cp/cco/bw/bw.h
@@ -0,0 +1,360 @@
+#ifndef cp_cco_bw_h
+#define cp_cco_bw_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp_cco_bw.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "cp/cp.h"
+#include "cp/cco/bw/bw_prio_heap.h"
+#include "lib/list.h"
+#include "lib/set.h"
+#include "cp/conn/conn.h"
+
+enum cp_cco_bw_persistence_t
+{
+ CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT,
+ CP_CCO_BW_PERSISTENCE_PERSISTENT
+};
+typedef enum cp_cco_bw_persistence_t cp_cco_bw_persistence_t;
+
+/**
+ * Allocation of a connection
+ */
+struct cp_cco_bw_alloc_t
+{
+ /**
+ * Start time persistent flag.
+ */
+ bool stpf;
+
+ /**
+ * Start Time of the allocation ATU
+ */
+ u16 st_atu;
+
+ /**
+ * End Time of the allocation ATU
+ */
+ u16 et_atu;
+
+ /**
+ * GLID of the allocation
+ */
+ u8 glid;
+
+ /**
+ * Connection identifier
+ */
+ u16 cid;
+
+ /**
+ * Persistence of the allocation. Value not defined yet (maybe regarding
+ * to the priority)
+ */
+ cp_cco_bw_persistence_t persistence;
+
+ /**
+ * Duration of the persitence in number of beacon period
+ */
+ u8 duration_persistence;
+
+ /**
+ * Node of the list of alloc
+ */
+ list_node_t node;
+
+ /**
+ * Node for beacon use
+ */
+ set_node_t set_node;
+
+};
+typedef struct cp_cco_bw_alloc_t cp_cco_bw_alloc_t;
+
+/**
+ * Bandwidth Manager Module. - Create the schedule - Allocate a specific
+ * connection - finalise and return a schedule (used by the Beacon module
+ * only)
+ */
+struct cp_cco_bw_t
+{
+ /**
+ * Priority heap list
+ */
+ cp_cco_bw_prio_heap_t prio_heap[CP_CCO_BW_NB_PRIORITY_HEAPS];
+
+ /**
+ * Actual schedule
+ */
+ list_t actual_schedule;
+
+ /**
+ * Finalised schedule
+ */
+ list_t finalised_schedule;
+
+ /**
+ * Number of persistent allocation in the actual schedule
+ */
+ u16 nb_alloc_pers_actual;
+
+ /**
+ * Number of non persistent alloaction in the actual schedule
+ */
+ u16 nb_alloc_no_pers_actual;
+
+ /**
+ * Number of persistent allocation in the finalised schedule
+ */
+ u16 nb_alloc_pers_finalised;
+
+ /**
+ * Number of non persistent alloaction in the finalised schedule
+ */
+ u16 nb_alloc_no_pers_finalised;
+};
+typedef struct cp_cco_bw_t cp_cco_bw_t;
+
+/**
+ * Allocate at the beginning of the beacon period
+ * \param ctx Control plane context
+ * \param duration duration of the allocation
+ * \param glid GLID of the allocation
+ *
+ * Only allocate at the first free space doesnt take care of the time between
+ * the allocations
+ */
+void
+cp_cco_bw_alloc_beginning (cp_t *ctx, u16 duration, u8 glid);
+
+/**
+ * Allocate a complete Schedule.
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_alloc_sched (cp_t *ctx);
+
+/**
+ * Allocates a unique connection.
+ * \param ctx Control Plane Context
+ * \param conn Connection to allocate
+ * \return Result of the allocation True if the allocation has been done
+ * False if not enough free allocation time
+ *
+ */
+bool
+cp_cco_bw_alloc (cp_t *ctx, cp_link_t *link, u16 cid);
+
+/**
+ * This function will initialise a new schedule.
+ * \param ctx control plane context
+ * \return \todo fill this
+ *
+ */
+void
+cp_cco_bw_new_sched (cp_t *ctx);
+
+/**
+ * Finalise schedule
+ *
+ * \param ctx control plane context
+ * This function as to be called before asking for the schedule
+ * Fills the free fields with bonus allocation if there is not enough
+ * time for CSMA. Otherwise it fills with CSMA
+ */
+void
+cp_cco_bw_finalise_sched(cp_t *ctx);
+
+/**
+ * Checks if the state of the connection that are not allocated have changed
+ * and init their new state
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_check_conn_state(cp_t *ctx);
+
+/**
+ * Clears the connections passing the new states to old
+ * and initiating the new to OUT state
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_clear_conn_state(cp_t *ctx);
+
+/**
+ * Move to the next free time allocation. Set the previous and next
+ * allocation.
+ * \param ctx Control Plane Context
+ * \param prev_alloc Previous allocation
+ * \param next_alloc Next allocation
+ * \return true if there is another free time space otherwise false and of
+ * the allocations
+ *
+ */
+bool
+cp_cco_bw_set_next_free_time_space(cp_t *ctx,
+ cp_cco_bw_alloc_t **prev_alloc,
+ cp_cco_bw_alloc_t **next_alloc);
+/**
+ * Return the first element of the finalised schedule persistent or not
+ * persistent.
+ * \param ctx Control Plane Context
+ * \param persistence persistent or not persistent
+ * \return the first element of the schedule
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc (cp_t *ctx, cp_cco_bw_persistence_t persistence);
+
+/**
+ * Return the next allocation of the finalised schedule persistent or not
+ * \param ctx control plane context
+ * \param prev_alloc previous allocation
+ * \return the next allocation
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc (cp_t *ctx, cp_cco_bw_alloc_t *prev_alloc);
+
+/**
+ * Return the first element of the actual schedule persistent or not
+ * persistent.
+ * \param ctx Control Plane Context
+ * \param persistence persistent or not persistent
+ * \return the first element of the schedule
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc_actual_from_persistence (cp_t *ctx, cp_cco_bw_persistence_t persistence);
+
+/**
+ * Return the next allocation of the actual schedule persistent or not
+ * \param ctx control plane context
+ * \param prev_alloc previous allocation
+ * \return the next allocation
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc_actual_from_persistence (cp_t *ctx, cp_cco_bw_alloc_t *prev_alloc);
+
+/**
+ * Return the number of allocation of the finalised schedule persistent or not
+ * \param ctx control plane context
+ * \param persistence persistent or not persistent
+ * \return return the number of allocation
+ *
+ */
+u16
+cp_cco_bw_get_nb_alloc(cp_t *ctx, cp_cco_bw_persistence_t persistence);
+
+/**
+ * Return the number of allocation of the actual schedule persistent or not
+ * \param ctx control plane context
+ * \param persistence persistent or not persistent
+ * \return return the number of allocation
+ *
+ */
+u16
+cp_cco_bw_get_nb_alloc_actual(cp_t *ctx, cp_cco_bw_persistence_t persistence);
+
+/**
+ * Init of the BW manager.
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_init (cp_t* ctx);
+
+/**
+ * uninit the bandwidth manager allocations.
+ * \param ctx control plane context
+ *
+ */
+void
+cp_cco_bw_uninit (cp_t* ctx);
+
+/** add an allocation to the finalised schedule
+ * \param ctx the control plane context.
+ * \param alloc the allocation.
+ */
+void
+cp_cco_bw_alloc_add_finalised (cp_t *ctx, cp_cco_bw_alloc_t *alloc);
+
+/** add an allocation to the actual schedule
+ * \param ctx the control plane context.
+ * \param alloc the allocation.
+ */
+void
+cp_cco_bw_alloc_add (cp_t *ctx, cp_cco_bw_alloc_t *alloc);
+
+/** Remove an allocation from the actual schedule
+ * \param ctx the control plane context.
+ * \param alloc the allocation.
+ * \return result of the operation true if remove donne
+ */
+void
+cp_cco_bw_alloc_remove(cp_t *ctx, cp_cco_bw_alloc_t *alloc);
+
+/** Remove an allocation from the finalise schedule
+ * \param ctx the control plane context.
+ * \param alloc the allocation.
+ * \return result of the operation true if remove donne
+ */
+void
+cp_cco_bw_alloc_remove_finalised(cp_t *ctx, cp_cco_bw_alloc_t *alloc);
+
+/** Remove an allocation regarding its CID
+ * \param ctx the control plane context.
+ * \param cid connection identifier
+ * \return result of the operation true if remove donne
+ */
+void
+cp_cco_bw_alloc_remove_cid (cp_t *ctx, u16 cid);
+
+/**
+ * Returns the first allocation of a connection
+ * \param ctx Control Plane context
+ * \param cid Connection identifier
+ * \return the allocation
+ *
+ * This function is used with the cp_cco_bw_alloc_get_next function because of
+ * the multiple TXOPs.
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_alloc_get_first_txop(cp_t *ctx, u16 cid);
+
+/**
+ * Return the next allocation of the same connection
+ * \param ctx Control Plane context
+ * \param alloc previous allocation
+ * \return The next allocation of the same connection. If there is none is
+ * return NULL.
+ *
+ * This function is necessary because of the multiple TXOP possibilites.
+ */
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_alloc_get_next_txop(cp_t *ctx, cp_cco_bw_alloc_t* alloc);
+/**
+ * Uninit the actual schedule allocations
+ * \param ctx Control Plane context
+ *
+ */
+void
+cp_cco_bw_uninit_actual_sched(cp_t *ctx);
+
+#endif /* cp_cco_bw_h */
diff --git a/cesar/cp/cco/bw/bw_lib_alloc.h b/cesar/cp/cco/bw/bw_lib_alloc.h
new file mode 100644
index 0000000000..28dc3270d4
--- /dev/null
+++ b/cesar/cp/cco/bw/bw_lib_alloc.h
@@ -0,0 +1,82 @@
+#ifndef cp_ccp_cco_bw_bw_lib_alloc_h
+#define cp_ccp_cco_bw_bw_lib_alloc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cco/bw/bw_lib_alloc.h
+ * \brief schedules allocation.
+ * \ingroup cp_cco_bw
+ *
+ */
+#include "cp/cco/bw/bw.h"
+
+/** Initialise the SET.
+ * \param set the set to initialise.
+ */
+void
+cp_cco_bw_schedules_init (set_t *set);
+
+/** Uninitialise the SET.
+ * \param set the set to initialise.
+ */
+void
+cp_cco_bw_schedules_uninit (set_t *set);
+
+/** Prepare schedules.
+ * \param ctx the module context.
+ * \param set the set to add the allocations.
+ * \param persistence the type of allocation.
+ *
+ * Get the schedules form the BW and initialise the nodes of each alloc to
+ * insert it in the set.
+ */
+void
+cp_cco_bw_schedules_prepare (cp_t *ctx, set_t *set,
+ cp_cco_bw_persistence_t persistence);
+
+/** Add an allocation.
+ * \param set the set to add the allocation.
+ * \param node the node to add.
+ * \param write true if the node is not only hold by this set.
+ */
+void
+cp_cco_bw_schedules_add (set_t *set, cp_cco_bw_alloc_t *alloc,
+ bool write);
+
+/** Get the first allocation.
+ * \param set the set.
+ * \return the first allocation of the set.
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_schedules_get_first (set_t *set);
+
+/** Get the next allocation.
+ * \param set the set.
+ * \return the first allocation of the set.
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_schedules_get_next (set_t *set, cp_cco_bw_alloc_t* alloc);
+
+/**
+ * Compare two nodes.
+ * \param left Left node.
+ * \param right Right node.
+ * \return true if the left node is lesser than the right one
+ */
+bool
+cp_cco_bw_schedules_allocation_less (set_node_t * left,
+ set_node_t * right);
+
+/** Move the nodes from the source set to the dest set.
+ * \param set_dest the destination set.
+ * \param set_src the source set.
+ */
+void
+cp_cco_bw_schedules_move (set_t *set_dest, set_t *set_src);
+
+#endif /* cp_ccp_cco_bw_bw_lib_alloc_h */
diff --git a/cesar/cp/cco/bw/bw_prio_heap.h b/cesar/cp/cco/bw/bw_prio_heap.h
new file mode 100644
index 0000000000..e88ba70e3f
--- /dev/null
+++ b/cesar/cp/cco/bw/bw_prio_heap.h
@@ -0,0 +1,121 @@
+#ifndef cp_cco_bw_prio_heap_h
+#define cp_cco_bw_prio_heap_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp_cco_bw_prio_heap.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "lib/list.h"
+#include "cp/cp.h"
+
+/**
+ * connection storage regarding to its priority and time arrival.
+ */
+struct cp_cco_bw_prio_conn_t
+{
+ /**
+ * connection identifier
+ */
+ u16 cid;
+
+ /**
+ * Allocation status true : allocated false : not allocated
+ */
+ bool alloc_status;
+
+ /**
+ * Node of the List
+ */
+ list_node_t node;
+
+};
+typedef struct cp_cco_bw_prio_conn_t cp_cco_bw_prio_conn_t;
+
+/**
+ * Table that stores the pending connection in order of arrival. Each
+ * table has a specific priority level assigned (0 to 3). It manages the
+ * order and return the most prior connection
+ */
+struct cp_cco_bw_prio_heap_t
+{
+ /**
+ * level of priority of the heap (4 different levels)
+ */
+ u8 table_priority_level;
+
+ /**
+ * stage of the allocation. Faster to get to the next connection to
+ * allocate.
+ */
+ u32 nb_conn_allocated;
+
+ /**
+ * Number of connection into the heap
+ * */
+ u32 nb_conn;
+
+ /**
+ * first connection of the heap
+ */
+ list_t conns;
+
+};
+typedef struct cp_cco_bw_prio_heap_t cp_cco_bw_prio_heap_t;
+
+/*
+ * gets the most prior pending connection return its CID.
+ * \param ctx the module context.
+ * \return \todo fill this
+ *
+ */
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_get_most_prior_conn (cp_t *ctx);
+
+/**
+ * delete a connection.
+ * \param ctx the module context.
+ * \param cid Connection identifier
+ *
+ */
+void
+cp_cco_bw_prio_heap_del_conn (cp_t *ctx, u16 cid);
+
+/**
+ * add a connection.
+ * \param ctx the module context.
+ * \param cid Connection identifier
+ *
+ */
+void
+cp_cco_bw_prio_heap_add_conn (cp_t *ctx, u16 cid, u8 prio);
+
+/**
+ * Clears the status of the allocation
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_prio_heap_clear_conn(cp_t *ctx);
+
+/**
+ * Init function
+ */
+void
+cp_cco_bw_prio_heap_init(cp_t *ctx);
+
+/**
+ * Uninit function
+ */
+void
+cp_cco_bw_prio_heap_uninit(cp_t *ctx);
+
+#endif /* cp_cco_bw_prio_heap_h */
diff --git a/cesar/cp/cco/bw/doc/Bandwidth_Manager.odt b/cesar/cp/cco/bw/doc/Bandwidth_Manager.odt
new file mode 100755
index 0000000000..73ffeb0f08
--- /dev/null
+++ b/cesar/cp/cco/bw/doc/Bandwidth_Manager.odt
Binary files differ
diff --git a/cesar/cp/cco/bw/doc/bw.xmi b/cesar/cp/cco/bw/doc/bw.xmi
new file mode 100644
index 0000000000..c0961b7598
--- /dev/null
+++ b/cesar/cp/cco/bw/doc/bw.xmi
@@ -0,0 +1,1265 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-08-06T11:36:01" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="UML Model" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="MSG Module" isRoot="false" isAbstract="false" name="MSG Module" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="CCo Action Module" isRoot="false" isAbstract="false" name="CCo Action Module" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Bandwidth Manager Module" isRoot="false" isAbstract="false" name="Bandwidth Manager Module" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OqFNT55UVzVU" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0widC5QuvWxy" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="irUbdfzRtLuy" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OMTNsx2stiV3" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="luyeQvc8m5hN" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="kfod0hZO32mt" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xmmoTFsE9otX" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="jTfTYNoH0asy" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="HSMJS6CQrwCI" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="C4WJsNrZpU0N" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pocpPVnex8xP" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" comment="Start Time" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="huvuRoPtpoED" isRoot="false" isAbstract="false" name="cp_st_t" />
+ <UML:DataType stereotype="datatype" comment="End Time" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TJR8rTv6HJGr" isRoot="false" isAbstract="false" name="cp_et_t" />
+ <UML:DataType stereotype="datatype" comment="Connection Specification" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZCvyT3nV6461" isRoot="false" isAbstract="false" name="cp_cspec_t*" />
+ <UML:DataType stereotype="datatype" comment="Connection information" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BlOcERrdVcJi" isRoot="false" isAbstract="false" name="cp_cinfo_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nKah2FElYQjf" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" comment="Connection " isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qpL5yhMnv5m5" isRoot="false" isAbstract="false" name="cp_conn_t*" />
+ <UML:DataType stereotype="datatype" comment="Control Plane Context" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3Xrk8GDGycgY" isRoot="false" isAbstract="false" name="cp_t*" />
+ <UML:DataType stereotype="datatype" comment="connection allocation" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="M6xKR1cFPIwW" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_alloc_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" comment="Received MME" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="iSF0bbc1ufLz" isRoot="false" isAbstract="false" name="cp_mme_rx_t*" />
+ <UML:DataType stereotype="datatype" comment="Sending MME" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="rXf3L5yLNrBT" isRoot="false" isAbstract="false" name="cp_mme_tx_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="9kqqNN6qIMaD" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" comment="heap of connection of a specific priority stored regarding their time arrival" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="S1gNUo1cYqQt" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_prio_heap_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="D9PiHaAGBCIb" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qx03D9bX8Zse" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eoUNxGuvIuwA" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_conn_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LMD9GuDpzhxX" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_conn_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" comment="interval of a BLE (time and BLE)" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="l4plA4WjZ5hz" isRoot="false" isAbstract="false" name="cp_ble_interval_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="28emhDJMNjju" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CAMwXARcOr2q" isRoot="false" isAbstract="false" name="cp_cspec_field_status_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0FkJo3kMVDSV" isRoot="false" isAbstract="false" name="cp_link_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="d21ZFkuCFK5X" isRoot="false" isAbstract="false" name="cp_link_cinfo_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="y93NOeEZLD5e" isRoot="false" isAbstract="false" name="cp_link_qmp_t*" elementReference="3QNGiQmMsrXJ" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Z3fT7dhQPy4n" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="IoC0GToSkLgH" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="A8Jz1L2xHcVK" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="HtfvGG8l8Yj7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="5q2HdTVvIhvW" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Bkwt3dBBlSAm" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="3SUL0HC3J5nD" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="nBh3nCNq0N5e" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="paZ7GTbPBXIE" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="2lGX5o190Fyn" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ARPvuXfhiNiU" aggregation="composite" type="xnGQ9ti6LKXZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="X4KWRQAGyhLE" aggregation="none" type="akTdL0BuuMIi" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="mtZJnRKOO7ZU" isRoot="false" isAbstract="false" name="cp_conn_state_t" >
+ <UML:EnumerationLiteral comment="Connection actualy scheduled" isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="OX2HniyXbXoO" isRoot="false" isAbstract="false" name="IN" />
+ <UML:EnumerationLiteral comment="connection just added to the schedule a MME to confirm its presence into the schedule is needed." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="neVJeoamoZ5F" isRoot="false" isAbstract="false" name="ADD" />
+ <UML:EnumerationLiteral comment="Connection out of the schedule. This connection has to be cleared form the list." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="cqyEfU3313Im" isRoot="false" isAbstract="false" name="OUT" />
+ <UML:EnumerationLiteral comment="Connection just released normaly." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="loGfKRYwIW8x" isRoot="false" isAbstract="false" name="REL_NOR" />
+ <UML:EnumerationLiteral comment="Connection just released because of lack of Bandwidth space. " isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="80zKS1hCpxp7" isRoot="false" isAbstract="false" name="REL_BW" />
+ <UML:EnumerationLiteral comment="Connection just released because of connection specification pbs." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="eDMziEWTrzlV" isRoot="false" isAbstract="false" name="REL_CSPEC" />
+ <UML:EnumerationLiteral comment="Connection just released because it requested it." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="zRZGwOSgcWwz" isRoot="false" isAbstract="false" name="REL_REQ" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="t1BwC0faIOY6" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S9x8Wdc2hxY9" aggregation="aggregate" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LgNJNhWWd9p3" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="X4PpSxvCxRZk" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="3LgRDAgfJboo" aggregation="aggregate" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="FOowJM3e2RwN" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="vFMsgta757Na" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6StjZhld0P2D" aggregation="aggregate" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ZirqKfeX1STL" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="K35NPMr9taR3" isRoot="false" isAbstract="false" name="Classes" >
+ <UML:Namespace.ownedElement>
+ <UML:Class comment="Allocation of a connection" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="akTdL0BuuMIi" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Start Time of the allocation" isSpecification="false" visibility="public" xmi.id="WHgpgU3HDWsW" type="huvuRoPtpoED" name="st" />
+ <UML:Attribute comment="End Time of the allocation" isSpecification="false" visibility="public" xmi.id="2pv02ohjicc7" type="TJR8rTv6HJGr" name="et" />
+ <UML:Attribute comment="Pointer on the previous allocation" isSpecification="false" visibility="public" xmi.id="6CEonouBntNY" type="M6xKR1cFPIwW" name="prev_conn" />
+ <UML:Attribute comment="Pointer on the next allocation" isSpecification="false" visibility="public" xmi.id="6lmba4wqHNOl" type="M6xKR1cFPIwW" name="next_conn" />
+ <UML:Attribute comment="Persistence of the allocation. Value not defined yet (maybe regarding to the priority)" isSpecification="false" visibility="public" xmi.id="KtVJ3RkxxT7e" type="nKah2FElYQjf" name="presistence" />
+ <UML:Attribute comment="Start time persistent flag" isSpecification="false" visibility="public" xmi.id="dkbxTW5FavZS" type="irUbdfzRtLuy" name="stpf" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="jUHoqZsuISuy" type="9kqqNN6qIMaD" name="glid" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="9UW3dNtE8T9Z" type="qx03D9bX8Zse" name="cid" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="mVY4wQ05uW6V" type="9kqqNN6qIMaD" name="duration_persistence" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="rzhzQqWM5KrC" type="fn3T0g7mCdo8" name="node" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="3oBvIFO8C57d" type="vez0woDacG3c" name="set_node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="Bandwidth Manager Module" comment="Bandwidth Manager Module.
+- Create the schedule
+- Allocate a specific connection
+- finalise and return a schedule (used by the Beacon module only)" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="xnGQ9ti6LKXZ" isRoot="false" isAbstract="false" name="cp_cco_bw_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The actual schedule is the one is motion during the beacon period. It receives modifications regarding on the incoming MMEs. " isSpecification="false" visibility="public" xmi.id="8SVuiaBMFxkG" type="LMD9GuDpzhxX" name="actual_schedule" />
+ <UML:Attribute comment="the finalised schedule is the schedule final given to the Beacon module to be transformed into BENTRYs." isSpecification="false" visibility="public" xmi.id="IvjtyxL96U0O" type="LMD9GuDpzhxX" name="finalised_schedule" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="bMccUjua3QRe" type="tOgMBBDlVoLx" name="prio_heap[CP_CCO_BW_NB_PRIORITY_HEAPS]" />
+ <UML:Attribute comment="Number of persistent allocation in the actual schedule" isSpecification="false" visibility="private" xmi.id="qqpCp7AgWp2f" type="qx03D9bX8Zse" name="nb_alloc_pers_actual" />
+ <UML:Attribute comment="umber of non persistent alloaction in the actual schedule" isSpecification="false" visibility="private" xmi.id="yEOT2jRXwz6c" type="qx03D9bX8Zse" name="nb_alloc_no_pers_actual" />
+ <UML:Attribute comment="Number of persistent allocation in the finalised schedule" isSpecification="false" visibility="private" xmi.id="wHXJuWtlMix9" type="qx03D9bX8Zse" name="nb_alloc_pers_finalised" />
+ <UML:Attribute comment="Number of non persistent alloaction in the finalised schedule" isSpecification="false" visibility="private" xmi.id="o5qKsqxq4MK4" type="qx03D9bX8Zse" name="nb_alloc_no_pers_finalised" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="kZlArwfzKyf6" isRoot="false" isAbstract="false" isQuery="false" name="new_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZMv7zjxAvhNM" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocate a complete Schedule
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="O87gKQtsw1DR" isRoot="false" isAbstract="false" isQuery="false" name="alloc_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="6RTqCXJl2bsz" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocates a unique connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="6r5JBb3UvGb7" isRoot="false" isAbstract="false" isQuery="false" name="alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VpAthpuJcZuj" type="irUbdfzRtLuy" />
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="6m22OgadlX6q" value="" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="SjnLGAlGZvwN" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="8VFn5SRIJtio" isRoot="false" isAbstract="false" isQuery="false" name="finalise_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="X8GAwAWf7KHR" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="uninit the bandwidth manager allocations" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CX7QmGnNQfyu" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Finalise and return the schedule. Fills the free fields with bonus allocation if there is not enough time for CSMA. Otherwise it fills with CSMA." isSpecification="false" isLeaf="false" visibility="public" xmi.id="N8I7BjZIOdlW" isRoot="false" isAbstract="false" isQuery="false" name="get_next_alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="" type="LMD9GuDpzhxX" />
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="2RCfo71rfqbl" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4bO4EM12qaue" value="" type="LMD9GuDpzhxX" name="prev_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Init of the BW manager" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qDTUjKdqN9vB" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="rztSWU4nfOxL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="VNZrMxhseKAs" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LhtoKuOr2e0y" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Clears the connections passing the new states to old and initiating the new to OUT state
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="REvc418qnVEv" isRoot="false" isAbstract="false" isQuery="false" name="clear_conn_state" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3WKGgYni79mL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WlMKMGxlUqNX" isRoot="false" isAbstract="false" isQuery="false" name="set_next_free_time_space
+" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="eMmXZjl1djyO" type="irUbdfzRtLuy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sTLfzZY03sGh" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Uu0wkMRapmDm" value="" type="O1PWAArevDzF" name="prev_alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LlkPcy60zUW8" value="" type="O1PWAArevDzF" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="5NytACfVvOsX" isRoot="false" isAbstract="false" isQuery="false" name="uninit_actual_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MxWKR0S3MCYu" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="2dqv1jTNexf5" isRoot="false" isAbstract="false" isQuery="false" name="get_nb_alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vh1AX1VZcLUd" type="qx03D9bX8Zse" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="x76IKcCEw5lx" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocate at the beginning of the beacon period
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="2vygqejoln43" isRoot="false" isAbstract="false" isQuery="false" name="alloc_beginning" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QEHKJ3HEiGMF" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5ZkoNosn277K" value="" type="qx03D9bX8Zse" name="duration" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8MYqct3sinht" value="" type="9kqqNN6qIMaD" name="glid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="release the finalised schedule when it has been used (triggered by the Beacon module)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="29Uw34J8wOf4" isRoot="false" isAbstract="false" isQuery="false" name="release_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GbMzYAgg33TV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initiate the last ble and checks if the end of the free time has been reached." isSpecification="false" isLeaf="false" visibility="private" xmi.id="42UyQ92giMdG" isRoot="false" isAbstract="false" isQuery="false" name="get_alloc_ble" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZrY2nqzsglS3" type="irUbdfzRtLuy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DYfFa9DyHDdz" value="" type="JO1FHqi41DrK" name="first_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XEG2U9YoXX3m" value="" type="JO1FHqi41DrK" name="last_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NloMydf9BKMj" value="" type="qx03D9bX8Zse" name="nb_pb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5slaPoMkX84U" value="" type="TZfikGiIVwKz" name="alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lhdw1ydTVIBG" value="" type="TZfikGiIVwKz" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Calculate the best allocation time between 2 BLE" isSpecification="false" isLeaf="false" visibility="private" xmi.id="Xml5upZdXAZW" isRoot="false" isAbstract="false" isQuery="false" name="calculation_of_alloc_time" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8AzeT9s00O2m" value="" type="JO1FHqi41DrK" name="first_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ezeuk5xIpiLi" value="" type="JO1FHqi41DrK" name="last_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VuL02tV93UnW" value="" type="qx03D9bX8Zse" name="nb_pb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="34UrkpZDhuEk" value="" type="bfUc1UOFU09C" name="alloc_st" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="njtpBeJnHoNI" value="" type="bfUc1UOFU09C" name="alloc_et" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="D9bu1ncnWTcg" value="" type="TZfikGiIVwKz" name="alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5vRMhocyV7gC" value="" type="TZfikGiIVwKz" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="CCo Action Module" comment="- Functions reacting to incoming MME related to global connection.
+- Treatment of those MME
+- Storage and validation of the global connections
+- Control of the Bandwidth Manager's actions
+- React to the connections' states to send IND or CNF MME
+" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="ySeTGJOMEmYM" isRoot="false" isAbstract="false" name="cp_cco_action_t" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="he8aiM3PdmBs" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Operation comment="Function called after any allocation (complete schedule or single connection allocation)
+Study the state of the connections and send the MME related to those states.
+After sending those MMEs it clears the status.
+" isSpecification="false" isLeaf="false" visibility="private" xmi.id="QNnsMczV4BbV" isRoot="false" isAbstract="false" isQuery="false" name="mme_glink_send" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="Mwcl7hCpINk2" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_NEW.REQ
+
+Check the validity of the connection.
+Add the connection into the list of connections and the pending allocation list
+Call the bandwidth manager to redo the schedule
+Call cp_cco_action_mme_conn_cnf()" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4Jl61qfG7FdR" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_new_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="JQWhk2qSS5T3" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="XgvJotVBjB3x" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_REL.REQ
+
+Release the connection from the connections list and the pending allocation list
+Send the MME that will release the connection
+Call the bandwidth manager to redo the schedule " isSpecification="false" isLeaf="false" visibility="public" xmi.id="kWAzj2FfLSzz" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_rel_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="Ysh6LPKcpqHZ" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="MfPA26ZPsMEE" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_MOD.REQ
+
+Check the validity of the modifications
+Modify the connection's data
+Call the schedule function
+Check if the connection is still in the schedule
+Send the MME CNF with the result" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7f6S84QwyS5a" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="twxoZyefgG9F" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="Js8VgHGBvBVj" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_ALLOC_MOVE.REQ
+
+Check the validity of the connection.
+Memorise the position of the allocation
+Call the function that can allocate a unique connection.
+If it has allocated it somewhere else we delete the old allocation
+if not we keep the old allocation
+Send the MME CNF with the result
+Add the connection into the list of connections and the pending allocation list
+Call the bandwidth manager to redo the schedule
+Call cp_cco_action_mme_conn_cnf()" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VChtJRri78Bp" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_alloc_move_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="K8VzP5bG2Y5Z" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WjCAzMPBDokO" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process of a CC_BLE_UPDATE.IND. Actualisation of the BLE of a specific GLID. Call the Bandwidth Manager to redo the schedule." isSpecification="false" isLeaf="false" visibility="public" xmi.id="seYRAqbe0Jvw" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_ble_update_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="control plane context" isSpecification="false" visibility="private" xmi.id="e4ZuZ9iDlUSB" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming MME" isSpecification="false" visibility="private" xmi.id="7C9DGhT6JzVU" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Init function of the CCo" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DNsf89jKgseb" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="d9I6Xsav4TQb" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Uninit the cco action module (call the uninit function of lower ctx)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tR7lNfHrBJvJ" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Structure of a link." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Dd5IhQuqhODL" isRoot="false" isAbstract="false" name="cp_link_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="RP4g6QESrIGR" type="nKah2FElYQjf" name="status" />
+ <UML:Attribute comment="global link identifier" isSpecification="false" visibility="public" xmi.id="R4lfEOk34S06" type="9kqqNN6qIMaD" name="llid" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="sQEhgV9JJ0Rv" type="9kqqNN6qIMaD" name="glid" />
+ <UML:Attribute comment="connection information" isSpecification="false" visibility="public" xmi.id="y3j2Tj7pa9ls" type="BlOcERrdVcJi" name="cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="naiC13Fgjvwp" type="y93NOeEZLD5e" name="qmp" />
+ <UML:Attribute comment="forward BLE" isSpecification="false" visibility="public" xmi.id="2IFWtWCrXvs0" type="hQ7UEYOzATqF" name="list_ble" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="FMPxocle20Jj" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TS2kQReD1MO2" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ndi6WcvlwJhi" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tQKvOecr4caV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Table that stores the pending connection in order of arrival.
+Each table has a specific priority level assigned (0 to 3).
+It manages the order and return the most prior connection" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="pEl1C68UjFRR" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_heap_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="level of priority of the heap (4 different levels)" isSpecification="false" visibility="public" xmi.id="ooF6vpsKuOw1" type="9kqqNN6qIMaD" name="table_priority_level" />
+ <UML:Attribute comment="first connection of the heap" isSpecification="false" visibility="public" xmi.id="BoTNcsVT3vk5" type="hQ7UEYOzATqF" name="conns" />
+ <UML:Attribute comment="stage of the allocation. Faster to get to the next connection to allocate." isSpecification="false" visibility="public" xmi.id="AhBRVaG2kt6W" type="D9PiHaAGBCIb" name="nb_conn_allocated" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="vlplg1EMIh54" type="D9PiHaAGBCIb" name="nb_conn" />
+ <UML:Operation comment="gets the most prior pending connection return its CID" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BuYs8zIb3uMF" isRoot="false" isAbstract="false" isQuery="false" name="get_most_prior_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qSDgfvHVlaaj" type="9kqqNN6qIMaD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="delete a connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ArL3GjV2Yl6R" isRoot="false" isAbstract="false" isQuery="false" name="del_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="pjWQWF5WMF9W" value="" type="9kqqNN6qIMaD" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="add a connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="YyjQMfR7LmP8" isRoot="false" isAbstract="false" isQuery="false" name="add_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="p5JBnSFxHYyV" value="" type="9kqqNN6qIMaD" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Clears the status of the allocation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="FG15yw3gMB8Z" isRoot="false" isAbstract="false" isQuery="false" name="clear_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hWWrzM6s8tcm" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="uq9DVEHiSGoP" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Cr3X0B4hgaZd" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="udW0X6nRwucP" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6r5Z8twIjzph" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="connection storage regarding to its priority and time arrival." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="niNHo3iBMi93" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_conn_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="connection identifier
+" isSpecification="false" visibility="public" xmi.id="kC9bWRewTRAy" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="me7r6SxasvES" type="irUbdfzRtLuy" name="alloc_status" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="iHTllYAzskuy" type="fn3T0g7mCdo8" name="node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Connection Specification" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="d8mKKcTJhtMZ" isRoot="false" isAbstract="false" name="cp_link_qmp_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Delay Bound" isSpecification="false" visibility="public" xmi.id="gTg5YO0BUnWp" type="D9PiHaAGBCIb" name="delay" />
+ <UML:Attribute comment="jitter bound" isSpecification="false" visibility="public" xmi.id="Px64qTbAFKMM" type="D9PiHaAGBCIb" name="jitter" />
+ <UML:Attribute comment="Average MPDU size" isSpecification="false" visibility="public" xmi.id="hmYsthba8Gdh" type="qx03D9bX8Zse" name="av_MPDU_size" />
+ <UML:Attribute comment="Maximum MPDU size" isSpecification="false" visibility="public" xmi.id="eds9OOwnK2pA" type="qx03D9bX8Zse" name="max_MPDU_size" />
+ <UML:Attribute comment="Average data rate" isSpecification="false" visibility="public" xmi.id="TRLilh2QRZHL" type="qx03D9bX8Zse" name="av_data_rate" />
+ <UML:Attribute comment="Minimum data rate" isSpecification="false" visibility="public" xmi.id="nR9txDa68QcP" type="qx03D9bX8Zse" name="min_data_rate" />
+ <UML:Attribute comment="Maximum data rate" isSpecification="false" visibility="public" xmi.id="Cw0z3lDbs9ub" type="qx03D9bX8Zse" name="max_data_rate" />
+ <UML:Attribute comment="Maximum inter-TXOP time" isSpecification="false" visibility="public" xmi.id="8ZogWKRHjaAg" type="qx03D9bX8Zse" name="max_inter_TXOP" />
+ <UML:Attribute comment="Minimum inter TXOP time" isSpecification="false" visibility="public" xmi.id="mlls9LFKFFJI" type="qx03D9bX8Zse" name="min_inter_TXOP" />
+ <UML:Attribute comment="Maximum burst time" isSpecification="false" visibility="public" xmi.id="0UtqdlSmLEQp" type="qx03D9bX8Zse" name="max_burst" />
+ <UML:Attribute comment="Exception Policy" isSpecification="false" visibility="public" xmi.id="Xp6GQEvAxe07" type="9kqqNN6qIMaD" name="exception" />
+ <UML:Attribute comment="Inatictivity interval" isSpecification="false" visibility="public" xmi.id="zFRFUiXUCPJp" type="D9PiHaAGBCIb" name="inactivity" />
+ <UML:Attribute comment="MSDU error rate" isSpecification="false" visibility="public" xmi.id="AlZTxyIUnMlB" type="qx03D9bX8Zse" name="MSDU_error_rate" />
+ <UML:Attribute comment="Convergence Layer SAP Type" isSpecification="false" visibility="public" xmi.id="ZeJWIJbFY2U0" type="9kqqNN6qIMaD" name="CLST" />
+ <UML:Attribute comment="ATS tolerance" isSpecification="false" visibility="public" xmi.id="i0TuNmiXVFzS" type="qx03D9bX8Zse" name="ATS" />
+ <UML:Attribute comment="Smallest Tolerable Average Data rate" isSpecification="false" visibility="public" xmi.id="DHxzcgABIUha" type="qx03D9bX8Zse" name="min_tol_data" />
+ <UML:Attribute comment="Original average Data rate" isSpecification="false" visibility="public" xmi.id="nHpKJIK2Gnub" type="qx03D9bX8Zse" name="ori_av_data_rate" />
+ <UML:Attribute comment="RX window size" isSpecification="false" visibility="public" xmi.id="Xa82q7T1NOyx" type="qx03D9bX8Zse" name="rx_window" />
+ <UML:Attribute comment="Smoothing buffer size" isSpecification="false" visibility="public" xmi.id="498MbnuM4hgM" type="D9PiHaAGBCIb" name="smoothing:24" />
+ <UML:Attribute comment="Bidirectional burst" isSpecification="false" visibility="public" xmi.id="xzMBkEmIptId" type="9kqqNN6qIMaD" name="bidir_burst" />
+ <UML:Attribute comment="Number of TXOPs per beacon" isSpecification="false" visibility="public" xmi.id="ylcJ9bGBiMVJ" type="9kqqNN6qIMaD" name="nb_TXOP" />
+ <UML:Attribute comment="Average number of PBs per TXOP" isSpecification="false" visibility="public" xmi.id="8NdA5IU0HqCz" type="qx03D9bX8Zse" name="av_nb_pb" />
+ <UML:Attribute comment="Maximum number of PBs per TXOP" isSpecification="false" visibility="public" xmi.id="3wFspYTmH35P" type="qx03D9bX8Zse" name="max_nb_pb" />
+ <UML:Attribute comment="Pending PB threshold" isSpecification="false" visibility="public" xmi.id="eKaKe4bmRFvU" type="qx03D9bX8Zse" name="ppb_threshold" />
+ <UML:Attribute comment="Surplus of Bandwidth" isSpecification="false" visibility="public" xmi.id="XPVmEflHbz7P" type="qx03D9bX8Zse" name="surplus_bw" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="cinfo structure" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Q60RU8Qxt2jh" isRoot="false" isAbstract="false" name="cp_link_cinfo_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Validity : 0x00 not valid ; 0x01 valid" isSpecification="false" visibility="public" xmi.id="BCj7uWVLsuTg" type="9kqqNN6qIMaD" name="valid_cinfo" />
+ <UML:Attribute comment="type of connection requested" isSpecification="false" visibility="public" xmi.id="OMIbwSMKXMj1" type="9kqqNN6qIMaD" name="mac_service_t" />
+ <UML:Attribute comment="CAP" isSpecification="false" visibility="public" xmi.id="Eu76mal8u3ho" type="9kqqNN6qIMaD" name="user_priority" />
+ <UML:Attribute comment="Transfer of the ATS to the HLE : 0x00 not 0x01 passed" isSpecification="false" visibility="public" xmi.id="U38zOryr0uB8" type="9kqqNN6qIMaD" name="ats" />
+ <UML:Attribute comment="0x00 no smoothing 0x01 smoothing if possible" isSpecification="false" visibility="public" xmi.id="ZCRPvpA9hHET" type="9kqqNN6qIMaD" name="smoothing" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Structure of a connection. Add, delete, return a link." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="adjwEdq884ob" isRoot="false" isAbstract="false" name="cp_conn_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Connection identifier" isSpecification="false" visibility="public" xmi.id="Iz4rTWTxS3n0" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Attribute comment="Forward link id (global or local)" isSpecification="false" visibility="public" xmi.id="bdStR08xCgmF" type="0FkJo3kMVDSV" name="flink" />
+ <UML:Attribute comment="Reverse link id (local or global)" isSpecification="false" visibility="public" xmi.id="PKGfk5LGn3bJ" type="0FkJo3kMVDSV" name="rlink" />
+ <UML:Attribute comment="connection state" isSpecification="false" visibility="public" xmi.id="q86HxGHLiEfh" type="mtZJnRKOO7ZU" name="old_conn_state" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="WeNEbK4sTNyR" type="Bv4qUQAgGcnc" name="type" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="eptSFkclMxyx" type="F2oiQk9bfCP9" name="conn_info" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="aYoq8ZSkOLCb" type="mtZJnRKOO7ZU" name="new_conn_state" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="cBHp8bzlZhfx" type="9kqqNN6qIMaD" name="request_id" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="lsIYD0TogXRd" type="6sEW3jvdsAQ0" name="osa" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="lNlK5PFoHXMS" type="6sEW3jvdsAQ0" name="oda" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="gr9Y2XYluI6x" type="fLjwr6MNuZXD" name="violated_cspec" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="EKdjKZFyRMXT" type="fLjwr6MNuZXD" name="modified_cspec" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="t3ElLIjycSsT" type="fn3T0g7mCdo8" name="node" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WFqOmNayfDhz" isRoot="false" isAbstract="false" isQuery="false" name="init_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AYmkyfDTs3re" type="qpL5yhMnv5m5" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nuwEETf5Wrrq" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="OPd3dI1QBxcP" isRoot="false" isAbstract="false" isQuery="false" name="add_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OHVu8KiGsV0q" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8BJ0C9eaYFcB" value="" type="qpL5yhMnv5m5" name="conn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="YdZhYB6wQZoX" isRoot="false" isAbstract="false" isQuery="false" name="del_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tVllymc6vt68" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0kiZyIiWvIDR" value="" type="qx03D9bX8Zse" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="RHNsrCNkh8Uf" isRoot="false" isAbstract="false" isQuery="false" name="get_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sJQKu9biFdAR" type="qpL5yhMnv5m5" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s4loxpwyZcVV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vD1oTCGtSbjJ" value="" type="qx03D9bX8Zse" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="n61SEV75ZqtV" isRoot="false" isAbstract="false" isQuery="false" name="check_conn_validity" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SdoXJt4CCUU5" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fnRDPuiI7i5Z" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6GWe4N9kAYvY" value="" type="qpL5yhMnv5m5" name="conn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="d6nqhvGn9kPE" isRoot="false" isAbstract="false" isQuery="false" name="get_free_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="V8MvjMfCSZn1" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8WwG4rmUSb2k" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="S6wdZOiCST19" isRoot="false" isAbstract="false" isQuery="false" name="get_free_llid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yVCOyDYKSRoR" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MHvW1Ik7peOr" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="connection list manager. add, delete, return, modify and check the validity of the connections." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Ffpcevz092To" isRoot="false" isAbstract="false" name="cp_conn_mgr_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="bYj9JToa9uKf" type="hQ7UEYOzATqF" name="conns" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="9kRYzQhfAceh" isRoot="false" isAbstract="false" isQuery="false" name="garbage_conn" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="wiccWDa1IGB0" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_new_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s7Ltc57HQDvY" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wM97NSNHAxte" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="ARdRgpRYumPW" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_new_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rWlFjgoe0vlL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="O8dW5U9Ewkdc" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="X48RoXwe1hti" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_rel_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OfMMb5ixDJRH" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nYThH6Jo8PEu" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="uAWvrOeD1yYc" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_rel_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4EXFXxUITv0k" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zHX7hj0brWVg" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="u7uw5QW7e2LB" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xpTQjR9ijeoO" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NozCISsDZm7f" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Cbkob5zYtRxc" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_mod_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s4KZi6x3uvFD" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="N7OxsTa22Kre" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="OoAFD7r499dr" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_info_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8M19fqn3fxIq" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="37uCEY2U5sbZ" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="yuO7aB8gV7pA" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_info_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ycBbYRRbYMll" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="snFxeqUcjshJ" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="3nxXunhqNtRt" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_add_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IrSpDEa3znyd" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eSDNIueKfbra" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="MYQkPqdgh6Vs" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_add_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="I5vHsrtUH6pZ" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zTte3iEPFd7c" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="TjI8pn05stMj" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kFD1K1YJSQxV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8AtNl00CjGKW" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="4KbuDwdv9pwT" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_mod_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qSkIsimzqfMb" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dKnLb7pdPPXc" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="J9VSwPumre2k" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_rel_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KmjAP3l3MYMv" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dBY2Y3crA7I6" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WCqMot49dnJ3" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_sqz_req_rx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="o368ZQ3DZZD8" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bqxlvFqQPgmE" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="XqLBbcEPfIWF" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_sqz_cnf_rx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="iXQF7dNgRLRN" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YHnywZATPVc0" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="7qNl6tymRO2W" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zNCRgboFrbBl" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="M9nDiyyqHBL5" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0ozdebNMCsR8" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="ble interval values" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="oE5CCxttNgAF" isRoot="false" isAbstract="false" name="cp_ble_interval_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="ble value" isSpecification="false" visibility="public" xmi.id="7MBbDW5Dfddz" type="9kqqNN6qIMaD" name="ble" />
+ <UML:Attribute comment="end time" isSpecification="false" visibility="public" xmi.id="rWKEXa4Lo7W0" type="qx03D9bX8Zse" name="et" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="yi3iuDTAFpl9" type="fn3T0g7mCdo8" name="node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vQr3syDVnjwt" isRoot="false" isAbstract="false" name="Class Diagram" >
+ <UML:Namespace.ownedElement/>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="64" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1313" snapy="10" showatts="1" xmi.id="Vi7xSEHjGpDi" documentation="" type="1" showops="1" showpackage="0" name="bw" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1322" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="433" showattsigs="601" x="258" fillcolor="#ffffc0" y="489" showopsigs="601" linewidth="none" height="171" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="ySeTGJOMEmYM" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="1309" showattsigs="601" x="0" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="432" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="xnGQ9ti6LKXZ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="447" showattsigs="601" x="0" fillcolor="#ffffc0" y="778" showopsigs="601" linewidth="none" height="360" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Ffpcevz092To" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="201" showattsigs="601" x="715" fillcolor="#ffffc0" y="673" showopsigs="601" linewidth="none" height="198" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="pEl1C68UjFRR" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="179" showattsigs="601" x="707" fillcolor="#ffffc0" y="933" showopsigs="601" linewidth="none" height="81" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="niNHo3iBMi93" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="271" showattsigs="601" x="1009" fillcolor="#ffffc0" y="477" showopsigs="601" linewidth="none" height="225" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="akTdL0BuuMIi" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="307" x="985" fillcolor="#ffffc0" y="761" linewidth="none" height="90" usefillcolor="1" isinstance="0" xmi.id="0AFakTbKOjhV" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" linewidth="none" widgetbid="Ffpcevz092To" widgetaid="ySeTGJOMEmYM" xmi.id="U9HR73bnbWVt" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="474" starty="660" />
+ <endpoint endx="298" endy="778" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="5" indexa="4" totalcountb="2" indexb="1" linewidth="none" widgetbid="akTdL0BuuMIi" widgetaid="xnGQ9ti6LKXZ" xmi.id="2lGX5o190Fyn" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="1047" starty="432" />
+ <endpoint endx="1009" endy="589" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="1049" fillcolor="none" y="434" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="FiKARf3qnV0Z" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="15" x="992" fillcolor="none" y="565" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="xHPX7xRpKfxS" text="*" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="5" indexa="3" totalcountb="2" indexb="1" linewidth="none" widgetbid="pEl1C68UjFRR" widgetaid="xnGQ9ti6LKXZ" xmi.id="w2GO5CvfhZ6h" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="785" starty="432" />
+ <endpoint endx="815" endy="673" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="767" fillcolor="none" y="434" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="aShqn052gNB6" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="817" fillcolor="none" y="649" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="0CuliuLdAkAH" text="4" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="5" indexb="1" linewidth="none" widgetbid="xnGQ9ti6LKXZ" widgetaid="Ffpcevz092To" xmi.id="iYWkSGRVz8hL" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="149" starty="778" />
+ <endpoint endx="261" endy="432" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="pEl1C68UjFRR" widgetaid="Ffpcevz092To" xmi.id="F2c5R39MF9xW" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="447" starty="958" />
+ <endpoint endx="715" endy="772" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="niNHo3iBMi93" widgetaid="pEl1C68UjFRR" xmi.id="iFQH9XCi3DbL" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="815" starty="871" />
+ <endpoint endx="796" endy="933" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="818" fillcolor="none" y="902" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="fb60G1QrS5hF" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="15" x="777" fillcolor="none" y="928" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="5kGj5Pn4bfpH" text="*" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="0AFakTbKOjhV" widgetaid="akTdL0BuuMIi" xmi.id="3qIL60CD7SL5" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="1144" starty="702" />
+ <endpoint endx="1138" endy="761" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="2" linewidth="none" widgetbid="xnGQ9ti6LKXZ" widgetaid="ySeTGJOMEmYM" xmi.id="pV8BBjAtfG0U" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="474" starty="489" />
+ <endpoint endx="523" endy="432" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Package>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="K9Fc7ya6eboZ" isRoot="false" isAbstract="false" name="cp_link_type_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="15F3QKNkRcLY" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="sSSMYaHXdXb3" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_LOCAL" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="k4qPW77MaXi6" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_GLOBAL" />
+ </UML:Enumeration>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fLjwr6MNuZXD" isRoot="false" isAbstract="false" name="cp_conn_cspec_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="hUapPz7FvDlL" type="qx03D9bX8Zse" name="cspec_len_oct" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="zURtIMQaYz3T" type="d21ZFkuCFK5X" name="f_cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="eU5DT9ejQFbr" type="d21ZFkuCFK5X" name="r_cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="AhzYLwKyyJVB" type="y93NOeEZLD5e" name="f_qmp" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="7Na3g6CkUZ0C" type="y93NOeEZLD5e" name="r_qmp" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0AFakTbKOjhV" isRoot="false" isAbstract="false" name="cp_cco_bw_persistence_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="0AFakTbKOjhV" xmi.id="0sn2w94wHHV1" isRoot="false" isAbstract="false" name="CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT" />
+ <UML:EnumerationLiteral comment="
+" isSpecification="false" isLeaf="false" visibility="public" namespace="0AFakTbKOjhV" xmi.id="HGkt98I7y37u" isRoot="false" isAbstract="false" name="CP_CCO_BW_PERSISTENCE_PERSISTENT" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="SE4drlhQgGnK" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="YAuit4zYf3Wu" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="2wlU1Qi48ymD" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5N0jdm3LnaNE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="NXHwD5ElD6T6" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BQdoR9gT4Ry3" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="b7KNffbX2W2O" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="pg6xcsBxPQta" aggregation="aggregate" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="V5LhCmnLAO9b" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="fpbgLd4VX8IR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Wq3YFzb3dh0F" aggregation="aggregate" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="X9AvY1V17piH" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="kz0I7IjzeXWP" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="ZUcksjJMXMul" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="JUowBm9huJcS" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="nVqR2Kp5JL6z" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L5RQuAhUcHCU" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yVpUqjF9B14L" aggregation="none" type="Dd5IhQuqhODL" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="FuUBzFE99m1F" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lD2fXc5qhXGc" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="0" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fv4HCGj8lYcZ" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="aRjAdPOlJ8Zo" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="GphRolkaymDT" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="OHJ6mXgRSkgc" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="iFQH9XCi3DbL" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="0PjjwLHA9yZx" aggregation="composite" type="pEl1C68UjFRR" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="jKVh6h9TwQXi" aggregation="none" type="niNHo3iBMi93" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="mfAF1Et9RgMb" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yD7Ovn1tAka6" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="3rGCpq8YAbEE" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="8NatufiLOVge" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="GLfClCsjNz8I" aggregation="none" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="k79vpkzsZG3P" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="1V4Vw7QgAqng" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="49vCi9QzU69G" aggregation="composite" type="ySeTGJOMEmYM" name="" multiplicity="0" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="G0xex3ui82bx" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rG6FnLTUU3xX" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="kaqJoris0e2i" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lTfGXnUlnPNk" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="w2GO5CvfhZ6h" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="RGQZI1X2cLLO" aggregation="composite" type="xnGQ9ti6LKXZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="C2FAgHsPiWfD" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Generalization isSpecification="false" child="ySeTGJOMEmYM" visibility="public" namespace="Logical View" xmi.id="he8aiM3PdmBs" parent="xnGQ9ti6LKXZ" discriminator="" name="" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="RdSzOM9ws9pF" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="J7z6VMqwcHVs" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="G2uqNEFXGUhu" aggregation="none" type="nKah2FElYQjf" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="TjLJsBY0YHzZ" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="jYJS4xfN4eRX" aggregation="composite" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zFTZUzSl1MbN" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="FZnmqkJSolys" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="YosoGag08ySA" aggregation="composite" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="v7XxkwVhByGg" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="A4CznApzfO14" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="xiPx3yIZnAO3" aggregation="composite" type="Dd5IhQuqhODL" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="i23q0T0vbVrJ" aggregation="none" type="nKah2FElYQjf" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5MhNVwbXrStj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="RM0bIEFExeBy" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="cRXNZtRIwS8u" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yGvogmXTI20E" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="w7qVafo01mbH" aggregation="none" type="pEl1C68UjFRR" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="0oVvSet25PQf" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yR77gv82Dngk" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="IrvCH37D8vij" aggregation="composite" type="d8mKKcTJhtMZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="aUjZGIqF6KAW" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="qzZi0HXSKdRg" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="y2Y2Rwfhlau3" aggregation="composite" type="Dd5IhQuqhODL" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="dzGksxTQRAxg" aggregation="none" type="Q60RU8Qxt2jh" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Ytu0ZEZIt40G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="QlvW55045W6W" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="TlCEJ4Hw3Wet" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yIAhg4g39Wum" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="R7JsFGYf1R95" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="V99agD57wHLF" aggregation="none" type="adjwEdq884ob" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="1ZrlQBx4omHB" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Lb9M5oFWtWM9" aggregation="aggregate" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="mtmlKwqp3xOh" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="SgCGphSMnicE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8To2iAH3jPNo" aggregation="none" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="DcI48eBsXyds" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="4n7CxO4qepqv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="sSfvN3dWURYC" aggregation="none" type="pEl1C68UjFRR" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ZoDGDa2OAKQI" aggregation="none" type="adjwEdq884ob" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="a1oSjxPd5iaz" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="zc8WakMSC0NZ" aggregation="none" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="1y3WOcgxOsCb" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="VqiqgPP0C8zY" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="SExbZNtWz22X" aggregation="composite" type="Dd5IhQuqhODL" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="kNzwNLTOJXsf" aggregation="none" type="oE5CCxttNgAF" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="hTFpkGG8AM5T" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="7XdVPp4p11Qa" aggregation="composite" type="d8mKKcTJhtMZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="MI6MK7t4Sryn" aggregation="none" type="nKah2FElYQjf" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="U9HR73bnbWVt" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="CPBTu291ZkUy" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="XWnYVC7sUBCm" aggregation="none" type="Ffpcevz092To" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="REz0iVtn4vkj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="G5qiumV4BfY4" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="hf5ENYCu4xQa" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="iYWkSGRVz8hL" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="9VSdhcPxfDea" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="x7e7kABPnEdA" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="eYhdhOxPg2Vx" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="mn2plTPsypWd" aggregation="composite" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="RtZ67De2IJ91" aggregation="none" type="Ffpcevz092To" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="AnXqp1nebv8V" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="RKQFZ2PJpS8Y" aggregation="composite" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="tXRpKvTjm2or" aggregation="none" type="adjwEdq884ob" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="8IfFoRAxojCs" isRoot="false" isAbstract="false" name="Sequence diagram" >
+ <UML:Namespace.ownedElement/>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="F2c5R39MF9xW" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="vpEiFLH6qgwB" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ZPsLRgBe957s" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="O1PWAArevDzF" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t**" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="JSU2EBtENyKy" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_prio_heap_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tOgMBBDlVoLx" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_heap_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fn3T0g7mCdo8" isRoot="false" isAbstract="false" name="list_node_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vez0woDacG3c" isRoot="false" isAbstract="false" name="set_node_t" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="3qIL60CD7SL5" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="uzLWSwcMq3VL" aggregation="composite" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="b6eRJhGydZaF" aggregation="none" type="0AFakTbKOjhV" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="hQ7UEYOzATqF" isRoot="false" isAbstract="false" name="list_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="JO1FHqi41DrK" isRoot="false" isAbstract="false" name="cp_link_ble_interval_t*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="TZfikGiIVwKz" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bfUc1UOFU09C" isRoot="false" isAbstract="false" name="u16*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Bv4qUQAgGcnc" isRoot="false" isAbstract="false" name="cp_conn_type_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="F2oiQk9bfCP9" isRoot="false" isAbstract="false" name="cp_conn_info_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="6sEW3jvdsAQ0" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3QNGiQmMsrXJ" isRoot="false" isAbstract="false" name="cp_link_qmp_t" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="OlUNXhoPpodj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Y5jetciDT1Nv" aggregation="aggregate" type="fLjwr6MNuZXD" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="db7ynB7GZlcl" aggregation="none" type="d8mKKcTJhtMZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="ap8aOZNHajls" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="JviO1prXuaBm" aggregation="aggregate" type="fLjwr6MNuZXD" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BsxctLYUudTh" aggregation="none" type="Q60RU8Qxt2jh" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="g8cNqwVSwwE6" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="oYwLJW6bRmzQ" aggregation="aggregate" type="d8mKKcTJhtMZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="cqvUP5EYxC8o" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="ZLxwL8UTBdI7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="XgIPJj55F1RX" aggregation="aggregate" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="XX8xI7LuvHOI" aggregation="none" type="fLjwr6MNuZXD" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yN55b1ltFiLX" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="MdoHpx5KbLhv" aggregation="aggregate" type="Dd5IhQuqhODL" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="3myIlNpJtxEB" aggregation="none" type="K9Fc7ya6eboZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="N6VU8JNOwH9n" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="2X5wmRE841Nr" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yQ9ZmrSpbR7N" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="pV8BBjAtfG0U" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="mvefssqvPvpC" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3IP4eF04Oaq" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="jiAAt6MpIubW" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="D0dpPjCCeqrU" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="giN3bCDwGUKI" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="LcsLN0ze8QIE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8ZHCvr17pcwF" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L6RxuISaypba" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="pRzkrBbewp0R" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="Vi7xSEHjGpDi" documentation="" uniqueid="mmKkWrMpTD8p" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="1" type="803" id="vQr3syDVnjwt" >
+ <listitem open="0" type="807" id="Vi7xSEHjGpDi" label="bw" />
+ </listitem>
+ <listitem open="1" type="803" id="K35NPMr9taR3" >
+ <listitem open="0" type="813" id="oE5CCxttNgAF" >
+ <listitem open="0" type="814" id="7MBbDW5Dfddz" />
+ <listitem open="0" type="814" id="rWKEXa4Lo7W0" />
+ <listitem open="0" type="814" id="yi3iuDTAFpl9" />
+ </listitem>
+ <listitem open="0" type="813" id="ySeTGJOMEmYM" >
+ <listitem open="0" type="815" id="QNnsMczV4BbV" />
+ <listitem open="0" type="815" id="4Jl61qfG7FdR" />
+ <listitem open="0" type="815" id="kWAzj2FfLSzz" />
+ <listitem open="0" type="815" id="7f6S84QwyS5a" />
+ <listitem open="0" type="815" id="VChtJRri78Bp" />
+ <listitem open="0" type="815" id="seYRAqbe0Jvw" />
+ <listitem open="0" type="815" id="DNsf89jKgseb" />
+ <listitem open="0" type="815" id="tR7lNfHrBJvJ" />
+ </listitem>
+ <listitem open="0" type="813" id="akTdL0BuuMIi" >
+ <listitem open="0" type="814" id="WHgpgU3HDWsW" />
+ <listitem open="0" type="814" id="2pv02ohjicc7" />
+ <listitem open="0" type="814" id="6CEonouBntNY" />
+ <listitem open="0" type="814" id="6lmba4wqHNOl" />
+ <listitem open="0" type="814" id="KtVJ3RkxxT7e" />
+ <listitem open="0" type="814" id="dkbxTW5FavZS" />
+ <listitem open="0" type="814" id="jUHoqZsuISuy" />
+ <listitem open="0" type="814" id="9UW3dNtE8T9Z" />
+ <listitem open="0" type="814" id="mVY4wQ05uW6V" />
+ <listitem open="0" type="814" id="rzhzQqWM5KrC" />
+ <listitem open="0" type="814" id="3oBvIFO8C57d" />
+ </listitem>
+ <listitem open="0" type="813" id="niNHo3iBMi93" >
+ <listitem open="0" type="814" id="kC9bWRewTRAy" />
+ <listitem open="0" type="814" id="me7r6SxasvES" />
+ <listitem open="0" type="814" id="iHTllYAzskuy" />
+ </listitem>
+ <listitem open="0" type="813" id="pEl1C68UjFRR" >
+ <listitem open="0" type="814" id="ooF6vpsKuOw1" />
+ <listitem open="0" type="814" id="BoTNcsVT3vk5" />
+ <listitem open="0" type="814" id="AhBRVaG2kt6W" />
+ <listitem open="0" type="814" id="vlplg1EMIh54" />
+ <listitem open="0" type="815" id="BuYs8zIb3uMF" />
+ <listitem open="0" type="815" id="ArL3GjV2Yl6R" />
+ <listitem open="0" type="815" id="YyjQMfR7LmP8" />
+ <listitem open="0" type="815" id="FG15yw3gMB8Z" />
+ <listitem open="0" type="815" id="uq9DVEHiSGoP" />
+ <listitem open="0" type="815" id="udW0X6nRwucP" />
+ </listitem>
+ <listitem open="0" type="813" id="xnGQ9ti6LKXZ" >
+ <listitem open="0" type="814" id="8SVuiaBMFxkG" />
+ <listitem open="0" type="814" id="IvjtyxL96U0O" />
+ <listitem open="0" type="814" id="bMccUjua3QRe" />
+ <listitem open="0" type="814" id="qqpCp7AgWp2f" />
+ <listitem open="0" type="814" id="yEOT2jRXwz6c" />
+ <listitem open="0" type="814" id="wHXJuWtlMix9" />
+ <listitem open="0" type="814" id="o5qKsqxq4MK4" />
+ <listitem open="0" type="815" id="kZlArwfzKyf6" />
+ <listitem open="0" type="815" id="O87gKQtsw1DR" />
+ <listitem open="0" type="815" id="6r5JBb3UvGb7" />
+ <listitem open="0" type="815" id="8VFn5SRIJtio" />
+ <listitem open="0" type="815" id="CX7QmGnNQfyu" />
+ <listitem open="0" type="815" id="N8I7BjZIOdlW" />
+ <listitem open="0" type="815" id="qDTUjKdqN9vB" />
+ <listitem open="0" type="815" id="VNZrMxhseKAs" />
+ <listitem open="0" type="815" id="REvc418qnVEv" />
+ <listitem open="0" type="815" id="WlMKMGxlUqNX" />
+ <listitem open="0" type="815" id="5NytACfVvOsX" />
+ <listitem open="0" type="815" id="2dqv1jTNexf5" />
+ <listitem open="0" type="815" id="2vygqejoln43" />
+ <listitem open="0" type="815" id="29Uw34J8wOf4" />
+ <listitem open="0" type="815" id="42UyQ92giMdG" />
+ <listitem open="0" type="815" id="Xml5upZdXAZW" />
+ </listitem>
+ <listitem open="0" type="813" id="Ffpcevz092To" >
+ <listitem open="0" type="814" id="bYj9JToa9uKf" />
+ <listitem open="0" type="815" id="9kRYzQhfAceh" />
+ <listitem open="0" type="815" id="wiccWDa1IGB0" />
+ <listitem open="0" type="815" id="ARdRgpRYumPW" />
+ <listitem open="0" type="815" id="X48RoXwe1hti" />
+ <listitem open="0" type="815" id="uAWvrOeD1yYc" />
+ <listitem open="0" type="815" id="u7uw5QW7e2LB" />
+ <listitem open="0" type="815" id="Cbkob5zYtRxc" />
+ <listitem open="0" type="815" id="OoAFD7r499dr" />
+ <listitem open="0" type="815" id="yuO7aB8gV7pA" />
+ <listitem open="0" type="815" id="3nxXunhqNtRt" />
+ <listitem open="0" type="815" id="MYQkPqdgh6Vs" />
+ <listitem open="0" type="815" id="TjI8pn05stMj" />
+ <listitem open="0" type="815" id="4KbuDwdv9pwT" />
+ <listitem open="0" type="815" id="J9VSwPumre2k" />
+ <listitem open="0" type="815" id="WCqMot49dnJ3" />
+ <listitem open="0" type="815" id="XqLBbcEPfIWF" />
+ <listitem open="0" type="815" id="7qNl6tymRO2W" />
+ <listitem open="0" type="815" id="M9nDiyyqHBL5" />
+ </listitem>
+ <listitem open="0" type="813" id="adjwEdq884ob" >
+ <listitem open="0" type="814" id="Iz4rTWTxS3n0" />
+ <listitem open="0" type="814" id="bdStR08xCgmF" />
+ <listitem open="0" type="814" id="PKGfk5LGn3bJ" />
+ <listitem open="0" type="814" id="q86HxGHLiEfh" />
+ <listitem open="0" type="814" id="WeNEbK4sTNyR" />
+ <listitem open="0" type="814" id="eptSFkclMxyx" />
+ <listitem open="0" type="814" id="aYoq8ZSkOLCb" />
+ <listitem open="0" type="814" id="cBHp8bzlZhfx" />
+ <listitem open="0" type="814" id="lsIYD0TogXRd" />
+ <listitem open="0" type="814" id="lNlK5PFoHXMS" />
+ <listitem open="0" type="814" id="gr9Y2XYluI6x" />
+ <listitem open="0" type="814" id="EKdjKZFyRMXT" />
+ <listitem open="0" type="814" id="t3ElLIjycSsT" />
+ <listitem open="0" type="815" id="WFqOmNayfDhz" />
+ <listitem open="0" type="815" id="OPd3dI1QBxcP" />
+ <listitem open="0" type="815" id="YdZhYB6wQZoX" />
+ <listitem open="0" type="815" id="RHNsrCNkh8Uf" />
+ <listitem open="0" type="815" id="n61SEV75ZqtV" />
+ <listitem open="0" type="815" id="d6nqhvGn9kPE" />
+ <listitem open="0" type="815" id="S6wdZOiCST19" />
+ </listitem>
+ <listitem open="0" type="813" id="Q60RU8Qxt2jh" >
+ <listitem open="0" type="814" id="BCj7uWVLsuTg" />
+ <listitem open="0" type="814" id="OMIbwSMKXMj1" />
+ <listitem open="0" type="814" id="Eu76mal8u3ho" />
+ <listitem open="0" type="814" id="U38zOryr0uB8" />
+ <listitem open="0" type="814" id="ZCRPvpA9hHET" />
+ </listitem>
+ <listitem open="0" type="813" id="d8mKKcTJhtMZ" >
+ <listitem open="0" type="814" id="gTg5YO0BUnWp" />
+ <listitem open="0" type="814" id="Px64qTbAFKMM" />
+ <listitem open="0" type="814" id="hmYsthba8Gdh" />
+ <listitem open="0" type="814" id="eds9OOwnK2pA" />
+ <listitem open="0" type="814" id="TRLilh2QRZHL" />
+ <listitem open="0" type="814" id="nR9txDa68QcP" />
+ <listitem open="0" type="814" id="Cw0z3lDbs9ub" />
+ <listitem open="0" type="814" id="8ZogWKRHjaAg" />
+ <listitem open="0" type="814" id="mlls9LFKFFJI" />
+ <listitem open="0" type="814" id="0UtqdlSmLEQp" />
+ <listitem open="0" type="814" id="Xp6GQEvAxe07" />
+ <listitem open="0" type="814" id="zFRFUiXUCPJp" />
+ <listitem open="0" type="814" id="AlZTxyIUnMlB" />
+ <listitem open="0" type="814" id="ZeJWIJbFY2U0" />
+ <listitem open="0" type="814" id="i0TuNmiXVFzS" />
+ <listitem open="0" type="814" id="DHxzcgABIUha" />
+ <listitem open="0" type="814" id="nHpKJIK2Gnub" />
+ <listitem open="0" type="814" id="Xa82q7T1NOyx" />
+ <listitem open="0" type="814" id="498MbnuM4hgM" />
+ <listitem open="0" type="814" id="xzMBkEmIptId" />
+ <listitem open="0" type="814" id="ylcJ9bGBiMVJ" />
+ <listitem open="0" type="814" id="8NdA5IU0HqCz" />
+ <listitem open="0" type="814" id="3wFspYTmH35P" />
+ <listitem open="0" type="814" id="eKaKe4bmRFvU" />
+ <listitem open="0" type="814" id="XPVmEflHbz7P" />
+ </listitem>
+ <listitem open="0" type="813" id="Dd5IhQuqhODL" >
+ <listitem open="0" type="814" id="RP4g6QESrIGR" />
+ <listitem open="0" type="814" id="R4lfEOk34S06" />
+ <listitem open="0" type="814" id="sQEhgV9JJ0Rv" />
+ <listitem open="0" type="814" id="y3j2Tj7pa9ls" />
+ <listitem open="0" type="814" id="naiC13Fgjvwp" />
+ <listitem open="0" type="814" id="2IFWtWCrXvs0" />
+ <listitem open="0" type="815" id="FMPxocle20Jj" />
+ <listitem open="0" type="815" id="Ndi6WcvlwJhi" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="803" id="8IfFoRAxojCs" />
+ <listitem open="0" type="813" id="fLjwr6MNuZXD" >
+ <listitem open="0" type="814" id="hUapPz7FvDlL" />
+ <listitem open="0" type="814" id="zURtIMQaYz3T" />
+ <listitem open="0" type="814" id="eU5DT9ejQFbr" />
+ <listitem open="0" type="814" id="AhzYLwKyyJVB" />
+ <listitem open="0" type="814" id="7Na3g6CkUZ0C" />
+ </listitem>
+ <listitem open="1" type="813" id="TZfikGiIVwKz" />
+ <listitem open="1" type="813" id="O1PWAArevDzF" />
+ <listitem open="1" type="813" id="JSU2EBtENyKy" />
+ <listitem open="1" type="813" id="tOgMBBDlVoLx" />
+ <listitem open="1" type="813" id="F2oiQk9bfCP9" />
+ <listitem open="1" type="813" id="Bv4qUQAgGcnc" />
+ <listitem open="1" type="813" id="JO1FHqi41DrK" />
+ <listitem open="1" type="813" id="3QNGiQmMsrXJ" />
+ <listitem open="1" type="813" id="fn3T0g7mCdo8" />
+ <listitem open="1" type="813" id="hQ7UEYOzATqF" />
+ <listitem open="1" type="813" id="6sEW3jvdsAQ0" />
+ <listitem open="1" type="813" id="vez0woDacG3c" />
+ <listitem open="1" type="813" id="bfUc1UOFU09C" />
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="irUbdfzRtLuy" />
+ <listitem open="1" type="829" id="0widC5QuvWxy" />
+ <listitem open="1" type="829" id="l4plA4WjZ5hz" />
+ <listitem open="0" type="829" id="LMD9GuDpzhxX" />
+ <listitem open="0" type="829" id="M6xKR1cFPIwW" />
+ <listitem open="0" type="829" id="S1gNUo1cYqQt" />
+ <listitem open="0" type="829" id="eoUNxGuvIuwA" />
+ <listitem open="1" type="829" id="BlOcERrdVcJi" />
+ <listitem open="1" type="829" id="qpL5yhMnv5m5" />
+ <listitem open="1" type="829" id="CAMwXARcOr2q" />
+ <listitem open="1" type="829" id="ZCvyT3nV6461" />
+ <listitem open="1" type="829" id="TJR8rTv6HJGr" />
+ <listitem open="0" type="829" id="d21ZFkuCFK5X" />
+ <listitem open="1" type="829" id="y93NOeEZLD5e" />
+ <listitem open="1" type="829" id="0FkJo3kMVDSV" />
+ <listitem open="1" type="829" id="iSF0bbc1ufLz" />
+ <listitem open="1" type="829" id="rXf3L5yLNrBT" />
+ <listitem open="1" type="829" id="huvuRoPtpoED" />
+ <listitem open="1" type="829" id="3Xrk8GDGycgY" />
+ <listitem open="1" type="829" id="luyeQvc8m5hN" />
+ <listitem open="1" type="829" id="OMTNsx2stiV3" />
+ <listitem open="1" type="829" id="OqFNT55UVzVU" />
+ <listitem open="1" type="829" id="xmmoTFsE9otX" />
+ <listitem open="1" type="829" id="kfod0hZO32mt" />
+ <listitem open="1" type="829" id="pocpPVnex8xP" />
+ <listitem open="1" type="829" id="qx03D9bX8Zse" />
+ <listitem open="1" type="829" id="D9PiHaAGBCIb" />
+ <listitem open="1" type="829" id="28emhDJMNjju" />
+ <listitem open="1" type="829" id="9kqqNN6qIMaD" />
+ <listitem open="0" type="829" id="nKah2FElYQjf" />
+ <listitem open="1" type="829" id="jTfTYNoH0asy" />
+ <listitem open="1" type="829" id="C4WJsNrZpU0N" />
+ <listitem open="1" type="829" id="HSMJS6CQrwCI" />
+ </listitem>
+ <listitem open="1" type="831" id="0AFakTbKOjhV" >
+ <listitem open="0" type="839" id="0sn2w94wHHV1" />
+ <listitem open="0" type="839" id="HGkt98I7y37u" />
+ </listitem>
+ <listitem open="1" type="831" id="K9Fc7ya6eboZ" >
+ <listitem open="0" type="839" id="15F3QKNkRcLY" />
+ <listitem open="0" type="839" id="sSSMYaHXdXb3" />
+ <listitem open="0" type="839" id="k4qPW77MaXi6" />
+ </listitem>
+ <listitem open="0" type="831" id="mtZJnRKOO7ZU" >
+ <listitem open="0" type="839" id="OX2HniyXbXoO" />
+ <listitem open="0" type="839" id="neVJeoamoZ5F" />
+ <listitem open="0" type="839" id="cqyEfU3313Im" />
+ <listitem open="0" type="839" id="loGfKRYwIW8x" />
+ <listitem open="0" type="839" id="80zKS1hCpxp7" />
+ <listitem open="0" type="839" id="eDMziEWTrzlV" />
+ <listitem open="0" type="839" id="zRZGwOSgcWwz" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="pRzkrBbewp0R" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/cco/bw/inc/bw.h b/cesar/cp/cco/bw/inc/bw.h
new file mode 100644
index 0000000000..29b2c7f7f4
--- /dev/null
+++ b/cesar/cp/cco/bw/inc/bw.h
@@ -0,0 +1,134 @@
+#ifndef cp_cco_inc_bw_h
+#define cp_cco_inc_bw_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/cp_cco_bw_private.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "lib/set.h"
+#include "cp/cco/bw/bw.h"
+#include "cp/conn/link.h"
+
+#define FORWARD true
+#define BACKWARD false
+
+/**
+ * Release the schedule after finalising it and sending it.
+ * \param sched schedule to release
+ * \return \todo fill this
+ *
+ */
+void
+cp_cco_bw_release_sched (cp_t *ctx);
+
+/**
+ * Function that will allocate the end_tdma
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_alloc_end_tdma (cp_t *ctx);
+
+/**
+ * Function that will allocate the proxy beacons
+ * \param ctx Control Plane Context
+ *
+ */
+void
+cp_cco_bw_alloc_proxy (cp_t *ctx);
+
+/**
+ * Allocate the discover beacon
+ * \param ctx Control Plane context
+ *
+ */
+void
+cp_cco_bw_alloc_discover (cp_t *ctx);
+
+/**
+ * Return the next allocation
+ * \param ctx Control Plane Context
+ * \param conn finalised allocation
+ * \return The next allocation
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc_finalised(cp_cco_bw_alloc_t *alloc);
+
+/**
+ * Return the first connection of a heap
+ * \param heap Heap
+ * \return The first connection of the heap
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc_finalised(cp_t *ctx);
+
+/**
+ * Return the next allocation
+ * \param ctx Control Plane Context
+ * \param conn actual allocation
+ * \return The next allocation
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc_actual(cp_cco_bw_alloc_t *alloc);
+
+/**
+ * Return the first connection of a heap
+ * \param heap Heap
+ * \return The first connection of the heap
+ *
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc_actual(cp_t *ctx);
+
+/**
+ * Returns the last ble and checks if the end of the free time has been
+ * reached
+ * \param first_ble First ble of the calculation spot
+ * \param last_ble Last ble of this allocation spot
+ * \param nb_pb Number of PBs to allocate
+ * \param alloc allocation before the free time spot
+ * \param next_alloc next allocation
+ * \return false we have reached the end of the spot before finishing the
+ * allocation
+ *
+ */
+bool
+cp_cco_bw_get_alloc_ble(cp_link_ble_interval_t **first_ble,
+ cp_link_ble_interval_t **last_ble,
+ u16 nb_pb,
+ cp_cco_bw_alloc_t *alloc,
+ cp_cco_bw_alloc_t *next_alloc);
+
+/**
+ * Calculate the best allocation time between 2 BLE
+ * \param first_ble First BLE
+ * \param last_ble Last BLE
+ * \param nb_pb Number of PB to allocate
+ * \param alloc_st Allocation Start Time
+ * \param alloc_et Allocation End Time
+ * \param alloc Previous allocaton
+ * \param next_alloc Next_allocation
+ *
+ */
+void
+cp_cco_bw_calculation_of_alloc_time(cp_link_ble_interval_t *first_ble,
+ cp_link_ble_interval_t *last_ble,
+ u16 nb_pb,
+ u16 *alloc_st,
+ u16 *alloc_et,
+ cp_cco_bw_alloc_t *alloc,
+ cp_cco_bw_alloc_t *next_alloc);
+
+#endif /* cp_cco_bw_private_h */
diff --git a/cesar/cp/cco/bw/inc/bw_prio_heap.h b/cesar/cp/cco/bw/inc/bw_prio_heap.h
new file mode 100644
index 0000000000..f7e7d70473
--- /dev/null
+++ b/cesar/cp/cco/bw/inc/bw_prio_heap.h
@@ -0,0 +1,58 @@
+#ifndef cp_cco_inc_bw_prio_heap_h
+#define cp_cco_inc_bw_prio_heap_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+#include "cp/cco/bw/bw_prio_heap.h"
+#include "cp/cco/bw/bw.h"
+/**
+ * \file cp/cco/bw/inc/cp_cco_bw_prio_heap.h
+ * \brief « brief description »
+ * \ingroup cp/cco/bw/inc/cp_cco_bw_prio_heap.h
+ *
+ * « long description »
+ */
+
+/**
+ * Return a connection regarding on its CID
+ * \param ctx Control Plane Context
+ * \param cid Connection identifier
+ * \return The target Connection NULL if no connection
+ *
+ */
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_get_conn(cp_t *ctx, u16 cid);
+
+/**
+ * intiate a connection
+ * \return the initiated connection
+ *
+ */
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_init_prio_conn(void);
+
+/**
+ * Return the next connection
+ * \param heap heap where is the connection
+ * \param conn previous conncetion
+ * \return The next connection
+ *
+ */
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_get_next_conn(cp_cco_bw_prio_heap_t heap, cp_cco_bw_prio_conn_t *conn);
+
+
+/**
+ * Return the first connection of a heap
+ * \param heap Heap
+ * \return The first connection of the heap
+ *
+ */
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_get_first_conn(cp_cco_bw_prio_heap_t heap);
+
+#endif /* cp_cco_bw_prio_heap.h*/
diff --git a/cesar/cp/cco/bw/src/bw.c b/cesar/cp/cco/bw/src/bw.c
new file mode 100644
index 0000000000..aacc8ea1df
--- /dev/null
+++ b/cesar/cp/cco/bw/src/bw.c
@@ -0,0 +1,1135 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file bw.c
+ * \brief bandwidth manager module
+ * \ingroup cp_cco_bw
+ *
+ * Control the schedule of the beacon period
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "mac/common/timings.h"
+#include "lib/blk.h"
+#include "lib/list.h"
+
+#include "cp/pwl/pwl.h"
+
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/conn_mgr.h"
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/bw.h"
+#include "cp/cco/bw/bw_prio_heap.h"
+#include "cp/cco/bw/inc/bw_prio_heap.h"
+
+#include "cp/sta/mgr/sta_mgr.h"
+
+#include <stdlib.h>
+#include <stdio.h>
+
+/**
+ * Allocate all the TXOPs of a link
+ * \param link A link
+ * \return the result of the alloc false if no more allocation is possible
+ *
+ */
+bool
+cp_cco_bw_alloc_link(cp_t *ctx, cp_link_t *link, u16 cid)
+{
+ u8 txop_allocated = 0;
+ bool no_more_alloc = true;
+
+ /*Number of TXOP*/
+ u8 nb_txop;
+
+ nb_txop = link->qmp->nb_txop;
+
+ /* Allocation of the Forward link */
+ while(txop_allocated < nb_txop
+ && no_more_alloc)
+ {
+ txop_allocated++;
+
+ /*Allocate the connection if possible*/
+ no_more_alloc = cp_cco_bw_alloc(ctx, link, cid);
+ }
+ return no_more_alloc;
+}
+
+void
+cp_cco_bw_new_sched (cp_t *ctx)
+{
+ dbg_assert(ctx);
+
+ list_init(&ctx->bw.actual_schedule);
+
+ /* Beacon alloction*/
+ cp_cco_bw_alloc_beginning(ctx, CP_CCO_BW_ALLOC_TIME_BEACON_ATU,
+ MAC_LID_BEACON_MAX);
+
+ /* MINCSMA allocation */
+ cp_cco_bw_alloc_beginning(ctx, CP_CCO_BW_ALLOC_TIME_MINCSMA_ATU,
+ MAC_LID_LOCAL_CSMA);
+
+ /* CFPI allocation */
+ cp_cco_bw_alloc_beginning(ctx, CP_CCO_BW_ALLOC_TIME_CFPI_ATU,
+ MAC_LID_CFPI);
+
+ /* End TDMA protection allocation */
+ cp_cco_bw_alloc_end_tdma(ctx);
+}
+
+void
+cp_cco_bw_alloc_sched (cp_t *ctx)
+{
+
+ /*Loop state*/
+ bool no_more_alloc = true;
+
+ /*Connection to allocate*/
+ cp_cco_bw_prio_conn_t *prior_conn;
+
+ /*Connection*/
+ cp_conn_t *conn;
+
+ dbg_assert(ctx);
+
+ /*Clear the schedule*/
+ cp_cco_bw_uninit_actual_sched(ctx);
+
+ /*Init the schedule*/
+ cp_cco_bw_new_sched(ctx);
+
+ /*Allocation of the proxy beacon*/
+ cp_cco_bw_alloc_proxy(ctx);
+
+ /*Allocation of the discover beacon*/
+ cp_cco_bw_alloc_discover(ctx);
+
+ /*Until we can't allocate or there is no more connection to allocate*/
+ while(no_more_alloc
+ && prior_conn)
+ {
+ prior_conn = cp_cco_bw_prio_heap_get_most_prior_conn(ctx);
+
+ if(prior_conn)
+ {
+ conn = cp_conn_get_conn(ctx, prior_conn->cid);
+
+ /* Allocation of the Forward link*/
+ if(conn->flink->cinfo->valid_cinfo)
+ no_more_alloc = cp_cco_bw_alloc_link(ctx, conn->flink, conn->conn_info.cid);
+
+ /* Allocation of the Reverse link */
+ if(no_more_alloc && conn->rlink->cinfo->valid_cinfo)
+ no_more_alloc = cp_cco_bw_alloc_link(ctx, conn->rlink, conn->conn_info.cid);
+
+ /*Change Status if the allocation has been done*/
+ if(no_more_alloc)
+ {
+ prior_conn->alloc_status = true;
+
+ /*Change the state of the connection*/
+ if(conn->old_conn_state == CP_CONN_STATE_OUT)
+ conn->new_conn_state = CP_CONN_STATE_ADD;
+
+ else if(conn->old_conn_state == CP_CONN_STATE_IN)
+ conn->new_conn_state = CP_CONN_STATE_IN;
+ }
+
+ /*Else delete all the allocation done for this connection*/
+ else
+ cp_cco_bw_alloc_remove_cid(ctx, conn->conn_info.cid);
+
+ }
+ }
+ /*If all the connections are not allocated we check if their states
+ * changed*/
+ if(prior_conn)
+ cp_cco_bw_check_conn_state(ctx);
+}
+
+bool
+cp_cco_bw_alloc (cp_t *ctx, cp_link_t *link, u16 cid)
+{
+ /* Result returned true if alloc done */
+ bool result_alloc = false;
+
+ bool end_reached = false;
+
+ /* Number of PB to allocate */
+ u16 nb_pb;
+
+ /* Actual Allocation Start time */
+ u16 alloc_st;
+
+ /* Actual allocation End time */
+ u16 alloc_et;
+
+ /* Best Allocation Start time in the actual free time*/
+ u16 best_alloc_st = 0;
+
+ /* Best allocation End time in the actual free time*/
+ u16 best_alloc_et;
+
+ /* Actual allocation */
+ cp_cco_bw_alloc_t *new_alloc;
+
+ /* Actual allocation */
+ cp_cco_bw_alloc_t *alloc;
+
+ /* Next allocation */
+ cp_cco_bw_alloc_t *next_alloc;
+
+ /* Actual ble BLEs */
+ cp_link_ble_interval_t *actual_ble;
+
+ /* first ble */
+ cp_link_ble_interval_t *first_ble;
+
+ /* last ble */
+ cp_link_ble_interval_t *last_ble;
+
+ /*beacon duration atu*/
+ u16 beacon_period_atu;
+
+ dbg_assert(ctx);
+ dbg_assert(link);
+ dbg_assert(cid);
+
+ /*Init the beacon period with the pwl values*/
+ beacon_period_atu = MAC_TCK_TO_ATU(ctx->pwl.bp_avln_ntb[2] - ctx->pwl.bp_avln_ntb[1]);
+
+ best_alloc_et = beacon_period_atu;
+
+ /* get the connection to collect its infos */
+ nb_pb = link->qmp->av_nb_pb;
+ actual_ble = cp_link_get_first_ble(link);
+
+ /* Init allocation data */
+
+ /* first element of the schedule */
+ alloc = cp_cco_bw_get_first_alloc_actual(ctx);
+ next_alloc = cp_cco_bw_get_next_alloc_actual(alloc);
+
+ /* Begin hunting for the best free space */
+
+ /* While we are not at the last allocation */
+ while(&alloc->node != list_rbegin(&ctx->bw.actual_schedule))
+ {
+ /* if we are not at the end of the allocations */
+ if(cp_cco_bw_set_next_free_time_space(ctx, &alloc, &next_alloc))
+ {
+ end_reached = false;
+
+ /* Get the First BLE of the free allocation time */
+ while(actual_ble->et_atu <= alloc->et_atu)
+ actual_ble = cp_link_get_next_ble(actual_ble);
+
+ /* First computing begin first duration */
+ first_ble = actual_ble;
+ last_ble = actual_ble;
+
+ /*compute until we reach the last ble*/
+ while(!end_reached)
+ {
+ end_reached = cp_cco_bw_get_alloc_ble(&first_ble,
+ &last_ble,
+ nb_pb,
+ alloc,
+ next_alloc);
+ if(!end_reached)
+ {
+ cp_cco_bw_calculation_of_alloc_time(first_ble,
+ last_ble,
+ nb_pb,
+ &alloc_st,
+ &alloc_et,
+ alloc,
+ next_alloc);
+ result_alloc = true;
+
+ if ((alloc_et - alloc_st) < (best_alloc_et - best_alloc_st))
+ {
+ best_alloc_st = alloc_st;
+ best_alloc_et = alloc_et;
+ }
+ }
+ /*If the first ble is not equal to the start time of the next*/
+ if(actual_ble->et_atu!= beacon_period_atu && actual_ble->et_atu < next_alloc->st_atu)
+ {
+ actual_ble = cp_link_get_next_ble(actual_ble);
+ first_ble = actual_ble;
+ last_ble = first_ble;
+ }
+ else
+ end_reached = true;
+ }
+ alloc = next_alloc;
+ }
+ }
+ if(result_alloc)
+ {
+ /*Init the new allocation*/
+ new_alloc = blk_alloc();
+ new_alloc->st_atu = best_alloc_st;
+ new_alloc->et_atu = best_alloc_et;
+ new_alloc->glid = link->glid;
+ new_alloc->cid = cid;
+ cp_cco_bw_alloc_add(ctx, new_alloc);
+ }
+
+ return result_alloc;
+}
+
+void
+cp_cco_bw_finalise_sched(cp_t *ctx)
+{
+ cp_cco_bw_alloc_t *prev_alloc_actual;
+ cp_cco_bw_alloc_t *next_alloc_actual;
+ cp_cco_bw_alloc_t *prev_alloc_finalise;
+ cp_cco_bw_alloc_t *next_alloc_finalise;
+ cp_cco_bw_alloc_t *csma_alloc;
+
+ u16 free_space_atu;
+ u16 beacon_period_atu;
+
+ dbg_assert(ctx);
+
+ beacon_period_atu = MAC_TCK_TO_ATU(ctx->pwl.bp_avln_ntb[2] - ctx->pwl.bp_avln_ntb[1]);
+
+ prev_alloc_actual = cp_cco_bw_get_first_alloc_actual(ctx);
+ next_alloc_actual = cp_cco_bw_get_next_alloc_actual(prev_alloc_actual);
+ prev_alloc_finalise = cp_cco_bw_get_first_alloc_finalised(ctx);
+ next_alloc_finalise = cp_cco_bw_get_next_alloc_finalised(prev_alloc_finalise);
+
+ while(&prev_alloc_actual->node != list_rbegin(&ctx->bw.actual_schedule))
+ {
+ /** copy the current allocation */
+ prev_alloc_finalise = blk_alloc();
+
+ prev_alloc_finalise->st_atu = prev_alloc_actual->st_atu;
+ prev_alloc_finalise->et_atu = prev_alloc_actual->et_atu;
+ prev_alloc_finalise->cid = prev_alloc_actual->cid;
+ prev_alloc_finalise->glid = prev_alloc_actual->glid;
+ prev_alloc_finalise->persistence = prev_alloc_actual->persistence;
+ prev_alloc_finalise->duration_persistence = prev_alloc_actual->duration_persistence;
+
+ list_init_node(&prev_alloc_finalise->node);
+
+ list_insert(&ctx->bw.finalised_schedule, &next_alloc_finalise->node,
+ &prev_alloc_finalise->node);
+
+ /** Study if there is free space*/
+ if(prev_alloc_actual->et_atu != next_alloc_actual->st_atu
+ && &prev_alloc_actual->node != list_rbegin(&ctx->bw.actual_schedule))
+ {
+ free_space_atu = next_alloc_actual->st_atu - prev_alloc_actual->et_atu;
+
+ /** Enough space to put CSMA */
+ if(free_space_atu > CP_CCO_BW_MIN_CSMA_ALLOC_ATU)
+ {
+ csma_alloc = blk_alloc();
+ csma_alloc->st_atu = prev_alloc_actual->et_atu;
+ csma_alloc->et_atu = next_alloc_actual->st_atu;
+ csma_alloc->cid = 0;
+ csma_alloc->glid = MAC_LID_LOCAL_CSMA;
+ csma_alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ csma_alloc->duration_persistence = 0;
+ list_init_node(&csma_alloc->node);
+
+ list_insert(&ctx->bw.finalised_schedule, &next_alloc_finalise->node,
+ &csma_alloc->node);
+ }
+ /** Not enough space for CSMA so allocate bonus for the previous
+ * allocation*/
+ else
+ prev_alloc_finalise->et_atu = next_alloc_actual->st_atu;
+ }
+
+ /** Move to next allocation*/
+ prev_alloc_actual = next_alloc_actual;
+ next_alloc_actual = cp_cco_bw_get_next_alloc_actual(next_alloc_actual);
+ }
+
+ /** End of the TDMA region as a bonus for the last allocation */
+ prev_alloc_finalise->et_atu = beacon_period_atu;
+}
+
+void
+cp_cco_bw_clear_conn_state(cp_t *ctx)
+{
+ cp_cco_bw_prio_conn_t *prior_conn;
+ cp_conn_t *conn;
+ u8 nb_heap = 0;
+
+ while(nb_heap < CP_CCO_BW_NB_PRIORITY_HEAPS)
+ {
+ prior_conn = cp_cco_bw_prio_heap_get_first_conn(ctx->bw.prio_heap[nb_heap]);
+
+ while (prior_conn)
+ {
+ conn = cp_conn_get_conn(ctx, prior_conn->cid);
+
+ if(conn->new_conn_state == CP_CONN_STATE_IN
+ || conn->new_conn_state == CP_CONN_STATE_ADD)
+ conn->old_conn_state = CP_CONN_STATE_IN;
+ else
+ conn->old_conn_state = CP_CONN_STATE_OUT;
+
+ conn->new_conn_state = CP_CONN_STATE_OUT;
+
+ prior_conn = cp_cco_bw_prio_heap_get_next_conn(ctx->bw.prio_heap[nb_heap], prior_conn);
+ }
+ nb_heap++;
+ }
+}
+
+void
+cp_cco_bw_check_conn_state(cp_t *ctx)
+{
+ cp_cco_bw_prio_conn_t *prior_conn;
+ cp_conn_t *conn;
+ u8 nb_heap = 0;
+
+ while(nb_heap < CP_CCO_BW_NB_PRIORITY_HEAPS)
+ {
+ prior_conn = cp_cco_bw_prio_heap_get_first_conn(ctx->bw.prio_heap[nb_heap]);
+
+ while (prior_conn)
+ {
+ if(!prior_conn->alloc_status)
+ {
+ conn = cp_conn_get_conn(ctx, prior_conn->cid);
+
+ if(conn->old_conn_state == CP_CONN_STATE_IN
+ && conn->new_conn_state == CP_CONN_STATE_OUT)
+ conn->new_conn_state = CP_CONN_STATE_REL_BW;
+ }
+ prior_conn = cp_cco_bw_prio_heap_get_next_conn(ctx->bw.prio_heap[nb_heap], prior_conn);
+ }
+ nb_heap++;
+ }
+}
+
+bool
+cp_cco_bw_get_alloc_ble(cp_link_ble_interval_t **first_ble,
+ cp_link_ble_interval_t **last_ble,
+ u16 nb_pb,
+ cp_cco_bw_alloc_t *alloc,
+ cp_cco_bw_alloc_t *next_alloc)
+{
+ /*Side of research for allocation*/
+ bool side = FORWARD;
+
+ /*Side locked*/
+ bool backward_locked = false, forward_locked = false;
+
+ /*End of Loop*/
+ bool end_reached = false;
+
+ u16 nb_pb_alloc = 0;
+ u16 begin, end;
+
+ /*Working BLE*/
+ cp_link_ble_interval_t *ble;
+
+ dbg_assert(first_ble);
+ dbg_assert(last_ble);
+ dbg_assert(alloc);
+ dbg_assert(next_alloc);
+
+ /*Actual BLE*/
+ ble = *first_ble;
+
+ /*Study the free time space until we have allocated all the pbs or we have
+ * reached the next allocation*/
+ while(nb_pb > nb_pb_alloc
+ && !end_reached)
+ {
+
+ /*Add the allocation of the forward BLE*/
+ if(side == FORWARD)
+ {
+ /*Begin time*/
+ if(cp_link_get_prev_ble(ble)->et_atu <= alloc->et_atu)
+ {
+ backward_locked = true;
+ begin = alloc->et_atu;
+ }
+ else
+ begin = cp_link_get_prev_ble(ble)->et_atu;
+
+ /*End time*/
+ if (ble->et_atu >= next_alloc->st_atu)
+ {
+ end = next_alloc->st_atu;
+ forward_locked = true;
+ }
+ else
+ end = ble->et_atu;
+ }
+
+ /*Add the allocation of the backward BLE*/
+ else
+ {
+ /*Begin time*/
+ if (cp_link_get_prev_ble(ble)->et_atu <= alloc->et_atu)
+ {
+ begin = alloc->et_atu;
+ backward_locked = true;
+ }
+ else
+ begin = cp_link_get_prev_ble(ble)->et_atu;
+
+ /*End time*/
+ end = ble->et_atu;
+ }
+
+
+ /*Add up the pbs allocated*/
+ nb_pb_alloc = nb_pb_alloc + ((end - begin)*ble->ble)/CP_CCO_BW_PB_SIZE_OCTET;
+
+
+ /*Look at the side of the next BLE we are going to use*/
+ if (nb_pb_alloc < nb_pb)
+ {
+ /*If we cant go forward or If we can use the previous BLE and the previous BLE is better
+ * than the next*/
+ if((forward_locked && !backward_locked)
+ || (!backward_locked
+ && cp_link_get_prev_ble(*first_ble)->ble > cp_link_get_next_ble(*last_ble)->ble))
+ {
+ ble = cp_link_get_prev_ble(*first_ble);
+ *first_ble = ble;
+ side = BACKWARD;
+ }
+
+ /*Else if we can use the forward BLE*/
+ else if(!forward_locked)
+ {
+ ble = cp_link_get_next_ble(*last_ble);
+ *last_ble = ble;
+ side = FORWARD;
+ }
+ /*Else if we can't use the backward BLE nor the forward one we are
+ * done result : FALSE no allocation possible*/
+ else
+ end_reached = true;
+
+ }
+ }
+
+ /*Return the result of the allocation*/
+ return end_reached;
+}
+
+void
+cp_cco_bw_calculation_of_alloc_time(cp_link_ble_interval_t *first_ble,
+ cp_link_ble_interval_t *last_ble,
+ u16 nb_pb,
+ u16 *alloc_st,
+ u16 *alloc_et,
+ cp_cco_bw_alloc_t *alloc,
+ cp_cco_bw_alloc_t *next_alloc)
+{
+ u16 possible_pb_alloc = 0;
+ u16 nb_pb_alloc = 0;
+ u16 alloc_left;
+ cp_link_ble_interval_t *ble;
+
+ dbg_assert(first_ble);
+ dbg_assert(last_ble);
+ dbg_assert(alloc_st);
+ dbg_assert(alloc_et);
+ dbg_assert(alloc);
+ dbg_assert(next_alloc);
+
+ if(first_ble->ble >= last_ble->ble)
+ {
+ ble = first_ble;
+
+ if(cp_link_get_prev_ble(first_ble)->et_atu > alloc->et_atu)
+ *alloc_st = cp_link_get_prev_ble(first_ble)->et_atu;
+ else
+ *alloc_st = alloc->et_atu;
+
+ if(first_ble->et_atu < next_alloc->st_atu)
+ *alloc_et = first_ble->et_atu;
+ else
+ *alloc_et = next_alloc->st_atu;
+
+ possible_pb_alloc = ((*alloc_et - *alloc_st)*first_ble->ble)/CP_CCO_BW_PB_SIZE_OCTET;
+
+ /*If the first BLE is not enough*/
+ if(nb_pb > possible_pb_alloc)
+ {
+ while(nb_pb > (nb_pb_alloc + possible_pb_alloc))
+ {
+ /*Current allocation advance*/
+ nb_pb_alloc = nb_pb_alloc + possible_pb_alloc;
+
+ /*Next ble*/
+ ble = cp_link_get_next_ble(ble);
+
+ /*Number possible to allocate*/
+ possible_pb_alloc = (ble->ble*(ble->et_atu - cp_link_get_prev_ble(ble)->et_atu))/CP_CCO_BW_PB_SIZE_OCTET;
+ }
+
+ alloc_left = (nb_pb - nb_pb_alloc)*CP_CCO_BW_PB_SIZE_OCTET;
+
+ *alloc_et = cp_link_get_prev_ble(ble)->et_atu + (alloc_left + (ble->ble-1))/ble->ble;
+ }
+
+ /*If the first BLE is enough*/
+ else
+ *alloc_et = *alloc_st + (nb_pb*CP_CCO_BW_PB_SIZE_OCTET + (first_ble->ble-1))/first_ble->ble;
+ }
+ else
+ {
+ ble = last_ble;
+
+ /*End time*/
+ if(last_ble->et_atu > next_alloc->st_atu)
+ *alloc_et = next_alloc->st_atu;
+ else
+ *alloc_et = last_ble->et_atu;
+
+ possible_pb_alloc = ((*alloc_et -cp_link_get_prev_ble(last_ble)->et_atu) * last_ble->ble)/CP_CCO_BW_PB_SIZE_OCTET;
+
+ /*If the first ble is not enough*/
+ if (nb_pb > possible_pb_alloc)
+ {
+ while(nb_pb > (nb_pb_alloc + possible_pb_alloc))
+ {
+ nb_pb_alloc = nb_pb_alloc + possible_pb_alloc;
+
+ ble = cp_link_get_prev_ble(ble);
+
+ if (cp_link_get_next_ble(ble)->et_atu > alloc->et_atu)
+ possible_pb_alloc = (ble->ble*(ble->et_atu - cp_link_get_prev_ble(ble)->et_atu))/CP_CCO_BW_PB_SIZE_OCTET;
+ else
+ possible_pb_alloc = (ble->ble*(ble->et_atu - alloc->et_atu))/CP_CCO_BW_PB_SIZE_OCTET;
+
+ }
+
+ alloc_left = (nb_pb - nb_pb_alloc)*CP_CCO_BW_PB_SIZE_OCTET;
+
+ *alloc_st = ble->et_atu - (alloc_left + (ble->ble - 1))/ble->ble;
+ }
+
+ /*If first BLE is enough*/
+ else
+ *alloc_st = ble->et_atu - (nb_pb*CP_CCO_BW_PB_SIZE_OCTET + (ble->ble -1))/ble->ble;
+ }
+}
+
+bool
+cp_cco_bw_set_next_free_time_space(cp_t *ctx,
+ cp_cco_bw_alloc_t **prev_alloc,
+ cp_cco_bw_alloc_t **next_alloc)
+{
+ dbg_assert(ctx);
+ dbg_assert(prev_alloc);
+ dbg_assert(next_alloc);
+
+ do
+ {
+ *prev_alloc = *next_alloc;
+ *next_alloc = cp_cco_bw_get_next_alloc_actual(*next_alloc);
+ }
+ while(&(*prev_alloc)->node != list_rbegin(&ctx->bw.actual_schedule)
+ && (*next_alloc)->st_atu == (*prev_alloc)->et_atu);
+
+ return &(*prev_alloc)->node != list_rbegin(&ctx->bw.actual_schedule);
+}
+
+void
+cp_cco_bw_init (cp_t* ctx)
+{
+ dbg_assert(ctx);
+
+ cp_cco_bw_prio_heap_init(ctx);
+
+ list_init(&ctx->bw.actual_schedule);
+ list_init(&ctx->bw.finalised_schedule);
+}
+
+void
+cp_cco_bw_uninit (cp_t* ctx)
+{
+ dbg_assert(ctx);
+
+ cp_cco_bw_alloc_t *alloc;
+
+ while(!list_empty(&ctx->bw.actual_schedule))
+ {
+ alloc = cp_cco_bw_get_first_alloc_actual(ctx);
+ list_remove(&ctx->bw.actual_schedule,
+ list_begin(&ctx->bw.actual_schedule));
+ blk_release(alloc);
+ }
+
+ while(!list_empty(&ctx->bw.finalised_schedule))
+ {
+ alloc = cp_cco_bw_get_first_alloc_finalised(ctx);
+ list_remove(&ctx->bw.finalised_schedule,
+ list_begin(&ctx->bw.finalised_schedule));
+ blk_release(alloc);
+ }
+
+ cp_cco_bw_prio_heap_uninit(ctx);
+}
+
+void
+cp_cco_bw_alloc_add_finalised (cp_t *ctx, cp_cco_bw_alloc_t *alloc)
+{
+ cp_cco_bw_alloc_t *prev_alloc;
+ cp_cco_bw_alloc_t *next_alloc;
+
+ dbg_assert(ctx);
+ dbg_assert(alloc);
+
+ list_init_node(&alloc->node);
+
+ prev_alloc = cp_cco_bw_get_first_alloc_finalised(ctx);
+ next_alloc = cp_cco_bw_get_next_alloc_finalised(prev_alloc);
+
+ while(next_alloc->et_atu <= alloc->st_atu
+ && next_alloc->et_atu != 0)
+ {
+ prev_alloc = next_alloc;
+ next_alloc = cp_cco_bw_get_next_alloc_finalised(next_alloc);
+ }
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_finalised ++;
+ else
+ ctx->bw.nb_alloc_no_pers_finalised ++;
+
+ list_insert(&ctx->bw.finalised_schedule, &next_alloc->node, &alloc->node);
+}
+
+void
+cp_cco_bw_alloc_add (cp_t *ctx, cp_cco_bw_alloc_t *alloc)
+{
+ cp_cco_bw_alloc_t *prev_alloc;
+ cp_cco_bw_alloc_t *next_alloc;
+
+ dbg_assert(ctx);
+ dbg_assert(alloc);
+
+ list_init_node(&alloc->node);
+
+ prev_alloc = cp_cco_bw_get_first_alloc_actual(ctx);
+ next_alloc = cp_cco_bw_get_next_alloc_actual(prev_alloc);
+
+ while(next_alloc->et_atu <= alloc->st_atu
+ && next_alloc->et_atu != 0)
+ {
+ prev_alloc = next_alloc;
+ next_alloc = cp_cco_bw_get_next_alloc_actual(next_alloc);
+ }
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_actual ++;
+ else
+ ctx->bw.nb_alloc_no_pers_actual ++;
+
+ list_insert(&ctx->bw.actual_schedule, &next_alloc->node, &alloc->node);
+}
+
+void
+cp_cco_bw_alloc_remove_finalised (cp_t *ctx, cp_cco_bw_alloc_t *alloc)
+{
+ dbg_assert (ctx);
+ dbg_assert (alloc);
+
+ list_remove (&ctx->bw.finalised_schedule, &alloc->node);
+
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_finalised --;
+ else
+ ctx->bw.nb_alloc_no_pers_finalised --;
+
+ blk_release (alloc);
+}
+
+void
+cp_cco_bw_alloc_remove(cp_t *ctx, cp_cco_bw_alloc_t *alloc)
+{
+ dbg_assert (ctx);
+ dbg_assert (alloc);
+
+ list_remove (&ctx->bw.actual_schedule, &alloc->node);
+
+ if (alloc->persistence == CP_CCO_BW_PERSISTENCE_PERSISTENT)
+ ctx->bw.nb_alloc_pers_actual --;
+ else
+ ctx->bw.nb_alloc_no_pers_actual --;
+
+ blk_release (alloc);
+}
+
+void
+cp_cco_bw_alloc_remove_cid(cp_t *ctx, u16 cid)
+{
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert (ctx);
+
+ while(alloc)
+ {
+ alloc = cp_cco_bw_alloc_get_first_txop(ctx, cid);
+ if(alloc)
+ cp_cco_bw_alloc_remove(ctx, alloc);
+ }
+}
+
+void
+cp_cco_bw_uninit_actual_sched(cp_t *ctx)
+{
+ dbg_assert(ctx);
+
+ while(!list_empty(&ctx->bw.actual_schedule))
+ cp_cco_bw_alloc_remove(ctx, cp_cco_bw_get_first_alloc_actual(ctx));
+
+ cp_cco_bw_prio_heap_clear_conn(ctx);
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_alloc_get_first_txop(cp_t *ctx, u16 cid)
+{
+ cp_cco_bw_alloc_t* alloc;
+ u16 beacon_period_atu;
+
+ dbg_assert(ctx);
+
+ beacon_period_atu = MAC_TCK_TO_ATU(ctx->pwl.bp_avln_ntb[2] - ctx->pwl.bp_avln_ntb[1]);
+
+ alloc = cp_cco_bw_get_first_alloc_actual(ctx);
+
+ while(alloc->cid != cid
+ && alloc->et_atu != beacon_period_atu)
+ alloc = cp_cco_bw_get_next_alloc_actual(alloc);
+
+ /*We reached the last alloc and didn't find the one we need*/
+ if(alloc->cid != cid)
+ alloc = NULL;
+
+ return alloc;
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_alloc_get_next_txop(cp_t *ctx, cp_cco_bw_alloc_t* alloc)
+{
+ cp_cco_bw_alloc_t* next_alloc;
+
+ dbg_assert(ctx);
+ dbg_assert(alloc);
+
+ next_alloc = cp_cco_bw_get_next_alloc_actual(alloc);
+
+ /*Search for the next allocation*/
+ while(&next_alloc->node != list_rbegin(&ctx->bw.actual_schedule)
+ && next_alloc->cid != alloc->cid)
+ next_alloc = cp_cco_bw_get_next_alloc_actual(next_alloc);
+
+ /*We reached the last alloc and didn't find the one we need*/
+ if(next_alloc->cid != alloc->cid)
+ next_alloc = NULL;
+
+ return next_alloc;
+}
+
+void
+cp_cco_bw_alloc_end_tdma (cp_t *ctx)
+{
+ cp_cco_bw_alloc_t *end_tdma_alloc;
+ cp_cco_bw_alloc_t *prev_alloc;
+ cp_cco_bw_alloc_t *next_alloc;
+
+ u16 beacon_period_atu;
+
+ dbg_assert(ctx);
+
+ beacon_period_atu = MAC_TCK_TO_ATU(ctx->pwl.bp_avln_ntb[2] - ctx->pwl.bp_avln_ntb[1]);
+
+ prev_alloc = cp_cco_bw_get_first_alloc_actual(ctx);
+ next_alloc = cp_cco_bw_get_next_alloc_actual(prev_alloc);
+
+ cp_cco_bw_set_next_free_time_space(ctx, &prev_alloc, &next_alloc);
+
+ /*Schedule the end_tdma beacon*/
+ end_tdma_alloc = blk_alloc();
+
+ end_tdma_alloc->st_atu = beacon_period_atu - CP_CCO_BW_ALLOC_TIME_END_TDMA_PROTECTION_ATU;
+ end_tdma_alloc->et_atu = beacon_period_atu;
+ end_tdma_alloc->glid = MAC_LID_LOCAL_CSMA;
+ end_tdma_alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ end_tdma_alloc->duration_persistence = 0;
+
+ cp_cco_bw_alloc_add(ctx, end_tdma_alloc);
+}
+
+void
+cp_cco_bw_alloc_proxy (cp_t *ctx)
+{
+ cp_cco_bw_alloc_t *prev_alloc;
+ cp_cco_bw_alloc_t *next_alloc;
+
+ cp_cco_bw_alloc_t *proxy_alloc;
+
+ cp_net_t *avln;
+ cp_sta_t *sta;
+ u16 begin_alloc;
+ u16 end_alloc;
+
+ dbg_assert(ctx);
+
+ prev_alloc = cp_cco_bw_get_first_alloc_actual(ctx);
+ next_alloc = cp_cco_bw_get_next_alloc_actual(prev_alloc);
+
+ cp_cco_bw_set_next_free_time_space(ctx, &prev_alloc, &next_alloc);
+
+ /*Schedule the Proxy beacons*/
+ avln = cp_sta_mgr_get_our_avln(ctx);
+ sta = cp_net_get_first(ctx, avln, CP_STA_STATE_ASSOCIATED);
+
+ begin_alloc = prev_alloc->et_atu;
+ end_alloc = begin_alloc + CP_CCO_BW_ALLOC_TIME_BEACON_ATU;
+
+ while(sta)
+ {
+ if(cp_sta_get_pco_status(sta))
+ {
+ proxy_alloc = blk_alloc();
+ proxy_alloc->st_atu = begin_alloc;
+ proxy_alloc->et_atu = end_alloc;
+ proxy_alloc->glid = cp_sta_get_pco_glid(sta);
+ proxy_alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ proxy_alloc->duration_persistence = 0;
+
+ cp_cco_bw_alloc_add(ctx, proxy_alloc);
+
+ begin_alloc = end_alloc;
+ end_alloc = end_alloc + CP_CCO_BW_ALLOC_TIME_BEACON_ATU;
+ }
+
+ sta = cp_net_get_next(ctx, avln, sta);
+ }
+}
+
+void
+cp_cco_bw_alloc_beginning (cp_t *ctx, u16 duration, u8 glid)
+{
+ cp_cco_bw_alloc_t *alloc;
+ cp_cco_bw_alloc_t *prev_alloc;
+ cp_cco_bw_alloc_t *next_alloc;
+
+ dbg_assert(ctx);
+
+ prev_alloc = cp_cco_bw_get_first_alloc_actual(ctx);
+ next_alloc = cp_cco_bw_get_next_alloc_actual(prev_alloc);
+
+ cp_cco_bw_set_next_free_time_space(ctx, &prev_alloc, &next_alloc);
+
+ /*Schedule the discover beacon*/
+ alloc = blk_alloc();
+
+ alloc->st_atu = prev_alloc->et_atu;
+ alloc->et_atu = alloc->st_atu + duration;
+ alloc->glid = glid;
+ alloc->cid = 0;
+ alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ alloc->duration_persistence = 0;
+
+ cp_cco_bw_alloc_add(ctx, alloc);
+}
+
+
+void
+cp_cco_bw_alloc_discover (cp_t *ctx)
+{
+ cp_cco_bw_alloc_t *discover_alloc;
+ cp_cco_bw_alloc_t *prev_alloc;
+ cp_cco_bw_alloc_t *next_alloc;
+
+ dbg_assert(ctx);
+
+ prev_alloc = cp_cco_bw_get_first_alloc_actual(ctx);
+ next_alloc = cp_cco_bw_get_next_alloc_actual(prev_alloc);
+
+ cp_cco_bw_set_next_free_time_space(ctx, &prev_alloc, &next_alloc);
+
+ /*Schedule the discover beacon*/
+ discover_alloc = blk_alloc();
+
+ discover_alloc->st_atu = prev_alloc->et_atu;
+ discover_alloc->et_atu = discover_alloc->st_atu + CP_CCO_BW_ALLOC_TIME_BEACON_ATU;
+ discover_alloc->glid = MAC_LID_DISCOVER;
+ discover_alloc->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ discover_alloc->duration_persistence = 0;
+
+ cp_cco_bw_alloc_add(ctx, discover_alloc);
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc_actual_from_persistence (cp_t *ctx, cp_cco_bw_persistence_t persistence)
+{
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert(ctx);
+
+ alloc = PARENT_OF(cp_cco_bw_alloc_t, node,
+ list_begin(&ctx->bw.actual_schedule));
+
+ while(&alloc->node != list_rbegin(&ctx->bw.actual_schedule)
+ && alloc->persistence != persistence)
+ alloc = cp_cco_bw_get_next_alloc_actual(alloc);
+
+ if(alloc->persistence != persistence)
+ alloc = NULL;
+
+ return alloc;
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc_actual_from_persistence (cp_t *ctx, cp_cco_bw_alloc_t *prev_alloc)
+{
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert(ctx);
+ dbg_assert(prev_alloc);
+
+ if(&prev_alloc->node != list_rbegin(&ctx->bw.actual_schedule))
+ {
+ alloc = PARENT_OF(cp_cco_bw_alloc_t, node,
+ list_next(&prev_alloc->node));
+
+ while(&alloc->node != list_rbegin(&ctx->bw.actual_schedule)
+ && alloc->persistence != prev_alloc->persistence)
+ alloc = cp_cco_bw_get_next_alloc_actual(alloc);
+
+ if(alloc->persistence != prev_alloc->persistence)
+ alloc = NULL;
+ }
+ else
+ alloc = NULL;
+
+ return alloc;
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc (cp_t *ctx, cp_cco_bw_persistence_t persistence)
+{
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert(ctx);
+
+ alloc = PARENT_OF(cp_cco_bw_alloc_t, node,
+ list_begin(&ctx->bw.finalised_schedule));
+
+ while(&alloc->node != list_rbegin(&ctx->bw.finalised_schedule)
+ && alloc->persistence != persistence)
+ alloc = cp_cco_bw_get_next_alloc_finalised(alloc);
+
+ if(alloc->persistence != persistence)
+ alloc = NULL;
+
+ return alloc;
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc (cp_t *ctx, cp_cco_bw_alloc_t *prev_alloc)
+{
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert(ctx);
+ dbg_assert(prev_alloc);
+
+ if(&prev_alloc->node != list_rbegin(&ctx->bw.finalised_schedule))
+ {
+ alloc = PARENT_OF(cp_cco_bw_alloc_t, node,
+ list_next(&prev_alloc->node));
+
+ while(&alloc->node != list_rbegin(&ctx->bw.finalised_schedule)
+ && alloc->persistence != prev_alloc->persistence)
+ alloc = cp_cco_bw_get_next_alloc_finalised(alloc);
+
+ if(alloc->persistence != prev_alloc->persistence)
+ alloc = NULL;
+ }
+ else
+ alloc = NULL;
+
+ return alloc;
+}
+
+u16
+cp_cco_bw_get_nb_alloc(cp_t *ctx, cp_cco_bw_persistence_t persistence)
+{
+ dbg_assert(ctx);
+
+ return persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT ?
+ ctx->bw.nb_alloc_pers_finalised : ctx->bw.nb_alloc_no_pers_finalised;
+}
+
+u16
+cp_cco_bw_get_nb_alloc_actual(cp_t *ctx, cp_cco_bw_persistence_t persistence)
+{
+ dbg_assert(ctx);
+
+ return persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT ?
+ ctx->bw.nb_alloc_pers_actual : ctx->bw.nb_alloc_no_pers_actual;
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc_finalised(cp_t *ctx)
+{
+ dbg_assert(ctx);
+
+ return PARENT_OF(cp_cco_bw_alloc_t,
+ node,
+ list_begin(&ctx->bw.finalised_schedule));
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc_finalised(cp_cco_bw_alloc_t *alloc)
+{
+ dbg_assert(alloc);
+
+ return PARENT_OF(cp_cco_bw_alloc_t,
+ node,
+ list_next(&alloc->node));
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_first_alloc_actual(cp_t *ctx)
+{
+ dbg_assert(ctx);
+
+ return PARENT_OF(cp_cco_bw_alloc_t,
+ node,
+ list_begin(&ctx->bw.actual_schedule));
+}
+
+cp_cco_bw_alloc_t*
+cp_cco_bw_get_next_alloc_actual(cp_cco_bw_alloc_t *alloc)
+{
+ dbg_assert(alloc);
+ return PARENT_OF(cp_cco_bw_alloc_t,
+ node,
+ list_next(&alloc->node));
+}
+
diff --git a/cesar/cp/cco/bw/src/bw_lib_alloc.c b/cesar/cp/cco/bw/src/bw_lib_alloc.c
new file mode 100644
index 0000000000..55ae5cb846
--- /dev/null
+++ b/cesar/cp/cco/bw/src/bw_lib_alloc.c
@@ -0,0 +1,181 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cco/action/src/bw_lib_alloc.c
+ * \brief schedules list manager.
+ * \ingroup cp_cco_bw
+ *
+ */
+#include "common/std.h"
+#include "lib/set.h"
+#include "lib/blk.h"
+
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/bw_lib_alloc.h"
+
+/** Initialise the SET.
+ * \param set the set to initialise.
+ */
+void
+cp_cco_bw_schedules_init (set_t *set)
+{
+ dbg_assert (set);
+
+ set_init (set, cp_cco_bw_schedules_allocation_less);
+}
+
+/** Uninitialise the SET.
+ * \param set the set to initialise.
+ */
+void
+cp_cco_bw_schedules_uninit (set_t *set)
+{
+ cp_cco_bw_alloc_t *alloc;
+ cp_cco_bw_alloc_t *next;
+ dbg_assert (set);
+
+ alloc = cp_cco_bw_schedules_get_first (set);
+ while (alloc)
+ {
+ next = cp_cco_bw_schedules_get_next (set, alloc);
+ set_remove (set, &alloc->set_node);
+ blk_release (alloc);
+ alloc = next;
+ }
+}
+
+/** Add an allocation.
+ * \param set the set to add the allocation.
+ * \param node the node to add.
+ * \param write true if the node is not only hold by this set.
+ */
+void
+cp_cco_bw_schedules_add (set_t *set, cp_cco_bw_alloc_t *alloc,
+ bool write)
+{
+ dbg_assert (set);
+ dbg_assert (alloc);
+
+ // initialise the node.
+ set_node_init (&alloc->set_node);
+
+ // Add the node.
+ if (write == true)
+ blk_addref (alloc);
+ set_insert (set, &alloc->set_node);
+}
+
+/** Get the first allocation.
+ * \param set the set.
+ * \return the first allocation of the set.
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_schedules_get_first (set_t *set)
+{
+ set_node_t *current_node;
+ dbg_assert (set);
+
+ current_node = set_begin (set);
+
+ if (current_node)
+ return PARENT_OF (cp_cco_bw_alloc_t, set_node, current_node);
+
+ return NULL;
+}
+
+/** Get the next allocation.
+ * \param set the set.
+ * \return the first allocation of the set.
+ */
+cp_cco_bw_alloc_t*
+cp_cco_bw_schedules_get_next (set_t *set, cp_cco_bw_alloc_t* alloc)
+{
+ set_node_t *current_node;
+ dbg_assert (set);
+ dbg_assert (alloc);
+
+ current_node = set_next (set, &alloc->set_node);
+
+ if (current_node)
+ return PARENT_OF (cp_cco_bw_alloc_t, set_node, current_node);
+
+ return NULL;
+}
+
+/** Prepare schedules.
+ * \param ctx the module context.
+ * \param set the set to add the allocations.
+ * \param persistence the type of allocation.
+ *
+ * Get the schedules form the BW and initialise the nodes of each alloc to
+ * insert it in the set.
+ */
+void
+cp_cco_bw_schedules_prepare (cp_t *ctx, set_t *set,
+ cp_cco_bw_persistence_t persistence)
+{
+ uint nb = 0;
+ cp_cco_bw_alloc_t *alloc;
+
+ dbg_assert (ctx);
+ dbg_assert (set);
+
+ alloc = cp_cco_bw_get_first_alloc (ctx, persistence);
+ while (alloc)
+ {
+ nb ++;
+ cp_cco_bw_schedules_add (set, alloc, true);
+ alloc = cp_cco_bw_get_next_alloc (ctx, alloc);
+ }
+}
+
+/**
+ * Compare two nodes.
+ * \param left Left node.
+ * \param right Right node.
+ * \return true if the left node is lesser than the right one
+ */
+bool
+cp_cco_bw_schedules_allocation_less (set_node_t * left,
+ set_node_t * right)
+{
+ cp_cco_bw_alloc_t *left_alloc;
+ cp_cco_bw_alloc_t *right_alloc;
+
+ dbg_assert (left);
+ dbg_assert (right);
+
+ left_alloc = PARENT_OF (cp_cco_bw_alloc_t, set_node, left);
+ right_alloc = PARENT_OF (cp_cco_bw_alloc_t, set_node, right);
+
+ if (left_alloc->et_atu < right_alloc->et_atu)
+ return true;
+ else
+ return false;
+}
+
+/** Move the nodes from the source set to the dest set.
+ * \param set_dest the destination set.
+ * \param set_src the source set.
+ */
+void
+cp_cco_bw_schedules_move (set_t *set_dest, set_t *set_src)
+{
+ set_node_t *node;
+
+ dbg_assert (set_dest);
+ dbg_assert (set_src);
+
+ while (!set_empty (set_src))
+ {
+ node = set_begin (set_src);
+ set_remove (set_src, node);
+ set_node_init (node);
+ set_insert (set_dest, node);
+ }
+}
diff --git a/cesar/cp/cco/bw/src/bw_prio_heap.c b/cesar/cp/cco/bw/src/bw_prio_heap.c
new file mode 100644
index 0000000000..f01766554d
--- /dev/null
+++ b/cesar/cp/cco/bw/src/bw_prio_heap.c
@@ -0,0 +1,225 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file bw_prio_heap.c
+ * \brief control the heap of the connection
+ * \ingroup cp_cco_bw
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "lib/blk.h"
+
+#include "string.h"
+#include "cp/cco/bw/inc/bw_prio_heap.h"
+#include "cp/cco/bw/bw_prio_heap.h"
+
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/bw.h"
+#include "lib/list.h"
+
+#include "cp/inc/context.h"
+#include "cp/cp.h"
+
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_get_most_prior_conn (cp_t *ctx)
+{
+ cp_cco_bw_prio_conn_t* conn = NULL;
+ u16 nb_heap = 0;
+
+ dbg_assert(ctx);
+
+ /* while still heaps */
+ while(nb_heap < CP_CCO_BW_NB_PRIORITY_HEAPS
+ && !conn)
+ {
+ conn = cp_cco_bw_prio_heap_get_first_conn(ctx->bw.prio_heap[(CP_CCO_BW_NB_PRIORITY_HEAPS-1) - nb_heap]);
+
+ /* while still conn not allocated in the heap */
+ while(conn && conn->alloc_status)
+ conn = cp_cco_bw_prio_heap_get_next_conn(ctx->bw.prio_heap[(CP_CCO_BW_NB_PRIORITY_HEAPS-1) - nb_heap], conn);
+
+ nb_heap ++;
+ }
+
+ return conn;
+}
+
+void
+cp_cco_bw_prio_heap_add_conn (cp_t *ctx, u16 cid, u8 prio)
+{
+ cp_cco_bw_prio_conn_t *conn;
+
+ dbg_assert(ctx);
+
+ /* Init the new conn */
+ conn = cp_cco_bw_prio_heap_init_prio_conn();
+
+ conn->cid = cid;
+
+ /* add the new conn into the list */
+ list_push(&ctx->bw.prio_heap[prio].conns,&conn->node);
+
+ /* add 1 to the number of conn */
+ ctx->bw.prio_heap[prio].nb_conn++;
+}
+
+void
+cp_cco_bw_prio_heap_del_conn (cp_t *ctx, u16 cid)
+{
+ cp_cco_bw_prio_conn_t* conn = NULL;
+ u16 nb_heap = 0;
+
+ dbg_assert(ctx);
+
+ /* while still heaps */
+ while(nb_heap < CP_CCO_BW_NB_PRIORITY_HEAPS
+ && !conn)
+ {
+ /* first connection of the heap */
+ conn = cp_cco_bw_prio_heap_get_first_conn(ctx->bw.prio_heap[nb_heap]);
+
+ /* while still conn in the heap */
+ while(conn
+ && conn->cid != cid)
+ conn = cp_cco_bw_prio_heap_get_next_conn(ctx->bw.prio_heap[nb_heap], conn);
+
+ if(!conn)
+ nb_heap++;
+ }
+
+ if(conn)
+ {
+ ctx->bw.prio_heap[nb_heap].nb_conn--;
+ list_remove(&ctx->bw.prio_heap[nb_heap].conns,&conn->node);
+ blk_release(conn);
+ }
+}
+
+void
+cp_cco_bw_prio_heap_clear_conn(cp_t *ctx)
+{
+ cp_cco_bw_prio_conn_t *conn;
+ u16 nb_heap = 0;
+
+ dbg_assert(ctx);
+
+ while(nb_heap < CP_CCO_BW_NB_PRIORITY_HEAPS)
+ {
+ conn = cp_cco_bw_prio_heap_get_first_conn(ctx->bw.prio_heap[nb_heap]);
+
+ while(conn)
+ {
+ conn->alloc_status = false;
+ conn = cp_cco_bw_prio_heap_get_next_conn(ctx->bw.prio_heap[nb_heap], conn);
+ }
+ nb_heap++;
+ }
+}
+
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_get_conn(cp_t *ctx, u16 cid)
+{
+ cp_cco_bw_prio_conn_t *conn = NULL;
+ u16 nb_heap = 0;
+
+ dbg_assert(ctx);
+
+ while(nb_heap < CP_CCO_BW_NB_PRIORITY_HEAPS
+ && !conn)
+ {
+ conn = cp_cco_bw_prio_heap_get_first_conn(ctx->bw.prio_heap[nb_heap]);
+
+ while(conn
+ && conn->cid != cid)
+ conn = cp_cco_bw_prio_heap_get_next_conn(ctx->bw.prio_heap[nb_heap], conn);
+
+ nb_heap++;
+ }
+
+ return conn;
+}
+
+void
+cp_cco_bw_prio_heap_init(cp_t *ctx)
+{
+ int i;
+
+ dbg_assert(ctx);
+
+ for(i = 0; i < CP_CCO_BW_NB_PRIORITY_HEAPS ; i++)
+ {
+ ctx->bw.prio_heap[i].table_priority_level = i;
+ ctx->bw.prio_heap[i].nb_conn_allocated = 0;
+ ctx->bw.prio_heap[i].nb_conn = 0;
+ list_init(&ctx->bw.prio_heap[i].conns);
+ }
+}
+
+void
+cp_cco_bw_prio_heap_uninit(cp_t *ctx)
+{
+ u16 nb_heap = 0;
+ cp_cco_bw_prio_conn_t *rel_conn;
+
+ dbg_assert(ctx);
+
+ while(nb_heap < CP_CCO_BW_NB_PRIORITY_HEAPS)
+ {
+
+ while(!list_empty(&ctx->bw.prio_heap[nb_heap].conns))
+ {
+ rel_conn = PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_begin(&ctx->bw.prio_heap[nb_heap].conns));
+
+ list_remove(&ctx->bw.prio_heap[nb_heap].conns, list_begin(&ctx->bw.prio_heap[nb_heap].conns));
+ blk_release(rel_conn);
+ }
+ nb_heap++;
+ }
+}
+
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_init_prio_conn()
+{
+ cp_cco_bw_prio_conn_t *conn;
+
+ conn = blk_alloc();
+ conn->alloc_status = false;
+ list_init_node(&conn->node);
+
+ return conn;
+}
+
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_get_first_conn(cp_cco_bw_prio_heap_t heap)
+{
+ cp_cco_bw_prio_conn_t *conn;
+
+ if(heap.nb_conn)
+ conn = PARENT_OF(cp_cco_bw_prio_conn_t, node, list_begin(&heap.conns));
+ else
+ conn = NULL;
+ return conn;
+}
+
+cp_cco_bw_prio_conn_t*
+cp_cco_bw_prio_heap_get_next_conn(cp_cco_bw_prio_heap_t heap, cp_cco_bw_prio_conn_t *conn)
+{
+ cp_cco_bw_prio_conn_t *next_conn;
+
+ dbg_assert(conn);
+
+ if(&conn->node != list_rbegin(&heap.conns))
+ next_conn = PARENT_OF(cp_cco_bw_prio_conn_t, node, list_next(&conn->node));
+ else
+ next_conn = NULL;
+
+ return next_conn;
+}
diff --git a/cesar/cp/cco/bw/test/Makefile b/cesar/cp/cco/bw/test/Makefile
new file mode 100644
index 0000000000..6fe8e91d4b
--- /dev/null
+++ b/cesar/cp/cco/bw/test/Makefile
@@ -0,0 +1,17 @@
+BASE = ../../../..
+
+ECOS=y
+INCLUDES = cp/cco/bw/test/overide/
+
+TARGET_PROGRAMS = schedules bw_prio_heap_test bw_test
+
+schedules_SOURCES = bw_list_alloc_test.c pwl_stub.c msg_stub.c fsm_stub.c cl_stub.c
+schedules_MODULES = lib cp/cco/bw cp/conn mac/common cp/sta/mgr
+
+bw_prio_heap_test_SOURCES = bw_prio_heap_test.c pwl_stub.c msg_stub.c fsm_stub.c cl_stub.c
+bw_prio_heap_test_MODULES = lib cp/cco/bw cp/conn mac/common cp/sta/mgr
+
+bw_test_SOURCES = bw_test.c pwl_stub.c msg_stub.c fsm_stub.c cl_stub.c
+bw_test_MODULES = lib cp/cco/bw cp/conn mac/common cp/sta/mgr
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/cco/bw/test/bandwidth manager - test plan.ods b/cesar/cp/cco/bw/test/bandwidth manager - test plan.ods
new file mode 100644
index 0000000000..81a2588fa4
--- /dev/null
+++ b/cesar/cp/cco/bw/test/bandwidth manager - test plan.ods
Binary files differ
diff --git a/cesar/cp/cco/bw/test/ecos.ecc.sh b/cesar/cp/cco/bw/test/ecos.ecc.sh
new file mode 100644
index 0000000000..8253d98c9a
--- /dev/null
+++ b/cesar/cp/cco/bw/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/cco/bw/test/overide/cp_fsm_defs.h b/cesar/cp/cco/bw/test/overide/cp_fsm_defs.h
new file mode 100644
index 0000000000..c29fa69e19
--- /dev/null
+++ b/cesar/cp/cco/bw/test/overide/cp_fsm_defs.h
@@ -0,0 +1,38 @@
+#ifndef overide_cp_fsm_defs_h
+#define overide_cp_fsm_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp_fsm_defs.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_all_sta_leaved,
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* overide_cp_fsm_defs_h */
diff --git a/cesar/cp/cco/bw/test/src/bw_list_alloc_test.c b/cesar/cp/cco/bw/test/src/bw_list_alloc_test.c
new file mode 100644
index 0000000000..a7ca23e98b
--- /dev/null
+++ b/cesar/cp/cco/bw/test/src/bw_list_alloc_test.c
@@ -0,0 +1,103 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/beacon_schedules.c
+ * \brief Test the beacon schedules list.
+ * \ingroup cp_beacon
+ *
+ */
+#include "common/std.h"
+
+#include "lib/set.h"
+#include "lib/test.h"
+#include "lib/blk.h"
+#include "cyg/kernel/kapi.h"
+#include "cp/cco/bw/bw_lib_alloc.h"
+
+#include "cp/conn/conn.h"
+/**
+ * Add a node to the set.
+ * \param test the test object.
+ *
+ * Test at the same time:
+ * - Init function
+ * - uninit function
+ * - get first.
+ * - get next.
+ */
+void
+test_case_bw_schedules_add (test_t test)
+{
+ set_t set;
+ cp_cco_bw_alloc_t *alloc;
+
+ cp_cco_bw_schedules_init (&set);
+
+ alloc = blk_alloc();
+ alloc->st_atu = 10;
+ alloc->et_atu = 13;
+ alloc->stpf = true;
+ alloc->glid = 1;
+
+ cp_cco_bw_schedules_add (&set, alloc, true);
+ blk_release (alloc);
+ alloc = NULL;
+
+ alloc = blk_alloc();
+ alloc->et_atu = 15;
+ alloc->stpf = false;
+ alloc->glid = 2;
+
+ cp_cco_bw_schedules_add (&set, alloc, true);
+ blk_release (alloc);
+ alloc = NULL;
+
+
+ test_case_begin (test, "Add a node");
+
+ test_begin (test, "Get the node")
+ {
+ alloc = cp_cco_bw_schedules_get_first (&set);
+ test_fail_if (alloc == NULL, "shall exist");
+ test_fail_if (alloc->st_atu != 10, "Wrong start time");
+ test_fail_if (alloc->et_atu != 13, "Wrong end time");
+ test_fail_if (alloc->glid != 1, "Wrong GLID");
+ test_fail_if (alloc->stpf != true, "Wrong stpf");
+
+ alloc = cp_cco_bw_schedules_get_next (&set, alloc);
+ test_fail_if (alloc == NULL, "shall exist");
+ test_fail_if (alloc->et_atu != 15, "Wrong end time");
+ test_fail_if (alloc->glid != 2, "Wrong GLID");
+ test_fail_if (alloc->stpf != false, "Wrong stpf");
+ }
+ test_end;
+
+ cp_cco_bw_schedules_uninit (&set);
+}
+
+int
+main (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_bw_schedules_add (test);
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT(test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/cco/bw/test/src/bw_prio_heap_test.c b/cesar/cp/cco/bw/test/src/bw_prio_heap_test.c
new file mode 100644
index 0000000000..2d08c45d6d
--- /dev/null
+++ b/cesar/cp/cco/bw/test/src/bw_prio_heap_test.c
@@ -0,0 +1,319 @@
+
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file bw.c
+ * \brief bandwidth manager module
+ * \ingroup cp_cco_bw
+ *
+ * Control the schedule of the becon period
+ */
+#include "common/std.h"
+
+#include "lib/blk.h"
+#include "lib/test.h"
+#include "string.h"
+
+#include "lib/bitstream.h"
+
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/bw.h"
+#include "cp/cco/bw/inc/bw_prio_heap.h"
+#include "cp/cco/bw/bw_prio_heap.h"
+
+#include "cp/conn/conn.h"
+#include "cp/conn/conn_mgr.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "lib/list.h"
+
+/**
+ * Test the initialisation of the prio heaps
+ * \param test test paramters
+ *
+ */
+
+void
+test_case_bw_prio_heap_init (test_t test, cp_t *cp)
+{
+
+ test_case_begin (test, "Init prio heaps");
+
+ cp_pwl_init(cp);
+ cp_cco_bw_init(cp);
+
+ test_begin(test,"Init prio heaps"){
+ test_fail_if(cp->bw.prio_heap[3].nb_conn_allocated != 0,
+ "There shouldn't be any connection allocated") ;
+ test_fail_if(cp->bw.prio_heap[3].nb_conn != 0,
+ "There shouldn't be any connection");
+ test_fail_if(cp->bw.prio_heap[3].table_priority_level != 3,
+ "The priority is false");
+ test_fail_if(cp->bw.prio_heap[1].table_priority_level != 1,
+ "The heaps aren't well linked");
+ }
+ test_end;
+}
+/**
+ * Test the initialisation of the prio heaps
+ * \param test test paramters
+ *
+ *
+ */
+void
+test_case_bw_prio_heap_uninit (test_t test, cp_t *cp)
+{
+
+ test_case_begin (test, "Init prio heaps");
+
+ cp_cco_bw_uninit(cp);
+
+ test_begin(test,"Init prio heaps"){
+ test_fail_if(!blk_check_memory(),
+ "Memory allocation pb");
+ }
+ test_end;
+}
+
+void
+test_case_bw_prio_heap_add_conns (test_t test, cp_t *cp)
+{
+
+ u8 cid[3][4];
+ u8 prio[4];
+ int i;
+ int j;
+
+ test_case_begin (test, "Add connections into prio heaps");
+
+ for(i=0;i<4;i++){
+ for(j=0;j<3;j++)
+ cid[j][i] = (i*10)+j;
+ prio[i] = i;
+ }
+ for(i=0;i<4;i++)
+ for(j=0;j<3;j++)
+ cp_cco_bw_prio_heap_add_conn(cp,cid[j][i],prio[i]);
+
+ test_begin(test,"add connection into prio heaps"){
+ test_fail_if(PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_begin(&cp->bw.prio_heap[3].conns))->cid != 30,
+ "failure add : cid prio 3 conn 0");
+ test_fail_if(PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_next(list_begin(&cp->bw.prio_heap[2].conns)))->cid != 21,
+ "failure add :cid prio 2 conn 1");
+ test_fail_if(PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_next(list_next(list_begin(&cp->bw.prio_heap[1].conns))))->cid != 12,
+ "failure add :cid prio 1 conn 2");
+ test_fail_if(PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_next(list_next(list_begin(&cp->bw.prio_heap[0].conns))))->cid != 2,
+ "failure add :cid prio 0 conn 2");
+ }
+ test_end;
+}
+
+void
+test_case_bw_prio_heap_del_conns (test_t test)
+{
+
+ cp_t cp;
+
+ test_case_bw_prio_heap_init(test, &cp);
+
+ test_case_bw_prio_heap_add_conns (test, &cp);
+
+ test_case_begin (test, "\nDel connections into prio heaps\n\n");
+
+ //Del all add 1st
+ cp_cco_bw_prio_heap_del_conn(&cp,30);
+ cp_cco_bw_prio_heap_del_conn(&cp,31);
+ cp_cco_bw_prio_heap_del_conn(&cp,32);
+ cp_cco_bw_prio_heap_add_conn(&cp,35,3);
+
+ //Add last remove all firsts
+ cp_cco_bw_prio_heap_add_conn(&cp,25,2);
+ cp_cco_bw_prio_heap_del_conn(&cp,20);
+ cp_cco_bw_prio_heap_del_conn(&cp,21);
+ cp_cco_bw_prio_heap_del_conn(&cp,22);
+
+ //Del Last add Last
+ cp_cco_bw_prio_heap_del_conn(&cp,12);
+ cp_cco_bw_prio_heap_add_conn(&cp,12,1);
+
+ //Del first add last
+ cp_cco_bw_prio_heap_del_conn(&cp,0);
+ cp_cco_bw_prio_heap_add_conn(&cp,0,0);
+
+
+ test_begin(test,"Del connection into prio heaps"){
+ test_fail_if(PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_begin(&cp.bw.prio_heap[3].conns))->cid != 35,
+ "failure remove all conn + add 1st");
+ test_fail_if(PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_begin(&cp.bw.prio_heap[2].conns))->cid !=25,
+ "failure add 1 remove all");
+ test_fail_if(PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_next(list_next(list_begin(&cp.bw.prio_heap[1].conns))))->cid != 12,
+ "failure remove last add last");
+ test_fail_if(PARENT_OF(cp_cco_bw_prio_conn_t,
+ node,
+ list_next(list_next(list_begin(&cp.bw.prio_heap[0].conns))))->cid != 0,
+ "failure remove first add last");
+ }
+ test_end;
+
+ test_case_bw_prio_heap_uninit(test, &cp);
+}
+
+void
+test_case_bw_prio_get_most_prior_conn (test_t test)
+{
+
+ cp_t cp;
+ cp_cco_bw_prio_conn_t* most_prior_conn[5];
+
+ test_case_bw_prio_heap_init(test, &cp);
+
+ test_case_begin(test, "\nGet most prior conn");
+
+ most_prior_conn[0] = cp_cco_bw_prio_heap_get_most_prior_conn(&cp);
+
+ cp_cco_bw_prio_heap_add_conn(&cp,1,0);
+
+ most_prior_conn[1] = cp_cco_bw_prio_heap_get_most_prior_conn(&cp);
+
+ most_prior_conn[1]->alloc_status = true;
+
+ cp_cco_bw_prio_heap_add_conn(&cp,2,0);
+ cp_cco_bw_prio_heap_add_conn(&cp,3,0);
+
+ most_prior_conn[2] = cp_cco_bw_prio_heap_get_most_prior_conn(&cp);
+
+ cp_cco_bw_prio_heap_add_conn(&cp,10,1);
+ cp_cco_bw_prio_heap_add_conn(&cp,20,2);
+ cp_cco_bw_prio_heap_add_conn(&cp,21,2);
+
+ most_prior_conn[3] = cp_cco_bw_prio_heap_get_most_prior_conn(&cp);
+
+ cp_cco_bw_prio_heap_add_conn(&cp,30,3);
+ cp_cco_bw_prio_heap_add_conn(&cp,31,3);
+ cp_cco_bw_prio_heap_add_conn(&cp,32,3);
+
+ most_prior_conn[4] = cp_cco_bw_prio_heap_get_most_prior_conn(&cp);
+
+ test_begin(test,"Get most prior conn")
+ {
+ test_fail_if(most_prior_conn[0] != NULL,
+ "There shouldn't be any connection");
+ test_fail_if(most_prior_conn[1]->cid != 1,
+ "Only one connection");
+ test_fail_if(most_prior_conn[2]->cid != 2,
+ "First conn not prior");
+ test_fail_if(most_prior_conn[3]->cid != 20,
+ "Priority 2 first element shoud be prior");
+ test_fail_if(most_prior_conn[4]->cid != 30,
+ "Priority 3 first element shoul be prior");
+ }
+ test_end;
+
+ test_case_bw_prio_heap_uninit(test, &cp);
+}
+
+void
+test_case_bw_prio_heap_clear_conn(test_t test)
+{
+ cp_t cp;
+ cp_cco_bw_prio_conn_t *test_conn[3];
+ cp_cco_bw_prio_conn_t *tmp_conn;
+
+ test_case_bw_prio_heap_init(test, &cp);
+
+ cp_cco_bw_prio_heap_add_conn(&cp,10,0);
+ tmp_conn = cp_cco_bw_prio_heap_get_conn(&cp, 10);
+ tmp_conn->alloc_status = true;
+
+ cp_cco_bw_prio_heap_add_conn(&cp,20,0);
+ tmp_conn = cp_cco_bw_prio_heap_get_conn(&cp, 20);
+ tmp_conn->alloc_status = true;
+
+ cp_cco_bw_prio_heap_add_conn(&cp,30,0);
+ tmp_conn = cp_cco_bw_prio_heap_get_conn(&cp, 30);
+ tmp_conn->alloc_status = true;
+
+ test_case_begin(test, "\nClear conns");
+
+ cp_cco_bw_prio_heap_clear_conn(&cp);
+
+ test_conn[0] = cp_cco_bw_prio_heap_get_conn(&cp, 10);
+ test_conn[1] = cp_cco_bw_prio_heap_get_conn(&cp, 20);
+ test_conn[2] = cp_cco_bw_prio_heap_get_conn(&cp, 30);
+
+ test_begin(test,"Clear conns")
+ {
+ test_fail_if(test_conn[0]->alloc_status,
+ "The connection status should be not allocated (false) 0");
+ test_fail_if(test_conn[1]->alloc_status,
+ "The connection status should be not allocated (false) 1");
+ test_fail_if(test_conn[2]->alloc_status,
+ "The connection status should be not allocated (false) 2");
+ }
+ test_end;
+
+ test_case_bw_prio_heap_uninit(test, &cp);
+}
+
+void
+test_case_bw_prio_get_conn(test_t test)
+{
+ cp_t cp;
+ cp_cco_bw_prio_conn_t *conn;
+
+ test_case_bw_prio_heap_init(test, &cp);
+
+ cp_cco_bw_prio_heap_add_conn(&cp,10,0);
+ cp_cco_bw_prio_heap_add_conn(&cp,20,0);
+ cp_cco_bw_prio_heap_add_conn(&cp,30,0);
+
+ test_case_begin(test, "\nGet conns");
+
+ conn = cp_cco_bw_prio_heap_get_conn(&cp,20);
+
+ test_begin(test,"Get conns")
+ {
+ test_fail_if(conn->cid != 20,
+ "We don't get the good allocation (wrong CID)");
+ }
+ test_end;
+
+ test_case_bw_prio_heap_uninit(test, &cp);
+
+}
+int
+main (void){
+ test_t test;
+
+ test_init(test, 0, NULL);
+
+ test_case_bw_prio_get_conn(test);
+ test_case_bw_prio_heap_clear_conn(test);
+ test_case_bw_prio_get_most_prior_conn (test);
+ test_case_bw_prio_heap_del_conns (test);
+
+ test_result (test);
+ HAL_PLATFORM_EXIT(test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+
+}
diff --git a/cesar/cp/cco/bw/test/src/bw_test.c b/cesar/cp/cco/bw/test/src/bw_test.c
new file mode 100644
index 0000000000..0cd165a251
--- /dev/null
+++ b/cesar/cp/cco/bw/test/src/bw_test.c
@@ -0,0 +1,1277 @@
+ /* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \log bw.c
+ * \brief bandwidth manager module
+ * \ingroup cp_cco_bw
+ *
+ * Control the schedule of the becon period
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "lib/blk.h"
+#include "lib/test.h"
+#include "string.h"
+#include "mac/common/timings.h"
+
+#include "lib/bitstream.h"
+
+#include "cp/pwl/pwl.h"
+
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/inc/bw.h"
+#include "cp/cco/bw/bw_prio_heap.h"
+#include "cp/cco/bw/inc/bw_prio_heap.h"
+
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/conn_mgr.h"
+
+#include "lib/list.h"
+
+#include <stdio.h>
+
+
+#define INIT_TEST_MULITPLE_ALLOC(val)\
+ if (val == 0){\
+ \
+ nb_ble = 10;\
+ \
+ alloc[0].st_atu = 782;\
+ alloc[0].et_atu = 792;\
+ alloc[1].st_atu = 1052;\
+ alloc[1].et_atu = 1062;\
+ alloc[2].st_atu = 1257;\
+ alloc[2].et_atu = 1267;\
+ alloc[3].st_atu = 1302;\
+ alloc[3].et_atu = 1312;\
+ alloc[4].st_atu = 1683;\
+ alloc[4].et_atu = 1693;\
+ alloc[5].st_atu = 2083;\
+ alloc[5].et_atu = 2093;\
+ alloc[6].st_atu = 2925;\
+ alloc[6].et_atu = 2935;\
+ alloc[7].st_atu = 3802;\
+ alloc[7].et_atu = 3812;\
+ alloc[8].st_atu = 3838;\
+ alloc[8].et_atu = 3848;\
+ alloc[9].st_atu = 3874;\
+ alloc[9].et_atu = 3896;\
+ \
+ nb_pb = 25;\
+ \
+ alloc[0].cid = 0;\
+ alloc[1].cid = 0;\
+ alloc[2].cid = 0;\
+ alloc[3].cid = 0;\
+ alloc[4].cid = 0;\
+ alloc[5].cid = 0;\
+ alloc[6].cid = 0;\
+ alloc[7].cid = 0;\
+ alloc[8].cid = 0;\
+ alloc[9].cid = 0;\
+ \
+ ble_value[0] = 100;\
+ ble_value[1] = 50;\
+ ble_value[2] = 80;\
+ ble_value[3] = 150;\
+ ble_value[4] = 35;\
+ ble_value[5] = 40;\
+ ble_value[6] = 25;\
+ ble_value[7] = 30;\
+ ble_value[8] = 300;\
+ ble_value[9] = 200;\
+ \
+ ble_end_time[0] = 782;\
+ ble_end_time[1] = 1052;\
+ ble_end_time[2] = 1257;\
+ ble_end_time[3] = 1302;\
+ ble_end_time[4] = 1683;\
+ ble_end_time[5] = 2083;\
+ ble_end_time[6] = 2925;\
+ ble_end_time[7] = 3802;\
+ ble_end_time[8] = 3838;\
+ ble_end_time[9] = 3906;\
+ \
+ }\
+ if (val == 1){\
+ \
+ nb_ble = 10;\
+ \
+ alloc[0].st_atu = 1042;\
+ alloc[0].et_atu = 1052;\
+ alloc[1].st_atu = 1282;\
+ alloc[1].et_atu = 1292;\
+ alloc[2].st_atu = 1663;\
+ alloc[2].et_atu = 1673;\
+ alloc[3].st_atu = 2063;\
+ alloc[3].et_atu = 2073;\
+ alloc[4].st_atu = 3772;\
+ alloc[4].et_atu = 3782;\
+ alloc[5].st_atu = 3808;\
+ alloc[5].et_atu = 3818;\
+ alloc[6].st_atu = 3844;\
+ alloc[6].et_atu = 3896;\
+ \
+ nb_pb = 40;\
+ \
+ alloc[0].cid = 0;\
+ alloc[1].cid = 0;\
+ alloc[2].cid = 0;\
+ alloc[3].cid = 0;\
+ alloc[4].cid = 0;\
+ alloc[5].cid = 0;\
+ alloc[6].cid = 0;\
+ \
+ ble_value[0] = 100;\
+ ble_value[1] = 50;\
+ ble_value[2] = 80;\
+ ble_value[3] = 150;\
+ ble_value[4] = 35;\
+ ble_value[5] = 40;\
+ ble_value[6] = 25;\
+ ble_value[7] = 30;\
+ ble_value[8] = 300;\
+ ble_value[9] = 200;\
+ \
+ ble_end_time[0] = 782;\
+ ble_end_time[1] = 1042;\
+ ble_end_time[2] = 1247;\
+ ble_end_time[3] = 1282;\
+ ble_end_time[4] = 1663;\
+ ble_end_time[5] = 2063;\
+ ble_end_time[6] = 2905;\
+ ble_end_time[7] = 3772;\
+ ble_end_time[8] = 3808;\
+ ble_end_time[9] = 3906;\
+ }
+#define INIT_TEST_COMPLETE_SCHEDULE(val)\
+if(val == 0){\
+ \
+ nb_ble = 10;\
+ \
+ ble_value[0] = 90;\
+ ble_value[1] = 50;\
+ ble_value[2] = 80;\
+ ble_value[3] = 120;\
+ ble_value[4] = 35;\
+ ble_value[5] = 40;\
+ ble_value[6] = 25;\
+ ble_value[7] = 30;\
+ ble_value[8] = 70;\
+ ble_value[9] = 160;\
+ \
+ ble_end_time[0] = 935;\
+ ble_end_time[1] = 1195;\
+ ble_end_time[2] = 1390;\
+ ble_end_time[3] = 1429;\
+ ble_end_time[4] = 1785;\
+ ble_end_time[5] = 2175;\
+ ble_end_time[6] = 3007;\
+ ble_end_time[7] = 3735;\
+ ble_end_time[8] = 3839;\
+ ble_end_time[9] = 3906;\
+ \
+ conn_nb_pb[0]=10;\
+ conn_nb_pb[1]=15;\
+ conn_nb_pb[2]=20;\
+ conn_nb_pb[3]=20;\
+ conn_nb_pb[4]=15;\
+ conn_nb_pb[5]=25;\
+ conn_nb_pb[6]=30;\
+ conn_nb_pb[7]=30;\
+ conn_nb_pb[8]=5;\
+ conn_nb_pb[9]=10;\
+ \
+ conn_prio[0]=1;\
+ conn_prio[1]=2;\
+ conn_prio[2]=0;\
+ conn_prio[3]=3;\
+ conn_prio[4]=1;\
+ conn_prio[5]=2;\
+ conn_prio[6]=0;\
+ conn_prio[7]=3;\
+ conn_prio[8]=2;\
+ conn_prio[9]=3;\
+}
+#define INIT_TEST_F_AND_R_ALLOC(val)\
+if(val == 0)\
+{\
+ nb_ble = 10;\
+ \
+ ble_value[0] = 90;\
+ ble_value[1] = 50;\
+ ble_value[2] = 80;\
+ ble_value[3] = 120;\
+ ble_value[4] = 35;\
+ ble_value[5] = 40;\
+ ble_value[6] = 25;\
+ ble_value[7] = 30;\
+ ble_value[8] = 70;\
+ ble_value[9] = 160;\
+ \
+ ble_end_time[0] = 935;\
+ ble_end_time[1] = 1195;\
+ ble_end_time[2] = 1390;\
+ ble_end_time[3] = 1429;\
+ ble_end_time[4] = 1785;\
+ ble_end_time[5] = 2175;\
+ ble_end_time[6] = 3007;\
+ ble_end_time[7] = 3735;\
+ ble_end_time[8] = 3839;\
+ ble_end_time[9] = 3906;\
+ \
+ link_nb_pb[0][0]=20;\
+ link_nb_pb[0][1]=30;\
+ link_nb_pb[1][0]=10;\
+ link_nb_pb[1][1]=15;\
+ link_nb_pb[2][0]=25;\
+ link_nb_pb[2][1]=5;\
+ link_nb_pb[3][0]=10;\
+ link_nb_pb[3][1]=15;\
+ link_nb_pb[4][0]=20;\
+ link_nb_pb[4][1]=30;\
+ \
+ link_prio[0][0]=3;\
+ link_prio[0][1]=3;\
+ link_prio[1][0]=3;\
+ link_prio[1][1]=3;\
+ link_prio[2][0]=2;\
+ link_prio[2][1]=2;\
+ link_prio[3][0]=1;\
+ link_prio[3][1]=1;\
+ link_prio[4][0]=0;\
+ link_prio[4][1]=0;\
+\
+}
+
+
+
+u16 ble_value[10];
+u16 ble_end_time[10];
+u16 link_nb_pb[5][10];
+u16 link_prio[5][10];
+u16 conn_nb_pb[10];
+u16 conn_prio[10];
+u16 nb_pb;
+u16 nb_ble;
+
+cp_cco_bw_alloc_t alloc[10];
+
+/*Test the initialisation of the BW manager*/
+void
+test_case_bw_init(test_t test, cp_t *cp)
+{
+ test_case_begin(test, "\ninit BW");
+
+ cp_pwl_init(cp);
+ cp_conn_mgr_init(cp);
+ cp_sta_mgr_init(cp);
+ cp_cco_bw_init(cp);
+
+ test_begin(test,"init BW")
+ {
+ }
+ test_end;
+}
+
+/*Test the uninit of the BW and the release of the memory*/
+void
+test_case_bw_uninit(test_t test,cp_t *cp)
+{
+ test_case_begin(test, "\nUninit BW");
+
+ cp_conn_mgr_uninit(cp);
+ cp_sta_mgr_uninit(cp);
+ cp_cco_bw_uninit(cp);
+
+ test_begin(test,"Uninit BW")
+ {
+ test_fail_if(!list_empty(&cp->bw.actual_schedule),
+ "actual schedule not empty");
+ test_fail_if(!list_empty(&cp->bw.finalised_schedule),
+ "actual schedule not empty");
+ test_fail_if(!blk_check_memory(),
+ "Memroy allocation pb");
+ }
+ test_end;
+}
+
+/*Test the initialisation of a new schedule*/
+void
+test_case_bw_init_new_sched (test_t test)
+{
+ cp_t cp;
+
+ cp_cco_bw_alloc_t *beacon;
+ cp_cco_bw_alloc_t *mincsma;
+ cp_cco_bw_alloc_t *cfpi;
+ cp_cco_bw_alloc_t *end_tdma;
+
+ u16 beacon_st;
+ u16 beacon_et;
+ u16 mincsma_glid;
+ u16 mincsma_st;
+ u16 mincsma_et;
+ u16 cfpi_glid;
+ u16 cfpi_st;
+ u16 cfpi_et;
+ u16 end_tdma_glid;
+ u16 end_tdma_st;
+ u16 end_tdma_et;
+
+ test_case_bw_init(test, &cp);
+
+ test_case_begin(test, "\nInit new schedule");
+
+ cp_cco_bw_new_sched(&cp);
+
+ beacon = PARENT_OF(cp_cco_bw_alloc_t, node, list_begin(&cp.bw.actual_schedule));
+ beacon_st = beacon->st_atu;
+ beacon_et = beacon->et_atu;
+
+ mincsma = PARENT_OF(cp_cco_bw_alloc_t, node, list_next(&beacon->node));
+ mincsma_glid = mincsma->glid;
+ mincsma_st = mincsma->st_atu;
+ mincsma_et = mincsma->et_atu;
+
+ cfpi = PARENT_OF(cp_cco_bw_alloc_t, node, list_next(&mincsma->node));
+ cfpi_glid = cfpi->glid;
+ cfpi_st = cfpi->st_atu;
+ cfpi_et = cfpi->et_atu;
+
+ end_tdma = PARENT_OF(cp_cco_bw_alloc_t, node, list_next(&cfpi->node));
+ end_tdma_glid = end_tdma->glid;
+ end_tdma_st = end_tdma->st_atu;
+ end_tdma_et = end_tdma->et_atu;
+
+ test_begin(test,"Init new schedule")
+ {
+ test_fail_if(beacon_st != 0,
+ "wrong beacon start time ");
+ test_fail_if(beacon_et != CP_CCO_BW_ALLOC_TIME_BEACON_ATU,
+ "wrong beacon end time");
+
+ test_fail_if(mincsma_glid != MAC_LID_LOCAL_CSMA,
+ "wrong mincsma GLID");
+ test_fail_if(mincsma_st != CP_CCO_BW_ALLOC_TIME_BEACON_ATU,
+ "wrong mincsma start time ");
+ test_fail_if(mincsma_et != mincsma_st + CP_CCO_BW_ALLOC_TIME_MINCSMA_ATU,
+ "wrong mincsma end time");
+
+ test_fail_if(cfpi_glid != MAC_LID_CFPI,
+ "wrong cfpi GLID");
+ test_fail_if(cfpi_st != mincsma_et,
+ "wrong cfpi start time");
+ test_fail_if(cfpi_et != cfpi_st + CP_CCO_BW_ALLOC_TIME_CFPI_ATU,
+ "wrong cfpi end time");
+
+ test_fail_if(end_tdma_glid != MAC_LID_LOCAL_CSMA,
+ "wrong end TDMA protection GLID");
+ test_fail_if(end_tdma_st != end_tdma_et - CP_CCO_BW_ALLOC_TIME_END_TDMA_PROTECTION_ATU,
+ "wrong end TDMA protection start time");
+ test_fail_if(end_tdma_et != 3906,
+ "wrong end TDMA protection end time");
+ }
+ test_end;
+ test_case_bw_uninit(test, &cp);
+}
+
+/*Test the function to get_alloc_ble*/
+void
+test_case_get_alloc_ble(test_t test, u8 test_id)
+{
+ u16 i;
+ cp_t cp;
+ cp_link_t *link;
+ cp_link_ble_interval_t *first_ble_interval;
+ cp_link_ble_interval_t *last_ble;
+ cp_cco_bw_alloc_t first_alloc[3];
+ cp_cco_bw_alloc_t last_alloc[3];
+ bool result[3];
+
+ test_case_bw_init(test, &cp);
+
+ cp_cco_bw_new_sched(&cp);
+
+ /*Fill BLE*/
+ link = cp_link_init();
+
+ for(i=0;i<nb_ble;i++)
+ cp_link_push_ble(link, ble_value[i], ble_end_time[i]);
+
+ first_ble_interval = PARENT_OF(cp_link_ble_interval_t, node, list_begin(&link->list_ble));
+
+ if(test_id == 0)
+ {
+ first_alloc[0] = alloc[0];
+ last_alloc[0] = alloc[1];
+ first_alloc[1] = alloc[2];
+ last_alloc[1] = alloc[3];
+ first_alloc[2] = alloc[6];
+ last_alloc[2] = alloc[7];
+ }
+ else if(test_id == 1)
+ {
+ first_alloc[0] = alloc[0];
+ last_alloc[0] = alloc[1];
+ first_alloc[1] = alloc[1];
+ last_alloc[1] = alloc[2];
+ first_alloc[2] = alloc[3];
+ last_alloc[2] = alloc[4];
+ }
+
+ test_case_begin(test, "try to find free time to allocate");
+
+ for(i=0;i<3;i++)
+ {
+ while(first_ble_interval->et_atu < first_alloc[i].et_atu)
+ first_ble_interval = PARENT_OF(cp_link_ble_interval_t, node, list_next(&first_ble_interval->node));
+
+ last_ble = first_ble_interval;
+
+ result[i] = cp_cco_bw_get_alloc_ble(&first_ble_interval, &last_ble, nb_pb, &first_alloc[i], &last_alloc[i]);
+ }
+
+ test_begin(test, "try to find free time to allocate")
+ {
+ test_fail_if(result[0],"there should be enough free time 1");
+ test_fail_if(!result[1],"there shouldn't be enough free time 2");
+ test_fail_if(result[2],"there should be enough free time 3");
+ }
+ test_end;
+ cp_link_uninit(link);
+ test_case_bw_uninit(test, &cp);
+}
+
+/*Test a complete allocation
+ * From the connection creation
+ * Only forward links
+ * Only 1 TXOP
+ * Fake allocation are added to test the different part of the algorithm */
+void
+test_case_complete_allocation (test_t test, u8 test_id)
+{
+ u16 i,j;
+ cp_t cp;
+ u16 nb_alloc;
+
+ cp_conn_t *conn[3];
+ cp_cco_bw_alloc_t *alloc_tmp;
+ cp_cco_bw_alloc_t *alloc_test[3];
+
+ /*Initiate the bw context and conn context*/
+ test_case_bw_init(test, &cp);
+
+ cp_cco_bw_new_sched(&cp);
+
+ /*Initiate the connection values needed for its allocation*/
+ for(i=0;i<3;i++)
+ {
+ conn[i] = cp_conn_init_conn(&cp);
+ conn[i]->conn_info.cid = (i+1)*100;
+ conn[i]->flink->cinfo->valid_cinfo = 0x01;
+ conn[i]->flink->qmp->av_nb_pb = nb_pb;
+ conn[i]->flink->qmp->nb_txop = 1;
+ conn[i]->rlink->cinfo->valid_cinfo = 0x00;
+ conn[i]->flink->cinfo->user_priority = 0;
+ conn[i]->rlink->cinfo->user_priority = 0;
+ cp_conn_add_conn(&cp, conn[i]);
+
+ /*Init the BLEs*/
+ for(j=0;j<nb_ble;j++)
+ cp_link_push_ble(conn[i]->flink, ble_value[j], ble_end_time[j]);
+ }
+ /*Add the fake allocation to test the allocation fonction*/
+ if(test_id == 0)
+ nb_alloc = 10;
+
+ else if(test_id == 1)
+ nb_alloc = 6;
+
+ for(i=0;i<nb_alloc;i++)
+ {
+ alloc_tmp = blk_alloc();
+ alloc_tmp->st_atu = alloc[i].st_atu;
+ alloc_tmp->et_atu = alloc[i].et_atu;
+ alloc_tmp->cid = alloc[i].cid;
+ cp_cco_bw_alloc_add(&cp, alloc_tmp);
+ }
+
+ test_case_begin(test, "Try to allocate into the Beacon Period");
+
+ for(i=0;i<3;i++)
+ cp_cco_bw_alloc(&cp, cp_conn_get_conn(&cp,(i+1)*100)->flink, (i+1)*100);
+
+ for(i=0;i<3;i++)
+ alloc_test[i] = cp_cco_bw_alloc_get_first_txop(&cp, (i+1)*100);
+
+ test_begin(test, "Try to allocate into the Beacon Period")
+ {
+ if(test_id == 0)
+ {
+ test_fail_if(alloc_test[0]->st_atu != 1062,
+ "TEST 1 : wrong allocation st 1");
+ test_fail_if(alloc_test[0]->et_atu != 1225,
+ "TEST 1 : wrong allocation et 1");
+ test_fail_if(alloc_test[1]->st_atu != 792,
+ "TEST 1 : wrong allocation st 2");
+ test_fail_if(alloc_test[1]->et_atu != 1052,
+ "TEST 1 : wrong allocation et 2");
+ test_fail_if(alloc_test[2]->st_atu != 1693,
+ "TEST 1 : wrong allocation st 3");
+ test_fail_if(alloc_test[2]->et_atu != 2018,
+ "TEST 1 : wrong allocation et 3");
+ }
+ else if(test_id == 1)
+ {
+ test_fail_if(alloc_test[0]->st_atu != 1052,
+ "TEST 2 : wrong allocation st 1");
+ test_fail_if(alloc_test[0]->et_atu != 1282,
+ "TEST 2 : wrong allocation et 1");
+ test_fail_if(alloc_test[1]->st_atu != 678,
+ "TEST 2 : wrong allocation st 2");
+ test_fail_if(alloc_test[1]->et_atu != 990,
+ "TEST 2 : wrong allocation et 2");
+ test_fail_if(alloc_test[2]->st_atu != 2905,
+ "TEST 2 : wrong allocation st 3");
+ test_fail_if(alloc_test[2]->et_atu != 3599,
+ "TEST 2 : wrong allocation et 3");
+ }
+ }
+ test_end;
+ test_case_bw_uninit(test, &cp);
+}
+
+/*Test a complete schedule
+ * From the connection creation
+ * Only forward links
+ * Only 1 TXOP
+ * No fake allocations*/
+void
+test_case_complete_schedule (test_t test)
+{
+ cp_t cp;
+ cp_net_t *avln;
+ cp_sta_t *sta;
+ int i, j;
+
+ cp_cco_bw_alloc_t *alloc_test[13];
+ cp_conn_t *conn[10];
+
+ test_case_bw_init(test, &cp);
+ avln = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_sta_add (&cp, avln, 1, 1);
+
+ /*Init the connections*/
+ for(i = 0 ; i < 10 ; i++)
+ {
+ conn[i] = cp_conn_init_conn(&cp);
+ conn[i]->conn_info.cid = (i+1)*10;
+ conn[i]->flink->cinfo->valid_cinfo = 0x01;
+ conn[i]->conn_info.cspec.f_cinfo->user_priority = conn_prio[i];
+ conn[i]->conn_info.cspec.f_qmp->nb_txop = 1;
+ conn[i]->conn_info.cspec.f_qmp->av_nb_pb = conn_nb_pb[i];
+ conn[i]->rlink->cinfo->valid_cinfo = 0x00;
+ cp_conn_add_conn(&cp, conn[i]);
+
+ /*Init the BLEs*/
+ for(j = 0 ; j < nb_ble ; j++)
+ cp_link_push_ble(conn[i]->flink, ble_value[j], ble_end_time[j]);
+ }
+
+ test_case_begin(test, "Complete Schedule");
+
+ cp_cco_bw_alloc_sched(&cp);
+
+ alloc_test[0] = cp_cco_bw_get_first_alloc_actual(&cp);
+
+ for(i = 1 ; i < 14 ; i++)
+ alloc_test[i] = cp_cco_bw_get_next_alloc_actual(alloc_test[i-1]);
+
+ test_begin(test, "Complete Schedule")
+ {
+ test_fail_if(alloc_test[4]->st_atu != 819,
+ "wrong allocation st");
+ test_fail_if(alloc_test[4]->et_atu != 877,
+ "wrong allocation st");
+ test_fail_if(alloc_test[4]->cid != 100,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[5]->st_atu != 877,
+ "wrong allocation st");
+ test_fail_if(alloc_test[5]->et_atu != 987,
+ "wrong allocation st");
+ test_fail_if(alloc_test[5]->cid != 20,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[6]->st_atu != 1018,
+ "wrong allocation st");
+ test_fail_if(alloc_test[6]->et_atu != 1253,
+ "wrong allocation st");
+ test_fail_if(alloc_test[6]->cid != 60,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[7]->st_atu != 1253,
+ "wrong allocation st");
+ test_fail_if(alloc_test[7]->et_atu != 1429,
+ "wrong allocation st");
+ test_fail_if(alloc_test[7]->cid != 80,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[8]->st_atu != 1429,
+ "wrong allocation st");
+ test_fail_if(alloc_test[8]->et_atu != 1727,
+ "wrong allocation st");
+ test_fail_if(alloc_test[8]->cid != 30,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[9]->st_atu != 1785,
+ "wrong allocation st");
+ test_fail_if(alloc_test[9]->et_atu != 1915,
+ "wrong allocation st");
+ test_fail_if(alloc_test[9]->cid != 10,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[10]->st_atu != 1915,
+ "wrong allocation st");
+ test_fail_if(alloc_test[10]->et_atu != 2110,
+ "wrong allocation st");
+ test_fail_if(alloc_test[10]->cid != 50,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[11]->st_atu != 3007,
+ "wrong allocation st");
+ test_fail_if(alloc_test[11]->et_atu != 3527,
+ "wrong allocation st");
+ test_fail_if(alloc_test[11]->cid != 70,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[12]->st_atu != 3735,
+ "wrong allocation st");
+ test_fail_if(alloc_test[12]->et_atu != 3773,
+ "wrong allocation st");
+ test_fail_if(alloc_test[12]->cid != 90,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[13]->st_atu != 3816,
+ "wrong allocation st");
+ test_fail_if(alloc_test[13]->et_atu != 3896,
+ "wrong allocation st");
+ test_fail_if(alloc_test[13]->cid != 40,
+ "wrong allocation cid");
+ }
+ test_end;
+ slab_release(sta);
+ test_case_bw_uninit(test, &cp);
+}
+
+/* Test the add and get allocation functions*/
+void
+test_case_add_get_alloc(test_t test)
+{
+ cp_t cp;
+ cp_cco_bw_alloc_t *alloc;
+ cp_cco_bw_alloc_t *test_alloc;
+
+ test_case_bw_init(test, &cp);
+
+ alloc = blk_alloc();
+ alloc->st_atu = 1500;
+ alloc->et_atu = 2000;
+ alloc->cid = 100;
+
+ test_case_begin(test, "Add Get Allocation");
+
+ cp_cco_bw_alloc_add(&cp, alloc);
+ test_alloc = cp_cco_bw_alloc_get_first_txop(&cp, 100);
+
+ test_begin(test, "Add Get Allocation")
+ {
+ test_fail_if(test_alloc->st_atu != 1500,
+ "wrong allocation st");
+ test_fail_if(test_alloc->et_atu != 2000,
+ "wrong allocation et");
+ test_fail_if(test_alloc->cid != 100,
+ "wrong allocation cid");
+ }
+ test_end;
+
+ test_case_bw_uninit(test, &cp);
+}
+
+/* Test the allocation of the proxy */
+void
+test_case_allocate_proxy(test_t test)
+{
+ cp_t cp;
+ cp_net_t *avln;
+ cp_sta_t *sta[3];
+
+ cp_cco_bw_alloc_t *pco_alloc[3];
+
+ test_case_bw_init(test, &cp);
+
+ avln = cp_sta_mgr_get_our_avln (&cp);
+
+ sta[0] = cp_net_sta_add (&cp, avln, 1, 1);
+ cp_sta_set_pco_status (sta[0], true);
+ sta[1] = cp_net_sta_add (&cp, avln, 2, 2);
+ cp_sta_set_pco_status (sta[1], true);
+ sta[2] = cp_net_sta_add (&cp, avln, 3, 3);
+ cp_sta_set_pco_status (sta[2], true);
+
+ test_case_begin(test, "Proxy allocation");
+
+ cp_cco_bw_alloc_proxy(&cp);
+
+ pco_alloc[0] = cp_cco_bw_get_first_alloc_actual(&cp);
+ pco_alloc[1] = cp_cco_bw_get_next_alloc_actual(pco_alloc[0]);
+ pco_alloc[2] = cp_cco_bw_get_next_alloc_actual(pco_alloc[1]);
+
+ test_begin(test, "Proxy allocation")
+ {
+ test_fail_if(pco_alloc[0]->st_atu != 0,
+ "PCo 0 wrong st");
+ test_fail_if(pco_alloc[0]->et_atu != CP_CCO_BW_ALLOC_TIME_BEACON_ATU,
+ "PCo 0 wrong et");
+ test_fail_if(pco_alloc[1]->st_atu != pco_alloc[0]->et_atu,
+ "PCo 1 wrong st");
+ test_fail_if(pco_alloc[1]->et_atu != pco_alloc[0]->et_atu +
+ CP_CCO_BW_ALLOC_TIME_BEACON_ATU,
+ "PCo 1 wrong et");
+ test_fail_if(pco_alloc[2]->st_atu != pco_alloc[1]->et_atu,
+ "PCo 2 wrong st");
+ test_fail_if(pco_alloc[2]->et_atu != pco_alloc[1]->et_atu +
+ CP_CCO_BW_ALLOC_TIME_BEACON_ATU,
+ "PCo 2 wrong et");
+ }
+
+ blk_release(sta[0]);
+ blk_release(sta[1]);
+ blk_release(sta[2]);
+
+ test_end;
+ test_case_bw_uninit(test, &cp);
+}
+
+/* Test the allocation of multiple TXOPs
+ * 2 connections :
+ * First : 2 txop
+ * Second : 3 txop not enough space for them so there shouldnt be any
+ * allocated*/
+void
+test_case_allocate_multiple_txop (test_t test)
+{
+ cp_t cp;
+ cp_conn_t *conn[2];
+ cp_cco_bw_alloc_t *alloc_test[7];
+ cp_cco_bw_alloc_t *txop[3];
+ u16 j;
+
+ test_case_bw_init(test, &cp);
+
+ cp_cco_bw_new_sched(&cp);
+
+ conn[1]= cp_conn_init_conn(&cp);
+ conn[1]->flink->cinfo->valid_cinfo = 0x01;
+ conn[1]->rlink->cinfo->valid_cinfo = 0x00;
+ conn[1]->conn_info.cid = 200;
+ conn[1]->flink->cinfo->user_priority = 0;
+ conn[1]->rlink->cinfo->user_priority = 0;
+ conn[1]->conn_info.cspec.f_qmp->av_nb_pb = 50;
+ conn[1]->conn_info.cspec.f_qmp->nb_txop = 2;
+ cp_conn_add_conn(&cp, conn[1]);
+
+ /*Init the BLEs*/
+ for(j=0;j<nb_ble;j++)
+ cp_link_push_ble(conn[1]->flink, ble_value[j], ble_end_time[j]);
+
+ conn[0]= cp_conn_init_conn(&cp);
+ conn[0]->flink->cinfo->valid_cinfo = 0x01;
+ conn[0]->rlink->cinfo->valid_cinfo = 0x00;
+ conn[0]->flink->cinfo->user_priority = 0;
+ conn[0]->rlink->cinfo->user_priority = 0;
+ conn[0]->conn_info.cid = 100;
+ conn[0]->conn_info.cspec.f_qmp->av_nb_pb = 100;
+ conn[0]->conn_info.cspec.f_qmp->nb_txop = 3;
+ cp_conn_add_conn(&cp, conn[0]);
+
+ /*Init the BLEs*/
+ for(j=0;j<nb_ble;j++)
+ cp_link_push_ble(conn[0]->flink, ble_value[j], ble_end_time[j]);
+
+ cp_cco_bw_alloc_sched(&cp);
+
+ alloc_test[0] = cp_cco_bw_get_first_alloc_actual(&cp);
+
+ for(j = 1 ; j < 7 ; j++)
+ alloc_test[j] = cp_cco_bw_get_next_alloc_actual(alloc_test[j-1]);
+
+ txop[0] = cp_cco_bw_alloc_get_first_txop(&cp, 200);
+ txop[1] = cp_cco_bw_alloc_get_next_txop(&cp, txop[0]);
+ txop[2] = cp_cco_bw_alloc_get_next_txop(&cp, txop[1]);
+
+ test_case_begin(test, "Allocation with multiple TXOPs");
+ test_begin(test, "multiple TXOPs")
+ {
+ test_fail_if(alloc_test[4]->cid != 200,
+ "wrong allocation");
+ test_fail_if(alloc_test[5]->cid != 200,
+ "wrong allocation");
+ test_fail_if(alloc_test[6]->glid != MAC_LID_LOCAL_CSMA,
+ "wrong allocation");
+ test_fail_if(txop[0]!= alloc_test[4],
+ "Wrong first TXOP");
+ test_fail_if(txop[1]!= alloc_test[5],
+ "Wrong next TXOP");
+ test_fail_if(txop[2],
+ "Wrong next TXOP it should be NULL");
+ }
+ test_end;
+
+ test_case_bw_uninit(test, &cp);
+}
+
+/*Test the allocation of a connection with a forward and a reverse link
+ * 1 TXOP per link*/
+void
+test_case_f_and_r_alloc (test_t test)
+{
+ cp_t cp;
+ cp_net_t *avln;
+ cp_sta_t *sta;
+ int nb_conn;
+ int j,i;
+
+ cp_cco_bw_alloc_t *alloc_test[13];
+ cp_conn_t *conn[10];
+
+ test_case_bw_init(test, &cp);
+
+ avln = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_sta_add (&cp, avln, 1, 1);
+
+ /*Init the connections*/
+ for(nb_conn = 0 ; nb_conn < 5 ; nb_conn++)
+ {
+ conn[nb_conn] = cp_conn_init_conn(&cp);
+ conn[nb_conn]->conn_info.cid = (nb_conn+1)*10;
+
+ conn[nb_conn]->flink->cinfo->user_priority = link_prio[nb_conn][0];
+ conn[nb_conn]->flink->qmp->nb_txop = 1;
+ conn[nb_conn]->flink->qmp->av_nb_pb = link_nb_pb[nb_conn][0];
+ conn[nb_conn]->flink->cinfo->valid_cinfo = 0x01;
+
+ conn[nb_conn]->rlink->cinfo->user_priority = link_prio[nb_conn][1];
+ conn[nb_conn]->rlink->qmp->nb_txop = 1;
+ conn[nb_conn]->rlink->qmp->av_nb_pb = link_nb_pb[nb_conn][1];
+ conn[nb_conn]->rlink->cinfo->valid_cinfo = 0x01;
+
+ cp_conn_add_conn(&cp, conn[nb_conn]);
+
+ /*Init the BLEs*/
+ for(j = 0 ; j < nb_ble ; j++)
+ {
+ cp_link_push_ble(conn[nb_conn]->flink, ble_value[j], ble_end_time[j]);
+ cp_link_push_ble(conn[nb_conn]->rlink, ble_value[j], ble_end_time[j]);
+ }
+ }
+
+ test_case_begin(test, "Complete Schedule");
+
+ cp_cco_bw_alloc_sched(&cp);
+
+ alloc_test[0] = cp_cco_bw_get_first_alloc_actual(&cp);
+
+ for(i = 1 ; i < 14 ; i++)
+ alloc_test[i] = cp_cco_bw_get_next_alloc_actual(alloc_test[i-1]);
+
+ test_begin(test, "Complete Schedule")
+ {
+ test_fail_if(alloc_test[4]->st_atu != 819,
+ "wrong allocation st0");
+ test_fail_if(alloc_test[4]->et_atu != 877,
+ "wrong allocation et0");
+ test_fail_if(alloc_test[4]->cid != 20,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[5]->st_atu != 877,
+ "wrong allocation st");
+ test_fail_if(alloc_test[5]->et_atu != 987,
+ "wrong allocation et");
+ test_fail_if(alloc_test[5]->cid != 20,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[6]->st_atu != 1018,
+ "wrong allocation st");
+ test_fail_if(alloc_test[6]->et_atu != 1253,
+ "wrong allocation et");
+ test_fail_if(alloc_test[6]->cid != 30,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[7]->st_atu != 1253,
+ "wrong allocation st");
+ test_fail_if(alloc_test[7]->et_atu != 1429,
+ "wrong allocation et");
+ test_fail_if(alloc_test[7]->cid != 10,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[8]->st_atu != 1429,
+ "wrong allocation st");
+ test_fail_if(alloc_test[8]->et_atu != 1727,
+ "wrong allocation et");
+ test_fail_if(alloc_test[8]->cid != 50,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[9]->st_atu != 1785,
+ "wrong allocation st");
+ test_fail_if(alloc_test[9]->et_atu != 1915,
+ "wrong allocation et");
+ test_fail_if(alloc_test[9]->cid != 40,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[10]->st_atu != 1915,
+ "wrong allocation st");
+ test_fail_if(alloc_test[10]->et_atu != 2110,
+ "wrong allocation et");
+ test_fail_if(alloc_test[10]->cid != 40,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[11]->st_atu != 3007,
+ "wrong allocation st");
+ test_fail_if(alloc_test[11]->et_atu != 3527,
+ "wrong allocation et");
+ test_fail_if(alloc_test[11]->cid != 50,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[12]->st_atu != 3735,
+ "wrong allocation st");
+ test_fail_if(alloc_test[12]->et_atu != 3773,
+ "wrong allocation et");
+ test_fail_if(alloc_test[12]->cid != 30,
+ "wrong allocation cid");
+ test_fail_if(alloc_test[13]->st_atu != 3816,
+ "wrong allocation st");
+ test_fail_if(alloc_test[13]->et_atu != 3896,
+ "wrong allocation et");
+ test_fail_if(alloc_test[13]->cid != 10,
+ "wrong allocation cid");
+ }
+ test_end;
+ slab_release(sta);
+ test_case_bw_uninit(test, &cp);
+}
+
+/*Checks the change of the connection state*/
+void
+test_case_check_conn_state (test_t test)
+{
+ int i;
+ cp_t cp;
+ cp_conn_t *conn[4];
+
+ test_case_bw_init(test, &cp);
+
+ for(i=0;i<4;i++)
+ {
+ conn[i] = cp_conn_init_conn(&cp);
+ conn[i]->conn_info.cid = i+1;
+ conn[i]->conn_info.cspec.f_cinfo->user_priority = 0;
+ conn[i]->new_conn_state = CP_CONN_STATE_IN;
+ cp_conn_add_conn(&cp, conn[i]);
+ }
+
+ test_case_begin(test, "Check conn state");
+
+ conn[1]->new_conn_state = CP_CONN_STATE_OUT;
+
+ cp_cco_bw_clear_conn_state(&cp);
+
+ test_begin(test, "Check clear conn")
+ {
+ test_fail_if(conn[0]->new_conn_state != CP_CONN_STATE_OUT,
+ "connection clear not effective");
+ test_fail_if(conn[0]->old_conn_state != CP_CONN_STATE_IN,
+ "Old state initialisation pb");
+ test_fail_if(conn[1]->new_conn_state != CP_CONN_STATE_OUT,
+ "connection clear not effective");
+ test_fail_if(conn[1]->old_conn_state != CP_CONN_STATE_OUT,
+ "Old state initialisation pb");
+ }
+ test_end;
+
+ conn[0]->new_conn_state = CP_CONN_STATE_OUT;
+ conn[0]->old_conn_state = CP_CONN_STATE_IN;
+
+ conn[1]->new_conn_state = CP_CONN_STATE_IN;
+ conn[1]->old_conn_state = CP_CONN_STATE_IN;
+
+ conn[2]->new_conn_state = CP_CONN_STATE_ADD;
+ conn[2]->old_conn_state = CP_CONN_STATE_OUT;
+
+ conn[3]->new_conn_state = CP_CONN_STATE_OUT;
+ conn[3]->old_conn_state = CP_CONN_STATE_OUT;
+
+ cp_cco_bw_check_conn_state(&cp);
+
+ test_begin(test, "Check connection's changing state")
+ {
+ test_fail_if(conn[0]->new_conn_state != CP_CONN_STATE_REL_BW,
+ "Wrong connection state");
+ test_fail_if(conn[1]->new_conn_state != CP_CONN_STATE_IN,
+ "Wrong connection state");
+ test_fail_if(conn[2]->new_conn_state != CP_CONN_STATE_ADD,
+ "Wrong connection state");
+ test_fail_if(conn[3]->new_conn_state != CP_CONN_STATE_OUT,
+ "Wrong connection state");
+ }
+ test_end;
+ test_case_bw_uninit(test, &cp);
+}
+
+/*Test the finalisation of the schedule*/
+void
+test_case_finalise_sched (test_t test, int test_id)
+{
+ u16 i;
+ cp_t cp;
+
+ cp_cco_bw_alloc_t *alloc_tmp;
+ cp_cco_bw_alloc_t *alloc_test[24];
+
+ /*Initiate the bw context and conn context*/
+ test_case_bw_init(test, &cp);
+
+ cp_cco_bw_new_sched(&cp);
+
+ /*Add the fake allocation to test the allocation fonction*/
+ if(!test_id)
+ {
+ for(i=0;i<10;i++)
+ {
+ alloc_tmp = blk_alloc();
+ alloc_tmp->st_atu = alloc[i].st_atu;
+ alloc_tmp->et_atu = alloc[i].et_atu;
+ alloc_tmp->cid = alloc[i].cid;
+ cp_cco_bw_alloc_add(&cp, alloc_tmp);
+ }
+
+ /*Add a fake allocation to test the bonus adding part when not enough
+ * time is free for a CSMA allocation*/
+ alloc_tmp = blk_alloc();
+ alloc_tmp->st_atu = 3850;
+ alloc_tmp->et_atu = 3852;
+ alloc_tmp->cid = 0;
+ cp_cco_bw_alloc_add(&cp, alloc_tmp);
+
+ test_case_begin(test, "Finalise Schedule");
+
+ cp_cco_bw_finalise_sched(&cp);
+
+ alloc_test[0] = cp_cco_bw_get_first_alloc_finalised(&cp);
+
+ for(i=1;i<24;i++)
+ alloc_test[i] = cp_cco_bw_get_next_alloc_finalised(alloc_test[i-1]);
+ test_begin(test, "Finalise Schedule")
+ {
+ test_fail_if(alloc_test[3]->st_atu != 678,"wrong start time");
+ test_fail_if(alloc_test[3]->et_atu != 782,"wrong end time");
+ test_fail_if(alloc_test[3]->glid != MAC_LID_LOCAL_CSMA,"wrong GLID");
+
+ test_fail_if(alloc_test[5]->st_atu != 792,"wrong start time");
+ test_fail_if(alloc_test[5]->et_atu != 1052,"wrong end time");
+ test_fail_if(alloc_test[5]->glid != MAC_LID_LOCAL_CSMA,"wrong GLID");
+
+ test_fail_if(alloc_test[11]->st_atu != 1312,"wrong start time");
+ test_fail_if(alloc_test[11]->et_atu != 1683,"wrong end time");
+ test_fail_if(alloc_test[11]->glid != MAC_LID_LOCAL_CSMA,"wrong GLID");
+
+ test_fail_if(alloc_test[15]->st_atu != 2093,"wrong start time");
+ test_fail_if(alloc_test[15]->et_atu != 2925,"wrong end time");
+ test_fail_if(alloc_test[15]->glid != MAC_LID_LOCAL_CSMA,"wrong GLID");
+
+ test_fail_if(alloc_test[20]->st_atu != 3838,"wrong start time 20");
+ test_fail_if(alloc_test[20]->et_atu != 3850,"wrong end time 20");
+ test_fail_if(alloc_test[20]->glid == MAC_LID_LOCAL_CSMA,"wrong GLID");
+
+ test_fail_if(alloc_test[23]->st_atu != 3874,"wrong start time 22");
+ test_fail_if(alloc_test[23]->et_atu != 3906,"wrong end time 22");
+ }
+ test_end;
+ }
+ test_case_bw_uninit(test, &cp);
+}
+
+/*Test the functions related to the persistence*/
+void
+test_case_get_alloc_from_persistence (test_t test)
+{
+ cp_t cp;
+ u16 nb_alloc = 3;
+ u16 i;
+
+ cp_cco_bw_alloc_t *alloc_persistent_actual;
+ cp_cco_bw_alloc_t *alloc_not_persistent_actual;
+ cp_cco_bw_alloc_t *test_alloc_persistent_actual[3];
+ cp_cco_bw_alloc_t *test_alloc_not_persistent_actual[3];
+ u16 test_nb_alloc_persistent_actual;
+ u16 test_nb_alloc_not_persistent_actual;
+
+ cp_cco_bw_alloc_t *alloc_persistent_finalised;
+ cp_cco_bw_alloc_t *alloc_not_persistent_finalised;
+ cp_cco_bw_alloc_t *test_alloc_persistent_finalised[3];
+ cp_cco_bw_alloc_t *test_alloc_not_persistent_finalised[3];
+ u16 test_nb_alloc_persistent_finalised;
+ u16 test_nb_alloc_not_persistent_finalised;
+
+ test_case_bw_init(test, &cp);
+
+ test_case_begin(test, "Alloc from persistence");
+
+ for(i=0; i< nb_alloc; i++)
+ {
+ /*Alloc on the actual schedule*/
+ alloc_persistent_actual = blk_alloc();
+ alloc_persistent_actual->st_atu = i*10;
+ alloc_persistent_actual->et_atu = alloc_persistent_actual->st_atu + 1;
+ alloc_persistent_actual->persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ cp_cco_bw_alloc_add(&cp, alloc_persistent_actual);
+
+ alloc_not_persistent_actual = blk_alloc();
+ alloc_not_persistent_actual->st_atu = i*100;
+ alloc_not_persistent_actual->et_atu = alloc_not_persistent_actual->st_atu + 1;
+ alloc_not_persistent_actual->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ cp_cco_bw_alloc_add(&cp, alloc_not_persistent_actual);
+
+ /*Alloc on the finalised schedule*/
+ alloc_persistent_finalised = blk_alloc();
+ alloc_persistent_finalised->st_atu = i*10;
+ alloc_persistent_finalised->et_atu = alloc_persistent_finalised->st_atu + 1;
+ alloc_persistent_finalised->persistence = CP_CCO_BW_PERSISTENCE_PERSISTENT;
+ cp_cco_bw_alloc_add_finalised(&cp, alloc_persistent_finalised);
+
+ alloc_not_persistent_finalised = blk_alloc();
+ alloc_not_persistent_finalised->st_atu = i*100;
+ alloc_not_persistent_finalised->et_atu = alloc_not_persistent_finalised->st_atu + 1;
+ alloc_not_persistent_finalised->persistence = CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT;
+ cp_cco_bw_alloc_add_finalised(&cp, alloc_not_persistent_finalised);
+ }
+
+ /*Test on actual alloc*/
+ test_alloc_persistent_actual[0] = cp_cco_bw_get_first_alloc_actual_from_persistence (&cp, CP_CCO_BW_PERSISTENCE_PERSISTENT);
+ test_alloc_not_persistent_actual[0] = cp_cco_bw_get_first_alloc_actual_from_persistence(&cp, CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT);
+
+ for(i=1 ;i<nb_alloc ;i++)
+ {
+ test_alloc_persistent_actual[i] = cp_cco_bw_get_next_alloc_actual_from_persistence(&cp,
+ test_alloc_persistent_actual[i-1]);
+ test_alloc_not_persistent_actual[i] = cp_cco_bw_get_next_alloc_actual_from_persistence(&cp,
+ test_alloc_not_persistent_actual[i-1]);
+ }
+ cp_cco_bw_alloc_remove(&cp, test_alloc_persistent_actual[2]);
+ cp_cco_bw_alloc_remove(&cp, test_alloc_not_persistent_actual[2]);
+
+ test_nb_alloc_persistent_actual = cp_cco_bw_get_nb_alloc_actual(&cp, CP_CCO_BW_PERSISTENCE_PERSISTENT);
+ test_nb_alloc_not_persistent_actual = cp_cco_bw_get_nb_alloc_actual(&cp, CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT);
+
+ test_alloc_persistent_actual[2] = cp_cco_bw_get_next_alloc_actual_from_persistence(&cp,
+ test_alloc_persistent_actual[1]);
+ test_alloc_not_persistent_actual[2] = cp_cco_bw_get_next_alloc_actual_from_persistence(&cp,
+ test_alloc_not_persistent_actual[1]);
+
+ /*Test on finalise alloc*/
+ test_alloc_persistent_finalised[0] = cp_cco_bw_get_first_alloc(&cp, CP_CCO_BW_PERSISTENCE_PERSISTENT);
+ test_alloc_not_persistent_finalised[0] = cp_cco_bw_get_first_alloc(&cp, CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT);
+
+ for(i=1 ;i<nb_alloc ;i++)
+ {
+ test_alloc_persistent_finalised[i] = cp_cco_bw_get_next_alloc(&cp,
+ test_alloc_persistent_finalised[i-1]);
+ test_alloc_not_persistent_finalised[i] = cp_cco_bw_get_next_alloc(&cp,
+ test_alloc_not_persistent_finalised[i-1]);
+ }
+ cp_cco_bw_alloc_remove_finalised(&cp, test_alloc_persistent_finalised[2]);
+ cp_cco_bw_alloc_remove_finalised(&cp, test_alloc_not_persistent_finalised[2]);
+
+ test_nb_alloc_persistent_finalised = cp_cco_bw_get_nb_alloc(&cp, CP_CCO_BW_PERSISTENCE_PERSISTENT);
+ test_nb_alloc_not_persistent_finalised = cp_cco_bw_get_nb_alloc(&cp, CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT);
+
+ test_alloc_persistent_finalised[2] = cp_cco_bw_get_next_alloc(&cp,
+ test_alloc_persistent_finalised[1]);
+ test_alloc_not_persistent_finalised[2] = cp_cco_bw_get_next_alloc(&cp,
+ test_alloc_not_persistent_finalised[1]);
+ test_begin(test,"Alloc from persistence")
+ {
+ /*Test on actual allocations*/
+ test_fail_if(test_alloc_persistent_actual[0]->persistence != CP_CCO_BW_PERSISTENCE_PERSISTENT,
+ "Allocation actual persistence pb");
+ test_fail_if(test_alloc_persistent_actual[1]->persistence != CP_CCO_BW_PERSISTENCE_PERSISTENT,
+ "Allocation actual persistence pb");
+ test_fail_if(test_alloc_persistent_actual[2],
+ "Pb to remove a persitent allocation of the actual schedule");
+ test_fail_if(test_alloc_not_persistent_actual[0]->persistence != CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT,
+ "Allocation finalised actual persistence pb");
+ test_fail_if(test_alloc_not_persistent_actual[1]->persistence != CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT,
+ "Allocation actual persistence pb");
+ test_fail_if(test_alloc_not_persistent_actual[2],
+ "Pb to remove a actual not persistent allocation");
+ test_fail_if(test_nb_alloc_persistent_actual != 2,
+ "Wrong number of actual allocation persistent");
+ test_fail_if(test_nb_alloc_not_persistent_actual != 2,
+ "Wrong number of actual allocation not persistent");
+
+ /*Test on finalised allocations*/
+ test_fail_if(test_alloc_persistent_finalised[0]->persistence != CP_CCO_BW_PERSISTENCE_PERSISTENT,
+ "Allocation finalised persistence pb");
+ test_fail_if(test_alloc_persistent_finalised[1]->persistence != CP_CCO_BW_PERSISTENCE_PERSISTENT,
+ "Allocation finalised persistence pb");
+ test_fail_if(test_alloc_persistent_finalised[2],
+ "Pb to remove a finalised persitent allocation");
+ test_fail_if(test_alloc_not_persistent_finalised[0]->persistence != CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT,
+ "Allocation finalised persistence pb");
+ test_fail_if(test_alloc_not_persistent_finalised[1]->persistence != CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT,
+ "Allocation finalised persistence pb");
+ test_fail_if(test_alloc_not_persistent_finalised[2],
+ "Pb to remove a finalised not persistent allocation");
+ test_fail_if(test_nb_alloc_persistent_finalised != 2,
+ "Wrong number of finalised allocation persistent");
+ test_fail_if(test_nb_alloc_not_persistent_finalised != 2,
+ "Wrong number of finalised allocation not persistent");
+ }
+ test_end;
+ test_case_bw_uninit(test, &cp);
+}
+
+int
+main (void){
+
+ u8 i;
+ u8 nb_test = 2;
+ test_t test;
+
+ test_init(test, 0, NULL);
+
+ test_case_get_alloc_from_persistence (test);
+
+ test_case_check_conn_state (test);
+
+ test_case_allocate_proxy(test);
+
+ test_case_add_get_alloc(test);
+
+ INIT_TEST_COMPLETE_SCHEDULE(0);
+
+ test_case_allocate_multiple_txop (test);
+
+ test_case_complete_schedule (test);
+
+ INIT_TEST_F_AND_R_ALLOC(0);
+
+ test_case_f_and_r_alloc (test);
+
+ for(i=0;i<nb_test;i++)
+ {
+ INIT_TEST_MULITPLE_ALLOC(i);
+ test_case_finalise_sched (test, i);
+ test_case_get_alloc_ble(test, i);
+ test_case_complete_allocation (test, i);
+ }
+
+ test_result (test);
+ HAL_PLATFORM_EXIT(test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/cco/bw/test/src/cl_stub.c b/cesar/cp/cco/bw/test/src/cl_stub.c
new file mode 100644
index 0000000000..ec1f4bd9ec
--- /dev/null
+++ b/cesar/cp/cco/bw/test/src/cl_stub.c
@@ -0,0 +1,86 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/cl_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cl/cl.h"
+
+typedef uint cl_mactotei_blk_t;
+
+static cl_mactotei_blk_t table;
+
+/**
+ * Find a mac address in the table using a dichotomy search
+ *
+ * \param ctx the convergence layer context.
+ * \param mac the mac address to find
+ * \return the tei corresponding to the mac address if known otherwise it
+ * returns 0x0 if tei not found
+ */
+uint
+cl_mactotei_table_find_tei_from_mac (cl_t *ctx, mac_t mac)
+{
+ return 0;
+}
+
+/**
+ * Create a new table to be filled by the CP.
+ *
+ * \return a pointer to the new block to be fill with the mac to tei table
+ * data
+ */
+cl_mactotei_blk_t *
+cl_mactotei_new (void)
+{
+ return &table;
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag and the tei.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tei the tei to copy.
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tei_and_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tei, u8 tag)
+{
+}
+
+/**
+ * Add a new tupple of data to the table.
+ *
+ * \param table the table pointer to add a new mac to tei correspondance.
+ * \param mac_addr the mac addr to add
+ * \param tei the tei corresponding to the STA.
+ * \param tag the CP tag provide to indentifier a network.
+ */
+void cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr,
+ uint tei, uint tag)
+{
+}
+
+/**
+ * Request the CL to use the new table and remove the old one.
+ *
+ * \param ctx the CL context
+ * \param table the new table to use.
+ */
+void
+cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
+{
+}
+
diff --git a/cesar/cp/cco/bw/test/src/fsm_stub.c b/cesar/cp/cco/bw/test/src/fsm_stub.c
new file mode 100644
index 0000000000..849f375270
--- /dev/null
+++ b/cesar/cp/cco/bw/test/src/fsm_stub.c
@@ -0,0 +1,29 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
diff --git a/cesar/cp/cco/bw/test/src/msg_stub.c b/cesar/cp/cco/bw/test/src/msg_stub.c
new file mode 100644
index 0000000000..49e864f94d
--- /dev/null
+++ b/cesar/cp/cco/bw/test/src/msg_stub.c
@@ -0,0 +1,233 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file link.c
+ * \brief link management
+ * \ingroup cp/conn
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/conn/conn_mgr.h"
+#include "cp/conn/conn.h"
+#include "cp/conn/link.h"
+#include "cp/mme.h"
+
+void
+cp_msg_cm_conn_new_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_new_req_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_new_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_new_cnf_sent(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_cnf_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_new_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_cnf_t *data)
+{
+ return true;
+}
+
+/******************/
+/* APCM family */
+/******************/
+void
+cp_msg_apcm_conn_add_req_send(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_req_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_add_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_add_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_add_cnf_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_add_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_cnf_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_add_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_add_ind_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_add_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_ind_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_rel_ind_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_rel_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_rel_ind_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_rel_rsp_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_rel_rsp_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_rel_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_rel_rsp_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_info_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_info_req_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_info_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_info_req_t *data)
+{
+ return true;
+}
+
+bool
+cp_msg_cm_conn_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_mod_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_mod_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_mod_ind_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_mod_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_mod_cnf_t *data)
+{
+ return true;
+}
+
+bool
+cp_msg_cm_conn_info_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_info_cnf_t *data)
+{
+ return true;
+}
+bool
+cp_msg_apcm_conn_add_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_rsp_t *data)
+{
+ return true;
+}
+void
+cp_msg_cm_conn_new_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_new_cnf_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_mod_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_mod_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_mod_req_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_mod_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_mod_rsp_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_mod_cnf_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_rel_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_rel_req_t *data)
+{
+ return true;
+}
+void
+cp_msg_cm_conn_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_rel_ind_t *data)
+{
+}
+
diff --git a/cesar/cp/cco/bw/test/src/pwl_stub.c b/cesar/cp/cco/bw/test/src/pwl_stub.c
new file mode 100644
index 0000000000..4fa96e25ca
--- /dev/null
+++ b/cesar/cp/cco/bw/test/src/pwl_stub.c
@@ -0,0 +1,32 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file link.c
+ * \brief link management
+ * \ingroup cp/conn
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "mac/common/timings.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/pwl/pwl.h"
+
+void
+cp_pwl_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (&ctx->pwl, 0, sizeof (cp_pwl_t));
+ ctx->pwl.bp_avln_ntb [2] = MAC_ATU_TO_TCK(3906*2);
+ ctx->pwl.bp_avln_ntb [1] = MAC_ATU_TO_TCK(3906);
+}
+
diff --git a/cesar/cp/cco/region/doc/Region_Manager.odt b/cesar/cp/cco/region/doc/Region_Manager.odt
new file mode 100755
index 0000000000..972ccbb264
--- /dev/null
+++ b/cesar/cp/cco/region/doc/Region_Manager.odt
Binary files differ
diff --git a/cesar/cp/cco/region/doc/region.xmi b/cesar/cp/cco/region/doc/region.xmi
new file mode 100644
index 0000000000..804569d38d
--- /dev/null
+++ b/cesar/cp/cco/region/doc/region.xmi
@@ -0,0 +1,441 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-05-20T17:26:03" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="UML Model" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0YxkpH4IqNt7" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="aUMGBatf5W5Y" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DSdS4LG3rEng" isRoot="false" isAbstract="false" name="boolean" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TqxJDqPlKjzV" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="JsAMMDvYfW0j" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pGmhSYLwOIDZ" isRoot="false" isAbstract="false" name="byte" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8cKQMJvd930U" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Gt2vP2dFGNuj" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vDdHWqqcT83n" isRoot="false" isAbstract="false" name="String" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="gjjImauW3w7L" isRoot="false" isAbstract="false" name="cp_cco_region_inl_alloc_t*" elementReference="kT2bIBwZoXmo" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oUmui7GbHR8Q" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OJpOHl5xdO6m" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="zBcNEqKhckvA" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="RLF9aE3wImVB" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5LwnLaWMXeOA" isRoot="false" isAbstract="false" name="cp_mme_rx_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="jEjssjzeT2KU" isRoot="false" isAbstract="false" name="cp_cco_region_tried_alloc_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="v1vF54F8NwGF" isRoot="false" isAbstract="false" name="cp_cco_region_net_asked_t*" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class comment="Process the MME related to the region management.
+Manage the allocation and the region distribution of the beacon period." isSpecification="false" isLeaf="false" visibility="implementation" namespace="Logical View" xmi.id="t9p315AouZ4A" isRoot="false" isAbstract="false" name="cp_cco_region_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="HBtEpK8ujO4D" type="gjjImauW3w7L" name="inl_alloc" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="ecEf4zmdJ9OP" type="jEjssjzeT2KU" name="tried_alloc" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="wRP2a9wtM6A0" type="v1vF54F8NwGF" name="nets_req_status" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="3NlLCs4iSP4B" type="oUmui7GbHR8Q" name="nb_region" />
+ <UML:Operation comment="initiate the process of creating a new network" isSpecification="false" isLeaf="false" visibility="public" xmi.id="me3hlcUoQiCY" isRoot="false" isAbstract="false" isQuery="false" name="new_net_init" />
+ <UML:Operation comment="Initiate the tables that will keep in memory the evolution of the adding demands to of networks.
+It will ask to the first network if the allocation is possible." isSpecification="false" isLeaf="false" visibility="public" xmi.id="43bb7BT6KxGh" isRoot="false" isAbstract="false" isQuery="false" name="add_alloc_init" />
+ <UML:Operation comment="Initiate the tables that will keep in memory the evolution of the removal demands to of networks.
+It will ask to the first network if the allocation is possible." isSpecification="false" isLeaf="false" visibility="public" xmi.id="abIIW1HewNLO" isRoot="false" isAbstract="false" isQuery="false" name="rel_alloc_init" />
+ <UML:Operation comment="create the schedule to create the region BENTRY" isSpecification="false" isLeaf="false" visibility="public" xmi.id="EJ7eeKlCZm6p" isRoot="false" isAbstract="false" isQuery="false" name="get_region" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="8aAIFC7YYe1U" isRoot="false" isAbstract="false" isQuery="false" name="nid_conflict" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="htvl6xtNqamp" isRoot="false" isAbstract="false" isQuery="false" name="compute_inl_alloc" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="yaDplw7Z6asz" isRoot="false" isAbstract="false" isQuery="false" name="shut_down_net" />
+ <UML:Operation comment="When a NCo wants to add an allocation it will request it to the others. This function is called when we receive the demand.
+It will study it and respond the result found, failure or success." isSpecification="false" isLeaf="false" visibility="public" xmi.id="qrHQTLHhoTuw" isRoot="false" isAbstract="false" isQuery="false" name="send_nn_add_alloc_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uQssy4uuA37q" value="" type="oUmui7GbHR8Q" name="nco_tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="I4l62fygKBND" isRoot="false" isAbstract="false" isQuery="false" name="send_nn_add_alloc_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2xi9GV5Si0dl" value="" type="zBcNEqKhckvA" name="result" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1z83dI0vLlzL" value="" type="oUmui7GbHR8Q" name="nco_tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="When a NCo wants to remove an allocation it will request it to the others. This function is called when we receive the demand.
+It will study it and respond the result found, failure or success." isSpecification="false" isLeaf="false" visibility="public" xmi.id="JvhRzUvpLCDn" isRoot="false" isAbstract="false" isQuery="false" name="send_nn_rel_alloc_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="E3UjgqsbFvrN" value="" type="oUmui7GbHR8Q" name="nco_tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="AmWIoc6IPfXq" isRoot="false" isAbstract="false" isQuery="false" name="send_nn_rel_alloc_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ouVykrmQ6DJE" value="" type="zBcNEqKhckvA" name="result" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TZG7d8jlsG3g" value="" type="oUmui7GbHR8Q" name="nco_tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Treat the request of another NCo to create its own network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Plx7HXixGlGv" isRoot="false" isAbstract="false" isQuery="false" name="send_nn_new_net_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PGVTTofuNtz0" value="" type="oUmui7GbHR8Q" name="nco_tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Study the allocation time regarding to the bandwidth ratio and its INL allocation.
+Replies with a nn_add_alloc_cnf with the result of the precedent test." isSpecification="false" isLeaf="false" visibility="public" xmi.id="f7J0zIyyzhou" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_add_alloc_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s4FpQJWQMnDY" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="No specific action in the hp specification
+Call for the new INL allocation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TJfKifzcmBrP" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_add_alloc_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uNfDvaYJlYgV" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Study the result
+if success request for the next NCo if no more NCo allocation and send the .IND to signal the success.
+If failure send the .IND to signal the failure to the NCo that returned success. And change alloc time." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Px1j6Nu8IcIW" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_add_alloc_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vO3G80bXyaE2" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Not clear into the specification.
+Send NN_REL_ALLOC.CNF with a result.
+I don't see any reason to respond failure.
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uBQr2sHfxYfw" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_rel_alloc_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ay5O9Qu0U9pt" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Study the result
+not in the specificationIf failure try again ?
+if success ask another NCo until all are asked." isSpecification="false" isLeaf="false" visibility="public" xmi.id="UpbHR8PfArOq" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_rel_alloc_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="gERvAGG4g6ue" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Not on the specification
+Check the Slot
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="23HmE9A6KaxL" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_new_net_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Wi3IGinPgqno" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="No specific action in the hp specification
+Call for the new INL allocation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="QD0NleKaFDNW" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_new_net_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="HhojobaHus1y" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="receive the confirmation of a neighbour network. will process the result.
+If success ask the next NCo
+If failure respond .ind to signal the failure
+if no more NCo respond .ind to signal the success." isSpecification="false" isLeaf="false" visibility="public" xmi.id="HskYOYSnqIEV" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_new_net_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mPGahS5hF1wO" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the INL
+Send our INL into NN_INL.CNF
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cmRGaC4ptqZh" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_inl_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="JMG4GF6q1X7b" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the INL
+If we are not a network try to create one." isSpecification="false" isLeaf="false" visibility="public" xmi.id="9Ra0yGR5Cl38" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_inl_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3LPEpuV98aON" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="clear the net from the INL" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ksMwbP5ekSrX" isRoot="false" isAbstract="false" isQuery="false" name="process_nn_rel_net_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KMeSw2nbH9na" value="" type="5LwnLaWMXeOA" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="YaNMlgptbmyP" isRoot="false" isAbstract="false" isQuery="false" name="get_next_alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="bKAJ3v35HoQR" type="gjjImauW3w7L" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2AgHnuODkjnm" value="" type="gjjImauW3w7L" name="actual_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="3u4ee33gBhyx" isRoot="false" isAbstract="false" isQuery="false" name="get_nb_region" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="eSA6pEGt6KXk" type="oUmui7GbHR8Q" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0LEegzr3kCMs" isRoot="false" isAbstract="false" name="cp_cco_action_t" >
+ <UML:Classifier.feature>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="dpgL10DYtqYa" isRoot="false" isAbstract="false" isQuery="false" name="garbage" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="INL allocation representing the region repartition of the beacon period. Has been computing to avoid inter-network problems." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="kT2bIBwZoXmo" isRoot="false" isAbstract="false" name="cp_cco_region_inl_alloc_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="d4EEN7R3gBKw" type="oUmui7GbHR8Q" name="end_time" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="ylBy9YckPj1u" type="4HeHqHiULuih" name="alloc_state" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="sCS0xvbhlhDx" type="gjjImauW3w7L" name="prev_alloc" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="FOlOE9U09GXo" type="gjjImauW3w7L" name="next_alloc" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="4HeHqHiULuih" isRoot="false" isAbstract="false" name="cp_cco_region_alloc_state_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4HeHqHiULuih" xmi.id="RFOuU8oSPACy" isRoot="false" isAbstract="false" name="BEACON" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4HeHqHiULuih" xmi.id="yIMmZRqs9gOJ" isRoot="false" isAbstract="false" name="PROTECTED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4HeHqHiULuih" xmi.id="JisYA9QR1XQY" isRoot="false" isAbstract="false" name="RESERVED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4HeHqHiULuih" xmi.id="sgc58bbaoxSI" isRoot="false" isAbstract="false" name="CSMA" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4HeHqHiULuih" xmi.id="Gu61WTgbkIsZ" isRoot="false" isAbstract="false" name="STAYOUT" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="dCvMa0ALw2uw" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="6wx3GtzGjigE" aggregation="none" type="0LEegzr3kCMs" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="9RiCFnlSmDA3" aggregation="none" type="t9p315AouZ4A" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="fzAc12Wgvlvd" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="7rTnFnJLhGOy" aggregation="none" type="t9p315AouZ4A" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="8OEr4s4DJkNY" aggregation="none" type="0LEegzr3kCMs" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="t6tfVHEiGj77" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="X9zJM9KTymEC" aggregation="composite" type="t9p315AouZ4A" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="XYXEmuAsGMiI" aggregation="none" type="kT2bIBwZoXmo" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class comment="Keep in memory the different allocation we tried." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vhZF7IlXx2AR" isRoot="false" isAbstract="false" name="cp_cco_region_tried_alloc_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="D5DXDic99ez8" type="oUmui7GbHR8Q" name="start_time" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="cTtAQvKr7P3e" type="oUmui7GbHR8Q" name="end_time" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="rvPM5XzYQ9zK" type="jEjssjzeT2KU" name="prev" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="RoPop1PZG8P6" type="jEjssjzeT2KU" name="next" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="nDyIifkl3Ul6" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6dn2N0EuWk6G" aggregation="aggregate" type="t9p315AouZ4A" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="cF9sbr8mbbF5" aggregation="none" type="vhZF7IlXx2AR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="31dqOcGmVl7E" isRoot="false" isAbstract="false" name="cp_cco_region_req_table_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="ezhLI7vM9WAV" type="zBcNEqKhckvA" name="reqID" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="KDdhs0661XB6" type="9PHcAMq9VI9x" name="req_type" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="9PHcAMq9VI9x" isRoot="false" isAbstract="false" name="cp_cco_region_req_type_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="9PHcAMq9VI9x" xmi.id="qIWxnhSw4hWE" isRoot="false" isAbstract="false" name="NN_NEW_NET" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="9PHcAMq9VI9x" xmi.id="CQi475FxLju8" isRoot="false" isAbstract="false" name="NN_ADD_ALLOC" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="9PHcAMq9VI9x" xmi.id="Y2NmKlSW98ZG" isRoot="false" isAbstract="false" name="NN_REL_ALLOC" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="9PHcAMq9VI9x" xmi.id="E3T742ac4yMO" isRoot="false" isAbstract="false" name="NN_REL_NET" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Xmgak3yRppFi" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="CrtnR7qtMuIZ" aggregation="aggregate" type="t9p315AouZ4A" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="H2rCYAV4ih4z" aggregation="none" type="31dqOcGmVl7E" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vx6EqATGzVnu" isRoot="false" isAbstract="false" name="cp_cco_region_net_asked_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="aJSpeA5X8Bkw" type="DSdS4LG3rEng" name="asked" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="JDAHgyBj5agR" type="oUmui7GbHR8Q" name="tei" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="HPhW93N3Um52" isRoot="false" isAbstract="false" name="cp" />
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="812" snapy="10" showatts="1" xmi.id="6BO3Jnweumoz" documentation="Keep in memory the request made until we receive the .ind" type="1" showops="1" showpackage="0" name="region_manager" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="578" showattsigs="601" x="0" fillcolor="#ffffc0" y="88" showopsigs="601" linewidth="none" height="540" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="t9p315AouZ4A" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="292" showattsigs="601" x="492" fillcolor="#ffffc0" y="654" showopsigs="601" linewidth="none" height="99" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="kT2bIBwZoXmo" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="248" showattsigs="601" x="236" fillcolor="#ffffc0" y="741" showopsigs="601" linewidth="none" height="99" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="vhZF7IlXx2AR" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="1" width="126" showattsigs="601" x="111" fillcolor="none" y="0" showopsigs="601" linewidth="none" height="45" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="0LEegzr3kCMs" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="258" showattsigs="601" x="0" fillcolor="none" y="676" showopsigs="601" linewidth="none" height="63" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="31dqOcGmVl7E" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="4" indexa="3" visibilityB="200" totalcountb="4" indexb="1" linewidth="none" widgetbid="kT2bIBwZoXmo" widgetaid="t9p315AouZ4A" xmi.id="HBtEpK8ujO4D" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="433" starty="628" />
+ <endpoint endx="565" endy="654" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="548" fillcolor="none" y="547" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="qI5g9aXhDMBs" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="73" x="501" fillcolor="none" y="539" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="sBEWnKcQtJ4k" text="inl_alloc" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="vhZF7IlXx2AR" widgetaid="t9p315AouZ4A" xmi.id="nDyIifkl3Ul6" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="289" starty="628" />
+ <endpoint endx="360" endy="741" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="0LEegzr3kCMs" widgetaid="t9p315AouZ4A" xmi.id="fzAc12Wgvlvd" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="289" starty="88" />
+ <endpoint endx="174" endy="45" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="31dqOcGmVl7E" widgetaid="t9p315AouZ4A" xmi.id="Xmgak3yRppFi" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="144" starty="628" />
+ <endpoint endx="129" endy="676" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="0" indexa="0" visibilityB="200" totalcountb="0" indexb="0" linewidth="none" widgetbid="kT2bIBwZoXmo" widgetaid="kT2bIBwZoXmo" xmi.id="sCS0xvbhlhDx" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="565" starty="654" />
+ <endpoint endx="711" endy="654" />
+ <point x="565" y="604" />
+ <point x="711" y="604" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="713" fillcolor="none" y="630" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="QWTH6ncRRaDy" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="86" x="634" fillcolor="none" y="630" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="TQehpj1FFSUJ" text="prev_alloc" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="0" indexa="0" visibilityB="200" totalcountb="0" indexb="0" linewidth="none" widgetbid="kT2bIBwZoXmo" widgetaid="kT2bIBwZoXmo" xmi.id="FOlOE9U09GXo" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="565" starty="654" />
+ <endpoint endx="711" endy="654" />
+ <point x="565" y="604" />
+ <point x="711" y="604" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="713" fillcolor="none" y="630" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="TyTzrncJBEy1" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="86" x="634" fillcolor="none" y="630" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="9xw5oICHHfG6" text="next_alloc" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="SrlUrCVFsddT" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="6BO3Jnweumoz" documentation="" uniqueid="eSA6pEGt6KXk" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="807" id="UVeSTjN7Geho" label="class diagram" />
+ <listitem open="0" type="807" id="UVeSTjN7Geho" label="class diagram" />
+ <listitem open="0" type="807" id="6BO3Jnweumoz" label="region_manager" />
+ <listitem open="0" type="810" id="zUSsnrlhyQoL" label="new_net_create_unvalid" />
+ <listitem open="0" type="810" id="zUSsnrlhyQoL" label="new_net_create_unvalid" />
+ <listitem open="0" type="810" id="Vf0FJhHBC2Oc" label="new_net_create_valid" />
+ <listitem open="0" type="810" id="Vf0FJhHBC2Oc" label="new_net_create_valid" />
+ <listitem open="1" type="813" id="HPhW93N3Um52" />
+ <listitem open="1" type="813" id="0LEegzr3kCMs" >
+ <listitem open="0" type="815" id="dpgL10DYtqYa" />
+ </listitem>
+ <listitem open="1" type="813" id="kT2bIBwZoXmo" >
+ <listitem open="0" type="814" id="d4EEN7R3gBKw" />
+ <listitem open="0" type="814" id="ylBy9YckPj1u" />
+ <listitem open="0" type="814" id="sCS0xvbhlhDx" />
+ <listitem open="0" type="814" id="FOlOE9U09GXo" />
+ </listitem>
+ <listitem open="1" type="813" id="vx6EqATGzVnu" >
+ <listitem open="0" type="814" id="aJSpeA5X8Bkw" />
+ <listitem open="0" type="814" id="JDAHgyBj5agR" />
+ </listitem>
+ <listitem open="1" type="813" id="31dqOcGmVl7E" >
+ <listitem open="1" type="814" id="ezhLI7vM9WAV" />
+ <listitem open="1" type="814" id="KDdhs0661XB6" />
+ </listitem>
+ <listitem open="1" type="813" id="t9p315AouZ4A" >
+ <listitem open="0" type="814" id="HBtEpK8ujO4D" />
+ <listitem open="0" type="814" id="ecEf4zmdJ9OP" />
+ <listitem open="0" type="814" id="wRP2a9wtM6A0" />
+ <listitem open="0" type="814" id="3NlLCs4iSP4B" />
+ <listitem open="0" type="815" id="me3hlcUoQiCY" />
+ <listitem open="0" type="815" id="43bb7BT6KxGh" />
+ <listitem open="0" type="815" id="abIIW1HewNLO" />
+ <listitem open="0" type="815" id="EJ7eeKlCZm6p" />
+ <listitem open="0" type="815" id="8aAIFC7YYe1U" />
+ <listitem open="0" type="815" id="htvl6xtNqamp" />
+ <listitem open="0" type="815" id="yaDplw7Z6asz" />
+ <listitem open="0" type="815" id="qrHQTLHhoTuw" />
+ <listitem open="0" type="815" id="I4l62fygKBND" />
+ <listitem open="0" type="815" id="JvhRzUvpLCDn" />
+ <listitem open="0" type="815" id="AmWIoc6IPfXq" />
+ <listitem open="0" type="815" id="Plx7HXixGlGv" />
+ <listitem open="0" type="815" id="f7J0zIyyzhou" />
+ <listitem open="0" type="815" id="TJfKifzcmBrP" />
+ <listitem open="0" type="815" id="Px1j6Nu8IcIW" />
+ <listitem open="0" type="815" id="uBQr2sHfxYfw" />
+ <listitem open="0" type="815" id="UpbHR8PfArOq" />
+ <listitem open="0" type="815" id="23HmE9A6KaxL" />
+ <listitem open="0" type="815" id="QD0NleKaFDNW" />
+ <listitem open="0" type="815" id="HskYOYSnqIEV" />
+ <listitem open="1" type="815" id="cmRGaC4ptqZh" />
+ <listitem open="1" type="815" id="9Ra0yGR5Cl38" />
+ <listitem open="1" type="815" id="ksMwbP5ekSrX" />
+ <listitem open="0" type="815" id="YaNMlgptbmyP" />
+ <listitem open="0" type="815" id="3u4ee33gBhyx" />
+ </listitem>
+ <listitem open="1" type="813" id="vhZF7IlXx2AR" >
+ <listitem open="1" type="814" id="D5DXDic99ez8" />
+ <listitem open="1" type="814" id="cTtAQvKr7P3e" />
+ <listitem open="1" type="814" id="rvPM5XzYQ9zK" />
+ <listitem open="1" type="814" id="RoPop1PZG8P6" />
+ </listitem>
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="vDdHWqqcT83n" />
+ <listitem open="1" type="829" id="DSdS4LG3rEng" />
+ <listitem open="1" type="829" id="pGmhSYLwOIDZ" />
+ <listitem open="1" type="829" id="aUMGBatf5W5Y" />
+ <listitem open="1" type="829" id="gjjImauW3w7L" />
+ <listitem open="1" type="829" id="v1vF54F8NwGF" />
+ <listitem open="1" type="829" id="jEjssjzeT2KU" />
+ <listitem open="1" type="829" id="5LwnLaWMXeOA" />
+ <listitem open="1" type="829" id="JsAMMDvYfW0j" />
+ <listitem open="1" type="829" id="TqxJDqPlKjzV" />
+ <listitem open="1" type="829" id="0YxkpH4IqNt7" />
+ <listitem open="1" type="829" id="Gt2vP2dFGNuj" />
+ <listitem open="1" type="829" id="8cKQMJvd930U" />
+ <listitem open="1" type="829" id="oUmui7GbHR8Q" />
+ <listitem open="1" type="829" id="RLF9aE3wImVB" />
+ <listitem open="1" type="829" id="zBcNEqKhckvA" />
+ <listitem open="0" type="829" id="OJpOHl5xdO6m" />
+ </listitem>
+ <listitem open="0" type="831" id="4HeHqHiULuih" >
+ <listitem open="0" type="839" id="RFOuU8oSPACy" />
+ <listitem open="0" type="839" id="yIMmZRqs9gOJ" />
+ <listitem open="0" type="839" id="JisYA9QR1XQY" />
+ <listitem open="0" type="839" id="sgc58bbaoxSI" />
+ <listitem open="0" type="839" id="Gu61WTgbkIsZ" />
+ </listitem>
+ <listitem open="0" type="831" id="9PHcAMq9VI9x" >
+ <listitem open="0" type="839" id="qIWxnhSw4hWE" />
+ <listitem open="0" type="839" id="CQi475FxLju8" />
+ <listitem open="0" type="839" id="Y2NmKlSW98ZG" />
+ <listitem open="0" type="839" id="E3T742ac4yMO" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="SrlUrCVFsddT" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/cco/region/inc/region.h b/cesar/cp/cco/region/inc/region.h
new file mode 100644
index 0000000000..27e3cc7c1a
--- /dev/null
+++ b/cesar/cp/cco/region/inc/region.h
@@ -0,0 +1,151 @@
+#ifndef cp_cco_region_private_h
+#define cp_cco_region_private_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/cp_cco_region_private.h
+ * \brief Region manager functions
+ * \ingroup cp_cco_region
+ *
+ * « long description »
+ */
+#include "cp/cco/region/region.h"
+
+/**
+ * Memorise the alloc we already ask for to the other nets and has been
+ * refused
+ * */
+struct cp_cco_region_tried_alloc_t
+{
+ /**
+ * Start time
+ * */
+ u16 st;
+
+ /**
+ * End time
+ */
+ u16 et;
+};
+typedef struct cp_cco_region_tried_alloc_t cp_cco_region_tried_alloc_t;
+
+/**
+ * Memorise the different network we already requested
+ * Used to answer to those Networks when a problem occured
+ * 8 elements (8 networks)
+ */
+struct cp_cco_region_net_asked_t
+{
+ /**
+ * false net not asked true net asked
+ */
+ bool asked;
+
+ /**
+ * tei of the CCo of the Net
+ */
+ u16 tei;
+};
+typedef struct cp_cco_region_net_asked_t cp_cco_region_net_asked_t;
+
+
+/**
+ * Process the MME related to the region management. Manage the allocation
+ * and the region distribution of the beacon period.
+ */
+struct cp_cco_region_private_t
+{
+ /** Public data. */
+ cp_cco_region_t public_data;
+
+ /**
+ * List of the already tried alloc
+ * keep memory of the alloc that other nets already didn't accept to give
+ * allocation time
+ */
+ cp_cco_region_tried_alloc_t *tried_alloc;
+
+ /**
+ * List of the nets we already asked and received there answer for a
+ * specific request (used to indicate them the result)
+ */
+ cp_cco_region_net_asked_t *nets_req_status;
+
+
+
+};
+typedef struct cp_cco_region_private_t cp_cco_region_private_t;
+
+/**
+ * Calculate the inl alloc of our network
+ * \param ctx the module context.
+ *
+ * Compute the INL alloc of all NCo
+ */
+
+void
+cp_cco_region_compute_inl_alloc (cp_t *ctx);
+
+/**
+ * When a CCo wants to add an allocation it will request it to the others.
+ * \param ctx the module context.
+ * \param nco_tei null:w
+ *
+ *
+ * This function is called when we receive the demand. It will study
+ * it and respond the result found, failure or success
+ */
+
+void
+cp_cco_region_send_nn_add_alloc_req (cp_t *ctx, u16 nco_tei);
+
+/**
+ * send the NN_ADD_ALLOC.IND
+ * \param ctx the module context.
+ * \param result result of the request
+ * \param nco_tei target of the message
+ *
+ * Init the header and send the MME
+ */
+void
+cp_cco_region_send_nn_add_alloc_ind (cp_t *ctx, u8 result, u16 nco_tei);
+
+/**
+ * When a CCo wants to remove an allocation it will request it to the
+ * others.
+ * \param ctx the module context.
+ * \param nco_tei null
+ *
+ * This function is called when we receive the demand. It will study
+ * it and respond the result found, failure or success
+ */
+void
+cp_cco_region_send_nn_rel_alloc_req (cp_t *ctx, u16 nco_tei);
+
+/**
+ * send the NN_REL_ALLOC.IND
+ * \param ctx the module context.
+ * \param result null
+ * \param nco_tei null
+ *
+ * Init the header and send the MME
+ */
+void
+cp_cco_region_send_nn_rel_alloc_ind (cp_t *ctx, u8 result, u16 nco_tei);
+
+/**
+ * When a CCo wants to create its own network.
+ * \param ctx the module context.
+ * \param nco_tei our tei
+ *
+ * Init the header and send the MME
+ */
+void
+cp_cco_region_send_nn_new_net_req (cp_t *ctx, u16 nco_tei);
+
+#endif /* cp_cco_region_private_h */
diff --git a/cesar/cp/cco/region/region.h b/cesar/cp/cco/region/region.h
new file mode 100644
index 0000000000..c79c7f06a6
--- /dev/null
+++ b/cesar/cp/cco/region/region.h
@@ -0,0 +1,278 @@
+#ifndef cp_cco_region_h
+#define cp_cco_region_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp_cco_region.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "lib/list.h"
+
+#include "cp/cp.h"
+#include "cp/mme.h"
+
+/**
+* Enum of the different states of the regions
+*/
+
+enum cp_cco_region_alloc_state_t
+{
+ CP_CCO_REGION_ALLOC_STATE_BEACON,
+ CP_CCO_REGION_ALLOC_STATE_PROTECTED,
+ CP_CCO_REGION_ALLOC_STATE_RESERVED,
+ CP_CCO_REGION_ALLOC_STATE_STAYOUT,
+ CP_CCO_REGION_ALLOC_STATE_CSMA
+};
+typedef enum cp_cco_region_alloc_state_t cp_cco_region_alloc_state_t;
+
+struct cp_cco_region_inl_alloc_t
+{
+ /**
+ * End time
+ */
+ u16 et;
+
+ /**
+ * State of the region
+ */
+ cp_cco_region_alloc_state_t state;
+
+ /**
+ * List
+ */
+ list_node_t list;
+
+ // TODO Removed this once the region manager is written
+ // Update the beacon unit test i.e.
+ // trunk/cp/beacon/test/src/region_stub.c
+ struct cp_cco_region_inl_alloc_t *next;
+};
+typedef struct cp_cco_region_inl_alloc_t cp_cco_region_inl_alloc_t;
+
+struct cp_cco_region_t
+{
+
+ /**
+ * list of the inl alloc
+ */
+ cp_cco_region_inl_alloc_t *inl_alloc;
+
+ /**
+ * nb of region necessary for the region BENTRY
+ */
+ u16 nb_region;
+
+};
+typedef struct cp_cco_region_t cp_cco_region_t;
+
+/**
+ * Init region
+ * \param ctx the CP context.
+ */
+void
+cp_cco_region_init (cp_t *ctx);
+
+/**
+ * Uninit region
+ * \param ctx the CP context.
+ */
+void
+cp_cco_region_uninit(cp_t *ctx);
+
+
+/**
+ * initiate the process of creating a new network.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cco_region_new_net_init (cp_t *ctx);
+
+/**
+ * Initiate the tables that will keep in memory the evolution of the adding
+ * demands to of networks.
+ * \param ctx the module context.
+ *
+ * It will ask to the first network if the allocation is possible
+ */
+void
+cp_cco_region_add_alloc_init (cp_t *ctx);
+
+/**
+ * Initiate the tables that will keep in memory the evolution of the removal
+ * demands to of networks.
+ * \param ctx the module context.
+ *
+ * It will ask to the first network if the allocation is possible
+ */
+void
+cp_cco_region_rel_alloc_init (cp_t *ctx);
+
+/**
+ * create the schedule to create the region BENTRY.
+ * \param ctx the module context.
+ *
+ */
+cp_cco_region_inl_alloc_t*
+cp_cco_region_get_region (cp_t *ctx);
+
+/**
+ * Deal NID conflicts
+ * \param ctx the module context.
+ *
+ * Analyse the 2 nets with the same NID
+ * Shut down its net if needed
+ */
+void
+cp_cco_region_nid_conflict (cp_t *ctx);
+
+
+/**
+ * Process the shut down of the network
+ * \param ctx the module context.
+ *
+ * Signal to all the NCo that it is shuting down
+ */
+void
+cp_cco_region_shut_down_net (cp_t *ctx);
+
+
+/**
+ * Study the allocation time regarding to the bandwidth ratio and its
+ * INL allocation.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ * Replies with a nn_add_alloc_cnf with the result of the precedent test
+ */
+void
+cp_cco_region_process_nn_add_alloc_req (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * No specific action in the hp specification Call for the new INL allocation.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ */
+void
+cp_cco_region_process_nn_add_alloc_ind (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * Study the result if success request for the next NCo if no more NCo
+ * allocation and send the .
+ * \param ctx the module context.
+ * \param mme null
+ *
+ * IND to signal the success. If failure send the .IND to signal the failure
+ * to the NCo that returned success. And change alloc time
+ */
+void
+cp_cco_region_process_nn_add_alloc_cnf (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * Not clear into the specification.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ * Send NN_REL_ALLOC.CNF with a result. I don't see any reason to respond
+ * failure.
+ */
+void
+cp_cco_region_process_nn_rel_alloc_req (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * Study the result not in the specificationIf failure try again ? if
+ * success ask another NCo until all are asked.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ */
+void
+cp_cco_region_process_nn_rel_alloc_cnf (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * Not on the specification Check the Slot .
+ * \param ctx the module context.
+ * \param mme null
+ *
+ */
+void
+cp_cco_region_process_nn_new_net_req (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * No specific action in the hp specification Call for the new INL allocation.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ */
+void
+cp_cco_region_process_nn_new_net_ind (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * receive the confirmation of a neighbour network.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ * will process the result. If success ask the next NCo If failure respond
+ * .ind to signal the failure if no more NCo respond .ind to signal the
+ * success
+ */
+void
+cp_cco_region_process_nn_new_net_cnf (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * Compute the INL Send our INL into NN_INL.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ * CNF
+ */
+void
+cp_cco_region_process_nn_inl_req (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * Compute the INL If we are not a network try to create one.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ */
+void
+cp_cco_region_process_nn_inl_cnf (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * clear the net from the INL.
+ * \param ctx the module context.
+ * \param mme null
+ *
+ */
+void
+cp_cco_region_process_nn_rel_net_ind (cp_t *ctx, cp_mme_rx_t* mme);
+
+/**
+ * fonction that returns the next element allocated
+ * \param ctx the module context.
+ * \param actual_alloc actual alloc
+ * \return next allocation
+ *
+ */
+cp_cco_region_inl_alloc_t*
+cp_cco_region_get_next_alloc (cp_t *ctx, cp_cco_region_inl_alloc_t* actual_alloc);
+
+/**
+ * Returns the number of regions
+ * \param ctx the module context.
+ * \return number of regions
+ *
+ */
+u16
+cp_cco_region_get_nb_region (cp_t *ctx);
+
+#endif /* cp_cco_region_h */
diff --git a/cesar/cp/cl_interf/Module b/cesar/cp/cl_interf/Module
new file mode 100644
index 0000000000..789759acdc
--- /dev/null
+++ b/cesar/cp/cl_interf/Module
@@ -0,0 +1 @@
+SOURCES := cl_interf.c
diff --git a/cesar/cp/cl_interf/cl_interf.h b/cesar/cp/cl_interf/cl_interf.h
new file mode 100644
index 0000000000..18e8251763
--- /dev/null
+++ b/cesar/cp/cl_interf/cl_interf.h
@@ -0,0 +1,91 @@
+#ifndef cp_cl_interf_cl_interf_h
+#define cp_cl_interf_cl_interf_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cl_interf/cl_interf.h
+ * \brief CP2 cl interface.
+ * \ingroup cp_cl_interf
+ */
+
+#include "cp/mme.h"
+
+/** Forward declaration. */
+typedef struct cp_cl_interf_t cp_cl_interf_t;
+
+/**
+ * Initialise the module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cl_interf_init (cp_t *ctx);
+
+/**
+ * Uninitialise the module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cl_interf_uninit (cp_t *ctx);
+
+
+/**
+ * Process the MME received.
+ * \param ctx the module context.
+ *
+ * It shall use the MSG function to read the header and get a mme_rx_t
+ * context.
+ * - If the MME is complete, it process it and store the data need in
+ * the mme_rx_t context and call the MSG dispatch function.
+ * - if the MMe is fragmented, it shall verify if the segment has not
+ * already been process.
+ * * if it was process, it shall drop it.
+ * * If not, process it
+ */
+void
+cp_cl_interf_process_mme (cp_t *ctx);
+
+/**
+ * Get the available buffer.
+ * \param ctx the module context.
+ * \return MME TX buffer.
+ *
+ * Return null if no buffers are available
+ */
+u8 *
+cp_cl_interf_get_buffer_tx (cp_t *ctx);
+
+/**
+ * Send a MME over the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mme The MME to send.
+ *
+ */
+void
+cp_cl_interf_mme_send (cp_t *ctx, cp_mme_tx_t * mme);
+
+/**
+ * Add a buffer to the circular list.
+ * \param ctx the module context.
+ * \param buffer The buffer received.
+ *
+ */
+void
+cp_cl_interf_add_buffer_tx (cp_t *ctx, u8 * buffer);
+
+/**
+ * Remove all oldest MME received.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cl_interf_garbage_collector (cp_t *ctx);
+
+
+#endif /* cp_cl_interf_cl_interf_h */
diff --git a/cesar/cp/cl_interf/doc/cl-interf.xmi b/cesar/cp/cl_interf/doc/cl-interf.xmi
new file mode 100644
index 0000000000..c91ba065ad
--- /dev/null
+++ b/cesar/cp/cl_interf/doc/cl-interf.xmi
@@ -0,0 +1,221 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-06-11T17:10:43" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="fodFouh268eW" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DC463aIHhlK7" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oLPdEMH2zWqt" isRoot="false" isAbstract="false" name="boolean" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CrxITTrhftnh" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="T3yAmIFadeEp" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0Vsxzgo9VlQx" isRoot="false" isAbstract="false" name="byte" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CHesAPZbTVlF" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nzoOd2CcV2XS" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="gMaC509IFl8P" isRoot="false" isAbstract="false" name="String" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OUp2kw9SZTuJ" isRoot="false" isAbstract="false" name="cp_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="AAFUOZ0IGNtv" isRoot="false" isAbstract="false" name="cp_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="huLv09HSwJCq" isRoot="false" isAbstract="false" name="cp_mme_rx_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QfOrXhyfrB9D" isRoot="false" isAbstract="false" name="cp_mme_rx_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="i8UzTNsAGC3G" isRoot="false" isAbstract="false" name="u8 *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="JKiEbs40XSr2" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8nixyp9hxdeQ" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="yUZEeaSytACU" isRoot="false" isAbstract="false" name="u16 *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3ESYhKZp5Fk4" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="4tj2WLQTnzhS" isRoot="false" isAbstract="false" name="u32 *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="YAORIYtJmMqR" isRoot="false" isAbstract="false" name="uint" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eNEjczlgsSgP" isRoot="false" isAbstract="false" name="uint *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="n5sZ4X1cfP1w" isRoot="false" isAbstract="false" name="mfs_rx_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="HjZiBkB7uGkR" isRoot="false" isAbstract="false" name="circular_buffer_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="EbAmERjcvbjt" isRoot="false" isAbstract="false" name="cp_mme_tx_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="2pQgrGVogRXk" isRoot="false" isAbstract="false" name="cyg_mailbox" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CvfYB3fER3b7" isRoot="false" isAbstract="false" name="cyg_handle_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Lz9qKEoylkrp" isRoot="false" isAbstract="false" name="void *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OJjZc9tHsS0k" isRoot="false" isAbstract="false" name="cyg_sem_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BUNryvzNr1au" isRoot="false" isAbstract="false" name="blk_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="YxkRf9EIeI5c" isRoot="false" isAbstract="false" name="blk_desc_t *" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="WwjMdfM1SD5o" isRoot="false" isAbstract="false" name="cp_cl_interf_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The buffer list containing the TX buffers." isSpecification="false" visibility="private" xmi.id="Fk4rXJnfDxeU" type="HjZiBkB7uGkR" name="buffer_tx_list" />
+ <UML:Attribute comment="The array to provide to the circular buffer." isSpecification="false" visibility="private" xmi.id="gDCqvLxnafCv" type="i8UzTNsAGC3G" name="list [CP_CL_INTERF_LIST_SIZE]" />
+ <UML:Attribute comment="The mailbox to insert the received messages." isSpecification="false" visibility="private" xmi.id="dAar1Co3zCir" type="2pQgrGVogRXk" name="mme_rx_mailbox" />
+ <UML:Attribute comment="The mailbox handler." isSpecification="false" visibility="private" xmi.id="SDf9dBrn4WMD" type="CvfYB3fER3b7" name="mailbox_handle" />
+ <UML:Attribute comment="Semphore for the list tx buffer access." isSpecification="false" visibility="private" xmi.id="s9yLBSJXocGN" type="OJjZc9tHsS0k" name="buffer_list_sem" />
+ <UML:Operation comment="Initialise the module." isSpecification="false" isLeaf="false" visibility="public" xmi.id="YtA3AviNqLpX" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Receive a MME from the PWL or the HLE." isSpecification="false" isLeaf="false" visibility="private" xmi.id="W2LSLGDvtQpp" isRoot="false" isAbstract="false" isQuery="false" name="rx_mme" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The user data." isSpecification="false" visibility="private" xmi.id="OuuMdeDTNNdY" value="" type="Lz9qKEoylkrp" name="user" />
+ <UML:Parameter comment="The MFS used to received the MME." isSpecification="false" visibility="private" xmi.id="ma2dyrSRtDzi" value="" type="n5sZ4X1cfP1w" name="mfs" />
+ <UML:Parameter comment="The MME buffer containing the MME." isSpecification="false" visibility="private" xmi.id="T4mXpZoNQwOa" value="" type="i8UzTNsAGC3G" name="buffer" />
+ <UML:Parameter comment="The MME length." isSpecification="false" visibility="private" xmi.id="s7viQlDwlWM6" value="" type="YAORIYtJmMqR" name="length" />
+ <UML:Parameter comment="The CL data." isSpecification="false" visibility="private" xmi.id="xGAbfkzAZilR" value="" type="Lz9qKEoylkrp" name="cl-data" />
+ <UML:Parameter comment="Indicate if the MME was Phy encrypted or not." isSpecification="false" visibility="private" xmi.id="kl6BiSjaZdIx" value="" type="oLPdEMH2zWqt" name="hardware_encrypt" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process the MME received.
+It shall use the MSG function to read the header and get a mme_rx_t context.
+ - If the MME is complete, it process it and store the data need in the mme_rx_t context and call the MSG dispatch function.
+ - if the MMe is fragemented, it shall verify if the segment has not already been process.
+ * if it was process, it shall drop it.
+ * If not. process it." isSpecification="false" isLeaf="false" visibility="public" xmi.id="OUs90EFlmHOk" isRoot="false" isAbstract="false" isQuery="false" name="process_mme" />
+ <UML:Operation comment="Get the available buffer.
+Lock if until no buffers are available." isSpecification="false" isLeaf="false" visibility="public" xmi.id="VFoto3F4HJOm" isRoot="false" isAbstract="false" isQuery="false" name="get_buffer_tx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uRR6R8t4kUqQ" type="i8UzTNsAGC3G" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Send a MME over the PWL or the HLE." isSpecification="false" isLeaf="false" visibility="public" xmi.id="0OamQN7UE0ho" isRoot="false" isAbstract="false" isQuery="false" name="mme_send" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The MME to send." isSpecification="false" visibility="private" xmi.id="cedohj4Bwt4k" value="" type="EbAmERjcvbjt" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add a buffer to the circular list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Bvb7mdrgudsS" isRoot="false" isAbstract="false" isQuery="false" name="add_buffer_tx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The buffer received." isSpecification="false" visibility="private" xmi.id="lp1JKLDCmcJB" value="" type="i8UzTNsAGC3G" name="buffer" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove all oldest MME received." isSpecification="false" isLeaf="false" visibility="public" xmi.id="lCDTg4rpxQwj" isRoot="false" isAbstract="false" isQuery="false" name="garbage_collector" />
+ <UML:Operation comment="Uninitialise the module." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ttdu4I1hRsVT" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="mQz019kFYUpR" isRoot="false" isAbstract="false" name="cp_cl_interf_msg_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The buffer containing the MME." isSpecification="false" visibility="public" xmi.id="5YLrUxQgyh1m" type="i8UzTNsAGC3G" name="buffer" />
+ <UML:Attribute comment="The MME length." isSpecification="false" visibility="public" xmi.id="8JaeJ943Z31Y" type="YAORIYtJmMqR" name="length" />
+ <UML:Attribute comment="The MFS used to receive the MME from the PWL only, NULL if coming from the HLE." isSpecification="false" visibility="public" xmi.id="BmlhEa9J6S9Y" type="n5sZ4X1cfP1w" name="mfs" />
+ <UML:Attribute comment="Indicate if the MME was received as encrypted or not." isSpecification="false" visibility="public" xmi.id="PZFMGE6MXh0o" type="oLPdEMH2zWqt" name="hard_encrypt" />
+ <UML:Attribute comment="Data used by the CL." isSpecification="false" visibility="public" xmi.id="jCCDbeeeRbPU" type="Lz9qKEoylkrp" name="cl_data" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2eC8WeevFgVX" isRoot="false" isAbstract="false" name="cp_sta_reassembly_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Head of the list." isSpecification="false" visibility="public" xmi.id="GQ7bww5H9YfY" type="YxkRf9EIeI5c" name="head" />
+ <UML:Attribute comment="The tail of the list." isSpecification="false" visibility="public" xmi.id="t5bPc8ZlaxdY" type="YxkRf9EIeI5c" name="tail" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="savjcUcssjRp" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="fU4n0jJsmuHN" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="973" snapy="10" showatts="1" xmi.id="BF7V3R51Kpsx" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="844" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="702" showattsigs="601" x="95" fillcolor="#ffffc0" y="221" showopsigs="601" linewidth="none" height="224" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="WwjMdfM1SD5o" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="171" showattsigs="601" x="582" fillcolor="#ffffc0" y="49" showopsigs="601" linewidth="none" height="104" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="mQz019kFYUpR" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="156" showattsigs="601" x="121" fillcolor="#ffffc0" y="42" showopsigs="601" linewidth="none" height="80" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="2eC8WeevFgVX" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="BF7V3R51Kpsx" documentation="" uniqueid="YxkRf9EIeI5c" />
+ <listview>
+ <listitem open="1" type="800" label="Vues" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="807" id="BF7V3R51Kpsx" label="diagramme de classes" />
+ <listitem open="1" type="813" id="mQz019kFYUpR" >
+ <listitem open="0" type="814" id="5YLrUxQgyh1m" />
+ <listitem open="0" type="814" id="8JaeJ943Z31Y" />
+ <listitem open="0" type="814" id="BmlhEa9J6S9Y" />
+ <listitem open="0" type="814" id="PZFMGE6MXh0o" />
+ <listitem open="0" type="814" id="jCCDbeeeRbPU" />
+ </listitem>
+ <listitem open="1" type="813" id="WwjMdfM1SD5o" >
+ <listitem open="0" type="814" id="Fk4rXJnfDxeU" />
+ <listitem open="0" type="814" id="gDCqvLxnafCv" />
+ <listitem open="0" type="814" id="dAar1Co3zCir" />
+ <listitem open="0" type="814" id="SDf9dBrn4WMD" />
+ <listitem open="0" type="814" id="s9yLBSJXocGN" />
+ <listitem open="0" type="815" id="YtA3AviNqLpX" />
+ <listitem open="0" type="815" id="W2LSLGDvtQpp" />
+ <listitem open="0" type="815" id="OUs90EFlmHOk" />
+ <listitem open="0" type="815" id="VFoto3F4HJOm" />
+ <listitem open="0" type="815" id="0OamQN7UE0ho" />
+ <listitem open="0" type="815" id="Bvb7mdrgudsS" />
+ <listitem open="0" type="815" id="lCDTg4rpxQwj" />
+ <listitem open="0" type="815" id="Ttdu4I1hRsVT" />
+ </listitem>
+ <listitem open="1" type="813" id="2eC8WeevFgVX" >
+ <listitem open="0" type="814" id="GQ7bww5H9YfY" />
+ <listitem open="0" type="814" id="t5bPc8ZlaxdY" />
+ <listitem open="0" type="815" id="savjcUcssjRp" />
+ <listitem open="0" type="815" id="fU4n0jJsmuHN" />
+ </listitem>
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="gMaC509IFl8P" />
+ <listitem open="1" type="829" id="YxkRf9EIeI5c" />
+ <listitem open="1" type="829" id="BUNryvzNr1au" />
+ <listitem open="1" type="829" id="oLPdEMH2zWqt" />
+ <listitem open="1" type="829" id="0Vsxzgo9VlQx" />
+ <listitem open="1" type="829" id="DC463aIHhlK7" />
+ <listitem open="1" type="829" id="HjZiBkB7uGkR" />
+ <listitem open="1" type="829" id="huLv09HSwJCq" />
+ <listitem open="1" type="829" id="QfOrXhyfrB9D" />
+ <listitem open="1" type="829" id="EbAmERjcvbjt" />
+ <listitem open="1" type="829" id="OUp2kw9SZTuJ" />
+ <listitem open="1" type="829" id="AAFUOZ0IGNtv" />
+ <listitem open="1" type="829" id="CvfYB3fER3b7" />
+ <listitem open="1" type="829" id="2pQgrGVogRXk" />
+ <listitem open="1" type="829" id="OJjZc9tHsS0k" />
+ <listitem open="1" type="829" id="T3yAmIFadeEp" />
+ <listitem open="1" type="829" id="CrxITTrhftnh" />
+ <listitem open="1" type="829" id="fodFouh268eW" />
+ <listitem open="1" type="829" id="nzoOd2CcV2XS" />
+ <listitem open="1" type="829" id="n5sZ4X1cfP1w" />
+ <listitem open="1" type="829" id="CHesAPZbTVlF" />
+ <listitem open="1" type="829" id="8nixyp9hxdeQ" />
+ <listitem open="1" type="829" id="yUZEeaSytACU" />
+ <listitem open="1" type="829" id="3ESYhKZp5Fk4" />
+ <listitem open="1" type="829" id="4tj2WLQTnzhS" />
+ <listitem open="1" type="829" id="JKiEbs40XSr2" />
+ <listitem open="1" type="829" id="i8UzTNsAGC3G" />
+ <listitem open="1" type="829" id="YAORIYtJmMqR" />
+ <listitem open="1" type="829" id="eNEjczlgsSgP" />
+ <listitem open="1" type="829" id="Lz9qKEoylkrp" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" />
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/cl_interf/doc/cp_cl_interf.odt b/cesar/cp/cl_interf/doc/cp_cl_interf.odt
new file mode 100644
index 0000000000..7194a56641
--- /dev/null
+++ b/cesar/cp/cl_interf/doc/cp_cl_interf.odt
Binary files differ
diff --git a/cesar/cp/cl_interf/inc/cl_interf.h b/cesar/cp/cl_interf/inc/cl_interf.h
new file mode 100644
index 0000000000..0be8e944ea
--- /dev/null
+++ b/cesar/cp/cl_interf/inc/cl_interf.h
@@ -0,0 +1,46 @@
+#ifndef cp_cl_interf_inc_cl_interf_h
+#define cp_cl_interf_inc_cl_interf_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cl_interf/inc/cl_interf.h
+ * \brief Private functions.
+ * \ingroup cp_cl_interf
+ */
+#include "cp/cp.h"
+#include "mac/common/mfs.h"
+
+/**
+ * Receive a MME from the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mfs The MFS used to received the MME.
+ * \param buffer The MME buffer containing the MME.
+ * \param length The MME length.
+ * \param cl-data The CL data.
+ * \param hardware_encrypt Indicate if the MME was Phy encrypted or not.
+ *
+ */
+void
+cp_cl_interf_rx_mme (cp_t *ctx, mfs_rx_t * mfs,
+ u8 * buffer, uint length, void * cl_data,
+ bool hardware_encrypt);
+
+/**
+ * Copy the Fragmented MME into blocks.
+ * \param ctx the cp module context.
+ * \param tei the station source TEI.
+ * \param mme the MME to fragment.
+ * \param length the MME length.
+ * \param fmi the FMI MME data.
+ * \return true if it was the last message, false otherwise.
+ */
+bool
+cp_cl_interf_rx_mme_frag (cp_t *ctx, cp_tei_t tei, u8 *mme, uint length,
+ uint fmi);
+
+#endif /* cp_cl_interf_inc_cl_interf_h */
diff --git a/cesar/cp/cl_interf/inc/cl_interf_msg.h b/cesar/cp/cl_interf/inc/cl_interf_msg.h
new file mode 100644
index 0000000000..0cfea78575
--- /dev/null
+++ b/cesar/cp/cl_interf/inc/cl_interf_msg.h
@@ -0,0 +1,47 @@
+#ifndef cp_cl_interf_cl_interf_msg_h
+#define cp_cl_interf_cl_interf_msg_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cl_interf/cl_interf_msg.h
+ * \brief Message structure to store the data in the mailbox.
+ * \ingroup cp_cl_interf
+ *
+ */
+
+struct cp_cl_interf_msg_t
+{
+ /**
+ * The buffer containing the MME.
+ */
+ u8 * buffer;
+
+ /**
+ * The MME length.
+ */
+ uint length;
+
+ /**
+ * The MFS used to receive the MME from the PWL only, NULL if coming
+ * from the HLE.
+ */
+ mfs_rx_t * mfs;
+
+ /**
+ * Indicate if the MME was received as encrypted or not.
+ */
+ bool hard_encrypt;
+
+ /**
+ * Data used by the CL.
+ */
+ void * cl_data;
+};
+typedef struct cp_cl_interf_msg_t cp_cl_interf_msg_t;
+
+#endif /* cp_cl_interf_cl_interf_msg_h */
diff --git a/cesar/cp/cl_interf/inc/context.h b/cesar/cp/cl_interf/inc/context.h
new file mode 100644
index 0000000000..3bf956e6d3
--- /dev/null
+++ b/cesar/cp/cl_interf/inc/context.h
@@ -0,0 +1,51 @@
+#ifndef cp_cl_interf_context_h
+#define cp_cl_interf_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/cl_interf/context.h
+ * \brief CL interface context.
+ * \ingroup cl_interf
+ *
+ */
+
+#define CP_CL_INTERF_LIST_SIZE 2
+
+#include "cyg/kernel/kapi.h"
+
+#include "lib/circular_buffer.h"
+
+struct cp_cl_interf_t
+{
+ /**
+ * The buffer list containing the TX buffers.
+ */
+ circular_buffer_t buffer_tx_list;
+
+ /**
+ * The array to provide to the circular buffer.
+ */
+ u8 *list[CP_CL_INTERF_LIST_SIZE];
+
+ /**
+ * The mailbox to insert the received messages.
+ */
+ cyg_mbox mme_rx_mailbox;
+
+ /**
+ * The mailbox handler.
+ */
+ cyg_handle_t mailbox_handle;
+
+ /**
+ * Semaphore for the buffer TX list.
+ */
+ cyg_sem_t buffer_list_sem;
+};
+
+#endif /* cp_cl_interf_context_h */
diff --git a/cesar/cp/cl_interf/src/cl_interf.c b/cesar/cp/cl_interf/src/cl_interf.c
new file mode 100644
index 0000000000..b457092d82
--- /dev/null
+++ b/cesar/cp/cl_interf/src/cl_interf.c
@@ -0,0 +1,368 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cl_interf/src/cl_interf.c
+ * \brief Cl Interface source.
+ * \ingroup cp_cl_interf
+ *
+ */
+#include "common/std.h"
+#include "common/defs/ethernet.h"
+
+#include "lib/read_word.h"
+#include "lib/blk.h"
+
+#include "cp/cp.h"
+#include "cp/defs.h"
+
+#include "interface/interface.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/msg/msg.h"
+
+#include "cp/inc/context.h"
+#include "cp/cl_interf/inc/context.h"
+#include "cp/cl_interf/inc/cl_interf.h"
+#include "cp/cl_interf/inc/cl_interf_msg.h"
+
+/**
+ * Initialise the module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cl_interf_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ // Initialise the circular list.
+ circular_buffer_init (&ctx->cl_interf.buffer_tx_list,
+ ctx->cl_interf.list,
+ CP_CL_INTERF_LIST_SIZE);
+
+ // Create the mailbox.
+ cyg_mbox_create(&ctx->cl_interf.mailbox_handle,
+ &ctx->cl_interf.mme_rx_mailbox);
+
+ // Create the semaphore.
+ cyg_semaphore_init (&ctx->cl_interf.buffer_list_sem, 0);
+
+ // Initialise the call backs.
+ interface_callback_init (ctx->interface,
+ (interface_mme_recv_cb_t) cp_cl_interf_rx_mme,
+ (interface_mme_buffer_add_cb_t)
+ cp_cl_interf_add_buffer_tx,
+ ctx);
+}
+
+/**
+ * Uninitialise the module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cl_interf_uninit (cp_t *ctx)
+{
+ cp_cl_interf_t *msg;
+ dbg_assert (ctx);
+
+ while (cyg_mbox_peek (ctx->cl_interf.mailbox_handle))
+ {
+ msg = cyg_mbox_get (ctx->cl_interf.mailbox_handle);
+ blk_release (msg);
+ }
+
+ // Delete the mailbox.
+ cyg_mbox_delete (ctx->cl_interf.mailbox_handle);
+
+ // Delete the semaphore.
+ cyg_semaphore_destroy (&ctx->cl_interf.buffer_list_sem);
+}
+
+/**
+ * Process the MME received.
+ * \param ctx the module context.
+ *
+ * It shall use the MSG function to read the header and get a mme_rx_t
+ * context.
+ * - If the MME is complete, it process it and store the data need in
+ * the mme_rx_t context and call the MSG dispatch function.
+ * - if the MMe is fragmented, it shall verify if the segment has not
+ * already been process.
+ * * if it was process, it shall drop it.
+ * * If not, process it
+ */
+void
+cp_cl_interf_process_mme (cp_t *ctx)
+{
+ cp_mme_rx_t *mme;
+ cp_cl_interf_msg_t *msg;
+ uint fmi;
+
+ dbg_assert (ctx);
+
+ msg = cyg_mbox_get (ctx->cl_interf.mailbox_handle);
+ dbg_check (msg);
+
+ mme = cp_msg_mme_read_header (ctx, msg->buffer, msg->length,
+ msg->mfs->common.tei, &fmi);
+
+ // MME is not formatted correctly.
+ // Release the buffer.
+ if (!mme)
+ interface_mme_recv_done (ctx->interface, msg->cl_data);
+ else
+ {
+ mme->cl_data = msg->cl_data;
+ // Verify if the MME is a segmented MME.
+ if (fmi)
+ {
+ bool last_mme;
+ last_mme = cp_cl_interf_rx_mme_frag (ctx, msg->mfs->common.tei,
+ msg->buffer, msg->length,
+ fmi);
+
+ interface_mme_recv_done (ctx->interface, msg->cl_data);
+ mme->p_mme = NULL;
+ mme->length += msg->length;
+
+ if (last_mme)
+ {
+ cp_sta_t *sta;
+ cp_net_t *net;
+
+ net = cp_sta_mgr_get_our_avln (ctx);
+ sta = cp_net_get_sta (ctx, net, msg->mfs->common.tei);
+ mme->p_frag = (blk_t *)sta->reassembly_ctx.head;
+ mme->p_frag_current = mme->p_frag_current;
+ sta->reassembly_ctx.head = NULL;
+ sta->reassembly_ctx.tail = NULL;
+ slab_release (sta);
+
+ cp_msg_dispatch (ctx, mme);
+ }
+ else
+ {
+ interface_mme_recv_done (ctx->interface, msg->cl_data);
+ blk_release (mme);
+ }
+ }
+ // Normal MME call the MSG dispatcher.
+ else
+ cp_msg_dispatch (ctx, mme);
+ }
+
+
+ // Release data.
+ if (msg->mfs)
+ blk_release (msg->mfs);
+ slab_release (msg);
+}
+
+/**
+ * Get the available buffer.
+ * \param ctx the module context.
+ * \return MME TX buffer.
+ *
+ * Return null if no buffers are available
+ */
+u8 *
+cp_cl_interf_get_buffer_tx (cp_t *ctx)
+{
+ cyg_semaphore_wait (&ctx->cl_interf.buffer_list_sem);
+ return circular_buffer_get (&ctx->cl_interf.buffer_tx_list);
+}
+
+/**
+ * Send a MME over the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mme The MME to send.
+ *
+ */
+void
+cp_cl_interf_mme_send (cp_t *ctx, cp_mme_tx_t * mme)
+{
+ mfs_tx_t *mfs;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ if (mme->peer.all_sta)
+ {
+ cp_net_t *net;
+ cp_sta_t *sta_current;
+
+ net = cp_sta_mgr_get_our_avln (ctx);
+ sta_current = cp_net_get_first (ctx, net, CP_STA_STATE_ASSOCIATED);
+ while (sta_current)
+ {
+ mfs = mac_store_mfs_get_tx (ctx->mac_store, false /* bcast */,
+ true /* MME */,
+ MAC_LID_NONE /* MME */,
+ cp_sta_get_tei (sta_current));
+
+ // Provide it to the interface.
+ interface_mme_send (ctx->interface, mme->p_mme,
+ mme->length, mfs);
+
+ sta_current = cp_net_get_next (ctx, net, sta_current);
+
+ if (mfs)
+ blk_release (mfs);
+ }
+ }
+ else
+ {
+ dbg_assert (mme->peer.tei);
+ mfs = mac_store_mfs_get_tx (ctx->mac_store, false /* bcast */,
+ true /* MME */,
+ MAC_LID_NONE /* MME */,
+ mme->peer.tei);
+ // Provide it to the interface.
+ interface_mme_send (ctx->interface, mme->p_mme, mme->length, mfs);
+
+ if (mfs)
+ blk_release (mfs);
+ }
+}
+
+/**
+ * Add a buffer to the circular list.
+ * \param ctx the module context.
+ * \param buffer The buffer received.
+ *
+ */
+void
+cp_cl_interf_add_buffer_tx (cp_t *ctx, u8 * buffer)
+{
+ dbg_assert (ctx);
+ dbg_assert (buffer);
+
+ circular_buffer_add (&ctx->cl_interf.buffer_tx_list, buffer);
+ cyg_semaphore_post (&ctx->cl_interf.buffer_list_sem);
+}
+
+/**
+ * Remove all oldest MME received.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cl_interf_garbage_collector (cp_t *ctx){}
+
+
+/**
+ * Receive a MME from the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mfs The MFS used to received the MME.
+ * \param buffer The MME buffer containing the MME.
+ * \param length The MME length.
+ * \param cl-data The CL data.
+ * \param hardware_encrypt Indicate if the MME was Phy encrypted or not.
+ *
+ */
+void
+cp_cl_interf_rx_mme (cp_t *ctx, mfs_rx_t * mfs,
+ u8 * buffer, uint length, void * cl_data,
+ bool hardware_encrypt)
+{
+ cp_cl_interf_msg_t *msg;
+ dbg_assert (ctx);
+ dbg_assert (mfs);
+ dbg_assert (buffer);
+ dbg_assert (length >= ETH_PACKET_MIN_SIZE
+ && length <= ETH_PACKET_MAX_SIZE);
+
+ msg = blk_alloc ();
+ msg->mfs = mfs;
+ blk_addref (msg->mfs);
+ msg->buffer = buffer;
+ msg->length = length;
+ msg->cl_data = cl_data;
+ msg->hard_encrypt = hardware_encrypt;
+
+ // Store the message in the mailbox.
+ cyg_mbox_put (ctx->cl_interf.mailbox_handle, msg);
+
+ // Raise an event in station core.
+}
+
+
+/**
+ * Copy the Fragmented MME into blocks.
+ * \param ctx the cp module context.
+ * \param tei the station source TEI.
+ * \param mme the MME to fragment.
+ * \param length the MME length.
+ * \param fmi the FMI MME data.
+ * \return true if it was the last message, false otherwise.
+ */
+bool
+cp_cl_interf_rx_mme_frag (cp_t *ctx, cp_tei_t tei, u8 *mme, uint length,
+ uint fmi)
+{
+ uint fmi_frag_nbs;
+ uint fmi_frag_nb;
+ uint fmi_frag_ssn;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_reassembly_ctx_blk_t *head;
+ cp_sta_reassembly_ctx_blk_t *tail;
+ bitstream_t bitstream;
+ uint nb_blk;
+ cp_sta_reassembly_ctx_blk_t *current;
+ uint offset;
+ uint rest;
+
+
+ bitstream_init (&bitstream, &fmi, 16, BITSTREAM_READ);
+ bitstream_access (&bitstream, &fmi_frag_nbs, 4);
+ bitstream_access (&bitstream, &fmi_frag_nb, 4);
+ bitstream_access (&bitstream, &fmi_frag_ssn, 4);
+ bitstream_finalise (&bitstream);
+
+ net = cp_sta_mgr_get_our_avln (ctx);
+ sta = cp_net_get_sta (ctx, net, tei);
+
+ dbg_assert (sta);
+
+ sta->reassembly_ctx.last_seg_ssn = fmi_frag_ssn;
+ nb_blk = (length / BLK_SIZE) + 1;
+
+ // Compute the number of blocks.
+ head = (cp_sta_reassembly_ctx_blk_t *)
+ blk_alloc_desc_range (nb_blk, (blk_t **) &tail);
+ tail->next = NULL;
+
+ for (current = head, offset = 0;
+ offset < length && current != NULL;
+ offset += BLK_SIZE, current = current->next)
+ {
+ current->length = ((rest = (length - offset)) > BLK_SIZE)
+ ? BLK_SIZE : rest;
+ current->ssn = fmi_frag_ssn;
+ bitstream_memcpy (current->data, mme + offset,
+ (rest > BLK_SIZE) ? BLK_SIZE : rest);
+ }
+
+ // Chain the blocks.
+ if (sta->reassembly_ctx.tail)
+ {
+ sta->reassembly_ctx.tail->next = head;
+ sta->reassembly_ctx.tail = tail;
+ }
+ else
+ {
+ sta->reassembly_ctx.head = head;
+ sta->reassembly_ctx.tail = tail;
+ }
+ slab_release (sta);
+
+ if (fmi_frag_nb == fmi_frag_nbs)
+ return true;
+ else
+ return false;
+}
diff --git a/cesar/cp/cl_interf/test/Makefile b/cesar/cp/cl_interf/test/Makefile
new file mode 100644
index 0000000000..98019be202
--- /dev/null
+++ b/cesar/cp/cl_interf/test/Makefile
@@ -0,0 +1,13 @@
+BASE = ../../..
+
+ECOS = y
+
+INCLUDES = cp/cl_interf/test/overide
+
+TARGET_PROGRAMS = test-cl-interf
+
+test-cl-interf_SOURCES = test-cl-interf.c cl_stub.c fsm_stub.c
+test-cl-interf_MODULES = lib cp/cl_interf cp/sta/mgr mac/common \
+ cp/secu
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/cl_interf/test/doc/Makefile b/cesar/cp/cl_interf/test/doc/Makefile
new file mode 100644
index 0000000000..27949031b7
--- /dev/null
+++ b/cesar/cp/cl_interf/test/doc/Makefile
@@ -0,0 +1,20 @@
+PAGES= cl-interf.txt
+
+ODT=$(PAGES:%.txt=%.odt)
+HTML=$(PAGES:%.txt=%.html)
+
+all: $(ODT) $(HTML)
+
+odt: $(ODT)
+
+html: $(HTML)
+
+%.odt: %.txt
+ rst2odt.py $< $@
+
+%.html: %.txt
+ rst2html $< $@
+
+clean:
+ rm -f $(ODT)
+ rm -f $(HTML)
diff --git a/cesar/cp/cl_interf/test/doc/cl-interf.txt b/cesar/cp/cl_interf/test/doc/cl-interf.txt
new file mode 100644
index 0000000000..fd7607fba9
--- /dev/null
+++ b/cesar/cp/cl_interf/test/doc/cl-interf.txt
@@ -0,0 +1,81 @@
+CL Interface
+============
+
+Init
+----
+
+This function shall configure all the callback from the interface module:
+
+* Receive buffer
+* Receive MME.
+
+It shall initialise:
+
+* The buffer list.
+* The mailbox.
+
+Environment
+
+ Once the init function has be called all the callbacks function of the interface module shall be called to verify if the connectivity is done.
+ The eCos mailbox shall be empty as the buffer list.
+
+Receiving a MME
+---------------
+
+Environment
+ Simulate a received MME from the PWL.
+
+Result
+
+ It shall raise the flag in STA Core and create a message to post it in the mailbox.
+
+Processing a MME
+----------------
+
+This function shall get the first MME from the mailbox and process it. It will
+use the MSG function to read and get the cp_mme_rx_t context and get the type
+of MME. This shall then call the msg dispatch function.
+
+Test 1 : Non Fragmented MME.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+
+ Stub the function of the MSG to simulate the data of the MME.
+
+Result
+
+ The MSG function which read the header of the MME shall return the MME rx data.
+ The MSG dispatch function is called.
+
+Test 2 : Fragmented MME.
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+
+ Stub the function of the MSG to simulate the data of the MME.
+
+Result
+
+ The MSG function which read the header of the MME shall return the MME rx data.
+
+ The MME shall be copied in some blocks.
+
+Add and Get a TX buffer
+-----------------------
+
+Environment
+
+ Add a buffer to the list of buffer and get it.
+
+Result
+
+ The function shall return a cp_mme_tx_t object containing the address of the buffer instantiated in the test function.
+
+Sending a MME
+-------------
+
+This function shall get the MFS using the mac store.
+
+Garbage collector
+-----------------
diff --git a/cesar/cp/cl_interf/test/ecos.ecc.sh b/cesar/cp/cl_interf/test/ecos.ecc.sh
new file mode 100644
index 0000000000..2443d0e40f
--- /dev/null
+++ b/cesar/cp/cl_interf/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<'EOF'
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/cl_interf/test/overide/cp_fsm_defs.h b/cesar/cp/cl_interf/test/overide/cp_fsm_defs.h
new file mode 100644
index 0000000000..c29fa69e19
--- /dev/null
+++ b/cesar/cp/cl_interf/test/overide/cp_fsm_defs.h
@@ -0,0 +1,38 @@
+#ifndef overide_cp_fsm_defs_h
+#define overide_cp_fsm_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp_fsm_defs.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_all_sta_leaved,
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* overide_cp_fsm_defs_h */
diff --git a/cesar/cp/cl_interf/test/src/cl_stub.c b/cesar/cp/cl_interf/test/src/cl_stub.c
new file mode 100644
index 0000000000..1efcdc14e9
--- /dev/null
+++ b/cesar/cp/cl_interf/test/src/cl_stub.c
@@ -0,0 +1,88 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cl/cl_mactotei.h
+ * \brief mac to tei table interface between the CL and the CP
+ * \ingroup cl
+ *
+ */
+#include "common/std.h"
+#include "cl/cl_mactotei.h"
+
+/**
+ * Create a new table to be filled by the CP.
+ *
+ * \return a pointer to the new block to be fill with the mac to tei table
+ * data
+ */
+cl_mactotei_blk_t *
+cl_mactotei_new (void)
+{
+ return NULL;
+}
+
+/**
+ * Add a new tupple of data to the table.
+ *
+ * \param table the table pointer to add a new mac to tei correspondance.
+ * \param mac_addr the mac addr to add
+ * \param tei the tei corresponding to the STA.
+ * \param tag the CP tag provide to indentifier a network.
+ */
+void cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr,
+ uint tei, uint tag)
+{
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tag)
+{
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag and the tei.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tei the tei to copy.
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tei_and_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tei, u8 tag)
+{
+}
+
+/**
+ * Request the CL to use the new table and remove the old one.
+ *
+ * \param ctx the CL context
+ * \param table the new table to use.
+ */
+void
+cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
+{
+}
+
+/**
+ * Release the complete table from the memory.
+ *
+ * \param ctx the convergence layer context
+ */
+void cl_mactotei_release_table (cl_t *ctx)
+{
+}
+
diff --git a/cesar/cp/cl_interf/test/src/fsm_stub.c b/cesar/cp/cl_interf/test/src/fsm_stub.c
new file mode 100644
index 0000000000..849f375270
--- /dev/null
+++ b/cesar/cp/cl_interf/test/src/fsm_stub.c
@@ -0,0 +1,29 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
diff --git a/cesar/cp/cl_interf/test/src/test-cl-interf.c b/cesar/cp/cl_interf/test/src/test-cl-interf.c
new file mode 100644
index 0000000000..5460c03e79
--- /dev/null
+++ b/cesar/cp/cl_interf/test/src/test-cl-interf.c
@@ -0,0 +1,511 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cl_interf/test/src/test-cl-interf.c
+ * \brief Test the CL interface.
+ * \ingroup cp_cl_interf
+ *
+ * See [source:trunk/cesar/cp/cl_interf/test/doc/cl-intef.txt]
+ * or
+ * [wiki:UT-CPM1-CL-INTERF]
+ */
+#include "common/std.h"
+#include "common/defs/homeplugAV.h"
+#include "common/defs/ethernet.h"
+
+#include "lib/test.h"
+#include "lib/swap.h"
+#include "lib/read_word.h"
+
+#include "mac/common/store.h"
+
+#include "cp/cp.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/msg/msg.h"
+
+#include "cp/inc/context.h"
+#include "cp/cl_interf/inc/context.h"
+#include "cp/cl_interf/inc/cl_interf.h"
+#include "cp/cl_interf/inc/cl_interf_msg.h"
+
+#include "cp/msg/msg.h"
+
+static test_t test;
+static bool test_send_mme_without_mfs = false;
+
+// Use by the msg dispatch stub.
+static cp_mme_rx_t *dispatch_mme_rx;
+
+/** Thread context. */
+u8 thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
+cyg_handle_t thread_handle;
+cyg_thread thread;
+
+void
+test_case_cl_interf_init (void)
+{
+ cp_t cp;
+
+ test_case_begin (test, "Initialise");
+
+ cp_cl_interf_init (&cp);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (cp.cl_interf.buffer_tx_list.num_slots !=
+ CP_CL_INTERF_LIST_SIZE,
+ "Wrong number of slots for the TX buffer list");
+ test_fail_if (cp.cl_interf.buffer_tx_list.nb_elements!= 0,
+ "Wrong number of elements in TX buffer list");
+ test_fail_if (cyg_mbox_peek (cp.cl_interf.mailbox_handle) != 0,
+ "Wrong number of messages in the mailbox.");
+ }
+ test_end;
+}
+
+void
+test_case_cl_interf_receive_mme (void)
+{
+ cp_t cp;
+ mfs_rx_t *mfs;
+ cp_cl_interf_msg_t *msg;
+ void *cl_data;
+ u8 buffer[2048] __attribute__((aligned(2048)));
+
+ mfs = blk_alloc ();
+ cp_cl_interf_init (&cp);
+
+ test_case_begin (test, "Receive MME");
+
+ cp_cl_interf_rx_mme (&cp, mfs, buffer, 1200, cl_data, true);
+
+ msg = cyg_mbox_get (cp.cl_interf.mailbox_handle);
+ test_begin (test, "Verify.")
+ {
+ test_fail_if (msg == NULL, "Message shall not be null");
+ test_fail_if (msg->buffer != buffer, "Wrong MME buffer address");
+ test_fail_if (msg->length != 1200, "Wrong MME length");
+ test_fail_if (msg->mfs != mfs, "Wrong MFS");
+ test_fail_if (msg->hard_encrypt != true, "Wrong encryption status");
+ test_fail_if (msg->cl_data != cl_data, "Wrong data_cl");
+ }
+ test_end;
+ blk_release (msg);
+ blk_release (mfs);
+ blk_release (mfs);
+
+ cp_cl_interf_uninit (&cp);
+}
+
+void
+test_case_cl_intef_process_mme (void)
+{
+ cp_t cp;
+ mfs_rx_t *mfs;
+ void *cl_data;
+ u8 buffer[2048] __attribute__((aligned(2048)));
+ u8 buffer2[2048] __attribute__((aligned(2048)));
+ bitstream_t bitstream;
+ u64 data;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ blk_t *current;
+
+ cp_cl_interf_init (&cp);
+
+ test_case_begin (test, "Process the MME : Test 1");
+
+ mfs = blk_alloc ();
+ cl_data = buffer;
+
+ bitstream_init (&bitstream, buffer, 23, BITSTREAM_WRITE);
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x3456789ABCDEull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x12;
+ bitstream_access (&bitstream, &data, 32);
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ data = 1;
+ bitstream_access (&bitstream, &data, 8);
+ data = 0x3245;
+ bitstream_access (&bitstream, &data, 16);
+ data = 0;
+ bitstream_access (&bitstream, &data, 16);
+ bitstream_finalise (&bitstream);
+
+ cp_cl_interf_rx_mme (&cp, mfs, buffer, 1200, cl_data, true);
+ cp_cl_interf_process_mme (&cp);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (dispatch_mme_rx->p_mme != buffer, "Wrong buffer address");
+ test_fail_if (dispatch_mme_rx->p_frag != NULL, "frag shall be null");
+ test_fail_if (dispatch_mme_rx->length != 1200, "Wrong length");
+ test_fail_if (dispatch_mme_rx->cl_data != cl_data, "Wrong cl_data");
+ }
+ test_end;
+ blk_release (mfs);
+ blk_release (dispatch_mme_rx);
+
+ test_case_begin (test, "Process the MME : Test 2");
+
+ cp_sta_mgr_init (&cp);
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_sta_add (&cp, net, 1, 1);
+ slab_release (sta);
+
+ mfs = blk_alloc ();
+ mfs->common.tei = 1;
+
+ bitstream_init (&bitstream, buffer, 23, BITSTREAM_WRITE);
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x3456789ABCDEull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x12;
+ bitstream_access (&bitstream, &data, 32);
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ data = 1;
+ bitstream_access (&bitstream, &data, 8);
+ data = 0x3245;
+ bitstream_access (&bitstream, &data, 16);
+ data = 1; // 2 frags.
+ bitstream_access (&bitstream, &data, 4);
+ data = 0; // 1st frag.
+ bitstream_access (&bitstream, &data, 4);
+ data = 1; // SSN.
+ bitstream_access (&bitstream, &data, 4);
+ bitstream_finalise (&bitstream);
+
+ cp_cl_interf_rx_mme (&cp, mfs, buffer, 1200, cl_data, true);
+
+ bitstream_init (&bitstream, buffer2, 23, BITSTREAM_WRITE);
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x3456789ABCDEull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x12;
+ bitstream_access (&bitstream, &data, 32);
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ data = 1;
+ bitstream_access (&bitstream, &data, 8);
+ data = 0x3245;
+ bitstream_access (&bitstream, &data, 16);
+ data = 1; // 2 frags.
+ bitstream_access (&bitstream, &data, 4);
+ data = 1; // 1st frag.
+ bitstream_access (&bitstream, &data, 4);
+ data = 1; // SSN.
+ bitstream_access (&bitstream, &data, 4);
+ bitstream_finalise (&bitstream);
+
+ cp_cl_interf_rx_mme (&cp, mfs, buffer2, 1200, cl_data, true);
+
+ cp_cl_interf_process_mme (&cp);
+ cp_cl_interf_process_mme (&cp);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (dispatch_mme_rx->p_mme != NULL , "Wrong buffer address");
+ test_fail_if (dispatch_mme_rx->p_frag == NULL,
+ "frag shall not be null");
+ test_fail_if (dispatch_mme_rx->length != 2400, "Wrong length");
+ test_fail_if (dispatch_mme_rx->cl_data != cl_data, "Wrong cl_data");
+ }
+ test_end;
+
+
+ if (dispatch_mme_rx->p_frag)
+ {
+ current = dispatch_mme_rx->p_frag;
+ dispatch_mme_rx->p_frag = dispatch_mme_rx->p_frag->next;
+ while (current)
+ {
+ blk_release_desc (current);
+ current = dispatch_mme_rx->p_frag;
+ if (dispatch_mme_rx->p_frag)
+ dispatch_mme_rx->p_frag = dispatch_mme_rx->p_frag->next;
+ }
+ }
+
+ cp_sta_mgr_uninit (&cp);
+ cp_cl_interf_uninit (&cp);
+ blk_release (dispatch_mme_rx);
+ blk_release (mfs);
+}
+
+void
+test_case_cl_interf_add_and_get_tx_buffer (void)
+{
+ cp_t cp;
+ u8 buffer[2048] __attribute__((aligned(2048)));
+ u8 *mme;
+
+ test_case_begin (test, "Get a TX buffer");
+
+ cp_cl_interf_init (&cp);
+
+ cp_cl_interf_add_buffer_tx (&cp, buffer);
+
+ mme = cp_cl_interf_get_buffer_tx (&cp);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (mme != buffer, "Buffer shall not be null");
+ }
+ test_end;
+
+ cp_cl_interf_uninit (&cp);
+}
+
+void
+test_case_cl_interf_send_mme (void)
+{
+ cp_t cp;
+ cp_mme_tx_t mme;
+ mfs_tx_t *mfs;
+ bool added;
+ cp_sta_t *sta;
+ cp_net_t *net;
+
+ cp_cl_interf_init (&cp);
+ cp.mac_store = mac_store_init ();
+ memset (&mme, 0, sizeof (cp_mme_rx_t));
+
+ mfs = mac_store_mfs_add_tx (cp.mac_store, false, true, MAC_LID_NONE, 1,
+ &added);
+ dbg_assert (added);
+
+ mme.peer.tei = 1;
+ mme.length = 1200;
+
+ cp_cl_interf_mme_send (&cp, &mme);
+
+ mac_store_mfs_remove (cp.mac_store, (mfs_t *) mfs);
+ blk_release (mfs);
+
+ dbg_check (mac_store_sta_remove (cp.mac_store, 0x1));
+ mac_store_uninit (cp.mac_store);
+ cp_cl_interf_uninit (&cp);
+
+ /** Without MFS. */
+ test_send_mme_without_mfs = true;
+ cp_cl_interf_init (&cp);
+ cp_sta_mgr_init (&cp);
+
+ /* Create the station in the station Manager to send the MME. */
+ net = cp_sta_mgr_get_our_avln (&cp);
+ sta = cp_net_sta_add (&cp, net, 0x1, 0x12345);
+
+ mme.peer.tei = 1;
+ mme.length = 1200;
+
+ cp_cl_interf_mme_send (&cp, &mme);
+
+ cp_cl_interf_uninit (&cp);
+ cp_sta_mgr_uninit (&cp);
+ blk_release (sta);
+}
+
+void
+test_cl_interf_thread_entry_point (cyg_addrword_t data)
+{
+ test_init (test, 0, NULL);
+
+ test_case_cl_interf_init ();
+ test_case_cl_interf_receive_mme ();
+ test_case_cl_intef_process_mme ();
+ test_case_cl_interf_add_and_get_tx_buffer ();
+ test_case_cl_interf_send_mme ();
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+}
+
+int
+main (void)
+{
+ cyg_thread_create (9, &test_cl_interf_thread_entry_point,
+ (cyg_addrword_t) 0,
+ "Test thread",
+ thread_stack,
+ CYGNUM_HAL_STACK_SIZE_TYPICAL,
+ &thread_handle, &thread);
+
+ cyg_thread_resume (thread_handle);
+
+ return 0;
+}
+
+/**
+ * Initialise the callbacks functions.
+ * \param ctx the interface context.
+ * \param mme_recv_cb the function to call on reception of a MME.
+ * \param buffer_add_cb the function to call on buffer reception.
+ * \param beacon_add_cb the function to call on beacon reception
+ * \param user_data the data to provide on each callback function.
+ */
+void
+interface_callback_init (interface_t *ctx, interface_mme_recv_cb_t mme_recv_cb,
+ interface_mme_buffer_add_cb_t buffer_add_cb, void *user_data)
+{
+}
+
+/** Provides a MME to send to the CL. This MME can be send as a MME or a data.
+ * \param ctx the interface context.
+ * \param buffer the buffer containing the MME.
+ * \param length the length of the MME.
+ * \param mfs the MFS to send the MME if the mme is to be sent over the PWL,
+ * otherwise this pointer is NULL.
+ */
+void
+interface_mme_send (interface_t *ctx, u8* buffer, uint length, mfs_tx_t *mfs)
+{
+ test_case_begin (test, "Send MME");
+
+ if (!test_send_mme_without_mfs)
+ {
+ test_begin (test, "verify")
+ {
+ test_fail_if (length != 1200, "Wrong length");
+ test_fail_if (mfs == NULL, "MFS shall be provided");
+ test_fail_if (mfs->common.tei != 1, "Wrong MFS TEI");
+ }
+ test_end;
+ }
+ else
+ {
+ test_begin (test, "verify")
+ {
+ test_fail_if (length != 1200, "Wrong length");
+ }
+ test_end;
+ }
+}
+
+/**
+ * Inform the Data plane when the MME as been processed by the CP.
+ * \param ctx the interface context
+ * \param mme_recv the cl data (as a void pointer).
+ */
+void
+interface_mme_recv_done (interface_t *ctx, void *mme_recv)
+{
+}
+
+/**
+ * Function to init the mme rx t messages.
+ * \param ctx the module context.
+ * \param mme the MME received.
+ * \param length the MME length.
+ * \param tei the source TEI.
+ * \return the mme rx message initialised.
+ */
+cp_mme_rx_t *
+cp_msg_mme_rx_init (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei)
+{
+ cp_mme_rx_t *mme_rx;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (length >= ETH_PACKET_MIN_SIZE
+ && length <= ETH_PACKET_MAX_SIZE);
+
+ // Allocate the MME with the slab allocator.
+ mme_rx = slab_alloc (&ctx->msg.mme_rx_slab_cache);
+
+ dbg_assert (mme_rx);
+ memset (mme_rx, 0, sizeof (cp_mme_rx_t));
+ mme_rx->p_mme = mme;
+ mme_rx->length = length;
+ mme_rx->peer.tei = tei;
+ mme_rx->cp = ctx;
+
+ return mme_rx;
+}
+
+/**
+ * Read the header of a received MME and return the MME context.
+ * \param ctx the module context.
+ * \param mme the MME received.
+ * \param length the MME length.
+ * \param tei the source TEI (0xFF if coming from the HLE).
+ * \param fmi the FMI data.
+ * \return cp_mme_rx_t object associated.
+ */
+cp_mme_rx_t *
+cp_msg_mme_read_header (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei,
+ uint *fmi)
+{
+ cp_mme_rx_t *mme_rx;
+ bool vlantag_present;
+ uint mtype;
+ uint mmv;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ if (read_u16_from_word (mme + 12) == swap16 (HPAV_MTYPE_MME))
+ vlantag_present = false;
+ else
+ vlantag_present = true;
+
+ mme_rx = cp_msg_mme_rx_init (ctx, mme, length, tei);
+
+ bitstream_init (&mme_rx->bitstream, mme + ETH_MAC_ADDRESS_SIZE,
+ length, BITSTREAM_READ);
+ bitstream_access (&mme_rx->bitstream, &mme_rx->peer.mac,
+ BYTES_SIZE_TO_BITS(ETH_MAC_ADDRESS_SIZE));
+ if (vlantag_present)
+ bitstream_access (&mme_rx->bitstream, &mme_rx->peer.vlan_tag, 32);
+ else
+ mme_rx->peer.vlan_tag = 0;
+
+ bitstream_access (&mme_rx->bitstream, &mtype, 16);
+ bitstream_access (&mme_rx->bitstream, &mmv, 8);
+ bitstream_access (&mme_rx->bitstream, &mme_rx->mmtype, 16);
+ bitstream_access (&mme_rx->bitstream, fmi, 16);
+
+ // Verify some data.
+ if ((mmv != HPAV_MMV1) || (swap16(mtype) != HPAV_MTYPE_MME))
+ {
+ slab_release (mme_rx);
+ mme_rx = NULL;
+ }
+
+ return mme_rx;
+}
+
+
+/**
+ * Examine message type and post an event to the FSM.
+ * \param ctx control plane context
+ * \param mme received MME
+ *
+ * This function looks up the message type and translates it to a FSM event,
+ * while checking the encryption is compliant with the message type.
+ *
+ * It also extracts and checks payload from encrypted messages.
+ */
+void
+cp_msg_dispatch (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dispatch_mme_rx = mme;
+}
+
diff --git a/cesar/cp/conn/Module b/cesar/cp/conn/Module
new file mode 100644
index 0000000000..82fe1608a6
--- /dev/null
+++ b/cesar/cp/conn/Module
@@ -0,0 +1 @@
+SOURCES:=conn_mgr.c conn.c link.c
diff --git a/cesar/cp/conn/conn.h b/cesar/cp/conn/conn.h
new file mode 100644
index 0000000000..dff734604d
--- /dev/null
+++ b/cesar/cp/conn/conn.h
@@ -0,0 +1,221 @@
+#ifndef cp_conn_conn_h
+#define cp_conn_conn_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp_conn.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "cp/cp.h"
+#include "cp/conn/link.h"
+
+/*
+ * Different type of a connection
+ * */
+enum cp_conn_type_t{
+ CP_CONN_TYPE_UNICAST,
+ CP_CONN_TYPE_MULTICAST,
+ CP_CONN_TYPE_BROADCAST,
+ CP_CONN_TYPE_MULTIUNICAST,
+};
+typedef enum cp_conn_type_t cp_conn_type_t;
+/*
+ * Different state of a connection
+ * */
+enum cp_conn_state_t{
+ CP_CONN_STATE_IN,
+ CP_CONN_STATE_OUT,
+ CP_CONN_STATE_ADD,
+ CP_CONN_STATE_REL_BW,
+ CP_CONN_STATE_REL_NOR,
+ CP_CONN_STATE_REL_REQ,
+ CP_CONN_STATE_REL_CSPEC,
+ CP_CONN_STATE_STAYOUT
+};
+typedef enum cp_conn_state_t cp_conn_state_t;
+
+/**
+ * Connection Specification
+ */
+struct cp_conn_cspec_t
+{
+ /** CSPEC length in octet */
+ u16 cspec_len_oct;
+
+ /** Forward CINFO */
+ cp_link_cinfo_t *f_cinfo;
+
+ /** Reverse CINFO */
+ cp_link_cinfo_t *r_cinfo;
+
+ /** Forward QMP */
+ cp_link_qmp_t *f_qmp;
+
+ /** Reverse QMP */
+ cp_link_qmp_t *r_qmp;
+
+};
+typedef struct cp_conn_cspec_t cp_conn_cspec_t;
+
+struct cp_conn_info_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** STEI */
+ u8 stei;
+
+ /** DTEI */
+ u8 dtei;
+
+ /** LID-F */
+ u8 *lid_f;
+
+ /** LID-R */
+ u8 *lid_r;
+
+ /** CSPEC */
+ cp_conn_cspec_t cspec;
+
+};
+typedef struct cp_conn_info_t cp_conn_info_t;
+
+/**
+ * Structure of a connection. Add, delete, return a link.
+ */
+struct cp_conn_t
+{
+ /** Connection Type */
+ cp_conn_type_t type;
+
+ /** Connection information */
+ cp_conn_info_t conn_info;
+
+ /** Forward link */
+ cp_link_t *flink;
+
+ /** Reverse link */
+ cp_link_t *rlink;
+
+ /** connection state */
+ cp_conn_state_t new_conn_state;
+
+ /** connection state */
+ cp_conn_state_t old_conn_state;
+
+ /** Request ID */
+ u8 request_id;
+
+ /** expiration date of the connection used by the garbadge collector */
+ u16 expiration;
+
+ /** Original Source Address */
+ mac_t osa;
+
+ /** Original Destination Address */
+ mac_t oda;
+
+ /** Violated CSPEC */
+ cp_conn_cspec_t violated_cspec;
+
+ /** Modified CSPEC */
+ cp_conn_cspec_t modified_cspec;
+
+ /** list Node conn */
+ list_node_t node;
+
+};
+typedef struct cp_conn_t cp_conn_t;
+
+/**
+ * Memory initialisation of the connection
+ * \param ctx Control Plane Context
+ * \return The connection initiated
+ *
+ */
+cp_conn_t*
+cp_conn_init_conn(cp_t *ctx);
+
+/**
+ * add a connection into the connection list
+ * \param ctx Control plane context.
+ * \param new_conn Connection to add into the list
+ *
+ */
+void
+cp_conn_add_conn(cp_t *ctx, cp_conn_t *conn);
+
+/**
+ * delete a connection from the connection list
+ * \param ctx Control Plane context.
+ * \param cid Connection identifier of the connection to delete
+ *
+ */
+void
+cp_conn_del_conn (cp_t *ctx, u16 cid);
+
+/**
+ * Give access to a connection
+ * \param ctx Control plane context.
+ * \param cid connection identifier of the targeted connection
+ * \return the target connection
+ *
+ */
+cp_conn_t*
+cp_conn_get_conn (cp_t *ctx, u16 cid);
+
+/**
+ * Modify the caracteristics of a connection
+ * \param ctx control plane context.
+ * \param modified_conn Modified connection
+ *
+ */
+void
+cp_conn_mod_conn (cp_t *ctx, cp_conn_t* modified_conn);
+
+
+/**
+ * Garbage collector
+ * \param ctx Control Plane context.
+ *
+ */
+void
+cp_conn_garbage_conn (cp_conn_t *ctx);
+
+/**
+ * Check the validity of a connection
+ * \param ctx Control plane context
+ * \param conn Connection to validate
+ * \return the result of the test
+ *
+ */
+u8
+cp_conn_check_conn_validity (cp_t *ctx, cp_conn_t* conn);
+
+/**
+ * Return a free glid
+ * \param ctx Control plane context
+ * \return A free glid
+ *
+ */
+u8
+cp_conn_get_free_glid(cp_t *ctx);
+
+/**
+ * Return a free lid
+ * \param ctx Control plane context
+ * \return A free lid
+ *
+ */
+u8
+cp_conn_get_free_llid(cp_t *ctx);
+
+#endif /* cp_conn_h */
diff --git a/cesar/cp/conn/conn_mgr.h b/cesar/cp/conn/conn_mgr.h
new file mode 100644
index 0000000000..1f9da3bbd7
--- /dev/null
+++ b/cesar/cp/conn/conn_mgr.h
@@ -0,0 +1,640 @@
+#ifndef cp_conn_conn_mgr_h
+#define cp_conn_conn_mgr_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp_conn_mgr.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "cp/mme.h"
+#include "cp/conn/conn.h"
+/**
+ * connection list manager. add, delete, return, modify and check the
+ * validity of the connections.
+ */
+struct cp_conn_mgr_t
+{
+ list_t conns;
+};
+typedef struct cp_conn_mgr_t cp_conn_mgr_t;
+
+/****************************/
+/** STUB MME definitions **/
+/****************************/
+
+/****************************/
+/** CONN NEW **/
+/****************************/
+
+struct cp_msg_cm_conn_new_req_t
+{
+
+ /** Connection identifier*/
+ u16 cid;
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+
+ /** Classifier rule set */
+ //cp_classifier_rule_set_t *classifier;
+
+};
+typedef struct cp_msg_cm_conn_new_req_t cp_msg_cm_conn_new_req_t;
+
+/**
+ * Structure of a MME cm_conn_new_cnf
+ */
+struct cp_msg_cm_conn_new_cnf_t
+{
+
+ /** Connection identifier */
+ u16 cid;
+
+ /** Local reverse link id */
+ u8 llid_r;
+
+ /** Result */
+ u8 result;
+
+ /** Proposed CSPEC */
+ cp_conn_cspec_t *proposed_cspec;
+
+};
+typedef struct cp_msg_cm_conn_new_cnf_t cp_msg_cm_conn_new_cnf_t;
+
+
+/****************************/
+/** CONN REL **/
+/****************************/
+
+struct cp_msg_cm_conn_rel_ind_t
+{
+
+ /** Connection identifier */
+ u16 cid;
+
+ /** Reason code */
+ u8 reason_code;
+
+ /** Violated CSPEC */
+ cp_conn_cspec_t *violated_cspec;
+
+};
+typedef struct cp_msg_cm_conn_rel_ind_t cp_msg_cm_conn_rel_ind_t;
+
+
+struct cp_msg_cm_conn_rel_rsp_t
+{
+ /** Connection identifier */
+ u16 cid;
+};
+typedef struct cp_msg_cm_conn_rel_rsp_t cp_msg_cm_conn_rel_rsp_t;
+
+
+/****************************/
+/** CONN MOD **/
+/****************************/
+
+struct cp_msg_cm_conn_mod_req_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Modified CSPEC */
+ cp_conn_cspec_t *modified_cspec;
+};
+typedef struct cp_msg_cm_conn_mod_req_t cp_msg_cm_conn_mod_req_t;
+
+struct cp_msg_cm_conn_mod_cnf_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Result */
+ u8 result;
+
+ /** Proposed CSPEC */
+ cp_conn_cspec_t *proposed_cspec;
+
+};
+typedef struct cp_msg_cm_conn_mod_cnf_t cp_msg_cm_conn_mod_cnf_t;
+
+/****************************/
+/** CONN INFO **/
+/****************************/
+struct cp_msg_cm_conn_info_req_t
+{
+ /** Request type */
+ u8 req_type;
+
+ /** Connection identifier */
+ u16 cid;
+
+ /** GLID */
+ u8 glid;
+};
+typedef struct cp_msg_cm_conn_info_req_t cp_msg_cm_conn_info_req_t;
+
+struct cp_msg_cm_conn_info_cnf_t
+{
+ /** Number of Connection */
+ u8 nb_conn;
+
+ /** Connection information */
+ cp_conn_info_t **conn_info;
+};
+typedef struct cp_msg_cm_conn_info_cnf_t cp_msg_cm_conn_info_cnf_t;
+
+/****************************/
+/** CONN APCM **/
+/****************************/
+struct cp_msg_apcm_conn_add_req_t
+{
+ /** Original source address */
+ mac_t osa;
+
+ /** Destination source address */
+ mac_t oda;
+
+ /** Request ID */
+ u8 request_id;
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+
+ /** Classifier rule set */
+ //cp_classifier_rule_set_t *classifier;
+};
+typedef struct cp_msg_apcm_conn_add_req_t cp_msg_apcm_conn_add_req_t;
+
+struct cp_msg_apcm_conn_add_cnf_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Original source address */
+ mac_t osa;
+
+ /** Destination source address */
+ mac_t oda;
+
+ /** Result */
+ u8 result;
+
+ /** Request ID */
+ u8 request_id;
+
+ /** Proposed CSPEC */
+ cp_conn_cspec_t *proposed_cspec;
+};
+typedef struct cp_msg_apcm_conn_add_cnf_t cp_msg_apcm_conn_add_cnf_t;
+
+struct cp_msg_apcm_conn_add_ind_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Init MAC address */
+ mac_t osa;
+
+ /** Term MAC address */
+ mac_t oda;
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_apcm_conn_add_ind_t cp_msg_apcm_conn_add_ind_t;
+
+struct cp_msg_apcm_conn_add_rsp_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Result */
+ u8 result;
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_apcm_conn_add_rsp_t cp_msg_apcm_conn_add_rsp_t;
+
+struct cp_msg_apcm_conn_rel_req_t
+{
+ /** Connection identifier */
+ u16 cid;
+};
+typedef struct cp_msg_apcm_conn_rel_req_t cp_msg_apcm_conn_rel_req_t;
+
+struct cp_msg_apcm_conn_rel_cnf_t
+{
+ /** Connection identifier */
+ u16 cid;
+};
+typedef struct cp_msg_apcm_conn_rel_cnf_t cp_msg_apcm_conn_rel_cnf_t;
+
+struct cp_msg_apcm_conn_rel_ind_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Reason code*/
+ u8 reason_code;
+
+ /** Realising STA MAC Address*/
+ mac_t releasing_mac_add;
+
+ /** Proposed CSPEC */
+ cp_conn_cspec_t *proposed_cspec;
+
+ /** Violated CSPEC */
+ cp_conn_cspec_t *violated_cspec;
+};
+typedef struct cp_msg_apcm_conn_rel_ind_t cp_msg_apcm_conn_rel_ind_t;
+
+/**
+ * Structure of a MME apcm_conn_mod_req
+ */
+struct cp_msg_apcm_conn_mod_req_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** CSPEC */
+ cp_conn_cspec_t *cspec;
+};
+typedef struct cp_msg_apcm_conn_mod_req_t cp_msg_apcm_conn_mod_req_t;
+
+/**
+ * Structure of a MME apcm_conn_mod.cnf
+ */
+struct cp_msg_apcm_conn_mod_cnf_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Result */
+ u8 result;
+
+ /** proposed CSPEC */
+ cp_conn_cspec_t *proposed_cspec;
+};
+typedef struct cp_msg_apcm_conn_mod_cnf_t cp_msg_apcm_conn_mod_cnf_t;
+
+/**
+ * Structure of a MME apcm_conn_mod.ind
+ */
+struct cp_msg_apcm_conn_mod_ind_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** modified CSPEC */
+ cp_conn_cspec_t *modified_cspec;
+
+ /** Cause */
+ u8 cause;
+};
+typedef struct cp_msg_apcm_conn_mod_ind_t cp_msg_apcm_conn_mod_ind_t;
+
+/**
+ * Structure of a MME apcm_conn_mod.rsp
+ */
+struct cp_msg_apcm_conn_mod_rsp_t
+{
+ /** Connection identifier */
+ u16 cid;
+
+ /** Result */
+ u8 result;
+
+ /** proposed CSPEC */
+ cp_conn_cspec_t *proposed_cspec;
+};
+typedef struct cp_msg_apcm_conn_mod_rsp_t cp_msg_apcm_conn_mod_rsp_t;
+
+/**
+ * Process a CM_CONN_NEW_REQ MME
+ * \param ctx Control Plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_cm_conn_new_req(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_CONN_NEW_CNF MME
+ * \param ctx Control Plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_cm_conn_new_cnf(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_CONN_REL_IND MME
+ * \param ctx Control Plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_cm_conn_rel_ind(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_CONN_REL_RSP MME
+ * \param ctx Control Plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_cm_conn_rel_rsp(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_CONN_MOD_REQ MME
+ * \param ctx Control Plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_cm_conn_mod_req(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_CONN_MOD_CNF MME
+ * \param ctx Control Plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_cm_conn_mod_cnf(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_CONN_INFO_REQ MME
+ * \param ctx Control Plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_cm_conn_info_req(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_CONN_INFO_CNF MME
+ * \param ctx Control Plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_cm_conn_info_cnf(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a APCM_CONN_ADD.REQ
+ * \param ctx control plane context
+ * \param mme incoming MME
+ *
+ * It gets the CSPEC the destination STA and send the request to this STA
+ * It stores the request ID for this connection
+ *
+ */
+void
+cp_conn_mgr_process_apcm_conn_add_req(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a APCM_CONN_ADD.RSP
+ * \param ctx control plane context
+ * \param mme incoming MME
+ *
+ * It gets the response of the connection request. It shall send the respond
+ * to the originating STA with the result.
+ *
+ */
+void
+cp_conn_mgr_process_apcm_conn_add_rsp(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a APCM_CONN_MOD.REQ
+ * \param ctx control plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_apcm_conn_mod_req(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a APCM_CONN_MOD.RSP
+ * \param ctx control plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_apcm_conn_mod_rsp(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a APCM_CONN_REL.REQ
+ * \param ctx control plane context
+ * \param mme incoming MME
+ *
+ */
+void
+cp_conn_mgr_process_apcm_conn_rel_req(cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CC_LINK_SQZ.
+ * \param ctx Control Plane Context.
+ * \param mme Incoming mme
+ *
+ * Check the validity of the request Modify the connection's data
+ * Call the schedule function Check if the connection is still allocated
+ * Send the CNF with the result
+ */
+void
+cp_conn_mgr_process_cc_link_sqz_req_rx (cp_t* ctx, cp_mme_rx_t* mme);
+void
+cp_conn_mgr_process_cc_link_sqz_cnf_rx (cp_t* ctx, cp_mme_rx_t* mme);
+
+
+/**
+ * init function of the connection manager
+ * \param ctx Control palne context
+ *
+ * init the list of conns
+ */
+void
+cp_conn_mgr_init(cp_t *ctx);
+
+/**
+ * uninit function of the connection manager
+ * \param ctx Control plane context
+ *
+ * calls the uninit function of the conns to free the memory taken by the
+ * conns
+ */
+void
+cp_conn_mgr_uninit(cp_t *ctx);
+
+
+/*************************/
+/*** CONN NEW ***/
+/*************************/
+
+void
+cp_msg_cm_conn_new_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_new_req_t *data);
+
+bool
+cp_msg_cm_conn_new_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_req_t *data);
+
+void
+cp_msg_cm_conn_new_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_new_cnf_t *data);
+
+bool
+cp_msg_cm_conn_new_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_cnf_t *data);
+
+/*************************/
+/*** CONN REL ***/
+/*************************/
+
+void
+cp_msg_cm_conn_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_rel_ind_t *data);
+
+bool
+cp_msg_cm_conn_rel_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_rel_ind_t *data);
+
+void
+cp_msg_cm_conn_rel_rsp_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_rel_rsp_t *data);
+
+bool
+cp_msg_cm_conn_rel_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_rel_rsp_t *data);
+
+/*************************/
+/*** CONN MOD ***/
+/*************************/
+
+void
+cp_msg_cm_conn_mod_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_mod_req_t *data);
+
+bool
+cp_msg_cm_conn_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_mod_req_t *data);
+
+void
+cp_msg_cm_conn_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_mod_cnf_t *data);
+
+bool
+cp_msg_cm_conn_mod_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_mod_cnf_t *data);
+
+/*************************/
+/*** CONN INFO ***/
+/*************************/
+void
+cp_msg_cm_conn_info_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_info_req_t *data);
+
+bool
+cp_msg_cm_conn_info_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_info_req_t *data);
+void
+cp_msg_cm_conn_info_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_info_cnf_t *data);
+bool
+cp_msg_cm_conn_info_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_info_cnf_t *data);
+/*************************/
+/*** APCM Family ***/
+/*************************/
+
+/*************************/
+/*** APCM CONN ADD ***/
+/*************************/
+
+bool
+cp_msg_apcm_conn_add_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_req_t *data);
+void
+cp_msg_apcm_conn_add_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_add_cnf_t *data);
+
+void
+cp_msg_apcm_conn_add_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_add_ind_t *data);
+
+bool
+cp_msg_apcm_conn_add_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_rsp_t *data);
+/*************************/
+/*** APCM CONN REL ***/
+/*************************/
+
+bool
+cp_msg_apcm_conn_rel_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_rel_req_t *data);
+
+void
+cp_msg_apcm_conn_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_rel_ind_t *data);
+
+void
+cp_msg_apcm_conn_rel_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_rel_cnf_t *data);
+/*************************/
+/*** APCM CONN MOD ***/
+/*************************/
+bool
+cp_msg_apcm_conn_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_mod_req_t *data);
+
+void
+cp_msg_apcm_conn_mod_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_mod_ind_t *data);
+
+bool
+cp_msg_apcm_conn_mod_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_mod_rsp_t *data);
+
+void
+cp_msg_apcm_conn_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_mod_cnf_t *data);
+
+#endif /* cp_conn_mgr_h */
diff --git a/cesar/cp/conn/doc/conn.odt b/cesar/cp/conn/doc/conn.odt
new file mode 100644
index 0000000000..174b9ee906
--- /dev/null
+++ b/cesar/cp/conn/doc/conn.odt
Binary files differ
diff --git a/cesar/cp/conn/doc/conn.xmi b/cesar/cp/conn/doc/conn.xmi
new file mode 100644
index 0000000000..ab2d613c15
--- /dev/null
+++ b/cesar/cp/conn/doc/conn.xmi
@@ -0,0 +1,1285 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-08-06T11:34:17" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="UML Model" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="MSG Module" isRoot="false" isAbstract="false" name="MSG Module" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="CCo Action Module" isRoot="false" isAbstract="false" name="CCo Action Module" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Bandwidth Manager Module" isRoot="false" isAbstract="false" name="Bandwidth Manager Module" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OqFNT55UVzVU" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0widC5QuvWxy" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="irUbdfzRtLuy" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OMTNsx2stiV3" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="luyeQvc8m5hN" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="kfod0hZO32mt" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xmmoTFsE9otX" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="jTfTYNoH0asy" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="HSMJS6CQrwCI" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="C4WJsNrZpU0N" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pocpPVnex8xP" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" comment="Start Time" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="huvuRoPtpoED" isRoot="false" isAbstract="false" name="cp_st_t" />
+ <UML:DataType stereotype="datatype" comment="End Time" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TJR8rTv6HJGr" isRoot="false" isAbstract="false" name="cp_et_t" />
+ <UML:DataType stereotype="datatype" comment="Connection Specification" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZCvyT3nV6461" isRoot="false" isAbstract="false" name="cp_cspec_t*" />
+ <UML:DataType stereotype="datatype" comment="Connection information" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BlOcERrdVcJi" isRoot="false" isAbstract="false" name="cp_cinfo_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nKah2FElYQjf" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" comment="Connection " isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qpL5yhMnv5m5" isRoot="false" isAbstract="false" name="cp_conn_t*" />
+ <UML:DataType stereotype="datatype" comment="Control Plane Context" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3Xrk8GDGycgY" isRoot="false" isAbstract="false" name="cp_t*" />
+ <UML:DataType stereotype="datatype" comment="connection allocation" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="M6xKR1cFPIwW" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_alloc_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" comment="Received MME" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="iSF0bbc1ufLz" isRoot="false" isAbstract="false" name="cp_mme_rx_t*" />
+ <UML:DataType stereotype="datatype" comment="Sending MME" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="rXf3L5yLNrBT" isRoot="false" isAbstract="false" name="cp_mme_tx_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="9kqqNN6qIMaD" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" comment="heap of connection of a specific priority stored regarding their time arrival" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="S1gNUo1cYqQt" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_prio_heap_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="D9PiHaAGBCIb" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qx03D9bX8Zse" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eoUNxGuvIuwA" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_conn_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LMD9GuDpzhxX" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_conn_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" comment="interval of a BLE (time and BLE)" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="l4plA4WjZ5hz" isRoot="false" isAbstract="false" name="cp_ble_interval_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="28emhDJMNjju" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CAMwXARcOr2q" isRoot="false" isAbstract="false" name="cp_cspec_field_status_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0FkJo3kMVDSV" isRoot="false" isAbstract="false" name="cp_link_t*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="d21ZFkuCFK5X" isRoot="false" isAbstract="false" name="cp_link_cinfo_t*" elementReference="nKah2FElYQjf" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="y93NOeEZLD5e" isRoot="false" isAbstract="false" name="cp_link_qmp_t*" elementReference="3QNGiQmMsrXJ" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Z3fT7dhQPy4n" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="0EqeVSEBGbkp" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4DKXUSga3kTG" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="HtfvGG8l8Yj7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="rvCm6ua58Rhb" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="tvn7WXvYiF6C" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="3SUL0HC3J5nD" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="hkkiUBzJ7B4B" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6eGC3xourZ2L" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="2lGX5o190Fyn" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4xumAywpigYA" aggregation="composite" type="xnGQ9ti6LKXZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="sVTzgVAkAPvD" aggregation="none" type="akTdL0BuuMIi" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="mtZJnRKOO7ZU" isRoot="false" isAbstract="false" name="cp_conn_state_t" >
+ <UML:EnumerationLiteral comment="Connection actualy scheduled" isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="OX2HniyXbXoO" isRoot="false" isAbstract="false" name="IN" />
+ <UML:EnumerationLiteral comment="connection just added to the schedule a MME to confirm its presence into the schedule is needed." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="neVJeoamoZ5F" isRoot="false" isAbstract="false" name="ADD" />
+ <UML:EnumerationLiteral comment="Connection out of the schedule. This connection has to be cleared form the list." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="cqyEfU3313Im" isRoot="false" isAbstract="false" name="OUT" />
+ <UML:EnumerationLiteral comment="Connection just released normaly." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="loGfKRYwIW8x" isRoot="false" isAbstract="false" name="REL_NOR" />
+ <UML:EnumerationLiteral comment="Connection just released because of lack of Bandwidth space. " isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="80zKS1hCpxp7" isRoot="false" isAbstract="false" name="REL_BW" />
+ <UML:EnumerationLiteral comment="Connection just released because of connection specification pbs." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="eDMziEWTrzlV" isRoot="false" isAbstract="false" name="REL_CSPEC" />
+ <UML:EnumerationLiteral comment="Connection just released because it requested it." isSpecification="false" isLeaf="false" visibility="public" namespace="mtZJnRKOO7ZU" xmi.id="zRZGwOSgcWwz" isRoot="false" isAbstract="false" name="REL_REQ" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="t1BwC0faIOY6" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Ly21eYBU3cTi" aggregation="aggregate" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="8cQGzLRJ2XVI" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="X4PpSxvCxRZk" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="f0YiPatkWwjB" aggregation="aggregate" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="SufWU7Cahcog" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="vFMsgta757Na" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yGz0lUHPSp7r" aggregation="aggregate" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="OzZutI3LAjpd" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="K35NPMr9taR3" isRoot="false" isAbstract="false" name="Classes" >
+ <UML:Namespace.ownedElement>
+ <UML:Class comment="Allocation of a connection" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="akTdL0BuuMIi" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Start Time of the allocation" isSpecification="false" visibility="public" xmi.id="WHgpgU3HDWsW" type="huvuRoPtpoED" name="st" />
+ <UML:Attribute comment="End Time of the allocation" isSpecification="false" visibility="public" xmi.id="2pv02ohjicc7" type="TJR8rTv6HJGr" name="et" />
+ <UML:Attribute comment="Pointer on the previous allocation" isSpecification="false" visibility="public" xmi.id="6CEonouBntNY" type="M6xKR1cFPIwW" name="prev_conn" />
+ <UML:Attribute comment="Pointer on the next allocation" isSpecification="false" visibility="public" xmi.id="6lmba4wqHNOl" type="M6xKR1cFPIwW" name="next_conn" />
+ <UML:Attribute comment="Persistence of the allocation. Value not defined yet (maybe regarding to the priority)" isSpecification="false" visibility="public" xmi.id="KtVJ3RkxxT7e" type="nKah2FElYQjf" name="presistence" />
+ <UML:Attribute comment="Start time persistent flag" isSpecification="false" visibility="public" xmi.id="dkbxTW5FavZS" type="irUbdfzRtLuy" name="stpf" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="jUHoqZsuISuy" type="9kqqNN6qIMaD" name="glid" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="9UW3dNtE8T9Z" type="qx03D9bX8Zse" name="cid" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="mVY4wQ05uW6V" type="9kqqNN6qIMaD" name="duration_persistence" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="rzhzQqWM5KrC" type="fn3T0g7mCdo8" name="node" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="3oBvIFO8C57d" type="vez0woDacG3c" name="set_node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="Bandwidth Manager Module" comment="Bandwidth Manager Module.
+- Create the schedule
+- Allocate a specific connection
+- finalise and return a schedule (used by the Beacon module only)" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="xnGQ9ti6LKXZ" isRoot="false" isAbstract="false" name="cp_cco_bw_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The actual schedule is the one is motion during the beacon period. It receives modifications regarding on the incoming MMEs. " isSpecification="false" visibility="public" xmi.id="8SVuiaBMFxkG" type="LMD9GuDpzhxX" name="actual_schedule" />
+ <UML:Attribute comment="the finalised schedule is the schedule final given to the Beacon module to be transformed into BENTRYs." isSpecification="false" visibility="public" xmi.id="IvjtyxL96U0O" type="LMD9GuDpzhxX" name="finalised_schedule" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="bMccUjua3QRe" type="tOgMBBDlVoLx" name="prio_heap[CP_CCO_BW_NB_PRIORITY_HEAPS]" />
+ <UML:Attribute comment="Number of persistent allocation in the actual schedule" isSpecification="false" visibility="private" xmi.id="qqpCp7AgWp2f" type="qx03D9bX8Zse" name="nb_alloc_pers_actual" />
+ <UML:Attribute comment="umber of non persistent alloaction in the actual schedule" isSpecification="false" visibility="private" xmi.id="yEOT2jRXwz6c" type="qx03D9bX8Zse" name="nb_alloc_no_pers_actual" />
+ <UML:Attribute comment="Number of persistent allocation in the finalised schedule" isSpecification="false" visibility="private" xmi.id="wHXJuWtlMix9" type="qx03D9bX8Zse" name="nb_alloc_pers_finalised" />
+ <UML:Attribute comment="Number of non persistent alloaction in the finalised schedule" isSpecification="false" visibility="private" xmi.id="o5qKsqxq4MK4" type="qx03D9bX8Zse" name="nb_alloc_no_pers_finalised" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="kZlArwfzKyf6" isRoot="false" isAbstract="false" isQuery="false" name="new_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZMv7zjxAvhNM" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocate a complete Schedule
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="O87gKQtsw1DR" isRoot="false" isAbstract="false" isQuery="false" name="alloc_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="6RTqCXJl2bsz" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocates a unique connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="6r5JBb3UvGb7" isRoot="false" isAbstract="false" isQuery="false" name="alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VpAthpuJcZuj" type="irUbdfzRtLuy" />
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="6m22OgadlX6q" value="" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="SjnLGAlGZvwN" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="8VFn5SRIJtio" isRoot="false" isAbstract="false" isQuery="false" name="finalise_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="X8GAwAWf7KHR" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="uninit the bandwidth manager allocations" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CX7QmGnNQfyu" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Finalise and return the schedule. Fills the free fields with bonus allocation if there is not enough time for CSMA. Otherwise it fills with CSMA." isSpecification="false" isLeaf="false" visibility="public" xmi.id="N8I7BjZIOdlW" isRoot="false" isAbstract="false" isQuery="false" name="get_next_alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="" type="LMD9GuDpzhxX" />
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="2RCfo71rfqbl" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4bO4EM12qaue" value="" type="LMD9GuDpzhxX" name="prev_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Init of the BW manager" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qDTUjKdqN9vB" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="rztSWU4nfOxL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="VNZrMxhseKAs" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LhtoKuOr2e0y" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Clears the connections passing the new states to old and initiating the new to OUT state
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="REvc418qnVEv" isRoot="false" isAbstract="false" isQuery="false" name="clear_conn_state" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3WKGgYni79mL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WlMKMGxlUqNX" isRoot="false" isAbstract="false" isQuery="false" name="set_next_free_time_space
+" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="eMmXZjl1djyO" type="irUbdfzRtLuy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sTLfzZY03sGh" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Uu0wkMRapmDm" value="" type="O1PWAArevDzF" name="prev_alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LlkPcy60zUW8" value="" type="O1PWAArevDzF" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="5NytACfVvOsX" isRoot="false" isAbstract="false" isQuery="false" name="uninit_actual_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MxWKR0S3MCYu" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="2dqv1jTNexf5" isRoot="false" isAbstract="false" isQuery="false" name="get_nb_alloc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vh1AX1VZcLUd" type="qx03D9bX8Zse" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="x76IKcCEw5lx" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Allocate at the beginning of the beacon period
+" isSpecification="false" isLeaf="false" visibility="public" xmi.id="2vygqejoln43" isRoot="false" isAbstract="false" isQuery="false" name="alloc_beginning" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QEHKJ3HEiGMF" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5ZkoNosn277K" value="" type="qx03D9bX8Zse" name="duration" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8MYqct3sinht" value="" type="9kqqNN6qIMaD" name="glid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="release the finalised schedule when it has been used (triggered by the Beacon module)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="29Uw34J8wOf4" isRoot="false" isAbstract="false" isQuery="false" name="release_sched" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GbMzYAgg33TV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initiate the last ble and checks if the end of the free time has been reached." isSpecification="false" isLeaf="false" visibility="private" xmi.id="42UyQ92giMdG" isRoot="false" isAbstract="false" isQuery="false" name="get_alloc_ble" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZrY2nqzsglS3" type="irUbdfzRtLuy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DYfFa9DyHDdz" value="" type="JO1FHqi41DrK" name="first_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XEG2U9YoXX3m" value="" type="JO1FHqi41DrK" name="last_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NloMydf9BKMj" value="" type="qx03D9bX8Zse" name="nb_pb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5slaPoMkX84U" value="" type="TZfikGiIVwKz" name="alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lhdw1ydTVIBG" value="" type="TZfikGiIVwKz" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Calculate the best allocation time between 2 BLE" isSpecification="false" isLeaf="false" visibility="private" xmi.id="Xml5upZdXAZW" isRoot="false" isAbstract="false" isQuery="false" name="calculation_of_alloc_time" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8AzeT9s00O2m" value="" type="JO1FHqi41DrK" name="first_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ezeuk5xIpiLi" value="" type="JO1FHqi41DrK" name="last_ble" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VuL02tV93UnW" value="" type="qx03D9bX8Zse" name="nb_pb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="34UrkpZDhuEk" value="" type="bfUc1UOFU09C" name="alloc_st" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="njtpBeJnHoNI" value="" type="bfUc1UOFU09C" name="alloc_et" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="D9bu1ncnWTcg" value="" type="TZfikGiIVwKz" name="alloc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5vRMhocyV7gC" value="" type="TZfikGiIVwKz" name="next_alloc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="CCo Action Module" comment="- Functions reacting to incoming MME related to global connection.
+- Treatment of those MME
+- Storage and validation of the global connections
+- Control of the Bandwidth Manager's actions
+- React to the connections' states to send IND or CNF MME
+" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="ySeTGJOMEmYM" isRoot="false" isAbstract="false" name="cp_cco_action_t" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="he8aiM3PdmBs" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Operation comment="Function called after any allocation (complete schedule or single connection allocation)
+Study the state of the connections and send the MME related to those states.
+After sending those MMEs it clears the status.
+" isSpecification="false" isLeaf="false" visibility="private" xmi.id="QNnsMczV4BbV" isRoot="false" isAbstract="false" isQuery="false" name="mme_glink_send" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="Mwcl7hCpINk2" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_NEW.REQ
+
+Check the validity of the connection.
+Add the connection into the list of connections and the pending allocation list
+Call the bandwidth manager to redo the schedule
+Call cp_cco_action_mme_conn_cnf()" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4Jl61qfG7FdR" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_new_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="JQWhk2qSS5T3" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="XgvJotVBjB3x" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_REL.REQ
+
+Release the connection from the connections list and the pending allocation list
+Send the MME that will release the connection
+Call the bandwidth manager to redo the schedule " isSpecification="false" isLeaf="false" visibility="public" xmi.id="kWAzj2FfLSzz" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_rel_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="Ysh6LPKcpqHZ" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="MfPA26ZPsMEE" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_LINK_MOD.REQ
+
+Check the validity of the modifications
+Modify the connection's data
+Call the schedule function
+Check if the connection is still in the schedule
+Send the MME CNF with the result" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7f6S84QwyS5a" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="twxoZyefgG9F" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming mme" isSpecification="false" visibility="private" xmi.id="Js8VgHGBvBVj" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process a CC_ALLOC_MOVE.REQ
+
+Check the validity of the connection.
+Memorise the position of the allocation
+Call the function that can allocate a unique connection.
+If it has allocated it somewhere else we delete the old allocation
+if not we keep the old allocation
+Send the MME CNF with the result
+Add the connection into the list of connections and the pending allocation list
+Call the bandwidth manager to redo the schedule
+Call cp_cco_action_mme_conn_cnf()" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VChtJRri78Bp" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_alloc_move_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="K8VzP5bG2Y5Z" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WjCAzMPBDokO" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Process of a CC_BLE_UPDATE.IND. Actualisation of the BLE of a specific GLID. Call the Bandwidth Manager to redo the schedule." isSpecification="false" isLeaf="false" visibility="public" xmi.id="seYRAqbe0Jvw" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_ble_update_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="control plane context" isSpecification="false" visibility="private" xmi.id="e4ZuZ9iDlUSB" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter comment="Incoming MME" isSpecification="false" visibility="private" xmi.id="7C9DGhT6JzVU" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Init function of the CCo" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DNsf89jKgseb" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Control Plane Context" isSpecification="false" visibility="private" xmi.id="d9I6Xsav4TQb" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Uninit the cco action module (call the uninit function of lower ctx)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tR7lNfHrBJvJ" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Structure of a link." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Dd5IhQuqhODL" isRoot="false" isAbstract="false" name="cp_link_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="RP4g6QESrIGR" type="nKah2FElYQjf" name="status" />
+ <UML:Attribute comment="global link identifier" isSpecification="false" visibility="public" xmi.id="R4lfEOk34S06" type="9kqqNN6qIMaD" name="llid" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="sQEhgV9JJ0Rv" type="9kqqNN6qIMaD" name="glid" />
+ <UML:Attribute comment="connection information" isSpecification="false" visibility="public" xmi.id="y3j2Tj7pa9ls" type="BlOcERrdVcJi" name="cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="naiC13Fgjvwp" type="y93NOeEZLD5e" name="qmp" />
+ <UML:Attribute comment="forward BLE" isSpecification="false" visibility="public" xmi.id="2IFWtWCrXvs0" type="hQ7UEYOzATqF" name="list_ble" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="FMPxocle20Jj" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TS2kQReD1MO2" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ndi6WcvlwJhi" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tQKvOecr4caV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Table that stores the pending connection in order of arrival.
+Each table has a specific priority level assigned (0 to 3).
+It manages the order and return the most prior connection" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="pEl1C68UjFRR" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_heap_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="level of priority of the heap (4 different levels)" isSpecification="false" visibility="public" xmi.id="ooF6vpsKuOw1" type="9kqqNN6qIMaD" name="table_priority_level" />
+ <UML:Attribute comment="first connection of the heap" isSpecification="false" visibility="public" xmi.id="BoTNcsVT3vk5" type="hQ7UEYOzATqF" name="conns" />
+ <UML:Attribute comment="stage of the allocation. Faster to get to the next connection to allocate." isSpecification="false" visibility="public" xmi.id="AhBRVaG2kt6W" type="D9PiHaAGBCIb" name="nb_conn_allocated" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="vlplg1EMIh54" type="D9PiHaAGBCIb" name="nb_conn" />
+ <UML:Operation comment="gets the most prior pending connection return its CID" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BuYs8zIb3uMF" isRoot="false" isAbstract="false" isQuery="false" name="get_most_prior_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qSDgfvHVlaaj" type="9kqqNN6qIMaD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="delete a connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ArL3GjV2Yl6R" isRoot="false" isAbstract="false" isQuery="false" name="del_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="pjWQWF5WMF9W" value="" type="9kqqNN6qIMaD" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="add a connection" isSpecification="false" isLeaf="false" visibility="public" xmi.id="YyjQMfR7LmP8" isRoot="false" isAbstract="false" isQuery="false" name="add_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Connection identifier" isSpecification="false" visibility="private" xmi.id="p5JBnSFxHYyV" value="" type="9kqqNN6qIMaD" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Clears the status of the allocation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="FG15yw3gMB8Z" isRoot="false" isAbstract="false" isQuery="false" name="clear_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hWWrzM6s8tcm" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="uq9DVEHiSGoP" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Cr3X0B4hgaZd" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="udW0X6nRwucP" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6r5Z8twIjzph" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="connection storage regarding to its priority and time arrival." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="niNHo3iBMi93" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_conn_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="connection identifier
+" isSpecification="false" visibility="public" xmi.id="kC9bWRewTRAy" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="me7r6SxasvES" type="irUbdfzRtLuy" name="alloc_status" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="iHTllYAzskuy" type="fn3T0g7mCdo8" name="node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Connection Specification" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="d8mKKcTJhtMZ" isRoot="false" isAbstract="false" name="cp_link_qmp_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Delay Bound" isSpecification="false" visibility="public" xmi.id="gTg5YO0BUnWp" type="D9PiHaAGBCIb" name="delay" />
+ <UML:Attribute comment="jitter bound" isSpecification="false" visibility="public" xmi.id="Px64qTbAFKMM" type="D9PiHaAGBCIb" name="jitter" />
+ <UML:Attribute comment="Average MPDU size" isSpecification="false" visibility="public" xmi.id="hmYsthba8Gdh" type="qx03D9bX8Zse" name="av_MPDU_size" />
+ <UML:Attribute comment="Maximum MPDU size" isSpecification="false" visibility="public" xmi.id="eds9OOwnK2pA" type="qx03D9bX8Zse" name="max_MPDU_size" />
+ <UML:Attribute comment="Average data rate" isSpecification="false" visibility="public" xmi.id="TRLilh2QRZHL" type="qx03D9bX8Zse" name="av_data_rate" />
+ <UML:Attribute comment="Minimum data rate" isSpecification="false" visibility="public" xmi.id="nR9txDa68QcP" type="qx03D9bX8Zse" name="min_data_rate" />
+ <UML:Attribute comment="Maximum data rate" isSpecification="false" visibility="public" xmi.id="Cw0z3lDbs9ub" type="qx03D9bX8Zse" name="max_data_rate" />
+ <UML:Attribute comment="Maximum inter-TXOP time" isSpecification="false" visibility="public" xmi.id="8ZogWKRHjaAg" type="qx03D9bX8Zse" name="max_inter_TXOP" />
+ <UML:Attribute comment="Minimum inter TXOP time" isSpecification="false" visibility="public" xmi.id="mlls9LFKFFJI" type="qx03D9bX8Zse" name="min_inter_TXOP" />
+ <UML:Attribute comment="Maximum burst time" isSpecification="false" visibility="public" xmi.id="0UtqdlSmLEQp" type="qx03D9bX8Zse" name="max_burst" />
+ <UML:Attribute comment="Exception Policy" isSpecification="false" visibility="public" xmi.id="Xp6GQEvAxe07" type="9kqqNN6qIMaD" name="exception" />
+ <UML:Attribute comment="Inatictivity interval" isSpecification="false" visibility="public" xmi.id="zFRFUiXUCPJp" type="D9PiHaAGBCIb" name="inactivity" />
+ <UML:Attribute comment="MSDU error rate" isSpecification="false" visibility="public" xmi.id="AlZTxyIUnMlB" type="qx03D9bX8Zse" name="MSDU_error_rate" />
+ <UML:Attribute comment="Convergence Layer SAP Type" isSpecification="false" visibility="public" xmi.id="ZeJWIJbFY2U0" type="9kqqNN6qIMaD" name="CLST" />
+ <UML:Attribute comment="ATS tolerance" isSpecification="false" visibility="public" xmi.id="i0TuNmiXVFzS" type="qx03D9bX8Zse" name="ATS" />
+ <UML:Attribute comment="Smallest Tolerable Average Data rate" isSpecification="false" visibility="public" xmi.id="DHxzcgABIUha" type="qx03D9bX8Zse" name="min_tol_data" />
+ <UML:Attribute comment="Original average Data rate" isSpecification="false" visibility="public" xmi.id="nHpKJIK2Gnub" type="qx03D9bX8Zse" name="ori_av_data_rate" />
+ <UML:Attribute comment="RX window size" isSpecification="false" visibility="public" xmi.id="Xa82q7T1NOyx" type="qx03D9bX8Zse" name="rx_window" />
+ <UML:Attribute comment="Smoothing buffer size" isSpecification="false" visibility="public" xmi.id="498MbnuM4hgM" type="D9PiHaAGBCIb" name="smoothing:24" />
+ <UML:Attribute comment="Bidirectional burst" isSpecification="false" visibility="public" xmi.id="xzMBkEmIptId" type="9kqqNN6qIMaD" name="bidir_burst" />
+ <UML:Attribute comment="Number of TXOPs per beacon" isSpecification="false" visibility="public" xmi.id="ylcJ9bGBiMVJ" type="9kqqNN6qIMaD" name="nb_TXOP" />
+ <UML:Attribute comment="Average number of PBs per TXOP" isSpecification="false" visibility="public" xmi.id="8NdA5IU0HqCz" type="qx03D9bX8Zse" name="av_nb_pb" />
+ <UML:Attribute comment="Maximum number of PBs per TXOP" isSpecification="false" visibility="public" xmi.id="3wFspYTmH35P" type="qx03D9bX8Zse" name="max_nb_pb" />
+ <UML:Attribute comment="Pending PB threshold" isSpecification="false" visibility="public" xmi.id="eKaKe4bmRFvU" type="qx03D9bX8Zse" name="ppb_threshold" />
+ <UML:Attribute comment="Surplus of Bandwidth" isSpecification="false" visibility="public" xmi.id="XPVmEflHbz7P" type="qx03D9bX8Zse" name="surplus_bw" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="cinfo structure" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Q60RU8Qxt2jh" isRoot="false" isAbstract="false" name="cp_link_cinfo_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Validity : 0x00 not valid ; 0x01 valid" isSpecification="false" visibility="public" xmi.id="BCj7uWVLsuTg" type="9kqqNN6qIMaD" name="valid_cinfo" />
+ <UML:Attribute comment="type of connection requested" isSpecification="false" visibility="public" xmi.id="OMIbwSMKXMj1" type="9kqqNN6qIMaD" name="mac_service_t" />
+ <UML:Attribute comment="CAP" isSpecification="false" visibility="public" xmi.id="Eu76mal8u3ho" type="9kqqNN6qIMaD" name="user_priority" />
+ <UML:Attribute comment="Transfer of the ATS to the HLE : 0x00 not 0x01 passed" isSpecification="false" visibility="public" xmi.id="U38zOryr0uB8" type="9kqqNN6qIMaD" name="ats" />
+ <UML:Attribute comment="0x00 no smoothing 0x01 smoothing if possible" isSpecification="false" visibility="public" xmi.id="ZCRPvpA9hHET" type="9kqqNN6qIMaD" name="smoothing" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Structure of a connection. Add, delete, return a link." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="adjwEdq884ob" isRoot="false" isAbstract="false" name="cp_conn_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Connection identifier" isSpecification="false" visibility="public" xmi.id="Iz4rTWTxS3n0" type="9kqqNN6qIMaD" name="cid" />
+ <UML:Attribute comment="Forward link id (global or local)" isSpecification="false" visibility="public" xmi.id="bdStR08xCgmF" type="0FkJo3kMVDSV" name="flink" />
+ <UML:Attribute comment="Reverse link id (local or global)" isSpecification="false" visibility="public" xmi.id="PKGfk5LGn3bJ" type="0FkJo3kMVDSV" name="rlink" />
+ <UML:Attribute comment="connection state" isSpecification="false" visibility="public" xmi.id="q86HxGHLiEfh" type="mtZJnRKOO7ZU" name="old_conn_state" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="WeNEbK4sTNyR" type="Bv4qUQAgGcnc" name="type" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="eptSFkclMxyx" type="F2oiQk9bfCP9" name="conn_info" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="aYoq8ZSkOLCb" type="mtZJnRKOO7ZU" name="new_conn_state" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="cBHp8bzlZhfx" type="9kqqNN6qIMaD" name="request_id" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="lsIYD0TogXRd" type="6sEW3jvdsAQ0" name="osa" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="lNlK5PFoHXMS" type="6sEW3jvdsAQ0" name="oda" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="gr9Y2XYluI6x" type="fLjwr6MNuZXD" name="violated_cspec" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="EKdjKZFyRMXT" type="fLjwr6MNuZXD" name="modified_cspec" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="t3ElLIjycSsT" type="fn3T0g7mCdo8" name="node" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WFqOmNayfDhz" isRoot="false" isAbstract="false" isQuery="false" name="init_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AYmkyfDTs3re" type="qpL5yhMnv5m5" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nuwEETf5Wrrq" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="OPd3dI1QBxcP" isRoot="false" isAbstract="false" isQuery="false" name="add_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OHVu8KiGsV0q" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8BJ0C9eaYFcB" value="" type="qpL5yhMnv5m5" name="conn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="YdZhYB6wQZoX" isRoot="false" isAbstract="false" isQuery="false" name="del_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tVllymc6vt68" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0kiZyIiWvIDR" value="" type="qx03D9bX8Zse" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="RHNsrCNkh8Uf" isRoot="false" isAbstract="false" isQuery="false" name="get_conn" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sJQKu9biFdAR" type="qpL5yhMnv5m5" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s4loxpwyZcVV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vD1oTCGtSbjJ" value="" type="qx03D9bX8Zse" name="cid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="n61SEV75ZqtV" isRoot="false" isAbstract="false" isQuery="false" name="check_conn_validity" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SdoXJt4CCUU5" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fnRDPuiI7i5Z" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6GWe4N9kAYvY" value="" type="qpL5yhMnv5m5" name="conn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="d6nqhvGn9kPE" isRoot="false" isAbstract="false" isQuery="false" name="get_free_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="V8MvjMfCSZn1" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8WwG4rmUSb2k" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="S6wdZOiCST19" isRoot="false" isAbstract="false" isQuery="false" name="get_free_llid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yVCOyDYKSRoR" type="9kqqNN6qIMaD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MHvW1Ik7peOr" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="connection list manager. add, delete, return, modify and check the validity of the connections." isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="Ffpcevz092To" isRoot="false" isAbstract="false" name="cp_conn_mgr_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="bYj9JToa9uKf" type="hQ7UEYOzATqF" name="conns" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="9kRYzQhfAceh" isRoot="false" isAbstract="false" isQuery="false" name="garbage_conn" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="wiccWDa1IGB0" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_new_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s7Ltc57HQDvY" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wM97NSNHAxte" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="ARdRgpRYumPW" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_new_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rWlFjgoe0vlL" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="O8dW5U9Ewkdc" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="X48RoXwe1hti" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_rel_ind" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OfMMb5ixDJRH" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nYThH6Jo8PEu" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="uAWvrOeD1yYc" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_rel_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4EXFXxUITv0k" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zHX7hj0brWVg" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="u7uw5QW7e2LB" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xpTQjR9ijeoO" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NozCISsDZm7f" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Cbkob5zYtRxc" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_mod_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s4KZi6x3uvFD" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="N7OxsTa22Kre" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="OoAFD7r499dr" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_info_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8M19fqn3fxIq" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="37uCEY2U5sbZ" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="yuO7aB8gV7pA" isRoot="false" isAbstract="false" isQuery="false" name="process_cm_conn_info_cnf" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ycBbYRRbYMll" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="snFxeqUcjshJ" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="3nxXunhqNtRt" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_add_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IrSpDEa3znyd" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eSDNIueKfbra" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="MYQkPqdgh6Vs" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_add_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="I5vHsrtUH6pZ" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zTte3iEPFd7c" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="TjI8pn05stMj" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_mod_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kFD1K1YJSQxV" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8AtNl00CjGKW" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="4KbuDwdv9pwT" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_mod_rsp" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qSkIsimzqfMb" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dKnLb7pdPPXc" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="J9VSwPumre2k" isRoot="false" isAbstract="false" isQuery="false" name="process_apcm_conn_rel_req" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KmjAP3l3MYMv" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dBY2Y3crA7I6" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="WCqMot49dnJ3" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_sqz_req_rx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="o368ZQ3DZZD8" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bqxlvFqQPgmE" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="XqLBbcEPfIWF" isRoot="false" isAbstract="false" isQuery="false" name="process_cc_link_sqz_cnf_rx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="iXQF7dNgRLRN" value="" type="3Xrk8GDGycgY" name="ctx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YHnywZATPVc0" value="" type="iSF0bbc1ufLz" name="mme" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="7qNl6tymRO2W" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zNCRgboFrbBl" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="M9nDiyyqHBL5" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0ozdebNMCsR8" value="" type="3Xrk8GDGycgY" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="ble interval values" isSpecification="false" isLeaf="false" visibility="public" namespace="K35NPMr9taR3" xmi.id="oE5CCxttNgAF" isRoot="false" isAbstract="false" name="cp_ble_interval_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="ble value" isSpecification="false" visibility="public" xmi.id="7MBbDW5Dfddz" type="9kqqNN6qIMaD" name="ble" />
+ <UML:Attribute comment="end time" isSpecification="false" visibility="public" xmi.id="rWKEXa4Lo7W0" type="qx03D9bX8Zse" name="et" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="yi3iuDTAFpl9" type="fn3T0g7mCdo8" name="node" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vQr3syDVnjwt" isRoot="false" isAbstract="false" name="Class Diagram" >
+ <UML:Namespace.ownedElement/>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="46" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1820" snapy="10" showatts="1" xmi.id="4HFzWQZSTZhP" documentation="" type="1" showops="1" showpackage="0" name="conn" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1874" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="447" showattsigs="601" x="0" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="360" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Ffpcevz092To" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="386" showattsigs="601" x="541" fillcolor="#ffffc0" y="0" showopsigs="601" linewidth="none" height="378" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="adjwEdq884ob" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="128" x="1052" fillcolor="#ffffc0" y="113" linewidth="none" height="162" usefillcolor="1" isinstance="0" xmi.id="mtZJnRKOO7ZU" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="149" showattsigs="601" x="361" fillcolor="#ffffc0" y="605" showopsigs="601" linewidth="none" height="117" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Q60RU8Qxt2jh" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="173" showattsigs="601" x="0" fillcolor="#ffffc0" y="407" showopsigs="601" linewidth="none" height="477" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="d8mKKcTJhtMZ" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="173" showattsigs="601" x="349" fillcolor="#ffffc0" y="772" showopsigs="601" linewidth="none" height="162" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Dd5IhQuqhODL" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="142" showattsigs="601" x="387" fillcolor="#ffffc0" y="991" showopsigs="601" linewidth="none" height="81" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="oE5CCxttNgAF" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="162" x="587" fillcolor="#ffffc0" y="799" linewidth="none" height="108" usefillcolor="1" isinstance="0" xmi.id="K9Fc7ya6eboZ" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="187" showattsigs="601" x="342" fillcolor="#ffffc0" y="441" showopsigs="601" linewidth="none" height="117" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="fLjwr6MNuZXD" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="adjwEdq884ob" widgetaid="Ffpcevz092To" xmi.id="AnXqp1nebv8V" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="447" starty="180" />
+ <endpoint endx="541" endy="189" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="3" indexb="2" linewidth="none" widgetbid="Dd5IhQuqhODL" widgetaid="adjwEdq884ob" xmi.id="1ZrlQBx4omHB" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="798" starty="378" />
+ <endpoint endx="464" endy="772" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="fLjwr6MNuZXD" widgetaid="adjwEdq884ob" xmi.id="ZLxwL8UTBdI7" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="669" starty="378" />
+ <endpoint endx="435" endy="441" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" visibilityB="200" totalcountb="3" indexb="1" linewidth="none" widgetbid="mtZJnRKOO7ZU" widgetaid="adjwEdq884ob" xmi.id="q86HxGHLiEfh" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="927" starty="126" />
+ <endpoint endx="1052" endy="167" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="117" x="944" fillcolor="none" y="170" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="LHkMcahwDerW" text="old_conn_state" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" visibilityB="200" totalcountb="3" indexb="2" linewidth="none" widgetbid="mtZJnRKOO7ZU" widgetaid="adjwEdq884ob" xmi.id="aYoq8ZSkOLCb" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="927" starty="252" />
+ <endpoint endx="1052" endy="221" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="124" x="937" fillcolor="none" y="223" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="gvId0mQX3wXS" text="new_conn_state" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="Q60RU8Qxt2jh" widgetaid="Dd5IhQuqhODL" xmi.id="qzZi0HXSKdRg" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="406" starty="772" />
+ <endpoint endx="435" endy="722" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="443" fillcolor="none" y="788" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="QMhbqIMCa6WA" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="435" fillcolor="none" y="741" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="fD4qqvMWoe7m" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="Q60RU8Qxt2jh" widgetaid="fLjwr6MNuZXD" xmi.id="ap8aOZNHajls" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="435" starty="558" />
+ <endpoint endx="435" endy="605" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="Dd5IhQuqhODL" widgetaid="d8mKKcTJhtMZ" xmi.id="yR77gv82Dngk" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="173" starty="725" />
+ <endpoint endx="349" endy="853" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="3" indexb="1" linewidth="none" widgetbid="d8mKKcTJhtMZ" widgetaid="fLjwr6MNuZXD" xmi.id="OlUNXhoPpodj" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="342" starty="499" />
+ <endpoint endx="173" endy="566" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="oE5CCxttNgAF" widgetaid="Dd5IhQuqhODL" xmi.id="VqiqgPP0C8zY" type="510" linecolor="none" >
+ <linepath>
+ <startpoint startx="435" starty="934" />
+ <endpoint endx="458" endy="991" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="391" fillcolor="none" y="935" linewidth="none" posttext="" role="701" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="PXKQSpssBXU1" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="411" fillcolor="none" y="967" linewidth="none" posttext="" role="702" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="ooBMsgWXraOh" text="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="K9Fc7ya6eboZ" widgetaid="Dd5IhQuqhODL" xmi.id="yN55b1ltFiLX" type="501" linecolor="none" >
+ <linepath>
+ <startpoint startx="522" starty="853" />
+ <endpoint endx="587" endy="853" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Package>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="K9Fc7ya6eboZ" isRoot="false" isAbstract="false" name="cp_link_type_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="15F3QKNkRcLY" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="sSSMYaHXdXb3" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_LOCAL" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="K9Fc7ya6eboZ" xmi.id="k4qPW77MaXi6" isRoot="false" isAbstract="false" name="CP_LINK_TYPE_GLOBAL" />
+ </UML:Enumeration>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fLjwr6MNuZXD" isRoot="false" isAbstract="false" name="cp_conn_cspec_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="hUapPz7FvDlL" type="qx03D9bX8Zse" name="cspec_len_oct" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="zURtIMQaYz3T" type="d21ZFkuCFK5X" name="f_cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="eU5DT9ejQFbr" type="d21ZFkuCFK5X" name="r_cinfo" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="AhzYLwKyyJVB" type="y93NOeEZLD5e" name="f_qmp" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="7Na3g6CkUZ0C" type="y93NOeEZLD5e" name="r_qmp" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0AFakTbKOjhV" isRoot="false" isAbstract="false" name="cp_cco_bw_persistence_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="0AFakTbKOjhV" xmi.id="0sn2w94wHHV1" isRoot="false" isAbstract="false" name="CP_CCO_BW_PERSISTENCE_NOT_PERSISTENT" />
+ <UML:EnumerationLiteral comment="
+" isSpecification="false" isLeaf="false" visibility="public" namespace="0AFakTbKOjhV" xmi.id="HGkt98I7y37u" isRoot="false" isAbstract="false" name="CP_CCO_BW_PERSISTENCE_PERSISTENT" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="SE4drlhQgGnK" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="TMflWOVf23ws" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="UPuAZjLmcUkp" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5N0jdm3LnaNE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="jg42FP3gkiRG" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="5xw7yqxSFscm" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="b7KNffbX2W2O" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ZvYCQI17w389" aggregation="aggregate" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="TBqBsFRxCL2A" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="fpbgLd4VX8IR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="B0bQqBAP7hbV" aggregation="aggregate" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zbcuek35wrGo" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="kz0I7IjzeXWP" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="7gjH1jQDh1bX" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="CmxHTWmQ7PIk" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="nVqR2Kp5JL6z" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="7Kp3B4pGkWYj" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EywvzWT9GORh" aggregation="none" type="Dd5IhQuqhODL" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="FuUBzFE99m1F" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="uB52YOmggZhr" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="0" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="bV6J1e3Dcx9Z" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="aRjAdPOlJ8Zo" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="Rcghy5OsHSsp" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ocVUCBJlgP5f" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="iFQH9XCi3DbL" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="36td12ATcr8a" aggregation="composite" type="pEl1C68UjFRR" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="wVQBxJ1lvUF5" aggregation="none" type="niNHo3iBMi93" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="mfAF1Et9RgMb" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fWpJwszxysbx" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="slOSaX2X2Qix" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="8NatufiLOVge" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="jhgdAtgpPV7L" aggregation="none" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="N6JJwsFobdGC" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="1V4Vw7QgAqng" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="8Gh8eP5M5lzF" aggregation="composite" type="ySeTGJOMEmYM" name="" multiplicity="0" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ed2479NSDek9" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rG6FnLTUU3xX" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="Wzv8a9IjNzr2" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="MxOPgLeJwfL3" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="w2GO5CvfhZ6h" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="oiW0NG9rD3xn" aggregation="composite" type="xnGQ9ti6LKXZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="CFWYCMaXHwwx" aggregation="none" type="pEl1C68UjFRR" name="" multiplicity="4" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Generalization isSpecification="false" child="ySeTGJOMEmYM" visibility="public" namespace="Logical View" xmi.id="he8aiM3PdmBs" parent="xnGQ9ti6LKXZ" discriminator="" name="" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="RdSzOM9ws9pF" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="FbEBEZF0Gl0b" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="z8SCBOxLbUto" aggregation="none" type="nKah2FElYQjf" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="TjLJsBY0YHzZ" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="qRJ5LF2aqFm2" aggregation="composite" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="o134k3dhB4rM" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="FZnmqkJSolys" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Sog1GZn4z69K" aggregation="composite" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="MAvAPfDDgGGO" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="A4CznApzfO14" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Jr3TvunNgTNx" aggregation="composite" type="Dd5IhQuqhODL" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="1Az0H9IdJDni" aggregation="none" type="nKah2FElYQjf" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5MhNVwbXrStj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="s0tWE7sYzv1u" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="nmGSGdPHnOF2" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yGvogmXTI20E" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="VXfojRUbPM6e" aggregation="none" type="pEl1C68UjFRR" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="TyAQs9LdvZ5B" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yR77gv82Dngk" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ASQvpdyKBb7s" aggregation="composite" type="d8mKKcTJhtMZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="2ZRQvX4PUCpK" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="qzZi0HXSKdRg" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L8vEfzOpRolE" aggregation="composite" type="Dd5IhQuqhODL" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="QhXZIeRJBsj7" aggregation="none" type="Q60RU8Qxt2jh" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Ytu0ZEZIt40G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="QlUsxHCGO7U3" aggregation="none" type="nKah2FElYQjf" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6stWfck5JFeb" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yIAhg4g39Wum" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="t5u3vbALKcBH" aggregation="aggregate" type="ySeTGJOMEmYM" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="tNVFT0JZqA3V" aggregation="none" type="adjwEdq884ob" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="1ZrlQBx4omHB" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="mmY51AetDXw9" aggregation="aggregate" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="86STgeiX1CnS" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="SgCGphSMnicE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="A600E3U0p03r" aggregation="none" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BfkOCgXJkykQ" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="4n7CxO4qepqv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="cQvbci4mm4l0" aggregation="none" type="pEl1C68UjFRR" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="7FyvDzmOfUlr" aggregation="none" type="adjwEdq884ob" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="a1oSjxPd5iaz" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8G8sEsGqJBSv" aggregation="none" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="sWgeYRdfebar" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="VqiqgPP0C8zY" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ZKEEoz3wFCmU" aggregation="composite" type="Dd5IhQuqhODL" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="20ILAkF2Etem" aggregation="none" type="oE5CCxttNgAF" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="hTFpkGG8AM5T" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KFQwpylOJzc5" aggregation="composite" type="d8mKKcTJhtMZ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="wf2CpmesnwBv" aggregation="none" type="nKah2FElYQjf" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="U9HR73bnbWVt" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="fOxtHZeZp4Ve" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="2H2JGcPDFPN5" aggregation="none" type="Ffpcevz092To" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="REz0iVtn4vkj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="Bzvwv4raTmSk" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="K6K78pl84lSJ" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="iYWkSGRVz8hL" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="NrUaErfPqYKj" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="d9I6ukoEo6Lu" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="eYhdhOxPg2Vx" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="u42ypUHAJlkX" aggregation="composite" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="aOvOuD8XMObE" aggregation="none" type="Ffpcevz092To" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="AnXqp1nebv8V" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="8OQuUjoOnoLa" aggregation="composite" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="HciaMR6upzJj" aggregation="none" type="adjwEdq884ob" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="8IfFoRAxojCs" isRoot="false" isAbstract="false" name="Sequence diagram" >
+ <UML:Namespace.ownedElement/>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="F2c5R39MF9xW" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="tZ1eLMFcxvDH" aggregation="none" type="Ffpcevz092To" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="MHBBGStSr6yc" aggregation="none" type="pEl1C68UjFRR" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="O1PWAArevDzF" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t**" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="JSU2EBtENyKy" isRoot="false" isAbstract="false" name="cp_cco_bw_conn_prio_heap_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tOgMBBDlVoLx" isRoot="false" isAbstract="false" name="cp_cco_bw_prio_heap_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fn3T0g7mCdo8" isRoot="false" isAbstract="false" name="list_node_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vez0woDacG3c" isRoot="false" isAbstract="false" name="set_node_t" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="3qIL60CD7SL5" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zhmUUcnY7nOK" aggregation="composite" type="akTdL0BuuMIi" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="AOZ56nSlFhb5" aggregation="none" type="0AFakTbKOjhV" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="hQ7UEYOzATqF" isRoot="false" isAbstract="false" name="list_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="JO1FHqi41DrK" isRoot="false" isAbstract="false" name="cp_link_ble_interval_t*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="TZfikGiIVwKz" isRoot="false" isAbstract="false" name="cp_cco_bw_alloc_t*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bfUc1UOFU09C" isRoot="false" isAbstract="false" name="u16*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Bv4qUQAgGcnc" isRoot="false" isAbstract="false" name="cp_conn_type_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="F2oiQk9bfCP9" isRoot="false" isAbstract="false" name="cp_conn_info_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="6sEW3jvdsAQ0" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3QNGiQmMsrXJ" isRoot="false" isAbstract="false" name="cp_link_qmp_t" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="OlUNXhoPpodj" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="GjI1IDUBRsgp" aggregation="aggregate" type="fLjwr6MNuZXD" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="XmY3iCflPLde" aggregation="none" type="d8mKKcTJhtMZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="ap8aOZNHajls" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Njq1KrMaYcao" aggregation="aggregate" type="fLjwr6MNuZXD" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="p4zGwd3RNbU6" aggregation="none" type="Q60RU8Qxt2jh" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="g8cNqwVSwwE6" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="m7rBTUooDcpV" aggregation="aggregate" type="d8mKKcTJhtMZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="R94zlenYikoc" aggregation="none" type="Dd5IhQuqhODL" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="ZLxwL8UTBdI7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Nq3kPVqBcfL3" aggregation="aggregate" type="adjwEdq884ob" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="87sJhfp8pr5Y" aggregation="none" type="fLjwr6MNuZXD" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="yN55b1ltFiLX" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Vq7Batnvjof9" aggregation="aggregate" type="Dd5IhQuqhODL" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="JUIv7bxFgpZN" aggregation="none" type="K9Fc7ya6eboZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="N6VU8JNOwH9n" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="SMTHDYogOvpw" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ocrWQVdhztc6" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="pV8BBjAtfG0U" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="TZM9MtVpFw4Q" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Vs4rltmYVd4t" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="jiAAt6MpIubW" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8fa5YAC1iW92" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="NcraYu01k4rW" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="LcsLN0ze8QIE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="vd4OG6HNlpSJ" aggregation="none" type="xnGQ9ti6LKXZ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="xcJf8QiV0X3W" aggregation="none" type="ySeTGJOMEmYM" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="pRzkrBbewp0R" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="4HFzWQZSTZhP" documentation="" uniqueid="mmKkWrMpTD8p" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="1" type="803" id="vQr3syDVnjwt" >
+ <listitem open="0" type="807" id="4HFzWQZSTZhP" label="conn" />
+ </listitem>
+ <listitem open="1" type="803" id="K35NPMr9taR3" >
+ <listitem open="0" type="813" id="oE5CCxttNgAF" >
+ <listitem open="0" type="814" id="7MBbDW5Dfddz" />
+ <listitem open="0" type="814" id="rWKEXa4Lo7W0" />
+ <listitem open="0" type="814" id="yi3iuDTAFpl9" />
+ </listitem>
+ <listitem open="0" type="813" id="ySeTGJOMEmYM" >
+ <listitem open="0" type="815" id="QNnsMczV4BbV" />
+ <listitem open="0" type="815" id="4Jl61qfG7FdR" />
+ <listitem open="0" type="815" id="kWAzj2FfLSzz" />
+ <listitem open="0" type="815" id="7f6S84QwyS5a" />
+ <listitem open="0" type="815" id="VChtJRri78Bp" />
+ <listitem open="0" type="815" id="seYRAqbe0Jvw" />
+ <listitem open="0" type="815" id="DNsf89jKgseb" />
+ <listitem open="0" type="815" id="tR7lNfHrBJvJ" />
+ </listitem>
+ <listitem open="0" type="813" id="akTdL0BuuMIi" >
+ <listitem open="0" type="814" id="WHgpgU3HDWsW" />
+ <listitem open="0" type="814" id="2pv02ohjicc7" />
+ <listitem open="0" type="814" id="6CEonouBntNY" />
+ <listitem open="0" type="814" id="6lmba4wqHNOl" />
+ <listitem open="0" type="814" id="KtVJ3RkxxT7e" />
+ <listitem open="0" type="814" id="dkbxTW5FavZS" />
+ <listitem open="0" type="814" id="jUHoqZsuISuy" />
+ <listitem open="0" type="814" id="9UW3dNtE8T9Z" />
+ <listitem open="0" type="814" id="mVY4wQ05uW6V" />
+ <listitem open="0" type="814" id="rzhzQqWM5KrC" />
+ <listitem open="0" type="814" id="3oBvIFO8C57d" />
+ </listitem>
+ <listitem open="0" type="813" id="niNHo3iBMi93" >
+ <listitem open="0" type="814" id="kC9bWRewTRAy" />
+ <listitem open="0" type="814" id="me7r6SxasvES" />
+ <listitem open="0" type="814" id="iHTllYAzskuy" />
+ </listitem>
+ <listitem open="0" type="813" id="pEl1C68UjFRR" >
+ <listitem open="0" type="814" id="ooF6vpsKuOw1" />
+ <listitem open="0" type="814" id="BoTNcsVT3vk5" />
+ <listitem open="0" type="814" id="AhBRVaG2kt6W" />
+ <listitem open="0" type="814" id="vlplg1EMIh54" />
+ <listitem open="0" type="815" id="BuYs8zIb3uMF" />
+ <listitem open="0" type="815" id="ArL3GjV2Yl6R" />
+ <listitem open="0" type="815" id="YyjQMfR7LmP8" />
+ <listitem open="0" type="815" id="FG15yw3gMB8Z" />
+ <listitem open="0" type="815" id="uq9DVEHiSGoP" />
+ <listitem open="0" type="815" id="udW0X6nRwucP" />
+ </listitem>
+ <listitem open="0" type="813" id="xnGQ9ti6LKXZ" >
+ <listitem open="0" type="814" id="8SVuiaBMFxkG" />
+ <listitem open="0" type="814" id="IvjtyxL96U0O" />
+ <listitem open="0" type="814" id="bMccUjua3QRe" />
+ <listitem open="0" type="814" id="qqpCp7AgWp2f" />
+ <listitem open="0" type="814" id="yEOT2jRXwz6c" />
+ <listitem open="0" type="814" id="wHXJuWtlMix9" />
+ <listitem open="0" type="814" id="o5qKsqxq4MK4" />
+ <listitem open="0" type="815" id="kZlArwfzKyf6" />
+ <listitem open="0" type="815" id="O87gKQtsw1DR" />
+ <listitem open="0" type="815" id="6r5JBb3UvGb7" />
+ <listitem open="0" type="815" id="8VFn5SRIJtio" />
+ <listitem open="0" type="815" id="CX7QmGnNQfyu" />
+ <listitem open="0" type="815" id="N8I7BjZIOdlW" />
+ <listitem open="0" type="815" id="qDTUjKdqN9vB" />
+ <listitem open="0" type="815" id="VNZrMxhseKAs" />
+ <listitem open="0" type="815" id="REvc418qnVEv" />
+ <listitem open="0" type="815" id="WlMKMGxlUqNX" />
+ <listitem open="0" type="815" id="5NytACfVvOsX" />
+ <listitem open="0" type="815" id="2dqv1jTNexf5" />
+ <listitem open="0" type="815" id="2vygqejoln43" />
+ <listitem open="0" type="815" id="29Uw34J8wOf4" />
+ <listitem open="0" type="815" id="42UyQ92giMdG" />
+ <listitem open="0" type="815" id="Xml5upZdXAZW" />
+ </listitem>
+ <listitem open="0" type="813" id="Ffpcevz092To" >
+ <listitem open="0" type="814" id="bYj9JToa9uKf" />
+ <listitem open="0" type="815" id="9kRYzQhfAceh" />
+ <listitem open="0" type="815" id="wiccWDa1IGB0" />
+ <listitem open="0" type="815" id="ARdRgpRYumPW" />
+ <listitem open="0" type="815" id="X48RoXwe1hti" />
+ <listitem open="0" type="815" id="uAWvrOeD1yYc" />
+ <listitem open="0" type="815" id="u7uw5QW7e2LB" />
+ <listitem open="0" type="815" id="Cbkob5zYtRxc" />
+ <listitem open="0" type="815" id="OoAFD7r499dr" />
+ <listitem open="0" type="815" id="yuO7aB8gV7pA" />
+ <listitem open="0" type="815" id="3nxXunhqNtRt" />
+ <listitem open="0" type="815" id="MYQkPqdgh6Vs" />
+ <listitem open="0" type="815" id="TjI8pn05stMj" />
+ <listitem open="0" type="815" id="4KbuDwdv9pwT" />
+ <listitem open="0" type="815" id="J9VSwPumre2k" />
+ <listitem open="0" type="815" id="WCqMot49dnJ3" />
+ <listitem open="0" type="815" id="XqLBbcEPfIWF" />
+ <listitem open="0" type="815" id="7qNl6tymRO2W" />
+ <listitem open="0" type="815" id="M9nDiyyqHBL5" />
+ </listitem>
+ <listitem open="0" type="813" id="adjwEdq884ob" >
+ <listitem open="0" type="814" id="Iz4rTWTxS3n0" />
+ <listitem open="0" type="814" id="bdStR08xCgmF" />
+ <listitem open="0" type="814" id="PKGfk5LGn3bJ" />
+ <listitem open="0" type="814" id="q86HxGHLiEfh" />
+ <listitem open="0" type="814" id="WeNEbK4sTNyR" />
+ <listitem open="0" type="814" id="eptSFkclMxyx" />
+ <listitem open="0" type="814" id="aYoq8ZSkOLCb" />
+ <listitem open="0" type="814" id="cBHp8bzlZhfx" />
+ <listitem open="0" type="814" id="lsIYD0TogXRd" />
+ <listitem open="0" type="814" id="lNlK5PFoHXMS" />
+ <listitem open="0" type="814" id="gr9Y2XYluI6x" />
+ <listitem open="0" type="814" id="EKdjKZFyRMXT" />
+ <listitem open="0" type="814" id="t3ElLIjycSsT" />
+ <listitem open="0" type="815" id="WFqOmNayfDhz" />
+ <listitem open="0" type="815" id="OPd3dI1QBxcP" />
+ <listitem open="0" type="815" id="YdZhYB6wQZoX" />
+ <listitem open="0" type="815" id="RHNsrCNkh8Uf" />
+ <listitem open="0" type="815" id="n61SEV75ZqtV" />
+ <listitem open="0" type="815" id="d6nqhvGn9kPE" />
+ <listitem open="0" type="815" id="S6wdZOiCST19" />
+ </listitem>
+ <listitem open="0" type="813" id="Q60RU8Qxt2jh" >
+ <listitem open="0" type="814" id="BCj7uWVLsuTg" />
+ <listitem open="0" type="814" id="OMIbwSMKXMj1" />
+ <listitem open="0" type="814" id="Eu76mal8u3ho" />
+ <listitem open="0" type="814" id="U38zOryr0uB8" />
+ <listitem open="0" type="814" id="ZCRPvpA9hHET" />
+ </listitem>
+ <listitem open="0" type="813" id="d8mKKcTJhtMZ" >
+ <listitem open="0" type="814" id="gTg5YO0BUnWp" />
+ <listitem open="0" type="814" id="Px64qTbAFKMM" />
+ <listitem open="0" type="814" id="hmYsthba8Gdh" />
+ <listitem open="0" type="814" id="eds9OOwnK2pA" />
+ <listitem open="0" type="814" id="TRLilh2QRZHL" />
+ <listitem open="0" type="814" id="nR9txDa68QcP" />
+ <listitem open="0" type="814" id="Cw0z3lDbs9ub" />
+ <listitem open="0" type="814" id="8ZogWKRHjaAg" />
+ <listitem open="0" type="814" id="mlls9LFKFFJI" />
+ <listitem open="0" type="814" id="0UtqdlSmLEQp" />
+ <listitem open="0" type="814" id="Xp6GQEvAxe07" />
+ <listitem open="0" type="814" id="zFRFUiXUCPJp" />
+ <listitem open="0" type="814" id="AlZTxyIUnMlB" />
+ <listitem open="0" type="814" id="ZeJWIJbFY2U0" />
+ <listitem open="0" type="814" id="i0TuNmiXVFzS" />
+ <listitem open="0" type="814" id="DHxzcgABIUha" />
+ <listitem open="0" type="814" id="nHpKJIK2Gnub" />
+ <listitem open="0" type="814" id="Xa82q7T1NOyx" />
+ <listitem open="0" type="814" id="498MbnuM4hgM" />
+ <listitem open="0" type="814" id="xzMBkEmIptId" />
+ <listitem open="0" type="814" id="ylcJ9bGBiMVJ" />
+ <listitem open="0" type="814" id="8NdA5IU0HqCz" />
+ <listitem open="0" type="814" id="3wFspYTmH35P" />
+ <listitem open="0" type="814" id="eKaKe4bmRFvU" />
+ <listitem open="0" type="814" id="XPVmEflHbz7P" />
+ </listitem>
+ <listitem open="0" type="813" id="Dd5IhQuqhODL" >
+ <listitem open="0" type="814" id="RP4g6QESrIGR" />
+ <listitem open="0" type="814" id="R4lfEOk34S06" />
+ <listitem open="0" type="814" id="sQEhgV9JJ0Rv" />
+ <listitem open="0" type="814" id="y3j2Tj7pa9ls" />
+ <listitem open="0" type="814" id="naiC13Fgjvwp" />
+ <listitem open="0" type="814" id="2IFWtWCrXvs0" />
+ <listitem open="0" type="815" id="FMPxocle20Jj" />
+ <listitem open="0" type="815" id="Ndi6WcvlwJhi" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="803" id="8IfFoRAxojCs" />
+ <listitem open="0" type="813" id="fLjwr6MNuZXD" >
+ <listitem open="0" type="814" id="hUapPz7FvDlL" />
+ <listitem open="0" type="814" id="zURtIMQaYz3T" />
+ <listitem open="0" type="814" id="eU5DT9ejQFbr" />
+ <listitem open="0" type="814" id="AhzYLwKyyJVB" />
+ <listitem open="0" type="814" id="7Na3g6CkUZ0C" />
+ </listitem>
+ <listitem open="1" type="813" id="TZfikGiIVwKz" />
+ <listitem open="1" type="813" id="O1PWAArevDzF" />
+ <listitem open="1" type="813" id="JSU2EBtENyKy" />
+ <listitem open="1" type="813" id="tOgMBBDlVoLx" />
+ <listitem open="1" type="813" id="F2oiQk9bfCP9" />
+ <listitem open="1" type="813" id="Bv4qUQAgGcnc" />
+ <listitem open="1" type="813" id="JO1FHqi41DrK" />
+ <listitem open="1" type="813" id="3QNGiQmMsrXJ" />
+ <listitem open="1" type="813" id="fn3T0g7mCdo8" />
+ <listitem open="1" type="813" id="hQ7UEYOzATqF" />
+ <listitem open="1" type="813" id="6sEW3jvdsAQ0" />
+ <listitem open="1" type="813" id="vez0woDacG3c" />
+ <listitem open="1" type="813" id="bfUc1UOFU09C" />
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="irUbdfzRtLuy" />
+ <listitem open="1" type="829" id="0widC5QuvWxy" />
+ <listitem open="1" type="829" id="l4plA4WjZ5hz" />
+ <listitem open="0" type="829" id="LMD9GuDpzhxX" />
+ <listitem open="0" type="829" id="M6xKR1cFPIwW" />
+ <listitem open="0" type="829" id="S1gNUo1cYqQt" />
+ <listitem open="0" type="829" id="eoUNxGuvIuwA" />
+ <listitem open="1" type="829" id="BlOcERrdVcJi" />
+ <listitem open="1" type="829" id="qpL5yhMnv5m5" />
+ <listitem open="1" type="829" id="CAMwXARcOr2q" />
+ <listitem open="1" type="829" id="ZCvyT3nV6461" />
+ <listitem open="1" type="829" id="TJR8rTv6HJGr" />
+ <listitem open="0" type="829" id="d21ZFkuCFK5X" />
+ <listitem open="1" type="829" id="y93NOeEZLD5e" />
+ <listitem open="1" type="829" id="0FkJo3kMVDSV" />
+ <listitem open="1" type="829" id="iSF0bbc1ufLz" />
+ <listitem open="1" type="829" id="rXf3L5yLNrBT" />
+ <listitem open="1" type="829" id="huvuRoPtpoED" />
+ <listitem open="1" type="829" id="3Xrk8GDGycgY" />
+ <listitem open="1" type="829" id="luyeQvc8m5hN" />
+ <listitem open="1" type="829" id="OMTNsx2stiV3" />
+ <listitem open="1" type="829" id="OqFNT55UVzVU" />
+ <listitem open="1" type="829" id="xmmoTFsE9otX" />
+ <listitem open="1" type="829" id="kfod0hZO32mt" />
+ <listitem open="1" type="829" id="pocpPVnex8xP" />
+ <listitem open="1" type="829" id="qx03D9bX8Zse" />
+ <listitem open="1" type="829" id="D9PiHaAGBCIb" />
+ <listitem open="1" type="829" id="28emhDJMNjju" />
+ <listitem open="1" type="829" id="9kqqNN6qIMaD" />
+ <listitem open="0" type="829" id="nKah2FElYQjf" />
+ <listitem open="1" type="829" id="jTfTYNoH0asy" />
+ <listitem open="1" type="829" id="C4WJsNrZpU0N" />
+ <listitem open="1" type="829" id="HSMJS6CQrwCI" />
+ </listitem>
+ <listitem open="1" type="831" id="0AFakTbKOjhV" >
+ <listitem open="0" type="839" id="0sn2w94wHHV1" />
+ <listitem open="0" type="839" id="HGkt98I7y37u" />
+ </listitem>
+ <listitem open="1" type="831" id="K9Fc7ya6eboZ" >
+ <listitem open="0" type="839" id="15F3QKNkRcLY" />
+ <listitem open="0" type="839" id="sSSMYaHXdXb3" />
+ <listitem open="0" type="839" id="k4qPW77MaXi6" />
+ </listitem>
+ <listitem open="0" type="831" id="mtZJnRKOO7ZU" >
+ <listitem open="0" type="839" id="OX2HniyXbXoO" />
+ <listitem open="0" type="839" id="neVJeoamoZ5F" />
+ <listitem open="0" type="839" id="cqyEfU3313Im" />
+ <listitem open="0" type="839" id="loGfKRYwIW8x" />
+ <listitem open="0" type="839" id="80zKS1hCpxp7" />
+ <listitem open="0" type="839" id="eDMziEWTrzlV" />
+ <listitem open="0" type="839" id="zRZGwOSgcWwz" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="pRzkrBbewp0R" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/conn/inc/conn.h b/cesar/cp/conn/inc/conn.h
new file mode 100644
index 0000000000..000baeec64
--- /dev/null
+++ b/cesar/cp/conn/inc/conn.h
@@ -0,0 +1,48 @@
+#ifndef cp_conn_inc_conn_h
+#define cp_conn_inc_conn_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp_conn.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "cp/cp.h"
+
+
+/**
+ * get the request id of a connection
+ * \param ctx Control Plane context
+ * \param cid Connection identifier
+ * \return request id
+ *
+ */
+u8
+cp_conn_get_request_id(cp_t *ctx, u16 cid);
+
+/**
+ * Return the next connection
+ * \param conn actual conncetion
+ * \return The next connection
+ *
+ */
+cp_conn_t*
+cp_conn_get_next_conn(cp_t *ctx, cp_conn_t *conn);
+
+/**
+ * Return the first connection of a heap
+ * \param heap Heap
+ * \return The first connection of the heap
+ *
+ */
+cp_conn_t*
+cp_conn_get_first_conn(cp_t *ctx);
+
+#endif
diff --git a/cesar/cp/conn/inc/link.h b/cesar/cp/conn/inc/link.h
new file mode 100644
index 0000000000..1392e923c5
--- /dev/null
+++ b/cesar/cp/conn/inc/link.h
@@ -0,0 +1,38 @@
+#ifndef cp_conn_inc_link_h
+#define cp_conn_inc_link_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file link.h
+ * \brief link management
+ * \ingroup cp/conn
+ *
+ * « long description »
+ */
+
+/**
+ * BLE memory allocation
+ * \param first first BLE of a link
+ * \param new new element to add to the heap
+ *
+ * link the BLE
+ */
+void
+cp_link_push_ble(cp_link_t *link, u16 ble, u16 et);
+
+/**
+ * Release the BLE of a link
+ * \param link Link
+ *
+ */
+void
+cp_link_release_ble(cp_link_t *link);
+
+#endif
+
+
diff --git a/cesar/cp/conn/link.h b/cesar/cp/conn/link.h
new file mode 100644
index 0000000000..33738509d8
--- /dev/null
+++ b/cesar/cp/conn/link.h
@@ -0,0 +1,276 @@
+#ifndef cp_conn_link_h
+#define cp_conn_link_h
+
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file link.h
+ * \brief link management
+ * \ingroup cp/conn
+ *
+ * « long description »
+ */
+#include "lib/blk.h"
+
+/**
+ * cinfo structure
+ */
+struct cp_link_cinfo_t
+{
+ /** Validity : 0x00 not valid ; 0x01 valid */
+ u8 valid_cinfo;
+
+ /** type of connection requested */
+ u8 mac_service_t;
+
+ /** CAP */
+ u8 user_priority;
+
+ /** Transfer of the ATS to the HLE : 0x00 not 0x01 passed */
+ u8 ats;
+
+ /** 0x00 no smoothing 0x01 smoothing if possible */
+ u8 smoothing;
+
+};
+typedef struct cp_link_cinfo_t cp_link_cinfo_t;
+
+/**
+ * ble interval values
+ */
+struct cp_link_ble_interval_t
+{
+ /** ble value */
+ u16 ble;
+
+ /** end time */
+ u16 et_atu;
+
+ /** Node */
+ list_node_t node;
+};
+typedef struct cp_link_ble_interval_t cp_link_ble_interval_t;
+
+
+/**
+ * Connection Specification
+ */
+struct cp_link_qmp_t
+{
+ /**
+ * Delay Bound
+ */
+ u32 delay;
+
+ /**
+ * jitter bound
+ */
+ u32 jitter;
+
+ /**
+ * Average MPDU size
+ */
+ u16 av_MPDU_size;
+
+ /**
+ * Maximum MPDU size
+ */
+ u16 max_MPDU_size;
+
+ /**
+ * Average data rate
+ */
+ u16 av_data_rate;
+
+ /**
+ * Minimum data rate
+ */
+ u16 min_data_rate;
+
+ /**
+ * Maximum data rate
+ */
+ u16 max_data_rate;
+
+ /**
+ * Maximum inter-TXOP time
+ */
+ u16 max_inter_TXOP;
+
+ /**
+ * Minimum inter TXOP time
+ */
+ u16 min_inter_TXOP;
+
+ /**
+ * Maximum burst time
+ */
+ u16 max_burst;
+
+ /**
+ * Exception Policy
+ */
+ u8 exception;
+
+ /**
+ * Inatictivity interval
+ */
+ u32 inactivity;
+
+ /**
+ * MSDU error rate
+ */
+ u16 MSDU_error_rate;
+
+ /**
+ * Convergence Layer SAP Type
+ */
+ u8 CLST;
+
+ /**
+ * ATS tolerance
+ */
+ u16 ATS;
+
+ /**
+ * Smallest Tolerable Average Data rate
+ */
+ u16 min_tol_data;
+
+ /**
+ * Original average Data rate
+ */
+ u16 ori_av_data_rate;
+
+ /**
+ * RX window size
+ */
+ u16 rx_window;
+
+ /**
+ * Smoothing buffer size
+ */
+ u32 smoothing:24;
+
+ /**
+ * Bidirectional burst
+ */
+ u8 bidir_burst;
+
+ /**
+ * Number of TXOPs per beacon
+ */
+ u8 nb_txop;
+
+ /**
+ * Average number of PBs per TXOP
+ */
+ u16 av_nb_pb;
+
+ /**
+ * Maximum number of PBs per TXOP
+ */
+ u16 max_nb_pb;
+
+ /**
+ * Pending PB threshold
+ */
+ u16 ppb_threshold;
+
+ /**
+ * Surplus of Bandwidth
+ */
+ u16 surplus_bw;
+
+};
+typedef struct cp_link_qmp_t cp_link_qmp_t;
+
+/**
+ * Status of the link
+ * NONE : not present in the connection
+ * LOCAL : local link
+ * GLOBAL : global link
+ */
+enum cp_link_type_t
+{
+ CP_LINK_TYPE_NONE,
+ CP_LINK_TYPE_LOCAL,
+ CP_LINK_TYPE_GLOBAL
+};
+typedef enum cp_link_type_t cp_link_type_t;
+
+/**
+ * Structure of a link.
+ */
+struct cp_link_t
+{
+ /** Link status */
+ cp_link_type_t status;
+
+ /** LLID */
+ u8 llid;
+
+ /** GLID */
+ u8 glid;
+
+ /** CINFO */
+ cp_link_cinfo_t *cinfo;
+
+ /** QMP */
+ cp_link_qmp_t *qmp;
+
+ /** BLEs */
+ list_t list_ble;
+
+};
+typedef struct cp_link_t cp_link_t;
+
+/**
+ * Initialise the memory taken buy a link
+ * \param void no argument
+ *
+ */
+cp_link_t*
+cp_link_init (void);
+
+/**
+ * Clear the Memory taken buy a specific link.
+ * \param link link to flush
+ *
+ */
+void
+cp_link_uninit (cp_link_t *link);
+
+/**
+ * Returns the first BLE
+ * \param ctx Control Plane Context
+ * \return First BLE
+ *
+ */
+cp_link_ble_interval_t*
+cp_link_get_first_ble(cp_link_t *link);
+
+/**
+ * Returns the prev BLE
+ * \param ble Actual BLE
+ * \return Previous BLE
+ *
+ */
+cp_link_ble_interval_t*
+cp_link_get_prev_ble(cp_link_ble_interval_t* ble);
+
+/**
+ * Returns the next BLE
+ * \param ble Actual BLE
+ * \return Next BLE
+ *
+ */
+cp_link_ble_interval_t*
+cp_link_get_next_ble(cp_link_ble_interval_t* ble);
+
+#endif /* cp_link_h */
diff --git a/cesar/cp/conn/src/conn.c b/cesar/cp/conn/src/conn.c
new file mode 100644
index 0000000000..9084be1b15
--- /dev/null
+++ b/cesar/cp/conn/src/conn.c
@@ -0,0 +1,216 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file conn.c
+ * \brief conn
+ * \ingroup cp_conn
+ *
+ * Control the schedule of the becon period
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/bw/bw_prio_heap.h"
+
+#include "lib/blk.h"
+#include <stdio.h>
+
+cp_conn_t*
+cp_conn_init_conn(cp_t *ctx)
+{
+ cp_conn_t *conn;
+
+ dbg_assert(ctx);
+
+ conn = blk_alloc();
+ conn->flink = cp_link_init();
+ conn->rlink = cp_link_init();
+
+ conn->conn_info.lid_f = &conn->flink->llid;
+ conn->conn_info.lid_r = &conn->rlink->llid;
+ conn->conn_info.cspec.f_cinfo = conn->flink->cinfo;
+ conn->conn_info.cspec.f_cinfo = conn->flink->cinfo;
+ conn->conn_info.cspec.r_cinfo = conn->rlink->cinfo;
+ conn->conn_info.cspec.f_qmp = conn->flink->qmp;
+ conn->conn_info.cspec.r_qmp = conn->rlink->qmp;
+ conn->new_conn_state = CP_CONN_STATE_OUT;
+ conn->old_conn_state = CP_CONN_STATE_OUT;
+
+ list_init_node (&conn->node);
+
+ return conn;
+}
+
+cp_conn_t*
+cp_conn_get_conn(cp_t *ctx, u16 cid)
+{
+ cp_conn_t *conn;
+
+ dbg_assert(ctx);
+
+ conn = cp_conn_get_first_conn(ctx);
+
+ while(conn &&
+ conn->conn_info.cid != cid)
+ conn = cp_conn_get_next_conn(ctx, conn);
+
+ return conn;
+}
+
+void
+cp_conn_add_conn(cp_t *ctx, cp_conn_t *conn)
+{
+ dbg_assert(ctx);
+ dbg_assert(conn);
+
+ /*Add the connection into the BW module*/
+ cp_cco_bw_prio_heap_add_conn(ctx,
+ conn->conn_info.cid,
+ conn->conn_info.cspec.f_cinfo->user_priority);
+
+ list_push(&ctx->conn_mgr.conns, &conn->node);
+}
+
+void
+cp_conn_del_conn(cp_t *ctx, u16 cid)
+{
+ cp_conn_t *conn = NULL;
+
+ dbg_assert(ctx);
+
+ conn = cp_conn_get_conn(ctx, cid);
+
+ cp_link_uninit(conn->flink);
+ cp_link_uninit(conn->rlink);
+ blk_release(conn->flink);
+ blk_release(conn->rlink);
+
+ /*Remove the connection in the BW module*/
+ cp_cco_bw_prio_heap_del_conn(ctx, cid);
+
+ list_remove(&ctx->conn_mgr.conns, &conn->node);
+ blk_release(conn);
+}
+
+u8
+cp_conn_get_free_llid(cp_t *ctx)
+{
+ u8 llid = MAC_PLID_MAX;
+ cp_conn_t *conn;
+
+ dbg_assert(ctx);
+
+ conn = cp_conn_get_first_conn(ctx);
+
+ if(conn)
+ {
+ do
+ {
+ conn = cp_conn_get_first_conn(ctx);
+ llid++;
+
+ while(conn
+ && (conn->flink->llid != llid && conn->rlink->llid != llid))
+ conn = cp_conn_get_next_conn(ctx, conn);
+ }
+ while(conn
+ && llid <= MAC_LLID_MAX);
+
+ if(conn)
+ llid = 0;
+ }
+ else
+ llid = MAC_LLID_MIN;
+
+ return llid;
+}
+
+u8
+cp_conn_get_free_glid(cp_t *ctx)
+{
+ u8 glid = MAC_LLID_MAX;
+ cp_conn_t *conn;
+
+ dbg_assert(ctx);
+
+ conn = cp_conn_get_first_conn(ctx);
+
+ if(conn)
+ {
+ do
+ {
+ conn = cp_conn_get_first_conn(ctx);
+ glid++;
+
+ while(conn
+ && (conn->flink->glid != glid && conn->rlink->glid != glid))
+ conn = cp_conn_get_next_conn(ctx, conn);
+ }
+ while(conn
+ && glid <= MAC_GLID_MAX);
+
+ if(conn)
+ glid = 0;
+ }
+ else
+ glid = MAC_GLID_MIN;
+
+ return glid;
+}
+
+u8
+cp_conn_get_request_id(cp_t *ctx, u16 cid)
+{
+ dbg_assert(ctx);
+
+ return cp_conn_get_conn(ctx, cid)->request_id;
+}
+
+cp_conn_t*
+cp_conn_get_next_conn(cp_t *ctx, cp_conn_t *conn)
+{
+ cp_conn_t *next_conn;
+
+ dbg_assert(ctx);
+ dbg_assert(conn);
+
+ if(&conn->node != list_rbegin(&ctx->conn_mgr.conns))
+ next_conn = PARENT_OF(cp_conn_t, node, list_next(&conn->node));
+ else
+ next_conn = NULL;
+
+ return next_conn;
+}
+
+cp_conn_t*
+cp_conn_get_first_conn(cp_t *ctx)
+{
+ cp_conn_t *conn;
+
+ dbg_assert(ctx);
+
+ if(!list_empty(&ctx->conn_mgr.conns))
+ conn = PARENT_OF(cp_conn_t, node, list_begin(&ctx->conn_mgr.conns));
+ else
+ conn = NULL;
+
+ return conn;
+}
+
+u8
+cp_conn_check_conn_validity(cp_t *ctx, cp_conn_t *conn)
+{
+ return 0x00;
+}
diff --git a/cesar/cp/conn/src/conn_mgr.c b/cesar/cp/conn/src/conn_mgr.c
new file mode 100644
index 0000000000..89d06bc667
--- /dev/null
+++ b/cesar/cp/conn/src/conn_mgr.c
@@ -0,0 +1,457 @@
+ /* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file conn_mgr.c
+ * \brief conn mgr
+ * \ingroup cp_conn
+ *
+ */
+#include "common/std.h"
+#include "cl/inc/cl_mactotei.h"
+#include "lib/blk.h"
+#include "cp/types.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/conn_mgr.h"
+
+#include "cp/sta/mgr/sta_own_data.h"
+#include "cp/sta/mgr/sta_mgr.h"
+
+void
+cp_conn_mgr_init(cp_t *ctx)
+{
+ dbg_assert(ctx);
+
+ list_init(&ctx->conn_mgr.conns);
+}
+
+void
+cp_conn_mgr_uninit(cp_t *ctx)
+{
+ cp_conn_t *conn;
+
+ dbg_assert(ctx);
+
+ while(!list_empty(&ctx->conn_mgr.conns))
+ {
+ conn = PARENT_OF(cp_conn_t, node, list_begin(&ctx->conn_mgr.conns));
+ cp_link_uninit(conn->flink);
+ cp_link_uninit(conn->rlink);
+ list_remove(&ctx->conn_mgr.conns, &conn->node);
+ blk_release(conn);
+ }
+}
+
+void
+cp_conn_mgr_process_cm_conn_new_req(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+ cp_sta_t *sta;
+ cp_net_t *net;
+
+ cp_msg_cm_conn_new_req_t received_data;
+ cp_msg_apcm_conn_add_ind_t send_data;
+
+ cp_msg_cm_conn_new_req_receive(ctx, mme, &received_data);
+
+ net = cp_sta_mgr_get_our_avln(ctx);
+ sta = cp_net_get_sta(ctx, net, mme->peer.tei);
+
+ /* Init conn */
+ conn = cp_conn_init_conn(ctx);
+
+ /* Init conn info */
+ conn->conn_info.cid = received_data.cid;
+ conn->conn_info.stei = mme->peer.tei;
+ conn->conn_info.dtei = cp_sta_own_data_get_tei(ctx);
+
+ if(received_data.cspec->f_cinfo->valid_cinfo)
+ {
+ conn->flink->llid = (u8)received_data.cid;
+ conn->flink->cinfo = received_data.cspec->f_cinfo;
+ conn->flink->qmp = received_data.cspec->f_qmp;
+ }
+
+ if(received_data.cspec->r_cinfo->valid_cinfo)
+ {
+ conn->rlink->llid = cp_conn_get_free_llid(ctx);
+ conn->rlink->cinfo = received_data.cspec->r_cinfo;
+ conn->rlink->qmp = received_data.cspec->r_qmp;
+ }
+
+ /* Conn state OUT */
+ conn->new_conn_state = CP_CONN_STATE_OUT;
+ conn->old_conn_state = CP_CONN_STATE_OUT;
+ conn->type = CP_CONN_TYPE_UNICAST;
+
+ /* Add the connection */
+ cp_conn_add_conn(ctx, conn);
+
+ /* Initiate MME */
+ send_data.cid = received_data.cid;
+ send_data.oda = cp_sta_own_data_get_mac_address(ctx);
+ send_data.osa = cp_sta_get_mac_address(sta);
+ send_data.cspec = received_data.cspec;
+
+ /* Send the request to the HLE */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_apcm_conn_add_ind_send(ctx,
+ CP_MME_PEER(send_data.osa),
+ &send_data);
+}
+
+void
+cp_conn_mgr_process_cm_conn_new_cnf(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+
+ cp_msg_cm_conn_new_cnf_t received_data;
+ cp_msg_apcm_conn_add_cnf_t send_data;
+
+ cp_msg_cm_conn_new_cnf_receive(ctx,
+ mme,
+ &received_data);
+
+ /* Init the data of the MME to send to the HLE */
+ send_data.cid = received_data.cid;
+ send_data.oda = conn->oda;
+ send_data.osa = conn->osa;
+ send_data.result = received_data.result;
+ send_data.request_id = cp_conn_get_request_id(ctx, received_data.cid);
+ send_data.proposed_cspec = received_data.proposed_cspec;
+
+ conn = cp_conn_get_conn(ctx, received_data.cid);
+
+ /* Send the MME to the HLE */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_apcm_conn_add_cnf_send(ctx,
+ mme->peer,
+ &send_data);
+ /* Valid result */
+ if(!received_data.result)
+ conn->rlink->llid = received_data.llid_r;
+
+ /* Unvalid result */
+ else
+ cp_conn_del_conn(ctx, received_data.cid);
+}
+
+void
+cp_conn_mgr_process_cm_conn_rel_ind(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+
+ cp_msg_cm_conn_rel_ind_t received_data;
+ cp_msg_apcm_conn_rel_ind_t send_ind_data;
+ cp_msg_cm_conn_rel_rsp_t send_rsp_data;
+
+ conn = cp_conn_get_conn(ctx, received_data.cid);
+ cp_msg_cm_conn_rel_ind_receive(ctx, mme, &received_data);
+
+ /* Init the IND to the HLE */
+ send_ind_data.cid = received_data.cid;
+ send_ind_data.reason_code = received_data.reason_code;
+ send_ind_data.releasing_mac_add = mme->peer.mac;
+ send_ind_data.proposed_cspec = NULL;
+ send_ind_data.violated_cspec = received_data.violated_cspec;
+
+ /* Send MME */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_apcm_conn_rel_ind_send(ctx,
+ CP_MME_PEER(mme->peer.mac),
+ &send_ind_data);
+
+ /* Init the RSP */
+ send_rsp_data.cid = received_data.cid;
+
+ /* Send MME */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_cm_conn_rel_rsp_send(ctx,
+ mme->peer,
+ &send_rsp_data);
+
+ /* Release conn */
+ cp_conn_del_conn(ctx, received_data.cid);
+}
+
+void
+cp_conn_mgr_process_cm_conn_rel_rsp(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_msg_cm_conn_rel_rsp_t received_data;
+
+ cp_msg_cm_conn_rel_rsp_receive(ctx, mme, &received_data);
+
+ /* TODO Add a value into sta.h to count the number of connection that released the connection. If
+ * all the connections didnt released the connection find a way to ask
+ * them again regarding their tei.*/
+}
+
+void
+cp_conn_mgr_process_cm_conn_mod_req(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+
+ cp_msg_cm_conn_mod_req_t received_data;
+ cp_msg_apcm_conn_mod_ind_t send_data;
+
+ cp_msg_cm_conn_mod_req_receive(ctx, mme, &received_data);
+
+ conn = cp_conn_get_conn(ctx, received_data.cid);
+
+ /* Init IND MME */
+ send_data.cid = received_data.cid;
+ send_data.modified_cspec = received_data.modified_cspec;
+ send_data.cause = 0x00;
+
+ /* Send MME */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_apcm_conn_mod_ind_send(ctx,
+ CP_MME_PEER(mme->peer.mac),
+ &send_data);
+
+ /* Storage of the modified CSPEC until we get the answer of the HLE */
+ conn->modified_cspec = *received_data.modified_cspec;
+}
+
+void
+cp_conn_mgr_process_cm_conn_mod_cnf(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+ cp_msg_cm_conn_mod_cnf_t received_data;
+ cp_msg_apcm_conn_mod_cnf_t send_data;
+
+ cp_msg_cm_conn_mod_cnf_receive(ctx, mme, &received_data);
+
+ conn = cp_conn_get_conn(ctx, received_data.cid);
+
+ /*If UNICAST*/
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ {
+ send_data.cid = received_data.cid;
+ send_data.result = received_data.result;
+ send_data.proposed_cspec = received_data.proposed_cspec;
+
+ /*cp_msg_apcm_conn_mod_cnf_send(ctx,
+ CP_MME_PEER(mme->peer.mac),
+ &send_data);*/
+ }
+
+ /* TODO broad/multi req have to wait for every sta involved to answer*/
+}
+
+void
+cp_conn_mgr_process_cm_conn_info_req(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_msg_cm_conn_info_req_t received_data;
+
+ cp_msg_cm_conn_info_req_receive(ctx, mme, &received_data);
+
+ /* TODO Send the data to the requested destination */
+}
+
+void
+cp_conn_mgr_process_cm_conn_info_cnf(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_msg_cm_conn_info_cnf_t received_data;
+
+ cp_msg_cm_conn_info_cnf_receive(ctx, mme, &received_data);
+
+ /* TODO find out what to do with the data */
+}
+
+void
+cp_conn_mgr_process_apcm_conn_add_req(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ u16 cid;
+
+ cp_net_t *net;
+
+ cp_conn_t *conn;
+
+ cp_msg_apcm_conn_add_req_t received_data;
+ cp_msg_cm_conn_new_req_t send_data;
+
+ net = cp_sta_mgr_get_our_avln(ctx);
+
+ cp_msg_apcm_conn_add_req_receive(ctx, mme, &received_data);
+
+ /* Init conn */
+ conn = cp_conn_init_conn(ctx);
+
+ /* Init conn info */
+ conn->flink->llid = cp_conn_get_free_llid(ctx);
+ conn->conn_info.stei = cp_sta_own_data_get_tei(ctx);
+ conn->conn_info.dtei = cl_mactotei_table_find_tei_from_mac(NULL, received_data.oda);
+
+ if(received_data.cspec->f_cinfo->valid_cinfo)
+ {
+ conn->flink->llid = cp_conn_get_free_llid(ctx);
+ conn->flink->cinfo = received_data.cspec->f_cinfo;
+ conn->flink->qmp = received_data.cspec->f_qmp;
+ }
+
+ if(received_data.cspec->r_cinfo->valid_cinfo)
+ {
+ conn->rlink->llid = cp_conn_get_free_llid(ctx);
+ conn->rlink->cinfo = received_data.cspec->r_cinfo;
+ conn->rlink->qmp = received_data.cspec->r_qmp;
+ }
+
+ conn->request_id = received_data.request_id;
+ conn->oda = received_data.oda;
+ conn->osa = received_data.osa;
+
+ /* Get CID of the connection*/
+ cid = conn->conn_info.stei;
+ cid = cid << 8;
+ cid = cid + conn->flink->llid;
+
+ conn->conn_info.cid = cid;
+
+ /* Add the connection to the list */
+ cp_conn_add_conn(ctx, conn);
+
+ /* Init MME */
+ send_data.cid = cid;
+ send_data.cspec = received_data.cspec;
+
+ /* Send MME */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_cm_conn_new_req_send(ctx,
+ CP_MME_PEER(received_data.oda,
+ conn->conn_info.dtei),
+ &send_data);
+
+}
+
+void
+cp_conn_mgr_process_apcm_conn_add_rsp(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+ cp_msg_apcm_conn_add_rsp_t received_data;
+ cp_msg_cm_conn_new_cnf_t send_data;
+
+ cp_msg_apcm_conn_add_rsp_receive(ctx, mme, &received_data);
+
+ conn = cp_conn_get_conn(ctx, received_data.cid);
+
+ /* Init RSP MME */
+ send_data.cid = received_data.cid;
+ send_data.llid_r = conn->rlink->llid;
+ send_data.result = received_data.result;
+ send_data.proposed_cspec = received_data.cspec;
+
+ /* Send MME */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_cm_conn_new_cnf_send(ctx,
+ CP_MME_PEER(conn->osa, conn->conn_info.stei),
+ &send_data);
+
+ /* Study the result */
+ if (!received_data.result)
+ cp_conn_del_conn(ctx, received_data.cid);
+
+}
+
+void
+cp_conn_mgr_process_apcm_conn_mod_req(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+ cp_msg_apcm_conn_mod_req_t received_data;
+ cp_msg_cm_conn_mod_req_t send_data;
+
+ cp_msg_apcm_conn_mod_req_receive(ctx, mme, &received_data);
+
+ conn = cp_conn_get_conn(ctx, received_data.cid);
+
+ /* Modify the CSPEC */
+ if(received_data.cspec->f_cinfo->valid_cinfo)
+ {
+ conn->flink->llid = cp_conn_get_free_llid(ctx);
+ conn->flink->cinfo = received_data.cspec->f_cinfo;
+ conn->flink->qmp = received_data.cspec->f_qmp;
+ }
+
+ if(received_data.cspec->r_cinfo->valid_cinfo)
+ {
+ conn->rlink->llid = cp_conn_get_free_llid(ctx);
+ conn->rlink->cinfo = received_data.cspec->r_cinfo;
+ conn->rlink->qmp = received_data.cspec->r_qmp;
+ }
+
+ /* Init rep MME */
+ send_data.cid = received_data.cid;
+ send_data.modified_cspec = received_data.cspec;
+
+ /* Send MME */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_cm_conn_mod_req_send(ctx,
+ CP_MME_PEER(conn->oda, conn->conn_info.dtei),
+ &send_data);
+}
+
+void
+cp_conn_mgr_process_apcm_conn_mod_rsp(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+ cp_msg_apcm_conn_mod_rsp_t received_data;
+ cp_msg_cm_conn_mod_cnf_t send_data;
+
+ cp_msg_apcm_conn_mod_rsp_receive(ctx, mme, &received_data);
+
+ conn = cp_conn_get_conn(ctx,received_data.cid);
+
+ /* Init rsp MME */
+ send_data.cid = received_data.cid;
+ send_data.result = received_data.result;
+ send_data.proposed_cspec = received_data.proposed_cspec;
+
+ /*If the modification is a success we change the cspec*/
+ if(received_data.result == 0x00)
+ {
+ conn->conn_info.cspec = conn->modified_cspec;
+ send_data.proposed_cspec->f_cinfo->valid_cinfo = 0x00;
+ send_data.proposed_cspec->r_cinfo->valid_cinfo = 0x00;
+ }
+
+ /* Send MME */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_cm_conn_mod_cnf_send(ctx,
+ CP_MME_PEER(conn->osa, conn->conn_info.stei),
+ &send_data);
+}
+
+void
+cp_conn_mgr_process_apcm_conn_rel_req(cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_conn_t *conn;
+ cp_msg_apcm_conn_rel_req_t received_data;
+ cp_msg_cm_conn_rel_ind_t send_data;
+
+ cp_msg_apcm_conn_rel_req_receive(ctx, mme, &received_data);
+
+ /* Init the release req MME*/
+ send_data.cid = received_data.cid;
+ send_data.reason_code = 0x00;
+ send_data.violated_cspec = NULL;
+
+ conn = cp_conn_get_conn(ctx, received_data.cid);
+
+ /* Send MME */
+ if(conn->type == CP_CONN_TYPE_UNICAST)
+ cp_msg_cm_conn_rel_ind_send(ctx,
+ CP_MME_PEER(conn->oda,conn->conn_info.dtei),
+ &send_data);
+
+}
+
diff --git a/cesar/cp/conn/src/link.c b/cesar/cp/conn/src/link.c
new file mode 100644
index 0000000000..8c0c383b93
--- /dev/null
+++ b/cesar/cp/conn/src/link.c
@@ -0,0 +1,101 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file link.c
+ * \brief link management
+ * \ingroup cp/conn
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "lib/blk.h"
+#include "lib/slab.h"
+
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+
+#include <stdio.h>
+
+cp_link_t*
+cp_link_init (void)
+{
+ cp_link_t *link;
+
+ link = blk_alloc();
+ link->cinfo = blk_alloc();
+ link->qmp = blk_alloc();
+
+ list_init(&link->list_ble);
+
+ return link;
+}
+
+void
+cp_link_uninit (cp_link_t *link)
+{
+ blk_release(link->cinfo);
+ blk_release(link->qmp);
+ cp_link_release_ble (link);
+ blk_release(link);
+}
+
+void
+cp_link_push_ble(cp_link_t *link, u16 ble, u16 et_atu)
+{
+ cp_link_ble_interval_t *new;
+
+ dbg_assert(link);
+
+ new = blk_alloc();
+ new->ble = ble;
+ new->et_atu = et_atu;
+ list_init_node(&new->node);
+
+ list_push(&link->list_ble, &new->node);
+}
+
+void
+cp_link_release_ble(cp_link_t *link)
+{
+ dbg_assert(link);
+ cp_link_ble_interval_t *tmp_ble;
+
+ while(!list_empty(&link->list_ble))
+ {
+ tmp_ble = PARENT_OF(cp_link_ble_interval_t,
+ node, list_begin(&link->list_ble));
+ list_remove(&link->list_ble, &tmp_ble->node);
+
+ blk_release(tmp_ble);
+ }
+}
+
+cp_link_ble_interval_t*
+cp_link_get_first_ble(cp_link_t *link)
+{
+ return PARENT_OF(cp_link_ble_interval_t, node,
+ list_begin(&link->list_ble));
+}
+
+cp_link_ble_interval_t*
+cp_link_get_next_ble(cp_link_ble_interval_t* ble)
+{
+ return PARENT_OF(cp_link_ble_interval_t, node, list_next(&ble->node));
+}
+
+cp_link_ble_interval_t*
+cp_link_get_prev_ble(cp_link_ble_interval_t* ble)
+{
+ return PARENT_OF(cp_link_ble_interval_t, node, list_prev(&ble->node));
+}
diff --git a/cesar/cp/conn/test/Makefile b/cesar/cp/conn/test/Makefile
new file mode 100644
index 0000000000..f155086095
--- /dev/null
+++ b/cesar/cp/conn/test/Makefile
@@ -0,0 +1,14 @@
+BASE = ../../..
+
+ECOS=y
+INCLUDES = cp/conn/test/overide/
+
+TARGET_PROGRAMS = conn_test conn_mgr_test
+
+conn_test_SOURCES = conn_test.c msg_stub.c pwl_stub.c fsm_stub.c
+conn_test_MODULES = lib cp/conn cp/sta/mgr cl cp/cco/bw mac/common
+
+conn_mgr_test_SOURCES = conn_mgr_test.c msg_stub.c pwl_stub.c fsm_stub.c
+conn_mgr_test_MODULES = lib cp/conn cp/sta/mgr cl cp/cco/bw mac/common
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/conn/test/ecos.ecc.sh b/cesar/cp/conn/test/ecos.ecc.sh
new file mode 100644
index 0000000000..8253d98c9a
--- /dev/null
+++ b/cesar/cp/conn/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/conn/test/overide/cp_fsm_defs.h b/cesar/cp/conn/test/overide/cp_fsm_defs.h
new file mode 100644
index 0000000000..c29fa69e19
--- /dev/null
+++ b/cesar/cp/conn/test/overide/cp_fsm_defs.h
@@ -0,0 +1,38 @@
+#ifndef overide_cp_fsm_defs_h
+#define overide_cp_fsm_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp_fsm_defs.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_all_sta_leaved,
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* overide_cp_fsm_defs_h */
diff --git a/cesar/cp/conn/test/src/conn_mgr_test.c b/cesar/cp/conn/test/src/conn_mgr_test.c
new file mode 100644
index 0000000000..6cf0c28929
--- /dev/null
+++ b/cesar/cp/conn/test/src/conn_mgr_test.c
@@ -0,0 +1,95 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file conn_mgr_test.c
+ * \brief Connection manager test
+ *
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/mme.h"
+
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/conn_mgr.h"
+
+#include "lib/test.h"
+
+void
+test_case_conn_mgr_init(test_t test, cp_t *cp)
+{
+
+ test_case_begin(test, "conn init");
+
+ cp_conn_mgr_init(cp);
+
+ test_begin(test, "conn init")
+ {
+ test_fail_if(!list_empty(&cp->conn_mgr.conns),
+ "the conn list should be empty");
+ }
+ test_end;
+}
+
+void
+test_case_conn_mgr_uninit(test_t test, cp_t *cp)
+{
+ test_case_begin(test, "conn uninit");
+
+ cp_conn_mgr_uninit(cp);
+
+ test_begin(test, "conn uninit")
+ {
+ test_fail_if(!list_empty(&cp->conn_mgr.conns),
+ "the conn list should be empty");
+
+ test_fail_if(!blk_check_memory,
+ "Memory pb in the Conn module");
+ }
+ test_end;
+}
+
+void
+test_case_conn_mgr_process_apcm_conn_add_req(test_t test)
+{
+ cp_t cp;
+ cp_mme_rx_t *mme = NULL;
+
+ test_case_begin(test, "apcm conn add req");
+
+ test_case_conn_mgr_init(test, &cp);
+
+ cp_conn_mgr_process_apcm_conn_add_req(&cp, mme);
+
+ test_begin(test, "apcm conn add req")
+ {
+ test_fail_if(list_empty(&cp.conn_mgr.conns),
+ "the conn list should be empty");
+
+ }
+ test_end;
+
+ test_case_conn_mgr_uninit(test, &cp);
+}
+
+int
+main (void){
+ test_t test;
+
+ test_init(test, 0, NULL);
+
+// test_case_conn_mgr_process_apcm_conn_add_req(test);
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+
+}
diff --git a/cesar/cp/conn/test/src/conn_test.c b/cesar/cp/conn/test/src/conn_test.c
new file mode 100644
index 0000000000..6faefc2cfc
--- /dev/null
+++ b/cesar/cp/conn/test/src/conn_test.c
@@ -0,0 +1,300 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file bw.c
+ * \brief bandwidth manager module
+ * \ingroup cp_cco_bw
+ *
+ * Control the schedule of the becon period
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "cp/conn/link.h"
+#include "cp/conn/inc/link.h"
+#include "cp/conn/conn.h"
+#include "cp/conn/inc/conn.h"
+#include "cp/conn/conn_mgr.h"
+
+#include "cp/pwl/pwl.h"
+#include "mac/common/timings.h"
+
+#include "lib/blk.h"
+#include "lib/list.h"
+#include "lib/test.h"
+
+#include <stdio.h>
+
+void
+test_case_conn_init(test_t test, cp_t *cp)
+{
+
+ test_case_begin(test, "conn init");
+
+ cp_conn_mgr_init(cp);
+
+ test_begin(test, "conn init")
+ {
+ test_fail_if(!list_empty(&cp->conn_mgr.conns),
+ "the conn list should be empty");
+ }
+ test_end;
+}
+
+void
+test_case_conn_uninit(test_t test, cp_t *cp)
+{
+ test_case_begin(test, "conn uninit");
+
+ cp_conn_mgr_uninit(cp);
+
+ test_begin(test, "conn uninit")
+ {
+ test_fail_if(!list_empty(&cp->conn_mgr.conns),
+ "the conn list should be empty");
+
+ test_fail_if(!blk_check_memory,
+ "Memory pb in the Conn module");
+ }
+ test_end;
+}
+
+void
+test_case_conn_add_conn (test_t test, cp_t *cp)
+{
+
+ int i,j;
+ cp_conn_t *conn[3];
+ cp_conn_t *test_conn[3];
+ u16 beacon_period_atu;
+
+ cp_link_ble_interval_t *tmp_ble;
+ cp_link_ble_interval_t *test_ble[3][10];
+
+ list_node_t *actual_node;
+
+ cp_cco_bw_init(cp);
+ cp_conn_mgr_init(cp);
+
+ beacon_period_atu = MAC_TCK_TO_ATU(cp->pwl.bp_avln_ntb[2] - cp->pwl.bp_avln_ntb[1]);
+
+ test_case_begin(test, "\nadd connection");
+
+ /* init conn*/
+
+ for(i=0;i<3;i++)
+ {
+ /*add conn*/
+ conn[i] = cp_conn_init_conn(cp);
+
+ conn[i]->flink->llid = 0;
+ conn[i]->rlink->llid = 0;
+
+ cp_conn_add_conn(cp, conn[i]);
+
+ conn[i]->conn_info.cid = i+10;
+ conn[i]->flink->llid = cp_conn_get_free_llid(cp);
+ conn[i]->rlink->llid = cp_conn_get_free_llid(cp);
+ conn[i]->flink->glid = cp_conn_get_free_glid(cp);
+ conn[i]->rlink->glid = cp_conn_get_free_glid(cp);
+
+ conn[i]->conn_info.cspec.f_cinfo->user_priority = 0;
+ }
+
+ /* init forward ble*/
+ for(j=0;j<3;j++)
+ {
+ for(i=0;i<10;i++)
+ {
+ cp_link_push_ble(conn[j]->flink,(i+1)*20,
+ ((i+1)*beacon_period_atu/10));
+ cp_link_push_ble(conn[j]->rlink,(i+1)*10,
+ (i+1)*(beacon_period_atu/10));
+ }
+ }
+ /*Get back the connection for the tests*/
+ actual_node = list_begin(&cp->conn_mgr.conns);
+
+ for(i=0;i<3;i++)
+ {
+ test_conn[i] = PARENT_OF(cp_conn_t,node,actual_node);
+ actual_node = list_next(actual_node);
+ }
+
+ /*Get back the ble for the tests*/
+ actual_node = list_begin(&cp->conn_mgr.conns);
+
+ for(j = 0;j<3;j++)
+ {
+ tmp_ble = PARENT_OF(cp_link_ble_interval_t,node,list_begin(&test_conn[j]->flink->list_ble));
+
+ for(i = 0; i<10; i++)
+ {
+ test_ble[j][i] = tmp_ble;
+ tmp_ble = PARENT_OF(cp_link_ble_interval_t,node,list_next(&tmp_ble->node));
+ }
+ }
+
+ test_begin(test,"add connection")
+ {
+ test_fail_if(test_ble[0][0]->ble != 20,
+ "wrong ble init of the conn");
+ test_fail_if(test_ble[1][1]->ble != 40,
+ "wrong ble init of the conn");
+ test_fail_if(test_ble[2][2]->ble != 60,
+ "wrong ble init of the conn");
+
+ test_fail_if(test_ble[0][2]->et_atu != (3*beacon_period_atu/10),
+ "wrong init end time of the conn");
+ test_fail_if(test_ble[1][6]->et_atu != (7*beacon_period_atu/10),
+ "wrong init end time of the conn");
+ test_fail_if(test_ble[2][9]->et_atu != (10*beacon_period_atu/10),
+ "wrong init end time of the conn");
+
+ test_fail_if(conn[0]->flink->llid !=0x04,
+ "lid init pb 0");
+ test_fail_if(conn[1]->rlink->llid !=0x07,
+ "lid init pb 1");
+ test_fail_if(conn[2]->flink->llid !=0x08,
+ "lid init pb 2");
+
+ test_fail_if(conn[0]->flink->glid !=0x80,
+ "glid init pb 0");
+ test_fail_if(conn[1]->rlink->glid !=0x83,
+ "glid init pb 1");
+ test_fail_if(conn[2]->flink->glid !=0x84,
+ "glid init pb 2");
+ }
+ test_end;
+}
+
+void
+test_case_conn_del_conn(test_t test)
+{
+ cp_t cp;
+
+ int i;
+ cp_conn_t *conn[3] ;
+
+ list_node_t *actual_node;
+
+ test_case_conn_init(test, &cp);
+
+ test_case_begin(test, "\nget connection");
+
+ test_case_conn_add_conn(test, &cp);
+
+ /*Get back the connection for the tests*/
+ actual_node = list_begin(&cp.conn_mgr.conns);
+
+ for(i=0;i<3;i++)
+ {
+ conn[i] = PARENT_OF(cp_conn_t,node,actual_node);
+ actual_node = list_next(actual_node);
+ cp_conn_del_conn(&cp, i+10);
+ }
+
+ test_begin(test,"get connection")
+ {
+ test_fail_if(list_empty(&cp.conn_mgr.conns)!=true,
+ "their shouldnt be any conn");
+ }
+ test_end;
+
+ test_case_conn_uninit(test, &cp);
+
+}
+
+void
+test_case_conn_get_conn (test_t test)
+{
+ cp_t cp;
+
+ int i,j;
+ cp_conn_t *conn[3] ;
+ u16 beacon_period_atu;
+
+ cp_link_ble_interval_t *tmp_ble;
+ cp_link_ble_interval_t *test_ble[3][10];
+
+ list_node_t *actual_node;
+
+ cp_pwl_init(&cp);
+
+ test_case_conn_init(test, &cp);
+
+ beacon_period_atu = MAC_TCK_TO_ATU(cp.pwl.bp_avln_ntb[2] - cp.pwl.bp_avln_ntb[1]);
+
+ test_case_conn_add_conn(test, &cp);
+
+ test_case_begin(test, "\nget connection");
+
+ actual_node = list_begin(&cp.conn_mgr.conns);
+
+ for(i=0;i<3;i++)
+ {
+ conn[i] = cp_conn_get_conn(&cp,i+10);
+ actual_node = list_next(actual_node);
+ }
+
+ for(j = 0;j<3;j++)
+ {
+ tmp_ble = PARENT_OF(cp_link_ble_interval_t, node,list_begin(&conn[j]->flink->list_ble));
+
+ for(i = 0; i<10; i++)
+ {
+ test_ble[j][i] =tmp_ble;
+ tmp_ble = PARENT_OF(cp_link_ble_interval_t, node,list_next(&tmp_ble->node));
+ }
+ }
+
+ test_begin(test,"get connection")
+ {
+ test_fail_if(conn[0]->conn_info.cid != 10,
+ "wrong cid 0");
+ test_fail_if(conn[1]->conn_info.cid != 11,
+ "wrong cid 1");
+ test_fail_if(conn[2]->conn_info.cid != 12,
+ "wrong cid 2");
+
+ test_fail_if(test_ble[0][0]->ble != 20,
+ "wrong ble init of the conn");
+ test_fail_if(test_ble[1][1]->ble != 40,
+ "wrong ble init of the conn");
+ test_fail_if(test_ble[2][2]->ble != 60,
+ "wrong ble init of the conn");
+
+ test_fail_if(test_ble[0][2]->et_atu != (3*beacon_period_atu/10),
+ "wrong init end time of the conn");
+ test_fail_if(test_ble[1][6]->et_atu != (7*beacon_period_atu/10),
+ "wrong init end time of the conn");
+ test_fail_if(test_ble[2][9]->et_atu != (10*beacon_period_atu/10),
+ "wrong init end time of the conn");
+
+ }
+ test_end;
+
+ test_case_conn_uninit(test, &cp);
+}
+int
+main (void){
+ test_t test;
+
+ test_init(test, 0, NULL);
+
+ test_case_conn_del_conn(test);
+
+ test_case_conn_get_conn (test);
+
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+
+}
diff --git a/cesar/cp/conn/test/src/fsm_stub.c b/cesar/cp/conn/test/src/fsm_stub.c
new file mode 100644
index 0000000000..849f375270
--- /dev/null
+++ b/cesar/cp/conn/test/src/fsm_stub.c
@@ -0,0 +1,29 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
diff --git a/cesar/cp/conn/test/src/msg_stub.c b/cesar/cp/conn/test/src/msg_stub.c
new file mode 100644
index 0000000000..2c27653864
--- /dev/null
+++ b/cesar/cp/conn/test/src/msg_stub.c
@@ -0,0 +1,246 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file link.c
+ * \brief link management
+ * \ingroup cp/conn
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/conn/conn_mgr.h"
+#include "cp/conn/conn.h"
+#include "cp/conn/link.h"
+#include "cp/mme.h"
+/*************************/
+/*** CONN NEW ***/
+/*************************/
+
+void
+cp_msg_cm_conn_new_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_new_req_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_new_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_new_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_new_cnf_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_new_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_new_cnf_t *data)
+{
+ return true;
+}
+
+/*************************/
+/*** CONN REL ***/
+/*************************/
+
+void
+cp_msg_cm_conn_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_rel_ind_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_rel_ind_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_rel_ind_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_rel_rsp_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_rel_rsp_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_rel_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_rel_rsp_t *data)
+{
+ return true;
+}
+
+/*************************/
+/*** CONN MOD ***/
+/*************************/
+
+void
+cp_msg_cm_conn_mod_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_mod_req_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_mod_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_cm_conn_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_mod_cnf_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_mod_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_mod_cnf_t *data)
+{
+ return true;
+}
+
+/*************************/
+/*** CONN INFO ***/
+/*************************/
+void
+cp_msg_cm_conn_info_req_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_info_req_t *data)
+{
+}
+
+bool
+cp_msg_cm_conn_info_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_info_req_t *data)
+{
+ return true;
+}
+void
+cp_msg_cm_conn_info_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_cm_conn_info_cnf_t *data)
+{
+}
+bool
+cp_msg_cm_conn_info_cnf_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_cm_conn_info_cnf_t *data)
+{
+ return true;
+}
+/*************************/
+/*** APCM Family ***/
+/*************************/
+
+/*************************/
+/*** APCM CONN ADD ***/
+/*************************/
+
+bool
+cp_msg_apcm_conn_add_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_req_t *data)
+{
+ return true;
+}
+void
+cp_msg_apcm_conn_add_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_add_cnf_t *data)
+{
+}
+
+void
+cp_msg_apcm_conn_add_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_add_ind_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_add_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_add_rsp_t *data)
+{
+ return true;
+}
+/*************************/
+/*** APCM CONN REL ***/
+/*************************/
+
+bool
+cp_msg_apcm_conn_rel_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_rel_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_rel_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_rel_ind_t *data)
+{
+}
+
+void
+cp_msg_apcm_conn_rel_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_rel_cnf_t *data)
+{
+}
+/*************************/
+/*** APCM CONN MOD ***/
+/*************************/
+bool
+cp_msg_apcm_conn_mod_req_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_mod_req_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_mod_ind_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_mod_ind_t *data)
+{
+}
+
+bool
+cp_msg_apcm_conn_mod_rsp_receive(cp_t *ctx,
+ cp_mme_rx_t *mme,
+ cp_msg_apcm_conn_mod_rsp_t *data)
+{
+ return true;
+}
+
+void
+cp_msg_apcm_conn_mod_cnf_send(cp_t *ctx,
+ cp_mme_peer_t peer,
+ cp_msg_apcm_conn_mod_cnf_t *data)
+{
+}
diff --git a/cesar/cp/conn/test/src/pwl_stub.c b/cesar/cp/conn/test/src/pwl_stub.c
new file mode 100644
index 0000000000..968fd802b1
--- /dev/null
+++ b/cesar/cp/conn/test/src/pwl_stub.c
@@ -0,0 +1,73 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file link.c
+ * \brief link management
+ * \ingroup cp/conn
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "mac/common/timings.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/pwl/pwl.h"
+
+/**
+ * Initialise the pwl module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (&ctx->pwl, 0, sizeof (cp_pwl_t));
+ ctx->pwl.bp_avln_ntb [2] = MAC_ATU_TO_TCK(3906*2);
+ ctx->pwl.bp_avln_ntb [1] = MAC_ATU_TO_TCK(3906);
+}
+
+/**
+ * Compute the frequency of the power line using the pratic register.
+ * \param ctx the module context.
+ *
+ * It shall read the pratic register twice with a gap of 20 ms. This
+ * function shall update the data in the object. If the medium is a coaxial
+ * cable, the 50Hz will be chosen
+ *
+ * \warn Only call this function in a Thread.
+ */
+void
+cp_pwl_acl_frequency_detection (cp_t *ctx)
+{
+}
+
+/**
+ * Estimate the current beacon period.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_estimate_beacon_period (cp_t *ctx)
+{
+}
+
+/**
+ * Uninitialise the PWL module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_uninit (cp_t *ctx)
+{
+ dbg_assert (ctx);
+}
+
diff --git a/cesar/cp/cp.h b/cesar/cp/cp.h
new file mode 100644
index 0000000000..ecf5de8e6c
--- /dev/null
+++ b/cesar/cp/cp.h
@@ -0,0 +1,39 @@
+#ifndef cp_cp_h
+#define cp_cp_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/cp.h
+ * \brief Control plane public API's.
+ * \ingroup cp
+ *
+ */
+#include "cp/types.h"
+
+#include "mac/common/config.h"
+#include "interface/forward.h"
+
+/**
+ * Initialise the Control plane.
+ * \param mac_config Mac configuration context.
+ * \param interface Interface context.
+ * \return The control plane context.
+ *
+ */
+cp_t *
+cp_init (mac_config_t * mac_config, interface_t * interface);
+
+/**
+ * Initialise the control plane context.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_uninit (cp_t *ctx);
+
+#endif /* cp_h */
diff --git a/cesar/cp/defs.h b/cesar/cp/defs.h
new file mode 100644
index 0000000000..b3ca202bf7
--- /dev/null
+++ b/cesar/cp/defs.h
@@ -0,0 +1,93 @@
+#ifndef cp_defs_h
+#define cp_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/defs.h
+ * \brief Definition for the Control Plane.
+ * \ingroup cp
+ */
+
+#define CP_BENTRY_COUNTDOWN_DEFAULT 5
+
+/** CCo level. */
+#define CP_CCO_LEVEL 0
+
+/** PCo capability. */
+#define CP_PCO_CAP true
+
+/** Backup CCo Cap. */
+#define CP_BACKUP_CCO_CAP true
+
+/** Minimum size of NPW password. */
+#define CP_NPW_MIN_SIZE 8 // bytes
+#define CP_NPW_MAX_SIZE 64 // bytes
+
+/** Maximum size of HFID (human-friendly identifier). */
+#define CP_HFID_SIZE 64 // bytes
+
+/** NMK size. */
+#define CP_NMK_SIZE 16 // bytes
+
+/** Device password length. */
+#define CP_DPW_MIN_SIZE 16 // bytes
+#define CP_DPW_MAX_SIZE 64 // bytes
+
+/** Hash key size. */
+#define CP_HASH_KEY_SIZE 384
+
+/** Expiration delay for the station. */
+#define CP_STA_EXPIRATION_DELAY_S 70
+
+/** Expiration delay for the networks. */
+#define CP_NET_EXPIRATION_DELAY_S 70
+
+/** Unassociated STA Advertisement Interval. */
+#define CP_USAI_S 1
+
+/** Discover period in seconds. */
+#define CP_DISCOVER_PERIOD_MAX_S 10
+
+/** Maximum number of beacon loss because an AVLN failure. */
+#define CP_MAX_NO_BEACON 10
+
+/** Max schedules beacon periods. */
+#define CP_SCHED_BEACON_PERIODS_MAC 3
+
+/** Define the size of the NID. */
+#define CP_NID_SIZE 7
+
+/** Max payload size in bytes. */
+#define CP_MME_PAYLOAD_MAX_SIZE_WITH_VLAN 1495
+#define CP_MME_PAYLOAD_MAX_SIZE 1499
+
+/** Specific allocation time in ATU. Calulated from their size in byte and their
+ * transmission in ROBO modulation*/
+
+/*Beacon size 136 bytes, repetition 5 time*/
+#define CP_CCO_BW_ALLOC_TIME_BEACON_ATU 141
+
+/*CFPI size 4 ms recommended*/
+#define CP_CCO_BW_ALLOC_TIME_CFPI_ATU 390
+
+/*MinCSMA size 1500 µs recommended*/
+#define CP_CCO_BW_ALLOC_TIME_MINCSMA_ATU 147
+
+/*Protection of overrun. Value not into the hpAV spec.*/
+#define CP_CCO_BW_ALLOC_TIME_END_TDMA_PROTECTION_ATU 10
+
+/** Size of a PB in octet used to transport a MSDU */
+#define CP_CCO_BW_PB_SIZE_OCTET 520
+
+/** Number of Priority heaps */
+#define CP_CCO_BW_NB_PRIORITY_HEAPS 4
+
+/** minimal size of a CSMA allocation */
+#define CP_CCO_BW_MIN_CSMA_ALLOC_ATU 5
+
+#endif /* cp_defs_h */
diff --git a/cesar/cp/doc/Makefile b/cesar/cp/doc/Makefile
new file mode 100644
index 0000000000..d2f0e2946c
--- /dev/null
+++ b/cesar/cp/doc/Makefile
@@ -0,0 +1,48 @@
+TOP = archi
+PAGES =
+GRAPHS = overview mme_rx_handle
+
+DOTFLAGS =
+CONVERTFLAGS = -border 1 -bordercolor '\#d7d7d7'
+INKSCAPEFLAGS = -D -d 180
+
+TOOLS_DIR = ../../common/tools
+DOC_DIR = ../../common/doc
+SDL2DOT = $(TOOLS_DIR)/sdl2dot
+SDLPS = $(TOOLS_DIR)/sdl.ps
+EXTRACT_DOC = $(DOC_DIR)/extractdoc
+DOX2RST = $(DOC_DIR)/dox2rst
+
+all: png
+
+png: $(GRAPHS:%=%.png)
+ps: $(GRAPHS:%=%.ps)
+
+%.png: %.svg
+ inkscape $(INKSCAPEFLAGS) $< -e $@
+
+%.png: %.ps
+ convert $(CONVERTFLAGS) $< $@
+
+%.ps: %.dot Makefile
+ dot $(DOTFLAGS) -Tps -l $(SDLPS) -o $@ $<
+
+%.dot: %.sdl
+ $(SDL2DOT) $< > $@
+
+html: $(TOP:%=%.html)
+odt: $(TOP:%=%.odt)
+
+%.rst: ../%.h
+ $(EXTRACT_DOC) $< | $(DOX2RST) -s 50 > $@
+
+%.html: %.txt $(PAGES:%=%.rst) png
+ rst2html $< $@
+
+%.odt: %.txt $(PAGES:%=%.rst) png
+ rst2odt.py $< $@
+
+clean:
+ rm -f $(GRAPHS:%=%.ps) $(GRAPHS:%=%.png)
+ rm -f $(PAGES:%=%.rst) $(PAGES:%=%.html)
+ rm -f $(TOP:%=%.html) $(TOP:%=%.odt)
diff --git a/cesar/cp/doc/archi.txt b/cesar/cp/doc/archi.txt
new file mode 100644
index 0000000000..7c57298294
--- /dev/null
+++ b/cesar/cp/doc/archi.txt
@@ -0,0 +1,480 @@
+
+Overview
+========
+
+Control plane is centered on the *STA core* module which control execution
+flow.
+
+.. figure:: overview.png
+ :scale: 25
+
+ Control plane overview
+
+Modules
+-------
+
+- beacon: handle beacon reception, emission and beacon period related
+ functions (CA schedule, change count downs).
+
+ - spoc: generate data needed by the hardware to correct frequency errors.
+
+ - ntb: synchronise NTB on tracked beacon.
+
+- vstate_fsm: global FSM.
+
+- msg: message dispatching, encoding and decoding.
+
+- cl_interf: interface with the convergence layer, handle MME exchanges,
+ buffers and reassembly.
+
+- secu: encryption and security related library.
+
+- cco:
+
+ - action: CCo behaviour.
+
+ - bw: Bandwidth manager.
+
+ - region: Regions manager.
+
+- sta:
+
+ - core: handle execution flow.
+
+ - event_handler: interface to the FSM.
+
+ - action: STA behaviour (power-on procedure, association, driver
+ interface...)
+
+ - data: database containing STA own data, list of discovered AVLN and list
+ of STA for each AVLN.
+
+ - mgr: handle complex data manipulations.
+
+- conn: connection database.
+
+ - link: link database.
+
+Mechanisms
+==========
+
+Messages reception flow
+-----------------------
+
+Messages arrive at the *cl_interf* interface, in the CL context. The
+*cl_interf* module stores the message and its parameters in its FIFO and
+raises the *STA core* flag corresponding to *cl_interf*.
+
+When *STA core* sees the raised flag, it calls the *cl_interf* module back to
+handle the message in the CP context. The message is dropped if it is not
+addressed to our CP or has bad fragmentation information.
+
+If the received message is a fragment, its content is copied into blocks and
+appended in the reassembly context of the corresponding STA. If the message
+is not complete, stop here.
+
+The message is then given to the *msg* dispatch function. This function will
+handle encrypted messages, translate message types to FSM event, and post the
+corresponding event in the *event_handler* module.
+
+The *event_handler* module adds the event in the events FIFO and raises the
+*STA core* flag corresponding to *event_handler*.
+
+Once *STA core* sees this flag, it calls the *event_handler* module to handle
+waiting events in its FIFO. This function will pop the event from the FIFO,
+send it to the *FSM*, and finally release the event.
+
+The *FSM* module will call any function associated with the transitions
+triggered by the posted event. Usually, those functions will be located in
+the *STA action* or *CCo action* modules.
+
+A function handling a message will use the *msg* module to decode the message.
+It can then take any required action, like posting a response, or changing
+internal states.
+
+Messages transmission flow
+--------------------------
+
+The *msg* module provides functions to build and send messages.
+
+Theses functions will:
+
+- ask the *cl_interf* for a new buffer,
+- fill headers,
+- fill data corresponding to the requested message type,
+- finalise the message,
+- send it to *cl_interf*.
+
+If the destination STA is a hidden STA, it will automatically encapsulate the
+message in a ``CC_RELAY.REQ``.
+
+The message will be encapsulated in a CM_ENCRYPTED_PAYLOAD.REQ if requested.
+
+Beacons reception flow
+----------------------
+
+Beacons are directly received by the *beacon* module. It stores the beacon in
+its FIFO and raises the *STA core* flag corresponding to *beacon*.
+
+When *STA core* sees the raised flag, it calls the *beacon* module to handle
+the beacon in the CP context.
+
+The *beacon* module reads the beacon and updates the CP database with
+information contained in it. If the beacon corresponds to the tracked AVLN,
+the *beacon* module also handles change countdowns and updates the CA
+schedule.
+
+In every cases, it posts the ``BEACON`` event, in order to trigger other
+modules actions if necessary.
+
+Each time the *beacon* module receives a beacon, it resets a timer to detect
+an eventual missed beacon on the next beacon period.
+
+Beacons transmission flow
+-------------------------
+
+A timer programmed by the *beacon* module will trigger just before the beacon
+period end to prepare the beacon for the next period. When this timer
+expires, a event is posted to the FSM which will trigger a call to the
+*beacon* module.
+
+Then, the *beacon* module prepares the beacon and gives it to the data plane
+which will sent it when appropriated according to schedule.
+
+Messages reassembly
+-------------------
+
+If a fragmented message is extracted from the *cl_interf* FIFO, its
+fragmentation information is checked. If all is in good shape, the message is
+copied into a list of 512 byte blocks which is attached to the transmitting
+station. If the message is out of sequence, it is dropped, and the current
+reassembly list for this station is cleared.
+
+The *bitstream* library will handle the decoding of blocks transparently.
+
+As the CP can be reassembling many different messages, it can not keep buffer
+internally because they are a sparse resource.
+
+Messages fragmentation
+----------------------
+
+To send a fragmented message, the *msg* module first computes the total
+message size, then constructs the message using the *bitstream* library. At
+each end of fragment, the *bitstream* will call a *msg* callback to send the
+fragment and start a new one.
+
+Core execution control
+----------------------
+
+The *STA core* module control execution flow in the control plane. It tests a
+event bit field in order to decide what to do and sleeps when no bit is set.
+
+The modules which use the *STA core* should have its own FIFO. When a
+module wants to be awaken by the *STA core*, it should put its data in its own
+FIFO and ask *STA core* to raise its event flag. The *STA core* will awake
+the CP once the flag is set and will call back the module which has set it.
+The module must then extract one event from its FIFO, handle it, and return.
+If there is still events in the FIFO, it should set the event flag again.
+
+The *STA core* also implements a garbage collector timer. It triggers about
+every second to do background cleanup in modules. The *STA core* will call
+every modules interested by this event.
+
+Here are the event flags, in priority order:
+
+beacon
+ Set when the *beacon* module receives a beacon.
+FSM
+ Set when a event is posted in the FSM FIFO.
+cl_interf
+ Set when a message or a fragment is received in the *cl_interf*.
+garbage_collector
+ Set every second.
+
+The *STA core* also provides timers related helpers.
+
+Enhanced bitstream library
+--------------------------
+
+The *bitstream* library must be updated to handle multiple buffers. To do
+this, a callback is registered to *bitstream* to replace its buffer with a new
+one.
+
+To receive a fragmented message, when this callback will be called, it should
+give the next block in the list.
+
+To send a fragmented message, when this callback will be called, it should
+send the buffer, ask for a new one, fill header and give it to the *bitstream*
+library.
+
+MME handles
+-----------
+
+MME header structure
+~~~~~~~~~~~~~~~~~~~~
+
+This contains:
+
+- peer TEI
+- peer MAC address
+- VLAN informations
+- MMTYPE
+
+When a response must be sent to a received message, the MME header structure
+can be used as a parameter for the MME to send.
+
+Received MME handle
+~~~~~~~~~~~~~~~~~~~
+
+.. figure:: mme_rx_handle.png
+ :scale: 25
+
+ MME RX handle
+
+When a non fragmented message is received, the buffer is directly associated
+with the MME handle. The header is read by *cl_interf* and the *bitstream*
+points to data inside payload.
+
+When a fragmented message is received, the list of blocks is referenced by the
+MME handle. Headers are not present in the blocks, only payload. Once the
+*bitstream* arrives at buffer end, a callback is called which will replace the
+*bitstream* buffer with a new one.
+
+Modules details
+===============
+
+Beacon
+------
+
+This module handles:
+
+- beacon reception and decoding,
+- beacon transmission and encoding,
+- CA schedule update,
+- beacon period change countdowns,
+- missed beacon.
+
+The received beacons are filtered according to there NID, SNID, and beacon
+type. If the beacon is a discovery beacon or does not correspond to our
+tracked NID and SNID, it is used to update the CP database. In other cases,
+it is used as our beacon, schedule is updated, change countdowns are set,
+hybrid mode is used, discover and/or proxy beacon are send.
+
+When the beacon is not received, the schedule is programmed using permanent
+information, countdowns are decremented and an event is generated to signal
+the beacon miss.
+
+Msg
+---
+
+This module handles:
+
+- message decoding and encoding,
+- message transmission (get a buffer from *cl_interf*, fill header, encode,
+ send),
+- message dispatching (translating between MMTYPE and FSM events),
+- message encryption/decryption,
+- message encapsulation/decapsulation for relay,
+- message filtering according to segment encryption.
+
+Messages dispatching
+~~~~~~~~~~~~~~~~~~~~
+
+This is called by *cl_interf* when a complete message has been received. The
+*cl_interf* module has read the MME header yet and the *bitstream* context is
+ready to read the payload.
+
+If the message is a encrypted message, it is first checked for coherency, then
+decrypted. If the decryption is successful and information is coherent, the
+message is decapsulated, and encryption information is stored in the MME
+handle. It is then treated like any other MME. If the decryption is not
+successful or there is any incoherent field, it is posted in the FSM queue
+with a special BAD_CM_ENCRYPTED_PAYLOAD_IND event.
+
+Then, the message is filtered according to its MMTYPE and segment encryption
+status and posted in the FSM queue with an event corresponding to its MMTYPE.
+
+Messages decoding
+~~~~~~~~~~~~~~~~~
+
+When a module receives a message from the FSM, it should use *msg* services to
+decode it.
+
+Most messages will be decoded with a function call to *msg*, using a structure
+as parameter which will be filled by the *msg* function.
+
+Some messages, like ``CC_SET_TEI_MAP.IND`` will also need a callback function
+which will be called for each received station.
+
+Messages encoding and transmission
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+To send a message, a module should use a *msg* function which will ask for a
+new buffer, fill headers, encapsulate the message in a CC_RELAY.IND if
+necessary, and in a CM_ENCRYPTED_PAYLOAD.IND if requested.
+
+Most messages will be encoded with a function call to *msg*, using all
+messages fields as function parameters.
+
+Some messages, like ``CC_SET_TEI_MAP.IND`` will require that *msg* module uses
+the *STA mgr* interface to fetch data to send.
+
+SECU
+----
+
+This module handles:
+
+- AES:
+
+ - encryption
+ - decryption
+
+- SHA:
+
+ - SHA256
+ - PBKDF1
+
+- HomeplugAV:
+
+ - NPW to NMK
+ - NMK-SL to NID
+ - random NMK generation
+ - PRN procedure (start new, check, gen_next)
+
+It should behave as a separate library and will therefore not take the CP
+context as parameter.
+
+STA data & STA mgr
+------------------
+
+The *STA data* module maintains:
+
+- the STA own data
+- the network list
+- the STA list for each network
+
+It should keeps its information private.
+
+The *STA mgr* module is responsible for complex changes to *STA data* and can
+access private parts.
+
+Coding guidelines
+=================
+
+Contexts
+--------
+
+Each function in each module will receive the complete CP context as
+parameter. The CP context contains all the modules contexts, as value (for
+public context) or as pointer (for private ones).
+
+Naming conventions
+------------------
+
+Each function or types should be prefixed with the complete module name. For
+example, the ``choucroute`` function in the *STA action* module will be called
+``cp_sta_action_choucroute``.
+
+CP development milestones
+=========================
+
+Milestone 1
+-----------
+
+The first version will be able to:
+
+- play the power-on discovery procedure,
+- associate, authenticate and leave an AVLN,
+- act as a CCo to accept joining STA,
+- relay MME, only used to test the relay infrastructure,
+- use CSMA only schedule.
+
+This does not correspond yet to a CCo0.
+
+Handled MME messages
+--------------------
+
+========================= ==== ===========
+MME TYPE Milestone 1
+========================= ==== ===========
+CC_CCO_APPOINT REQ .
+.. CNF .
+CC_BACKUP_APPOINT REQ .
+.. CNF .
+CC_HANDOVER REQ .
+.. CNF .
+CC_LINK_INFO IND .
+.. RSP .
+CC_HANDOVER_INFO IND .
+.. RSP .
+CC_DISCOVER_LIST REQ .
+.. CNF .
+.. IND .
+CC_LINK_NEW REQ .
+.. CNF .
+CC_LINK_MOD REQ .
+.. CNF .
+CC_LINK_SQZ REQ .
+.. CNF .
+CC_LINK_REL REQ .
+.. CNF .
+CC_DETECT_REPORT REQ .
+.. CNF .
+CC_WHO_RU REQ X
+.. CNF X
+CC_ASSOC REQ X
+.. CNF X
+CC_LEAVE REQ X
+.. CNF X
+.. IND X
+.. RSP X
+CC_SET_TEI_MAP REQ .
+.. IND X
+CC_RELAY REQ X
+.. IND X
+CC_BEACON_RELIABILITY REQ .
+.. CNF .
+CC_ALLOC_MOVE REQ .
+.. CNF .
+CC_ACCESS all .
+CC_DCPPC IND .
+.. RSP .
+CC_HP1_DET REQ .
+.. CNF .
+CC_BLE_UPDATE IND .
+CP_* all .
+PH_* all .
+NN_* all .
+CM_UNASSOCIATED_STA IND X
+CM_ENCRYPTED_PAYLOAD IND X
+.. RSP X
+CM_SET_KEY REQ X
+.. CNF X
+CM_GET_KEY REQ X
+.. CNF X
+CM_SC_JOIN REQ .
+.. CNF .
+CM_CHAN_EST IND X
+CM_TM_UPDATE IND X
+CM_AMP_MAP REQ .
+.. CNF .
+CM_BRG_INFO REQ .
+.. CNF .
+CM_CONN_NEW REQ .
+.. CNF .
+CM_CONN_REL IND .
+.. CNF .
+CM_CONN_MOD REQ .
+.. CNF .
+CM_CONN_INFO REQ .
+.. CNF .
+CM_STA_CAP all .
+CM_NW_INFO all .
+CM_GET_BEACON all .
+CM_HFID all .
+CM_MME_ERROR IND X
+CM_NW_STATS REQ .
+.. CNF .
+CM_LINK_STATS REQ .
+.. CNF .
+========================= ==== ===========
diff --git a/cesar/cp/doc/cp.xmi b/cesar/cp/doc/cp.xmi
new file mode 100644
index 0000000000..e347901734
--- /dev/null
+++ b/cesar/cp/doc/cp.xmi
@@ -0,0 +1,123 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-04-25T16:48:32" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ovJVCQtIXOB4" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="g1LYmYUa8ZA8" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="6XajJCo577bH" isRoot="false" isAbstract="false" name="boolean" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="VSZ3qk5XkQ3U" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="wV222DA6ikqz" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ue42jdJD5rGw" isRoot="false" isAbstract="false" name="byte" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZLRHjSmfxoi0" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="zq6hZueTWjVE" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="MnRQchM92lRl" isRoot="false" isAbstract="false" name="String" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="cMWBY2Uxmq1Z" isRoot="false" isAbstract="false" name="cp_sta_mgr_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="7Tq8plPyGG7g" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="NoC7y59y7tTJ" isRoot="false" isAbstract="false" name="mac_config_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="IvpwWGft3ryz" isRoot="false" isAbstract="false" name="interface_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="aA5IrwxfSa3k" isRoot="false" isAbstract="false" name="cp_t *" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="DDO8z48ztDeS" isRoot="false" isAbstract="false" name="cp_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="station manager context." isSpecification="false" visibility="private" xmi.id="Jve0PsKCJkmy" type="cMWBY2Uxmq1Z" name="sta_mgr" />
+ <UML:Attribute comment="The mac config context." isSpecification="false" visibility="private" xmi.id="X8bIaj3TgcRj" type="NoC7y59y7tTJ" name="mac_config" />
+ <UML:Attribute comment="The interface context." isSpecification="false" visibility="private" xmi.id="v7y0zRJkiqfo" type="IvpwWGft3ryz" name="interface" />
+ <UML:Operation comment="Initialise the Control plane." isSpecification="false" isLeaf="false" visibility="public" xmi.id="mIQGTwg7fidQ" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="dhRIP4hz9sOo" type="aA5IrwxfSa3k" />
+ <UML:Parameter comment="Mac configuration context." isSpecification="false" visibility="private" xmi.id="c6BOfuBD3EVu" value="" type="NoC7y59y7tTJ" name="mac_config" />
+ <UML:Parameter comment="Interface context." isSpecification="false" visibility="private" xmi.id="8SZY2aIotj2M" value="" type="IvpwWGft3ryz" name="interface" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initialise the control plane context." isSpecification="false" isLeaf="false" visibility="public" xmi.id="0plniUp25WSM" isRoot="false" isAbstract="false" isQuery="false" name="uninit" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The control plane context." isSpecification="false" visibility="private" xmi.id="uW3tfvFUgoUS" value="" type="aA5IrwxfSa3k" name="ctx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="978" snapy="10" showatts="1" xmi.id="nZ4c2ZMUfoc4" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="853" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="429" showattsigs="601" x="244" fillcolor="#ffffc0" y="36" showopsigs="601" linewidth="none" height="96" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="DDO8z48ztDeS" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="nZ4c2ZMUfoc4" documentation="" uniqueid="uW3tfvFUgoUS" />
+ <listview>
+ <listitem open="1" type="800" label="Vues" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="807" id="nZ4c2ZMUfoc4" label="diagramme de classes" />
+ <listitem open="1" type="813" id="DDO8z48ztDeS" >
+ <listitem open="0" type="814" id="Jve0PsKCJkmy" />
+ <listitem open="0" type="814" id="X8bIaj3TgcRj" />
+ <listitem open="0" type="814" id="v7y0zRJkiqfo" />
+ <listitem open="0" type="815" id="mIQGTwg7fidQ" />
+ <listitem open="0" type="815" id="0plniUp25WSM" />
+ </listitem>
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="MnRQchM92lRl" />
+ <listitem open="1" type="829" id="6XajJCo577bH" />
+ <listitem open="1" type="829" id="ue42jdJD5rGw" />
+ <listitem open="1" type="829" id="g1LYmYUa8ZA8" />
+ <listitem open="1" type="829" id="cMWBY2Uxmq1Z" />
+ <listitem open="1" type="829" id="aA5IrwxfSa3k" />
+ <listitem open="1" type="829" id="wV222DA6ikqz" />
+ <listitem open="1" type="829" id="VSZ3qk5XkQ3U" />
+ <listitem open="1" type="829" id="ovJVCQtIXOB4" />
+ <listitem open="1" type="829" id="IvpwWGft3ryz" />
+ <listitem open="1" type="829" id="zq6hZueTWjVE" />
+ <listitem open="1" type="829" id="NoC7y59y7tTJ" />
+ <listitem open="1" type="829" id="ZLRHjSmfxoi0" />
+ <listitem open="0" type="829" id="7Tq8plPyGG7g" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" />
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/doc/cp_archi.odt b/cesar/cp/doc/cp_archi.odt
new file mode 100644
index 0000000000..2914314cea
--- /dev/null
+++ b/cesar/cp/doc/cp_archi.odt
Binary files differ
diff --git a/cesar/cp/doc/mme_rx_handle.svg b/cesar/cp/doc/mme_rx_handle.svg
new file mode 100644
index 0000000000..6e09f15537
--- /dev/null
+++ b/cesar/cp/doc/mme_rx_handle.svg
@@ -0,0 +1,455 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:xlink="http://www.w3.org/1999/xlink"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="744.09448819"
+ height="1052.3622047"
+ id="svg2"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ sodipodi:docbase="/home/schodet/work/cesar3/cp/doc"
+ sodipodi:docname="mme_rx_handle.svg">
+ <defs
+ id="defs4">
+ <marker
+ inkscape:stockid="Arrow1Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Mstart"
+ style="overflow:visible">
+ <path
+ id="path7645"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.4) translate(10,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Mend"
+ style="overflow:visible;">
+ <path
+ id="path7624"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(0.6) rotate(180) translate(0,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Lend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Lend"
+ style="overflow:visible;">
+ <path
+ id="path7630"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(1.1) rotate(180) translate(1,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="1.0835887"
+ inkscape:cx="395.00015"
+ inkscape:cy="520.00026"
+ inkscape:document-units="px"
+ inkscape:current-layer="layer1"
+ showgrid="true"
+ gridspacingx="10px"
+ gridspacingy="10px"
+ inkscape:grid-points="true"
+ inkscape:window-width="1024"
+ inkscape:window-height="1268"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata7">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g6572"
+ transform="translate(-20,1.182556e-4)">
+ <rect
+ y="52.362064"
+ x="300.00018"
+ height="120.03069"
+ width="99.999771"
+ id="rect4706"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000095;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path4708"
+ d="M 300,82.398655 L 400,82.362183"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ sodipodi:nodetypes="cc"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 300,112.39865 L 400,112.36218"
+ id="path4710" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path4712"
+ d="M 300,142.39865 L 400,142.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <text
+ id="text4714"
+ y="72.398651"
+ x="310"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="72.398651"
+ x="310"
+ id="tspan4716"
+ sodipodi:role="line">Next</tspan></text>
+ <text
+ id="text4718"
+ y="102.39865"
+ x="310"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="102.39865"
+ x="310"
+ id="tspan4720"
+ sodipodi:role="line">Data</tspan></text>
+ <text
+ id="text4722"
+ y="132.39865"
+ x="310"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="132.39865"
+ x="310"
+ id="tspan4724"
+ sodipodi:role="line">Size</tspan></text>
+ </g>
+ <g
+ id="g4738">
+ <rect
+ y="52.361286"
+ x="49.998085"
+ height="280.00098"
+ width="130.00002"
+ id="rect2764"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000012;stroke-opacity:1" />
+ <text
+ id="text2766"
+ y="92.362183"
+ x="60"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="92.362183"
+ x="60"
+ id="tspan2768"
+ sodipodi:role="line">Blocks</tspan></text>
+ <text
+ id="text2770"
+ y="122.36218"
+ x="60"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="122.36218"
+ x="60"
+ id="tspan2772"
+ sodipodi:role="line">Buffer</tspan></text>
+ <path
+ id="path3661"
+ d="M 50,102.36218 L 180,102.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path3663"
+ d="M 50,132.36218 L 180,132.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path3665"
+ d="M 50,72.362183 L 180,72.362183"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path3667"
+ d="M 180,222.36218 L 50,222.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path3669"
+ d="M 80,222.36218 L 80,302.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path3671"
+ d="M 50,302.36218 L 180,302.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path3673"
+ d="M 80,252.36218 L 180,252.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ id="path3675"
+ d="M 80,282.36218 L 180,282.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <text
+ id="text3677"
+ y="292.36218"
+ x="88.716797"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="292.36218"
+ x="88.716797"
+ id="tspan3679"
+ sodipodi:role="line">...</tspan></text>
+ <text
+ id="text4566"
+ y="242.36218"
+ x="90"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="242.36218"
+ x="90"
+ id="tspan4568"
+ sodipodi:role="line">Current</tspan></text>
+ <text
+ id="text4570"
+ y="272.36218"
+ x="90"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="272.36218"
+ x="90"
+ id="tspan4572"
+ sodipodi:role="line">Left</tspan></text>
+ <text
+ id="text4574"
+ y="322.36218"
+ x="60"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="322.36218"
+ x="60"
+ id="tspan4576"
+ sodipodi:role="line">Next</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="60"
+ y="151.47937"
+ id="text4578"><tspan
+ sodipodi:role="line"
+ id="tspan4580"
+ x="60"
+ y="151.47937">Header</tspan></text>
+ <text
+ transform="matrix(0,-1,1,0,0,0)"
+ id="text4582"
+ y="69.117188"
+ x="-293.53992"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="69.117188"
+ x="-293.53992"
+ id="tspan4584"
+ sodipodi:role="line">Bitstream</tspan></text>
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="59.839844"
+ y="63.850464"
+ id="text4586"><tspan
+ sodipodi:role="line"
+ id="tspan4588"
+ x="59.839844"
+ y="63.850464">...</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 50,202.36218 L 180,202.36218"
+ id="path4590" />
+ <text
+ id="text4592"
+ y="212.36218"
+ x="59.839844"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ y="212.36218"
+ x="59.839844"
+ id="tspan4594"
+ sodipodi:role="line">...</tspan></text>
+ </g>
+ <use
+ x="0"
+ y="0"
+ xlink:href="#g6572"
+ id="use6584"
+ transform="translate(219.5,0)"
+ width="744.09448"
+ height="1052.3622" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 180,82.362183 C 200,82.362183 260,52.362183 280,52.362183"
+ id="path6586" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 380,62.362183 C 400,62.362183 480,52.362183 500,52.362183"
+ id="path6588" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 600,62.362183 C 620,62.362183 630,52.362183 650,52.362183"
+ id="path6590" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 650,42.362183 L 650,62.362183"
+ id="path7660" />
+ <rect
+ style="fill:none;fill-opacity:1;stroke:black;stroke-width:0.9999997;stroke-opacity:1"
+ id="rect7662"
+ width="100.00006"
+ height="300.00006"
+ x="419.99994"
+ y="202.36212" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 380,92.362183 C 400,92.362183 380,202.36218 420,202.36218"
+ id="path7666"
+ sodipodi:nodetypes="cc" />
+ <path
+ id="path8553"
+ d="M 600,92.362183 C 620,92.362183 600,202.36218 640,202.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ sodipodi:nodetypes="cc" />
+ <rect
+ y="202.36212"
+ x="639.99994"
+ height="300.00006"
+ width="100.00006"
+ id="rect8555"
+ style="fill:none;fill-opacity:1;stroke:black;stroke-width:0.9999997;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 180,232.36218 C 200,232.36218 380,272.36218 420,272.36218"
+ id="path8557" />
+ <rect
+ style="fill:#ccc;fill-opacity:1;stroke:black;stroke-width:0.9999997;stroke-opacity:1"
+ id="rect8559"
+ width="100.0024"
+ height="99.917038"
+ x="639.99982"
+ y="402.4451" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 180,262.36218 C 200,262.36218 360,402.36218 400,402.36218"
+ id="path9446" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend);marker-start:url(#Arrow1Mstart)"
+ d="M 400,502.36218 L 400,272.36218"
+ id="path9448" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 180,312.36218 C 200,312.36218 310,212.36218 350,212.36218 C 390,212.36218 460,52.362183 500,52.362183"
+ id="path9450"
+ sodipodi:nodetypes="csc" />
+ <use
+ x="0"
+ y="0"
+ xlink:href="#g4738"
+ id="use11224"
+ transform="translate(0,499.4999)"
+ width="744.09448"
+ height="1052.3622" />
+ <rect
+ y="552.36194"
+ x="349.99762"
+ height="469.99973"
+ width="100.00255"
+ id="rect11226"
+ style="fill:none;fill-opacity:1;stroke:black;stroke-width:0.9999997;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 180,112.36218 L 200,112.36218"
+ id="path11228" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 200,102.36218 L 200,122.36218"
+ id="path11230" />
+ <path
+ id="path12117"
+ d="M 180,582.36218 L 200,582.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-opacity:1" />
+ <path
+ id="path12119"
+ d="M 200,572.36218 L 200,592.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;marker-end:url(#Arrow2Mend)"
+ d="M 180,612.36218 C 200,612.36218 310,552.36218 350,552.36218"
+ id="path12123" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 350,622.36218 L 450,622.36218"
+ id="path13012" />
+ <rect
+ y="922.36096"
+ x="349.99744"
+ height="100.00002"
+ width="99.999878"
+ id="rect13014"
+ style="fill:#ccc;fill-opacity:1;stroke:black;stroke-width:0.99999982;stroke-opacity:1" />
+ <path
+ id="path13016"
+ d="M 180,732.36218 C 200,732.36218 310,652.36218 350,652.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ sodipodi:nodetypes="cc" />
+ <path
+ id="path13018"
+ d="M 180,762.36218 C 200,762.36218 290,772.36218 330,772.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ sodipodi:nodetypes="cc" />
+ <path
+ id="path13020"
+ d="M 330,922.36218 L 330,652.36218"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow1Mstart);marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ sodipodi:nodetypes="cc" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="360"
+ y="572.36218"
+ id="text13022"><tspan
+ sodipodi:role="line"
+ id="tspan13024"
+ x="360"
+ y="572.36218">MME Header</tspan></text>
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ d="M 180,812.36218 L 200,812.36218"
+ id="path13026" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1"
+ d="M 200,802.36218 L 200,822.36218"
+ id="path13028"
+ sodipodi:nodetypes="cc" />
+ </g>
+</svg>
diff --git a/cesar/cp/doc/overview.svg b/cesar/cp/doc/overview.svg
new file mode 100644
index 0000000000..782b7d77ed
--- /dev/null
+++ b/cesar/cp/doc/overview.svg
@@ -0,0 +1,521 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<!-- Created with Inkscape (http://www.inkscape.org/) -->
+<svg
+ xmlns:dc="http://purl.org/dc/elements/1.1/"
+ xmlns:cc="http://web.resource.org/cc/"
+ xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
+ xmlns:svg="http://www.w3.org/2000/svg"
+ xmlns="http://www.w3.org/2000/svg"
+ xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
+ xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
+ width="1052.3622"
+ height="744.09448"
+ id="svg2762"
+ sodipodi:version="0.32"
+ inkscape:version="0.44.1"
+ version="1.0"
+ sodipodi:docbase="/home/schodet/work/cesar3/cp/doc"
+ sodipodi:docname="overview.svg">
+ <defs
+ id="defs2764">
+ <marker
+ inkscape:stockid="Arrow2Mend"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Mend"
+ style="overflow:visible;">
+ <path
+ id="path5682"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round;"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(0.6) rotate(180) translate(0,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow2Mstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow2Mstart"
+ style="overflow:visible">
+ <path
+ id="path5685"
+ style="font-size:12.0;fill-rule:evenodd;stroke-width:0.62500000;stroke-linejoin:round"
+ d="M 8.7185878,4.0337352 L -2.2072895,0.016013256 L 8.7185884,-4.0017078 C 6.9730900,-1.6296469 6.9831476,1.6157441 8.7185878,4.0337352 z "
+ transform="scale(0.6) translate(0,0)" />
+ </marker>
+ <marker
+ inkscape:stockid="Arrow1Lstart"
+ orient="auto"
+ refY="0.0"
+ refX="0.0"
+ id="Arrow1Lstart"
+ style="overflow:visible">
+ <path
+ id="path5709"
+ d="M 0.0,0.0 L 5.0,-5.0 L -12.5,0.0 L 5.0,5.0 L 0.0,0.0 z "
+ style="fill-rule:evenodd;stroke:#000000;stroke-width:1.0pt;marker-start:none"
+ transform="scale(0.8) translate(12.5,0)" />
+ </marker>
+ </defs>
+ <sodipodi:namedview
+ id="base"
+ pagecolor="#ffffff"
+ bordercolor="#666666"
+ borderopacity="1.0"
+ gridtolerance="10000"
+ guidetolerance="10"
+ objecttolerance="10"
+ inkscape:pageopacity="0.0"
+ inkscape:pageshadow="2"
+ inkscape:zoom="0.89132811"
+ inkscape:cx="506.32591"
+ inkscape:cy="372.04724"
+ inkscape:document-units="px"
+ inkscape:current-layer="g5736"
+ width="1052.3622px"
+ height="744.09448px"
+ inkscape:window-width="1024"
+ inkscape:window-height="1268"
+ inkscape:window-x="0"
+ inkscape:window-y="0" />
+ <metadata
+ id="metadata2767">
+ <rdf:RDF>
+ <cc:Work
+ rdf:about="">
+ <dc:format>image/svg+xml</dc:format>
+ <dc:type
+ rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
+ </cc:Work>
+ </rdf:RDF>
+ </metadata>
+ <g
+ inkscape:label="Layer 1"
+ inkscape:groupmode="layer"
+ id="layer1">
+ <g
+ id="g4557"
+ transform="translate(-49.69972,23.46204)"
+ inkscape:connector-avoid="true">
+ <rect
+ y="103.36002"
+ x="59.399132"
+ height="58.999985"
+ width="178.99992"
+ id="rect2770"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000155;stroke-opacity:1" />
+ <text
+ id="text4542"
+ y="140.14029"
+ x="148.74284"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ y="140.14029"
+ x="148.74284"
+ id="tspan4544"
+ sodipodi:role="line">MSG</tspan></text>
+ </g>
+ <g
+ id="g4552"
+ transform="translate(11.3849,20.69305)"
+ inkscape:connector-avoid="true">
+ <rect
+ y="106.12901"
+ x="515.38556"
+ height="58.999985"
+ width="178.99992"
+ id="rect4546"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000155;stroke-opacity:1" />
+ <text
+ id="text4548"
+ y="142.90926"
+ x="604.72925"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ y="142.90926"
+ x="604.72925"
+ id="tspan4550"
+ sodipodi:role="line">CL interf</tspan></text>
+ </g>
+ <g
+ id="g4562"
+ transform="translate(208.8358,-77.21943)"
+ inkscape:connector-avoid="true">
+ <rect
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000155;stroke-opacity:1"
+ id="rect4564"
+ width="178.99992"
+ height="58.999985"
+ x="59.399132"
+ y="103.36002" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="148.74284"
+ y="140.14029"
+ id="text4566"><tspan
+ sodipodi:role="line"
+ x="148.74284"
+ y="140.14029"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ id="tspan4570">FSM</tspan></text>
+ </g>
+ <g
+ id="g4584"
+ transform="translate(-9.95302,16.53333)"
+ inkscape:connector-avoid="true">
+ <path
+ transform="matrix(0.821861,0,0,0.735758,64.20157,-73.26681)"
+ d="M 478.16644 289.57285 A 108.89919 40.094704 0 1 1 260.36805,289.57285 A 108.89919 40.094704 0 1 1 478.16644 289.57285 z"
+ sodipodi:ry="40.094704"
+ sodipodi:rx="108.89919"
+ sodipodi:cy="289.57285"
+ sodipodi:cx="369.26724"
+ id="path4574"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.28597736;stroke-opacity:1"
+ sodipodi:type="arc" />
+ <text
+ id="text4580"
+ y="147.069"
+ x="367.56097"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ id="tspan4582"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ y="147.069"
+ x="367.56097"
+ sodipodi:role="line">STA core</tspan><tspan
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ y="172.069"
+ x="367.56097"
+ sodipodi:role="line"
+ id="tspan5743" /></text>
+ </g>
+ <g
+ id="g4589"
+ transform="translate(11.3849,126.719)"
+ inkscape:connector-avoid="true">
+ <rect
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000155;stroke-opacity:1"
+ id="rect4591"
+ width="178.99992"
+ height="58.999985"
+ x="515.38556"
+ y="106.12901" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="604.72925"
+ y="142.90926"
+ id="text4593"><tspan
+ sodipodi:role="line"
+ id="tspan4595"
+ x="604.72925"
+ y="142.90926"
+ style="font-size:20px;text-align:center;text-anchor:middle">Beacon</tspan></text>
+ </g>
+ <g
+ id="g4597"
+ transform="translate(-247.1506,126.719)"
+ inkscape:connector-avoid="true">
+ <rect
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000155;stroke-opacity:1"
+ id="rect4599"
+ width="178.99992"
+ height="58.999985"
+ x="515.38556"
+ y="106.12901" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="604.72925"
+ y="142.90926"
+ id="text4601"><tspan
+ sodipodi:role="line"
+ id="tspan4603"
+ x="604.72925"
+ y="142.90926"
+ style="font-size:20px;text-align:center;text-anchor:middle">STA action</tspan></text>
+ </g>
+ <g
+ id="g4605"
+ transform="translate(-505.6861,126.719)"
+ inkscape:connector-avoid="true">
+ <rect
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000155;stroke-opacity:1"
+ id="rect4607"
+ width="178.99992"
+ height="58.999985"
+ x="515.38556"
+ y="106.12901" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="604.72925"
+ y="142.90926"
+ id="text4609"><tspan
+ sodipodi:role="line"
+ id="tspan4611"
+ x="604.72925"
+ y="142.90926"
+ style="font-size:20px;text-align:center;text-anchor:middle">CCo action</tspan></text>
+ </g>
+ <g
+ id="g5736"
+ transform="translate(10.37778,0)">
+ <rect
+ y="26.112196"
+ x="775.50134"
+ height="596.45691"
+ width="178.99992"
+ id="rect4639"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000143;stroke-opacity:1" />
+ <text
+ transform="scale(1.029638,0.971215)"
+ id="text4641"
+ y="62.607651"
+ x="839.95068"
+ style="font-size:11.65458298px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ style="font-size:19.42430496px;text-align:center;text-anchor:middle"
+ y="62.607651"
+ x="839.95068"
+ sodipodi:role="line"
+ id="tspan4645">Data plane</tspan></text>
+ </g>
+ <path
+ id="path4649"
+ d="M 357.7349,89.235134 L 357.7349,122.07704"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ d="M 357.7349,192.85711 L 357.7349,225.69902"
+ id="path5720" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path5722"
+ d="M 287.40407,181.54804 L 195.57443,226.43318"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ d="M 426.90484,181.56531 L 518.73448,226.45045"
+ id="path5724"
+ sodipodi:nodetypes="cc" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ d="M 195.45294,156.32206 L 260.93011,156.32206"
+ id="path5726"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path5741"
+ d="M 453.88062,156.32206 L 519.35779,156.32206"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ d="M 711.92252,156.32206 L 777.39969,156.32206"
+ id="path5745"
+ sodipodi:nodetypes="cc" />
+ <path
+ sodipodi:nodetypes="cc"
+ id="path5747"
+ d="M 711.92252,262.34801 L 777.39969,262.34801"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1" />
+ <g
+ inkscape:connector-avoid="true"
+ transform="translate(11.3849,232.2303)"
+ id="g5749">
+ <rect
+ y="106.12901"
+ x="515.38556"
+ height="58.999985"
+ width="178.99992"
+ id="rect5751"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000155;stroke-opacity:1" />
+ <text
+ id="text5753"
+ y="142.90926"
+ x="604.72925"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ y="142.90926"
+ x="604.72925"
+ id="tspan5755"
+ sodipodi:role="line">NTB</tspan></text>
+ </g>
+ <path
+ id="path5757"
+ d="M 616.27042,299.16174 L 616.27042,332.00365"
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1" />
+ <path
+ style="fill:none;fill-rule:evenodd;stroke:black;stroke-width:0.99999994px;stroke-linecap:butt;stroke-linejoin:miter;marker-start:url(#Arrow2Mstart);marker-mid:none;marker-end:url(#Arrow2Mend);stroke-opacity:1"
+ d="M 711.92252,367.85931 L 777.39969,367.85931"
+ id="path5759"
+ sodipodi:nodetypes="cc" />
+ <g
+ id="g5761"
+ transform="translate(-494.5755,331.4576)"
+ inkscape:connector-avoid="true">
+ <rect
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000179;stroke-opacity:1"
+ id="rect5763"
+ width="139.33408"
+ height="47.893532"
+ x="534.64227"
+ y="111.68222" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="604.72925"
+ y="142.90926"
+ id="text5765"><tspan
+ sodipodi:role="line"
+ x="604.72925"
+ y="142.90926"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ id="tspan5769">conn</tspan></text>
+ </g>
+ <g
+ inkscape:connector-avoid="true"
+ transform="translate(-329.2414,331.4576)"
+ id="g5781">
+ <rect
+ y="111.68222"
+ x="534.64227"
+ height="47.893532"
+ width="139.33408"
+ id="rect5783"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000179;stroke-opacity:1" />
+ <text
+ id="text5785"
+ y="142.90926"
+ x="604.72925"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ id="tspan5787"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ y="142.90926"
+ x="604.72925"
+ sodipodi:role="line">CCo BW</tspan></text>
+ </g>
+ <g
+ id="g5789"
+ transform="translate(-163.9073,331.4576)"
+ inkscape:connector-avoid="true">
+ <rect
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000179;stroke-opacity:1"
+ id="rect5791"
+ width="139.33408"
+ height="47.893532"
+ x="534.64227"
+ y="111.68222" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="604.72925"
+ y="142.90926"
+ id="text5793"><tspan
+ sodipodi:role="line"
+ x="604.72925"
+ y="142.90926"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ id="tspan5795">STA data</tspan></text>
+ </g>
+ <g
+ inkscape:connector-avoid="true"
+ transform="translate(-494.5755,405.3512)"
+ id="g5797">
+ <rect
+ y="111.68222"
+ x="534.64227"
+ height="47.893532"
+ width="139.33408"
+ id="rect5799"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000179;stroke-opacity:1" />
+ <text
+ id="text5801"
+ y="142.90926"
+ x="604.72925"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ id="tspan5803"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ y="142.90926"
+ x="604.72925"
+ sodipodi:role="line">link</tspan></text>
+ </g>
+ <g
+ id="g5805"
+ transform="translate(1.42673,331.4576)"
+ inkscape:connector-avoid="true">
+ <rect
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000179;stroke-opacity:1"
+ id="rect5807"
+ width="139.33408"
+ height="47.893532"
+ x="534.64227"
+ y="111.68222" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="604.72925"
+ y="142.90926"
+ id="text5809"><tspan
+ sodipodi:role="line"
+ x="604.72925"
+ y="142.90926"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ id="tspan5811">SECU</tspan></text>
+ </g>
+ <g
+ id="g5813"
+ transform="translate(-329.2414,405.3512)"
+ inkscape:connector-avoid="true">
+ <rect
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000179;stroke-opacity:1"
+ id="rect5815"
+ width="139.33408"
+ height="47.893532"
+ x="534.64227"
+ y="111.68222" />
+ <text
+ xml:space="preserve"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ x="604.72925"
+ y="142.90926"
+ id="text5817"><tspan
+ sodipodi:role="line"
+ x="604.72925"
+ y="142.90926"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ id="tspan5819">CCo region</tspan></text>
+ </g>
+ <g
+ inkscape:connector-avoid="true"
+ transform="translate(-163.9073,405.3511)"
+ id="g5821">
+ <rect
+ y="111.68222"
+ x="534.64227"
+ height="47.893532"
+ width="139.33408"
+ id="rect5823"
+ style="fill:white;fill-opacity:1;stroke:black;stroke-width:1.00000179;stroke-opacity:1" />
+ <text
+ id="text5825"
+ y="142.90926"
+ x="604.72925"
+ style="font-size:12px;font-style:normal;font-weight:normal;fill:black;fill-opacity:1;stroke:none;stroke-width:1px;stroke-linecap:butt;stroke-linejoin:miter;stroke-opacity:1;font-family:Bitstream Vera Sans"
+ xml:space="preserve"><tspan
+ id="tspan5827"
+ style="font-size:20px;text-align:center;text-anchor:middle"
+ y="142.90926"
+ x="604.72925"
+ sodipodi:role="line">STA mgr</tspan></text>
+ </g>
+ </g>
+</svg>
diff --git a/cesar/cp/fsm/Module b/cesar/cp/fsm/Module
new file mode 100644
index 0000000000..7fb9413c88
--- /dev/null
+++ b/cesar/cp/fsm/Module
@@ -0,0 +1,37 @@
+SOURCES := tables.c fsm.c events.c
+
+cp_fsm_defs_h = $(OBJ_DIR)/inc/cp_fsm_defs.h
+cp_fsm_tables_h = $(OBJ_DIR)/inc/cp_fsm_tables.h
+CLEAN_FILES += $(cp_fsm_defs_h) $(cp_fsm_tables_h)
+
+$(call src2obj,cp/fsm/src/tables.c,host): $(cp_fsm_tables_h)
+$(call src2obj,cp/fsm/src/tables.c,target): $(cp_fsm_tables_h)
+$(BASE)/cp/fsm/fsm.h: $(cp_fsm_defs_h)
+
+vpath %.fsm $(BASE)
+vpath %.conf $(BASE)
+vpath %_defs.h $(BASE)
+vpath %_tables.h $(BASE)
+
+cp_fsm_deps = $(call src2src,cp.fsm cp.conf template_defs.h \
+ template_tables.h,cp/fsm/src/fsm)
+
+dfagen = $(TOOLS_DIR)/dfagen/dfagen.py
+
+$(dfagen): $(TOOLS_DIR)/dfagen/dfagen/parser.py
+
+$(TOOLS_DIR)/dfagen/dfagen/parser.py: $(TOOLS_DIR)/dfagen/dfagen/parser.g
+ yapps $<
+
+$(cp_fsm_defs_h) $(cp_fsm_tables_h): $(cp_fsm_deps) $(dfagen)
+ python $(dfagen) -O $(OBJ_DIR)/inc \
+ -o c -d $< -c $(filter %.conf,$^) -p cp_fsm
+
+CLEAN_FILES += $(OBJ_DIR)/cp_fsm.png $(OBJ_DIR)/cp_fsm.dot
+
+$(OBJ_DIR)/cp_fsm.png: $(OBJ_DIR)/cp_fsm.dot
+ dot -Tpng -o $@ $<
+
+$(OBJ_DIR)/cp_fsm.dot: $(cp_fsm_deps)
+ python $(TOOLS_DIR)/dfagen/dfagen.py -O $(OBJ_DIR) \
+ -o dot -d $< -p cp_fsm
diff --git a/cesar/cp/fsm/forward.h b/cesar/cp/fsm/forward.h
new file mode 100644
index 0000000000..b4ed654122
--- /dev/null
+++ b/cesar/cp/fsm/forward.h
@@ -0,0 +1,19 @@
+#ifndef cp_fsm_forward_h
+#define cp_fsm_forward_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/fsm/forward.h
+ * \brief Control plane FSM forward declarations.
+ * \ingroup cp_fsm
+ */
+
+/* Forward declaration. */
+typedef struct cp_fsm_event_t cp_fsm_event_t;
+
+#endif /* cp_fsm_forward_h */
diff --git a/cesar/cp/fsm/fsm.h b/cesar/cp/fsm/fsm.h
new file mode 100644
index 0000000000..ffb92cad63
--- /dev/null
+++ b/cesar/cp/fsm/fsm.h
@@ -0,0 +1,78 @@
+#ifndef cp_fsm_fsm_h
+#define cp_fsm_fsm_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/fsm/fsm.h
+ * \brief Control plane finite state machine.
+ * \ingroup cp_fsm
+ */
+#include "cp/cp.h"
+
+#include "forward.h"
+#include "inc/events.h"
+
+/**
+ * Shortcut to initialise and post an event.
+ * \param ctx control plane context
+ * \param kind one of the possible kinds of event
+ * \param type event type, automatically prefixed with CP_FSM_EVENT_TYPE_
+ * \param args event creation arguments
+ */
+#define cp_fsm_post_new_event(ctx, kind, type, args...) \
+ cp_fsm_post ((ctx), cp_fsm_event_ ## kind ## _new \
+ ((ctx), CP_FSM_EVENT_TYPE_ ## type, ## args))
+
+BEGIN_DECLS
+
+/**
+ * Initialise the FSM.
+ * \param ctx control plane context
+ */
+void
+cp_fsm_init (cp_t *ctx);
+
+/**
+ * Uninitialise the FSM, drop any pending event.
+ * \param ctx control plane context
+ */
+void
+cp_fsm_uninit (cp_t *ctx);
+
+/**
+ * Process one event from the FSM queue.
+ * \param ctx control plane context
+ */
+void
+cp_fsm_process (cp_t *ctx);
+
+/**
+ * Add an event in the FSM event queue.
+ * \param ctx control plane context
+ * \param event event to add
+ *
+ * Event reference is transfered to the FSM module.
+ */
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event);
+
+/**
+ * Select a branch during a transition.
+ * \param ctx control plane context
+ * \param branch branch to select
+ *
+ * The selected branch must correspond to the current handled transition.
+ */
+void
+cp_fsm_branch_ (cp_t *ctx, cp_fsm_branch_t branch);
+#define cp_fsm_branch(ctx, state, event, branch) \
+ cp_fsm_branch_ ((ctx), CP_FSM_BRANCH (state, event, branch))
+
+END_DECLS
+
+#endif /* cp_fsm_fsm_h */
diff --git a/cesar/cp/fsm/inc/context.h b/cesar/cp/fsm/inc/context.h
new file mode 100644
index 0000000000..eb44884039
--- /dev/null
+++ b/cesar/cp/fsm/inc/context.h
@@ -0,0 +1,43 @@
+#ifndef cp_fsm_inc_context_h
+#define cp_fsm_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/fsm/inc/context.h
+ * \brief FSM private context.
+ * \ingroup cp_fsm
+ */
+
+#include "lib/slab.h"
+
+/** FSM context. */
+struct cp_fsm_t
+{
+ /** Current active states. */
+ cp_fsm_state_t active_states[CP_FSM_INITIAL_NB];
+ /** Currently handled event, reset to NULL when no event is handled. */
+ cp_fsm_event_t *handled_event;
+ /** Currently handled active state index, undefined when no event is
+ * handled. */
+ uint handled_active_state;
+ /** Head of pending event list. */
+ cp_fsm_event_t *head;
+ /** Tail of pending event list. */
+ cp_fsm_event_t *tail;
+ /** Slab cache for bare events. */
+ slab_cache_t event_bare_cache;
+ /** Slab cache for MME events. */
+ slab_cache_t event_mme_cache;
+ /** Slab cache for STA events. */
+ slab_cache_t event_sta_cache;
+ /** Slab cache for beacon events. */
+ slab_cache_t event_beacon_cache;
+};
+typedef struct cp_fsm_t cp_fsm_t;
+
+#endif /* cp_fsm_inc_context_h */
diff --git a/cesar/cp/fsm/inc/events.h b/cesar/cp/fsm/inc/events.h
new file mode 100644
index 0000000000..776638ea82
--- /dev/null
+++ b/cesar/cp/fsm/inc/events.h
@@ -0,0 +1,99 @@
+#ifndef cp_fsm_inc_events_h
+#define cp_fsm_inc_events_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/fsm/inc/events.h
+ * \brief FSM events.
+ * \ingroup cp_fsm
+ */
+#include "cp/mme.h"
+#include "cp/beacon/beacon_desc.h"
+#include "cp/sta/mgr/net.h"
+
+/* This is a auto-generated file, check your Makefile if it is not found. */
+#include "cp_fsm_defs.h"
+
+/**
+ * Call the transition associated with an event.
+ * \param ctx control plane context
+ * \param event handled event
+ * \param transition transition function to call
+ */
+typedef void (*cp_fsm_event_handler_t) (cp_t *ctx, cp_fsm_event_t *event,
+ cp_fsm_transition_t transition);
+
+/** Event base structure. */
+struct cp_fsm_event_t
+{
+ /** Next event in queue. */
+ cp_fsm_event_t *next;
+ /** Event type. */
+ cp_fsm_event_type_t type;
+ /** Handle transition callback. */
+ cp_fsm_event_handler_t handler;
+};
+/* Forward declaration in cp/fsm/forward.h. */
+
+BEGIN_DECLS
+
+/**
+ * Allocate and initialise a new bare event without arguments.
+ * \param ctx control plane context
+ * \param type event type
+ * \return a reference to the new event
+ */
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type);
+
+/**
+ * Allocate and initialise a new event with an associated received MME.
+ * \param ctx control plane context
+ * \param type event type
+ * \param mme lent reference to the associated MME
+ * \return a reference to the new event
+ */
+cp_fsm_event_t *
+cp_fsm_event_mme_new (cp_t *ctx, cp_fsm_event_type_t type, cp_mme_rx_t *mme);
+
+/**
+ * Allocate and initialise a new event with an associated STA.
+ * \param ctx control plane context
+ * \param type event type
+ * \param net STA network
+ * \param sta lent reference to the associated STA
+ * \return a reference to the new event
+ */
+cp_fsm_event_t *
+cp_fsm_event_sta_new (cp_t *ctx, cp_fsm_event_type_t type,
+ cp_net_t *net, cp_sta_t *sta);
+
+/**
+ * Allocate and initialise a new event with an associated beacon.
+ * \param ctx control plane context
+ * \param type event type
+ * \param beacon lent reference to the associated beacon
+ * \param net network from which the beacon come from
+ * \param sta lent reference to the STA emitting the beacon
+ * \return a reference to the new event
+ */
+cp_fsm_event_t *
+cp_fsm_event_beacon_new (cp_t *ctx, cp_fsm_event_type_t type,
+ cp_beacon_desc_t *beacon, cp_net_t *net,
+ cp_sta_t *sta);
+
+/**
+ * Initialise event part of FSM context.
+ * \param ctx control plane context
+ */
+void
+cp_fsm_event_init (cp_t *ctx);
+
+END_DECLS
+
+#endif /* cp_fsm_inc_events_h */
diff --git a/cesar/cp/fsm/inc/tables.h b/cesar/cp/fsm/inc/tables.h
new file mode 100644
index 0000000000..ef0a19fc83
--- /dev/null
+++ b/cesar/cp/fsm/inc/tables.h
@@ -0,0 +1,36 @@
+#ifndef cp_fsm_inc_tables_h
+#define cp_fsm_inc_tables_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/fsm/inc/tables.h
+ * \brief FSM tables declaration.
+ * \ingroup cp_fsm
+ */
+
+/** Control Plane FSM transition table. */
+extern const cp_fsm_transition_t
+cp_fsm_transition_table[CP_FSM_STATE_NB][CP_FSM_EVENT_TYPE_NB];
+
+/** Control Plane FSM only branch table. */
+extern const cp_fsm_state_t
+cp_fsm_only_branch_table[CP_FSM_STATE_NB][CP_FSM_EVENT_TYPE_NB];
+
+/* Control Plane FSM state enter table. */
+const cp_fsm_enter_leave_t
+cp_fsm_enter_table[CP_FSM_STATE_NB];
+
+/* Control Plane FSM state leave table. */
+const cp_fsm_enter_leave_t
+cp_fsm_leave_table[CP_FSM_STATE_NB];
+
+/* Control Plane FSM initial states table. */
+extern const cp_fsm_state_t
+cp_fsm_initials_table[CP_FSM_INITIAL_NB];
+
+#endif /* cp_fsm_inc_tables_h */
diff --git a/cesar/cp/fsm/src/events.c b/cesar/cp/fsm/src/events.c
new file mode 100644
index 0000000000..ec58eced61
--- /dev/null
+++ b/cesar/cp/fsm/src/events.c
@@ -0,0 +1,230 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/fsm/src/events.c
+ * \brief FSM events.
+ * \ingroup cp_fsm
+ */
+#include "common/std.h"
+
+#include "cp/inc/context.h"
+
+#include "fsm.h"
+#include "inc/tables.h"
+
+typedef void (*cp_fsm_event_bare_transition_t) (cp_t *ctx);
+
+void
+cp_fsm_event_bare_handler (cp_t *ctx, cp_fsm_event_t *event,
+ cp_fsm_transition_t transition)
+{
+ dbg_assert (ctx);
+ dbg_assert_ptr (event);
+ dbg_assert (transition);
+ cp_fsm_event_bare_transition_t t = transition;
+ /* Call transition. */
+ t (ctx);
+}
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ dbg_assert (ctx);
+ dbg_assert (type < CP_FSM_EVENT_TYPE_NB);
+ cp_fsm_event_t *e;
+ e = slab_alloc (&ctx->fsm.event_bare_cache);
+ e->next = NULL;
+ e->type = type;
+ e->handler = cp_fsm_event_bare_handler;
+ return e;
+}
+
+/** MME event. */
+struct cp_fsm_event_mme_t
+{
+ /** Parent event. */
+ cp_fsm_event_t event;
+ /** Associated MME. */
+ cp_mme_rx_t *mme;
+};
+typedef struct cp_fsm_event_mme_t cp_fsm_event_mme_t;
+
+typedef void (*cp_fsm_event_mme_transition_t) (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_fsm_event_mme_handler (cp_t *ctx, cp_fsm_event_t *event,
+ cp_fsm_transition_t transition)
+{
+ dbg_assert (ctx);
+ dbg_assert_ptr (event);
+ dbg_assert (transition);
+ cp_fsm_event_mme_transition_t t = transition;
+ cp_fsm_event_mme_t *event_mme =
+ PARENT_OF (cp_fsm_event_mme_t, event, event);
+ /* Call transition. */
+ t (ctx, event_mme->mme);
+}
+
+cp_fsm_event_t *
+cp_fsm_event_mme_new (cp_t *ctx, cp_fsm_event_type_t type, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (type < CP_FSM_EVENT_TYPE_NB);
+ cp_fsm_event_mme_t *e;
+ e = slab_alloc (&ctx->fsm.event_mme_cache);
+ e->event.next = NULL;
+ e->event.type = type;
+ e->event.handler = cp_fsm_event_mme_handler;
+ slab_addref (mme);
+ e->mme = mme;
+ return &e->event;
+}
+
+void
+cp_fsm_event_mme_destructor (void *object)
+{
+ dbg_assert (object);
+ cp_fsm_event_mme_t *e = object;
+ slab_release (e->mme);
+}
+
+/** STA event. */
+struct cp_fsm_event_sta_t
+{
+ /** Parent event. */
+ cp_fsm_event_t event;
+ /** Associated net. */
+ cp_net_t *net;
+ /** Associated STA. */
+ cp_sta_t *sta;
+};
+typedef struct cp_fsm_event_sta_t cp_fsm_event_sta_t;
+
+typedef void (*cp_fsm_event_sta_transition_t) (cp_t *ctx,
+ cp_net_t *net,
+ cp_sta_t *sta);
+
+void
+cp_fsm_event_sta_handler (cp_t *ctx, cp_fsm_event_t *event,
+ cp_fsm_transition_t transition)
+{
+ dbg_assert (ctx);
+ dbg_assert_ptr (event);
+ dbg_assert (transition);
+ cp_fsm_event_sta_transition_t t = transition;
+ cp_fsm_event_sta_t *event_sta =
+ PARENT_OF (cp_fsm_event_sta_t, event, event);
+ /* Call transition. */
+ t (ctx, event_sta->net, event_sta->sta);
+}
+
+cp_fsm_event_t *
+cp_fsm_event_sta_new (cp_t *ctx, cp_fsm_event_type_t type,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (type < CP_FSM_EVENT_TYPE_NB);
+ cp_fsm_event_sta_t *e;
+ e = slab_alloc (&ctx->fsm.event_sta_cache);
+ e->event.next = NULL;
+ e->event.type = type;
+ e->event.handler = cp_fsm_event_sta_handler;
+ e->net = net;
+ slab_addref (sta);
+ e->sta = sta;
+ return &e->event;
+}
+
+void
+cp_fsm_event_sta_destructor (void *object)
+{
+ dbg_assert (object);
+ cp_fsm_event_sta_t *e = object;
+ slab_release (e->sta);
+}
+
+/** Beacon event. */
+struct cp_fsm_event_beacon_t
+{
+ /** Parent event. */
+ cp_fsm_event_t event;
+ /** Associated beacon. */
+ cp_beacon_desc_t *beacon;
+ /** Associated net. */
+ cp_net_t *net;
+ /** Associated STA. */
+ cp_sta_t *sta;
+};
+typedef struct cp_fsm_event_beacon_t cp_fsm_event_beacon_t;
+
+typedef void (*cp_fsm_event_beacon_transition_t) (cp_t *ctx,
+ cp_beacon_desc_t *beacon,
+ cp_net_t *net,
+ cp_sta_t *sta);
+
+void
+cp_fsm_event_beacon_handler (cp_t *ctx, cp_fsm_event_t *event,
+ cp_fsm_transition_t transition)
+{
+ dbg_assert (ctx);
+ dbg_assert_ptr (event);
+ dbg_assert (transition);
+ cp_fsm_event_beacon_transition_t t = transition;
+ cp_fsm_event_beacon_t *event_beacon =
+ PARENT_OF (cp_fsm_event_beacon_t, event, event);
+ /* Call transition. */
+ t (ctx, event_beacon->beacon, event_beacon->net, event_beacon->sta);
+}
+
+cp_fsm_event_t *
+cp_fsm_event_beacon_new (cp_t *ctx, cp_fsm_event_type_t type,
+ cp_beacon_desc_t *beacon, cp_net_t *net,
+ cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (type < CP_FSM_EVENT_TYPE_NB);
+ cp_fsm_event_beacon_t *e;
+ e = slab_alloc (&ctx->fsm.event_beacon_cache);
+ e->event.next = NULL;
+ e->event.type = type;
+ e->event.handler = cp_fsm_event_beacon_handler;
+ blk_addref_desc ((blk_t *) beacon);
+ e->beacon = beacon;
+ e->net = net;
+ slab_addref (sta);
+ e->sta = sta;
+ return &e->event;
+}
+
+void
+cp_fsm_event_beacon_destructor (void *object)
+{
+ dbg_assert (object);
+ cp_fsm_event_beacon_t *e = object;
+ blk_release_desc ((blk_t *) e->beacon);
+ slab_release (e->sta);
+}
+
+void
+cp_fsm_event_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ slab_cache_init (&ctx->fsm.event_bare_cache, "event_bare",
+ sizeof (cp_fsm_event_t),
+ NULL);
+ slab_cache_init (&ctx->fsm.event_mme_cache, "event_mme",
+ sizeof (cp_fsm_event_mme_t),
+ cp_fsm_event_mme_destructor);
+ slab_cache_init (&ctx->fsm.event_sta_cache, "event_sta",
+ sizeof (cp_fsm_event_sta_t),
+ cp_fsm_event_sta_destructor);
+ slab_cache_init (&ctx->fsm.event_beacon_cache, "event_beacon",
+ sizeof (cp_fsm_event_beacon_t),
+ cp_fsm_event_beacon_destructor);
+}
+
diff --git a/cesar/cp/fsm/src/fsm.c b/cesar/cp/fsm/src/fsm.c
new file mode 100644
index 0000000000..c05243f3c6
--- /dev/null
+++ b/cesar/cp/fsm/src/fsm.c
@@ -0,0 +1,186 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/fsm/src/fsm.c
+ * \brief FSM engine.
+ * \ingroup cp_fsm
+ */
+#include "common/std.h"
+
+#include "cp/inc/context.h"
+
+#include "fsm.h"
+#include "inc/tables.h"
+
+void
+cp_fsm_init (cp_t *ctx)
+{
+ uint i;
+ dbg_assert (ctx);
+ for (i = 0; i < CP_FSM_INITIAL_NB; i++)
+ ctx->fsm.active_states[i] = cp_fsm_initials_table[i];
+ for (i = 0; i < CP_FSM_INITIAL_NB; i++)
+ if (cp_fsm_enter_table[i])
+ cp_fsm_enter_table[i] (ctx);
+ ctx->fsm.handled_event = NULL;
+ ctx->fsm.head = NULL;
+ ctx->fsm.tail = NULL;
+ cp_fsm_event_init (ctx);
+}
+
+void
+cp_fsm_uninit (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ dbg_assert (!ctx->fsm.handled_event);
+ cp_fsm_event_t *p, *pnext;
+ for (p = ctx->fsm.head; p; p = pnext)
+ {
+ pnext = p->next;
+ slab_release (p);
+ }
+}
+
+/**
+ * Execute callbacks attached to enter and leave action of states.
+ * \param ctx control plane context
+ * \param i active state index
+ * \param to state entered
+ */
+static void
+cp_fsm_leave_enter (cp_t *ctx, uint i, cp_fsm_state_t to)
+{
+ dbg_assert (ctx);
+ dbg_assert (i < CP_FSM_INITIAL_NB);
+ dbg_assert (to < CP_FSM_STATE_NB);
+ cp_fsm_state_t from = ctx->fsm.active_states[i];
+ dbg_assert (from < CP_FSM_STATE_NB);
+ if (cp_fsm_leave_table[from])
+ cp_fsm_leave_table[from] (ctx);
+ ctx->fsm.active_states[i] = to;
+ if (cp_fsm_enter_table[to])
+ cp_fsm_enter_table[to] (ctx);
+}
+
+/**
+ * Handle event for one active state.
+ * \param ctx control plane context
+ * \param e event to handle
+ * \param i active state index
+ */
+static void
+cp_fsm_handled_event (cp_t *ctx, cp_fsm_event_t *e, uint i)
+{
+ dbg_assert (ctx);
+ dbg_assert (e);
+ dbg_assert (i < CP_FSM_INITIAL_NB);
+ cp_fsm_transition_t t =
+ cp_fsm_transition_table[ctx->fsm.active_states[i]][e->type];
+ if (t)
+ {
+ /* Transition with action. */
+ ctx->fsm.handled_event = e;
+ ctx->fsm.handled_active_state = i;
+ e->handler (ctx, e, t);
+ /* If state has not been set, this means that there is one and
+ * only one branch for this transition. Check this and change
+ * state. */
+ if (ctx->fsm.handled_event)
+ {
+ cp_fsm_state_t to =
+ cp_fsm_only_branch_table[ctx->fsm.active_states[i]][e->type];
+ dbg_assert_print (to != CP_FSM_STATE_NB,
+ "no branch selected");
+ dbg_assert (to < CP_FSM_STATE_NB);
+ if (to != CP_FSM_STATE_NB) /* Be clement for errors. */
+ cp_fsm_leave_enter (ctx, i, to);
+ ctx->fsm.handled_event = NULL;
+ }
+ }
+ else
+ {
+ /* Transition without action. */
+ cp_fsm_state_t to =
+ cp_fsm_only_branch_table[ctx->fsm.active_states[i]][e->type];
+ if (to != CP_FSM_STATE_NB)
+ {
+ dbg_assert (to < CP_FSM_STATE_NB);
+ cp_fsm_leave_enter (ctx, i, to);
+ ctx->fsm.handled_event = NULL;
+ }
+ }
+}
+
+void
+cp_fsm_process (cp_t *ctx)
+{
+ uint i;
+ dbg_assert (ctx);
+ dbg_assert (!ctx->fsm.handled_event);
+ if (ctx->fsm.head)
+ {
+ /* Extract event from queue. */
+ cp_fsm_event_t *e = ctx->fsm.head;
+ ctx->fsm.head = e->next;
+ if (!e->next)
+ dbg_invalid_ptr (ctx->fsm.tail);
+ dbg_assert (e->type < CP_FSM_EVENT_TYPE_NB);
+ dbg_assert (e->handler);
+ /* Handle event. */
+ for (i = 0; i < CP_FSM_INITIAL_NB; i++)
+ cp_fsm_handled_event (ctx, e, i);
+ /* Release event. */
+ slab_release (e);
+ }
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+ dbg_assert (ctx);
+ dbg_assert_ptr (event);
+ dbg_assert (event->next == NULL);
+ dbg_assert (event->type < CP_FSM_EVENT_TYPE_NB);
+ dbg_assert (event->handler);
+ /* Add event to event queue, do not add reference as it is transfered to
+ * us. */
+ if (ctx->fsm.head)
+ {
+ dbg_assert_ptr (ctx->fsm.tail);
+ ctx->fsm.tail->next = event;
+ }
+ else
+ ctx->fsm.head = event;
+ ctx->fsm.tail = event;
+}
+
+void
+cp_fsm_branch_ (cp_t *ctx, cp_fsm_branch_t branch)
+{
+ dbg_assert (ctx);
+ uint i = ctx->fsm.handled_active_state;
+ dbg_assert (i < CP_FSM_INITIAL_NB);
+ dbg_assert (ctx->fsm.active_states[i] < CP_FSM_STATE_NB);
+ dbg_assert_print (ctx->fsm.handled_event,
+ "not in transition or duplicated branch");
+ /* Check there is actually several branches. */
+ dbg_assert_print (cp_fsm_only_branch_table[ctx->fsm.active_states[i]]
+ [ctx->fsm.handled_event->type] == CP_FSM_STATE_NB,
+ "no branch");
+ /* Check this correspond to the current transition. */
+ cp_fsm_state_t state = ((uint) branch >> 16) & 0xff;
+ cp_fsm_event_type_t event_type = ((uint) branch >> 8) & 0xff;
+ dbg_assert_print (state == ctx->fsm.active_states[i]
+ && event_type == ctx->fsm.handled_event->type,
+ "bad branch");
+ /* Select this branch. */
+ cp_fsm_state_t to = ((uint) branch) & 0xff;
+ cp_fsm_leave_enter (ctx, i, to);
+ ctx->fsm.handled_event = NULL;
+}
+
diff --git a/cesar/cp/fsm/src/fsm/cp.conf b/cesar/cp/fsm/src/fsm/cp.conf
new file mode 100644
index 0000000000..2c50e8d998
--- /dev/null
+++ b/cesar/cp/fsm/src/fsm/cp.conf
@@ -0,0 +1,6 @@
+[user]
+template-dir = .
+
+[templates]
+template_defs.h = %_defs.h
+template_tables.h = %_tables.h
diff --git a/cesar/cp/fsm/src/fsm/cp.fsm b/cesar/cp/fsm/src/fsm/cp.fsm
new file mode 100644
index 0000000000..9dcdd0ca47
--- /dev/null
+++ b/cesar/cp/fsm/src/fsm/cp.fsm
@@ -0,0 +1,178 @@
+Control Plane FSM
+ Temporary test FSM for control plane.
+
+States:
+ UNASSOCIATED [enter=cp_sta_action_assoc__unassociated__enter]
+ WAIT_ASSOC_CONF
+ ASSOCIATED
+ AUTHENTICATED
+ LEAVING
+ LEAVE_WAIT
+
+ *STOPPED
+ STARTED
+ STOPPING
+
+ *POWERON
+ POWERON_JOINING
+ USTA
+ USTA_JOINING
+ UCCO
+ STA [enter=cp_sta_action_poweron__sta__enter]
+ CCO
+
+Events:
+ to_assoc
+ to_leave
+ assoc_timeout
+ renew
+ CC_ASSOC_CNF
+ CM_GET_KEY_REQ_PID0
+ CM_GET_KEY_CNF_PID0
+ CM_SET_KEY_REQ_PID1
+ CM_SET_KEY_CNF_PID1
+ CM_SET_KEY_REQ
+ CC_LEAVE_IND
+ CC_LEAVE_CNF
+ joined
+ left
+
+ DRV_STA_SET_MAC_ADDR_REQ
+ DRV_STA_SET_CCO_PREF_REQ
+ DRV_STA_SET_WAS_CCO_REQ
+ DRV_STA_SET_NPW_REQ
+ DRV_STA_SET_DPW_REQ
+ DRV_STA_SET_SL_REQ
+ DRV_STA_SET_NID_REQ
+ DRV_STA_SET_M_STA_HFID_REQ
+ DRV_STA_SET_U_STA_HFID_REQ
+ DRV_STA_SET_AVLN_HFID_REQ
+ DRV_STA_SET_TONEMASK_REQ
+ DRV_STA_MAC_START_REQ
+ DRV_STA_MAC_STOP_REQ
+
+ btt_timeout
+ ustt_timeout
+ BEACON
+ all_sta_leaved
+ join_timeout
+ association_request
+ net_list_empty
+ usta_ind
+ BEACON_NOT_RECEIVED
+ BEACON_TIMER_EXPIRES
+ snid_conflict
+
+UNASSOCIATED:
+ to_assoc -> WAIT_ASSOC_CONF [cp_sta_action_assoc__unassociated__to_assoc]
+ send CC_ASSOC.REQ
+
+WAIT_ASSOC_CONF:
+ CC_ASSOC_CNF: ok -> ASSOCIATED [cp_sta_action_assoc__wait_assoc_cnf__cc_assoc_cnf]
+ send CM_GET_KEY.REQ
+ CC_ASSOC_CNF: nok -> UNASSOCIATED
+ CC_ASSOC_CNF: unrelated -> .
+ assoc_timeout: retry -> . [cp_sta_action_assoc__wait_assoc_cnf__timeout]
+ send CC_ASSOC.REQ
+ assoc_timeout: no retry -> UNASSOCIATED
+
+ASSOCIATED:
+ CM_GET_KEY_CNF_PID0: ok -> AUTHENTICATED [cp_sta_action_assoc__associated__cm_get_key_cnf_pid_0]
+ CM_GET_KEY_CNF_PID0: nok -> UNASSOCIATED
+ CM_GET_KEY_CNF_PID0: unrelated -> .
+ assoc_timeout -> UNASSOCIATED [cp_sta_action_assoc__associated__timeout]
+
+AUTHENTICATED:
+ renew -> . [cp_sta_action_assoc__authenticated__renew]
+ send CC_ASSOC.REQ for renewal
+ CC_ASSOC_CNF -> . [cp_sta_action_assoc__authenticated__cc_assoc_cnf]
+ CM_SET_KEY_REQ_PID1 -> . [cp_sta_action_assoc__authenticated__cm_set_key_req_pid_1]
+ send CM_SET_KEY.CNF
+ to_leave -> LEAVING [cp_sta_action_assoc__authenticated__to_leave]
+ send CC_LEAVE.REQ
+ CC_LEAVE_IND: ok -> LEAVE_WAIT [cp_sta_action_assoc__authenticated__cc_leave_ind]
+ send CC_LEAVE.RSP
+ CC_LEAVE_IND: nok -> .
+
+LEAVING:
+ CC_LEAVE_CNF: ok -> UNASSOCIATED [cp_sta_action_assoc__leaving__cc_leave_cnf]
+ cleanup data plane
+ CC_LEAVE_CNF: unrelated -> .
+ assoc_timeout -> LEAVE_WAIT [cp_sta_action_assoc__leaving__timeout]
+ send CC_LEAVE.REQ
+
+LEAVE_WAIT:
+ assoc_timeout -> UNASSOCIATED [cp_sta_action_assoc__leave_wait__timeout]
+ cleanup data plane
+
+
+STOPPED:
+ DRV_STA_SET_MAC_ADDR_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req]
+ DRV_STA_SET_CCO_PREF_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req]
+ DRV_STA_SET_WAS_CCO_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_was_cco_req]
+ DRV_STA_SET_NPW_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_npw_req]
+ DRV_STA_SET_DPW_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_dpw_req]
+ DRV_STA_SET_SL_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_sl_req]
+ DRV_STA_SET_NID_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_nid_req]
+ DRV_STA_SET_M_STA_HFID_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_m_sta_hfid_req]
+ DRV_STA_SET_U_STA_HFID_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_u_sta_hfid_req]
+ DRV_STA_SET_AVLN_HFID_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_avln_hfid_req]
+ DRV_STA_SET_TONEMASK_REQ -> . [cp_sta_action_drv__stopped__drv_sta_set_tonemask_req]
+ DRV_STA_MAC_START_REQ -> STARTED [cp_sta_action_drv__stopped__drv_sta_mac_start_req]
+ send DRV_STA_MAC_START.CNF
+
+STARTED:
+ DRV_STA_MAC_STOP_REQ: associated -> STOPPING [cp_sta_action_drv__started__drv_sta_mac_stop_req]
+ DRV_STA_MAC_STOP_REQ: unassociated -> STOPPING
+ send DRV_STA_MAC_STOP.CNF
+
+STOPPING:
+ left -> STOPPED [cp_sta_action_drv__stopping__left]
+ send DRV_STA_MAC_STOP.CNF
+
+
+POWERON:
+ ustt_timeout -> . [cp_sta_action_poweron__poweron__ustt_timeout]
+ send CM_UNASSOCIATED_STA.IND if an AVLN is present
+ btt_timeout: nid match cco -> CCO [cp_sta_action_poweron__poweron__btt_timeout]
+ btt_timeout: avln -> USTA
+ btt_timeout: no avln -> UCCO
+ BEACON: nid match -> POWERON_JOINING [cp_sta_action_poweron__poweron__beacon]
+ BEACON: no nid match -> .
+
+USTA:
+ ustt_timeout -> . [cp_sta_action_poweron__usta__ustt_timeout]
+ send CM_UNASSOCIATED_STA.IND if an AVLN is present
+ BEACON: nid match -> USTA_JOINING [cp_sta_action_poweron__usta__beacon]
+ BEACON: no nid match -> .
+ net_list_empty -> UCCO [NULL]
+ usta_ind: nid match cco -> CCO [cp_sta_action_poweron__usta__usta_ind]
+ usta_ind: else -> .
+
+POWERON_JOINING:
+ left -> POWERON [cp_sta_action_poweron__poweron_joining__left]
+
+USTA_JOINING:
+ left -> USTA [cp_sta_action_poweron__usta_joining__left]
+
+POWERON_JOINING, USTA_JOINING:
+ joined -> STA [NULL]
+
+UCCO:
+ BEACON -> USTA [NULL]
+ association_request -> CCO [NULL]
+
+STA:
+ BEACON -> . [cp_sta_action_poweron__sta__beacon]
+ clear missed beacon counter
+ BEACON_NOT_RECEIVED: avln failure -> POWERON [cp_sta_action_poweron__sta__beacon_not_received]
+ BEACON_NOT_RECEIVED: else -> .
+ left -> USTA [NULL]
+
+CCO:
+ join_timeout: sta -> . [cp_sta_action_poweron__cco__join_timeout]
+ join_timeout: no sta avln -> USTA
+ join_timeout: no sta no avln -> UCCO
+ all_sta_leaved: avln -> USTA [cp_sta_action_poweron__cco__all_sta_leaved]
+ all_sta_leaved: no avln -> UCCO
+
diff --git a/cesar/cp/fsm/src/fsm/template_defs.h b/cesar/cp/fsm/src/fsm/template_defs.h
new file mode 100644
index 0000000000..d61762c492
--- /dev/null
+++ b/cesar/cp/fsm/src/fsm/template_defs.h
@@ -0,0 +1,52 @@
+#ifndef %(prefix)s_defs_h
+#define %(prefix)s_defs_h
+/*
+ * THIS IS AN AUTOMATICALLY GENERATED FILE, DO NOT EDIT!
+ *
+ * %(name)s
+ *
+%(*comments)s */
+
+/* %(name)s states. */
+enum %(prefix)s_state_t
+{
+%(states)s %(PREFIX)s_STATE_NB
+};
+typedef enum %(prefix)s_state_t %(prefix)s_state_t;
+
+/* %(name)s events types. */
+enum %(prefix)s_event_type_t
+{
+%(events,%(PREFIX)s_EVENT_TYPE_%(event)s)s %(PREFIX)s_EVENT_TYPE_NB
+};
+typedef enum %(prefix)s_event_type_t %(prefix)s_event_type_t;
+
+/* This macro enables checks for branches used in the wrong state/event
+ * combination. */
+#define _BRANCH(state, event, to) \
+ ((%(PREFIX)s_STATE_ ## state) << 16 \
+ | (%(PREFIX)s_EVENT_TYPE_ ## event) << 8 \
+ | (%(PREFIX)s_STATE_ ## to))
+
+/* %(name)s branches. */
+enum %(prefix)s_branch_t
+{
+%(branches)s};
+typedef enum %(prefix)s_branch_t %(prefix)s_branch_t;
+
+#undef _BRANCH
+
+/* %(name)s transition type. */
+typedef void *%(prefix)s_transition_t;
+
+/* %(name)s enter/leave type. */
+typedef void (*%(prefix)s_enter_leave_t) (cp_t *ctx);
+
+/* Value to use to follow a given branch. */
+#define %(PREFIX)s_BRANCH(state, event, branch) \
+ %(PREFIX)s_BRANCH__ ## state ## __ ## event ## __ ## branch
+
+/* %(name)s number of initial states. */
+#define %(PREFIX)s_INITIAL_NB %(initials_nb)s
+
+#endif /* %(prefix)s_defs_h */
diff --git a/cesar/cp/fsm/src/fsm/template_tables.h b/cesar/cp/fsm/src/fsm/template_tables.h
new file mode 100644
index 0000000000..c6fbefb1ac
--- /dev/null
+++ b/cesar/cp/fsm/src/fsm/template_tables.h
@@ -0,0 +1,32 @@
+/*
+ * THIS IS AN AUTOMATICALLY GENERATED FILE, DO NOT EDIT!
+ *
+ * %(name)s
+ *
+%(*comments)s */
+
+/* %(name)s transition table. */
+const %(prefix)s_transition_t
+%(prefix)s_transition_table[%(PREFIX)s_STATE_NB][%(PREFIX)s_EVENT_TYPE_NB] = {
+%(transition_table)s};
+
+/* %(name)s only branch table. */
+const %(prefix)s_state_t
+%(prefix)s_only_branch_table[%(PREFIX)s_STATE_NB][%(PREFIX)s_EVENT_TYPE_NB] = {
+%(only_branch_table)s};
+
+/* %(name)s state enter table. */
+const %(prefix)s_enter_leave_t
+%(prefix)s_enter_table[%(PREFIX)s_STATE_NB] = {
+%(states,%(@enter|NULL)s)s};
+
+/* %(name)s state leave table. */
+const %(prefix)s_enter_leave_t
+%(prefix)s_leave_table[%(PREFIX)s_STATE_NB] = {
+%(states,%(@leave|NULL)s)s};
+
+/* %(name)s initial states table. */
+const %(prefix)s_state_t
+%(prefix)s_initials_table[%(PREFIX)s_INITIAL_NB] = {
+%(initials)s};
+
diff --git a/cesar/cp/fsm/src/tables.c b/cesar/cp/fsm/src/tables.c
new file mode 100644
index 0000000000..8ed8677720
--- /dev/null
+++ b/cesar/cp/fsm/src/tables.c
@@ -0,0 +1,21 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/fsm/src/tables.c
+ * \brief FSM tables.
+ * \ingroup cp_fsm
+ */
+#include "common/std.h"
+
+#include "fsm.h"
+#include "inc/tables.h"
+
+#include "cp/sta/action/action.h"
+
+/* Include generated tables. */
+#include "cp_fsm_tables.h"
diff --git a/cesar/cp/fsm/test/utest/Config b/cesar/cp/fsm/test/utest/Config
new file mode 100644
index 0000000000..1221024089
--- /dev/null
+++ b/cesar/cp/fsm/test/utest/Config
@@ -0,0 +1 @@
+CONFIG_DEBUG_FATAL_CATCH = y
diff --git a/cesar/cp/fsm/test/utest/Makefile b/cesar/cp/fsm/test/utest/Makefile
new file mode 100644
index 0000000000..62d24791bf
--- /dev/null
+++ b/cesar/cp/fsm/test/utest/Makefile
@@ -0,0 +1,17 @@
+BASE = ../../../..
+
+INCLUDES = cp/fsm/test/utest cp/fsm/test/utest/override
+
+HOST_PROGRAMS = test_fsm
+test_fsm_SOURCES = test_fsm.c fsm_stub.c actions.c
+test_fsm_MODULES = lib lib/scenario cp/fsm
+cp_fsm_MODULE_SOURCES = fsm.c events.c
+
+include $(BASE)/common/make/top.mk
+
+$(call src2obj,src/test_fsm.c,host): $(BASE)/cp/fsm/fsm.h
+$(call src2obj,src/test_fsm.c,target): $(BASE)/cp/fsm/fsm.h
+
+# Override fsm.
+vpath %.fsm
+vpath %.fsm override
diff --git a/cesar/cp/fsm/test/utest/inc/scenario_defs.h b/cesar/cp/fsm/test/utest/inc/scenario_defs.h
new file mode 100644
index 0000000000..0638902f6d
--- /dev/null
+++ b/cesar/cp/fsm/test/utest/inc/scenario_defs.h
@@ -0,0 +1,97 @@
+#ifndef inc_scenario_defs_h
+#define inc_scenario_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/scenario_defs.h
+ * \brief Scenario definitions.
+ * \ingroup test
+ */
+
+#include "cp/types.h"
+#include "cp/mme.h"
+#include "cp/fsm/fsm.h"
+
+/* Scenario globals. */
+#define SCENARIO_DEFS_GLOBALS \
+ cp_t *cp;
+
+/* Scenario actions. */
+#define SCENARIO_DEFS_ACTIONS \
+ post_and_process
+
+typedef struct
+{
+ cp_fsm_event_type_t type;
+ cp_mme_rx_t *mme;
+ cp_beacon_desc_t *beacon;
+ cp_net_t *net;
+ cp_sta_t *sta;
+} scenario_action_post_and_process_t;
+
+void
+scenario_action_post_and_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params);
+
+/* Scenario events. */
+#define SCENARIO_DEFS_EVENTS \
+ cp_fsm__STATE1__event1, \
+ cp_fsm__STATE1__event2, \
+ cp_fsm__STATE1__event_mme, \
+ cp_fsm__STATE1__event_sta, \
+ cp_fsm__STATE1__event_beacon, \
+ cp_fsm__STATE1__eventb, \
+ cp_fsm__STATE2__event3, \
+ cp_fsm__STATE3__event1, \
+ cp_fsm__STATE3__event2, \
+ cp_fsm__STATE4__event1, \
+ cp_fsm__STATE5__enter, \
+ cp_fsm__STATE5__leave, \
+ cp_fsm__STATE6__enter, \
+ cp_fsm__STATE6__leave, \
+ cp_fsm__STATEA__eventb, \
+ cp_fsm__STATEB__eventa
+
+typedef struct
+{
+ cp_fsm_branch_t branch;
+} scenario_event_transition_with_branch_t;
+
+typedef scenario_empty_t scenario_event_cp_fsm__STATE1__event1_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATE1__event2_t;
+typedef struct
+{
+ cp_mme_rx_t *mme;
+} scenario_event_cp_fsm__STATE1__event_mme_t;
+typedef struct
+{
+ cp_net_t *net;
+ cp_sta_t *sta;
+} scenario_event_cp_fsm__STATE1__event_sta_t;
+typedef struct
+{
+ cp_beacon_desc_t *beacon;
+ cp_net_t *net;
+ cp_sta_t *sta;
+} scenario_event_cp_fsm__STATE1__event_beacon_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATE1__eventb_t;
+typedef scenario_event_transition_with_branch_t
+scenario_event_cp_fsm__STATE2__event3_t;
+typedef scenario_event_transition_with_branch_t
+scenario_event_cp_fsm__STATE3__event1_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATE3__event2_t;
+typedef scenario_event_transition_with_branch_t
+scenario_event_cp_fsm__STATE4__event1_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATE5__enter_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATE5__leave_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATE6__enter_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATE6__leave_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATEA__eventb_t;
+typedef scenario_empty_t scenario_event_cp_fsm__STATEB__eventa_t;
+
+#endif /* inc_scenario_defs_h */
diff --git a/cesar/cp/fsm/test/utest/override/cp2/fsm/src/fsm/cp.fsm b/cesar/cp/fsm/test/utest/override/cp2/fsm/src/fsm/cp.fsm
new file mode 100644
index 0000000000..a2da64a5a5
--- /dev/null
+++ b/cesar/cp/fsm/test/utest/override/cp2/fsm/src/fsm/cp.fsm
@@ -0,0 +1,72 @@
+Test Control Plane FSM
+ Test FSM for engine test.
+
+States:
+ STATE1
+ STATE2
+ STATE3
+ STATE4
+ STATE5 [enter=cp_fsm__STATE5__enter leave=cp_fsm__STATE5__leave]
+ STATE6 [enter=cp_fsm__STATE6__enter leave=cp_fsm__STATE6__leave]
+ *STATEA
+ STATEB
+
+Events:
+ event1
+ event2
+ event3
+ event4
+ event5
+ event6
+ error_event_no_branch
+ test error conditions: no branch selected
+ error_event_bad_branch
+ test error conditions: branch not for this event
+ error_event_dup_branch
+ test error conditions: branch selected two times
+ event_mme
+ event_sta
+ event_beacon
+ event_no_action
+ eventa
+ eventb
+
+STATE1:
+ event1 -> .
+ event2 -> STATE2
+ event5 -> STATE5 [NULL]
+ error_event_no_branch: branch1 -> .
+ error_event_no_branch: branch2 -> .
+ error_event_bad_branch: branch1 -> .
+ error_event_bad_branch: branch2 -> .
+ error_event_dup_branch: branch1 -> .
+ error_event_dup_branch: branch2 -> .
+ event_mme -> .
+ event_sta -> .
+ event_beacon -> .
+ event_no_action -> STATE3 [NULL]
+ eventb -> STATE3
+
+STATE2:
+ event3: branch1 -> STATE3
+ event3: branch2 -> STATE4
+
+STATE3:
+ event2 -> STATE2
+
+STATE3, STATE4:
+ event1: branch1 -> STATE1
+ event1: branch2 -> .
+
+STATE5:
+ event6 -> STATE6 [NULL]
+
+STATE6:
+ event1 -> STATE1 [NULL]
+
+STATEA:
+ eventb -> STATEB
+
+STATEB:
+ eventa -> STATEA
+
diff --git a/cesar/cp/fsm/test/utest/override/cp2/inc/context.h b/cesar/cp/fsm/test/utest/override/cp2/inc/context.h
new file mode 100644
index 0000000000..8eacbcbaa1
--- /dev/null
+++ b/cesar/cp/fsm/test/utest/override/cp2/inc/context.h
@@ -0,0 +1,25 @@
+#ifndef override_cp_inc_context_h
+#define override_cp_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/inc/context.h
+ * \brief Control plane context override.
+ * \ingroup test
+ */
+
+#include "cp/fsm/fsm.h"
+#include "cp/fsm/inc/context.h"
+
+struct cp_t
+{
+ /** FSM context. */
+ cp_fsm_t fsm;
+};
+
+#endif /* override_cp_inc_context_h */
diff --git a/cesar/cp/fsm/test/utest/src/actions.c b/cesar/cp/fsm/test/utest/src/actions.c
new file mode 100644
index 0000000000..3c74de91a1
--- /dev/null
+++ b/cesar/cp/fsm/test/utest/src/actions.c
@@ -0,0 +1,35 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/actions.c
+ * \brief Scenario actions.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+void
+scenario_action_post_and_process_cb (scenario_globals_t *globals,
+ scenario_params_t *params)
+{
+ scenario_action_post_and_process_t *p = &params->action_post_and_process;
+ cp_fsm_event_t *event;
+ if (p->mme)
+ event = cp_fsm_event_mme_new (globals->cp, p->type, p->mme);
+ else if (p->beacon)
+ event = cp_fsm_event_beacon_new (globals->cp, p->type, p->beacon,
+ p->net, p->sta);
+ else if (p->sta)
+ event = cp_fsm_event_sta_new (globals->cp, p->type, p->net, p->sta);
+ else
+ event = cp_fsm_event_bare_new (globals->cp, p->type);
+ cp_fsm_post (globals->cp, event);
+ cp_fsm_process (globals->cp);
+}
+
diff --git a/cesar/cp/fsm/test/utest/src/fsm_stub.c b/cesar/cp/fsm/test/utest/src/fsm_stub.c
new file mode 100644
index 0000000000..07c5581ec5
--- /dev/null
+++ b/cesar/cp/fsm/test/utest/src/fsm_stub.c
@@ -0,0 +1,205 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief Override FSM tables.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "cp/fsm/fsm.h"
+#include "cp/fsm/inc/tables.h"
+
+void
+cp_fsm__STATE1__event1 (cp_t *ctx);
+
+void
+cp_fsm__STATE1__event2 (cp_t *ctx);
+
+void
+cp_fsm__STATE1__error_event_no_branch (cp_t *ctx);
+
+void
+cp_fsm__STATE1__error_event_bad_branch (cp_t *ctx);
+
+void
+cp_fsm__STATE1__error_event_dup_branch (cp_t *ctx);
+
+void
+cp_fsm__STATE1__event_mme (cp_t *ctx, cp_mme_rx_t *mme);
+
+void
+cp_fsm__STATE1__event_sta (cp_t *ctx, cp_net_t *net, cp_sta_t *sta);
+
+void
+cp_fsm__STATE1__event_beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta);
+
+void
+cp_fsm__STATE1__eventb (cp_t *ctx);
+
+void
+cp_fsm__STATE2__event3 (cp_t *ctx);
+
+void
+cp_fsm__STATE3__event1 (cp_t *ctx);
+
+void
+cp_fsm__STATE3__event2 (cp_t *ctx);
+
+void
+cp_fsm__STATE4__event1 (cp_t *ctx);
+
+void
+cp_fsm__STATE5__enter (cp_t *ctx);
+
+void
+cp_fsm__STATE5__leave (cp_t *ctx);
+
+void
+cp_fsm__STATE6__enter (cp_t *ctx);
+
+void
+cp_fsm__STATE6__leave (cp_t *ctx);
+
+void
+cp_fsm__STATEA__eventb (cp_t *ctx);
+
+void
+cp_fsm__STATEB__eventa (cp_t *ctx);
+
+/* Include generated tables. */
+#include "cp_fsm_tables.h"
+
+void
+cp_fsm__STATE1__event1 (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE1__event1);
+}
+
+void
+cp_fsm__STATE1__event2 (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE1__event2);
+}
+
+void
+cp_fsm__STATE1__error_event_no_branch (cp_t *ctx)
+{
+ /* Do not choose branch. */
+}
+
+void
+cp_fsm__STATE1__error_event_bad_branch (cp_t *ctx)
+{
+ cp_fsm_branch (ctx, STATE2, event3, branch1);
+}
+
+void
+cp_fsm__STATE1__error_event_dup_branch (cp_t *ctx)
+{
+ cp_fsm_branch (ctx, STATE1, error_event_dup_branch, branch1);
+ cp_fsm_branch (ctx, STATE1, error_event_dup_branch, branch2);
+}
+
+void
+cp_fsm__STATE1__event_mme (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ scenario_event (cp_fsm__STATE1__event_mme, param);
+ test_fail_unless (mme == param->mme);
+}
+
+void
+cp_fsm__STATE1__event_sta (cp_t *ctx, cp_net_t *net, cp_sta_t *sta)
+{
+ scenario_event (cp_fsm__STATE1__event_sta, param);
+ test_fail_unless (net == param->net);
+ test_fail_unless (sta == param->sta);
+}
+
+void
+cp_fsm__STATE1__event_beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ scenario_event (cp_fsm__STATE1__event_beacon, param);
+ test_fail_unless (beacon == param->beacon);
+ test_fail_unless (net == param->net);
+ test_fail_unless (sta == param->sta);
+}
+
+void
+cp_fsm__STATE1__eventb (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE1__eventb);
+}
+
+void
+cp_fsm__STATE2__event3 (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE2__event3, param);
+ cp_fsm_branch_ (ctx, param->branch);
+}
+
+void
+cp_fsm__STATE3__event1 (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE3__event1, param);
+ cp_fsm_branch_ (ctx, param->branch);
+}
+
+void
+cp_fsm__STATE3__event2 (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE3__event2);
+}
+
+void
+cp_fsm__STATE4__event1 (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE4__event1, param);
+ cp_fsm_branch_ (ctx, param->branch);
+}
+
+void
+cp_fsm__STATE5__enter (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE5__enter);
+}
+
+void
+cp_fsm__STATE5__leave (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE5__leave);
+}
+
+void
+cp_fsm__STATE6__enter (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE6__enter);
+}
+
+void
+cp_fsm__STATE6__leave (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATE6__leave);
+}
+
+void
+cp_fsm__STATEA__eventb (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATEA__eventb);
+}
+
+void
+cp_fsm__STATEB__eventa (cp_t *ctx)
+{
+ scenario_event (cp_fsm__STATEB__eventa);
+}
+
diff --git a/cesar/cp/fsm/test/utest/src/test_fsm.c b/cesar/cp/fsm/test/utest/src/test_fsm.c
new file mode 100644
index 0000000000..23bcbed791
--- /dev/null
+++ b/cesar/cp/fsm/test/utest/src/test_fsm.c
@@ -0,0 +1,322 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_fsm.c
+ * \brief Test FSM module.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/blk.h"
+#include "lib/test.h"
+#include "lib/scenario/scenario.h"
+
+#include "cp/fsm/fsm.h"
+
+#include "cp/inc/context.h"
+
+void
+test_fsm_basic_test_case (test_t t)
+{
+ test_case_begin (t, "basic");
+ cp_t cp;
+ slab_cache_t cache;
+ slab_cache_init (&cache, "dummy", 1, NULL);
+ cp_mme_rx_t *mme = slab_alloc (&cache);
+ cp_sta_t *sta = slab_alloc (&cache);
+ cp_net_t *net = (void *) 0x9abcdef0;
+ cp_beacon_desc_t *beacon = (cp_beacon_desc_t *) blk_alloc_desc ();
+ test_begin (t, "bare")
+ {
+ cp_fsm_init (&cp);
+ scenario_entry_t entries[] = {
+ /* STATE1 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event1),
+ SCENARIO_EVENT (cp_fsm__STATE1__event1),
+ /* STATE1 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event2),
+ SCENARIO_EVENT (cp_fsm__STATE1__event2),
+ /* STATE2 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event3),
+ SCENARIO_EVENT (cp_fsm__STATE2__event3,
+ .branch = CP_FSM_BRANCH (STATE2, event3, branch1)),
+ /* STATE3 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event1),
+ SCENARIO_EVENT (cp_fsm__STATE3__event1,
+ .branch = CP_FSM_BRANCH (STATE3, event1, branch2)),
+ /* STATE3 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event2),
+ SCENARIO_EVENT (cp_fsm__STATE3__event2),
+ /* STATE2 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event3),
+ SCENARIO_EVENT (cp_fsm__STATE2__event3,
+ .branch = CP_FSM_BRANCH (STATE2, event3, branch2)),
+ /* STATE4 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event1),
+ SCENARIO_EVENT (cp_fsm__STATE4__event1,
+ .branch = CP_FSM_BRANCH (STATE4, event1, branch2)),
+ /* STATE4 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event1),
+ SCENARIO_EVENT (cp_fsm__STATE4__event1,
+ .branch = CP_FSM_BRANCH (STATE4, event1, branch1)),
+ /* STATE1 */
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_STATE1);
+ cp_fsm_uninit (&cp);
+ } test_end;
+ test_begin (t, "mme")
+ {
+ cp_fsm_init (&cp);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event_mme, .mme = mme),
+ SCENARIO_EVENT (cp_fsm__STATE1__event_mme, .mme = mme),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_STATE1);
+ cp_fsm_uninit (&cp);
+ } test_end;
+ test_begin (t, "sta")
+ {
+ cp_fsm_init (&cp);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event_sta,
+ .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm__STATE1__event_sta,
+ .net = net, .sta = sta),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_STATE1);
+ cp_fsm_uninit (&cp);
+ } test_end;
+ test_begin (t, "beacon")
+ {
+ cp_fsm_init (&cp);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event_beacon,
+ .beacon = beacon, .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm__STATE1__event_beacon,
+ .beacon = beacon, .net = net, .sta = sta),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_STATE1);
+ cp_fsm_uninit (&cp);
+ } test_end;
+ test_begin (t, "dual")
+ {
+ cp_fsm_init (&cp);
+ scenario_entry_t entries[] = {
+ /* STATE1, STATEA */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_eventb),
+ SCENARIO_EVENT (cp_fsm__STATE1__eventb),
+ SCENARIO_EVENT (cp_fsm__STATEA__eventb),
+ /* STATE3, STATEB */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_eventa),
+ SCENARIO_EVENT (cp_fsm__STATEB__eventa),
+ /* STATE3, STATEA */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event1),
+ SCENARIO_EVENT (cp_fsm__STATE3__event1,
+ .branch = CP_FSM_BRANCH (STATE3, event1, branch1)),
+ /* STATE1, STATEA */
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_STATE1);
+ test_fail_unless (cp.fsm.active_states[1] == CP_FSM_STATE_STATEA);
+ cp_fsm_uninit (&cp);
+ } test_end;
+ test_begin (t, "no action")
+ {
+ cp_fsm_init (&cp);
+ scenario_entry_t entries[] = {
+ /* STATE1 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event_no_action),
+ /* STATE3 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event1),
+ SCENARIO_EVENT (cp_fsm__STATE3__event1,
+ .branch = CP_FSM_BRANCH (STATE3, event1, branch1)),
+ /* STATE1 */
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_STATE1);
+ cp_fsm_uninit (&cp);
+ } test_end;
+ test_begin (t, "enter leave")
+ {
+ cp_fsm_init (&cp);
+ scenario_entry_t entries[] = {
+ /* STATE1 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event5),
+ SCENARIO_EVENT (cp_fsm__STATE5__enter),
+ /* STATE5 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event6),
+ SCENARIO_EVENT (cp_fsm__STATE5__leave),
+ SCENARIO_EVENT (cp_fsm__STATE6__enter),
+ /* STATE6 */
+ SCENARIO_ACTION (post_and_process,
+ .type = CP_FSM_EVENT_TYPE_event1),
+ SCENARIO_EVENT (cp_fsm__STATE6__leave),
+ /* STATE1 */
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &cp,
+ };
+ scenario_run (t, entries, &globals);
+ test_fail_unless (cp.fsm.active_states[0] == CP_FSM_STATE_STATE1);
+ cp_fsm_uninit (&cp);
+ } test_end;
+ slab_release (mme);
+ slab_release (sta);
+ slab_cache_uninit (&cache);
+ blk_release_desc ((blk_t *) beacon);
+}
+
+void
+test_fsm_error_test_case (test_t t)
+{
+ test_case_begin (t, "error");
+ cp_t cp;
+ test_begin (t, "no branch")
+ {
+ cp_fsm_init (&cp);
+ cp_fsm_event_t *event = cp_fsm_event_bare_new (
+ &cp, CP_FSM_EVENT_TYPE_error_event_no_branch);
+ cp_fsm_post (&cp, event);
+ const char *asserted = NULL;
+ dbg_fatal_try_begin
+ {
+ cp_fsm_process (&cp);
+ }
+ dbg_fatal_try_catch (const char *msg)
+ {
+ slab_release (event); /* Was not release due to assert. */
+ asserted = msg;
+ }
+ dbg_fatal_try_end;
+ test_fail_unless (asserted);
+ } test_end;
+ test_begin (t, "bad branch")
+ {
+ cp_fsm_init (&cp);
+ cp_fsm_event_t *event = cp_fsm_event_bare_new (
+ &cp, CP_FSM_EVENT_TYPE_error_event_bad_branch);
+ cp_fsm_post (&cp, event);
+ const char *asserted = NULL;
+ dbg_fatal_try_begin
+ {
+ cp_fsm_process (&cp);
+ }
+ dbg_fatal_try_catch (const char *msg)
+ {
+ slab_release (event); /* Was not release due to assert. */
+ asserted = msg;
+ }
+ dbg_fatal_try_end;
+ test_fail_unless (asserted);
+ } test_end;
+ test_begin (t, "dup branch")
+ {
+ cp_fsm_init (&cp);
+ cp_fsm_event_t *event = cp_fsm_event_bare_new (
+ &cp, CP_FSM_EVENT_TYPE_error_event_dup_branch);
+ cp_fsm_post (&cp, event);
+ const char *asserted = NULL;
+ dbg_fatal_try_begin
+ {
+ cp_fsm_process (&cp);
+ }
+ dbg_fatal_try_catch (const char *msg)
+ {
+ slab_release (event); /* Was not release due to assert. */
+ asserted = msg;
+ }
+ dbg_fatal_try_end;
+ test_fail_unless (asserted);
+ } test_end;
+ test_begin (t, "not in transition")
+ {
+ cp_fsm_init (&cp);
+ const char *asserted = NULL;
+ dbg_fatal_try_begin
+ {
+ cp_fsm_branch (&cp, STATE1, error_event_no_branch, branch1);
+ }
+ dbg_fatal_try_catch (const char *msg)
+ {
+ asserted = msg;
+ }
+ dbg_fatal_try_end;
+ test_fail_unless (asserted);
+ } test_end;
+}
+
+void
+test_fsm_test_suite (test_t t)
+{
+ test_suite_begin (t, "fsm");
+ test_fsm_basic_test_case (t);
+ test_fsm_error_test_case (t);
+ test_case_begin (t, "memory");
+ test_begin (t, "memory")
+ {
+ test_fail_unless (blk_check_memory ());
+ } test_end;
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ test_init (t, argc, argv);
+ test_fsm_test_suite (t);
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/inc/context.h b/cesar/cp/inc/context.h
new file mode 100644
index 0000000000..110b63b677
--- /dev/null
+++ b/cesar/cp/inc/context.h
@@ -0,0 +1,117 @@
+#ifndef cp_inc_cp_h
+#define cp_inc_cp_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/inc/cp_private.h
+ * \brief Control plane context.
+ * \ingroup cp
+ *
+ */
+#include "lib/rnd.h"
+
+#include "mac/common/config.h"
+#include "interface/interface.h"
+#include "cl/cl.h"
+
+#include "hal/phy/phy.h"
+#include "hal/timer/timer.h"
+
+/* Public interfaces. */
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/core/core.h"
+#include "cp/sta/action/action.h"
+#include "cp/cco/action/cco_action.h"
+#include "cp/pwl/pwl.h"
+#include "cp/beacon/beacon.h"
+#include "cp/cco/bw/bw.h"
+#include "cp/cco/region/region.h"
+#include "cp/conn/conn_mgr.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/fsm/forward.h"
+#include "cp/fsm/fsm.h"
+
+/* Private interfaces. */
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "cp/sta/core/inc/core.h"
+#include "cp/sta/action/inc/context.h"
+#include "cp/cco/action/inc/cco_action.h"
+#include "cp/beacon/inc/beacon.h"
+#include "cp/cco/region/inc/region.h"
+#include "cp/cl_interf/inc/context.h"
+#include "cp/msg/inc/context.h"
+#include "cp/fsm/inc/context.h"
+
+
+struct cp_t
+{
+ /** FSM context. */
+ cp_fsm_t fsm;
+
+ /** station core context. */
+ cp_sta_core_t sta_core;
+
+ /** station manager context. */
+ cp_sta_mgr_t sta_mgr;
+
+ /** CCo Action. */
+ cp_cco_action_t cco_action;
+
+ /** Sta action. */
+ cp_sta_action_t sta_action;
+
+ /** PWL Module. */
+ cp_pwl_t pwl;
+
+ /** Beacon module. */
+ cp_beacon_t beacon;
+
+ /** Region manager context. */
+ cp_cco_region_t region;
+
+ /** Bandwidth Manager context. */
+ cp_cco_bw_t bw;
+
+ /** Connection manager context. */
+ cp_conn_mgr_t conn_mgr;
+
+ /** Cl Interface context. */
+ cp_cl_interf_t cl_interf;
+
+ /** MSG context. */
+ cp_msg_t msg;
+
+ /** The mac config context. */
+ mac_config_t *mac_config;
+
+ /** The interface context. */
+ interface_t *interface;
+
+ /** Convergence layer context. */
+ cl_t *cl;
+
+ /** Phy context. */
+ phy_t *phy;
+
+ /** Hal timer context. */
+ hal_timer_t *hal_timer;
+
+ /** Mac Store. */
+ mac_store_t *mac_store;
+
+ /** Channel access context. */
+ ca_t *ca;
+
+ /** PB Processing layer. */
+ pbproc_t *pbproc;
+
+ /** Random generator. */
+ lib_rnd_t rnd;
+};
+
+#endif /* cp_inc_cp_h */
diff --git a/cesar/cp/mme.h b/cesar/cp/mme.h
new file mode 100644
index 0000000000..8a1fa9ef9e
--- /dev/null
+++ b/cesar/cp/mme.h
@@ -0,0 +1,326 @@
+#ifndef cp_mme_h
+#define cp_mme_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/mme.h
+ * \brief Definition of the MME types.
+ * \ingroup cp
+ */
+#include "lib/bitstream.h"
+#include "lib/blk.h"
+
+#include "cp/types.h"
+#include "cp/secu/secu.h"
+
+/* MMTYPE base values for DRV MME messages. */
+#define DRV_STA_SET_MAC_ADDR 0xA000
+#define DRV_STA_SET_CCO_PREF 0xA004
+#define DRV_STA_SET_WAS_CCO 0xA008
+#define DRV_STA_SET_NPW 0xA00C
+#define DRV_STA_SET_DPW 0xA010
+#define DRV_STA_SET_SL 0xA014
+#define DRV_STA_SET_M_STA_HFID 0xA018
+#define DRV_STA_SET_U_STA_HFID 0xA01C
+#define DRV_STA_SET_AVLN_HFID 0xA020
+#define DRV_STA_SET_TONEMASK 0xA024
+#define DRV_STA_START 0xA028
+#define DRV_STA_STOP 0xA02C
+#define DRV_STA_SET_NID 0xA030
+
+/* MMTYPE sub-values for MMEs (REQ, CNF, IND or RSP). */
+#define CP_MME_REQ 0x00
+#define CP_MME_CNF 0x01
+#define CP_MME_IND 0x02
+#define CP_MME_RSP 0x03
+
+/** MMTYPE constants. */
+enum cp_mmtype_t
+{
+ CC_CCO_APPOINT_REQ = 0x0000,
+ CC_CCO_APPOINT_CNF = 0x0001,
+ CC_BACKUP_APPOINT_REQ = 0x0004,
+ CC_BACKUP_APPOINT_CNF = 0x0005,
+ CC_LINK_INFO_REQ = 0x0008,
+ CC_LINK_INFO_CNF = 0x0009,
+ CC_LINK_INFO_IND = 0x000A,
+ CC_LINK_INFO_RSP = 0x000B,
+ CC_HANDOVER_REQ = 0x000C,
+ CC_HANDOVER_CNF = 0x000D,
+ CC_HANDOVER_INFO_IND = 0x0012,
+ CC_HANDOVER_INFO_RSP = 0x0013,
+ CC_DISCOVER_LIST_REQ = 0x0014,
+ CC_DISCOVER_LIST_CNF = 0x0015,
+ CC_DISCOVER_LIST_IND = 0x0016,
+ CC_LINK_NEW_REQ = 0x0018,
+ CC_LINK_NEW_CNF = 0x0019,
+ CC_LINK_MOD_REQ = 0x001C,
+ CC_LINK_MOD_CNF = 0x001D,
+ CC_LINK_SQZ_REQ = 0x0020,
+ CC_LINK_SQZ_CNF = 0x0021,
+ CC_LINK_REL_REQ = 0x0024,
+ CC_LINK_REL_IND = 0x0025,
+ CC_DETECT_REPORT_REQ = 0x0028,
+ CC_DETECT_REPORT_CNF = 0x0029,
+ CC_WHO_RU_REQ = 0x002C,
+ CC_WHO_RU_CNF = 0x002D,
+ CC_ASSOC_REQ = 0x0030,
+ CC_ASSOC_CNF = 0x0031,
+ CC_LEAVE_REQ = 0x0034,
+ CC_LEAVE_CNF = 0x0035,
+ CC_LEAVE_IND = 0x0036,
+ CC_LEAVE_RSP = 0x0037,
+ CC_SET_TEI_MAP_REQ = 0x0038,
+ CC_SET_TEI_MAP_IND = 0x0039,
+ CC_RELAY_REQ = 0x003C,
+ CC_RELAY_IND = 0x003D,
+ CC_BEACON_RELIABILITY_REQ = 0x0040,
+ CC_BEACON_RELIABILITY_CNF = 0x0041,
+ CC_ALLOC_MOVE_REQ = 0x0044,
+ CC_ALLOC_MOVE_CNF = 0x0045,
+ CC_ACCESS_NEW_REQ = 0x0048,
+ CC_ACCESS_NEW_CNF = 0x0049,
+ CC_ACCESS_NEW_IND = 0x004A,
+ CC_ACCESS_NEW_RSP = 0x004B,
+ CC_ACCESS_REL_REQ = 0x004C,
+ CC_ACCESS_REL_CNF = 0x004D,
+ CC_ACCESS_REL_IND = 0x004E,
+ CC_ACCESS_REL_RSP = 0x004F,
+ CC_DCPPC_IND = 0x0052,
+ CC_DCPPC_RSP = 0x0053,
+ CC_HP1_DET_REQ = 0x0054,
+ CC_HP1_DET_CNF = 0x0055,
+ CC_BLE_UPDATE_IND = 0x005A,
+
+ CP_PROXY_APPOINT_REQ = 0x2000,
+ CP_PROXY_APPOINT_CNF = 0x2001,
+ PH_PROXY_APPOINT_IND = 0x2006,
+ CP_PROXY_WAKE_REQ = 0x2008,
+
+ NN_INL_REQ = 0x4000,
+ NN_INL_CNF = 0x4001,
+ NN_NEW_REQ = 0x4004,
+ NN_NEW_CNF = 0x4005,
+ NN_NEW_IND = 0x4006,
+ NN_ADD_ALLOC_REQ = 0x4008,
+ NN_ADD_ALLOC_CNF = 0x4009,
+ NN_ADD_ALLOC_IND = 0x400A,
+ NN_REL_ALLOC_REQ = 0x400C,
+ NN_REL_ALLOC_CNF = 0x400D,
+ NN_REL_NET_IND = 0x4012,
+
+ CM_UNASSOCIATED_STA_IND = 0x6002,
+ CM_ENCRYPTED_PAYLOAD_IND = 0x6006,
+ CM_ENCRYPTED_PAYLOAD_RSP = 0x6007,
+ CM_SET_KEY_REQ = 0x6008,
+ CM_SET_KEY_CNF = 0x6009,
+ CM_GET_KEY_REQ = 0x600C,
+ CM_GET_KEY_CNF = 0x600D,
+ CM_SC_JOIN_REQ = 0x6010,
+ CM_SC_JOIN_CNF = 0x6011,
+ CM_CHAN_EST_IND = 0x6016,
+ CM_TM_UPDATE_IND = 0x601A,
+ CM_AMP_MAP_REQ = 0x601C,
+ CM_AMP_MAP_CNF = 0x601D,
+ CM_BRG_INFO_REQ = 0x6020,
+ CM_BRG_INFO_CNF = 0x6021,
+ CM_CONN_NEW_REQ = 0x6024,
+ CM_CONN_NEW_CNF = 0x6025,
+ CM_CONN_REL_IND = 0x602A,
+ CM_CONN_REL_RSP = 0x602B,
+ CM_CONN_MOD_REQ = 0x602C,
+ CM_CONN_MOD_CNF = 0x602D,
+ CM_CONN_INFO_REQ = 0x6030,
+ CM_CONN_INFO_CNF = 0x6031,
+ CM_STA_CAP_REQ = 0x6034,
+ CM_STA_CAP_CNF = 0x6035,
+ CM_NW_INFO_REQ = 0x6038,
+ CM_NW_INFO_CNF = 0x6039,
+ CM_GET_BEACON_REQ = 0x603C,
+ CM_GET_BEACON_CNF = 0x603D,
+ CM_HFID_REQ = 0x6040,
+ CM_HFID_CNF = 0x6041,
+ CM_MME_ERROR_IND = 0x6046,
+ CM_NW_STATS_REQ = 0x6048,
+ CM_NW_STATS_CNF = 0x6049,
+ CM_LINK_STATS_REQ = 0x604C,
+ CM_LINK_STATS_CNF = 0x604D,
+
+ DRV_STA_SET_MAC_ADDR_REQ = DRV_STA_SET_MAC_ADDR + CP_MME_REQ,
+ DRV_STA_SET_MAC_ADDR_CNF = DRV_STA_SET_MAC_ADDR + CP_MME_CNF,
+ DRV_STA_SET_CCO_PREF_REQ = DRV_STA_SET_CCO_PREF + CP_MME_REQ,
+ DRV_STA_SET_CCO_PREF_CNF = DRV_STA_SET_CCO_PREF + CP_MME_CNF,
+ DRV_STA_SET_WAS_CCO_REQ = DRV_STA_SET_WAS_CCO + CP_MME_REQ,
+ DRV_STA_SET_WAS_CCO_CNF = DRV_STA_SET_WAS_CCO + CP_MME_CNF,
+ DRV_STA_SET_WAS_CCO_IND = DRV_STA_SET_WAS_CCO + CP_MME_IND,
+ DRV_STA_SET_WAS_CCO_RSP = DRV_STA_SET_WAS_CCO + CP_MME_RSP,
+ DRV_STA_SET_NPW_REQ = DRV_STA_SET_NPW + CP_MME_REQ,
+ DRV_STA_SET_NPW_CNF = DRV_STA_SET_NPW + CP_MME_CNF,
+ DRV_STA_SET_DPW_REQ = DRV_STA_SET_DPW + CP_MME_REQ,
+ DRV_STA_SET_DPW_CNF = DRV_STA_SET_DPW + CP_MME_CNF,
+ DRV_STA_SET_SL_REQ = DRV_STA_SET_SL + CP_MME_REQ,
+ DRV_STA_SET_SL_CNF = DRV_STA_SET_SL + CP_MME_CNF,
+ DRV_STA_SET_M_STA_HFID_REQ = DRV_STA_SET_M_STA_HFID + CP_MME_REQ,
+ DRV_STA_SET_M_STA_HFID_CNF = DRV_STA_SET_M_STA_HFID + CP_MME_CNF,
+ DRV_STA_SET_U_STA_HFID_REQ = DRV_STA_SET_U_STA_HFID + CP_MME_REQ,
+ DRV_STA_SET_U_STA_HFID_CNF = DRV_STA_SET_U_STA_HFID + CP_MME_CNF,
+ DRV_STA_SET_AVLN_HFID_REQ = DRV_STA_SET_AVLN_HFID + CP_MME_REQ,
+ DRV_STA_SET_AVLN_HFID_CNF = DRV_STA_SET_AVLN_HFID + CP_MME_CNF,
+ DRV_STA_SET_TONEMASK_REQ = DRV_STA_SET_TONEMASK + CP_MME_REQ,
+ DRV_STA_SET_TONEMASK_CNF = DRV_STA_SET_TONEMASK + CP_MME_CNF,
+ DRV_STA_START_REQ = DRV_STA_START + CP_MME_REQ,
+ DRV_STA_START_CNF = DRV_STA_START + CP_MME_CNF,
+ DRV_STA_STOP_REQ = DRV_STA_STOP + CP_MME_REQ,
+ DRV_STA_STOP_CNF = DRV_STA_STOP + CP_MME_CNF,
+ DRV_STA_SET_NID_REQ = DRV_STA_SET_NID + CP_MME_REQ,
+ DRV_STA_SET_NID_CNF = DRV_STA_SET_NID + CP_MME_CNF,
+};
+typedef enum cp_mmtype_t cp_mmtype_t;
+
+/** Payload encryption key select. */
+enum cp_mme_peks_t
+{
+ /** Encrypted using destination station DAK. */
+ CP_MME_PEKS_DAK,
+ /** Encrypted using NMK known to station. */
+ CP_MME_PEKS_NMK,
+ /** First TEK identifier. */
+ CP_MME_PEKS_TEK_MIN,
+ /** Last TEK identifier. */
+ CP_MME_PEKS_TEK_MAX = 0xe,
+ /** Number of TEK identifiers. */
+ CP_MME_PEKS_TEK_NB = CP_MME_PEKS_TEK_MAX - CP_MME_PEKS_TEK_MIN + 1,
+ /** No encryption. */
+ CP_MME_PEKS_NONE = 0xf,
+ /** Number of valid PEKS in a MME. */
+ CP_MME_PEKS_NB,
+ /** Special value meaning no encapsulation in a
+ * CM_ENCRYPTED_PAYLOAD.IND. */
+ CP_MME_PEKS_SPC_NOT_EMBEDDED = 0x100,
+};
+typedef enum cp_mme_peks_t cp_mme_peks_t;
+
+/** MME peer (sender or recipient, depending of the MME direction).
+ *
+ * This structure contains information needed to send a MME to the right
+ * destination. It is contained in the RX MME handle in order to respond to a
+ * received MME. */
+struct cp_mme_peer_t
+{
+ /** Peer MAC address. */
+ mac_t mac;
+ /** VLAN tag or 0 if none. */
+ u32 vlan_tag;
+ /** Peer TEI, or 0xff if not TEI based. */
+ cp_tei_t tei;
+ /** Send to every stations of our AVLN. */
+ bool all_sta;
+};
+typedef struct cp_mme_peer_t cp_mme_peer_t;
+
+/** Relay information for the MME relay. */
+struct cp_mme_relay_t
+{
+ /** Mac address corresponding to the Final destination in the REQ and the
+ * Original source for the IND. */
+ mac_t mac_fa;
+ /** Final TEI. */
+ cp_tei_t ftei;
+};
+typedef struct cp_mme_relay_t cp_mme_relay_t;
+
+/** MME handle for RX. */
+struct cp_mme_rx_t
+{
+ /** pointer to the received MME. */
+ u8 *p_mme;
+ /** pointer to the MME's fragments. */
+ blk_t *p_frag;
+ /** Pointer to the current frag. */
+ blk_t *p_frag_current;
+ /** MMType the type of MME. */
+ uint mmtype;
+ /** size of the MME (including header). */
+ uint length;
+ /** Peer information. */
+ cp_mme_peer_t peer;
+ /** Payload encryption. */
+ cp_mme_peks_t peks;
+ /** Protocol run information if present. */
+ cp_secu_protocol_run_t prun;
+ /** \TODO use the correct bitstream. */
+ bitstream_t bitstream;
+ /** Data used by the CL. */
+ void *cl_data;
+ /** CP context used by the destructor of the MME_rx_t message. */
+ cp_t *cp;
+ /** IV or UUID. */
+ cp_key_t iv_uuid;
+ /** Relay information. */
+ cp_mme_relay_t relay;
+};
+typedef struct cp_mme_rx_t cp_mme_rx_t;
+
+/** MME handle for TX. */
+struct cp_mme_tx_t
+{
+ /** pointer to the Tx buffer. */
+ u8 *p_mme;
+ /** size of the mme (including header). */
+ uint length;
+ /** true if the message is encapsulated in cc_relay. */
+ bool relay;
+ /** Peer information. */
+ cp_mme_peer_t peer;
+ /** Payload encryption. */
+ cp_mme_peks_t peks;
+ /** Protocol run information if present. */
+ cp_secu_protocol_run_t prun;
+ /** \TODO use the correct bitstream. */
+ bitstream_t bitstream;
+ /** CP context used by the destructor of the MME_tx_t message. */
+ cp_t *cp;
+ /** Offset of the payload. */
+ uint payload_offset;
+ /** RF Len. */
+ uint rf_len;
+ /** IV or UUID. */
+ cp_key_t iv_uuid;
+};
+typedef struct cp_mme_tx_t cp_mme_tx_t;
+
+/** Construct a cp_mme_peer_t for unicast to all STA. */
+#define CP_MME_PEER_ALL_STA \
+ ((cp_mme_peer_t) { .all_sta = true })
+
+/** Construct a cp_mme_peer_t from a MAC address and an optional TEI. */
+#define CP_MME_PEER(mac, tei...) \
+ PASTE_EXPAND (CP_MME_PEER_, PREPROC_NARG (mac, ## tei)) (mac, ## tei)
+
+#define CP_MME_PEER_1(mac_) \
+ CP_MME_PEER_2 (mac_, 0xff)
+#define CP_MME_PEER_2(mac_, tei_) \
+ ((cp_mme_peer_t) { .mac = mac_, .vlan_tag = 0, .tei = tei_, \
+ .all_sta = false })
+
+/**
+ * Compare two cp_mme_peer_t.
+ * \param p1 first structure
+ * \param p2 second structure
+ * \return true if they match.
+ *
+ * This only works for MAC or MAC+TEI peer structures, ignoring VLAN tag and
+ * all_sta flag.
+ */
+extern inline bool
+cp_mme_peer_cmp (cp_mme_peer_t *p1, cp_mme_peer_t *p2)
+{
+ return p1->mac == p2->mac && p1->tei == p2->tei;
+}
+
+#endif /* cp_mme_h */
diff --git a/cesar/cp/msg/Module b/cesar/cp/msg/Module
new file mode 100644
index 0000000000..ea8a9bae40
--- /dev/null
+++ b/cesar/cp/msg/Module
@@ -0,0 +1 @@
+SOURCES := msg.c mme.c msg_cc.c msg_cm.c
diff --git a/cesar/cp/msg/inc/cc_assoc.h b/cesar/cp/msg/inc/cc_assoc.h
new file mode 100644
index 0000000000..f1f3708378
--- /dev/null
+++ b/cesar/cp/msg/inc/cc_assoc.h
@@ -0,0 +1,64 @@
+#ifndef cp_msg_inc_cc_assoc_h
+#define cp_msg_inc_cc_assoc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/cc_assoc.h
+ * \brief CC_ASSOC messages.
+ * \ingroup cp_msg
+ */
+
+/** CC_ASSOC.REQ request type. */
+enum cp_msg_cc_assoc_req_type_t
+{
+ CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ CP_MSG_CC_ASSOC_REQ_TYPE_RENEW,
+ CP_MSG_CC_ASSOC_REQ_TYPE_NB
+};
+
+/** CC_ASSOC.CNF result. */
+enum cp_msg_cc_assoc_cnf_result_t
+{
+ CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_TEMPORARY_RESSOURCE_EXHAUSTION,
+ CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_PERMANANT_RESSOURCE_EXHAUSTION,
+ CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_OTHER_REASON,
+ CP_MSG_CC_ASSOC_CNF_RESULT_NB
+};
+
+/** Data associated with a CC_ASSOC.REQ message. */
+struct cp_msg_cc_assoc_req_t
+{
+ /** Request type. */
+ enum cp_msg_cc_assoc_req_type_t request_type;
+ /** NID of the AVLN. */
+ cp_nid_t nid;
+ /** Station CCo capability. */
+ u8 cco_cap;
+ /** Station proxy capability. */
+ u8 proxy_cap;
+};
+typedef struct cp_msg_cc_assoc_req_t cp_msg_cc_assoc_req_t;
+
+/** Data associated with a CC_ASSOC.CNF message. */
+struct cp_msg_cc_assoc_cnf_t
+{
+ /** Association result. */
+ enum cp_msg_cc_assoc_cnf_result_t result;
+ /** NID of the AVLN. */
+ cp_nid_t nid;
+ /** SNID of the AVLN. */
+ cp_snid_t snid;
+ /** Station TEI. */
+ cp_tei_t sta_tei;
+ /** Lease time for the TEI. */
+ u16 lease_time_min;
+};
+typedef struct cp_msg_cc_assoc_cnf_t cp_msg_cc_assoc_cnf_t;
+
+#endif /* cp_msg_inc_cc_assoc_h */
diff --git a/cesar/cp/msg/inc/cc_leave.h b/cesar/cp/msg/inc/cc_leave.h
new file mode 100644
index 0000000000..3250f4b305
--- /dev/null
+++ b/cesar/cp/msg/inc/cc_leave.h
@@ -0,0 +1,33 @@
+#ifndef cp_msg_inc_cc_leave_h
+#define cp_msg_inc_cc_leave_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/cc_leave.h
+ * \brief CC_LEAVE messages.
+ * \ingroup cp_msg
+ */
+
+/** CC_LEAVE.REQ reason for the disassociation. */
+enum cp_msg_cc_leave_req_reason_t
+{
+ CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST,
+ CP_MSG_CC_LEAVE_REQ_REASON_POWER_DOWN,
+ CP_MSG_CC_LEAVE_REQ_REASON_NB
+};
+
+/** CC_LEAVE.IND reason for the disassociation. */
+enum cp_msg_cc_leave_ind_reason_t
+{
+ CP_MSG_CC_LEAVE_IND_REASON_USER_REQUEST,
+ CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
+ CP_MSG_CC_LEAVE_IND_REASON_CCO_SHUTTING_DOWN,
+ CP_MSG_CC_LEAVE_IND_REASON_NB
+};
+
+#endif /* cp_msg_inc_cc_leave_h */
diff --git a/cesar/cp/msg/inc/cc_set_tei_map.h b/cesar/cp/msg/inc/cc_set_tei_map.h
new file mode 100644
index 0000000000..44ed35e716
--- /dev/null
+++ b/cesar/cp/msg/inc/cc_set_tei_map.h
@@ -0,0 +1,51 @@
+#ifndef cp_msg_inc_cc_set_tei_map_h
+#define cp_msg_inc_cc_set_tei_map_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/cc_set_tei_map.h
+ * \brief CC_SET_TEI_MAP messages.
+ * \ingroup cp_msg
+ */
+
+/** CC_SET_TEI_MAP.IND mode. */
+enum cp_msg_cc_set_tei_map_ind_mode_t
+{
+ CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE,
+ CP_MSG_CC_SET_TEI_MAP_IND_MODE_ADD,
+ CP_MSG_CC_SET_TEI_MAP_IND_MODE_DELETE,
+ CP_MSG_CC_SET_TEI_MAP_IND_MODE_NB
+};
+
+/** CC_SET_TEI_MAP.IND station status. */
+enum cp_msg_cc_set_tei_map_ind_status_t
+{
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED,
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED,
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_DISASSOCIATED,
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_NB
+};
+
+/** CC_SET_TEI_MAP change buffer data. */
+struct cp_msg_cc_set_tei_map_change_buffer_t
+{
+ /** CP context. */
+ cp_t *cp;
+ /** MSG context. */
+ void *msg;
+ /** FMI data, number of fragment. */
+ uint fmi_nbFrag;
+ /** Fragment number. */
+ uint fmi_fnmi;
+ /** Sequence number. */
+ uint fmi_ssn;
+};
+typedef struct cp_msg_cc_set_tei_map_change_buffer_t
+cp_msg_cc_set_tei_map_change_buffer_t;
+
+#endif /* cp_msg_inc_cc_set_tei_map_h */
diff --git a/cesar/cp/msg/inc/cc_who_ru.h b/cesar/cp/msg/inc/cc_who_ru.h
new file mode 100644
index 0000000000..14fd168620
--- /dev/null
+++ b/cesar/cp/msg/inc/cc_who_ru.h
@@ -0,0 +1,28 @@
+#ifndef cp_msg_inc_cc_who_ru_h
+#define cp_msg_inc_cc_who_ru_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/cc_who_ru.h
+ * \brief CC_WHO_RU messages.
+ * \ingroup cp_msg
+ */
+
+/** Data associated with a CC_WHO_RU.CNF message. */
+struct cp_msg_cc_who_ru_cnf_t
+{
+ /** NID of network being queried. */
+ cp_nid_t nid;
+ /** CCo MAC address. */
+ mac_t cco_mac;
+ /** HFID of AVLN. */
+ char avln_hfid[CP_HFID_SIZE + 1];
+};
+typedef struct cp_msg_cc_who_ru_cnf_t cp_msg_cc_who_ru_cnf_t;
+
+#endif /* cp_msg_inc_cc_who_ru_h */
diff --git a/cesar/cp/msg/inc/cm_get_key.h b/cesar/cp/msg/inc/cm_get_key.h
new file mode 100644
index 0000000000..ae5fe29152
--- /dev/null
+++ b/cesar/cp/msg/inc/cm_get_key.h
@@ -0,0 +1,59 @@
+#ifndef cp_msg_inc_cm_get_key_h
+#define cp_msg_inc_cm_get_key_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/cm_get_key.h
+ * \brief CM_GET_KEY messages.
+ * \ingroup cp_msg
+ */
+
+/** CM_GET_KEY.CNF result. */
+enum cp_msg_cm_get_key_cnf_result_t
+{
+ CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ CP_MSG_CM_GET_KEY_CNF_RESULT_REQUEST_REFUSED,
+ CP_MSG_CM_GET_KEY_CNF_RESULT_UNSUPPORTED_METHOD_KEY_TYPE,
+ CP_MSG_CM_GET_KEY_CNF_RESULT_NB
+};
+
+/** Data associated with a CM_GET_KEY.REQ message. */
+struct cp_msg_cm_get_key_req_t
+{
+ /** Request type: direct or relayed. */
+ bool relayed;
+ /** Requested key type. */
+ enum cp_msg_key_type_t key_type;
+ /** NID. */
+ cp_nid_t nid;
+ /** Hash key if present. */
+ u8 hash_key[CP_HASH_KEY_SIZE];
+};
+typedef struct cp_msg_cm_get_key_req_t cp_msg_cm_get_key_req_t;
+
+/** Data associated with a CM_GET_KEY.CNF message. */
+struct cp_msg_cm_get_key_cnf_t
+{
+ /** Result. */
+ enum cp_msg_cm_get_key_cnf_result_t result;
+ /** Requested key type. */
+ enum cp_msg_key_type_t key_type;
+ /** NID. */
+ cp_nid_t nid;
+ /** EKS. */
+ u8 eks;
+ union {
+ /** Hash key if present. */
+ u8 hash_key[CP_HASH_KEY_SIZE];
+ /** Key if present. */
+ cp_key_t key;
+ };
+};
+typedef struct cp_msg_cm_get_key_cnf_t cp_msg_cm_get_key_cnf_t;
+
+#endif /* cp_msg_inc_cm_get_key_h */
diff --git a/cesar/cp/msg/inc/cm_key.h b/cesar/cp/msg/inc/cm_key.h
new file mode 100644
index 0000000000..dcc25f6b45
--- /dev/null
+++ b/cesar/cp/msg/inc/cm_key.h
@@ -0,0 +1,28 @@
+#ifndef cp_msg_inc_cm_key_h
+#define cp_msg_inc_cm_key_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/cm_key.h
+ * \brief CM_SET_KEY and CM_GET_KEY messages.
+ * \ingroup cp_msg
+ */
+
+/** Key type, used in CM_SET_KEY and CM_GET_KEY. */
+enum cp_msg_key_type_t
+{
+ CP_MSG_KEY_DAK,
+ CP_MSG_KEY_NMK,
+ CP_MSG_KEY_NEK,
+ CP_MSG_KEY_TEK,
+ CP_MSG_KEY_HASH_KEY,
+ CP_MSG_KEY_NONCE_ONLY,
+ CP_MSG_KEY_NB
+};
+
+#endif /* cp_msg_inc_cm_key_h */
diff --git a/cesar/cp/msg/inc/cm_mme_error.h b/cesar/cp/msg/inc/cm_mme_error.h
new file mode 100644
index 0000000000..61e2b5b8b3
--- /dev/null
+++ b/cesar/cp/msg/inc/cm_mme_error.h
@@ -0,0 +1,39 @@
+#ifndef cp_msg_inc_cm_mme_error_h
+#define cp_msg_inc_cm_mme_error_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/cm_mme_error.h
+ * \brief CM_MME_ERROR messages.
+ * \ingroup cp_msg
+ */
+
+/** CM_MME_ERROR.IND reason. */
+enum cp_msg_cm_mme_error_ind_reason_t
+{
+ CP_MSG_CM_MME_ERROR_IND_REASON_MME_NOT_SUPPORTED,
+ CP_MSG_CM_MME_ERROR_IND_REASON_INVALID_MME_FIELDS,
+ CP_MSG_CM_MME_ERROR_IND_REASON_UNSUPPORTED_FEATURE,
+ CP_MSG_CM_MME_ERROR_IND_REASON_NB
+};
+
+/** Data associated with a CM_MME_ERROR.IND message. */
+struct cp_msg_cm_mme_error_ind_t
+{
+ /** Reason of error. */
+ enum cp_msg_cm_mme_error_ind_reason_t reason;
+ /** Version of received MME. */
+ u8 rx_mmv;
+ /** MMTYPE of received MME. */
+ cp_mmtype_t rx_mmtype;
+ /** Offset of first invalid field. */
+ uint offset;
+};
+typedef struct cp_msg_cm_mme_error_ind_t cp_msg_cm_mme_error_ind_t;
+
+#endif /* cp_msg_inc_cm_mme_error_h */
diff --git a/cesar/cp/msg/inc/cm_set_key.h b/cesar/cp/msg/inc/cm_set_key.h
new file mode 100644
index 0000000000..3d4ebc1b22
--- /dev/null
+++ b/cesar/cp/msg/inc/cm_set_key.h
@@ -0,0 +1,50 @@
+#ifndef cp_msg_inc_cm_set_key_h
+#define cp_msg_inc_cm_set_key_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/cm_set_key.h
+ * \brief CM_SET_KEY messages.
+ * \ingroup cp_msg
+ */
+
+/** CM_SET_KEY.CNF result. */
+enum cp_msg_cm_set_key_cnf_result_t
+{
+ CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS,
+ CP_MSG_CM_SET_KEY_CNF_RESULT_FAILURE,
+ CP_MSG_CM_SET_KEY_CNF_RESULT_NB
+};
+
+/** Data associated with a CM_SET_KEY.REQ message. */
+struct cp_msg_cm_set_key_req_t
+{
+ /** Key type. */
+ enum cp_msg_key_type_t key_type;
+ /** CCo capability. */
+ u8 cco_cap;
+ /** NID. */
+ cp_nid_t nid;
+ /** New EKS. */
+ u8 new_eks;
+ /** New key if present. */
+ cp_key_t new_key;
+};
+typedef struct cp_msg_cm_set_key_req_t cp_msg_cm_set_key_req_t;
+
+/** Data associated with a CM_SET_KEY.CNF message. */
+struct cp_msg_cm_set_key_cnf_t
+{
+ /** Result. */
+ enum cp_msg_cm_set_key_cnf_result_t result;
+ /** CCo capability. */
+ u8 cco_cap;
+};
+typedef struct cp_msg_cm_set_key_cnf_t cp_msg_cm_set_key_cnf_t;
+
+#endif /* cp_msg_inc_cm_set_key_h */
diff --git a/cesar/cp/msg/inc/context.h b/cesar/cp/msg/inc/context.h
new file mode 100644
index 0000000000..d69afb1e5f
--- /dev/null
+++ b/cesar/cp/msg/inc/context.h
@@ -0,0 +1,28 @@
+#ifndef cp_msg_inc_context_h
+#define cp_msg_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/msg.h
+ * \brief MSG context.
+ * \ingroup cp_msg
+ *
+ */
+#include "lib/slab.h"
+
+/** Message context. */
+struct cp_msg_t
+{
+ /** Slab cache for the MME TX. */
+ slab_cache_t mme_tx_slab_cache;
+ /** Slab cache for the MME RX. */
+ slab_cache_t mme_rx_slab_cache;
+};
+typedef struct cp_msg_t cp_msg_t;
+
+#endif /* cp_msg_inc_context_h */
diff --git a/cesar/cp/msg/inc/msg.h b/cesar/cp/msg/inc/msg.h
new file mode 100644
index 0000000000..766e2244f8
--- /dev/null
+++ b/cesar/cp/msg/inc/msg.h
@@ -0,0 +1,55 @@
+#ifndef cp_msg_inc_msg_h
+#define cp_msg_inc_msg_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/msg.h
+ * \brief Private function headers.
+ * \ingroup cp_msg
+ */
+#include "cp/mme.h"
+
+#define CP_MSG_ENCRYPTED_DATA_HEADER_SIZE 24
+#define CP_MSG_ENCRYPTED_DATA_FOOTER_SIZE 9
+
+/**
+ * Function to init the mme rx t messages.
+ * \param ctx the module context.
+ * \param mme the MME received.
+ * \param length the MME length.
+ * \param tei the source TEI.
+ * \return the mme rx message initialised.
+ */
+cp_mme_rx_t *
+cp_msg_mme_rx_init (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei);
+
+/**
+ * Function to init the mme rx t messages.
+ * \param ctx the module context.
+ * \return the mme rx message initialised.
+ */
+cp_mme_tx_t *
+cp_msg_mme_tx_init (cp_t *ctx);
+
+/**
+ * Function destructor for the MME RX messages.
+ * \param ctx the module context.
+ * \param msg the message context.
+ */
+void
+cp_msg_mme_rx_destructor (cp_mme_rx_t *mme);
+
+/**
+ * Function destructor for the MME TX messages.
+ * \param ctx the module context.
+ * \param msg the message context.
+ */
+void
+cp_msg_mme_tx_destructor (cp_mme_tx_t *mme);
+
+#endif /* cp_msg_inc_msg_h */
diff --git a/cesar/cp/msg/inc/msg_cc.h b/cesar/cp/msg/inc/msg_cc.h
new file mode 100644
index 0000000000..44a72ca197
--- /dev/null
+++ b/cesar/cp/msg/inc/msg_cc.h
@@ -0,0 +1,364 @@
+#ifndef cp_msg_inc_msg_cc_h
+#define cp_msg_inc_msg_cc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/msg_cc.h
+ * \brief CC family MME.
+ * \ingroup cp_msg
+ */
+#include "cc_who_ru.h"
+#include "cc_assoc.h"
+#include "cc_leave.h"
+#include "cc_set_tei_map.h"
+
+#include "cp/mme.h"
+
+BEGIN_DECLS
+
+/**
+ * Send a CC_WHO_RU.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param nid NID of the requested AVLN
+ */
+void
+cp_msg_cc_who_ru_req_send (cp_t *ctx, cp_mme_peer_t *peer, cp_nid_t nid);
+
+/**
+ * Receive a CC_WHO_RU.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param nid received NID of the requested AVLN
+ * \return true on success
+ */
+bool
+cp_msg_cc_who_ru_req_receive (cp_t *ctx, cp_mme_rx_t *mme, cp_nid_t *nid);
+
+/**
+ * Send a CC_WHO_RU.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_who_ru_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_who_ru_cnf_t *data);
+
+/**
+ * Receive a CC_WHO_RU.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_who_ru_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_who_ru_cnf_t *data);
+
+/**
+ * Send a CC_ASSOC.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_assoc_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_req_t *data);
+
+/**
+ * Receive a CC_ASSOC.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_assoc_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_req_t *data);
+
+/**
+ * Send a CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_assoc_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_cnf_t *data);
+
+/**
+ * Receive a CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_assoc_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_cnf_t *data);
+
+/**
+ * Send a CC_LEAVE.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param reason reason for the disassociation
+ */
+void
+cp_msg_cc_leave_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_leave_req_reason_t reason);
+
+/**
+ * Receive a CC_LEAVE.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param reason received reason for the disassociation
+ * \return true on success
+ */
+bool
+cp_msg_cc_leave_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ enum cp_msg_cc_leave_req_reason_t *reason);
+
+/**
+ * Send a CC_LEAVE.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_leave_cnf_send (cp_t *ctx, cp_mme_peer_t *peer);
+
+/**
+ * Receive a CC_LEAVE.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \return true on success
+ */
+bool
+cp_msg_cc_leave_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Send a CC_LEAVE.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param reason reason for the disassociation
+ * \param nid NID
+ */
+void
+cp_msg_cc_leave_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_leave_ind_reason_t reason,
+ cp_nid_t nid);
+
+/**
+ * Receive a CC_LEAVE.IND.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param reason received reason for the disassociation
+ * \param nid received NID
+ * \return true on success
+ */
+bool
+cp_msg_cc_leave_ind_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ enum cp_msg_cc_leave_ind_reason_t *reason,
+ cp_nid_t *nid);
+
+/**
+ * Send a CC_LEAVE.RSP.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_leave_rsp_send (cp_t *ctx, cp_mme_peer_t *peer);
+
+/**
+ * Receive a CC_LEAVE.RSP.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \return true on success
+ */
+bool
+cp_msg_cc_leave_rsp_receive (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Send a CC_SET_TEI_MAP.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_set_tei_map_req_send (cp_t *ctx, cp_mme_peer_t *peer);
+
+/**
+ * Receive a CC_SET_TEI_MAP.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \return true on success
+ */
+bool
+cp_msg_cc_set_tei_map_req_receive (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Begin a CC_SET_TEI_MAP.IND construction.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mode update, add or delete
+ * \param sta_nb number of stations sent
+ * \return the MME being constructed
+ */
+cp_mme_tx_t *
+cp_msg_cc_set_tei_map_ind_send_begin (
+ cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_set_tei_map_ind_mode_t mode, uint sta_nb);
+
+/**
+ * Write a station to a CC_SET_TEI_MAP.IND being constructed.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ * \param tei STA TEI
+ * \param mac STA mac address
+ * \param status STA status
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_sta (
+ cp_t *ctx, cp_mme_tx_t *mme, cp_tei_t tei, mac_t mac,
+ enum cp_msg_cc_set_tei_map_ind_status_t status);
+
+/**
+ * Finalise and send a CC_SET_TEI_MAP.IND message.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_end (cp_t *ctx, cp_mme_tx_t *mme);
+
+/**
+ * Begin a CC_SET_TEI_MAP.IND reception.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param mode received mode: update, add or delete
+ * \param sta_nb received number of STA
+ * \return true on success
+ */
+bool
+cp_msg_cc_set_tei_map_ind_receive_begin (
+ cp_t *ctx, cp_mme_rx_t *mme,
+ enum cp_msg_cc_set_tei_map_ind_mode_t *mode, uint *sta_nb);
+
+/**
+ * Read a station from a received CC_SET_TEI_MAP.IND.
+ * \param ctx control plane context
+ * \param mme MME being received
+ * \param tei received STA TEI
+ * \param mac received STA mac address
+ * \param status received STA status
+ * \return true on success
+ */
+bool
+cp_msg_cc_set_tei_map_ind_receive_sta (
+ cp_t *ctx, cp_mme_rx_t *mme, cp_tei_t *tei, mac_t *mac,
+ enum cp_msg_cc_set_tei_map_ind_status_t *status);
+
+/**
+ * Finalise a CC_SET_TEI_MAP.IND reception.
+ * \param ctx control plane context
+ * \param mme MME being received
+ * \return true on success
+ */
+bool
+cp_msg_cc_set_tei_map_ind_receive_end (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Write the header of a CC_RELAY MME.
+ * \param ctx the module context.
+ * \param peer the peer information.
+ * \param mmtype the MMType of the MME CC_RELAY_REQ or CC_RELAY_IND.
+ * \param prun if the MME shall be encrypted.
+ * \param peks the Payload encryption key select.
+ * \param fda the final destination mac address.
+ * \param ftei the final TEI.
+ */
+cp_mme_tx_t *
+cp_msg_cc_relay_send_begin (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype,
+ const cp_secu_protocol_run_t *prun,
+ cp_mme_peks_t peks,
+ mac_t fda, cp_tei_t ftei);
+
+/**
+ * Finalise the MME CC_RELAY.*.
+ * \param ctx the module context.
+ * \param msg the MME to send.
+ * \param length the MME length corresponding (header included).
+ *
+ * Patch the Length of the MME payload in the MSG CC_RELAY.REQ MME.
+ */
+void
+cp_msg_cc_relay_send_finalise (cp_t *ctx, cp_mme_tx_t *msg, uint length);
+
+/**
+ * Write the header of a CC_RELAY MME.
+ * \param ctx the module context.
+ * \param peer the peer information.
+ * \param mmtype the MMType of the MME CC_RELAY_REQ or CC_RELAY_IND.
+ * \param prun if the MME shall be encrypted.
+ * \param peks the Payload encryption key select.
+ * \param fda the final destination mac address.
+ * \param ftei the final TEI.
+ */
+extern inline cp_mme_tx_t *
+cp_msg_cc_relay_req_send_begin (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_secu_protocol_run_t *prun,
+ cp_mme_peks_t peks,
+ mac_t fda, cp_tei_t ftei)
+{
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (fda);
+ dbg_assert (ftei);
+
+ return cp_msg_cc_relay_send_begin (ctx, peer, CC_RELAY_REQ,
+ prun, peks,
+ fda, ftei);
+}
+
+/**
+ * Write the header of a CC_RELAY MME.
+ * \param ctx the module context.
+ * \param peer the peer information.
+ * \param prun if the MME shall be encrypted.
+ * \param peks the Payload encryption key select.
+ * \param fda the final destination mac address.
+ * \param ftei the final TEI.
+ */
+extern inline cp_mme_tx_t *
+cp_msg_cc_relay_ind_send_begin (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_secu_protocol_run_t *prun,
+ cp_mme_peks_t peks,
+ mac_t fda, cp_tei_t ftei)
+{
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (fda);
+ dbg_assert (ftei);
+
+ return cp_msg_cc_relay_send_begin (ctx, peer, CC_RELAY_IND,
+ prun, peks,
+ fda, ftei);
+}
+
+/**
+ * Receive a CC_RELAY.*
+ * \param ctx the control plane context.
+ * \param msg the MME context.
+ * \param length the MME payload length contained.
+ *
+ * Initialise the Relay MME.
+ */
+void
+cp_msg_cc_relay_receive (cp_t *ctx, cp_mme_rx_t *msg, uint *length);
+
+END_DECLS
+
+#endif /* cp_msg_inc_msg_cc_h */
diff --git a/cesar/cp/msg/inc/msg_cm.h b/cesar/cp/msg/inc/msg_cm.h
new file mode 100644
index 0000000000..052521a814
--- /dev/null
+++ b/cesar/cp/msg/inc/msg_cm.h
@@ -0,0 +1,203 @@
+#ifndef cp_msg_inc_msg_cm_h
+#define cp_msg_inc_msg_cm_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/msg_cm.h
+ * \brief CM family MME.
+ * \ingroup cp_msg
+ */
+#include "cm_key.h"
+#include "cm_set_key.h"
+#include "cm_get_key.h"
+#include "cm_mme_error.h"
+
+BEGIN_DECLS
+
+/**
+ * Send a CM_UNASSOCIATED_STA.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param nid NID of the transmitting STA
+ * \param cco_cap CCo capability of the transmitting STA
+ */
+void
+cp_msg_cm_unassociated_sta_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_nid_t nid, u8 cco_cap);
+
+/**
+ * Receive a CM_UNASSOCIATED_STA.IND.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param nid received NID of the transmitting STA
+ * \param cco_cap received CCo capability of the transmitting STA
+ * \return true on success
+ */
+bool
+cp_msg_cm_unassociated_sta_ind_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_nid_t *nid, u8 *cco_cap);
+
+/**
+ * Get the PID of the CM_SET_KEY.CNF.
+ * \param ctx the Control plane context.
+ * \param mme the MME handle.
+ * \return pid the pid of the MME.
+ */
+uint
+cp_msg_cm_set_key_get_pid (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Send a CM_SET_KEY.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_set_key_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_set_key_req_t *data);
+
+/**
+ * Receive a CM_SET_KEY.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_set_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_set_key_req_t *data);
+
+/**
+ * Get the PID of the CM_GET_KEY.CNF.
+ * \param ctx the Control plane context.
+ * \param mme the MME handle.
+ * \return pid the pid of the MME.
+ */
+uint
+cp_msg_cm_get_key_cnf_get_pid (cp_t *ctx, cp_mme_rx_t *mme);
+
+
+/**
+ * Send a CM_SET_KEY.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_set_key_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_set_key_cnf_t *data);
+
+/**
+ * Receive a CM_SET_KEY.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_set_key_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_set_key_cnf_t *data);
+
+/**
+ * Get the PID of the CM_GET_KEY.REQ.
+ * \param ctx the Control plane context.
+ * \param mme the MME handle.
+ * \return pid the pid of the MME.
+ */
+uint
+cp_msg_cm_get_key_req_get_pid (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Send a CM_GET_KEY.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_get_key_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_get_key_req_t *data);
+
+/**
+ * Receive a CM_GET_KEY.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_get_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_get_key_req_t *data);
+
+/**
+ * Send a CM_GET_KEY.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_get_key_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_get_key_cnf_t *data);
+
+/**
+ * Receive a CM_GET_KEY.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_get_key_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_get_key_cnf_t *data);
+
+/**
+ * Send a CM_MME_ERROR.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_mme_error_ind_send (cp_t *ctx, cp_mme_peer_t *peer_info,
+ const cp_msg_cm_mme_error_ind_t *data);
+/**
+ * Receive a CM_MME_ERROR.IND.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cm_mme_error_ind_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_mme_error_ind_t *data);
+
+END_DECLS
+
+#endif /* cp_msg_inc_msg_cm_h */
diff --git a/cesar/cp/msg/inc/msg_drv.h b/cesar/cp/msg/inc/msg_drv.h
new file mode 100644
index 0000000000..470ad59df3
--- /dev/null
+++ b/cesar/cp/msg/inc/msg_drv.h
@@ -0,0 +1,177 @@
+#ifndef cp_msg_inc_msg_drv_h
+#define cp_msg_inc_msg_drv_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/inc/msg_drv.h
+ * \brief DRV family MME.
+ * \ingroup cp_msg
+ */
+
+/** Result of a DRV family request. */
+enum cp_msg_drv_result_t
+{
+ CP_MSG_DRV_RESULT_SUCCESS,
+ CP_MSG_DRV_RESULT_FAILURE,
+ CP_MSG_DRV_RESULT_NB,
+};
+typedef enum cp_msg_drv_result_t cp_msg_drv_result_t;
+
+BEGIN_DECLS
+
+/**
+ * Receive a DRV_STA_SET_MAC_ADDR.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param mac received mac address
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_mac_addr_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ mac_t *mac);
+
+/**
+ * Receive a DRV_STA_SET_CCO_PREF.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param cco_pref received CCo preferred flag
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_cco_pref_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ bool *cco_pref);
+
+/**
+ * Receive a DRV_STA_SET_WAS_CCO.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param was_cco received was CCo flag
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_was_cco_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ bool *was_cco);
+
+/**
+ * Receive a DRV_STA_SET_NPW.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param npw received NPW
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_npw_req_receive (cp_t *ctx, cp_mme_rx_t *mme, char *npw);
+
+/**
+ * Receive a DRV_STA_SET_DPW.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param dpw received device password
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_dpw_req_receive (cp_t *ctx, cp_mme_rx_t *mme, char *dpw);
+
+/**
+ * Receive a DRV_STA_SET_SL.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param sl received SL
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_sl_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_security_level_t *sl);
+
+/**
+ * Receive a DRV_STA_SET_NID.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param nid received NID
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_nid_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_nid_t *nid);
+
+/**
+ * Receive a DRV_STA_SET_M_STA_HFID.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param m_sta_hfid received manufacturer STA HFID
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_m_sta_hfid_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ char *m_sta_hfid);
+
+/**
+ * Receive a DRV_STA_SET_U_STA_HFID.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param u_sta_hfid received user STA HFID
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_u_sta_hfid_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ char *u_sta_hfid);
+
+/**
+ * Receive a DRV_STA_SET_AVLN_HFID.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param avln_hfid received AVLN HFID
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_avln_hfid_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ char *avln_hfid);
+
+/**
+ * Receive a DRV_STA_SET_TONEMASK.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param tonemask received tonemask
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_set_tonemask_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ u32 *tonemask);
+
+/**
+ * Receive a DRV_STA_MAC_START.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_mac_start_req_receive (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Receive a DRV_STA_MAC_STOP.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \return true on success
+ */
+bool
+cp_msg_drv_sta_mac_stop_req_receive (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Send a DRV_....CNF, works for any DRV messages.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mmtype MMTYPE to respond to
+ * \param result result code
+ */
+void
+cp_msg_drv_any_cnf_send (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype,
+ cp_msg_drv_result_t result);
+
+END_DECLS
+
+#endif /* cp_msg_inc_msg_drv_h */
diff --git a/cesar/cp/msg/msg.h b/cesar/cp/msg/msg.h
new file mode 100644
index 0000000000..712117c753
--- /dev/null
+++ b/cesar/cp/msg/msg.h
@@ -0,0 +1,188 @@
+#ifndef cp_msg_msg_h
+#define cp_msg_msg_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/msg.h
+ * \brief MME creation and decoding.
+ * \ingroup cp_msg
+ *
+ * The msg module handles:
+ *
+ * - messages decoding,
+ * - messages encoding,
+ * - messages dispatch,
+ * - encrypted payload encapsulation,
+ * - relaying encapsulation.
+ */
+#include "cp/cp.h"
+#include "cp/mme.h"
+#include "cp/defs.h"
+
+#include "inc/msg_cc.h"
+#include "inc/msg_cm.h"
+#include "inc/msg_drv.h"
+
+enum cp_msg_avln_status_t
+{
+ CP_MSG_AVLN_STATUS_UNASSOC_CCO_0,
+ CP_MSG_AVLN_STATUS_UNASSOC_CCO_1,
+ CP_MSG_AVLN_STATUS_UNASSOC_CCO_2,
+ CP_MSG_AVLN_STATUS_UNASSOC_CCO_3,
+ CP_MSG_AVLN_STATUS_ASSOC_NOT_PCO,
+ CP_MSG_AVLN_STATUS_ASSOC_PCO,
+ CP_MSG_AVLN_STATUS_CCO = 0x8,
+ CP_MSG_AVLN_STATUS_NB
+};
+
+BEGIN_DECLS
+
+/**
+ * Initialise the MSG module.
+ * \param ctx control plane context
+ */
+void
+cp_msg_init (cp_t *ctx);
+
+/**
+ * Uninitialise the MSG module.
+ * \param ctx control plane context
+ */
+void
+cp_msg_uninit (cp_t *ctx);
+
+
+/**
+ * Examine message type and post an event to the FSM.
+ * \param ctx control plane context
+ * \param mme received MME
+ *
+ * This function looks up the message type and translates it to a FSM event,
+ * while checking the encryption is compliant with the message type.
+ *
+ * It also extracts and checks payload from encrypted messages.
+ */
+void
+cp_msg_dispatch (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Initialise a MME handle for a new message to be transmitted.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mmtype the MME MMTYPE.
+ * \return the newly created message
+ *
+ * This function:
+ *
+ * - gets a buffer for MME transmission,
+ * - encapsulates the MME in a CC_RELAY.REQ if necessary,
+ * - writes the MME header.
+ */
+cp_mme_tx_t *
+cp_msg_mme_init (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype);
+
+/**
+ * Initialise a MME handle for a new encrypted message to be transmitted.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mmtype the MME MMType.
+ * \param pid protocol identifier
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \return the newly created message
+ *
+ * This does the same as cp_msg_mme_init(), but also encapsulate the MME in a
+ * CM_ENCRYPTED_PAYLOAD.IND.
+ */
+cp_mme_tx_t *
+cp_msg_mme_init_encrypted (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mmtype_t mmtype,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun);
+
+ /** Write the header of a fragmented MME.
+ * \param ctx the ctx module.
+ * \param msg the message allocate previously.
+ * \param peer the peer data.
+ * \param mmtype the mmtype of the MME.
+ * \param fmi_nbFrag The number of fragments.
+ * \param fmi_fnmi the number of the fragment.
+ * \param fmi_ssn the sequence number of the fragment.
+ */
+void
+cp_msg_mme_write_frag_header (cp_t *ctx, cp_mme_tx_t *msg,
+ cp_mme_peer_t *peer, cp_mmtype_t mmtype,
+ uint fmi_nbFrag, uint fmi_fnmi, uint fmi_ssn);
+
+/**
+ * Initialise a MME handle for a new message fragment to be transmitted.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mmtype the MME MMTYPE.
+ * \param fmi_nbFrag The number of fragments.
+ * \param fmi_fnmi the number of the fragment.
+ * \param fmi_ssn the sequence number of the fragment.
+ * \return the newly created message
+ *
+ * This function:
+ *
+ * - gets a buffer for MME transmission,
+ * - encapsulates the MME in a CC_RELAY.REQ if necessary,
+ * - writes the MME header.
+ */
+cp_mme_tx_t *
+cp_msg_mme_init_frag (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype,
+ uint fmi_nbFrag, uint fmi_fnmi, uint fmi_ssn);
+
+/**
+ * Finalise and send a MME.
+ * \param ctx control plane context
+ * \param mme MME handle
+ *
+ * If the MME is encapsulated, write any pending footer, then send the
+ * message.
+ */
+void
+cp_msg_mme_send (cp_t *ctx, cp_mme_tx_t *mme);
+
+/**
+ * Read the header of a received MME and return the MME context.
+ * \param ctx the module context.
+ * \param mme the MME received.
+ * \param length the MME length.
+ * \param tei the source TEI (0xFF if coming from the HLE).
+ * \param fmi the FMI data.
+ * \return cp_mme_rx_t object associated.
+ */
+cp_mme_rx_t *
+cp_msg_mme_read_header (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei,
+ uint *fmi);
+
+/**
+ * Read an encrypted header and decrypt the payload.
+ * \param ctx the module context.
+ * \param mme the mme context.
+ * \return true if decoded correctly, false otherwise.
+ */
+bool
+cp_msg_mme_read_header_enc (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Change the current buffer of the reception message.
+ * \param ctx the module context.
+ * \param msg the message RX to change the buffer.
+ *
+ * This shall be used only on the RX MMEs which are received as fragmented
+ * ones.
+ */
+void
+cp_msg_mme_rx_change_buffer (cp_t *ctx, cp_mme_rx_t *msg);
+
+END_DECLS
+
+#endif /* cp_msg_msg_h */
diff --git a/cesar/cp/msg/src/mme.c b/cesar/cp/msg/src/mme.c
new file mode 100644
index 0000000000..6014b97606
--- /dev/null
+++ b/cesar/cp/msg/src/mme.c
@@ -0,0 +1,109 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/src/mme.c
+ * \brief Function to init and destroy the MME messages.
+ * \ingroup cp_msg
+ *
+ */
+#include "common/std.h"
+
+#include "common/defs/ethernet.h"
+#include "lib/slab.h"
+
+#include "interface/interface.h"
+#include "cp/cl_interf/cl_interf.h"
+
+#include "cp/msg/inc/msg.h"
+#include "cp/inc/context.h"
+
+/**
+ * Function to init the mme rx t messages.
+ * \param ctx the module context.
+ * \param mme the MME received.
+ * \param length the MME length.
+ * \param tei the source TEI.
+ * \return the mme rx message initialised.
+ */
+cp_mme_rx_t *
+cp_msg_mme_rx_init (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei)
+{
+ cp_mme_rx_t *mme_rx;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (length >= ETH_PACKET_MIN_SIZE
+ && length <= ETH_PACKET_MAX_SIZE);
+
+ // Allocate the MME with the slab allocator.
+ mme_rx = slab_alloc (&ctx->msg.mme_rx_slab_cache);
+
+ dbg_assert (mme_rx);
+ memset (mme_rx, 0, sizeof (cp_mme_rx_t));
+ mme_rx->p_mme = mme;
+ mme_rx->length = length;
+ mme_rx->peer.tei = tei;
+ mme_rx->cp = ctx;
+
+ return mme_rx;
+}
+
+/**
+ * Function to init the mme rx t messages.
+ * \param ctx the module context.
+ * \return the mme rx message initialised.
+ */
+cp_mme_tx_t *
+cp_msg_mme_tx_init (cp_t *ctx)
+{
+ cp_mme_tx_t *mme;
+
+ dbg_assert (ctx);
+ mme = slab_alloc (&ctx->msg.mme_tx_slab_cache);
+ memset (mme, 0, sizeof (cp_mme_tx_t));
+
+ mme->cp = ctx;
+ return mme;
+}
+
+/**
+ * Function destructor for the MME RX messages.
+ * \param ctx the module context.
+ * \param msg the message context.
+ */
+void
+cp_msg_mme_rx_destructor (cp_mme_rx_t *mme)
+{
+ blk_t *blk;
+
+ dbg_assert (mme);
+
+ if (mme->p_mme)
+ interface_mme_recv_done (mme->cp->interface, mme->cl_data);
+
+ while (mme->p_frag)
+ {
+ blk = mme->p_frag;
+ mme->p_frag = blk->next;
+ blk_release (blk);
+ }
+}
+
+/**
+ * Function destructor for the MME TX messages.
+ * \param msg the message context.
+ */
+void
+cp_msg_mme_tx_destructor (cp_mme_tx_t *mme)
+{
+ dbg_assert (mme);
+
+ if (mme->p_mme)
+ cp_cl_interf_add_buffer_tx (mme->cp, mme->p_mme);
+}
+
diff --git a/cesar/cp/msg/src/msg.c b/cesar/cp/msg/src/msg.c
new file mode 100644
index 0000000000..186977908e
--- /dev/null
+++ b/cesar/cp/msg/src/msg.c
@@ -0,0 +1,764 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/src/msg.c
+ * \brief MSG functions.
+ * \ingroup cp_msg
+ *
+ */
+#include "common/std.h"
+#include "lib/read_word.h"
+#include "lib/swap.h"
+#include "lib/crc.h"
+#include "lib/rnd.h"
+
+#include "common/defs/homeplugAV.h"
+#include "common/defs/ethernet.h"
+
+#include "cp/cp.h"
+#include "cp/msg/msg.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/sta_own_data.h"
+#include "cp/secu/aes.h"
+
+#include "cp/msg/inc/msg.h"
+#include "cp/inc/context.h"
+
+#include <stdio.h>
+
+/** Padd the MME to reach the minimal length. */
+static void
+cp_msg_mme_pad (cp_t *ctx, cp_mme_tx_t *msg)
+{
+ uint data;
+
+ dbg_assert (ctx);
+ dbg_assert (msg);
+
+ data = 0;
+ while (bitstream_bytes_processed (&msg->bitstream) < ETH_PACKET_MIN_SIZE)
+ {
+ bitstream_access (&msg->bitstream, &data, 8);
+ }
+}
+
+/**
+ * Initialise the MSG module.
+ * \param ctx control plane context
+ */
+void
+cp_msg_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ slab_cache_init (&ctx->msg.mme_tx_slab_cache, "MME TX",
+ sizeof (cp_mme_tx_t),
+ (slab_object_destructor_t) cp_msg_mme_tx_destructor);
+
+ slab_cache_init (&ctx->msg.mme_rx_slab_cache, "MME RX",
+ sizeof (cp_mme_rx_t),
+ (slab_object_destructor_t) cp_msg_mme_rx_destructor);
+}
+
+/**
+ * Uninitialise the MSG module.
+ * \param ctx control plane context
+ */
+void
+cp_msg_uninit (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ slab_cache_uninit (&ctx->msg.mme_tx_slab_cache);
+ slab_cache_uninit (&ctx->msg.mme_rx_slab_cache);
+}
+
+/**
+ * Examine message type and post an event to the FSM.
+ * \param ctx control plane context
+ * \param mme received MME
+ *
+ * This function looks up the message type and translates it to a FSM event,
+ * while checking the encryption is compliant with the message type.
+ *
+ * It also extracts and checks payload from encrypted messages.
+ */
+void
+cp_msg_dispatch (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ if (mme->mmtype == CM_ENCRYPTED_PAYLOAD_IND)
+ cp_msg_mme_read_header_enc (ctx, mme);
+
+ // TODO : Post the event.
+}
+
+/**
+ * Initialise a MME handle for a new message to be transmitted.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mmtype the MME MMTYPE.
+ * \return the newly created message
+ *
+ * This function:
+ *
+ * - gets a buffer for MME transmission,
+ * - encapsulates the MME in a CC_RELAY.REQ if necessary,
+ * - writes the MME header.
+ */
+cp_mme_tx_t *
+cp_msg_mme_init (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype)
+{
+ cp_mme_tx_t *msg;
+ cp_sta_own_data_t *own_data;
+ u64 data;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+
+ // Allocate the new message.
+ msg = cp_msg_mme_tx_init (ctx);
+ dbg_assert (msg);
+
+ // Get a buffer.
+ msg->p_mme = cp_cl_interf_get_buffer_tx (ctx);
+ msg->peer = *peer;
+ msg->peks = CP_MME_PEKS_SPC_NOT_EMBEDDED;
+
+ // Get the station own data.
+ own_data = cp_sta_mgr_get_sta_own_data (ctx);
+
+ // Initialise the bitstream context and fill the MME header.
+ bitstream_init (&msg->bitstream, msg->p_mme, ETH_PACKET_MAX_SIZE,
+ BITSTREAM_WRITE);
+
+ // Store the Destination Mac address.
+ bitstream_access (&msg->bitstream, &peer->mac,
+ BYTES_SIZE_TO_BITS (ETH_MAC_ADDRESS_SIZE));
+
+ // Store the source mac address.
+ data = cp_sta_own_data_get_mac_address (ctx);
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (ETH_MAC_ADDRESS_SIZE));
+
+ // Vlan tag.
+ if (peer->vlan_tag)
+ bitstream_access (&msg->bitstream, &peer->vlan_tag,
+ BYTES_SIZE_TO_BITS(ETH_VLAN_TAG_SIZE));
+
+ // MTYPE.
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MTYPE_SIZE));
+
+ // MMV
+ data = HPAV_MMV;
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MMV_SIZE));
+
+ //MMTYPE.
+ bitstream_access (&msg->bitstream, &mmtype,
+ BYTES_SIZE_TO_BITS (HPAV_MMTYPE_SIZE));
+
+ //FMI = 0.
+ data = 0;
+ bitstream_access (&msg->bitstream, &data, 16);
+
+ return msg;
+}
+
+/**
+ * Initialise a MME handle for a new encrypted message to be transmitted.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mmtype the MME MMType.
+ * \param pid protocol identifier
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \return the newly created message
+ *
+ * This does the same as cp_msg_mme_init(), but also encapsulate the MME in a
+ * CM_ENCRYPTED_PAYLOAD.IND.
+ */
+cp_mme_tx_t *
+cp_msg_mme_init_encrypted (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mmtype_t mmtype,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun)
+{
+ cp_mme_tx_t *msg;
+ cp_sta_own_data_t *own_data;
+ u64 data;
+ uint i;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (prun);
+
+ if (peks == CP_MME_PEKS_SPC_NOT_EMBEDDED)
+ {
+ msg = cp_msg_mme_init (ctx, peer, mmtype);
+ return msg;
+ }
+
+ // Initialise the message context.
+ msg = cp_msg_mme_tx_init (ctx);
+ dbg_assert (msg);
+
+ // Get a buffer
+ msg->p_mme = cp_cl_interf_get_buffer_tx (ctx);
+ msg->peer = *peer;
+ msg->peks = peks;
+ msg->prun = *prun;
+
+ // Compute the random filler.
+
+ own_data = cp_sta_mgr_get_sta_own_data (ctx);
+
+ // Initialise the bitstream context.
+ bitstream_init (&msg->bitstream, msg->p_mme, ETH_PACKET_MAX_SIZE,
+ BITSTREAM_WRITE);
+
+ // Store the ODA.
+ bitstream_access (&msg->bitstream, &msg->peer.mac,
+ BYTES_SIZE_TO_BITS (ETH_MAC_ADDRESS_SIZE));
+
+ // Store the OSA.
+ data = cp_sta_own_data_get_mac_address (ctx);
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (ETH_MAC_ADDRESS_SIZE));
+
+ // Vlan tag.
+ if (peer->vlan_tag)
+ bitstream_access (&msg->bitstream, &peer->vlan_tag,
+ BYTES_SIZE_TO_BITS(ETH_VLAN_TAG_SIZE));
+
+ // MTYPE.
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MTYPE_SIZE));
+
+ // MMV
+ data = HPAV_MMV;
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MMV_SIZE));
+
+ //MMTYPE.
+ data = CM_ENCRYPTED_PAYLOAD_IND;
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MMTYPE_SIZE));
+
+ // FMI = 0.
+ data = 0;
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_FMI_SIZE));
+
+ // PKES.
+ bitstream_access (&msg->bitstream, &msg->peks, 8);
+
+ // AVLN status.
+ if (own_data->is_cco)
+ data = CP_MSG_AVLN_STATUS_CCO;
+ else if (!cp_sta_own_data_get_tei (ctx))
+ data = CP_MSG_AVLN_STATUS_UNASSOC_CCO_0 + CP_CCO_LEVEL;
+ else if (cp_sta_own_data_get_pco_status(ctx)
+ && cp_sta_own_data_get_tei(ctx))
+ data = CP_MSG_AVLN_STATUS_ASSOC_PCO;
+ else if (!cp_sta_own_data_get_pco_status(ctx)
+ && cp_sta_own_data_get_tei(ctx))
+ data = CP_MSG_AVLN_STATUS_ASSOC_NOT_PCO;
+
+ bitstream_access (&msg->bitstream, &data, 8);
+
+ // PID.
+ bitstream_access (&msg->bitstream, &msg->prun.pid, 8);
+
+ // PRN.
+ bitstream_access (&msg->bitstream, &msg->prun.prn, 16);
+
+ // PMN.
+ bitstream_access (&msg->bitstream, &msg->prun.pmn, 8);
+
+ // IV or UUID.
+ for (i = 0; i< 4; i++)
+ {
+ msg->iv_uuid.key[i] = lib_rnd32 (&ctx->rnd);
+ bitstream_access (&msg->bitstream, &msg->iv_uuid.key[i], 32);
+ }
+
+ // Length of the MME TO be patch at the end.
+ data = 0;
+ bitstream_access (&msg->bitstream, &data, 16);
+
+ // RFLen
+ msg->rf_len = lib_rnd32 (&ctx->rnd) % 0xF;
+ for (i = 0; i < msg->rf_len; i++)
+ {
+ data = lib_rnd32 (&ctx->rnd);
+ bitstream_access (&msg->bitstream, &data, 8);
+ }
+
+ // Compute the payload offset.
+ msg->payload_offset = bitstream_bytes_processed (&msg->bitstream);
+
+ // The payload
+ // Store the ODA.
+ bitstream_access (&msg->bitstream, &msg->peer.mac,
+ BYTES_SIZE_TO_BITS (ETH_MAC_ADDRESS_SIZE));
+
+ // Store the OSA.
+ data = cp_sta_own_data_get_mac_address (ctx);
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (ETH_MAC_ADDRESS_SIZE));
+
+ // Vlan tag.
+ if (peer->vlan_tag)
+ bitstream_access (&msg->bitstream, &peer->vlan_tag,
+ BYTES_SIZE_TO_BITS(ETH_VLAN_TAG_SIZE));
+
+ // MTYPE.
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MTYPE_SIZE));
+
+ // MMV
+ data = HPAV_MMV;
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MMV_SIZE));
+
+ //MMTYPE.
+ bitstream_access (&msg->bitstream, &mmtype,
+ BYTES_SIZE_TO_BITS (HPAV_MMTYPE_SIZE));
+
+ //FMI.
+ data = 0;
+ bitstream_access (&msg->bitstream, &data, 16);
+
+ return msg;
+}
+
+/** Write the header of a fragmented MME.
+ * \param ctx the ctx module.
+ * \param msg the message allocate previously.
+ * \param peer the peer data.
+ * \param mmtype the mmtype of the MME.
+ * \param fmi_nbFrag The number of fragments.
+ * \param fmi_fnmi the number of the fragment.
+ * \param fmi_ssn the sequence number of the fragment.
+ */
+void
+cp_msg_mme_write_frag_header (cp_t *ctx, cp_mme_tx_t *msg,
+ cp_mme_peer_t *peer, cp_mmtype_t mmtype,
+ uint fmi_nbFrag, uint fmi_fnmi, uint fmi_ssn)
+{
+ cp_sta_own_data_t *own_data;
+ u64 data;
+
+ // Get the station own data.
+ own_data = cp_sta_mgr_get_sta_own_data (ctx);
+
+ // Initialise the bitstream context and fill the MME header.
+ bitstream_init (&msg->bitstream, msg->p_mme, ETH_PACKET_MAX_SIZE,
+ BITSTREAM_WRITE);
+
+ // Store the Destination Mac address.
+ bitstream_access (&msg->bitstream, &peer->mac,
+ BYTES_SIZE_TO_BITS (ETH_MAC_ADDRESS_SIZE));
+
+ // Store the source mac address.
+ data = cp_sta_own_data_get_mac_address (ctx);
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (ETH_MAC_ADDRESS_SIZE));
+
+ // Vlan tag.
+ if (peer->vlan_tag)
+ bitstream_access (&msg->bitstream, &peer->vlan_tag,
+ BYTES_SIZE_TO_BITS(ETH_VLAN_TAG_SIZE));
+
+ // MTYPE.
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MTYPE_SIZE));
+
+ // MMV
+ data = HPAV_MMV;
+ bitstream_access (&msg->bitstream, &data,
+ BYTES_SIZE_TO_BITS (HPAV_MMV_SIZE));
+
+ //MMTYPE.
+ bitstream_access (&msg->bitstream, &mmtype,
+ BYTES_SIZE_TO_BITS (HPAV_MMTYPE_SIZE));
+
+ // FMI.
+ bitstream_access (&msg->bitstream, &fmi_nbFrag, 4);
+ /* frag number. */
+ bitstream_access (&msg->bitstream, &fmi_fnmi, 4);
+ /* MME ssn. */
+ bitstream_access (&msg->bitstream, &fmi_ssn, 8);
+}
+
+/**
+ * Initialise a MME handle for a new message fragment to be transmitted.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mmtype the MME MMTYPE.
+ * \param fmi_nbFrag The number of fragments.
+ * \param fmi_fnmi the number of the fragment.
+ * \param fmi_ssn the sequence number of the fragment.
+ * \return the newly created message
+ *
+ * This function:
+ *
+ * - gets a buffer for MME transmission,
+ * - encapsulates the MME in a CC_RELAY.REQ if necessary,
+ * - writes the MME header.
+ */
+cp_mme_tx_t *
+cp_msg_mme_init_frag (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype,
+ uint fmi_nbFrag, uint fmi_fnmi, uint fmi_ssn)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (fmi_fnmi <= fmi_nbFrag);
+ dbg_assert (fmi_ssn <= fmi_nbFrag);
+
+ // Allocate the new message.
+ msg = cp_msg_mme_tx_init (ctx);
+ dbg_assert (msg);
+
+ // Get a buffer.
+ msg->p_mme = cp_cl_interf_get_buffer_tx (ctx);
+ msg->peer = *peer;
+ msg->peks = CP_MME_PEKS_SPC_NOT_EMBEDDED;
+
+ cp_msg_mme_write_frag_header (ctx, msg, peer, mmtype,
+ fmi_nbFrag, fmi_fnmi, fmi_ssn);
+
+ return msg;
+}
+
+
+/**
+ * Finalise and send a MME.
+ * \param ctx control plane context
+ * \param mme MME handle
+ *
+ * If the MME is encapsulated, write any pending footer, then send the
+ * message.
+ */
+void
+cp_msg_mme_send (cp_t *ctx, cp_mme_tx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ /* Ends the MME. See HPAV table 11-253. */
+ if ((mme->peks != CP_MME_PEKS_SPC_NOT_EMBEDDED)
+ && (mme->prun.pid != 0x4))
+ {
+ crc_t crc;
+ aes_context aes;
+ uint crc_value;
+ u32 enc_tab[256];
+ uint word;
+ uint padding_len;
+ uint i;
+ uint enc_length;
+
+ crc.width = 32;
+ crc.generator = HPAV_CRC32_GENERATOR;
+ crc.init = HPAV_CRC32_INIT;
+ crc.refin = true;
+ crc.refout = true;
+ crc.xorout = 0xffffffff;
+ crc.reg_init = 0;
+ crc.table.t32 = enc_tab;
+ crc_init(&crc);
+
+ /* Patch the length of the MME in the header.
+ * 22 Bytes in after the head of the encrypted payload to reach the
+ * length field.
+ * + The MME header.
+ * - 1 for the alignment.
+ */
+ mme->length = (bitstream_bytes_processed (&mme->bitstream)
+ - mme->payload_offset);
+ word = *((uint *) (mme->p_mme + (mme->peer.vlan_tag ?
+ HPAV_MME_HEADER_LEN_WITH_VLAN:
+ HPAV_MME_HEADER)
+ + 21));
+ word &= 0xFF0000FF;
+ word |= mme->length << 8;
+ *((uint*)(mme->p_mme + (mme->peer.vlan_tag ?
+ HPAV_MME_HEADER_LEN_WITH_VLAN:
+ HPAV_MME_HEADER)
+ + 21)) = word;
+
+
+
+ /* Compute the CRC. */
+ crc_value = crc_compute_block_le (&crc,
+ mme->p_mme + mme->payload_offset,
+ mme->length
+ + (mme->peer.vlan_tag ?
+ HPAV_MME_HEADER_LEN_WITH_VLAN:
+ HPAV_MME_HEADER));
+ /* Store the CRC. */
+ bitstream_access (&mme->bitstream, &crc_value, 32);
+
+ /* PID. */
+ bitstream_access (&mme->bitstream, &mme->prun.pid, 8);
+
+ /* PRN. */
+ bitstream_access (&mme->bitstream, &mme->prun.prn, 16);
+
+ /* PMN. */
+ bitstream_access (&mme->bitstream, &mme->prun.pmn, 8);
+
+ /* Padding. crc_value variable used as Padding. */
+ padding_len = 16 - ((mme->length + mme->rf_len
+ + CP_MSG_ENCRYPTED_DATA_FOOTER_SIZE) % 16);
+
+ word = 0;
+ for ( i = 0; i < padding_len; i++)
+ bitstream_access (&mme->bitstream, &word, 8);
+
+ /* RF Len. */
+ bitstream_access (&mme->bitstream, &mme->rf_len, 8);
+
+ /* Finalise the bitstream. */
+ cp_msg_mme_pad (ctx, mme);
+ bitstream_finalise (&mme->bitstream);
+
+ /* AES encryption. */
+ enc_length = mme->length
+ + mme->rf_len
+ + CP_MSG_ENCRYPTED_DATA_FOOTER_SIZE
+ + padding_len;
+
+ aes_set_key (&aes, (u8 *) &mme->iv_uuid);
+ aes_cbc_encrypt (&aes, (u8 *) &mme->iv_uuid,
+ mme->p_mme + mme->payload_offset - mme->rf_len,
+ mme->p_mme + mme->payload_offset - mme->rf_len,
+ enc_length);
+ }
+ else
+ {
+ /* Finalise the bitstream. */
+ cp_msg_mme_pad (ctx, mme);
+ bitstream_finalise (&mme->bitstream);
+ }
+
+ mme->length = bitstream_bytes_processed (&mme->bitstream);
+ /* Send the MME. */
+ cp_cl_interf_mme_send (ctx, mme);
+
+ /* Release the mme. */
+ slab_release (mme);
+}
+
+
+/**
+ * Read the header of a received MME and return the MME context.
+ * \param ctx the module context.
+ * \param mme the MME received.
+ * \param length the MME length.
+ * \param tei the source TEI (0xFF if coming from the HLE).
+ * \param fmi the FMI data.
+ * \return cp_mme_rx_t object associated.
+ */
+cp_mme_rx_t *
+cp_msg_mme_read_header (cp_t *ctx, u8 *mme, uint length, cp_tei_t tei,
+ uint *fmi)
+{
+ cp_mme_rx_t *mme_rx;
+ bool vlantag_present;
+ uint mtype;
+ uint mmv;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ if (read_u16_from_word (mme + 12) == swap16 (HPAV_MTYPE_MME))
+ vlantag_present = false;
+ else
+ vlantag_present = true;
+
+ mme_rx = cp_msg_mme_rx_init (ctx, mme, length, tei);
+
+ bitstream_init (&mme_rx->bitstream, mme + ETH_MAC_ADDRESS_SIZE,
+ length, BITSTREAM_READ);
+ bitstream_access (&mme_rx->bitstream, &mme_rx->peer.mac,
+ BYTES_SIZE_TO_BITS(ETH_MAC_ADDRESS_SIZE));
+ if (vlantag_present)
+ bitstream_access (&mme_rx->bitstream, &mme_rx->peer.vlan_tag, 32);
+ else
+ mme_rx->peer.vlan_tag = 0;
+
+ bitstream_access (&mme_rx->bitstream, &mtype, 16);
+ bitstream_access (&mme_rx->bitstream, &mmv, 8);
+ bitstream_access (&mme_rx->bitstream, &mme_rx->mmtype, 16);
+ bitstream_access (&mme_rx->bitstream, fmi, 16);
+
+ // Verify some data.
+ if ((mmv != HPAV_MMV1) || (swap16(mtype) != HPAV_MTYPE_MME))
+ {
+ slab_release (mme_rx);
+ mme_rx = NULL;
+ }
+
+ return mme_rx;
+}
+
+/**
+ * Read an encrypted header and decrypt the payload.
+ * \param ctx the module context.
+ * \param mme the mme context.
+ * \return true if decoded correctly, false otherwise.
+ */
+bool
+cp_msg_mme_read_header_enc (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ uint data;
+ uint i;
+ uint enc_length;
+ uint full_length;
+ uint payload_offset;
+ uint rf_len;
+
+ mac_t oda = 0;
+ mac_t osa = 0;
+ uint vlan_tag = 0;
+ uint mtype = 0;
+ uint mmv = 0;
+
+ aes_context aes;
+ cp_sta_own_data_t *owndata;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ full_length = mme->length;
+ owndata = cp_sta_mgr_get_sta_own_data (ctx);
+
+ // Continue reading the MME.
+ // PEKS.
+ bitstream_access (&mme->bitstream, &mme->peks, 8);
+
+ // AVLN STATUS.
+ bitstream_access (&mme->bitstream, &data, 8);
+
+ // PID.
+ bitstream_access (&mme->bitstream, &mme->prun.pid, 8);
+
+ // PRN.
+ bitstream_access (&mme->bitstream, &mme->prun.prn, 16);
+
+ // PMN.
+ bitstream_access (&mme->bitstream, &mme->prun.pmn, 8);
+
+ // IV.
+ for ( i = 0; i < 4; i++)
+ {
+ bitstream_access (&mme->bitstream, &mme->iv_uuid.key[i], 32);
+ }
+
+ // Len of the payload.
+ bitstream_access (&mme->bitstream, &mme->length, 16);
+
+ // Decrypt the buffer.
+
+ /* Compute a first payload offset position. The RF is still in contained
+ * in this length because the RF length is encrypted. */
+ payload_offset = CP_MSG_ENCRYPTED_DATA_HEADER_SIZE
+ + (mme->peer.vlan_tag ? HPAV_MME_HEADER_LEN_WITH_VLAN :
+ HPAV_MME_HEADER);
+
+ enc_length = full_length - payload_offset;
+
+ aes_set_key (&aes, (u8 *) &mme->iv_uuid);
+ aes_cbc_decrypt (&aes, (u8*) &mme->iv_uuid,
+ mme->p_mme + payload_offset,
+ mme->p_mme + payload_offset,
+ enc_length);
+
+ /* The length provided in the mme->length corresponds to the full size of
+ * the MME (header included). The RF length is setted to the length - 1
+ * bytes. */
+ rf_len = read_u8_from_word (mme->p_mme + full_length - 1);
+
+
+ // RF.
+ for (i = 0; i < rf_len; i++)
+ bitstream_access (&mme->bitstream, &data, 8);
+
+ /* Payload. */
+ // ODA.
+ bitstream_access (&mme->bitstream, &oda, 48);
+
+ // OSA.
+ bitstream_access (&mme->bitstream, &osa, 48);
+
+ if (mme->peer.vlan_tag)
+ bitstream_access (&mme->bitstream, &vlan_tag, 32);
+
+ // MType
+ bitstream_access (&mme->bitstream, &mtype, 16);
+
+ // MMV
+ bitstream_access (&mme->bitstream, &mmv, 8);
+
+ if ((mmv != HPAV_MMV1)
+ || (mtype != swap16(HPAV_MTYPE_MME))
+ || (oda != cp_sta_own_data_get_mac_address (ctx))
+ || (osa != mme->peer.mac)
+ || (vlan_tag != mme->peer.vlan_tag))
+ {
+ slab_release (mme);
+ return false;
+ }
+
+ // MMTYPE.
+ bitstream_access (&mme->bitstream, &mme->mmtype, 16);
+
+ // FMI
+ bitstream_access (&mme->bitstream, &data, 16);
+
+ return true;
+}
+
+/**
+ * Change the current buffer of the reception message.
+ * \param ctx the module context.
+ * \param msg the message RX to change the buffer.
+ *
+ * This shall be used only on the RX MMEs which are received as fragmented
+ * ones.
+ */
+void
+cp_msg_mme_rx_change_buffer (cp_t *ctx, cp_mme_rx_t *msg)
+{
+ dbg_assert (ctx);
+ dbg_assert (msg);
+
+ dbg_assert (msg->p_frag);
+ dbg_assert (msg->p_frag_current);
+ dbg_assert (msg->p_frag_current->next);
+
+ // Change the current pointer to the next one.
+ msg->p_frag_current = msg->p_frag_current->next;
+
+ bitstream_init (&msg->bitstream, msg->p_frag_current->data, BLK_SIZE,
+ BITSTREAM_READ);
+}
+
diff --git a/cesar/cp/msg/src/msg_cc.c b/cesar/cp/msg/src/msg_cc.c
new file mode 100644
index 0000000000..28d61ba6db
--- /dev/null
+++ b/cesar/cp/msg/src/msg_cc.c
@@ -0,0 +1,828 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/src/msg_cc.c
+ * \brief CC family MME.
+ * \ingroup cp_msg
+ */
+#include "common/std.h"
+#include "common/defs/homeplugAV.h"
+#include "lib/slab.h"
+
+#include "cp/cp.h"
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/msg/msg.h"
+
+#include "cp/sta/mgr/net.h"
+#include "cp/sta/mgr/sta_mgr.h"
+
+#include "cp/msg/inc/msg_cc.h"
+
+/**
+ * Send a CC_WHO_RU.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param nid NID of the requested AVLN
+ */
+void
+cp_msg_cc_who_ru_req_send (cp_t *ctx, cp_mme_peer_t *peer, cp_nid_t nid)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (nid);
+
+ msg = cp_msg_mme_init (ctx, peer, CC_WHO_RU_REQ);
+ dbg_check (msg);
+
+ bitstream_access (&msg->bitstream, &nid, 56);
+
+ msg->length = 7;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_WHO_RU.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param nid received NID of the requested AVLN
+ * \return true on success
+ */
+bool
+cp_msg_cc_who_ru_req_receive (cp_t *ctx, cp_mme_rx_t *mme, cp_nid_t *nid)
+{
+ cp_net_t *net;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (nid);
+
+ bitstream_access (&mme->bitstream, nid, 56);
+
+ net = cp_sta_mgr_get_our_avln (ctx);
+ if (*nid != cp_net_get_nid (ctx, net))
+ return false;
+ return true;
+}
+
+/**
+ * Send a CC_WHO_RU.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_who_ru_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_who_ru_cnf_t *data)
+{
+ uint i;
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (data);
+
+ dbg_assert (data->nid);
+ dbg_assert (data->cco_mac);
+
+ msg = cp_msg_mme_init (ctx, peer, CC_WHO_RU_CNF);
+ dbg_check (msg);
+
+ bitstream_access (&msg->bitstream, &data->nid, 56);
+ bitstream_access (&msg->bitstream, (mac_t *) &data->cco_mac, 48);
+
+ for (i = 0; i < CP_HFID_SIZE; i++)
+ bitstream_access (&msg->bitstream, (u8*) &data->avln_hfid[i], 8);
+
+ msg->length = 77;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_WHO_RU.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_who_ru_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_who_ru_cnf_t *data)
+{
+ uint i;
+ cp_net_t *net;
+ cp_sta_t *cco;
+ cp_sta_own_data_t *own;
+
+ mac_t mac;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (data);
+
+ bitstream_access (&mme->bitstream, &data->nid, 56);
+ bitstream_access (&mme->bitstream, (mac_t *) &data->cco_mac, 48);
+
+ for ( i = 0; i < CP_HFID_SIZE; i++)
+ bitstream_access (&mme->bitstream, &data->avln_hfid[i], 8);
+
+ own = cp_sta_mgr_get_sta_own_data (ctx);
+ net = cp_sta_mgr_get_our_avln (ctx);
+ dbg_check (net);
+
+ if (own->is_cco)
+ mac = cp_sta_own_data_get_mac_address (ctx);
+ else
+ {
+ cco = cp_net_get_cco (ctx, net);
+ dbg_check (cco);
+ mac = cp_sta_get_mac_address (cco);
+ }
+
+ if ((cp_net_get_nid (ctx, net) != data->nid)
+ || mac != data->cco_mac)
+ return false;
+
+ return true;
+}
+
+/**
+ * Send a CC_ASSOC.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_assoc_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_req_t *data)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (data);
+
+ dbg_assert ((data->request_type < CP_MSG_CC_ASSOC_REQ_TYPE_NB)
+ || (data->cco_cap < 4)
+ || (data->proxy_cap < 2));
+
+
+ msg = cp_msg_mme_init (ctx, peer, CC_ASSOC_REQ);
+ dbg_check (msg);
+
+ bitstream_access (&msg->bitstream, &data->request_type, 8);
+ bitstream_access (&msg->bitstream, &data->nid, 56);
+ bitstream_access (&msg->bitstream, &data->cco_cap, 8);
+ bitstream_access (&msg->bitstream, &data->proxy_cap, 8);
+
+ msg->length = 10;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_ASSOC.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_assoc_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_req_t *data)
+{
+ cp_net_t *net;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (data);
+
+ bitstream_access (&mme->bitstream, &data->request_type, 8);
+ bitstream_access (&mme->bitstream, &data->nid, 56);
+ bitstream_access (&mme->bitstream, &data->cco_cap, 8);
+ bitstream_access (&mme->bitstream, &data->proxy_cap, 8);
+
+ // Verify the data read.
+ net = cp_sta_mgr_get_our_avln (ctx);
+ dbg_check (net);
+
+ if ((data->request_type >= CP_MSG_CC_ASSOC_REQ_TYPE_NB)
+ || (cp_net_get_nid(ctx, net) != data->nid)
+ || (data->cco_cap >= 4)
+ || (data->proxy_cap >= 2))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Send a CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cc_assoc_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ const cp_msg_cc_assoc_cnf_t *data)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (data);
+
+ dbg_assert ((data->result < CP_MSG_CC_ASSOC_CNF_RESULT_NB)
+ || data->nid
+ || data->sta_tei
+ || data->lease_time_min);
+
+ msg = cp_msg_mme_init (ctx, peer, CC_ASSOC_CNF);
+ dbg_check (msg);
+
+ bitstream_access (&msg->bitstream, &data->result, 8);
+ bitstream_access (&msg->bitstream, &data->nid, 56);
+ bitstream_access (&msg->bitstream, &data->snid, 8);
+ bitstream_access (&msg->bitstream, &data->sta_tei, 8);
+ bitstream_access (&msg->bitstream, &data->lease_time_min, 16);
+
+ msg->length = 12;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cc_assoc_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cc_assoc_cnf_t *data)
+{
+ cp_net_t *net;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (data);
+
+ bitstream_access (&mme->bitstream, &data->result, 8);
+ bitstream_access (&mme->bitstream, &data->nid, 56);
+ bitstream_access (&mme->bitstream, &data->snid, 8);
+ bitstream_access (&mme->bitstream, &data->sta_tei, 8);
+ bitstream_access (&mme->bitstream, &data->lease_time_min, 16);
+
+ /* Verify. */
+ net = cp_sta_mgr_get_our_avln (ctx);
+ dbg_check (net);
+
+ if ((cp_net_get_nid (ctx, net) != data->nid)
+ || (cp_net_get_snid (ctx, net) != data->snid)
+ || (data->result < CP_MSG_CC_ASSOC_CNF_RESULT_NB))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Send a CC_LEAVE.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param reason reason for the disassociation
+ */
+void
+cp_msg_cc_leave_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_leave_req_reason_t reason)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (reason < CP_MSG_CC_LEAVE_IND_REASON_NB);
+
+ msg = cp_msg_mme_init (ctx, peer, CC_LEAVE_REQ);
+ dbg_check (msg);
+
+ bitstream_access (&msg->bitstream, &reason, 8);
+
+ msg->length = 1;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_LEAVE.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param reason received reason for the disassociation
+ * \return true on success
+ */
+bool
+cp_msg_cc_leave_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ enum cp_msg_cc_leave_req_reason_t *reason)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (reason);
+
+ bitstream_access (&mme->bitstream, reason, 8);
+
+
+ if (*reason >= CP_MSG_CC_LEAVE_IND_REASON_NB)
+ return false;
+ return true;
+}
+
+/**
+ * Send a CC_LEAVE.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_leave_cnf_send (cp_t *ctx, cp_mme_peer_t *peer)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+
+ msg = cp_msg_mme_init (ctx, peer, CC_LEAVE_CNF);
+ dbg_check (msg);
+
+ msg->length = 0;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_LEAVE.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \return true on success
+ */
+bool
+cp_msg_cc_leave_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ return true;
+}
+
+/**
+ * Send a CC_LEAVE.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param reason reason for the disassociation
+ * \param nid NID
+ */
+void
+cp_msg_cc_leave_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_leave_ind_reason_t reason,
+ cp_nid_t nid)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (reason < CP_MSG_CC_LEAVE_IND_REASON_NB);
+ dbg_assert (nid);
+
+ msg = cp_msg_mme_init (ctx, peer, CC_LEAVE_IND);
+ dbg_check (msg);
+
+ bitstream_access (&msg->bitstream, &reason, 8);
+ bitstream_access (&msg->bitstream, &nid, 56);
+
+ msg->length = 8;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_LEAVE.IND.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param reason received reason for the disassociation
+ * \param nid received NID
+ * \return true on success
+ */
+bool
+cp_msg_cc_leave_ind_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ enum cp_msg_cc_leave_ind_reason_t *reason,
+ cp_nid_t *nid)
+{
+ cp_net_t *net;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (reason);
+ dbg_assert (nid);
+
+ bitstream_access (&mme->bitstream, reason, 8);
+ bitstream_access (&mme->bitstream, nid, 56);
+
+ /* Verify. */
+ net = cp_sta_mgr_get_our_avln (ctx);
+ dbg_check (net);
+
+ if ((cp_net_get_nid (ctx, net) != *nid)
+ || (*reason < CP_MSG_CC_LEAVE_IND_REASON_NB))
+ {
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Send a CC_LEAVE.RSP.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_leave_rsp_send (cp_t *ctx, cp_mme_peer_t *peer)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+
+ msg = cp_msg_mme_init (ctx, peer, CC_LEAVE_RSP);
+ dbg_check (msg);
+
+ msg->length = 0;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_LEAVE.RSP.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \return true on success
+ */
+bool
+cp_msg_cc_leave_rsp_receive (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ return true;
+}
+
+/**
+ * Send a CC_SET_TEI_MAP.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ */
+void
+cp_msg_cc_set_tei_map_req_send (cp_t *ctx, cp_mme_peer_t *peer)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+
+ msg = cp_msg_mme_init (ctx, peer, CC_SET_TEI_MAP_REQ);
+ dbg_check (msg);
+
+ msg->length = 0;
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CC_SET_TEI_MAP.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \return true on success
+ */
+bool
+cp_msg_cc_set_tei_map_req_receive (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ return true;
+}
+
+/** CC_SET_TEI_MAP Function to call when the buffer is full.
+ * \param ctx the bitstream context.
+ * \param data the structure registered.
+ */
+static void
+cp_msg_set_tei_map_send_change_buffer (bitstream_t *ctx,
+ cp_msg_cc_set_tei_map_change_buffer_t *data)
+{
+ bitstream_t bitstream_old;
+ cp_mme_tx_t *msg;
+ dbg_assert (ctx);
+ dbg_assert (data);
+ dbg_assert (data->cp);
+ dbg_assert (data->msg);
+
+ msg = data->msg;
+
+ // Finalise the MME.
+ slab_addref (msg);
+ cp_msg_mme_send (data->cp, msg);
+
+ // Initialise the header of the new buffer.
+ msg->p_mme = cp_cl_interf_get_buffer_tx (data->cp);
+ bitstream_old = msg->bitstream;
+
+ cp_msg_mme_write_frag_header (data->cp, msg, &msg->peer,
+ CC_SET_TEI_MAP_IND, data->fmi_nbFrag,
+ ++data->fmi_fnmi, ++data->fmi_ssn);
+ // Finalise the stream.
+ bitstream_finalise (&msg->bitstream);
+
+ // Set newly the boolean indicating the buffer change callback is present.
+ bitstream_old.start = msg->bitstream.start;
+ bitstream_old.stream = msg->bitstream.stream;
+ bitstream_old.bit_offset = msg->bitstream.bit_offset;
+ msg->bitstream = bitstream_old;
+}
+
+
+/**
+ * Begin a CC_SET_TEI_MAP.IND construction.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param mode update, add or delete
+ * \param sta_nb number of stations sent
+ * \return the MME being constructed
+ */
+cp_mme_tx_t *
+cp_msg_cc_set_tei_map_ind_send_begin (
+ cp_t *ctx, cp_mme_peer_t *peer,
+ enum cp_msg_cc_set_tei_map_ind_mode_t mode, uint sta_nb)
+{
+ cp_mme_tx_t *msg;
+ cp_msg_cc_set_tei_map_change_buffer_t *data = NULL;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (mode < CP_MSG_CC_SET_TEI_MAP_IND_MODE_NB);
+ dbg_assert (sta_nb);
+
+ if (sta_nb * 8 > (peer->vlan_tag ? CP_MME_PAYLOAD_MAX_SIZE_WITH_VLAN :
+ CP_MME_PAYLOAD_MAX_SIZE) - 2)
+ {
+ data = blk_alloc ();
+ data->cp = ctx;
+ data->fmi_nbFrag = 1;
+ data->fmi_fnmi = 0;
+ data->fmi_ssn = 0;
+
+ msg = cp_msg_mme_init_frag (ctx, peer, CC_SET_TEI_MAP_IND, 1, 0, 0);
+ data->msg = msg;
+ bitstream_buffer_full_init_cb (&msg->bitstream,
+ (bitstream_buffer_cb_t) cp_msg_set_tei_map_send_change_buffer,
+ data);
+ }
+ else
+ msg = cp_msg_mme_init (ctx, peer, CC_SET_TEI_MAP_IND);
+ dbg_check (msg);
+
+ bitstream_access (&msg->bitstream, &mode, 8);
+ bitstream_access (&msg->bitstream, &sta_nb, 8);
+
+ return msg;
+}
+
+/**
+ * Write a station to a CC_SET_TEI_MAP.IND being constructed.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ * \param tei STA TEI
+ * \param mac STA mac address
+ * \param status STA status
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_sta (
+ cp_t *ctx, cp_mme_tx_t *mme, cp_tei_t tei, mac_t mac,
+ enum cp_msg_cc_set_tei_map_ind_status_t status)
+{
+ dbg_assert (mme);
+ dbg_assert (tei);
+ dbg_assert (mac);
+ dbg_assert (status < CP_MSG_CC_SET_TEI_MAP_IND_STATUS_NB);
+
+ bitstream_access (&mme->bitstream, &tei, 8);
+ bitstream_access (&mme->bitstream, &mac, 48);
+ bitstream_access (&mme->bitstream, &status, 8);
+}
+
+/**
+ * Finalise and send a CC_SET_TEI_MAP.IND message.
+ * \param ctx control plane context
+ * \param mme MME being constructed
+ */
+void
+cp_msg_cc_set_tei_map_ind_send_end (cp_t *ctx, cp_mme_tx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ if (mme->bitstream.buffer_cb_present)
+ blk_release (mme->bitstream.user_data);
+ cp_msg_mme_send (ctx, mme);
+}
+
+/**
+ * Change the bitstream buffer for the CC_SET_TEI_MAP.IND reception.
+ * \param ctx the bitstream context.
+ * \param data the data buffer.
+ */
+static void
+cp_msg_cc_set_tei_map_recv_change_buffer (bitstream_t *ctx,
+ cp_msg_cc_set_tei_map_change_buffer_t *data)
+{
+ cp_mme_rx_t *msg;
+ dbg_assert (ctx);
+ dbg_assert (data);
+ dbg_assert (data->cp);
+ dbg_assert (data->msg);
+
+ msg = data->msg;
+
+ cp_msg_mme_rx_change_buffer (data->cp, msg);
+
+ // Set newly the boolean indicating the buffer change callback is present.
+ msg->bitstream.buffer_cb_present = true;
+}
+
+/**
+ * Begin a CC_SET_TEI_MAP.IND reception.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param mode received mode: update, add or delete
+ * \param sta_nb received number of STA
+ * \return true on success
+ */
+bool
+cp_msg_cc_set_tei_map_ind_receive_begin (
+ cp_t *ctx, cp_mme_rx_t *mme,
+ enum cp_msg_cc_set_tei_map_ind_mode_t *mode, uint *sta_nb)
+{
+ cp_msg_cc_set_tei_map_change_buffer_t *data;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (mode);
+ dbg_assert (sta_nb);
+
+ if (mme->p_mme == NULL)
+ {
+ data = blk_alloc ();
+ data->msg = mme;
+ data->cp = ctx;
+ bitstream_buffer_full_init_cb (&mme->bitstream,
+ (bitstream_buffer_cb_t)
+ cp_msg_cc_set_tei_map_recv_change_buffer,
+ data);
+ }
+
+ bitstream_access (&mme->bitstream, mode, 8);
+ bitstream_access (&mme->bitstream, sta_nb, 8);
+
+ // Point to the current fragment.
+
+ if (*mode >= CP_MSG_CC_SET_TEI_MAP_IND_MODE_NB)
+ return false;
+ return true;
+}
+
+/**
+ * Read a station from a received CC_SET_TEI_MAP.IND.
+ * \param ctx control plane context
+ * \param mme MME being received
+ * \param tei received STA TEI
+ * \param mac received STA mac address
+ * \param status received STA status
+ * \return true on success
+ */
+bool
+cp_msg_cc_set_tei_map_ind_receive_sta (
+ cp_t *ctx, cp_mme_rx_t *mme, cp_tei_t *tei, mac_t *mac,
+ enum cp_msg_cc_set_tei_map_ind_status_t *status)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (tei);
+ dbg_assert (mac);
+ dbg_assert (status);
+
+ bitstream_access (&mme->bitstream, tei, 8);
+ bitstream_access (&mme->bitstream, mac, 48);
+ bitstream_access (&mme->bitstream, status, 8);
+
+ if (*status >= CP_MSG_CC_SET_TEI_MAP_IND_STATUS_NB)
+ return false;
+ return true;
+}
+
+/**
+ * Finalise a CC_SET_TEI_MAP.IND reception.
+ * \param ctx control plane context
+ * \param mme MME being received
+ * \return true on success
+ */
+bool
+cp_msg_cc_set_tei_map_ind_receive_end (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+
+ return true;
+}
+
+/**
+ * Write the header of a CC_RELAY MME.
+ * \param ctx the module context.
+ * \param peer the peer information.
+ * \param mmtype the MMType of the MME CC_RELAY_REQ or CC_RELAY_IND.
+ * \param prun if the MME shall be encrypted.
+ * \param peks the Payload encryption key select.
+ * \param fda the final destination mac address.
+ * \param ftei the final TEI.
+ */
+cp_mme_tx_t *
+cp_msg_cc_relay_send_begin (cp_t *ctx, cp_mme_peer_t *peer, cp_mmtype_t mmtype,
+ const cp_secu_protocol_run_t *prun,
+ cp_mme_peks_t peks,
+ mac_t fda, cp_tei_t ftei)
+{
+ cp_mme_tx_t * msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (fda);
+ dbg_assert (ftei);
+
+ dbg_assert ((mmtype != CC_RELAY_REQ) || (mmtype != CC_RELAY_IND));
+
+ // Get a TX buffer.
+ if (peks == CP_MME_PEKS_SPC_NOT_EMBEDDED)
+ msg = cp_msg_mme_init (ctx, peer, mmtype);
+ else
+ msg = cp_msg_mme_init_encrypted (ctx, peer, mmtype, peks, prun);
+
+ // Fill the data of the MME.
+ bitstream_access (&msg->bitstream, &fda, 48);
+ // Fill the TEI of the final destination station.
+ bitstream_access (&msg->bitstream, &ftei, 8);
+ // Go forward inserting a zero length MME payload length.
+ bitstream_write (&msg->bitstream, 0, 16);
+
+ return msg;
+}
+
+/**
+ * Finalise the MME CC_RELAY.*.
+ * \param ctx the module context.
+ * \param msg the MME to send.
+ * \param length the MME length corresponding (header included).
+ *
+ * Patch the Length of the MME payload in the MSG CC_RELAY.REQ MME.
+ */
+void
+cp_msg_cc_relay_send_finalise (cp_t *ctx, cp_mme_tx_t *msg, uint length)
+{
+ uint word;
+
+ dbg_assert (ctx);
+ dbg_assert (msg);
+ dbg_assert (length);
+
+ // Get the word containing the length of MME relay payload length field.
+ word = *((uint *) (msg->p_mme + (msg->peer.vlan_tag ? 28 : 24)));
+ // Add the length to the 16bits MSB in the word.
+ word = (word & 0xFFFF) | (length << 16);
+ // Store the word at the same address.
+ *((uint *) (msg->p_mme + (msg->peer.vlan_tag ? 28 : 24))) = word;
+}
+
+/**
+ * Receive a CC_RELAY.*
+ * \param ctx the control plane context.
+ * \param msg the MME context.
+ * \param length the MME payload length contained.
+ *
+ * Initialise the Relay MME.
+ */
+void
+cp_msg_cc_relay_receive (cp_t *ctx, cp_mme_rx_t *msg, uint *length)
+{
+ dbg_assert (ctx);
+ dbg_assert (msg);
+ dbg_assert (length);
+
+ // Read the FDA.
+ bitstream_access (&msg->bitstream, &msg->relay.mac_fa, 48);
+ bitstream_access (&msg->bitstream, &msg->relay.ftei, 8);
+ bitstream_access (&msg->bitstream, length, 16);
+}
+
diff --git a/cesar/cp/msg/src/msg_cm.c b/cesar/cp/msg/src/msg_cm.c
new file mode 100644
index 0000000000..02e56b4378
--- /dev/null
+++ b/cesar/cp/msg/src/msg_cm.c
@@ -0,0 +1,543 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/src/msg_cm.c
+ * \brief CM family MME.
+ * \ingroup cp_msg
+ */
+#include "common/std.h"
+#include "common/defs/homeplugAV.h"
+
+#include "lib/read_word.h"
+
+#include "cp/cp.h"
+#include "cp/mme.h"
+#include "cp/msg/msg.h"
+
+#include "cp/sta/mgr/net.h"
+#include "cp/sta/mgr/sta_mgr.h"
+
+#include "cp/msg/inc/msg_cm.h"
+
+/**
+ * Send a CM_UNASSOCIATED_STA.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param nid NID of the transmitting STA
+ * \param cco_cap CCo capability of the transmitting STA
+ */
+void
+cp_msg_cm_unassociated_sta_ind_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_nid_t nid, u8 cco_cap);
+
+/**
+ * Receive a CM_UNASSOCIATED_STA.IND.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param nid received NID of the transmitting STA
+ * \param cco_cap received CCo capability of the transmitting STA
+ * \return true on success
+ */
+bool
+cp_msg_cm_unassociated_sta_ind_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_nid_t *nid, u8 *cco_cap);
+
+/**
+ * Access to the data in the buffer.
+ * \param stream the stream to access the buffer.
+ * \param prun the protocol run.
+ * \param data the data.
+ */
+static void
+cp_msg_cm_set_key_req_access (bitstream_t *stream,
+ cp_secu_protocol_run_t *prun,
+ cp_msg_cm_set_key_req_t *data)
+{
+ uint i;
+
+ dbg_assert (stream);
+ dbg_assert (prun);
+ dbg_assert (data);
+
+ bitstream_access (stream, &data->key_type, 8);
+ bitstream_access (stream, &prun->my_nonce, 32);
+ bitstream_access (stream, &prun->your_nonce, 32);
+ bitstream_access (stream, &prun->pid, 8);
+ bitstream_access (stream, &prun->prn, 16);
+ bitstream_access (stream, &prun->pmn, 8);
+ bitstream_write (stream, CP_CCO_LEVEL, 8);
+ bitstream_access (stream, &data->nid, 56);
+ bitstream_access (stream, &data->new_eks, 8);
+ for (i = 0; i < 4; i ++)
+ bitstream_access (stream, &data->new_key.key[i], 32);
+}
+
+/**
+ * Get the PID of the CM_SET_KEY.CNF.
+ * \param ctx the Control plane context.
+ * \param mme the MME handle.
+ * \return pid the pid of the MME.
+ */
+uint
+cp_msg_cm_set_key_get_pid (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ uint offset;
+ uint pid;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (mme->peks == CP_MME_PEKS_SPC_NOT_EMBEDDED);
+
+
+ if (mme->peer.vlan_tag)
+ offset = HPAV_MME_HEADER_LEN_WITH_VLAN;
+ else
+ offset = HPAV_MME_HEADER;
+
+ pid = read_u8_from_word (mme->p_mme + offset + 9);
+
+ return pid;
+}
+
+/**
+ * Send a CM_SET_KEY.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_set_key_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_set_key_req_t *data)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (peer);
+ dbg_assert (prun);
+ dbg_assert (data);
+
+ msg = cp_msg_mme_init_encrypted (ctx, peer, CM_SET_KEY_REQ, peks,
+ prun);
+ dbg_check (msg);
+
+ cp_msg_cm_set_key_req_access (&msg->bitstream,
+ (cp_secu_protocol_run_t *) prun,
+ (cp_msg_cm_set_key_req_t *) data);
+
+ /* request type is HASH Key. */
+ /* if (data->key_type == CP_MSG_KEY_HASH_KEY)
+ {
+ }
+ */
+
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CM_SET_KEY.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_set_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_set_key_req_t *data)
+{
+ cp_net_t *net;
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (data);
+
+ cp_msg_cm_set_key_req_access (&mme->bitstream, &mme->prun, data);
+ XCH(mme->prun.my_nonce, mme->prun.your_nonce);
+
+ /* Verify some data. */
+ net = cp_sta_mgr_get_our_avln (ctx);
+ dbg_check (net);
+
+ if ((cp_net_get_nid (ctx, net) != data->nid)
+ || (data->key_type >= CP_MSG_KEY_NB))
+ return false;
+
+ return true;
+}
+
+/**
+ * CM_SET_KEY.CNF access.
+ * \param stream the bitstream context.
+ * \param prun the protocol run context.
+ * \param data the structure to use to read or write the data.
+ */
+static void
+cp_msg_cm_set_key_cnf_access (bitstream_t *stream,
+ cp_secu_protocol_run_t *prun,
+ cp_msg_cm_set_key_cnf_t *data)
+{
+ dbg_assert (stream);
+ dbg_assert (prun);
+ dbg_assert (data);
+
+ bitstream_access (stream, &data->result, 8);
+ bitstream_access (stream, &prun->my_nonce, 32);
+ bitstream_access (stream, &prun->your_nonce, 32);
+ bitstream_access (stream, &prun->pid, 8);
+ bitstream_access (stream, &prun->prn, 16);
+ bitstream_access (stream, &prun->pmn, 8);
+ bitstream_access (stream, &data->cco_cap, 8);
+}
+
+/**
+ * Send a CM_SET_KEY.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_set_key_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_set_key_cnf_t *data)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (prun);
+ dbg_assert (data);
+
+ dbg_assert (data->result < CP_MSG_CM_SET_KEY_CNF_RESULT_NB);
+
+ msg = cp_msg_mme_init (ctx, peer, CM_SET_KEY_CNF);
+ dbg_check (msg);
+
+ cp_msg_cm_set_key_cnf_access (&msg->bitstream,
+ (cp_secu_protocol_run_t *) prun,
+ (cp_msg_cm_set_key_cnf_t *) data);
+
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CM_SET_KEY.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_set_key_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_set_key_cnf_t *data)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (data);
+
+ cp_msg_cm_set_key_cnf_access (&mme->bitstream,
+ &mme->prun,
+ data);
+ XCH (mme->prun.my_nonce, mme->prun.your_nonce);
+
+ /* Verify data. */
+ if ((data->result > CP_MSG_CM_SET_KEY_CNF_RESULT_NB)
+ || (data->cco_cap >= 0x3))
+ return false;
+ return false;
+}
+
+/**
+ * Get the PID of the CM_GET_KEY.REQ.
+ * \param ctx the Control plane context.
+ * \param mme the MME handle.
+ * \return pid the pid of the MME.
+ */
+uint
+cp_msg_cm_get_key_req_get_pid (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ uint offset;
+ uint pid;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (mme->peks == CP_MME_PEKS_SPC_NOT_EMBEDDED);
+
+
+ if (mme->peer.vlan_tag)
+ offset = HPAV_MME_HEADER_LEN_WITH_VLAN;
+ else
+ offset = HPAV_MME_HEADER;
+
+ pid = read_u8_from_word (mme->p_mme + offset + 13);
+
+ return pid;
+}
+
+
+/**
+ * CM_GET_KEY.REQ Access.
+ * \param stream the bitstream context.
+ * \param prun the protocol run context.
+ * \param data the structure to use to read or write the data.
+ */
+static void
+cp_msg_cm_get_key_req_access (bitstream_t *stream,
+ cp_secu_protocol_run_t *prun,
+ cp_msg_cm_get_key_req_t *data)
+{
+ uint i;
+ dbg_assert (stream);
+ dbg_assert (prun);
+ dbg_assert (data);
+
+ bitstream_access (stream, &data->relayed, 8);
+ bitstream_access (stream, &data->key_type, 8);
+ bitstream_access (stream, &data->nid, 56);
+ bitstream_access (stream, &prun->my_nonce, 8);
+ bitstream_access (stream, &prun->pid, 8);
+ bitstream_access (stream, &prun->prn, 16);
+ bitstream_access (stream, &prun->pmn, 8);
+
+ if (data->key_type == CP_MSG_KEY_HASH_KEY)
+ {
+ for (i = 0; i < CP_HASH_KEY_SIZE; i++);
+ bitstream_access (stream, &data->hash_key[i], 8);
+ }
+}
+
+/**
+ * Send a CM_GET_KEY.REQ.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_get_key_req_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_get_key_req_t *data)
+{
+ cp_mme_tx_t *mme;
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (prun);
+ dbg_assert (data);
+
+ dbg_assert (data->key_type < CP_MSG_KEY_NB);
+ dbg_assert (data->nid);
+
+ mme = cp_msg_mme_init_encrypted (ctx, peer, CM_GET_KEY_REQ, peks,
+ prun);
+ dbg_check (mme);
+
+ cp_msg_cm_get_key_req_access (&mme->bitstream,
+ (cp_secu_protocol_run_t *) prun,
+ (cp_msg_cm_get_key_req_t *) data);
+
+
+ cp_msg_mme_send (ctx, mme);
+}
+
+/**
+ * Receive a CM_GET_KEY.REQ.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_get_key_req_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_get_key_req_t *data)
+{
+ cp_net_t *net;
+ dbg_assert (mme);
+ dbg_assert (data);
+
+ cp_msg_cm_get_key_req_access (&mme->bitstream,
+ &mme->prun,
+ data);
+ XCH (mme->prun.my_nonce, mme->prun.your_nonce);
+
+ /* Verify */
+ net = cp_sta_mgr_get_our_avln (ctx);
+ dbg_check (net);
+
+ if ((cp_net_get_nid (ctx, net) != data->nid)
+ || (data->key_type >= CP_MSG_KEY_NB))
+ return false;
+ return true;
+}
+
+/**
+ * CM_GET_KEY_CNF_access.
+ * \param stream the bitstream context.
+ * \param prun the protocol run context.
+ * \param data the structure to use to read or write the data.
+ */
+static void
+cp_msg_cm_get_key_cnf_access (bitstream_t *stream,
+ cp_secu_protocol_run_t *prun,
+ cp_msg_cm_get_key_cnf_t *data)
+{
+ uint i;
+
+ dbg_assert (stream);
+ dbg_assert (prun);
+ dbg_assert (data);
+
+ bitstream_access (stream, &data->result, 8);
+ bitstream_access (stream, &data->key_type, 8);
+ bitstream_access (stream, &prun->my_nonce, 32);
+ bitstream_access (stream, &prun->your_nonce, 32);
+ bitstream_access (stream, &data->nid, 56);
+ bitstream_access (stream, &data->eks, 8);
+ bitstream_access (stream, &prun->pid, 8);
+ bitstream_access (stream, &prun->prn, 16);
+ bitstream_access (stream, &prun->pmn, 8);
+
+ if (data->key_type == CP_MSG_KEY_HASH_KEY)
+ {
+ for ( i = 0; i < CP_HASH_KEY_SIZE; i++)
+ bitstream_access (stream, &data->hash_key[i], 8);
+ }
+ else if (data->key_type != CP_MSG_KEY_NONCE_ONLY)
+ {
+ for ( i = 0; i < sizeof (cp_key_t); i++)
+ bitstream_access (stream, &data->hash_key[i], 8);
+ }
+}
+
+/**
+ * Get the PID of the CM_GET_KEY.CNF.
+ * \param ctx the Control plane context.
+ * \param mme the MME handle.
+ * \return pid the pid of the MME.
+ */
+uint
+cp_msg_cm_get_key_cnf_get_pid (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ uint offset;
+ uint pid;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (mme->peks == CP_MME_PEKS_SPC_NOT_EMBEDDED);
+
+
+ if (mme->peer.vlan_tag)
+ offset = HPAV_MME_HEADER_LEN_WITH_VLAN;
+ else
+ offset = HPAV_MME_HEADER;
+
+ pid = read_u8_from_word (mme->p_mme + offset + 18);
+
+ return pid;
+}
+
+
+/**
+ * Send a CM_GET_KEY.CNF.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param peks payload encryption key select
+ * \param prun protocol run information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_get_key_cnf_send (cp_t *ctx, cp_mme_peer_t *peer,
+ cp_mme_peks_t peks,
+ const cp_secu_protocol_run_t *prun,
+ const cp_msg_cm_get_key_cnf_t *data)
+{
+ cp_mme_tx_t *msg;
+
+ dbg_assert (ctx);
+ dbg_assert (peer);
+ dbg_assert (prun);
+ dbg_assert (data);
+
+ dbg_assert (data->key_type < CP_MSG_KEY_NB);
+
+ msg = cp_msg_mme_init_encrypted (ctx, peer, CM_GET_KEY_CNF, peks, prun);
+ dbg_check (msg);
+
+ cp_msg_cm_get_key_cnf_access (&msg->bitstream,
+ (cp_secu_protocol_run_t *) prun,
+ (cp_msg_cm_get_key_cnf_t *) data);
+
+
+ cp_msg_mme_send (ctx, msg);
+}
+
+/**
+ * Receive a CM_GET_KEY.CNF.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ *
+ * Encryption and protocol run information is available in the MME handle.
+ */
+bool
+cp_msg_cm_get_key_cnf_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_get_key_cnf_t *data)
+{
+ cp_net_t *net;
+
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ dbg_assert (data);
+
+ cp_msg_cm_get_key_cnf_access (&mme->bitstream,
+ &mme->prun,
+ data);
+ XCH (mme->prun.my_nonce, mme->prun.your_nonce);
+
+ /* Verify data. */
+ net = cp_sta_mgr_get_our_avln (ctx);
+ dbg_check (net);
+
+ if ((cp_net_get_nid (ctx, net) != data->nid)
+ || (data->key_type >= CP_MSG_KEY_NB))
+ return false;
+ return true;
+}
+
+/**
+ * Send a CM_MME_ERROR.IND.
+ * \param ctx control plane context
+ * \param peer peer information
+ * \param data MME data to send
+ */
+void
+cp_msg_cm_mme_error_ind_send (cp_t *ctx, cp_mme_peer_t *peer_info,
+ const cp_msg_cm_mme_error_ind_t *data);
+/**
+ * Receive a CM_MME_ERROR.IND.
+ * \param ctx control plane context
+ * \param mme MME handle
+ * \param data received MME data
+ * \return true on success
+ */
+bool
+cp_msg_cm_mme_error_ind_receive (cp_t *ctx, cp_mme_rx_t *mme,
+ cp_msg_cm_mme_error_ind_t *data);
+
+
diff --git a/cesar/cp/msg/test/Makefile b/cesar/cp/msg/test/Makefile
new file mode 100644
index 0000000000..2c6ffea002
--- /dev/null
+++ b/cesar/cp/msg/test/Makefile
@@ -0,0 +1,20 @@
+BASE = ../../..
+
+INCLUDES = cp/msg/test/overide/
+
+HOST_PROGRAMS = test-msg-read-header test-msg-cc test-msg-cm test_frag
+
+test-msg-read-header_SOURCES = test-msg-read-header.c interface_stub.c \
+ cp_cl_interface_stub.c cl_stub.c fsm_stub.c
+test-msg-read-header_MODULES = lib cp/msg cp/secu cp/sta/mgr
+
+test-msg-cc_SOURCES = msg_cc.c interface_stub.c cl_stub.c fsm_stub.c
+test-msg-cc_MODULES = lib cp/msg cp/sta/mgr cp/secu
+
+test-msg-cm_SOURCES = msg_cm.c interface_stub.c cl_stub.c fsm_stub.c
+test-msg-cm_MODULES = lib cp/msg cp/sta/mgr cp/secu
+
+test_frag_SOURCES = cc_set_tei_map_frag.c interface_stub.c cl_stub.c fsm_stub.c
+test_frag_MODULES = lib cp/msg cp/sta/mgr cp/secu
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/msg/test/doc/Makefile b/cesar/cp/msg/test/doc/Makefile
new file mode 100644
index 0000000000..50006394a5
--- /dev/null
+++ b/cesar/cp/msg/test/doc/Makefile
@@ -0,0 +1,20 @@
+PAGES = read-header.txt
+
+ODT=$(PAGES:%.txt=%.odt)
+HTML=$(PAGES:%.txt=%.html)
+
+all: $(ODT) $(HTML)
+
+odt: $(ODT)
+
+html: $(HTML)
+
+%.odt: %.txt
+ rst2odt.py $< $@
+
+%.html: %.txt
+ rst2html $< $@
+
+clean:
+ rm -f $(ODT)
+ rm -f $(HTML)
diff --git a/cesar/cp/msg/test/doc/read-header.txt b/cesar/cp/msg/test/doc/read-header.txt
new file mode 100644
index 0000000000..482609d42b
--- /dev/null
+++ b/cesar/cp/msg/test/doc/read-header.txt
@@ -0,0 +1,69 @@
+MSG read MME header
+===================
+
+ MME used for the test with :
+
+* a length of 92 bytes.
+* TEI = 1
+
++-------+-------------------+-----------------+
+|Name | Value | length (bytes) |
++-------+-------------------+-----------------+
+|oda | 12:34:56:78:9A:BC | 6 |
++-------+-------------------+-----------------+
+|osa | 34:56:78:9A:BC:DE | 6 |
++-------+-------------------+-----------------+
+|[vlan] | 0x12 | 4 |
++-------+-------------------+-----------------+
+|Mtype | 0x88E1 | 2 |
++-------+-------------------+-----------------+
+|MMV | 0x1 | 1 |
++-------+-------------------+-----------------+
+|MMTYPE | 0x3245 | 2 |
++-------+-------------------+-----------------+
+|FMI | 0x432 | 2 |
++-------+-------------------+-----------------+
+
+Test 1 : Read a MME with a VLAN tag.
+------------------------------------
+
+The result shall be the following one.
+
+The MME rx object returned shall not be NULL and shall contain:
+
+* p_mme = buffer address containing the MME.
+* mmtype = 0x3245
+* length = 92.
+* peer
+
+ * mac = 34:56:78:9A:BC:DE
+ * vlan = 0x12
+ * tei = 1 (provided in argument).
+ * all_sta = false.
+
+Test 2 : Read a MME without a VLAN tag.
+---------------------------------------
+
+The result shall be the following one.
+
+The MME rx object returned shall not be NULL and shall contain:
+
+* p_mme = buffer address containing the MME.
+* mmtype = 0x3245
+* length = 92.
+* peer
+
+ * mac = 34:56:78:9A:BC:DE
+ * vlan = 0
+ * tei = 1 (provided in argument).
+ * all_sta = false.
+
+Test 3 : Read a MME with the MMV equal to 0
+-------------------------------------------
+
+The returned value shall be NULL.
+
+Test 4 : Read the MME with MType different of 0x88E1
+----------------------------------------------------
+
+The returned value shall be NULL.
diff --git a/cesar/cp/msg/test/overide/cp2/inc/context.h b/cesar/cp/msg/test/overide/cp2/inc/context.h
new file mode 100644
index 0000000000..e4b1b9195e
--- /dev/null
+++ b/cesar/cp/msg/test/overide/cp2/inc/context.h
@@ -0,0 +1,48 @@
+#ifndef overide_cp_inc_context_h
+#define overide_cp_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp/inc/context.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#include "lib/rnd.h"
+#include "cp/msg/inc/context.h"
+#include "cl/cl.h"
+
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/inc/sta_mgr.h"
+
+#include "mac/common/config.h"
+
+struct cp_t
+{
+ /** MSG context. */
+ cp_msg_t msg;
+
+ /** Interface context. */
+ interface_t *interface;
+
+ /** Station Manager. */
+ cp_sta_mgr_t sta_mgr;
+
+ /** Convergence layer context. */
+ cl_t *cl;
+
+ /** Random generator. */
+ lib_rnd_t rnd;
+
+ /** Mac config. */
+ mac_config_t *mac_config;
+};
+
+#endif /* overide_cp_inc_context_h */
diff --git a/cesar/cp/msg/test/overide/cp2/sta/core/core.h b/cesar/cp/msg/test/overide/cp2/sta/core/core.h
new file mode 100644
index 0000000000..89f6aae70c
--- /dev/null
+++ b/cesar/cp/msg/test/overide/cp2/sta/core/core.h
@@ -0,0 +1,18 @@
+#ifndef overide_cp_sta_core_core_h
+#define overide_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp/sta/core/core.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#endif /* overide_cp_sta_core_core_h */
diff --git a/cesar/cp/msg/test/overide/cp_fsm_defs.h b/cesar/cp/msg/test/overide/cp_fsm_defs.h
new file mode 100644
index 0000000000..c29fa69e19
--- /dev/null
+++ b/cesar/cp/msg/test/overide/cp_fsm_defs.h
@@ -0,0 +1,38 @@
+#ifndef overide_cp_fsm_defs_h
+#define overide_cp_fsm_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp_fsm_defs.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_all_sta_leaved,
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* overide_cp_fsm_defs_h */
diff --git a/cesar/cp/msg/test/src/cc_set_tei_map_frag.c b/cesar/cp/msg/test/src/cc_set_tei_map_frag.c
new file mode 100644
index 0000000000..db467adf86
--- /dev/null
+++ b/cesar/cp/msg/test/src/cc_set_tei_map_frag.c
@@ -0,0 +1,261 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/cc_set_tei_map_frag.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "common/defs/ethernet.h"
+#include "lib/test.h"
+#include "lib/swap.h"
+#include "lib/blk.h"
+#include <stdio.h>
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/msg/msg.h"
+
+struct mme_header_t
+{
+ mac_t oda;
+ mac_t osa;
+ uint vlan;
+ uint mtype;
+ uint mmv;
+ cp_mmtype_t mmtype;
+ uint fmi_inf;
+ uint fmi_mi;
+ uint fmi_ssn;
+};
+typedef struct mme_header_t mme_header_t;
+
+static u8 buffer_list[3][2048];
+static uint next_buffer = 0;
+static test_t test;
+
+void
+test_case_msg_cc_set_tei_map_frag (void)
+{
+ cp_mme_peer_t peer;
+ cp_mme_tx_t *mme_tx;
+ uint mode;
+ uint nb_sta;
+ u64 data;
+ uint i;
+ uint offset;
+ cp_t cp;
+ bitstream_t stream;
+ mme_header_t header;
+ mac_config_t mac_config;
+ cp_mme_rx_t msg_rx;
+
+ mac_t mac;
+ cp_tei_t tei;
+ uint status;
+
+ u8 *buffer1;
+ u8 *buffer2;
+
+ blk_t *frag_first;
+ blk_t *frag_last;
+
+ cp.mac_config = &mac_config;
+ test_init (test, 0, NULL);
+
+ cp_sta_own_data_set_tei (&cp, 0xA);
+ cp_sta_own_data_set_mac_address (&cp, 0x123456789ABCull);
+ cp_sta_mgr_update_our_avln_nid (&cp, 0x123456789ABCDEFull);
+ cp_sta_mgr_update_our_avln_snid (&cp, 0x2);
+
+
+ test_case_begin (test, "CC_SET_TEI_MAP.IND : Send");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0x0;
+ peer.all_sta = false;
+
+ mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_ADD;
+ nb_sta = 200;
+
+ mme_tx = cp_msg_cc_set_tei_map_ind_send_begin (&cp, &peer, mode, nb_sta);
+ // get the first buffer.
+ buffer1 = mme_tx->p_mme;
+
+ for (i = 0; i < nb_sta; i++)
+ {
+ cp_msg_cc_set_tei_map_ind_send_sta (&cp, mme_tx, i + 1, i + 1,
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED);
+ }
+ // get the second buffer.
+ buffer2 = mme_tx->p_mme;
+
+ cp_msg_cc_set_tei_map_ind_send_end (&cp, mme_tx);
+
+ bitstream_init (&stream, buffer1, 1518, BITSTREAM_READ);
+
+ bitstream_access (&stream, &header.oda, 48);
+ bitstream_access (&stream, &header.osa, 48);
+ bitstream_access (&stream, &header.mtype, 16);
+ header.mtype = swap16 (header.mtype);
+ bitstream_access (&stream, &header.mmv, 8);
+ bitstream_access (&stream, &header.mmtype, 16);
+ bitstream_access (&stream, &header.fmi_inf, 4);
+ bitstream_access (&stream, &header.fmi_mi, 4);
+ bitstream_access (&stream, &header.fmi_ssn, 8);
+
+ test_begin (test, "Verify buffer 1")
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != mode, "Wrong mode");
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != nb_sta, "Wrong number of entries");
+
+ for ( i = 0; bitstream_bytes_processed (&stream) < ETH_PACKET_MAX_SIZE; i++)
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != i + 1, "Wrong TEI");
+ bitstream_access (&stream, &data, 48);
+ test_fail_if (data != i + 1, "Wrong Mac Address");
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED,
+ "Wrong status");
+ }
+ }
+ test_end
+ bitstream_finalise (&stream);
+
+ bitstream_init (&stream, buffer2, 1518, BITSTREAM_READ);
+
+ bitstream_access (&stream, &header.oda, 48);
+ bitstream_access (&stream, &header.osa, 48);
+ bitstream_access (&stream, &header.mtype, 16);
+ header.mtype = swap16 (header.mtype);
+ bitstream_access (&stream, &header.mmv, 8);
+ bitstream_access (&stream, &header.mmtype, 16);
+ bitstream_access (&stream, &header.fmi_inf, 4);
+ bitstream_access (&stream, &header.fmi_mi, 4);
+ bitstream_access (&stream, &header.fmi_ssn, 8);
+
+ test_begin (test, "Verify buffer 2")
+ {
+ bitstream_access (&stream, &data, 48);
+ test_fail_if (data != 188, "Wrong mac address");
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != 0, "Wrong status");
+ for ( i = 0; i < 12; i++)
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != i + 189, "Wrong TEI");
+ bitstream_access (&stream, &data, 48);
+ test_fail_if (data != i + 189, "Wrong Mac Address");
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED,
+ "Wrong status");
+ }
+ }
+ test_end
+ bitstream_finalise (&stream);
+
+ test_case_begin (test, "CC_SET_TEI_MAP.IND received frag");
+ // Store the payload of the first buffer to the blocks.
+ frag_first = blk_alloc_desc_range (4, &frag_last);
+
+ /* First frag. */
+ offset = 19;
+ memcpy (frag_first->data, buffer1 + offset, BLK_SIZE);
+
+ /* Second frag. */
+ offset += BLK_SIZE;
+ memcpy (frag_first->next->data, buffer1 + offset, BLK_SIZE);
+
+ /* Third frag. */
+ offset += BLK_SIZE;
+ memcpy (frag_first->next->next->data, buffer1 + offset, 475);
+ offset = 19;
+ memcpy (frag_first->next->next->data + 475, buffer2 + offset, BLK_SIZE -
+ 475);
+
+ /* Fourth frag. */
+ offset += BLK_SIZE - 475;
+ memcpy (frag_first->next->next->next->data, buffer2 + offset, BLK_SIZE);
+ frag_last->next = NULL;
+
+ msg_rx.p_frag = frag_first;
+ msg_rx.p_frag_current = frag_first;
+ msg_rx.length = 1600;
+ bitstream_init (&msg_rx.bitstream, msg_rx.p_frag->data, 512,
+ BITSTREAM_READ);
+ cp_msg_cc_set_tei_map_ind_receive_begin (&cp, &msg_rx, &mode, &nb_sta);
+
+ test_begin (test, "Verify")
+ {
+ for (i = 0; i < nb_sta; i++)
+ {
+ cp_msg_cc_set_tei_map_ind_receive_sta (&cp, &msg_rx, &tei, &mac,
+ &status);
+ test_fail_if (mac != i + 1, "Wrong mac address");
+ test_fail_if (tei != i + 1, "Wrong TEI");
+ test_fail_if (status != 0, "Wrong status");
+ }
+ }
+ test_end;
+
+ cp_msg_cc_set_tei_map_ind_receive_end (&cp, &msg_rx);
+ /* Release the blocks allocated. */
+ blk_release_desc_range ((blk_t *) frag_first, (blk_t *) frag_last);
+ blk_release (msg_rx.bitstream.user_data);
+}
+
+int
+main (void)
+{
+ test_case_msg_cc_set_tei_map_frag ();
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u8 *
+cp_cl_interf_get_buffer_tx (cp_t *ctx)
+{
+ u8 *buffer;
+ dbg_assert (ctx);
+
+ buffer = buffer_list[next_buffer];
+ next_buffer = (next_buffer + 1) % 3;
+ return buffer;
+}
+
+void
+cp_cl_interf_add_buffer_tx (cp_t *ctx, u8 * buffer)
+{
+}
+
+/**
+ * Send a MME over the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mme The MME to send.
+ *
+ */
+void
+cp_cl_interf_mme_send (cp_t *ctx, cp_mme_tx_t * mme)
+{
+ dbg_assert (mme);
+ mme->p_mme = NULL;
+}
diff --git a/cesar/cp/msg/test/src/cl_stub.c b/cesar/cp/msg/test/src/cl_stub.c
new file mode 100644
index 0000000000..e9ff2f1556
--- /dev/null
+++ b/cesar/cp/msg/test/src/cl_stub.c
@@ -0,0 +1,119 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cl/cl_mactotei.h
+ * \brief mac to tei table interface between the CL and the CP
+ * \ingroup cl
+ *
+ */
+#include "common/std.h"
+#include "cl/cl_mactotei.h"
+
+#include "lib/bitstream.h"
+#include <string.h>
+
+/**
+ * Create a new table to be filled by the CP.
+ *
+ * \return a pointer to the new block to be fill with the mac to tei table
+ * data
+ */
+cl_mactotei_blk_t *
+cl_mactotei_new (void)
+{
+ u8 *my_data;
+
+ my_data = blk_alloc ();
+ my_data[0] = 0;
+ return (cl_mactotei_blk_t *) my_data;
+}
+
+/**
+ * Add a new tupple of data to the table.
+ *
+ * \param table the table pointer to add a new mac to tei correspondance.
+ * \param mac_addr the mac addr to add
+ * \param tei the tei corresponding to the STA.
+ * \param tag the CP tag provide to indentifier a network.
+ */
+void cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr,
+ uint tei, uint tag)
+{
+ bitstream_t bitstream;
+ u8 *data;
+ uint pos;
+
+ dbg_assert (table);
+ dbg_assert (tei);
+
+ data = (u8 *) table;
+ pos = 8 * data[0] + 1;
+
+ bitstream_init (&bitstream, &data[pos],
+ 8, BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &tag, 8);
+ bitstream_access (&bitstream, &tei, 8);
+ bitstream_access (&bitstream, &mac_addr, 48);
+ bitstream_finalise (&bitstream);
+
+ data[0] ++;
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tag)
+{
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag and the tei.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tei the tei to copy.
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tei_and_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tei, u8 tag)
+{
+}
+
+/**
+ * Request the CL to use the new table and remove the old one.
+ *
+ * \param ctx the CL context
+ * \param table the new table to use.
+ */
+void
+cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
+{
+ dbg_assert (ctx);
+ dbg_assert (table);
+
+ memcpy ((u8 *) ctx, (u8 *)table, 512) ;
+
+ blk_release (table);
+}
+
+/**
+ * Release the complete table from the memory.
+ *
+ * \param ctx the convergence layer context
+ */
+void cl_mactotei_release_table (cl_t *ctx)
+{
+}
+
diff --git a/cesar/cp/msg/test/src/cp_cl_interface_stub.c b/cesar/cp/msg/test/src/cp_cl_interface_stub.c
new file mode 100644
index 0000000000..69f5b65b8d
--- /dev/null
+++ b/cesar/cp/msg/test/src/cp_cl_interface_stub.c
@@ -0,0 +1,44 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/cp_cl_interface_stub.c
+ * \brief CL interface stub functions.
+ * \ingroup cp_msg
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+#include "cp/msg/msg.h"
+
+static u8 buffer[2048] __attribute__((aligned(2048)));
+
+u8 *
+cp_cl_interf_get_buffer_tx (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return buffer;
+}
+
+void
+cp_cl_interf_add_buffer_tx (cp_t *ctx, u8 * buffer)
+{
+}
+
+/**
+ * Send a MME over the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mme The MME to send.
+ *
+ */
+void
+cp_cl_interf_mme_send (cp_t *ctx, cp_mme_tx_t * mme)
+{
+ mme->p_mme = NULL;
+}
diff --git a/cesar/cp/msg/test/src/fsm_stub.c b/cesar/cp/msg/test/src/fsm_stub.c
new file mode 100644
index 0000000000..849f375270
--- /dev/null
+++ b/cesar/cp/msg/test/src/fsm_stub.c
@@ -0,0 +1,29 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
diff --git a/cesar/cp/msg/test/src/interface_stub.c b/cesar/cp/msg/test/src/interface_stub.c
new file mode 100644
index 0000000000..68d5683537
--- /dev/null
+++ b/cesar/cp/msg/test/src/interface_stub.c
@@ -0,0 +1,27 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/interface_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+
+/**
+ * Inform the Data plane when the MME as been processed by the CP.
+ * \param ctx the interface context
+ * \param mme_recv the cl data (as a void pointer).
+ */
+void
+interface_mme_recv_done (interface_t *ctx, void *mme_recv)
+{
+}
diff --git a/cesar/cp/msg/test/src/msg_cc.c b/cesar/cp/msg/test/src/msg_cc.c
new file mode 100644
index 0000000000..6a85ffd5f0
--- /dev/null
+++ b/cesar/cp/msg/test/src/msg_cc.c
@@ -0,0 +1,646 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/test/src/msg_cc.c
+ * \brief Test the MSG_CC Family functions.
+ * \ingroup cp_msg
+ *
+ */
+#include "common/std.h"
+
+#include "common/defs/ethernet.h"
+#include "common/defs/homeplugAV.h"
+
+#include "lib/test.h"
+#include "lib/swap.h"
+#include "lib/bitstream.h"
+
+#include "cp/cp.h"
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/sta_own_data.h"
+
+#include "cp/inc/context.h"
+#include "cp/msg/inc/msg.h"
+
+#include "stdio.h"
+
+struct mme_header_t
+{
+ mac_t oda;
+ mac_t osa;
+ uint vlan;
+ uint mtype;
+ uint mmv;
+ cp_mmtype_t mmtype;
+ uint fmi_inf;
+ uint fmi_mi;
+ uint fmi_ssn;
+};
+typedef struct mme_header_t mme_header_t;
+
+static u8 buffer[2048] __attribute__((aligned(2048)));
+cp_t cp;
+mac_config_t mac_config;
+bitstream_t stream;
+mme_header_t header;
+mac_t own_mac_addr = 0x123456789ABCull;
+
+mme_header_t expected;
+test_t test;
+
+static void
+test_read_header (bool vlan_present)
+{
+ bitstream_init (&stream, buffer, 1518, BITSTREAM_READ);
+
+ bitstream_access (&stream, &header.oda, 48);
+ bitstream_access (&stream, &header.osa, 48);
+ if (vlan_present)
+ bitstream_access (&stream, &header.vlan, 32);
+ bitstream_access (&stream, &header.mtype, 16);
+ header.mtype = swap16 (header.mtype);
+ bitstream_access (&stream, &header.mmv, 8);
+ bitstream_access (&stream, &header.mmtype, 16);
+ bitstream_access (&stream, &header.fmi_inf, 4);
+ bitstream_access (&stream, &header.fmi_mi, 4);
+ bitstream_access (&stream, &header.fmi_ssn, 8);
+
+ test_begin (test, "Header")
+ {
+ test_fail_if (header.oda != expected.oda, "Wrong dest mac address");
+ test_fail_if (header.osa != expected.osa, "Wrong source mac address");
+ test_fail_if (header.mtype != HPAV_MTYPE_MME,
+ "Wrong MTYPE");
+ test_fail_if (header.mmv != HPAV_MMV, "Wrong source mac address");
+ test_fail_if (header.mmtype != expected.mmtype,
+ "Wrong MMTYPE");
+ test_fail_if (header.fmi_inf != expected.fmi_inf, "Wrong FMI");
+ test_fail_if (header.fmi_mi != expected.fmi_mi, "Wrong FMI ni");
+ test_fail_if (header.fmi_ssn != expected.fmi_ssn, "Wrong FMI SSN");
+ }
+ test_end;
+}
+
+void
+test_case_msg_cc_who_ru (void)
+{
+ cp_mme_peer_t peer;
+ cp_nid_t nid;
+ u64 data;
+ cp_mme_rx_t *mme;
+ cp_msg_cc_who_ru_cnf_t cnf;
+ cp_sta_own_data_t *own_data;
+ u8 hfid[CP_HFID_SIZE+1];
+ uint i;
+
+ test_case_begin (test, "CC_WHO_RU.REQ : Send");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0xA;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDEull;
+
+ cp_msg_cc_who_ru_req_send (&cp, &peer, nid);
+
+ expected.oda = peer.mac;
+ expected.osa = own_mac_addr;
+ expected.mmtype = CC_WHO_RU_REQ;
+ expected.fmi_inf = 0;
+ expected.fmi_mi = 0;
+ expected.fmi_ssn = 0;
+
+ test_read_header (false);
+ test_begin (test, "NID")
+ {
+ bitstream_access (&stream, &data, 56);
+ test_fail_if (data != nid, "Wrong NID");
+ }
+ test_end;
+ bitstream_finalise (&stream);
+
+ test_case_begin (test, "CC_WHO_RU.REQ : Receive");
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 60, 0xA, (uint*) &data);
+ cp_msg_cc_who_ru_req_receive (&cp, mme, &data);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (nid != data, "Wrong NID");
+ }
+ test_end;
+
+ slab_release (mme);
+
+
+ test_case_begin (test, "CC_WHO_RU.CNF : Send");
+
+ cnf.nid = nid;
+ cnf.cco_mac = own_mac_addr;
+ strcpy (cnf.avln_hfid, "Hello world\0");
+ cp_msg_cc_who_ru_cnf_send (&cp, &peer, &cnf);
+
+ expected.mmtype = CC_WHO_RU_CNF;
+ test_read_header (false);
+
+ test_begin (test, "verify")
+ {
+ bitstream_access (&stream, &data, 56);
+ test_fail_if (data != nid, "Wrong NID");
+ bitstream_access (&stream, &data, 48);
+ test_fail_if (data != own_mac_addr, "Wrong Mac @");
+
+ for (i = 0; i < CP_HFID_SIZE; i++)
+ bitstream_access (&stream, &hfid[i], 8);
+
+ data = strcmp ((char *)hfid, "Hello world\0");
+ test_fail_if (data != 0, "Wrong HFID");
+ }
+ test_end;
+
+
+ test_case_begin (test, "CC_WHO_RU.CNF : Receive");
+ own_data = cp_sta_mgr_get_sta_own_data (&cp);
+ own_data->is_cco = true;
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 60, 0xA, (uint *) &data);
+ cp_msg_cc_who_ru_cnf_receive (&cp, mme, &cnf);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (mme->mmtype != CC_WHO_RU_CNF, "Wrong MMTYPE");
+ test_fail_if (cnf.nid != nid, "Wrong NID");
+ test_fail_if (cnf.cco_mac != own_mac_addr, "Wrong mac @");
+ data = strcmp (cnf.avln_hfid, "Hello world\0");
+ test_fail_if (data != 0, "Wrong HFID");
+ }
+ test_end;
+
+ slab_release (mme);
+}
+
+void
+test_case_msg_cc_assoc (void)
+{
+ cp_mme_peer_t peer;
+ u64 data;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ cp_mme_rx_t *mme;
+ cp_msg_cc_assoc_req_t req;
+ cp_msg_cc_assoc_cnf_t cnf;
+
+ test_case_begin (test, "CC_ASSOC.REQ : Send");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0x0;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDull;
+ snid = 0xf;
+
+ req.request_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW;
+ req.nid = nid;
+ req.cco_cap = CP_CCO_LEVEL;
+ req.proxy_cap = 1;
+
+ cp_msg_cc_assoc_req_send (&cp, &peer, &req);
+
+ expected.oda = peer.mac;
+ expected.osa = own_mac_addr;
+ expected.mmtype = CC_ASSOC_REQ;
+ expected.fmi_inf = 0;
+ expected.fmi_mi = 0;
+ expected.fmi_ssn = 0;
+
+ test_read_header (false);
+ test_begin (test, "NID")
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ "Wrong request type");
+
+ bitstream_access (&stream, &data, 56);
+ test_fail_if (data != nid, "Wrong NID");
+
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != req.cco_cap, "Wrong CCO cap");
+
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != req.proxy_cap, "Wrong Proxy cap");
+ }
+ test_end;
+ bitstream_finalise (&stream);
+
+ test_case_begin (test, "CC_ASSOC.REQ : Receive");
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 60, 0xA, (uint *) &data);
+ cp_msg_cc_assoc_req_receive (&cp, mme, &req);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (mme->mmtype != CC_ASSOC_REQ, "Wrong MMtype");
+ test_fail_if (req.request_type != CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ "Wrong request type");
+ test_fail_if (req.nid != nid, "Wrong NID");
+ test_fail_if (req.cco_cap != CP_CCO_LEVEL, "Wrong CCO cap");
+ test_fail_if (req.proxy_cap != 1, "Wrong proxy type");
+ }
+ test_end;
+
+ slab_release (mme);
+
+ test_case_begin (test, "CC_ASSOC.CNF : SEND");
+
+ cnf.result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS;
+ cnf.nid = nid;
+ cnf.snid = snid;
+ cnf.sta_tei = 0xB;
+ cnf.lease_time_min = 10;
+
+ cp_msg_cc_assoc_cnf_send (&cp, &peer, &cnf);
+
+ expected.oda = peer.mac;
+ expected.osa = own_mac_addr;
+ expected.mmtype = CC_ASSOC_CNF;
+ expected.fmi_inf = 0;
+ expected.fmi_mi = 0;
+ expected.fmi_ssn = 0;
+
+ test_read_header (false);
+ test_begin (test, "SEND")
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ "Wrong result type");
+
+ bitstream_access (&stream, &data, 56);
+ test_fail_if (data != nid, "Wrong NID");
+
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != snid, "Wrong SNID");
+
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != cnf.sta_tei, "Wrong TEI");
+
+ bitstream_access (&stream, &data, 16);
+ test_fail_if (data != cnf.lease_time_min, "Wrong Lease time");
+ }
+ test_end;
+ bitstream_finalise (&stream);
+
+ test_case_begin (test, "CC_ASSOC.CNF : Receive");
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 60, 0xA, (uint *) &data);
+ cp_msg_cc_assoc_cnf_receive (&cp, mme, &cnf);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (mme->mmtype != CC_ASSOC_CNF, "Wrong MMtype");
+ test_fail_if (cnf.result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ "Wrong result type");
+ test_fail_if (cnf.nid != nid, "Wrong NID");
+ test_fail_if (cnf.snid != snid , "Wrong SNID");
+ test_fail_if (cnf.sta_tei != 0xB, "Wrong TEI");
+ test_fail_if (cnf.lease_time_min != 10, "Wrong lease time");
+ }
+ test_end;
+
+ slab_release (mme);
+}
+
+void
+test_case_msg_cc_leave (void)
+{
+ cp_mme_peer_t peer;
+ u64 data;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ cp_mme_rx_t *mme;
+ uint reason;
+
+ test_case_begin (test, "CC_LEAVE.REQ : Send");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0x0;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDull;
+ snid = 0xf;
+
+ reason = CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED;
+ cp_msg_cc_leave_req_send (&cp, &peer, reason);
+
+ expected.oda = peer.mac;
+ expected.osa = own_mac_addr;
+ expected.mmtype = CC_LEAVE_REQ;
+ expected.fmi_inf = 0;
+ expected.fmi_mi = 0;
+ expected.fmi_ssn = 0;
+
+ test_read_header (false);
+ test_begin (test, "Verify")
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != reason,
+ "Wrong reason type");
+ }
+ test_end;
+ bitstream_finalise (&stream);
+
+ test_case_begin (test, "CC_LEAVE.REQ : Receive");
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 60, 0xA, (uint *) &data);
+ cp_msg_cc_leave_req_receive (&cp, mme, &reason);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (mme->mmtype != CC_LEAVE_REQ, "Wrong MMtype");
+ test_fail_if (reason != CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
+ "Wrong request type");
+ }
+ test_end;
+
+ slab_release (mme);
+
+ test_case_begin (test, "CC_LEAVE.IND : SEND");
+
+ cp_msg_cc_leave_ind_send (&cp, &peer, reason, nid);
+
+ expected.oda = peer.mac;
+ expected.osa = own_mac_addr;
+ expected.mmtype = CC_LEAVE_IND;
+ expected.fmi_inf = 0;
+ expected.fmi_mi = 0;
+ expected.fmi_ssn = 0;
+
+ test_read_header (false);
+ test_begin (test, "SEND")
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
+ "Wrong reason");
+
+ bitstream_access (&stream, &data, 56);
+ test_fail_if (data != nid, "Wrong NID");
+ }
+ test_end;
+ bitstream_finalise (&stream);
+
+ test_case_begin (test, "CC_LEAVE.IND : Receive");
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 60, 0xA, (uint *) &data);
+ cp_msg_cc_leave_ind_receive (&cp, mme, &reason, &nid);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (mme->mmtype != CC_LEAVE_IND, "Wrong MMtype");
+ test_fail_if (reason != CP_MSG_CC_LEAVE_IND_REASON_TEI_LEASE_EXPIRED,
+ "Wrong reason type");
+ test_fail_if (nid != 0x123456789ABCDull, "Wrong NID");
+ }
+ test_end;
+
+ slab_release (mme);
+}
+
+void
+test_case_msg_cc_set_tei_map (void)
+{
+ cp_mme_peer_t peer;
+ cp_nid_t nid;
+ cp_snid_t snid;
+ cp_mme_tx_t *mme_tx;
+ cp_mme_rx_t *mme_rx;
+ uint mode;
+ uint nb_sta;
+ u64 data;
+ cp_tei_t tei;
+ mac_t mac;
+ uint status;
+
+ test_case_begin (test, "CC_SET_TEI_MAP.IND : Send");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0x0;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDull;
+ snid = 0xf;
+
+ mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_ADD;
+ nb_sta = 1;
+
+ mme_tx = cp_msg_cc_set_tei_map_ind_send_begin (&cp, &peer, mode, nb_sta);
+ cp_msg_cc_set_tei_map_ind_send_sta (&cp, mme_tx, 0xA, own_mac_addr,
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED);
+ cp_msg_cc_set_tei_map_ind_send_end (&cp, mme_tx);
+
+ expected.oda = peer.mac;
+ expected.osa = own_mac_addr;
+ expected.mmtype = CC_SET_TEI_MAP_IND;
+ expected.fmi_inf = 0;
+ expected.fmi_mi = 0;
+ expected.fmi_ssn = 0;
+
+ test_read_header (false);
+ test_begin (test, "Verify")
+ {
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != mode, "Wrong mode");
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != nb_sta, "Wrong number of entries");
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != 0xA, "Wrong TEI");
+ bitstream_access (&stream, &data, 48);
+ test_fail_if (data != own_mac_addr, "Wrong Mac Address");
+ bitstream_access (&stream, &data, 8);
+ test_fail_if (data != CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED,
+ "Wrong status");
+ }
+ test_end
+ bitstream_finalise (&stream);
+
+ test_case_begin (test, "CC_SET_TEI_MAP.IND : Receive");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0x0;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDull;
+ snid = 0xf;
+
+ mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_ADD;
+ nb_sta = 1;
+
+ mme_rx = cp_msg_mme_read_header (&cp, buffer, 60, 0xA, (uint*) &data);
+ cp_msg_cc_set_tei_map_ind_receive_begin (&cp, mme_rx, &mode,
+ &nb_sta);
+ cp_msg_cc_set_tei_map_ind_receive_sta (&cp, mme_rx, &tei, &mac, &status);
+ cp_msg_cc_set_tei_map_ind_receive_end (&cp, mme_rx);
+
+ expected.mmtype = CC_SET_TEI_MAP_IND;
+
+ test_read_header (false);
+ test_begin (test, "Verify")
+ {
+ test_fail_if (mode != CP_MSG_CC_SET_TEI_MAP_IND_MODE_ADD,
+ "Wrong mode");
+ test_fail_if (nb_sta != 1, "Wrong number of entries");
+ test_fail_if (tei != 0xA, "Wrong TEI");
+ test_fail_if (mac != own_mac_addr, "Wrong Mac Address");
+ test_fail_if (status != CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED,
+ "Wrong status");
+ }
+ test_end
+ bitstream_finalise (&stream);
+
+ slab_release (mme_rx);
+}
+
+void
+test_case_cc_relay (void)
+{
+ cp_mme_peer_t peer;
+ cp_nid_t nid;
+ cp_secu_protocol_run_t prun;
+ cp_mme_tx_t *msg_tx;
+ cp_mme_rx_t *msg_rx;
+ uint fmi;
+ uint length;
+
+ test_case_begin (test, "CC_RELAY.REQ");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0xA;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDEull;
+
+ prun.pid = 2;
+ prun.pmn = 2;
+ prun.prn = 2;
+ prun.my_nonce = 0x12;
+ prun.your_nonce = 0x13;
+
+ msg_tx = cp_msg_cc_relay_req_send_begin (&cp, &peer, &prun,
+ CP_MME_PEKS_SPC_NOT_EMBEDDED,
+ MAC_BROADCAST, 0xFF);
+
+ for (length = 100; length; length --)
+ {
+ bitstream_access (&msg_tx->bitstream, &length, 8);
+ }
+ cp_msg_cc_relay_send_finalise (&cp, msg_tx, 100);
+ cp_msg_mme_send (&cp, msg_tx);
+
+ msg_rx = cp_msg_mme_read_header (&cp, buffer, 100 + 19, 0x0, &fmi);
+ cp_msg_cc_relay_receive (&cp, msg_rx, &length);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (msg_rx->mmtype != CC_RELAY_REQ, "Wrong MME Type");
+ test_fail_if (length != 100, "Wrong length");
+ test_fail_if (msg_rx->relay.mac_fa != MAC_BROADCAST,
+ "Wrong mac address");
+ test_fail_if (msg_rx->relay.ftei != 0xFF, "Wrong FTEI");
+ }
+ test_end;
+
+ peer = msg_tx->peer;
+ slab_release (msg_tx);
+
+ test_case_begin (test, "CC_RELAY.IND");
+ msg_tx = cp_msg_cc_relay_ind_send_begin (&cp, &peer, &prun,
+ CP_MME_PEKS_SPC_NOT_EMBEDDED,
+ 0x3456789ABCDEull,
+ 0x3);
+ for (length = 102; length; length --)
+ {
+ bitstream_access (&msg_tx->bitstream, &length, 8);
+ }
+ cp_msg_cc_relay_send_finalise (&cp, msg_tx, 102);
+ cp_msg_mme_send (&cp, msg_tx);
+
+ msg_rx = cp_msg_mme_read_header (&cp, buffer, 102 + 19, 0x0, &fmi);
+ cp_msg_cc_relay_receive (&cp, msg_rx, &length);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (msg_rx->mmtype != CC_RELAY_IND, "Wrong MME Type");
+ test_fail_if (length != 102, "Wrong length");
+ test_fail_if (msg_rx->relay.mac_fa != 0x3456789ABCDEull,
+ "Wrong mac address");
+ test_fail_if (msg_rx->relay.ftei != 0x3, "Wrong FTEI");
+ }
+ test_end;
+
+ slab_release (msg_tx);
+}
+
+int
+main (void)
+{
+ cp_sta_own_data_t *own_data;
+
+ cp.mac_config = &mac_config;
+ test_init (test, 0, NULL);
+
+ own_data = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_tei (&cp, 0xA);
+ cp_sta_own_data_set_mac_address (&cp, own_mac_addr);
+ cp_sta_mgr_update_our_avln_nid (&cp, 0x123456789ABCDEFull);
+ cp_sta_mgr_update_our_avln_snid (&cp, 0x2);
+
+ test_case_msg_cc_who_ru ();
+ test_case_msg_cc_assoc ();
+ test_case_msg_cc_leave ();
+ test_case_msg_cc_set_tei_map ();
+ test_case_cc_relay ();
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u8 *
+cp_cl_interf_get_buffer_tx (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return buffer;
+}
+
+void
+cp_cl_interf_add_buffer_tx (cp_t *ctx, u8 * buffer)
+{
+}
+
+/**
+ * Send a MME over the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mme The MME to send.
+ *
+ */
+void
+cp_cl_interf_mme_send (cp_t *ctx, cp_mme_tx_t * mme)
+{
+ mme->p_mme = NULL;
+}
diff --git a/cesar/cp/msg/test/src/msg_cm.c b/cesar/cp/msg/test/src/msg_cm.c
new file mode 100644
index 0000000000..00d4fcc2a9
--- /dev/null
+++ b/cesar/cp/msg/test/src/msg_cm.c
@@ -0,0 +1,634 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/msg/test/src/msg_cm.c
+ * \brief Test the MSG_CM Family functions.
+ * \ingroup cp_msg
+ *
+ */
+#include "common/std.h"
+
+#include "common/defs/ethernet.h"
+#include "common/defs/homeplugAV.h"
+
+#include "lib/test.h"
+#include "lib/swap.h"
+#include "lib/bitstream.h"
+
+#include "cp/cp.h"
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/sta_own_data.h"
+
+#include "cp/inc/context.h"
+#include "cp/msg/inc/msg.h"
+
+struct mme_header_t
+{
+ mac_t oda;
+ mac_t osa;
+ uint vlan;
+ uint mtype;
+ uint mmv;
+ cp_mmtype_t mmtype;
+ uint fmi_inf;
+ uint fmi_mi;
+ uint fmi_ssn;
+};
+typedef struct mme_header_t mme_header_t;
+
+static u8 buffer[2048] __attribute__((aligned(2048)));
+static uint buffer_len;
+cp_t cp;
+mac_config_t mac_config;
+bitstream_t stream;
+mme_header_t header;
+mac_t own_mac_addr = 0x123456789ABCull;
+
+mme_header_t expected;
+test_t test;
+
+void
+test_case_cm_set_key (void)
+{
+ cp_mme_peer_t peer;
+ cp_nid_t nid;
+ cp_secu_protocol_run_t prun;
+ cp_msg_cm_set_key_req_t key_req;
+ cp_msg_cm_set_key_cnf_t key_cnf;
+ cp_mme_rx_t *msg;
+ uint fmi;
+ cp_sta_own_data_t *own_data;
+
+ test_case_begin (test, "CM_SET_KEY.REQ");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0xA;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDEull;
+
+ prun.pid = 2;
+ prun.pmn = 2;
+ prun.prn = 2;
+ prun.my_nonce = 0x12;
+ prun.your_nonce = 0x13;
+
+ key_req.key_type = CP_MSG_KEY_DAK;
+ key_req.cco_cap = CP_CCO_LEVEL;
+ key_req.new_eks = 2;
+ key_req.new_key.key[0] = 0;
+ key_req.new_key.key[1] = 1;
+ key_req.new_key.key[2] = 2;
+ key_req.new_key.key[3] = 3;
+ key_req.nid = nid;
+
+ cp_msg_cm_set_key_req_send (&cp, &peer, 2, &prun, &key_req);
+
+ // Read the MME.
+ own_data = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_mac_address (&cp, peer.mac);
+
+ msg = cp_msg_mme_read_header (&cp, (u8*)buffer, buffer_len, 0xa, &fmi);
+ cp_msg_mme_read_header_enc (&cp, msg);
+
+ cp_msg_cm_set_key_req_receive (&cp, msg, &key_req);
+ test_begin (test, "Verify")
+ {
+ test_fail_if (key_req.key_type != CP_MSG_KEY_DAK, "Wrong key type");
+ test_fail_if (key_req.cco_cap != CP_CCO_LEVEL, "Wrong CCo level");
+ test_fail_if (key_req.nid != nid, "Wrong NID");
+ test_fail_if (msg->prun.pid != prun.pid, "Wrong PID");
+ test_fail_if (msg->prun.prn != prun.prn, "Wrong PRN");
+ test_fail_if (msg->prun.pmn != prun.pmn, "Wrong PMN");
+ test_fail_if (msg->prun.your_nonce != prun.my_nonce , "Wrong nonce");
+ }
+ test_end;
+
+ slab_release (msg);
+
+ test_case_begin (test, "CM_SET_KEY.CNF");
+
+ cp_sta_own_data_set_mac_address (&cp, own_mac_addr);
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0xA;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDEull;
+
+ prun.pid = 2;
+ prun.pmn = 2;
+ prun.prn = 2;
+ prun.my_nonce = 0x12;
+ prun.your_nonce = 0x13;
+
+ key_cnf.result = CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS;
+ key_cnf.cco_cap = CP_CCO_LEVEL;
+
+ cp_msg_cm_set_key_cnf_send (&cp, &peer, 2, &prun, &key_cnf);
+
+ // Read the MME.
+ cp_sta_own_data_set_mac_address (&cp, peer.mac);
+
+ msg = cp_msg_mme_read_header (&cp, (u8*)buffer, buffer_len, 0xa, &fmi);
+
+ cp_msg_cm_set_key_cnf_receive (&cp, msg, &key_cnf);
+ test_begin (test, "Verify")
+ {
+ test_fail_if (key_cnf.result != CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS,
+ "Wrong result type");
+ test_fail_if (key_cnf.cco_cap != CP_CCO_LEVEL, "Wrong CCo level");
+ test_fail_if (msg->prun.pid != prun.pid, "Wrong PID");
+ test_fail_if (msg->prun.prn != prun.prn, "Wrong PRN");
+ test_fail_if (msg->prun.pmn != prun.pmn, "Wrong PMN");
+ test_fail_if (msg->prun.your_nonce != prun.my_nonce , "Wrong nonce");
+ }
+ test_end;
+
+ slab_release (msg);
+}
+
+void
+test_case_cm_get_key (void)
+{
+ cp_mme_peer_t peer;
+ cp_nid_t nid;
+ cp_secu_protocol_run_t prun;
+ cp_mme_rx_t *msg;
+ uint fmi;
+ cp_sta_own_data_t *own_data;
+ cp_msg_cm_get_key_req_t data;
+ cp_msg_cm_get_key_cnf_t cnf;
+
+ test_case_begin (test, "CM_SET_GET_KEY.REQ");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0xA;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDEull;
+
+ prun.pid = 2;
+ prun.pmn = 2;
+ prun.prn = 2;
+ prun.my_nonce = 0x12;
+ prun.your_nonce = 0x13;
+
+ data.relayed = false;
+ data.key_type = CP_MSG_KEY_DAK;
+ data.nid = nid;
+
+ cp_msg_cm_get_key_req_send (&cp, &peer, 2, &prun, &data);
+
+ // Read the MME.
+ own_data = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_mac_address (&cp, peer.mac);
+
+ msg = cp_msg_mme_read_header (&cp, (u8*)buffer, buffer_len, 0xa, &fmi);
+ cp_msg_mme_read_header_enc (&cp, msg);
+
+ cp_msg_cm_get_key_req_receive (&cp, msg, &data);
+ test_begin (test, "Verify")
+ {
+ test_fail_if (data.relayed != false, "Wrong relayed data");
+ test_fail_if (data.key_type != CP_MSG_KEY_DAK, "Wrong key type");
+ test_fail_if (data.nid != nid, "Wrong NID");
+ test_fail_if (msg->prun.pid != prun.pid, "Wrong PID");
+ test_fail_if (msg->prun.prn != prun.prn, "Wrong PRN");
+ test_fail_if (msg->prun.pmn != prun.pmn, "Wrong PMN");
+ test_fail_if (msg->prun.your_nonce != prun.my_nonce , "Wrong nonce");
+ }
+ test_end;
+
+ slab_release (msg);
+
+ test_case_begin (test, "CM_SET_GET_KEY.CNF");
+
+ peer.mac = 0x23456789ABCDull;
+ peer.vlan_tag = 0x0;
+ peer.tei = 0xA;
+ peer.all_sta = false;
+
+ nid = 0x123456789ABCDEull;
+
+ prun.pid = 2;
+ prun.pmn = 2;
+ prun.prn = 2;
+ prun.my_nonce = 0x12;
+ prun.your_nonce = 0x13;
+
+ cnf.result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
+ cnf.key_type = CP_MSG_KEY_DAK;
+ cnf.nid = nid;
+ cnf.eks = 2;
+ cnf.key.key[0] = 0;
+ cnf.key.key[1] = 1;
+ cnf.key.key[2] = 2;
+ cnf.key.key[3] = 3;
+
+ cp_msg_cm_get_key_cnf_send (&cp, &peer, 2, &prun, &cnf);
+
+ // Read the MME.
+ own_data = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_mac_address (&cp, peer.mac);
+
+ msg = cp_msg_mme_read_header (&cp, (u8*)buffer, buffer_len, 0xa, &fmi);
+ cp_msg_mme_read_header_enc (&cp, msg);
+
+ cp_msg_cm_get_key_cnf_receive (&cp, msg, &cnf);
+ test_begin (test, "Verify")
+ {
+ test_fail_if (cnf.result != CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ "Wrong result data");
+ test_fail_if (cnf.key_type != CP_MSG_KEY_DAK, "Wrong key type");
+ test_fail_if (cnf.nid != nid, "Wrong NID");
+ test_fail_if (cnf.eks != 2, "Wrong EKS");
+ test_fail_if (cnf.key.key[0] != 0, "Wrong Key 0");
+ test_fail_if (cnf.key.key[1] != 1, "Wrong Key 1");
+ test_fail_if (cnf.key.key[2] != 2, "Wrong Key 2");
+ test_fail_if (cnf.key.key[3] != 3, "Wrong Key 3");
+ test_fail_if (msg->prun.pid != prun.pid, "Wrong PID");
+ test_fail_if (msg->prun.prn != prun.prn, "Wrong PRN");
+ test_fail_if (msg->prun.pmn != prun.pmn, "Wrong PMN");
+ test_fail_if (msg->prun.your_nonce != prun.my_nonce , "Wrong nonce");
+ }
+ test_end;
+
+ slab_release (msg);
+}
+
+void
+test_case_cm_get_key_get_pid (void)
+{
+ bitstream_t bitstream;
+ cp_mme_rx_t mme_rx;
+ u8 buffer[1024];
+ u64 data;
+
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ /* ODA. */
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ /* OSA. */
+ data = 0x23456789ABCDull;
+ bitstream_access (&bitstream, &data, 48);
+ /* Mtype. */
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ /* MMV. */
+ data = HPAV_MMV;
+ bitstream_access (&bitstream, &data, 8);
+ /* MMTYPE. */
+ data = CM_GET_KEY_REQ;
+ bitstream_access (&bitstream, &data, 16);
+ /* FMI. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 16);
+ /* Request type. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 8);
+ /* Requested key type. */
+ data = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
+ bitstream_access (&bitstream, &data, 8);
+ /* NID. */
+ data = 0x123456789ABCDEFull;
+ bitstream_access (&bitstream, &data, 56);
+ /* my nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* PID. */
+ data = 0x2;
+ bitstream_access (&bitstream, &data, 8);
+ bitstream_finalise (&bitstream);
+
+ mme_rx.p_mme = buffer;
+ mme_rx.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED;
+
+ test_case_begin (test, "Get PID");
+
+ test_begin (test, "PID = 0x2")
+ {
+ test_fail_if (cp_msg_cm_get_key_req_get_pid (&cp, &mme_rx) != 0x2);
+ }
+ test_end;
+
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ /* ODA. */
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ /* OSA. */
+ data = 0x23456789ABCDull;
+ bitstream_access (&bitstream, &data, 48);
+ /* Mtype. */
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ /* MMV. */
+ data = HPAV_MMV;
+ bitstream_access (&bitstream, &data, 8);
+ /* MMTYPE. */
+ data = CM_GET_KEY_REQ;
+ bitstream_access (&bitstream, &data, 16);
+ /* FMI. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 16);
+ /* Request type. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 8);
+ /* Requested key type. */
+ data = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
+ bitstream_access (&bitstream, &data, 8);
+ /* NID. */
+ data = 0x123456789ABCDEFull;
+ bitstream_access (&bitstream, &data, 56);
+ /* my nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* PID. */
+ data = 0x3;
+ bitstream_access (&bitstream, &data, 8);
+ bitstream_finalise (&bitstream);
+
+ mme_rx.p_mme = buffer;
+ mme_rx.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED;
+
+ test_begin (test, "PID = 0x3")
+ {
+ test_fail_if (cp_msg_cm_get_key_req_get_pid (&cp, &mme_rx) != 0x3);
+ }
+ test_end;
+
+}
+
+void
+test_case_cm_get_key_cnf_get_pid (void)
+{
+ bitstream_t bitstream;
+ cp_mme_rx_t mme_rx;
+ u8 buffer[1024];
+ u64 data;
+
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ /* ODA. */
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ /* OSA. */
+ data = 0x23456789ABCDull;
+ bitstream_access (&bitstream, &data, 48);
+ /* Mtype. */
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ /* MMV. */
+ data = HPAV_MMV;
+ bitstream_access (&bitstream, &data, 8);
+ /* MMTYPE. */
+ data = CM_GET_KEY_CNF;
+ bitstream_access (&bitstream, &data, 16);
+ /* FMI. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 16);
+ /* Result. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 8);
+ /* Requested key type. */
+ data = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
+ bitstream_access (&bitstream, &data, 8);
+ /* my nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* your nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* NID. */
+ data = 0x123456789ABCDEFull;
+ bitstream_access (&bitstream, &data, 56);
+ /* EKS. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 8);
+ /* PID. */
+ data = 0x2;
+ bitstream_access (&bitstream, &data, 8);
+ bitstream_finalise (&bitstream);
+
+ mme_rx.p_mme = buffer;
+ mme_rx.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED;
+
+ test_case_begin (test, "Get PID");
+
+ test_begin (test, "PID = 0x2")
+ {
+ test_fail_if (cp_msg_cm_get_key_cnf_get_pid (&cp, &mme_rx) != 0x2);
+ }
+ test_end;
+
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ /* ODA. */
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ /* OSA. */
+ data = 0x23456789ABCDull;
+ bitstream_access (&bitstream, &data, 48);
+ /* Mtype. */
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ /* MMV. */
+ data = HPAV_MMV;
+ bitstream_access (&bitstream, &data, 8);
+ /* MMTYPE. */
+ data = CM_GET_KEY_CNF;
+ bitstream_access (&bitstream, &data, 16);
+ /* FMI. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 16);
+ /* Result. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 8);
+ /* Requested key type. */
+ data = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED;
+ bitstream_access (&bitstream, &data, 8);
+ /* my nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* your nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* NID. */
+ data = 0x123456789ABCDEFull;
+ bitstream_access (&bitstream, &data, 56);
+ /* EKS. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 8);
+ /* PID. */
+ data = 0x3;
+ bitstream_access (&bitstream, &data, 8);
+ bitstream_finalise (&bitstream);
+
+ mme_rx.p_mme = buffer;
+ mme_rx.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED;
+
+ test_begin (test, "PID = 0x3")
+ {
+ test_fail_if (cp_msg_cm_get_key_cnf_get_pid (&cp, &mme_rx) != 0x3);
+ }
+ test_end;
+}
+
+void
+test_case_cm_set_key_get_pid (void)
+{
+ bitstream_t bitstream;
+ cp_mme_rx_t mme_rx;
+ u8 buffer[1024];
+ u64 data;
+
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ /* ODA. */
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ /* OSA. */
+ data = 0x23456789ABCDull;
+ bitstream_access (&bitstream, &data, 48);
+ /* Mtype. */
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ /* MMV. */
+ data = HPAV_MMV;
+ bitstream_access (&bitstream, &data, 8);
+ /* MMTYPE. */
+ data = CM_GET_KEY_CNF;
+ bitstream_access (&bitstream, &data, 16);
+ /* FMI. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 16);
+ /* Result. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 8);
+ /* my nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* your nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* PID. */
+ data = 0x2;
+ bitstream_access (&bitstream, &data, 8);
+ bitstream_finalise (&bitstream);
+
+ mme_rx.p_mme = buffer;
+ mme_rx.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED;
+
+ test_case_begin (test, "Get PID");
+
+ test_begin (test, "PID = 0x2")
+ {
+ test_fail_if (cp_msg_cm_set_key_get_pid (&cp, &mme_rx) != 0x2);
+ }
+ test_end;
+
+ bitstream_init (&bitstream, buffer, 60, BITSTREAM_WRITE);
+ /* ODA. */
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ /* OSA. */
+ data = 0x23456789ABCDull;
+ bitstream_access (&bitstream, &data, 48);
+ /* Mtype. */
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ /* MMV. */
+ data = HPAV_MMV;
+ bitstream_access (&bitstream, &data, 8);
+ /* MMTYPE. */
+ data = CM_GET_KEY_CNF;
+ bitstream_access (&bitstream, &data, 16);
+ /* FMI. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 16);
+ /* Result. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 8);
+ /* my nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* your nonce. */
+ data = 0x0;
+ bitstream_access (&bitstream, &data, 32);
+ /* PID. */
+ data = 0x3;
+ bitstream_access (&bitstream, &data, 8);
+ bitstream_finalise (&bitstream);
+
+ mme_rx.p_mme = buffer;
+ mme_rx.peks = CP_MME_PEKS_SPC_NOT_EMBEDDED;
+
+ test_begin (test, "PID = 0x3")
+ {
+ test_fail_if (cp_msg_cm_set_key_get_pid (&cp, &mme_rx) != 0x3);
+ }
+ test_end;
+}
+
+int
+main (void)
+{
+ cp_sta_own_data_t *own_data;
+
+ cp.mac_config = &mac_config;
+ test_init (test, 0, NULL);
+
+ own_data = cp_sta_mgr_get_sta_own_data (&cp);
+ cp_sta_own_data_set_tei (&cp, 0xA);
+ cp_sta_own_data_set_mac_address (&cp, own_mac_addr);
+ cp_sta_mgr_update_our_avln_nid (&cp, 0x123456789ABCDEFull);
+ cp_sta_mgr_update_our_avln_snid (&cp, 0x2);
+
+ lib_rnd_init (&cp.rnd, 0x12345678);
+
+ test_case_cm_set_key ();
+ test_case_cm_get_key ();
+ test_case_cm_get_key_get_pid ();
+ test_case_cm_get_key_cnf_get_pid ();
+ test_case_cm_set_key_get_pid ();
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+u8 *
+cp_cl_interf_get_buffer_tx (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return buffer;
+}
+
+void
+cp_cl_interf_add_buffer_tx (cp_t *ctx, u8 * buffer)
+{
+}
+
+/**
+ * Send a MME over the PWL or the HLE.
+ * \param ctx the module context.
+ * \param mme The MME to send.
+ *
+ */
+void
+cp_cl_interf_mme_send (cp_t *ctx, cp_mme_tx_t * mme)
+{
+ buffer_len = mme->length;
+ mme->p_mme = NULL;
+}
diff --git a/cesar/cp/msg/test/src/sta_mgr_stub.c b/cesar/cp/msg/test/src/sta_mgr_stub.c
new file mode 100644
index 0000000000..565e827c92
--- /dev/null
+++ b/cesar/cp/msg/test/src/sta_mgr_stub.c
@@ -0,0 +1,67 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/sta_mgr_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/sta/mgr/sta_own_data.h"
+#include "cp/sta/mgr/inc/sta_own_data.h"
+
+static cp_sta_own_data_private_t own;
+
+/**
+ * Returns a reference on our own station data.
+ * \param ctx the module context.
+ * \return A reference on the sta own data. Do not release It it not a block.
+ */
+cp_sta_own_data_t *
+cp_sta_mgr_get_sta_own_data (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return (cp_sta_own_data_t *) &own;
+}
+
+/**
+ * Get the station mac address.
+ * \param ctx the module context.
+ * \return Get the station Mac address.
+ *
+ */
+mac_t
+cp_sta_own_data_get_mac_address (cp_sta_own_data_t *ctx)
+{
+ dbg_assert (ctx);
+ return ((cp_sta_own_data_private_t *) ctx)->mac_addr;
+}
+
+/**
+ * Set the station Mac address.
+ * \param ctx the module context.
+ * \param mac_addr The Mac address of the station.
+ * \param cp The control plane context.
+ *
+ */
+void
+cp_sta_own_data_set_mac_address (cp_sta_own_data_t *ctx,
+ mac_t mac_addr, cp_t * cp)
+{
+ dbg_assert (ctx);
+ ((cp_sta_own_data_private_t *) ctx)->mac_addr = mac_addr;
+}
+
+cp_tei_t
+cp_sta_own_data_get_tei (cp_sta_own_data_t *ctx)
+{
+ return 0xA;
+}
diff --git a/cesar/cp/msg/test/src/test-msg-read-header.c b/cesar/cp/msg/test/src/test-msg-read-header.c
new file mode 100644
index 0000000000..c396113545
--- /dev/null
+++ b/cesar/cp/msg/test/src/test-msg-read-header.c
@@ -0,0 +1,184 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test/src/test-msg.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * http://pessac/cesar/trac/wiki/UT-CPM1-MSG-MSG
+ */
+#include "common/std.h"
+#include "common/defs/homeplugAV.h"
+
+#include "lib/bitstream.h"
+#include "lib/test.h"
+#include "lib/swap.h"
+
+#include "cp/cp.h"
+#include "cp/msg/msg.h"
+
+#include "cp/inc/context.h"
+
+/**
+ * Test the msg_read header function with a MME containing a VLAN Tag.
+ * \param test the test object.
+ */
+void
+test_case_msg_read_header_mme_without_vlan (test_t test)
+{
+ cp_t cp;
+ bitstream_t bitstream;
+ u8 buffer[256] __attribute__((aligned(256)));
+ uint fmi;
+ cp_mme_rx_t *mme;
+
+ u64 data;
+
+ cp_msg_init (&cp);
+
+ test_case_begin (test, "TEST 1");
+
+ bitstream_init (&bitstream, buffer, 23, BITSTREAM_WRITE);
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x3456789ABCDEull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x12;
+ bitstream_access (&bitstream, &data, 32);
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ data = 1;
+ bitstream_access (&bitstream, &data, 8);
+ data = 0x3245;
+ bitstream_access (&bitstream, &data, 16);
+ data = 0x432;
+ bitstream_access (&bitstream, &data, 16);
+ bitstream_finalise (&bitstream);
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 92, 0x1, &fmi);
+
+ test_begin (test, "Read a MME with vlan")
+ {
+ test_fail_if (mme->p_mme != buffer, "Wrong buffer address");
+ test_fail_if (mme->length != 92, "Wrong length");
+ test_fail_if (mme->mmtype != 0x3245, "Wrong MMTYPE");
+ test_fail_if (mme->peer.mac != 0x3456789ABCDEull,
+ "Wrong mac address");
+ test_fail_if (mme->peer.tei != 1, "wrong TEI");
+ test_fail_if (mme->peer.vlan_tag != 0x12, "Wrong VLAN tag");
+ test_fail_if (mme->peer.all_sta != false, "all_sta shall be false");
+ test_fail_if (fmi != 0x432, "wrong FMI value");
+ }
+ test_end;
+ slab_release (mme);
+
+ test_case_begin (test, "TEST 2");
+
+ bitstream_init (&bitstream, buffer, 19, BITSTREAM_WRITE);
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x3456789ABCDEull;
+ bitstream_access (&bitstream, &data, 48);
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ data = 1;
+ bitstream_access (&bitstream, &data, 8);
+ data = 0x3245;
+ bitstream_access (&bitstream, &data, 16);
+ data = 0x432;
+ bitstream_access (&bitstream, &data, 16);
+ bitstream_finalise (&bitstream);
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 92, 0x1, &fmi);
+
+ test_begin (test, "Read a MME without vlan")
+ {
+ test_fail_if (mme->p_mme != buffer, "Wrong buffer address");
+ test_fail_if (mme->length != 92, "Wrong length");
+ test_fail_if (mme->mmtype != 0x3245, "Wrong MMTYPE");
+ test_fail_if (mme->peer.mac != 0x3456789ABCDEull,
+ "Wrong mac address");
+ test_fail_if (mme->peer.tei != 1, "wrong TEI");
+ test_fail_if (mme->peer.vlan_tag != 0, "Wrong VLAN tag");
+ test_fail_if (mme->peer.all_sta != false, "all_sta shall be false");
+ test_fail_if (fmi != 0x432, "wrong FMI value");
+ }
+ test_end;
+ slab_release (mme);
+
+ test_case_begin (test, "TEST 3");
+
+ bitstream_init (&bitstream, buffer, 23, BITSTREAM_WRITE);
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x3456789ABCDEull;
+ bitstream_access (&bitstream, &data, 48);
+ data = swap16(HPAV_MTYPE_MME);
+ bitstream_access (&bitstream, &data, 16);
+ data = 0;
+ bitstream_access (&bitstream, &data, 8);
+ data = 0x3245;
+ bitstream_access (&bitstream, &data, 16);
+ data = 0x432;
+ bitstream_access (&bitstream, &data, 16);
+ bitstream_finalise (&bitstream);
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 92, 0x1, &fmi);
+
+ test_begin (test, "Read a MME without vlan")
+ {
+ test_fail_if (mme != NULL, "Shall be null");
+ }
+ test_end;
+
+ test_case_begin (test, "TEST 4");
+
+ bitstream_init (&bitstream, buffer, 23, BITSTREAM_WRITE);
+ data = 0x123456789ABCull;
+ bitstream_access (&bitstream, &data, 48);
+ data = 0x3456789ABCDEull;
+ bitstream_access (&bitstream, &data, 48);
+ data = swap16(HPAV_MTYPE_MME + 1);
+ bitstream_access (&bitstream, &data, 16);
+ data = 1;
+ bitstream_access (&bitstream, &data, 8);
+ data = 0x3245;
+ bitstream_access (&bitstream, &data, 16);
+ data = 0x432;
+ bitstream_access (&bitstream, &data, 16);
+ bitstream_finalise (&bitstream);
+
+ mme = cp_msg_mme_read_header (&cp, buffer, 92, 0x1, &fmi);
+
+ test_begin (test, "Read a MME without vlan")
+ {
+ test_fail_if (mme != NULL, "Shall be null");
+ }
+ test_end;
+
+ cp_msg_uninit (&cp);
+}
+
+int
+main (void)
+{
+ test_t test;
+ test_init (test, 0, NULL);
+
+ test_case_msg_read_header_mme_without_vlan (test);
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/pwl/Module b/cesar/cp/pwl/Module
new file mode 100644
index 0000000000..ba76fba637
--- /dev/null
+++ b/cesar/cp/pwl/Module
@@ -0,0 +1 @@
+SOURCES := pwl.c
diff --git a/cesar/cp/pwl/doc/pwl.xmi b/cesar/cp/pwl/doc/pwl.xmi
new file mode 100644
index 0000000000..390ce7fa71
--- /dev/null
+++ b/cesar/cp/pwl/doc/pwl.xmi
@@ -0,0 +1,168 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-06-05T18:04:31" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="R9NuP1byDcOU" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eVuCjs6naR38" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="cnaRv3q3OkSQ" isRoot="false" isAbstract="false" name="boolean" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="KOdwl5INaBZH" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3f3c56khsI8l" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="MyoigH80dkxO" isRoot="false" isAbstract="false" name="byte" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nFjMOIdSwg41" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="lmib4oMOmB7Q" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QDR1xMOjZ75y" isRoot="false" isAbstract="false" name="String" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QTe9foTn6zxN" isRoot="false" isAbstract="false" name="cp_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5YxBXuZ7VHyB" isRoot="false" isAbstract="false" name="cp_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5glhki3mRQDR" isRoot="false" isAbstract="false" name="cp_beacon_timer_cb_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="7547YRlBRwzb" isRoot="false" isAbstract="false" name="uint" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="I0eaYmyLKAKE" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="62wfeFJgUCx2" isRoot="false" isAbstract="false" name="uint *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oNKBdmiCuZhc" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="R35vatyKHxmx" isRoot="false" isAbstract="false" name="const cp_pwl_frequency_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="VXzmSlhtub53" isRoot="false" isAbstract="false" name="const cp_pwl_bp_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="IXkqA11FmD70" isRoot="false" isAbstract="false" name="const uint" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class comment="Power line module. Contains all the data concerning the PWL state." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="5LjCZQQXZ0ip" isRoot="false" isAbstract="false" name="cp_pwl_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Inform on the frequency of the PWL. Only two values are possible the 50 and 60 Hz." isSpecification="false" visibility="public" xmi.id="Wi5Stcc00hzo" type="R35vatyKHxmx" name="frequency" />
+ <UML:Attribute comment="Beacon period static value. This value never change it corresponds to the value theoretical of the beacon period. (1 000 000 ticks for the 50 Hz and 833 333 ticks for the 60Hz)" isSpecification="false" visibility="public" xmi.id="xwMpEO1Q799d" type="VXzmSlhtub53" name="bp_ntb" />
+ <UML:Attribute comment="The zero cross theoretical value of the beacon period. Based on the frequency detection. It corresponds to a quarter of the bp_ntb value." isSpecification="false" visibility="public" xmi.id="cBdvg0Tpf0c5" type="IXkqA11FmD70" name="zc_ntb" />
+ <UML:Attribute comment="The value computed once the ACL frequency is done to know how many beacon periods it has in 10 seconds." isSpecification="false" visibility="public" xmi.id="Jwz9anfjNuT8" type="IXkqA11FmD70" name="discover_period_max_bp" />
+ <UML:Attribute comment="The previous, current and next values of the beacon period in the AVLN computed by the CCo.
+This value will be update at each beacon period by the beacon module.
+It contains the data in NTB of the previous, current and next beacon period.
+For example, 1 000 000; 2 000 000; 3 000 000" isSpecification="false" visibility="public" xmi.id="1OKgN4fDyJIz" type="7547YRlBRwzb" name="bp_avln_ntb [3]" />
+ <UML:Attribute comment="Current beacon period value of the PWL. Use to estimate the beacon period." isSpecification="false" visibility="public" xmi.id="EvTXszMDvNnh" type="7547YRlBRwzb" name="per_ntb" />
+ <UML:Attribute comment="The next four beacon period offset values." isSpecification="false" visibility="public" xmi.id="80EJub6ZN7Wa" type="7547YRlBRwzb" name="bto[4]" />
+ <UML:Attribute comment="Values of the PRATIC register." isSpecification="false" visibility="public" xmi.id="FL81XPj4WdMF" type="7547YRlBRwzb" name="date_ntb [2]" />
+ <UML:Operation comment="Initialise the pwl module." isSpecification="false" isLeaf="false" visibility="public" xmi.id="af2BxXUIQSye" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Compute the frequency of the power line using the pratic register.
+It shall read the pratic register twice with a gap of 20 ms.
+This function shall update the data in the object.
+If the medium is a coaxial cable, the 50Hz will be chosen." isSpecification="false" isLeaf="false" visibility="public" xmi.id="rh89Xuuhl3sT" isRoot="false" isAbstract="false" isQuery="false" name="acl_frequency_detection" />
+ <UML:Operation comment="Estimate the current beacon period." isSpecification="false" isLeaf="false" visibility="public" xmi.id="o1xEYo2wBJTd" isRoot="false" isAbstract="false" isQuery="false" name="estimate_beacon_period" />
+ <UML:Operation comment="Uninitialise the PWL module." isSpecification="false" isLeaf="false" visibility="public" xmi.id="gEdYSU3Z5YpE" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Vd2VI0H78FNa" isRoot="false" isAbstract="false" name="cp_pwl_frequency_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="Vd2VI0H78FNa" xmi.id="o1VyuW0O91rP" isRoot="false" isAbstract="false" name="CP_PWL_FREQ_60" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="Vd2VI0H78FNa" xmi.id="WsUNEfH2emyZ" isRoot="false" isAbstract="false" name="CP_PWL_FREQ_50" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" comment="Values possible for the theorical values of the beacon period in ntb ticks." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="WynxBsM8ngv1" isRoot="false" isAbstract="false" name="cp_pwl_bp_t" >
+ <UML:EnumerationLiteral comment="1 000 000 ticks." isSpecification="false" isLeaf="false" visibility="public" namespace="WynxBsM8ngv1" xmi.id="Q2E40q7VmuSv" isRoot="false" isAbstract="false" name="CP_PWL_BP_50" />
+ <UML:EnumerationLiteral comment="833 333 ticks." isSpecification="false" isLeaf="false" visibility="public" namespace="WynxBsM8ngv1" xmi.id="aTaIt9hH9vJA" isRoot="false" isAbstract="false" name="CP_PWL_BP_60" />
+ </UML:Enumeration>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="47rF58Y2yD87" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="Vewx9rt8UrO2" aggregation="none" type="I0eaYmyLKAKE" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="7NH3KXmEauVx" aggregation="none" type="5LjCZQQXZ0ip" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="973" snapy="10" showatts="1" xmi.id="u4iNIXCkUpAT" documentation="" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="844" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="259" showattsigs="601" x="142" fillcolor="#ffffc0" y="266" showopsigs="601" linewidth="none" height="208" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="5LjCZQQXZ0ip" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="140" x="125" fillcolor="#ffffc0" y="96" linewidth="none" height="64" usefillcolor="1" isinstance="0" xmi.id="Vd2VI0H78FNa" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <enumwidget usesdiagramfillcolor="0" width="101" x="325" fillcolor="#ffffc0" y="100" linewidth="none" height="64" usefillcolor="1" isinstance="0" xmi.id="WynxBsM8ngv1" showpackage="0" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="u4iNIXCkUpAT" documentation="" uniqueid="Jwz9anfjNuT8" />
+ <listview>
+ <listitem open="1" type="800" label="Vues" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="807" id="u4iNIXCkUpAT" label="diagramme de classes" />
+ <listitem open="1" type="813" id="5LjCZQQXZ0ip" >
+ <listitem open="0" type="814" id="Wi5Stcc00hzo" />
+ <listitem open="0" type="814" id="xwMpEO1Q799d" />
+ <listitem open="0" type="814" id="cBdvg0Tpf0c5" />
+ <listitem open="0" type="814" id="Jwz9anfjNuT8" />
+ <listitem open="0" type="814" id="1OKgN4fDyJIz" />
+ <listitem open="0" type="814" id="EvTXszMDvNnh" />
+ <listitem open="0" type="814" id="80EJub6ZN7Wa" />
+ <listitem open="0" type="814" id="FL81XPj4WdMF" />
+ <listitem open="0" type="815" id="af2BxXUIQSye" />
+ <listitem open="0" type="815" id="rh89Xuuhl3sT" />
+ <listitem open="0" type="815" id="o1xEYo2wBJTd" />
+ <listitem open="0" type="815" id="gEdYSU3Z5YpE" />
+ </listitem>
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="QDR1xMOjZ75y" />
+ <listitem open="1" type="829" id="cnaRv3q3OkSQ" />
+ <listitem open="1" type="829" id="MyoigH80dkxO" />
+ <listitem open="1" type="829" id="eVuCjs6naR38" />
+ <listitem open="1" type="829" id="VXzmSlhtub53" />
+ <listitem open="1" type="829" id="R35vatyKHxmx" />
+ <listitem open="1" type="829" id="IXkqA11FmD70" />
+ <listitem open="1" type="829" id="5glhki3mRQDR" />
+ <listitem open="1" type="829" id="QTe9foTn6zxN" />
+ <listitem open="1" type="829" id="5YxBXuZ7VHyB" />
+ <listitem open="1" type="829" id="3f3c56khsI8l" />
+ <listitem open="1" type="829" id="KOdwl5INaBZH" />
+ <listitem open="1" type="829" id="R9NuP1byDcOU" />
+ <listitem open="1" type="829" id="lmib4oMOmB7Q" />
+ <listitem open="1" type="829" id="nFjMOIdSwg41" />
+ <listitem open="1" type="829" id="oNKBdmiCuZhc" />
+ <listitem open="1" type="829" id="7547YRlBRwzb" />
+ <listitem open="1" type="829" id="62wfeFJgUCx2" />
+ <listitem open="0" type="829" id="I0eaYmyLKAKE" />
+ </listitem>
+ <listitem open="0" type="831" id="WynxBsM8ngv1" >
+ <listitem open="0" type="839" id="Q2E40q7VmuSv" />
+ <listitem open="0" type="839" id="aTaIt9hH9vJA" />
+ </listitem>
+ <listitem open="0" type="831" id="Vd2VI0H78FNa" >
+ <listitem open="0" type="839" id="o1VyuW0O91rP" />
+ <listitem open="0" type="839" id="WsUNEfH2emyZ" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" />
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/pwl/doc/scilab/Makefile b/cesar/cp/pwl/doc/scilab/Makefile
new file mode 100644
index 0000000000..7c4e211550
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/Makefile
@@ -0,0 +1,15 @@
+PAGES= estimate_acl_freq_decrease estimate_acl_freq_increase estimate_acl_stable
+
+all: $(PAGES)
+
+%: %.sce
+ if [ ! -d res ]; then mkdir res; fi;
+ cp $< myfile.sce
+ echo "exit" >> myfile.sce
+ scilab -f myfile.sce
+ rm myfile.sce
+ mv *.csv res
+ mv *.h res
+
+clean:
+ rm -rf res
diff --git a/cesar/cp/pwl/doc/scilab/convertc.sce b/cesar/cp/pwl/doc/scilab/convertc.sce
new file mode 100644
index 0000000000..3d60d70ed9
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/convertc.sce
@@ -0,0 +1,41 @@
+// SPiDCOM Technologies.
+// Nélio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+// Convert an array of values to a C array.
+
+// @param file_name the file name to write the data in. The file shall be a
+// c file.
+// @param array_name the array name.
+// @param array the array to write.
+function convertc_array (file_name, array_name, array)
+
+nb_points = length(array);
+index = strindex(file_name, ".");
+
+if index < length(file_name)
+ define_name = part(file_name, [1:index-1]) + "_" + array_name;
+else
+ define_name = file_name + "_" + array_name;
+end
+
+// Provide an array for the C unit test.
+result_file = file ('open', file_name, 'unknown');
+ fprintf (result_file, "#ifndef %s", define_name);
+ fprintf (result_file, "#define %s", define_name);
+ fprintf (result_file, "/* File generated by scilab */");
+ fprintf (result_file, "");
+ fprintf (result_file, "uint %s [%d] = {", array_name, nb_points);
+ for i = 1:nb_points - 1
+ fprintf (result_file, " %d, ", array(i));
+ end
+
+// Write the last value.
+fprintf (result_file, "%d };", array(nb_points));
+fprintf (result_file, "uint %s = %d;", array_name + '_length', nb_points);
+
+fprintf (result_file, "#endif /* %s */", define_name);
+file ('close', result_file);
+
+endfunction
diff --git a/cesar/cp/pwl/doc/scilab/estimate_acl_freq_decrease.sce b/cesar/cp/pwl/doc/scilab/estimate_acl_freq_decrease.sce
new file mode 100644
index 0000000000..fd0b0d0ed5
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/estimate_acl_freq_decrease.sce
@@ -0,0 +1,50 @@
+// SPiDCOM Technologies.
+// Nélio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+// Launch a test to verify the estimation function.
+
+// load the file, containing the function to generate a stable 50hz zero
+// cross.
+getf ('src/zc_capture_decrease.sce');
+getf ('src/estimateBP.sce');
+
+// C array writer
+getf('convertc.sce');
+
+// Initialise the environment.
+date_ntb = zeros(1,2);
+// 50 Hz in ticks.
+bp_ntb = 1e6;
+zc_ntb = bp_ntb / 4;
+
+nb_points = 1e3;
+
+cp = [date_ntb, bp_ntb, zc_ntb, 0];
+
+//Vector of points.
+result = zeros(nb_points,length(cp) + 1);
+for i = 1:1000
+ cp = cp_pwl_estimate_beacon_period (cp);
+
+ result (i,:) = [cp, cp(1) - cp(2)];
+ bp_ntb = cp(3) + 1e6;
+end
+
+// Write the result in a file.
+result_file = file('open', 'result_decrease.csv', 'unknown');
+fprintf (result_file, "Per, Per(ATU), Zc 1, Zc 2, Diff\n");
+for i = 1:nb_points
+ fprintf (result_file, "%d, %d, %d, %d, %d\n", result(i,5), int(result(i,5) / 256), result(i,1), result(i,2), result(i,6));
+end
+// Close the file.
+file('close', result_file);
+
+// Write the array.
+res = result(:,1);
+convertc_array ('table_decrease.h', 'ac_decrease', res);
+
+// Write the result of the simulation.
+res = result (:,5);
+convertc_array ('result_decrease.h', 'result_ac_decrease', res);
diff --git a/cesar/cp/pwl/doc/scilab/estimate_acl_freq_increase.sce b/cesar/cp/pwl/doc/scilab/estimate_acl_freq_increase.sce
new file mode 100644
index 0000000000..4539a5a90b
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/estimate_acl_freq_increase.sce
@@ -0,0 +1,54 @@
+// SPiDCOM Technologies.
+// Nélio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+// Launch a test to verify the estimation function.
+
+// load the file, containing the function to generate a stable 50hz zero
+// cross.
+getf ('src/zc_capture_increase.sce');
+getf ('src/estimateBP.sce');
+
+// C array writer
+getf('convertc.sce');
+
+// Initialise the environment.
+date_ntb = zeros (1,2);
+// 50 Hz in ticks.
+bp_ntb = 1e6;
+zc_ntb = bp_ntb / 4;
+
+// Number of points.
+nb_points = 1000;
+
+
+cp = [date_ntb, bp_ntb, zc_ntb, 0];
+
+//Vector of points.
+result = zeros(nb_points,length(cp) + 1);
+
+for i = 1:nb_points
+ cp = cp_pwl_estimate_beacon_period (cp);
+
+ result (i,:) = [cp, cp(1) - cp(2)];
+ bp_ntb = cp(3) + 1e6;
+end
+
+// Write the result in a file.
+result_file = file('open', 'result_increase.csv', 'unknown');
+
+fprintf (result_file, "Per, Per(ATU), Zc 1, Zc 2, diff\n");
+for i = 1:nb_points
+ fprintf (result_file, "%d, %d, %d, %d, %d\n", result(i,5), int(result(i,5) / 256), result(i,1), result(i,2), result(i,6));
+end
+// Close the file.
+file('close', result_file);
+
+// Write the array.
+res = result(:,1);
+convertc_array ('table_increase.h', 'ac_increase', res);
+
+// Write the result of the simulation.
+res = result (:,5);
+convertc_array ('result_increase.h', 'result_ac_increase', res);
diff --git a/cesar/cp/pwl/doc/scilab/estimate_acl_stable.sce b/cesar/cp/pwl/doc/scilab/estimate_acl_stable.sce
new file mode 100644
index 0000000000..f8996ff594
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/estimate_acl_stable.sce
@@ -0,0 +1,52 @@
+// SPiDCOM Technologies.
+// Nélio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+// Launch a test to verify the estimation function.
+
+// load the file, containing the function to generate a stable 50hz zero
+// cross.
+getf ('src/zc_capture.sce');
+getf ('src/estimateBP.sce');
+
+// C array writer
+getf('convertc.sce');
+
+// Initialise the environment.
+date_ntb = zeros (1,2);
+// 50 Hz in ticks.
+bp_ntb = 1e6;
+zc_ntb = bp_ntb / 4;
+
+// Number of points.
+nb_points = 1e3;
+
+cp = [date_ntb, bp_ntb, zc_ntb, 0];
+
+//Vector of points.
+result = zeros(nb_points,length(cp) + 1);
+
+for i = 1:nb_points
+ cp = cp_pwl_estimate_beacon_period (cp);
+
+ result (i,:) = [cp, cp(1) - cp(2)];
+ bp_ntb = cp(3) + 1e6;
+end
+
+// Write the result in a file.
+result_file = file('open', 'result_stable.csv', 'unknown');
+fprintf (result_file, "Per, Per(ATU), Zc 1, Zc 2, diff\n");
+for i = 1:nb_points
+ fprintf (result_file, "%d, %d, %d, %d, %d\n", result(i,5), int(result(i,5) / 256), result(i,1), result(i,2), result(6));
+end
+// Close the file.
+file('close', result_file);
+
+// Write the array.
+res = result(:,1);
+convertc_array ('table.h', 'ac_stable', res);
+
+// Write the result of the simulation.
+res = result (:,5);
+convertc_array ('result_stable.h', 'result_ac_stable', res);
diff --git a/cesar/cp/pwl/doc/scilab/src/estimateBP.sce b/cesar/cp/pwl/doc/scilab/src/estimateBP.sce
new file mode 100644
index 0000000000..3a87e42c6b
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/src/estimateBP.sce
@@ -0,0 +1,34 @@
+// SPiDCOM Technologies.
+// Nélio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+//Estimate the beacon period using the synchronisation of the PWL.
+//This shall use a function to generate the ACL frequency.
+
+// The function phy_clock_get_zero_cross_captured_date shall be written in
+// function of the test which is being done.
+// WARN : Import the file containing the function before using this script.
+
+// compute the estimation of the ACL period.
+// @param cp the CP context.
+// - date_ntb[2]
+// - bp_ntb
+// - zc_ntb
+// - per_ntb
+// @return the [per, date_ntb']
+function [res] = cp_pwl_estimate_beacon_period (cp)
+
+date_ntb = [cp(1) ,cp(2)];
+bp_ntb = cp(3);
+zc_ntb = cp(4);
+
+date_ntb(2) = date_ntb(1);
+date_ntb(1) = phy_clock_get_zero_cross_captured_date (date_ntb(2));
+diff_ntb = modulo((date_ntb(1) - date_ntb(2)), bp_ntb + 10000);
+per_ntb = (4-int((diff_ntb / zc_ntb))) * zc_ntb + diff_ntb;
+
+res = [date_ntb, bp_ntb, zc_ntb, per_ntb];
+return res;
+
+endfunction
diff --git a/cesar/cp/pwl/doc/scilab/src/zc_capture.sce b/cesar/cp/pwl/doc/scilab/src/zc_capture.sce
new file mode 100644
index 0000000000..ba46a463ec
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/src/zc_capture.sce
@@ -0,0 +1,19 @@
+// SPiDCOM Technologies.
+// Nélio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+// This script will provide a function to generate a perfect 50 Hz frequency
+// AC Line based on the NTB date.
+
+
+// Function to simulate the frequency of the AC line.
+// @param phy the previous value provided.
+// @Return phy + 250 000
+function phy = phy_clock_get_zero_cross_captured_date(phy)
+
+phy = phy + 1000000;
+return phy;
+
+endfunction
+
diff --git a/cesar/cp/pwl/doc/scilab/src/zc_capture_decrease.sce b/cesar/cp/pwl/doc/scilab/src/zc_capture_decrease.sce
new file mode 100644
index 0000000000..2009ebeb72
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/src/zc_capture_decrease.sce
@@ -0,0 +1,21 @@
+// SPiDCOM Technologies.
+// Nélio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+// This script will provide a function to generate a 50 Hz frequency
+// AC Line based on the NTB date with a little jitter.
+
+
+// Function to simulate the frequency of the AC line.
+// @param phy the previous value provided.
+// @param var The variation of frequency.
+// @Return phy + 250 000
+function phy = phy_clock_get_zero_cross_captured_date(phy)
+
+var = int(rand (1) * 100000);
+phy = phy + 1000000 - var;
+return phy;
+
+endfunction
+
diff --git a/cesar/cp/pwl/doc/scilab/src/zc_capture_increase.sce b/cesar/cp/pwl/doc/scilab/src/zc_capture_increase.sce
new file mode 100644
index 0000000000..2afdd497cd
--- /dev/null
+++ b/cesar/cp/pwl/doc/scilab/src/zc_capture_increase.sce
@@ -0,0 +1,21 @@
+// SPiDCOM Technologies.
+// Nélio Laranjeiro
+// 16-05-2008
+// Cesar project.
+
+// This script will provide a function to generate a 50 Hz frequency
+// AC Line based on the NTB date with a little jitter.
+
+
+// Function to simulate the frequency of the AC line.
+// @param phy the previous value provided.
+// @param var The variation of frequency.
+// @Return phy + 250 000
+function phy = phy_clock_get_zero_cross_captured_date(phy)
+
+var = int(rand (1) * 1000);
+phy = phy + 1e6 + var;
+return phy;
+
+endfunction
+
diff --git a/cesar/cp/pwl/doc/spec.odt b/cesar/cp/pwl/doc/spec.odt
new file mode 100644
index 0000000000..24b6b82028
--- /dev/null
+++ b/cesar/cp/pwl/doc/spec.odt
Binary files differ
diff --git a/cesar/cp/pwl/doc/study.odt b/cesar/cp/pwl/doc/study.odt
new file mode 100644
index 0000000000..52c04a05d1
--- /dev/null
+++ b/cesar/cp/pwl/doc/study.odt
Binary files differ
diff --git a/cesar/cp/pwl/pwl.h b/cesar/cp/pwl/pwl.h
new file mode 100644
index 0000000000..753c2708fa
--- /dev/null
+++ b/cesar/cp/pwl/pwl.h
@@ -0,0 +1,136 @@
+#ifndef cp_pwl_h
+#define cp_pwl_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/pwl/pwl.h
+ * \brief The powerline state.
+ * \ingroup cp_pwl
+ *
+ */
+
+/** Frequency possibility. */
+enum cp_pwl_frequency_t
+{
+ CP_PWL_FREQ_50,
+ CP_PWL_FREQ_60
+};
+typedef enum cp_pwl_frequency_t cp_pwl_frequency_t;
+
+/** Conversion of the frequency to ticks. */
+enum cp_pwl_bp_t
+{
+ CP_PWL_BP_50 = 1000000,
+ CP_PWL_BP_60 = 833333
+};
+typedef enum cp_pwl_bp_t cp_pwl_bp_t;
+
+/** Zero cross values. */
+enum cp_pwl_zc_t
+{
+ CP_PWL_ZC_50 = (CP_PWL_BP_50 / 4),
+ CP_PWL_ZC_60 = (CP_PWL_BP_60 / 4)
+};
+typedef enum cp_pwl_zc_t cp_pwl_zc_t;
+
+/**
+ * Power line module. Contains all the data concerning the PWL state.
+ */
+struct cp_pwl_t
+{
+ /**
+ * Inform on the frequency of the PWL. Only two values are possible
+ * the 50 and 60 Hz.
+ */
+ const cp_pwl_frequency_t frequency;
+
+ /**
+ * Beacon period static value. This value never change it corresponds
+ * to the value theoretical of the beacon period. (1 000 000 ticks
+ * for the 50 Hz and 833 333 ticks for the 60Hz)
+ */
+ const cp_pwl_bp_t bp_ntb;
+
+ /**
+ * The zero cross theoretical value of the beacon period. Based on
+ * the frequency detection. It corresponds to a quarter of the bp_ntb
+ * value.
+ */
+ const uint zc_ntb;
+
+ /**
+ * The value computed once the ACL frequency is done to know how many
+ * beacon periods it has in 10 seconds.
+ */
+ const uint discover_period_max_bp;
+
+ /**
+ * The previous, current and next values of the beacon period in the
+ * AVLN computed by the CCo.
+ * This value will be update at each beacon period by the beacon module.
+ * It contains the data in NTB of the previous, current and next beacon
+ * period. For example, 1 000 000; 2 000 000; 3 000 000
+ */
+ uint bp_avln_ntb [3];
+
+ /**
+ * Current beacon period value of the PWL. Use to estimate the beacon
+ * period.
+ */
+ uint per_ntb;
+
+ /**
+ * The next four beacon period offset values.
+ */
+ uint bto[4];
+
+ /**
+ * Values of the PRATIC register.
+ */
+ uint date_ntb [2];
+};
+typedef struct cp_pwl_t cp_pwl_t;
+
+/**
+ * Initialise the pwl module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_init (cp_t *ctx);
+
+/**
+ * Compute the frequency of the power line using the pratic register.
+ * \param ctx the module context.
+ *
+ * It shall read the pratic register twice with a gap of 20 ms. This
+ * function shall update the data in the object. If the medium is a coaxial
+ * cable, the 50Hz will be chosen
+ *
+ * \warn Only call this function in a Thread.
+ */
+void
+cp_pwl_acl_frequency_detection (cp_t *ctx);
+
+/**
+ * Estimate the current beacon period.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_estimate_beacon_period (cp_t *ctx);
+
+/**
+ * Uninitialise the PWL module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_uninit (cp_t *ctx);
+
+#endif /* cp_pwl_h */
diff --git a/cesar/cp/pwl/src/pwl.c b/cesar/cp/pwl/src/pwl.c
new file mode 100644
index 0000000000..c4c11fc526
--- /dev/null
+++ b/cesar/cp/pwl/src/pwl.c
@@ -0,0 +1,117 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/pwl/src/pwl.c
+ * \brief Power Line module.
+ * \ingroup cp_pwl
+ *
+ * The Power line module is responsible to keep the station synchronized with
+ * the AC Line Power Line.
+ */
+#include "common/std.h"
+#include "string.h"
+
+/* Timings, for the macro MAC_MS_TO_TCK*/
+#include "mac/common/timings.h"
+
+#include "cp/cp.h"
+#include "cp/pwl/pwl.h"
+
+#include "cp/inc/context.h"
+
+/**
+ * Initialise the pwl module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset (&ctx->pwl, 0, sizeof (cp_pwl_t));
+}
+
+/**
+ * Compute the frequency of the power line using the pratic register.
+ * \param ctx the module context.
+ *
+ * It shall read the pratic register twice with a gap of 20 ms. This
+ * function shall update the data in the object. If the medium is a coaxial
+ * cable, the 50Hz will be chosen
+ *
+ * \warn Only call this function in a Thread.
+ */
+void
+cp_pwl_acl_frequency_detection (cp_t *ctx)
+{
+ uint bp_width_ntb;
+
+ dbg_assert (ctx);
+ dbg_assert (ctx->phy);
+
+ ctx->pwl.date_ntb[1] = phy_clock_get_zero_cross_captured_date(ctx->phy);
+
+ cyg_thread_delay (2);
+ ctx->pwl.date_ntb[0] = phy_clock_get_zero_cross_captured_date(ctx->phy);
+
+ // compute the becon period.
+ bp_width_ntb = (ctx->pwl.date_ntb[0] - ctx->pwl.date_ntb[1] + 5000)
+ % CP_PWL_ZC_50;
+
+ if (bp_width_ntb > 6000)
+ {
+ *((cp_pwl_frequency_t*) &ctx->pwl.frequency) = CP_PWL_FREQ_60;
+ *((cp_pwl_bp_t*) &ctx->pwl.bp_ntb) = CP_PWL_BP_60;
+ *((uint*) &ctx->pwl.zc_ntb) = CP_PWL_ZC_60;
+ }
+ else
+ {
+ *((cp_pwl_frequency_t*) &ctx->pwl.frequency) = CP_PWL_FREQ_50;
+ *((cp_pwl_bp_t*) &ctx->pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &ctx->pwl.zc_ntb) = CP_PWL_ZC_50;
+ }
+
+ *((uint*) &ctx->pwl.discover_period_max_bp) =
+ MAC_MS_TO_TCK(MAC_SEC_TO_MS (CP_DISCOVER_PERIOD_MAX_S))
+ / ctx->pwl.bp_ntb;
+}
+
+/**
+ * Estimate the current beacon period.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_estimate_beacon_period (cp_t *ctx)
+{
+ uint diff_ntb;
+
+ dbg_assert (ctx);
+ dbg_assert (ctx->pwl.bp_ntb);
+
+ ctx->pwl.date_ntb[1] = ctx->pwl.date_ntb[0];
+ ctx->pwl.date_ntb[0] = phy_clock_get_zero_cross_captured_date (ctx->phy);
+
+ diff_ntb = (ctx->pwl.date_ntb[0] - ctx->pwl.date_ntb[1])
+ % (ctx->pwl.bp_ntb + 10000);
+ ctx->pwl.per_ntb = (4-(diff_ntb / ctx->pwl.zc_ntb)) *
+ ctx->pwl.zc_ntb + diff_ntb;
+}
+
+/**
+ * Uninitialise the PWL module.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_pwl_uninit (cp_t *ctx)
+{
+ dbg_assert (ctx);
+}
+
diff --git a/cesar/cp/pwl/test/Makefile b/cesar/cp/pwl/test/Makefile
new file mode 100644
index 0000000000..9c84fbec6f
--- /dev/null
+++ b/cesar/cp/pwl/test/Makefile
@@ -0,0 +1,10 @@
+BASE = ../../..
+
+ECOS = y
+
+TARGET_PROGRAMS = pwl
+
+pwl_SOURCES = pwl.c
+pwl_MODULES = lib cp/pwl
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/pwl/test/doc/Makefile b/cesar/cp/pwl/test/doc/Makefile
new file mode 100644
index 0000000000..d3db9f86c8
--- /dev/null
+++ b/cesar/cp/pwl/test/doc/Makefile
@@ -0,0 +1,20 @@
+PAGES= pwl.txt
+
+ODT=$(PAGES:%.txt=%.odt)
+HTML=$(PAGES:%.txt=%.html)
+
+all: $(ODT) $(HTML)
+
+odt: $(ODT)
+
+html: $(HTML)
+
+%.odt: %.txt
+ rst2odt.py $< $@
+
+%.html: %.txt
+ rst2html $< $@
+
+clean:
+ rm -f $(ODT)
+ rm -f $(HTML)
diff --git a/cesar/cp/pwl/test/doc/pwl.txt b/cesar/cp/pwl/test/doc/pwl.txt
new file mode 100644
index 0000000000..7982f71045
--- /dev/null
+++ b/cesar/cp/pwl/test/doc/pwl.txt
@@ -0,0 +1,92 @@
+==========
+PWL Module
+==========
+
+Init
+----
+
+This shall initialise the PWL module.
+At the end of this test, the PWL module attributes shall be equal to 0.
+
+Uninit
+------
+
+Actually does nothing.
+
+Frequency detection
+-------------------
+
+Shall detect the 50, 60 Hz or the coaxial cable.
+
+Environment
+ This shall be use in a THREAD cause of the cyg_thread_delay function it calls.
+
+On 50 Hz PWL
+~~~~~~~~~~~~
+
+It shall read the PRATIC register twice and compute the zero cross gap.
+At the end:
+
+ * frequency == CP_PWL_FREQ_50
+ * bp_ntb == CP_PWL_BP_50
+ * zc_ntb == CP_PWL_ZC_50
+
+On 60 Hz PWL
+~~~~~~~~~~~~
+
+It shall read the PRATIC register twice and compute the zero cross gap.
+At the end:
+
+ * frequency == CP_PWL_FREQ_60
+ * bp_ntb == CP_PWL_BP_60
+ * zc_ntb == CP_PWL_ZC_60
+
+On Coaxial
+~~~~~~~~~~
+
+It shall read the PRATIC register twice and compute the zero cross gap.
+At the end:
+
+ * frequency == CP_PWL_FREQ_50
+ * bp_ntb == CP_PWL_BP_50
+ * zc_ntb == CP_PWL_ZC_50
+
+Estimate beacon period
+----------------------
+
+This test shall provide the same result as the scilab simulation.
+see cp/pwl/doc/scilab
+
+The scilab script is written to produce table to use with the unit test to verify the test.
+For that, use the makefile in the scilab directory, it will produce in the res directory three files for each script:
+
+ * table_xxx.h The table to include in the test to compute the period beacon, it correspond to PRATIC register values computed by scilab.
+ * result_xxx.h The result table of beacon period computed by scilab. It corresponds to the result that should be computed by the PWL module reacting to the table.
+ * result_xxx.csv the file containing the values computed i.e. the beacon period, the beacon period in ATU, the first zero cross, the next one, the difference between the two.
+
+Test 1 : AC stable.
+~~~~~~~~~~~~~~~~~~~
+
+This shall compute the values of the beacon period according with the values computed by scilab.
+So this shall use:
+
+ * table.h : entry data simulating the PRATIC register.
+ * result_stable.h : the beacon period computed by scilab to compare with.
+
+Test 2 : AC increasing.
+~~~~~~~~~~~~~~~~~~~~~~~
+
+This shall compute the values of the beacon period according with the values computed by scilab.
+So this shall use:
+
+ * table_increase.h : entry data simulating the PRATIC register.
+ * result_increase.h : the beacon period computed by scilab to compare with.
+
+Test 3 : AC decreasing.
+~~~~~~~~~~~~~~~~~~~~~~~
+
+This shall compute the values of the beacon period according with the values computed by scilab.
+So this shall use:
+
+ * table_decrease.h : entry data simulating the PRATIC register.
+ * result_decrease.h : the beacon period computed by scilab to compare with.
diff --git a/cesar/cp/pwl/test/ecos.ecc.sh b/cesar/cp/pwl/test/ecos.ecc.sh
new file mode 100644
index 0000000000..8253d98c9a
--- /dev/null
+++ b/cesar/cp/pwl/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<EOF
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/pwl/test/inc/result_decrease.h b/cesar/cp/pwl/test/inc/result_decrease.h
new file mode 100644
index 0000000000..0512787887
--- /dev/null
+++ b/cesar/cp/pwl/test/inc/result_decrease.h
@@ -0,0 +1,1006 @@
+#ifndef result_decrease_result_ac_decrease
+#define result_decrease_result_ac_decrease
+/* File generated by scilab */
+uint result_ac_decrease [1000] = {
+ 1228868,
+ 1174396,
+ 1249978,
+ 1216968,
+ 1183462,
+ 1187161,
+ 1165026,
+ 1181427,
+ 1162179,
+ 1243163,
+ 1193916,
+ 1183765,
+ 1177365,
+ 1230149,
+ 1195575,
+ 1226793,
+ 1226878,
+ 1228354,
+ 1161662,
+ 1184749,
+ 1219240,
+ 1156704,
+ 1228540,
+ 1218736,
+ 1213837,
+ 1220778,
+ 1193358,
+ 1201736,
+ 1216783,
+ 1190650,
+ 1199847,
+ 1206315,
+ 1223069,
+ 1186743,
+ 1209481,
+ 1158153,
+ 1245627,
+ 1201815,
+ 1223605,
+ 1208519,
+ 1221936,
+ 1237200,
+ 1172169,
+ 1228810,
+ 1238787,
+ 1181432,
+ 1234688,
+ 1180292,
+ 1165845,
+ 1209380,
+ 1209052,
+ 1162159,
+ 1238617,
+ 1230017,
+ 1193814,
+ 1191039,
+ 1181461,
+ 1160938,
+ 1199578,
+ 1215064,
+ 1211263,
+ 1157772,
+ 1155119,
+ 1215647,
+ 1212399,
+ 1176591,
+ 1223843,
+ 1200066,
+ 1223615,
+ 1197465,
+ 1196238,
+ 1238001,
+ 1227437,
+ 1187260,
+ 1173916,
+ 1245145,
+ 1182761,
+ 1229829,
+ 1210885,
+ 1166997,
+ 1191213,
+ 1201709,
+ 1227672,
+ 1165992,
+ 1237941,
+ 1221447,
+ 1163925,
+ 1165059,
+ 1197430,
+ 1150688,
+ 1185115,
+ 1150769,
+ 1244996,
+ 1175145,
+ 1208960,
+ 1189155,
+ 1164558,
+ 1243574,
+ 1167210,
+ 1157377,
+ 1193328,
+ 1192884,
+ 1168399,
+ 1244311,
+ 1194041,
+ 1237507,
+ 1177208,
+ 1223223,
+ 1195347,
+ 1151146,
+ 1176044,
+ 1249629,
+ 1190995,
+ 1219036,
+ 1224478,
+ 1187482,
+ 1238426,
+ 1188830,
+ 1182161,
+ 1216800,
+ 1247413,
+ 1198256,
+ 1210832,
+ 1225865,
+ 1199356,
+ 1207639,
+ 1221063,
+ 1241121,
+ 1187872,
+ 1215451,
+ 1179352,
+ 1197886,
+ 1221296,
+ 1184973,
+ 1241187,
+ 1205013,
+ 1177728,
+ 1160233,
+ 1225722,
+ 1206623,
+ 1153230,
+ 1199315,
+ 1197671,
+ 1194031,
+ 1193827,
+ 1203183,
+ 1172055,
+ 1170990,
+ 1151915,
+ 1168130,
+ 1207432,
+ 1225385,
+ 1157705,
+ 1239993,
+ 1203218,
+ 1210496,
+ 1246339,
+ 1198247,
+ 1166746,
+ 1188952,
+ 1231289,
+ 1248105,
+ 1165665,
+ 1242515,
+ 1164672,
+ 1248755,
+ 1231325,
+ 1200795,
+ 1175104,
+ 1155851,
+ 1228760,
+ 1192050,
+ 1223719,
+ 1206391,
+ 1158895,
+ 1169174,
+ 1168974,
+ 1224096,
+ 1208610,
+ 1214001,
+ 1180873,
+ 1173432,
+ 1214274,
+ 1173067,
+ 1195224,
+ 1240378,
+ 1154389,
+ 1227926,
+ 1248568,
+ 1168086,
+ 1236951,
+ 1153180,
+ 1184387,
+ 1225545,
+ 1197169,
+ 1165311,
+ 1171234,
+ 1237380,
+ 1171162,
+ 1215470,
+ 1223402,
+ 1152902,
+ 1161248,
+ 1229333,
+ 1164749,
+ 1182554,
+ 1158472,
+ 1247152,
+ 1226322,
+ 1179847,
+ 1237975,
+ 1167126,
+ 1218390,
+ 1196949,
+ 1192849,
+ 1245220,
+ 1167514,
+ 1192012,
+ 1222082,
+ 1154549,
+ 1159289,
+ 1216399,
+ 1238244,
+ 1157463,
+ 1177364,
+ 1159906,
+ 1210511,
+ 1193449,
+ 1179386,
+ 1182122,
+ 1208671,
+ 1235978,
+ 1200477,
+ 1208052,
+ 1163738,
+ 1221425,
+ 1224879,
+ 1216109,
+ 1210781,
+ 1203185,
+ 1216384,
+ 1196632,
+ 1229610,
+ 1234101,
+ 1248182,
+ 1209017,
+ 1248942,
+ 1230347,
+ 1222745,
+ 1215624,
+ 1229663,
+ 1219881,
+ 1222375,
+ 1220555,
+ 1192820,
+ 1228583,
+ 1181046,
+ 1191445,
+ 1207959,
+ 1207225,
+ 1218155,
+ 1192382,
+ 1207451,
+ 1152381,
+ 1224811,
+ 1206089,
+ 1242407,
+ 1224407,
+ 1243294,
+ 1173489,
+ 1245827,
+ 1215618,
+ 1230299,
+ 1228772,
+ 1218597,
+ 1171784,
+ 1244591,
+ 1158098,
+ 1203965,
+ 1220074,
+ 1249709,
+ 1160066,
+ 1166121,
+ 1206563,
+ 1172322,
+ 1236047,
+ 1238494,
+ 1196446,
+ 1206883,
+ 1188547,
+ 1157411,
+ 1240062,
+ 1207195,
+ 1155682,
+ 1246727,
+ 1157868,
+ 1155510,
+ 1159930,
+ 1169057,
+ 1247481,
+ 1249804,
+ 1199248,
+ 1209240,
+ 1165920,
+ 1199828,
+ 1158713,
+ 1205643,
+ 1190163,
+ 1172582,
+ 1170780,
+ 1194954,
+ 1209150,
+ 1177826,
+ 1202315,
+ 1186070,
+ 1150362,
+ 1234253,
+ 1196494,
+ 1228710,
+ 1194086,
+ 1206951,
+ 1247720,
+ 1192386,
+ 1178509,
+ 1156784,
+ 1237674,
+ 1221345,
+ 1248753,
+ 1192306,
+ 1210614,
+ 1181115,
+ 1152977,
+ 1164843,
+ 1216067,
+ 1162275,
+ 1238686,
+ 1197359,
+ 1197027,
+ 1157083,
+ 1152346,
+ 1187746,
+ 1151775,
+ 1174571,
+ 1195453,
+ 1177140,
+ 1247475,
+ 1209749,
+ 1240169,
+ 1223914,
+ 1213637,
+ 1232534,
+ 1157659,
+ 1173949,
+ 1193598,
+ 1212030,
+ 1162238,
+ 1167826,
+ 1182130,
+ 1241780,
+ 1224473,
+ 1175556,
+ 1227305,
+ 1181631,
+ 1156350,
+ 1199470,
+ 1224752,
+ 1181812,
+ 1221637,
+ 1235906,
+ 1182409,
+ 1204874,
+ 1174570,
+ 1236298,
+ 1183918,
+ 1211100,
+ 1179982,
+ 1158320,
+ 1228772,
+ 1223022,
+ 1218002,
+ 1247679,
+ 1177346,
+ 1234660,
+ 1226448,
+ 1241203,
+ 1178941,
+ 1181113,
+ 1184047,
+ 1231849,
+ 1210951,
+ 1234131,
+ 1187593,
+ 1186240,
+ 1207296,
+ 1239284,
+ 1226178,
+ 1155371,
+ 1204234,
+ 1160356,
+ 1205616,
+ 1169105,
+ 1181683,
+ 1246599,
+ 1226195,
+ 1155080,
+ 1228173,
+ 1188454,
+ 1166865,
+ 1172660,
+ 1207559,
+ 1177379,
+ 1179001,
+ 1202543,
+ 1155614,
+ 1235404,
+ 1242859,
+ 1182663,
+ 1184631,
+ 1230032,
+ 1189859,
+ 1231007,
+ 1224161,
+ 1240122,
+ 1243801,
+ 1245966,
+ 1175999,
+ 1188374,
+ 1184165,
+ 1224855,
+ 1211567,
+ 1206036,
+ 1184593,
+ 1191219,
+ 1189792,
+ 1245465,
+ 1229706,
+ 1171558,
+ 1223625,
+ 1206168,
+ 1163352,
+ 1212079,
+ 1173313,
+ 1189934,
+ 1171433,
+ 1176129,
+ 1194558,
+ 1150709,
+ 1152426,
+ 1212904,
+ 1219678,
+ 1154805,
+ 1178722,
+ 1238077,
+ 1199909,
+ 1217100,
+ 1201911,
+ 1216964,
+ 1186956,
+ 1228829,
+ 1205140,
+ 1190855,
+ 1181933,
+ 1242608,
+ 1155664,
+ 1237137,
+ 1229810,
+ 1230307,
+ 1160714,
+ 1203821,
+ 1187488,
+ 1179403,
+ 1179819,
+ 1209121,
+ 1243638,
+ 1243427,
+ 1196690,
+ 1246685,
+ 1218422,
+ 1212142,
+ 1203805,
+ 1187127,
+ 1221215,
+ 1217080,
+ 1202808,
+ 1216463,
+ 1194470,
+ 1238040,
+ 1173861,
+ 1202091,
+ 1221831,
+ 1226200,
+ 1217058,
+ 1226933,
+ 1228638,
+ 1209451,
+ 1219047,
+ 1182371,
+ 1152931,
+ 1195583,
+ 1247953,
+ 1160587,
+ 1215097,
+ 1238947,
+ 1229767,
+ 1236954,
+ 1164261,
+ 1186220,
+ 1209289,
+ 1183081,
+ 1229574,
+ 1166896,
+ 1248779,
+ 1201156,
+ 1154502,
+ 1244126,
+ 1167416,
+ 1220193,
+ 1242243,
+ 1191540,
+ 1174713,
+ 1244828,
+ 1190414,
+ 1211663,
+ 1200998,
+ 1197273,
+ 1243111,
+ 1161570,
+ 1178088,
+ 1243058,
+ 1238478,
+ 1201374,
+ 1173285,
+ 1241195,
+ 1179915,
+ 1231209,
+ 1229822,
+ 1209372,
+ 1209034,
+ 1232305,
+ 1216871,
+ 1244816,
+ 1208508,
+ 1177788,
+ 1242254,
+ 1191442,
+ 1212921,
+ 1228839,
+ 1230968,
+ 1193921,
+ 1155753,
+ 1181823,
+ 1222658,
+ 1229283,
+ 1230621,
+ 1182022,
+ 1191164,
+ 1156683,
+ 1194909,
+ 1169595,
+ 1239256,
+ 1175961,
+ 1193897,
+ 1173389,
+ 1171694,
+ 1235612,
+ 1233529,
+ 1218226,
+ 1199735,
+ 1180796,
+ 1179935,
+ 1161294,
+ 1180203,
+ 1182011,
+ 1213841,
+ 1223261,
+ 1242264,
+ 1235059,
+ 1217982,
+ 1229740,
+ 1205012,
+ 1172925,
+ 1225648,
+ 1228739,
+ 1239008,
+ 1180186,
+ 1208491,
+ 1199702,
+ 1174884,
+ 1150599,
+ 1231713,
+ 1219781,
+ 1212146,
+ 1178469,
+ 1154759,
+ 1202961,
+ 1231291,
+ 1224429,
+ 1205650,
+ 1177660,
+ 1162381,
+ 1246267,
+ 1207066,
+ 1218428,
+ 1213176,
+ 1235413,
+ 1182317,
+ 1197381,
+ 1209964,
+ 1249709,
+ 1219319,
+ 1170974,
+ 1154221,
+ 1183108,
+ 1220704,
+ 1167762,
+ 1248202,
+ 1162893,
+ 1218190,
+ 1192756,
+ 1192614,
+ 1215080,
+ 1179328,
+ 1214008,
+ 1209477,
+ 1188592,
+ 1184760,
+ 1247049,
+ 1193312,
+ 1178860,
+ 1204116,
+ 1202795,
+ 1243763,
+ 1241456,
+ 1248655,
+ 1214570,
+ 1182807,
+ 1236394,
+ 1228803,
+ 1209841,
+ 1209638,
+ 1193717,
+ 1194690,
+ 1242311,
+ 1196393,
+ 1240998,
+ 1187820,
+ 1249988,
+ 1177803,
+ 1183388,
+ 1182008,
+ 1154859,
+ 1237931,
+ 1176811,
+ 1241684,
+ 1169781,
+ 1247096,
+ 1184971,
+ 1175722,
+ 1228234,
+ 1152116,
+ 1160748,
+ 1214888,
+ 1202544,
+ 1173006,
+ 1242657,
+ 1191054,
+ 1226211,
+ 1209237,
+ 1206952,
+ 1246293,
+ 1185959,
+ 1208693,
+ 1166031,
+ 1249979,
+ 1199147,
+ 1202451,
+ 1153750,
+ 1152020,
+ 1242144,
+ 1158500,
+ 1188274,
+ 1150359,
+ 1245315,
+ 1157541,
+ 1153102,
+ 1200838,
+ 1220230,
+ 1243970,
+ 1186866,
+ 1247590,
+ 1234726,
+ 1155189,
+ 1222558,
+ 1202053,
+ 1201443,
+ 1182360,
+ 1166788,
+ 1248742,
+ 1195463,
+ 1165733,
+ 1159709,
+ 1205906,
+ 1166677,
+ 1177661,
+ 1206229,
+ 1219194,
+ 1162502,
+ 1196442,
+ 1219141,
+ 1216454,
+ 1226576,
+ 1224106,
+ 1164785,
+ 1201783,
+ 1189048,
+ 1151272,
+ 1151886,
+ 1216969,
+ 1214109,
+ 1222195,
+ 1154166,
+ 1248437,
+ 1220357,
+ 1203141,
+ 1207380,
+ 1207824,
+ 1239652,
+ 1207203,
+ 1171393,
+ 1164320,
+ 1230066,
+ 1178687,
+ 1197911,
+ 1156883,
+ 1208562,
+ 1190199,
+ 1194509,
+ 1164471,
+ 1219023,
+ 1155539,
+ 1225574,
+ 1162396,
+ 1201258,
+ 1211560,
+ 1240777,
+ 1242946,
+ 1176612,
+ 1172079,
+ 1171724,
+ 1228385,
+ 1215799,
+ 1206991,
+ 1187383,
+ 1154458,
+ 1204585,
+ 1249708,
+ 1248931,
+ 1152537,
+ 1172958,
+ 1186034,
+ 1154642,
+ 1208516,
+ 1203385,
+ 1227616,
+ 1215431,
+ 1226594,
+ 1183807,
+ 1223089,
+ 1151698,
+ 1176067,
+ 1220979,
+ 1210041,
+ 1152078,
+ 1249245,
+ 1179790,
+ 1160925,
+ 1184731,
+ 1208638,
+ 1164184,
+ 1226040,
+ 1201800,
+ 1151515,
+ 1205303,
+ 1226702,
+ 1227655,
+ 1169975,
+ 1172493,
+ 1201750,
+ 1171552,
+ 1234654,
+ 1172772,
+ 1160480,
+ 1155327,
+ 1180182,
+ 1154409,
+ 1245160,
+ 1196765,
+ 1220532,
+ 1180229,
+ 1156238,
+ 1239245,
+ 1172366,
+ 1186266,
+ 1243370,
+ 1168306,
+ 1214527,
+ 1191395,
+ 1215390,
+ 1205753,
+ 1161774,
+ 1173564,
+ 1172359,
+ 1221924,
+ 1180914,
+ 1178253,
+ 1212799,
+ 1156746,
+ 1227434,
+ 1174789,
+ 1219253,
+ 1190207,
+ 1230762,
+ 1226130,
+ 1175292,
+ 1152869,
+ 1206297,
+ 1187752,
+ 1217087,
+ 1217037,
+ 1222314,
+ 1201271,
+ 1172680,
+ 1159225,
+ 1199878,
+ 1198405,
+ 1192074,
+ 1234537,
+ 1173889,
+ 1180921,
+ 1221268,
+ 1153575,
+ 1193393,
+ 1192179,
+ 1223366,
+ 1202530,
+ 1189265,
+ 1245903,
+ 1199875,
+ 1197041,
+ 1187406,
+ 1227807,
+ 1215326,
+ 1210489,
+ 1195572,
+ 1235693,
+ 1178346,
+ 1167311,
+ 1241962,
+ 1173653,
+ 1182288,
+ 1241992,
+ 1193684,
+ 1165999,
+ 1158571,
+ 1154339,
+ 1233235,
+ 1206541,
+ 1245825,
+ 1201673,
+ 1221107,
+ 1208843,
+ 1227998,
+ 1218554,
+ 1222661,
+ 1173082,
+ 1244515,
+ 1204677,
+ 1227372,
+ 1235133,
+ 1225650,
+ 1211555,
+ 1238588,
+ 1213504,
+ 1156206,
+ 1228612,
+ 1161923,
+ 1219747,
+ 1220642,
+ 1159322,
+ 1170406,
+ 1247977,
+ 1232780,
+ 1228003,
+ 1174511,
+ 1209107,
+ 1203193,
+ 1207912,
+ 1175196,
+ 1225444,
+ 1247423,
+ 1211244,
+ 1228081,
+ 1151258,
+ 1188142,
+ 1231670,
+ 1196869,
+ 1234949,
+ 1154385,
+ 1180051,
+ 1224166,
+ 1188448,
+ 1230970,
+ 1203925,
+ 1197800,
+ 1179462,
+ 1161252,
+ 1231418,
+ 1240775,
+ 1212204,
+ 1156307,
+ 1230195,
+ 1202980,
+ 1212212,
+ 1213704,
+ 1222067,
+ 1182786,
+ 1180911,
+ 1198953,
+ 1243894,
+ 1156647,
+ 1235511,
+ 1192788,
+ 1195402,
+ 1244834,
+ 1199890,
+ 1157391,
+ 1164531,
+ 1191430,
+ 1162082,
+ 1224680,
+ 1170961,
+ 1186702,
+ 1163977,
+ 1159804,
+ 1218413,
+ 1209990,
+ 1238892,
+ 1202949,
+ 1196373,
+ 1221216,
+ 1162599,
+ 1242592,
+ 1221851,
+ 1179163,
+ 1233474,
+ 1223327,
+ 1161806,
+ 1214629,
+ 1247354,
+ 1241384,
+ 1226861,
+ 1236594,
+ 1182760,
+ 1230971,
+ 1176925,
+ 1199516,
+ 1162089,
+ 1194556,
+ 1229368,
+ 1209884,
+ 1204407,
+ 1180229,
+ 1210341,
+ 1200162,
+ 1235476,
+ 1159247,
+ 1239908,
+ 1248229,
+ 1170624,
+ 1206909,
+ 1191567,
+ 1170458,
+ 1236094,
+ 1239873,
+ 1216832,
+ 1166556,
+ 1244501,
+ 1213040,
+ 1175468,
+ 1244282,
+ 1190004,
+ 1229143,
+ 1162012,
+ 1202172,
+ 1178840,
+ 1164142,
+ 1169218,
+ 1198401,
+ 1160827,
+1161577 };
+uint result_ac_decrease_length = 1000;
+#endif /* result_decrease_result_ac_decrease */
diff --git a/cesar/cp/pwl/test/inc/result_increase.h b/cesar/cp/pwl/test/inc/result_increase.h
new file mode 100644
index 0000000000..b8f4322c03
--- /dev/null
+++ b/cesar/cp/pwl/test/inc/result_increase.h
@@ -0,0 +1,1006 @@
+#ifndef result_increase_result_ac_increase
+#define result_increase_result_ac_increase
+/* File generated by scilab */
+uint result_ac_increase [1000] = {
+ 1000211,
+ 1000756,
+ 1000000,
+ 1000330,
+ 1000665,
+ 1000628,
+ 1000849,
+ 1000685,
+ 1000878,
+ 1000068,
+ 1000560,
+ 1000662,
+ 1000726,
+ 1000198,
+ 1000544,
+ 1000232,
+ 1000231,
+ 1000216,
+ 1000883,
+ 1000652,
+ 1000307,
+ 1000932,
+ 1000214,
+ 1000312,
+ 1000361,
+ 1000292,
+ 1000566,
+ 1000482,
+ 1000332,
+ 1000593,
+ 1000501,
+ 1000436,
+ 1000269,
+ 1000632,
+ 1000405,
+ 1000918,
+ 1000043,
+ 1000481,
+ 1000263,
+ 1000414,
+ 1000280,
+ 1000128,
+ 1000778,
+ 1000211,
+ 1000112,
+ 1000685,
+ 1000153,
+ 1000697,
+ 1000841,
+ 1000406,
+ 1000409,
+ 1000878,
+ 1000113,
+ 1000199,
+ 1000561,
+ 1000589,
+ 1000685,
+ 1000890,
+ 1000504,
+ 1000349,
+ 1000387,
+ 1000922,
+ 1000948,
+ 1000343,
+ 1000376,
+ 1000734,
+ 1000261,
+ 1000499,
+ 1000263,
+ 1000525,
+ 1000537,
+ 1000119,
+ 1000225,
+ 1000627,
+ 1000760,
+ 1000048,
+ 1000672,
+ 1000201,
+ 1000391,
+ 1000830,
+ 1000587,
+ 1000482,
+ 1000223,
+ 1000840,
+ 1000120,
+ 1000285,
+ 1000860,
+ 1000849,
+ 1000525,
+ 1000993,
+ 1000648,
+ 1000992,
+ 1000050,
+ 1000748,
+ 1000410,
+ 1000608,
+ 1000854,
+ 1000064,
+ 1000827,
+ 1000926,
+ 1000566,
+ 1000571,
+ 1000816,
+ 1000056,
+ 1000559,
+ 1000124,
+ 1000727,
+ 1000267,
+ 1000546,
+ 1000988,
+ 1000739,
+ 1000003,
+ 1000590,
+ 1000309,
+ 1000255,
+ 1000625,
+ 1000115,
+ 1000611,
+ 1000678,
+ 1000332,
+ 1000025,
+ 1000517,
+ 1000391,
+ 1000241,
+ 1000506,
+ 1000423,
+ 1000289,
+ 1000088,
+ 1000621,
+ 1000345,
+ 1000706,
+ 1000521,
+ 1000287,
+ 1000650,
+ 1000088,
+ 1000449,
+ 1000722,
+ 1000897,
+ 1000242,
+ 1000433,
+ 1000967,
+ 1000506,
+ 1000523,
+ 1000559,
+ 1000561,
+ 1000468,
+ 1000779,
+ 1000790,
+ 1000980,
+ 1000818,
+ 1000425,
+ 1000246,
+ 1000922,
+ 1000100,
+ 1000467,
+ 1000395,
+ 1000036,
+ 1000517,
+ 1000832,
+ 1000610,
+ 1000187,
+ 1000018,
+ 1000843,
+ 1000074,
+ 1000853,
+ 1000012,
+ 1000186,
+ 1000492,
+ 1000748,
+ 1000941,
+ 1000212,
+ 1000579,
+ 1000262,
+ 1000436,
+ 1000911,
+ 1000808,
+ 1000810,
+ 1000259,
+ 1000413,
+ 1000359,
+ 1000691,
+ 1000765,
+ 1000357,
+ 1000769,
+ 1000547,
+ 1000096,
+ 1000956,
+ 1000220,
+ 1000014,
+ 1000819,
+ 1000130,
+ 1000968,
+ 1000656,
+ 1000244,
+ 1000528,
+ 1000846,
+ 1000787,
+ 1000126,
+ 1000788,
+ 1000345,
+ 1000265,
+ 1000970,
+ 1000887,
+ 1000206,
+ 1000852,
+ 1000674,
+ 1000915,
+ 1000028,
+ 1000236,
+ 1000701,
+ 1000120,
+ 1000828,
+ 1000316,
+ 1000530,
+ 1000571,
+ 1000047,
+ 1000824,
+ 1000579,
+ 1000279,
+ 1000954,
+ 1000907,
+ 1000336,
+ 1000117,
+ 1000925,
+ 1000726,
+ 1000900,
+ 1000394,
+ 1000565,
+ 1000706,
+ 1000678,
+ 1000413,
+ 1000140,
+ 1000495,
+ 1000419,
+ 1000862,
+ 1000285,
+ 1000251,
+ 1000338,
+ 1000392,
+ 1000468,
+ 1000336,
+ 1000533,
+ 1000203,
+ 1000158,
+ 1000018,
+ 1000409,
+ 1000010,
+ 1000196,
+ 1000272,
+ 1000343,
+ 1000203,
+ 1000301,
+ 1000276,
+ 1000294,
+ 1000571,
+ 1000214,
+ 1000689,
+ 1000585,
+ 1000420,
+ 1000427,
+ 1000318,
+ 1000576,
+ 1000425,
+ 1000976,
+ 1000251,
+ 1000439,
+ 1000075,
+ 1000255,
+ 1000067,
+ 1000765,
+ 1000041,
+ 1000343,
+ 1000197,
+ 1000212,
+ 1000314,
+ 1000782,
+ 1000054,
+ 1000919,
+ 1000460,
+ 1000299,
+ 1000002,
+ 1000899,
+ 1000838,
+ 1000434,
+ 1000776,
+ 1000139,
+ 1000115,
+ 1000535,
+ 1000431,
+ 1000614,
+ 1000925,
+ 1000099,
+ 1000428,
+ 1000943,
+ 1000032,
+ 1000921,
+ 1000944,
+ 1000900,
+ 1000809,
+ 1000025,
+ 1000001,
+ 1000507,
+ 1000407,
+ 1000840,
+ 1000501,
+ 1000912,
+ 1000443,
+ 1000598,
+ 1000774,
+ 1000792,
+ 1000550,
+ 1000408,
+ 1000721,
+ 1000476,
+ 1000639,
+ 1000996,
+ 1000157,
+ 1000535,
+ 1000212,
+ 1000559,
+ 1000430,
+ 1000022,
+ 1000576,
+ 1000714,
+ 1000932,
+ 1000123,
+ 1000286,
+ 1000012,
+ 1000576,
+ 1000393,
+ 1000688,
+ 1000970,
+ 1000851,
+ 1000339,
+ 1000877,
+ 1000113,
+ 1000526,
+ 1000529,
+ 1000929,
+ 1000976,
+ 1000622,
+ 1000982,
+ 1000754,
+ 1000545,
+ 1000728,
+ 1000025,
+ 1000402,
+ 1000098,
+ 1000260,
+ 1000363,
+ 1000174,
+ 1000923,
+ 1000760,
+ 1000564,
+ 1000379,
+ 1000877,
+ 1000821,
+ 1000678,
+ 1000082,
+ 1000255,
+ 1000744,
+ 1000226,
+ 1000683,
+ 1000936,
+ 1000505,
+ 1000252,
+ 1000681,
+ 1000283,
+ 1000140,
+ 1000675,
+ 1000451,
+ 1000754,
+ 1000137,
+ 1000660,
+ 1000389,
+ 1000700,
+ 1000916,
+ 1000212,
+ 1000269,
+ 1000319,
+ 1000023,
+ 1000726,
+ 1000153,
+ 1000235,
+ 1000087,
+ 1000710,
+ 1000688,
+ 1000659,
+ 1000181,
+ 1000390,
+ 1000158,
+ 1000624,
+ 1000637,
+ 1000427,
+ 1000107,
+ 1000238,
+ 1000946,
+ 1000457,
+ 1000896,
+ 1000443,
+ 1000808,
+ 1000683,
+ 1000034,
+ 1000238,
+ 1000949,
+ 1000218,
+ 1000615,
+ 1000831,
+ 1000773,
+ 1000424,
+ 1000726,
+ 1000709,
+ 1000474,
+ 1000943,
+ 1000145,
+ 1000071,
+ 1000673,
+ 1000653,
+ 1000199,
+ 1000601,
+ 1000189,
+ 1000258,
+ 1000098,
+ 1000061,
+ 1000040,
+ 1000740,
+ 1000616,
+ 1000658,
+ 1000251,
+ 1000384,
+ 1000439,
+ 1000654,
+ 1000587,
+ 1000602,
+ 1000045,
+ 1000202,
+ 1000784,
+ 1000263,
+ 1000438,
+ 1000866,
+ 1000379,
+ 1000766,
+ 1000600,
+ 1000785,
+ 1000738,
+ 1000554,
+ 1000992,
+ 1000975,
+ 1000370,
+ 1000303,
+ 1000951,
+ 1000712,
+ 1000119,
+ 1000500,
+ 1000329,
+ 1000480,
+ 1000330,
+ 1000630,
+ 1000211,
+ 1000448,
+ 1000591,
+ 1000680,
+ 1000073,
+ 1000943,
+ 1000128,
+ 1000201,
+ 1000196,
+ 1000892,
+ 1000461,
+ 1000625,
+ 1000705,
+ 1000701,
+ 1000408,
+ 1000063,
+ 1000065,
+ 1000533,
+ 1000033,
+ 1000315,
+ 1000378,
+ 1000461,
+ 1000628,
+ 1000287,
+ 1000329,
+ 1000471,
+ 1000335,
+ 1000555,
+ 1000119,
+ 1000761,
+ 1000479,
+ 1000281,
+ 1000238,
+ 1000329,
+ 1000230,
+ 1000213,
+ 1000405,
+ 1000309,
+ 1000676,
+ 1000970,
+ 1000544,
+ 1000020,
+ 1000894,
+ 1000349,
+ 1000110,
+ 1000202,
+ 1000130,
+ 1000857,
+ 1000637,
+ 1000407,
+ 1000669,
+ 1000204,
+ 1000831,
+ 1000012,
+ 1000488,
+ 1000954,
+ 1000058,
+ 1000825,
+ 1000298,
+ 1000077,
+ 1000584,
+ 1000752,
+ 1000051,
+ 1000595,
+ 1000383,
+ 1000490,
+ 1000527,
+ 1000068,
+ 1000884,
+ 1000719,
+ 1000069,
+ 1000115,
+ 1000486,
+ 1000767,
+ 1000088,
+ 1000700,
+ 1000187,
+ 1000201,
+ 1000406,
+ 1000409,
+ 1000176,
+ 1000331,
+ 1000051,
+ 1000414,
+ 1000722,
+ 1000077,
+ 1000585,
+ 1000370,
+ 1000211,
+ 1000190,
+ 1000560,
+ 1000942,
+ 1000681,
+ 1000273,
+ 1000207,
+ 1000193,
+ 1000679,
+ 1000588,
+ 1000933,
+ 1000550,
+ 1000804,
+ 1000107,
+ 1000740,
+ 1000561,
+ 1000766,
+ 1000783,
+ 1000143,
+ 1000164,
+ 1000317,
+ 1000502,
+ 1000692,
+ 1000700,
+ 1000887,
+ 1000697,
+ 1000679,
+ 1000361,
+ 1000267,
+ 1000077,
+ 1000149,
+ 1000320,
+ 1000202,
+ 1000449,
+ 1000770,
+ 1000243,
+ 1000212,
+ 1000109,
+ 1000698,
+ 1000415,
+ 1000502,
+ 1000751,
+ 1000994,
+ 1000182,
+ 1000302,
+ 1000378,
+ 1000715,
+ 1000952,
+ 1000470,
+ 1000187,
+ 1000255,
+ 1000443,
+ 1000723,
+ 1000876,
+ 1000037,
+ 1000429,
+ 1000315,
+ 1000368,
+ 1000145,
+ 1000676,
+ 1000526,
+ 1000400,
+ 1000002,
+ 1000306,
+ 1000790,
+ 1000957,
+ 1000668,
+ 1000292,
+ 1000822,
+ 1000017,
+ 1000871,
+ 1000318,
+ 1000572,
+ 1000573,
+ 1000349,
+ 1000706,
+ 1000359,
+ 1000405,
+ 1000614,
+ 1000652,
+ 1000029,
+ 1000566,
+ 1000711,
+ 1000458,
+ 1000472,
+ 1000062,
+ 1000085,
+ 1000013,
+ 1000354,
+ 1000671,
+ 1000136,
+ 1000211,
+ 1000401,
+ 1000403,
+ 1000562,
+ 1000553,
+ 1000076,
+ 1000536,
+ 1000090,
+ 1000621,
+ 1000000,
+ 1000721,
+ 1000666,
+ 1000679,
+ 1000951,
+ 1000120,
+ 1000731,
+ 1000083,
+ 1000802,
+ 1000029,
+ 1000650,
+ 1000742,
+ 1000217,
+ 1000978,
+ 1000892,
+ 1000351,
+ 1000474,
+ 1000769,
+ 1000073,
+ 1000589,
+ 1000237,
+ 1000407,
+ 1000430,
+ 1000037,
+ 1000640,
+ 1000413,
+ 1000839,
+ 1000000,
+ 1000508,
+ 1000475,
+ 1000962,
+ 1000979,
+ 1000078,
+ 1000915,
+ 1000617,
+ 1000996,
+ 1000046,
+ 1000924,
+ 1000968,
+ 1000491,
+ 1000297,
+ 1000060,
+ 1000631,
+ 1000024,
+ 1000152,
+ 1000948,
+ 1000274,
+ 1000479,
+ 1000485,
+ 1000676,
+ 1000832,
+ 1000012,
+ 1000545,
+ 1000842,
+ 1000902,
+ 1000440,
+ 1000833,
+ 1000723,
+ 1000437,
+ 1000308,
+ 1000874,
+ 1000535,
+ 1000308,
+ 1000335,
+ 1000234,
+ 1000258,
+ 1000852,
+ 1000482,
+ 1000609,
+ 1000987,
+ 1000981,
+ 1000330,
+ 1000358,
+ 1000278,
+ 1000958,
+ 1000015,
+ 1000296,
+ 1000468,
+ 1000426,
+ 1000421,
+ 1000103,
+ 1000427,
+ 1000786,
+ 1000856,
+ 1000199,
+ 1000713,
+ 1000520,
+ 1000931,
+ 1000414,
+ 1000598,
+ 1000554,
+ 1000855,
+ 1000309,
+ 1000944,
+ 1000244,
+ 1000876,
+ 1000487,
+ 1000384,
+ 1000092,
+ 1000070,
+ 1000733,
+ 1000779,
+ 1000782,
+ 1000216,
+ 1000342,
+ 1000430,
+ 1000626,
+ 1000955,
+ 1000454,
+ 1000002,
+ 1000010,
+ 1000974,
+ 1000770,
+ 1000639,
+ 1000953,
+ 1000414,
+ 1000466,
+ 1000223,
+ 1000345,
+ 1000234,
+ 1000661,
+ 1000269,
+ 1000983,
+ 1000739,
+ 1000290,
+ 1000399,
+ 1000979,
+ 1000007,
+ 1000702,
+ 1000890,
+ 1000652,
+ 1000413,
+ 1000858,
+ 1000239,
+ 1000482,
+ 1000984,
+ 1000446,
+ 1000232,
+ 1000223,
+ 1000800,
+ 1000775,
+ 1000482,
+ 1000784,
+ 1000153,
+ 1000772,
+ 1000895,
+ 1000946,
+ 1000698,
+ 1000955,
+ 1000048,
+ 1000532,
+ 1000294,
+ 1000697,
+ 1000937,
+ 1000107,
+ 1000776,
+ 1000637,
+ 1000066,
+ 1000816,
+ 1000354,
+ 1000586,
+ 1000346,
+ 1000442,
+ 1000882,
+ 1000764,
+ 1000776,
+ 1000280,
+ 1000690,
+ 1000717,
+ 1000372,
+ 1000932,
+ 1000225,
+ 1000752,
+ 1000307,
+ 1000597,
+ 1000192,
+ 1000238,
+ 1000747,
+ 1000971,
+ 1000437,
+ 1000622,
+ 1000329,
+ 1000329,
+ 1000276,
+ 1000487,
+ 1000773,
+ 1000907,
+ 1000501,
+ 1000515,
+ 1000579,
+ 1000154,
+ 1000761,
+ 1000690,
+ 1000287,
+ 1000964,
+ 1000566,
+ 1000578,
+ 1000266,
+ 1000474,
+ 1000607,
+ 1000040,
+ 1000501,
+ 1000529,
+ 1000625,
+ 1000221,
+ 1000346,
+ 1000395,
+ 1000544,
+ 1000143,
+ 1000716,
+ 1000826,
+ 1000080,
+ 1000763,
+ 1000677,
+ 1000080,
+ 1000563,
+ 1000840,
+ 1000914,
+ 1000956,
+ 1000167,
+ 1000434,
+ 1000041,
+ 1000483,
+ 1000288,
+ 1000411,
+ 1000220,
+ 1000314,
+ 1000273,
+ 1000769,
+ 1000054,
+ 1000453,
+ 1000226,
+ 1000148,
+ 1000243,
+ 1000384,
+ 1000114,
+ 1000364,
+ 1000937,
+ 1000213,
+ 1000880,
+ 1000302,
+ 1000293,
+ 1000906,
+ 1000795,
+ 1000020,
+ 1000172,
+ 1000219,
+ 1000754,
+ 1000408,
+ 1000468,
+ 1000420,
+ 1000748,
+ 1000245,
+ 1000025,
+ 1000387,
+ 1000219,
+ 1000987,
+ 1000618,
+ 1000183,
+ 1000531,
+ 1000150,
+ 1000956,
+ 1000699,
+ 1000258,
+ 1000615,
+ 1000190,
+ 1000460,
+ 1000522,
+ 1000705,
+ 1000887,
+ 1000185,
+ 1000092,
+ 1000377,
+ 1000936,
+ 1000198,
+ 1000470,
+ 1000377,
+ 1000362,
+ 1000279,
+ 1000672,
+ 1000690,
+ 1000510,
+ 1000061,
+ 1000933,
+ 1000144,
+ 1000572,
+ 1000545,
+ 1000051,
+ 1000501,
+ 1000926,
+ 1000854,
+ 1000585,
+ 1000879,
+ 1000253,
+ 1000790,
+ 1000632,
+ 1000860,
+ 1000901,
+ 1000315,
+ 1000400,
+ 1000111,
+ 1000470,
+ 1000536,
+ 1000287,
+ 1000874,
+ 1000074,
+ 1000281,
+ 1000708,
+ 1000165,
+ 1000266,
+ 1000881,
+ 1000353,
+ 1000026,
+ 1000086,
+ 1000231,
+ 1000134,
+ 1000672,
+ 1000190,
+ 1000730,
+ 1000504,
+ 1000879,
+ 1000554,
+ 1000206,
+ 1000401,
+ 1000455,
+ 1000697,
+ 1000396,
+ 1000498,
+ 1000145,
+ 1000907,
+ 1000100,
+ 1000017,
+ 1000793,
+ 1000430,
+ 1000584,
+ 1000795,
+ 1000139,
+ 1000101,
+ 1000331,
+ 1000834,
+ 1000054,
+ 1000369,
+ 1000745,
+ 1000057,
+ 1000599,
+ 1000208,
+ 1000879,
+ 1000478,
+ 1000711,
+ 1000858,
+ 1000807,
+ 1000515,
+ 1000891,
+1000884 };
+uint result_ac_increase_length = 1000;
+#endif /* result_increase_result_ac_increase */
diff --git a/cesar/cp/pwl/test/inc/result_stable.h b/cesar/cp/pwl/test/inc/result_stable.h
new file mode 100644
index 0000000000..147e4af46b
--- /dev/null
+++ b/cesar/cp/pwl/test/inc/result_stable.h
@@ -0,0 +1,1006 @@
+#ifndef result_stable_result_ac_stable
+#define result_stable_result_ac_stable
+/* File generated by scilab */
+uint result_ac_stable [1000] = {
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+ 1000000,
+1000000 };
+uint result_ac_stable_length = 1000;
+#endif /* result_stable_result_ac_stable */
diff --git a/cesar/cp/pwl/test/inc/table.h b/cesar/cp/pwl/test/inc/table.h
new file mode 100644
index 0000000000..355ddc2f0a
--- /dev/null
+++ b/cesar/cp/pwl/test/inc/table.h
@@ -0,0 +1,1006 @@
+#ifndef table_ac_stable
+#define table_ac_stable
+/* File generated by scilab */
+uint ac_stable [1000] = {
+ 1000000,
+ 2000000,
+ 3000000,
+ 4000000,
+ 5000000,
+ 6000000,
+ 7000000,
+ 8000000,
+ 9000000,
+ 10000000,
+ 11000000,
+ 12000000,
+ 13000000,
+ 14000000,
+ 15000000,
+ 16000000,
+ 17000000,
+ 18000000,
+ 19000000,
+ 20000000,
+ 21000000,
+ 22000000,
+ 23000000,
+ 24000000,
+ 25000000,
+ 26000000,
+ 27000000,
+ 28000000,
+ 29000000,
+ 30000000,
+ 31000000,
+ 32000000,
+ 33000000,
+ 34000000,
+ 35000000,
+ 36000000,
+ 37000000,
+ 38000000,
+ 39000000,
+ 40000000,
+ 41000000,
+ 42000000,
+ 43000000,
+ 44000000,
+ 45000000,
+ 46000000,
+ 47000000,
+ 48000000,
+ 49000000,
+ 50000000,
+ 51000000,
+ 52000000,
+ 53000000,
+ 54000000,
+ 55000000,
+ 56000000,
+ 57000000,
+ 58000000,
+ 59000000,
+ 60000000,
+ 61000000,
+ 62000000,
+ 63000000,
+ 64000000,
+ 65000000,
+ 66000000,
+ 67000000,
+ 68000000,
+ 69000000,
+ 70000000,
+ 71000000,
+ 72000000,
+ 73000000,
+ 74000000,
+ 75000000,
+ 76000000,
+ 77000000,
+ 78000000,
+ 79000000,
+ 80000000,
+ 81000000,
+ 82000000,
+ 83000000,
+ 84000000,
+ 85000000,
+ 86000000,
+ 87000000,
+ 88000000,
+ 89000000,
+ 90000000,
+ 91000000,
+ 92000000,
+ 93000000,
+ 94000000,
+ 95000000,
+ 96000000,
+ 97000000,
+ 98000000,
+ 99000000,
+ 100000000,
+ 101000000,
+ 102000000,
+ 103000000,
+ 104000000,
+ 105000000,
+ 106000000,
+ 107000000,
+ 108000000,
+ 109000000,
+ 110000000,
+ 111000000,
+ 112000000,
+ 113000000,
+ 114000000,
+ 115000000,
+ 116000000,
+ 117000000,
+ 118000000,
+ 119000000,
+ 120000000,
+ 121000000,
+ 122000000,
+ 123000000,
+ 124000000,
+ 125000000,
+ 126000000,
+ 127000000,
+ 128000000,
+ 129000000,
+ 130000000,
+ 131000000,
+ 132000000,
+ 133000000,
+ 134000000,
+ 135000000,
+ 136000000,
+ 137000000,
+ 138000000,
+ 139000000,
+ 140000000,
+ 141000000,
+ 142000000,
+ 143000000,
+ 144000000,
+ 145000000,
+ 146000000,
+ 147000000,
+ 148000000,
+ 149000000,
+ 150000000,
+ 151000000,
+ 152000000,
+ 153000000,
+ 154000000,
+ 155000000,
+ 156000000,
+ 157000000,
+ 158000000,
+ 159000000,
+ 160000000,
+ 161000000,
+ 162000000,
+ 163000000,
+ 164000000,
+ 165000000,
+ 166000000,
+ 167000000,
+ 168000000,
+ 169000000,
+ 170000000,
+ 171000000,
+ 172000000,
+ 173000000,
+ 174000000,
+ 175000000,
+ 176000000,
+ 177000000,
+ 178000000,
+ 179000000,
+ 180000000,
+ 181000000,
+ 182000000,
+ 183000000,
+ 184000000,
+ 185000000,
+ 186000000,
+ 187000000,
+ 188000000,
+ 189000000,
+ 190000000,
+ 191000000,
+ 192000000,
+ 193000000,
+ 194000000,
+ 195000000,
+ 196000000,
+ 197000000,
+ 198000000,
+ 199000000,
+ 200000000,
+ 201000000,
+ 202000000,
+ 203000000,
+ 204000000,
+ 205000000,
+ 206000000,
+ 207000000,
+ 208000000,
+ 209000000,
+ 210000000,
+ 211000000,
+ 212000000,
+ 213000000,
+ 214000000,
+ 215000000,
+ 216000000,
+ 217000000,
+ 218000000,
+ 219000000,
+ 220000000,
+ 221000000,
+ 222000000,
+ 223000000,
+ 224000000,
+ 225000000,
+ 226000000,
+ 227000000,
+ 228000000,
+ 229000000,
+ 230000000,
+ 231000000,
+ 232000000,
+ 233000000,
+ 234000000,
+ 235000000,
+ 236000000,
+ 237000000,
+ 238000000,
+ 239000000,
+ 240000000,
+ 241000000,
+ 242000000,
+ 243000000,
+ 244000000,
+ 245000000,
+ 246000000,
+ 247000000,
+ 248000000,
+ 249000000,
+ 250000000,
+ 251000000,
+ 252000000,
+ 253000000,
+ 254000000,
+ 255000000,
+ 256000000,
+ 257000000,
+ 258000000,
+ 259000000,
+ 260000000,
+ 261000000,
+ 262000000,
+ 263000000,
+ 264000000,
+ 265000000,
+ 266000000,
+ 267000000,
+ 268000000,
+ 269000000,
+ 270000000,
+ 271000000,
+ 272000000,
+ 273000000,
+ 274000000,
+ 275000000,
+ 276000000,
+ 277000000,
+ 278000000,
+ 279000000,
+ 280000000,
+ 281000000,
+ 282000000,
+ 283000000,
+ 284000000,
+ 285000000,
+ 286000000,
+ 287000000,
+ 288000000,
+ 289000000,
+ 290000000,
+ 291000000,
+ 292000000,
+ 293000000,
+ 294000000,
+ 295000000,
+ 296000000,
+ 297000000,
+ 298000000,
+ 299000000,
+ 300000000,
+ 301000000,
+ 302000000,
+ 303000000,
+ 304000000,
+ 305000000,
+ 306000000,
+ 307000000,
+ 308000000,
+ 309000000,
+ 310000000,
+ 311000000,
+ 312000000,
+ 313000000,
+ 314000000,
+ 315000000,
+ 316000000,
+ 317000000,
+ 318000000,
+ 319000000,
+ 320000000,
+ 321000000,
+ 322000000,
+ 323000000,
+ 324000000,
+ 325000000,
+ 326000000,
+ 327000000,
+ 328000000,
+ 329000000,
+ 330000000,
+ 331000000,
+ 332000000,
+ 333000000,
+ 334000000,
+ 335000000,
+ 336000000,
+ 337000000,
+ 338000000,
+ 339000000,
+ 340000000,
+ 341000000,
+ 342000000,
+ 343000000,
+ 344000000,
+ 345000000,
+ 346000000,
+ 347000000,
+ 348000000,
+ 349000000,
+ 350000000,
+ 351000000,
+ 352000000,
+ 353000000,
+ 354000000,
+ 355000000,
+ 356000000,
+ 357000000,
+ 358000000,
+ 359000000,
+ 360000000,
+ 361000000,
+ 362000000,
+ 363000000,
+ 364000000,
+ 365000000,
+ 366000000,
+ 367000000,
+ 368000000,
+ 369000000,
+ 370000000,
+ 371000000,
+ 372000000,
+ 373000000,
+ 374000000,
+ 375000000,
+ 376000000,
+ 377000000,
+ 378000000,
+ 379000000,
+ 380000000,
+ 381000000,
+ 382000000,
+ 383000000,
+ 384000000,
+ 385000000,
+ 386000000,
+ 387000000,
+ 388000000,
+ 389000000,
+ 390000000,
+ 391000000,
+ 392000000,
+ 393000000,
+ 394000000,
+ 395000000,
+ 396000000,
+ 397000000,
+ 398000000,
+ 399000000,
+ 400000000,
+ 401000000,
+ 402000000,
+ 403000000,
+ 404000000,
+ 405000000,
+ 406000000,
+ 407000000,
+ 408000000,
+ 409000000,
+ 410000000,
+ 411000000,
+ 412000000,
+ 413000000,
+ 414000000,
+ 415000000,
+ 416000000,
+ 417000000,
+ 418000000,
+ 419000000,
+ 420000000,
+ 421000000,
+ 422000000,
+ 423000000,
+ 424000000,
+ 425000000,
+ 426000000,
+ 427000000,
+ 428000000,
+ 429000000,
+ 430000000,
+ 431000000,
+ 432000000,
+ 433000000,
+ 434000000,
+ 435000000,
+ 436000000,
+ 437000000,
+ 438000000,
+ 439000000,
+ 440000000,
+ 441000000,
+ 442000000,
+ 443000000,
+ 444000000,
+ 445000000,
+ 446000000,
+ 447000000,
+ 448000000,
+ 449000000,
+ 450000000,
+ 451000000,
+ 452000000,
+ 453000000,
+ 454000000,
+ 455000000,
+ 456000000,
+ 457000000,
+ 458000000,
+ 459000000,
+ 460000000,
+ 461000000,
+ 462000000,
+ 463000000,
+ 464000000,
+ 465000000,
+ 466000000,
+ 467000000,
+ 468000000,
+ 469000000,
+ 470000000,
+ 471000000,
+ 472000000,
+ 473000000,
+ 474000000,
+ 475000000,
+ 476000000,
+ 477000000,
+ 478000000,
+ 479000000,
+ 480000000,
+ 481000000,
+ 482000000,
+ 483000000,
+ 484000000,
+ 485000000,
+ 486000000,
+ 487000000,
+ 488000000,
+ 489000000,
+ 490000000,
+ 491000000,
+ 492000000,
+ 493000000,
+ 494000000,
+ 495000000,
+ 496000000,
+ 497000000,
+ 498000000,
+ 499000000,
+ 500000000,
+ 501000000,
+ 502000000,
+ 503000000,
+ 504000000,
+ 505000000,
+ 506000000,
+ 507000000,
+ 508000000,
+ 509000000,
+ 510000000,
+ 511000000,
+ 512000000,
+ 513000000,
+ 514000000,
+ 515000000,
+ 516000000,
+ 517000000,
+ 518000000,
+ 519000000,
+ 520000000,
+ 521000000,
+ 522000000,
+ 523000000,
+ 524000000,
+ 525000000,
+ 526000000,
+ 527000000,
+ 528000000,
+ 529000000,
+ 530000000,
+ 531000000,
+ 532000000,
+ 533000000,
+ 534000000,
+ 535000000,
+ 536000000,
+ 537000000,
+ 538000000,
+ 539000000,
+ 540000000,
+ 541000000,
+ 542000000,
+ 543000000,
+ 544000000,
+ 545000000,
+ 546000000,
+ 547000000,
+ 548000000,
+ 549000000,
+ 550000000,
+ 551000000,
+ 552000000,
+ 553000000,
+ 554000000,
+ 555000000,
+ 556000000,
+ 557000000,
+ 558000000,
+ 559000000,
+ 560000000,
+ 561000000,
+ 562000000,
+ 563000000,
+ 564000000,
+ 565000000,
+ 566000000,
+ 567000000,
+ 568000000,
+ 569000000,
+ 570000000,
+ 571000000,
+ 572000000,
+ 573000000,
+ 574000000,
+ 575000000,
+ 576000000,
+ 577000000,
+ 578000000,
+ 579000000,
+ 580000000,
+ 581000000,
+ 582000000,
+ 583000000,
+ 584000000,
+ 585000000,
+ 586000000,
+ 587000000,
+ 588000000,
+ 589000000,
+ 590000000,
+ 591000000,
+ 592000000,
+ 593000000,
+ 594000000,
+ 595000000,
+ 596000000,
+ 597000000,
+ 598000000,
+ 599000000,
+ 600000000,
+ 601000000,
+ 602000000,
+ 603000000,
+ 604000000,
+ 605000000,
+ 606000000,
+ 607000000,
+ 608000000,
+ 609000000,
+ 610000000,
+ 611000000,
+ 612000000,
+ 613000000,
+ 614000000,
+ 615000000,
+ 616000000,
+ 617000000,
+ 618000000,
+ 619000000,
+ 620000000,
+ 621000000,
+ 622000000,
+ 623000000,
+ 624000000,
+ 625000000,
+ 626000000,
+ 627000000,
+ 628000000,
+ 629000000,
+ 630000000,
+ 631000000,
+ 632000000,
+ 633000000,
+ 634000000,
+ 635000000,
+ 636000000,
+ 637000000,
+ 638000000,
+ 639000000,
+ 640000000,
+ 641000000,
+ 642000000,
+ 643000000,
+ 644000000,
+ 645000000,
+ 646000000,
+ 647000000,
+ 648000000,
+ 649000000,
+ 650000000,
+ 651000000,
+ 652000000,
+ 653000000,
+ 654000000,
+ 655000000,
+ 656000000,
+ 657000000,
+ 658000000,
+ 659000000,
+ 660000000,
+ 661000000,
+ 662000000,
+ 663000000,
+ 664000000,
+ 665000000,
+ 666000000,
+ 667000000,
+ 668000000,
+ 669000000,
+ 670000000,
+ 671000000,
+ 672000000,
+ 673000000,
+ 674000000,
+ 675000000,
+ 676000000,
+ 677000000,
+ 678000000,
+ 679000000,
+ 680000000,
+ 681000000,
+ 682000000,
+ 683000000,
+ 684000000,
+ 685000000,
+ 686000000,
+ 687000000,
+ 688000000,
+ 689000000,
+ 690000000,
+ 691000000,
+ 692000000,
+ 693000000,
+ 694000000,
+ 695000000,
+ 696000000,
+ 697000000,
+ 698000000,
+ 699000000,
+ 700000000,
+ 701000000,
+ 702000000,
+ 703000000,
+ 704000000,
+ 705000000,
+ 706000000,
+ 707000000,
+ 708000000,
+ 709000000,
+ 710000000,
+ 711000000,
+ 712000000,
+ 713000000,
+ 714000000,
+ 715000000,
+ 716000000,
+ 717000000,
+ 718000000,
+ 719000000,
+ 720000000,
+ 721000000,
+ 722000000,
+ 723000000,
+ 724000000,
+ 725000000,
+ 726000000,
+ 727000000,
+ 728000000,
+ 729000000,
+ 730000000,
+ 731000000,
+ 732000000,
+ 733000000,
+ 734000000,
+ 735000000,
+ 736000000,
+ 737000000,
+ 738000000,
+ 739000000,
+ 740000000,
+ 741000000,
+ 742000000,
+ 743000000,
+ 744000000,
+ 745000000,
+ 746000000,
+ 747000000,
+ 748000000,
+ 749000000,
+ 750000000,
+ 751000000,
+ 752000000,
+ 753000000,
+ 754000000,
+ 755000000,
+ 756000000,
+ 757000000,
+ 758000000,
+ 759000000,
+ 760000000,
+ 761000000,
+ 762000000,
+ 763000000,
+ 764000000,
+ 765000000,
+ 766000000,
+ 767000000,
+ 768000000,
+ 769000000,
+ 770000000,
+ 771000000,
+ 772000000,
+ 773000000,
+ 774000000,
+ 775000000,
+ 776000000,
+ 777000000,
+ 778000000,
+ 779000000,
+ 780000000,
+ 781000000,
+ 782000000,
+ 783000000,
+ 784000000,
+ 785000000,
+ 786000000,
+ 787000000,
+ 788000000,
+ 789000000,
+ 790000000,
+ 791000000,
+ 792000000,
+ 793000000,
+ 794000000,
+ 795000000,
+ 796000000,
+ 797000000,
+ 798000000,
+ 799000000,
+ 800000000,
+ 801000000,
+ 802000000,
+ 803000000,
+ 804000000,
+ 805000000,
+ 806000000,
+ 807000000,
+ 808000000,
+ 809000000,
+ 810000000,
+ 811000000,
+ 812000000,
+ 813000000,
+ 814000000,
+ 815000000,
+ 816000000,
+ 817000000,
+ 818000000,
+ 819000000,
+ 820000000,
+ 821000000,
+ 822000000,
+ 823000000,
+ 824000000,
+ 825000000,
+ 826000000,
+ 827000000,
+ 828000000,
+ 829000000,
+ 830000000,
+ 831000000,
+ 832000000,
+ 833000000,
+ 834000000,
+ 835000000,
+ 836000000,
+ 837000000,
+ 838000000,
+ 839000000,
+ 840000000,
+ 841000000,
+ 842000000,
+ 843000000,
+ 844000000,
+ 845000000,
+ 846000000,
+ 847000000,
+ 848000000,
+ 849000000,
+ 850000000,
+ 851000000,
+ 852000000,
+ 853000000,
+ 854000000,
+ 855000000,
+ 856000000,
+ 857000000,
+ 858000000,
+ 859000000,
+ 860000000,
+ 861000000,
+ 862000000,
+ 863000000,
+ 864000000,
+ 865000000,
+ 866000000,
+ 867000000,
+ 868000000,
+ 869000000,
+ 870000000,
+ 871000000,
+ 872000000,
+ 873000000,
+ 874000000,
+ 875000000,
+ 876000000,
+ 877000000,
+ 878000000,
+ 879000000,
+ 880000000,
+ 881000000,
+ 882000000,
+ 883000000,
+ 884000000,
+ 885000000,
+ 886000000,
+ 887000000,
+ 888000000,
+ 889000000,
+ 890000000,
+ 891000000,
+ 892000000,
+ 893000000,
+ 894000000,
+ 895000000,
+ 896000000,
+ 897000000,
+ 898000000,
+ 899000000,
+ 900000000,
+ 901000000,
+ 902000000,
+ 903000000,
+ 904000000,
+ 905000000,
+ 906000000,
+ 907000000,
+ 908000000,
+ 909000000,
+ 910000000,
+ 911000000,
+ 912000000,
+ 913000000,
+ 914000000,
+ 915000000,
+ 916000000,
+ 917000000,
+ 918000000,
+ 919000000,
+ 920000000,
+ 921000000,
+ 922000000,
+ 923000000,
+ 924000000,
+ 925000000,
+ 926000000,
+ 927000000,
+ 928000000,
+ 929000000,
+ 930000000,
+ 931000000,
+ 932000000,
+ 933000000,
+ 934000000,
+ 935000000,
+ 936000000,
+ 937000000,
+ 938000000,
+ 939000000,
+ 940000000,
+ 941000000,
+ 942000000,
+ 943000000,
+ 944000000,
+ 945000000,
+ 946000000,
+ 947000000,
+ 948000000,
+ 949000000,
+ 950000000,
+ 951000000,
+ 952000000,
+ 953000000,
+ 954000000,
+ 955000000,
+ 956000000,
+ 957000000,
+ 958000000,
+ 959000000,
+ 960000000,
+ 961000000,
+ 962000000,
+ 963000000,
+ 964000000,
+ 965000000,
+ 966000000,
+ 967000000,
+ 968000000,
+ 969000000,
+ 970000000,
+ 971000000,
+ 972000000,
+ 973000000,
+ 974000000,
+ 975000000,
+ 976000000,
+ 977000000,
+ 978000000,
+ 979000000,
+ 980000000,
+ 981000000,
+ 982000000,
+ 983000000,
+ 984000000,
+ 985000000,
+ 986000000,
+ 987000000,
+ 988000000,
+ 989000000,
+ 990000000,
+ 991000000,
+ 992000000,
+ 993000000,
+ 994000000,
+ 995000000,
+ 996000000,
+ 997000000,
+ 998000000,
+ 999000000,
+1000000000 };
+uint ac_stable_length = 1000;
+#endif /* table_ac_stable */
diff --git a/cesar/cp/pwl/test/inc/table_decrease.h b/cesar/cp/pwl/test/inc/table_decrease.h
new file mode 100644
index 0000000000..4c1502802d
--- /dev/null
+++ b/cesar/cp/pwl/test/inc/table_decrease.h
@@ -0,0 +1,1006 @@
+#ifndef table_decrease_ac_decrease
+#define table_decrease_ac_decrease
+/* File generated by scilab */
+uint ac_decrease [1000] = {
+ 978868,
+ 1903264,
+ 2903242,
+ 3870210,
+ 4803672,
+ 5740833,
+ 6655859,
+ 7587286,
+ 8499465,
+ 9492628,
+ 10436544,
+ 11370309,
+ 12297674,
+ 13277823,
+ 14223398,
+ 15200191,
+ 16177069,
+ 17155423,
+ 18067085,
+ 19001834,
+ 19971074,
+ 20877778,
+ 21856318,
+ 22825054,
+ 23788891,
+ 24759669,
+ 25703027,
+ 26654763,
+ 27621546,
+ 28562196,
+ 29512043,
+ 30468358,
+ 31441427,
+ 32378170,
+ 33337651,
+ 34245804,
+ 35241431,
+ 36193246,
+ 37166851,
+ 38125370,
+ 39097306,
+ 40084506,
+ 41006675,
+ 41985485,
+ 42974272,
+ 43905704,
+ 44890392,
+ 45820684,
+ 46736529,
+ 47695909,
+ 48654961,
+ 49567120,
+ 50555737,
+ 51535754,
+ 52479568,
+ 53420607,
+ 54352068,
+ 55263006,
+ 56212584,
+ 57177648,
+ 58138911,
+ 59046683,
+ 59951802,
+ 60917449,
+ 61879848,
+ 62806439,
+ 63780282,
+ 64730348,
+ 65703963,
+ 66651428,
+ 67597666,
+ 68585667,
+ 69563104,
+ 70500364,
+ 71424280,
+ 72419425,
+ 73352186,
+ 74332015,
+ 75292900,
+ 76209897,
+ 77151110,
+ 78102819,
+ 79080491,
+ 79996483,
+ 80984424,
+ 81955871,
+ 82869796,
+ 83784855,
+ 84732285,
+ 85632973,
+ 86568088,
+ 87468857,
+ 88463853,
+ 89388998,
+ 90347958,
+ 91287113,
+ 92201671,
+ 93195245,
+ 94112455,
+ 95019832,
+ 95963160,
+ 96906044,
+ 97824443,
+ 98818754,
+ 99762795,
+ 100750302,
+ 101677510,
+ 102650733,
+ 103596080,
+ 104497226,
+ 105423270,
+ 106422899,
+ 107363894,
+ 108332930,
+ 109307408,
+ 110244890,
+ 111233316,
+ 112172146,
+ 113104307,
+ 114071107,
+ 115068520,
+ 116016776,
+ 116977608,
+ 117953473,
+ 118902829,
+ 119860468,
+ 120831531,
+ 121822652,
+ 122760524,
+ 123725975,
+ 124655327,
+ 125603213,
+ 126574509,
+ 127509482,
+ 128500669,
+ 129455682,
+ 130383410,
+ 131293643,
+ 132269365,
+ 133225988,
+ 134129218,
+ 135078533,
+ 136026204,
+ 136970235,
+ 137914062,
+ 138867245,
+ 139789300,
+ 140710290,
+ 141612205,
+ 142530335,
+ 143487767,
+ 144463152,
+ 145370857,
+ 146360850,
+ 147314068,
+ 148274564,
+ 149270903,
+ 150219150,
+ 151135896,
+ 152074848,
+ 153056137,
+ 154054242,
+ 154969907,
+ 155962422,
+ 156877094,
+ 157875849,
+ 158857174,
+ 159807969,
+ 160733073,
+ 161638924,
+ 162617684,
+ 163559734,
+ 164533453,
+ 165489844,
+ 166398739,
+ 167317913,
+ 168236887,
+ 169210983,
+ 170169593,
+ 171133594,
+ 172064467,
+ 172987899,
+ 173952173,
+ 174875240,
+ 175820464,
+ 176810842,
+ 177715231,
+ 178693157,
+ 179691725,
+ 180609811,
+ 181596762,
+ 182499942,
+ 183434329,
+ 184409874,
+ 185357043,
+ 186272354,
+ 187193588,
+ 188180968,
+ 189102130,
+ 190067600,
+ 191041002,
+ 191943904,
+ 192855152,
+ 193834485,
+ 194749234,
+ 195681788,
+ 196590260,
+ 197587412,
+ 198563734,
+ 199493581,
+ 200481556,
+ 201398682,
+ 202367072,
+ 203314021,
+ 204256870,
+ 205252090,
+ 206169604,
+ 207111616,
+ 208083698,
+ 208988247,
+ 209897536,
+ 210863935,
+ 211852179,
+ 212759642,
+ 213687006,
+ 214596912,
+ 215557423,
+ 216500872,
+ 217430258,
+ 218362380,
+ 219321051,
+ 220307029,
+ 221257506,
+ 222215558,
+ 223129296,
+ 224100721,
+ 225075600,
+ 226041709,
+ 227002490,
+ 227955675,
+ 228922059,
+ 229868691,
+ 230848301,
+ 231832402,
+ 232830584,
+ 233789601,
+ 234788543,
+ 235768890,
+ 236741635,
+ 237707259,
+ 238686922,
+ 239656803,
+ 240629178,
+ 241599733,
+ 242542553,
+ 243521136,
+ 244452182,
+ 245393627,
+ 246351586,
+ 247308811,
+ 248276966,
+ 249219348,
+ 250176799,
+ 251079180,
+ 252053991,
+ 253010080,
+ 254002487,
+ 254976894,
+ 255970188,
+ 256893677,
+ 257889504,
+ 258855122,
+ 259835421,
+ 260814193,
+ 261782790,
+ 262704574,
+ 263699165,
+ 264607263,
+ 265561228,
+ 266531302,
+ 267531011,
+ 268441077,
+ 269357198,
+ 270313761,
+ 271236083,
+ 272222130,
+ 273210624,
+ 274157070,
+ 275113953,
+ 276052500,
+ 276959911,
+ 277949973,
+ 278907168,
+ 279812850,
+ 280809577,
+ 281717445,
+ 282622955,
+ 283532885,
+ 284451942,
+ 285449423,
+ 286449227,
+ 287398475,
+ 288357715,
+ 289273635,
+ 290223463,
+ 291132176,
+ 292087819,
+ 293027982,
+ 293950564,
+ 294871344,
+ 295816298,
+ 296775448,
+ 297703274,
+ 298655589,
+ 299591659,
+ 300492021,
+ 301476274,
+ 302422768,
+ 303401478,
+ 304345564,
+ 305302515,
+ 306300235,
+ 307242621,
+ 308171130,
+ 309077914,
+ 310065588,
+ 311036933,
+ 312035686,
+ 312977992,
+ 313938606,
+ 314869721,
+ 315772698,
+ 316687541,
+ 317653608,
+ 318565883,
+ 319554569,
+ 320501928,
+ 321448955,
+ 322356038,
+ 323258384,
+ 324196130,
+ 325097905,
+ 326022476,
+ 326967929,
+ 327895069,
+ 328892544,
+ 329852293,
+ 330842462,
+ 331816376,
+ 332780013,
+ 333762547,
+ 334670206,
+ 335594155,
+ 336537753,
+ 337499783,
+ 338412021,
+ 339329847,
+ 340261977,
+ 341253757,
+ 342228230,
+ 343153786,
+ 344131091,
+ 345062722,
+ 345969072,
+ 346918542,
+ 347893294,
+ 348825106,
+ 349796743,
+ 350782649,
+ 351715058,
+ 352669932,
+ 353594502,
+ 354580800,
+ 355514718,
+ 356475818,
+ 357405800,
+ 358314120,
+ 359292892,
+ 360265914,
+ 361233916,
+ 362231595,
+ 363158941,
+ 364143601,
+ 365120049,
+ 366111252,
+ 367040193,
+ 367971306,
+ 368905353,
+ 369887202,
+ 370848153,
+ 371832284,
+ 372769877,
+ 373706117,
+ 374663413,
+ 375652697,
+ 376628875,
+ 377534246,
+ 378488480,
+ 379398836,
+ 380354452,
+ 381273557,
+ 382205240,
+ 383201839,
+ 384178034,
+ 385083114,
+ 386061287,
+ 386999741,
+ 387916606,
+ 388839266,
+ 389796825,
+ 390724204,
+ 391653205,
+ 392605748,
+ 393511362,
+ 394496766,
+ 395489625,
+ 396422288,
+ 397356919,
+ 398336951,
+ 399276810,
+ 400257817,
+ 401231978,
+ 402222100,
+ 403215901,
+ 404211867,
+ 405137866,
+ 406076240,
+ 407010405,
+ 407985260,
+ 408946827,
+ 409902863,
+ 410837456,
+ 411778675,
+ 412718467,
+ 413713932,
+ 414693638,
+ 415615196,
+ 416588821,
+ 417544989,
+ 418458341,
+ 419420420,
+ 420343733,
+ 421283667,
+ 422205100,
+ 423131229,
+ 424075787,
+ 424976496,
+ 425878922,
+ 426841826,
+ 427811504,
+ 428716309,
+ 429645031,
+ 430633108,
+ 431583017,
+ 432550117,
+ 433502028,
+ 434468992,
+ 435405948,
+ 436384777,
+ 437339917,
+ 438280772,
+ 439212705,
+ 440205313,
+ 441110977,
+ 442098114,
+ 443077924,
+ 444058231,
+ 444968945,
+ 445922766,
+ 446860254,
+ 447789657,
+ 448719476,
+ 449678597,
+ 450672235,
+ 451665662,
+ 452612352,
+ 453609037,
+ 454577459,
+ 455539601,
+ 456493406,
+ 457430533,
+ 458401748,
+ 459368828,
+ 460321636,
+ 461288099,
+ 462232569,
+ 463220609,
+ 464144470,
+ 465096561,
+ 466068392,
+ 467044592,
+ 468011650,
+ 468988583,
+ 469967221,
+ 470926672,
+ 471895719,
+ 472828090,
+ 473731021,
+ 474676604,
+ 475674557,
+ 476585144,
+ 477550241,
+ 478539188,
+ 479518955,
+ 480505909,
+ 481420170,
+ 482356390,
+ 483315679,
+ 484248760,
+ 485228334,
+ 486145230,
+ 487144009,
+ 488095165,
+ 488999667,
+ 489993793,
+ 490911209,
+ 491881402,
+ 492873645,
+ 493815185,
+ 494739898,
+ 495734726,
+ 496675140,
+ 497636803,
+ 498587801,
+ 499535074,
+ 500528185,
+ 501439755,
+ 502367843,
+ 503360901,
+ 504349379,
+ 505300753,
+ 506224038,
+ 507215233,
+ 508145148,
+ 509126357,
+ 510106179,
+ 511065551,
+ 512024585,
+ 513006890,
+ 513973761,
+ 514968577,
+ 515927085,
+ 516854873,
+ 517847127,
+ 518788569,
+ 519751490,
+ 520730329,
+ 521711297,
+ 522655218,
+ 523560971,
+ 524492794,
+ 525465452,
+ 526444735,
+ 527425356,
+ 528357378,
+ 529298542,
+ 530205225,
+ 531150134,
+ 532069729,
+ 533058985,
+ 533984946,
+ 534928843,
+ 535852232,
+ 536773926,
+ 537759538,
+ 538743067,
+ 539711293,
+ 540661028,
+ 541591824,
+ 542521759,
+ 543433053,
+ 544363256,
+ 545295267,
+ 546259108,
+ 547232369,
+ 548224633,
+ 549209692,
+ 550177674,
+ 551157414,
+ 552112426,
+ 553035351,
+ 554010999,
+ 554989738,
+ 555978746,
+ 556908932,
+ 557867423,
+ 558817125,
+ 559742009,
+ 560642608,
+ 561624321,
+ 562594102,
+ 563556248,
+ 564484717,
+ 565389476,
+ 566342437,
+ 567323728,
+ 568298157,
+ 569253807,
+ 570181467,
+ 571093848,
+ 572090115,
+ 573047181,
+ 574015609,
+ 574978785,
+ 575964198,
+ 576896515,
+ 577843896,
+ 578803860,
+ 579803569,
+ 580772888,
+ 581693862,
+ 582598083,
+ 583531191,
+ 584501895,
+ 585419657,
+ 586417859,
+ 587330752,
+ 588298942,
+ 589241698,
+ 590184312,
+ 591149392,
+ 592078720,
+ 593042728,
+ 594002205,
+ 594940797,
+ 595875557,
+ 596872606,
+ 597815918,
+ 598744778,
+ 599698894,
+ 600651689,
+ 601645452,
+ 602636908,
+ 603635563,
+ 604600133,
+ 605532940,
+ 606519334,
+ 607498137,
+ 608457978,
+ 609417616,
+ 610361333,
+ 611306023,
+ 612298334,
+ 613244727,
+ 614235725,
+ 615173545,
+ 616173533,
+ 617101336,
+ 618034724,
+ 618966732,
+ 619871591,
+ 620859522,
+ 621786333,
+ 622778017,
+ 623697798,
+ 624694894,
+ 625629865,
+ 626555587,
+ 627533821,
+ 628435937,
+ 629346685,
+ 630311573,
+ 631264117,
+ 632187123,
+ 633179780,
+ 634120834,
+ 635097045,
+ 636056282,
+ 637013234,
+ 638009527,
+ 638945486,
+ 639904179,
+ 640820210,
+ 641820189,
+ 642769336,
+ 643721787,
+ 644625537,
+ 645527557,
+ 646519701,
+ 647428201,
+ 648366475,
+ 649266834,
+ 650262149,
+ 651169690,
+ 652072792,
+ 653023630,
+ 653993860,
+ 654987830,
+ 655924696,
+ 656922286,
+ 657907012,
+ 658812201,
+ 659784759,
+ 660736812,
+ 661688255,
+ 662620615,
+ 663537403,
+ 664536145,
+ 665481608,
+ 666397341,
+ 667307050,
+ 668262956,
+ 669179633,
+ 670107294,
+ 671063523,
+ 672032717,
+ 672945219,
+ 673891661,
+ 674860802,
+ 675827256,
+ 676803832,
+ 677777938,
+ 678692723,
+ 679644506,
+ 680583554,
+ 681484826,
+ 682386712,
+ 683353681,
+ 684317790,
+ 685289985,
+ 686194151,
+ 687192588,
+ 688162945,
+ 689116086,
+ 690073466,
+ 691031290,
+ 692020942,
+ 692978145,
+ 693899538,
+ 694813858,
+ 695793924,
+ 696722611,
+ 697670522,
+ 698577405,
+ 699535967,
+ 700476166,
+ 701420675,
+ 702335146,
+ 703304169,
+ 704209708,
+ 705185282,
+ 706097678,
+ 707048936,
+ 708010496,
+ 709001273,
+ 709994219,
+ 710920831,
+ 711842910,
+ 712764634,
+ 713743019,
+ 714708818,
+ 715665809,
+ 716603192,
+ 717507650,
+ 718462235,
+ 719461943,
+ 720460874,
+ 721363411,
+ 722286369,
+ 723222403,
+ 724127045,
+ 725085561,
+ 726038946,
+ 727016562,
+ 727981993,
+ 728958587,
+ 729892394,
+ 730865483,
+ 731767181,
+ 732693248,
+ 733664227,
+ 734624268,
+ 735526346,
+ 736525591,
+ 737455381,
+ 738366306,
+ 739301037,
+ 740259675,
+ 741173859,
+ 742149899,
+ 743101699,
+ 744003214,
+ 744958517,
+ 745935219,
+ 746912874,
+ 747832849,
+ 748755342,
+ 749707092,
+ 750628644,
+ 751613298,
+ 752536070,
+ 753446550,
+ 754351877,
+ 755282059,
+ 756186468,
+ 757181628,
+ 758128393,
+ 759098925,
+ 760029154,
+ 760935392,
+ 761924637,
+ 762847003,
+ 763783269,
+ 764776639,
+ 765694945,
+ 766659472,
+ 767600867,
+ 768566257,
+ 769522010,
+ 770433784,
+ 771357348,
+ 772279707,
+ 773251631,
+ 774182545,
+ 775110798,
+ 776073597,
+ 776980343,
+ 777957777,
+ 778882566,
+ 779851819,
+ 780792026,
+ 781772788,
+ 782748918,
+ 783674210,
+ 784577079,
+ 785533376,
+ 786471128,
+ 787438215,
+ 788405252,
+ 789377566,
+ 790328837,
+ 791251517,
+ 792160742,
+ 793110620,
+ 794059025,
+ 795001099,
+ 795985636,
+ 796909525,
+ 797840446,
+ 798811714,
+ 799715289,
+ 800658682,
+ 801600861,
+ 802574227,
+ 803526757,
+ 804466022,
+ 805461925,
+ 806411800,
+ 807358841,
+ 808296247,
+ 809274054,
+ 810239380,
+ 811199869,
+ 812145441,
+ 813131134,
+ 814059480,
+ 814976791,
+ 815968753,
+ 816892406,
+ 817824694,
+ 818816686,
+ 819760370,
+ 820676369,
+ 821584940,
+ 822489279,
+ 823472514,
+ 824429055,
+ 825424880,
+ 826376553,
+ 827347660,
+ 828306503,
+ 829284501,
+ 830253055,
+ 831225716,
+ 832148798,
+ 833143313,
+ 834097990,
+ 835075362,
+ 836060495,
+ 837036145,
+ 837997700,
+ 838986288,
+ 839949792,
+ 840855998,
+ 841834610,
+ 842746533,
+ 843716280,
+ 844686922,
+ 845596244,
+ 846516650,
+ 847514627,
+ 848497407,
+ 849475410,
+ 850399921,
+ 851359028,
+ 852312221,
+ 853270133,
+ 854195329,
+ 855170773,
+ 856168196,
+ 857129440,
+ 858107521,
+ 859008779,
+ 859946921,
+ 860928591,
+ 861875460,
+ 862860409,
+ 863764794,
+ 864694845,
+ 865669011,
+ 866607459,
+ 867588429,
+ 868542354,
+ 869490154,
+ 870419616,
+ 871330868,
+ 872312286,
+ 873303061,
+ 874265265,
+ 875171572,
+ 876151767,
+ 877104747,
+ 878066959,
+ 879030663,
+ 880002730,
+ 880935516,
+ 881866427,
+ 882815380,
+ 883809274,
+ 884715921,
+ 885701432,
+ 886644220,
+ 887589622,
+ 888584456,
+ 889534346,
+ 890441737,
+ 891356268,
+ 892297698,
+ 893209780,
+ 894184460,
+ 895105421,
+ 896042123,
+ 896956100,
+ 897865904,
+ 898834317,
+ 899794307,
+ 900783199,
+ 901736148,
+ 902682521,
+ 903653737,
+ 904566336,
+ 905558928,
+ 906530779,
+ 907459942,
+ 908443416,
+ 909416743,
+ 910328549,
+ 911293178,
+ 912290532,
+ 913281916,
+ 914258777,
+ 915245371,
+ 916178131,
+ 917159102,
+ 918086027,
+ 919035543,
+ 919947632,
+ 920892188,
+ 921871556,
+ 922831440,
+ 923785847,
+ 924716076,
+ 925676417,
+ 926626579,
+ 927612055,
+ 928521302,
+ 929511210,
+ 930509439,
+ 931430063,
+ 932386972,
+ 933328539,
+ 934248997,
+ 935235091,
+ 936224964,
+ 937191796,
+ 938108352,
+ 939102853,
+ 940065893,
+ 940991361,
+ 941985643,
+ 942925647,
+ 943904790,
+ 944816802,
+ 945768974,
+ 946697814,
+ 947611956,
+ 948531174,
+ 949479575,
+ 950390402,
+951301979 };
+uint ac_decrease_length = 1000;
+#endif /* table_decrease_ac_decrease */
diff --git a/cesar/cp/pwl/test/inc/table_increase.h b/cesar/cp/pwl/test/inc/table_increase.h
new file mode 100644
index 0000000000..9ce6c22670
--- /dev/null
+++ b/cesar/cp/pwl/test/inc/table_increase.h
@@ -0,0 +1,1006 @@
+#ifndef table_increase_ac_increase
+#define table_increase_ac_increase
+/* File generated by scilab */
+uint ac_increase [1000] = {
+ 1000211,
+ 2000967,
+ 3000967,
+ 4001297,
+ 5001962,
+ 6002590,
+ 7003439,
+ 8004124,
+ 9005002,
+ 10005070,
+ 11005630,
+ 12006292,
+ 13007018,
+ 14007216,
+ 15007760,
+ 16007992,
+ 17008223,
+ 18008439,
+ 19009322,
+ 20009974,
+ 21010281,
+ 22011213,
+ 23011427,
+ 24011739,
+ 25012100,
+ 26012392,
+ 27012958,
+ 28013440,
+ 29013772,
+ 30014365,
+ 31014866,
+ 32015302,
+ 33015571,
+ 34016203,
+ 35016608,
+ 36017526,
+ 37017569,
+ 38018050,
+ 39018313,
+ 40018727,
+ 41019007,
+ 42019135,
+ 43019913,
+ 44020124,
+ 45020236,
+ 46020921,
+ 47021074,
+ 48021771,
+ 49022612,
+ 50023018,
+ 51023427,
+ 52024305,
+ 53024418,
+ 54024617,
+ 55025178,
+ 56025767,
+ 57026452,
+ 58027342,
+ 59027846,
+ 60028195,
+ 61028582,
+ 62029504,
+ 63030452,
+ 64030795,
+ 65031171,
+ 66031905,
+ 67032166,
+ 68032665,
+ 69032928,
+ 70033453,
+ 71033990,
+ 72034109,
+ 73034334,
+ 74034961,
+ 75035721,
+ 76035769,
+ 77036441,
+ 78036642,
+ 79037033,
+ 80037863,
+ 81038450,
+ 82038932,
+ 83039155,
+ 84039995,
+ 85040115,
+ 86040400,
+ 87041260,
+ 88042109,
+ 89042634,
+ 90043627,
+ 91044275,
+ 92045267,
+ 93045317,
+ 94046065,
+ 95046475,
+ 96047083,
+ 97047937,
+ 98048001,
+ 99048828,
+ 100049754,
+ 101050320,
+ 102050891,
+ 103051707,
+ 104051763,
+ 105052322,
+ 106052446,
+ 107053173,
+ 108053440,
+ 109053986,
+ 110054974,
+ 111055713,
+ 112055716,
+ 113056306,
+ 114056615,
+ 115056870,
+ 116057495,
+ 117057610,
+ 118058221,
+ 119058899,
+ 120059231,
+ 121059256,
+ 122059773,
+ 123060164,
+ 124060405,
+ 125060911,
+ 126061334,
+ 127061623,
+ 128061711,
+ 129062332,
+ 130062677,
+ 131063383,
+ 132063904,
+ 133064191,
+ 134064841,
+ 135064929,
+ 136065378,
+ 137066100,
+ 138066997,
+ 139067239,
+ 140067672,
+ 141068639,
+ 142069145,
+ 143069668,
+ 144070227,
+ 145070788,
+ 146071256,
+ 147072035,
+ 148072825,
+ 149073805,
+ 150074623,
+ 151075048,
+ 152075294,
+ 153076216,
+ 154076316,
+ 155076783,
+ 156077178,
+ 157077214,
+ 158077731,
+ 159078563,
+ 160079173,
+ 161079360,
+ 162079378,
+ 163080221,
+ 164080295,
+ 165081148,
+ 166081160,
+ 167081346,
+ 168081838,
+ 169082586,
+ 170083527,
+ 171083739,
+ 172084318,
+ 173084580,
+ 174085016,
+ 175085927,
+ 176086735,
+ 177087545,
+ 178087804,
+ 179088217,
+ 180088576,
+ 181089267,
+ 182090032,
+ 183090389,
+ 184091158,
+ 185091705,
+ 186091801,
+ 187092757,
+ 188092977,
+ 189092991,
+ 190093810,
+ 191093940,
+ 192094908,
+ 193095564,
+ 194095808,
+ 195096336,
+ 196097182,
+ 197097969,
+ 198098095,
+ 199098883,
+ 200099228,
+ 201099493,
+ 202100463,
+ 203101350,
+ 204101556,
+ 205102408,
+ 206103082,
+ 207103997,
+ 208104025,
+ 209104261,
+ 210104962,
+ 211105082,
+ 212105910,
+ 213106226,
+ 214106756,
+ 215107327,
+ 216107374,
+ 217108198,
+ 218108777,
+ 219109056,
+ 220110010,
+ 221110917,
+ 222111253,
+ 223111370,
+ 224112295,
+ 225113021,
+ 226113921,
+ 227114315,
+ 228114880,
+ 229115586,
+ 230116264,
+ 231116677,
+ 232116817,
+ 233117312,
+ 234117731,
+ 235118593,
+ 236118878,
+ 237119129,
+ 238119467,
+ 239119859,
+ 240120327,
+ 241120663,
+ 242121196,
+ 243121399,
+ 244121557,
+ 245121575,
+ 246121984,
+ 247121994,
+ 248122190,
+ 249122462,
+ 250122805,
+ 251123008,
+ 252123309,
+ 253123585,
+ 254123879,
+ 255124450,
+ 256124664,
+ 257125353,
+ 258125938,
+ 259126358,
+ 260126785,
+ 261127103,
+ 262127679,
+ 263128104,
+ 264129080,
+ 265129331,
+ 266129770,
+ 267129845,
+ 268130100,
+ 269130167,
+ 270130932,
+ 271130973,
+ 272131316,
+ 273131513,
+ 274131725,
+ 275132039,
+ 276132821,
+ 277132875,
+ 278133794,
+ 279134254,
+ 280134553,
+ 281134555,
+ 282135454,
+ 283136292,
+ 284136726,
+ 285137502,
+ 286137641,
+ 287137756,
+ 288138291,
+ 289138722,
+ 290139336,
+ 291140261,
+ 292140360,
+ 293140788,
+ 294141731,
+ 295141763,
+ 296142684,
+ 297143628,
+ 298144528,
+ 299145337,
+ 300145362,
+ 301145363,
+ 302145870,
+ 303146277,
+ 304147117,
+ 305147618,
+ 306148530,
+ 307148973,
+ 308149571,
+ 309150345,
+ 310151137,
+ 311151687,
+ 312152095,
+ 313152816,
+ 314153292,
+ 315153931,
+ 316154927,
+ 317155084,
+ 318155619,
+ 319155831,
+ 320156390,
+ 321156820,
+ 322156842,
+ 323157418,
+ 324158132,
+ 325159064,
+ 326159187,
+ 327159473,
+ 328159485,
+ 329160061,
+ 330160454,
+ 331161142,
+ 332162112,
+ 333162963,
+ 334163302,
+ 335164179,
+ 336164292,
+ 337164818,
+ 338165347,
+ 339166276,
+ 340167252,
+ 341167874,
+ 342168856,
+ 343169610,
+ 344170155,
+ 345170883,
+ 346170908,
+ 347171310,
+ 348171408,
+ 349171668,
+ 350172031,
+ 351172205,
+ 352173128,
+ 353173888,
+ 354174452,
+ 355174831,
+ 356175708,
+ 357176529,
+ 358177207,
+ 359177289,
+ 360177544,
+ 361178288,
+ 362178514,
+ 363179197,
+ 364180133,
+ 365180638,
+ 366180890,
+ 367181571,
+ 368181854,
+ 369181994,
+ 370182669,
+ 371183120,
+ 372183874,
+ 373184011,
+ 374184671,
+ 375185060,
+ 376185760,
+ 377186676,
+ 378186888,
+ 379187157,
+ 380187476,
+ 381187499,
+ 382188225,
+ 383188378,
+ 384188613,
+ 385188700,
+ 386189410,
+ 387190098,
+ 388190757,
+ 389190938,
+ 390191328,
+ 391191486,
+ 392192110,
+ 393192747,
+ 394193174,
+ 395193281,
+ 396193519,
+ 397194465,
+ 398194922,
+ 399195818,
+ 400196261,
+ 401197069,
+ 402197752,
+ 403197786,
+ 404198024,
+ 405198973,
+ 406199191,
+ 407199806,
+ 408200637,
+ 409201410,
+ 410201834,
+ 411202560,
+ 412203269,
+ 413203743,
+ 414204686,
+ 415204831,
+ 416204902,
+ 417205575,
+ 418206228,
+ 419206427,
+ 420207028,
+ 421207217,
+ 422207475,
+ 423207573,
+ 424207634,
+ 425207674,
+ 426208414,
+ 427209030,
+ 428209688,
+ 429209939,
+ 430210323,
+ 431210762,
+ 432211416,
+ 433212003,
+ 434212605,
+ 435212650,
+ 436212852,
+ 437213636,
+ 438213899,
+ 439214337,
+ 440215203,
+ 441215582,
+ 442216348,
+ 443216948,
+ 444217733,
+ 445218471,
+ 446219025,
+ 447220017,
+ 448220992,
+ 449221362,
+ 450221665,
+ 451222616,
+ 452223328,
+ 453223447,
+ 454223947,
+ 455224276,
+ 456224756,
+ 457225086,
+ 458225716,
+ 459225927,
+ 460226375,
+ 461226966,
+ 462227646,
+ 463227719,
+ 464228662,
+ 465228790,
+ 466228991,
+ 467229187,
+ 468230079,
+ 469230540,
+ 470231165,
+ 471231870,
+ 472232571,
+ 473232979,
+ 474233042,
+ 475233107,
+ 476233640,
+ 477233673,
+ 478233988,
+ 479234366,
+ 480234827,
+ 481235455,
+ 482235742,
+ 483236071,
+ 484236542,
+ 485236877,
+ 486237432,
+ 487237551,
+ 488238312,
+ 489238791,
+ 490239072,
+ 491239310,
+ 492239639,
+ 493239869,
+ 494240082,
+ 495240487,
+ 496240796,
+ 497241472,
+ 498242442,
+ 499242986,
+ 500243006,
+ 501243900,
+ 502244249,
+ 503244359,
+ 504244561,
+ 505244691,
+ 506245548,
+ 507246185,
+ 508246592,
+ 509247261,
+ 510247465,
+ 511248296,
+ 512248308,
+ 513248796,
+ 514249750,
+ 515249808,
+ 516250633,
+ 517250931,
+ 518251008,
+ 519251592,
+ 520252344,
+ 521252395,
+ 522252990,
+ 523253373,
+ 524253863,
+ 525254390,
+ 526254458,
+ 527255342,
+ 528256061,
+ 529256130,
+ 530256245,
+ 531256731,
+ 532257498,
+ 533257586,
+ 534258286,
+ 535258473,
+ 536258674,
+ 537259080,
+ 538259489,
+ 539259665,
+ 540259996,
+ 541260047,
+ 542260461,
+ 543261183,
+ 544261260,
+ 545261845,
+ 546262215,
+ 547262426,
+ 548262616,
+ 549263176,
+ 550264118,
+ 551264799,
+ 552265072,
+ 553265279,
+ 554265472,
+ 555266151,
+ 556266739,
+ 557267672,
+ 558268222,
+ 559269026,
+ 560269133,
+ 561269873,
+ 562270434,
+ 563271200,
+ 564271983,
+ 565272126,
+ 566272290,
+ 567272607,
+ 568273109,
+ 569273801,
+ 570274501,
+ 571275388,
+ 572276085,
+ 573276764,
+ 574277125,
+ 575277392,
+ 576277469,
+ 577277618,
+ 578277938,
+ 579278140,
+ 580278589,
+ 581279359,
+ 582279602,
+ 583279814,
+ 584279923,
+ 585280621,
+ 586281036,
+ 587281538,
+ 588282289,
+ 589283283,
+ 590283465,
+ 591283767,
+ 592284145,
+ 593284860,
+ 594285812,
+ 595286282,
+ 596286469,
+ 597286724,
+ 598287167,
+ 599287890,
+ 600288766,
+ 601288803,
+ 602289232,
+ 603289547,
+ 604289915,
+ 605290060,
+ 606290736,
+ 607291262,
+ 608291662,
+ 609291664,
+ 610291970,
+ 611292760,
+ 612293717,
+ 613294385,
+ 614294677,
+ 615295499,
+ 616295516,
+ 617296387,
+ 618296705,
+ 619297277,
+ 620297850,
+ 621298199,
+ 622298905,
+ 623299264,
+ 624299669,
+ 625300283,
+ 626300935,
+ 627300964,
+ 628301530,
+ 629302241,
+ 630302699,
+ 631303171,
+ 632303233,
+ 633303318,
+ 634303331,
+ 635303685,
+ 636304356,
+ 637304492,
+ 638304703,
+ 639305104,
+ 640305507,
+ 641306069,
+ 642306622,
+ 643306698,
+ 644307234,
+ 645307324,
+ 646307945,
+ 647307945,
+ 648308666,
+ 649309332,
+ 650310011,
+ 651310962,
+ 652311082,
+ 653311813,
+ 654311896,
+ 655312698,
+ 656312727,
+ 657313377,
+ 658314119,
+ 659314336,
+ 660315314,
+ 661316206,
+ 662316557,
+ 663317031,
+ 664317800,
+ 665317873,
+ 666318462,
+ 667318699,
+ 668319106,
+ 669319536,
+ 670319573,
+ 671320213,
+ 672320626,
+ 673321465,
+ 674321465,
+ 675321973,
+ 676322448,
+ 677323410,
+ 678324389,
+ 679324467,
+ 680325382,
+ 681325999,
+ 682326995,
+ 683327041,
+ 684327965,
+ 685328933,
+ 686329424,
+ 687329721,
+ 688329781,
+ 689330412,
+ 690330436,
+ 691330588,
+ 692331536,
+ 693331810,
+ 694332289,
+ 695332774,
+ 696333450,
+ 697334282,
+ 698334294,
+ 699334839,
+ 700335681,
+ 701336583,
+ 702337023,
+ 703337856,
+ 704338579,
+ 705339016,
+ 706339324,
+ 707340198,
+ 708340733,
+ 709341041,
+ 710341376,
+ 711341610,
+ 712341868,
+ 713342720,
+ 714343202,
+ 715343811,
+ 716344798,
+ 717345779,
+ 718346109,
+ 719346467,
+ 720346745,
+ 721347703,
+ 722347718,
+ 723348014,
+ 724348482,
+ 725348908,
+ 726349329,
+ 727349432,
+ 728349859,
+ 729350645,
+ 730351501,
+ 731351700,
+ 732352413,
+ 733352933,
+ 734353864,
+ 735354278,
+ 736354876,
+ 737355430,
+ 738356285,
+ 739356594,
+ 740357538,
+ 741357782,
+ 742358658,
+ 743359145,
+ 744359529,
+ 745359621,
+ 746359691,
+ 747360424,
+ 748361203,
+ 749361985,
+ 750362201,
+ 751362543,
+ 752362973,
+ 753363599,
+ 754364554,
+ 755365008,
+ 756365010,
+ 757365020,
+ 758365994,
+ 759366764,
+ 760367403,
+ 761368356,
+ 762368770,
+ 763369236,
+ 764369459,
+ 765369804,
+ 766370038,
+ 767370699,
+ 768370968,
+ 769371951,
+ 770372690,
+ 771372980,
+ 772373379,
+ 773374358,
+ 774374365,
+ 775375067,
+ 776375957,
+ 777376609,
+ 778377022,
+ 779377880,
+ 780378119,
+ 781378601,
+ 782379585,
+ 783380031,
+ 784380263,
+ 785380486,
+ 786381286,
+ 787382061,
+ 788382543,
+ 789383327,
+ 790383480,
+ 791384252,
+ 792385147,
+ 793386093,
+ 794386791,
+ 795387746,
+ 796387794,
+ 797388326,
+ 798388620,
+ 799389317,
+ 800390254,
+ 801390361,
+ 802391137,
+ 803391774,
+ 804391840,
+ 805392656,
+ 806393010,
+ 807393596,
+ 808393942,
+ 809394384,
+ 810395266,
+ 811396030,
+ 812396806,
+ 813397086,
+ 814397776,
+ 815398493,
+ 816398865,
+ 817399797,
+ 818400022,
+ 819400774,
+ 820401081,
+ 821401678,
+ 822401870,
+ 823402108,
+ 824402855,
+ 825403826,
+ 826404263,
+ 827404885,
+ 828405214,
+ 829405543,
+ 830405819,
+ 831406306,
+ 832407079,
+ 833407986,
+ 834408487,
+ 835409002,
+ 836409581,
+ 837409735,
+ 838410496,
+ 839411186,
+ 840411473,
+ 841412437,
+ 842413003,
+ 843413581,
+ 844413847,
+ 845414321,
+ 846414928,
+ 847414968,
+ 848415469,
+ 849415998,
+ 850416623,
+ 851416844,
+ 852417190,
+ 853417585,
+ 854418129,
+ 855418272,
+ 856418988,
+ 857419814,
+ 858419894,
+ 859420657,
+ 860421334,
+ 861421414,
+ 862421977,
+ 863422817,
+ 864423731,
+ 865424687,
+ 866424854,
+ 867425288,
+ 868425329,
+ 869425812,
+ 870426100,
+ 871426511,
+ 872426731,
+ 873427045,
+ 874427318,
+ 875428087,
+ 876428141,
+ 877428594,
+ 878428820,
+ 879428968,
+ 880429211,
+ 881429595,
+ 882429709,
+ 883430073,
+ 884431010,
+ 885431223,
+ 886432103,
+ 887432405,
+ 888432698,
+ 889433604,
+ 890434399,
+ 891434419,
+ 892434591,
+ 893434810,
+ 894435564,
+ 895435972,
+ 896436440,
+ 897436860,
+ 898437608,
+ 899437853,
+ 900437878,
+ 901438265,
+ 902438484,
+ 903439471,
+ 904440089,
+ 905440272,
+ 906440803,
+ 907440953,
+ 908441909,
+ 909442608,
+ 910442866,
+ 911443481,
+ 912443671,
+ 913444131,
+ 914444653,
+ 915445358,
+ 916446245,
+ 917446430,
+ 918446522,
+ 919446899,
+ 920447835,
+ 921448033,
+ 922448503,
+ 923448880,
+ 924449242,
+ 925449521,
+ 926450193,
+ 927450883,
+ 928451393,
+ 929451454,
+ 930452387,
+ 931452531,
+ 932453103,
+ 933453648,
+ 934453699,
+ 935454200,
+ 936455126,
+ 937455980,
+ 938456565,
+ 939457444,
+ 940457697,
+ 941458487,
+ 942459119,
+ 943459979,
+ 944460880,
+ 945461195,
+ 946461595,
+ 947461706,
+ 948462176,
+ 949462712,
+ 950462999,
+ 951463873,
+ 952463947,
+ 953464228,
+ 954464936,
+ 955465101,
+ 956465367,
+ 957466248,
+ 958466601,
+ 959466627,
+ 960466713,
+ 961466944,
+ 962467078,
+ 963467750,
+ 964467940,
+ 965468670,
+ 966469174,
+ 967470053,
+ 968470607,
+ 969470813,
+ 970471214,
+ 971471669,
+ 972472366,
+ 973472762,
+ 974473260,
+ 975473405,
+ 976474312,
+ 977474412,
+ 978474429,
+ 979475222,
+ 980475652,
+ 981476236,
+ 982477031,
+ 983477170,
+ 984477271,
+ 985477602,
+ 986478436,
+ 987478490,
+ 988478859,
+ 989479604,
+ 990479661,
+ 991480260,
+ 992480468,
+ 993481347,
+ 994481825,
+ 995482536,
+ 996483394,
+ 997484201,
+ 998484716,
+ 999485607,
+1000486491 };
+uint ac_increase_length = 1000;
+#endif /* table_increase_ac_increase */
diff --git a/cesar/cp/pwl/test/src/pwl.c b/cesar/cp/pwl/test/src/pwl.c
new file mode 100644
index 0000000000..930f7f882f
--- /dev/null
+++ b/cesar/cp/pwl/test/src/pwl.c
@@ -0,0 +1,344 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/pwl.c
+ * \brief Test the PWL Module.
+ * \ingroup cp_pwl
+ *
+ */
+#include "common/std.h"
+#include "lib/test.h"
+
+#include "mac/common/timings.h"
+
+#include "cp/cp.h"
+
+#include "cp/inc/context.h"
+
+#include <stdio.h>
+
+#include "cp/pwl/test/inc/table.h"
+#include "cp/pwl/test/inc/table_increase.h"
+#include "cp/pwl/test/inc/table_decrease.h"
+#include "cp/pwl/test/inc/result_stable.h"
+#include "cp/pwl/test/inc/result_increase.h"
+#include "cp/pwl/test/inc/result_decrease.h"
+
+
+enum test_pwl_phy_t
+{
+ TEST_PWL_PHY_NONE,
+ TEST_PWL_PHY_AC_STABLE,
+ TEST_PWL_PHY_AC_INC,
+ TEST_PWL_PHY_AC_DEC
+};
+
+uint i;
+uint zc_desired;
+uint phy_type;
+
+cyg_handle_t my_thread_handle;
+cyg_thread my_thread;
+u8 my_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
+
+/** Init
+ * \param test the test object.
+ *
+ * This shall initialise the PWL module.
+ * At the end of this test, the PWL module attributes shall be equal to 0.
+ */
+void
+test_case_pwl_init (test_t test)
+{
+ cp_t cp;
+
+ cp_pwl_init (&cp);
+
+ test_case_begin (test, "PWL Init");
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (cp.pwl.frequency != 0, "Freq not initialised");
+ test_fail_if (cp.pwl.bp_ntb != 0, "BP NTB not initialised");
+ test_fail_if (cp.pwl.zc_ntb != 0, "ZC NTB not initialised");
+ test_fail_if (cp.pwl.bp_avln_ntb[0] != 0, "BP AVLN not initialised");
+ test_fail_if (cp.pwl.bp_avln_ntb[1] != 0, "BP AVLN not initialised");
+ test_fail_if (cp.pwl.per_ntb != 0, "Per NTB not initialised");
+ test_fail_if (cp.pwl.bto[0] != 0, "BTO 0 not initialised");
+ test_fail_if (cp.pwl.bto[1] != 0, "BTO 1 not initialised");
+ test_fail_if (cp.pwl.bto[2] != 0, "BTO 2 not initialised");
+ test_fail_if (cp.pwl.bto[3] != 0, "BTO 3 not initialised");
+ test_fail_if (cp.pwl.date_ntb[0] != 0, "Date ntb 0 not initialised");
+ test_fail_if (cp.pwl.date_ntb[1] != 0, "Date ntb 1 not initialised");
+ }
+ test_end;
+}
+
+/** Frequency detection
+ * \param test the test object.
+ *
+ * Shall detect the 50, 60 Hz or the coaxial cable.
+ * Environment
+ * This shall be use in a THREAD cause of the cyg_thread_delay function
+ * it calls.
+ *
+ * On 50 Hz PWL
+ * It shall read the PRATIC register twice and compute the zero cross gap.
+ * At the end:
+ * * frequency == CP_PWL_FREQ_50
+ * * bp_ntb == CP_PWL_BP_50
+ * * zc_ntb == CP_PWL_ZC_50
+ *
+ * On 60 Hz PWL
+ * It shall read the PRATIC register twice and compute the zero cross gap.
+ * At the end:
+ * * frequency == CP_PWL_FREQ_60
+ * * bp_ntb == CP_PWL_BP_60
+ * * zc_ntb == CP_PWL_ZC_60
+ *
+ * On Coaxial
+ * It shall read the PRATIC register twice and compute the zero cross gap.
+ * At the end:
+ * * frequency == CP_PWL_FREQ_50
+ * * bp_ntb == CP_PWL_BP_50
+ * * zc_ntb == CP_PWL_ZC_50
+ */
+void
+test_case_pwl_frequency_detection (test_t test)
+{
+ cp_t cp;
+
+ test_case_begin (test, "Frequency detection");
+ cp.phy = (phy_t *) &cp;
+
+ // 50 Hz.
+ phy_type = TEST_PWL_PHY_NONE;
+ zc_desired = CP_PWL_ZC_50;
+ i = 0;
+
+ cp_pwl_acl_frequency_detection (&cp);
+
+ test_begin (test, "Frequency 50 Hz")
+ {
+ test_fail_if (cp.pwl.frequency != CP_PWL_FREQ_50, "Wrong frequency");
+ test_fail_if (cp.pwl.bp_ntb != CP_PWL_BP_50, "Wrong BP");
+ test_fail_if (cp.pwl.zc_ntb != CP_PWL_ZC_50, "Wrong ZC NTB");
+ test_fail_if (cp.pwl.discover_period_max_bp != 250, "Wrong interval");
+ }
+ test_end;
+
+
+ // 60 Hz.
+ zc_desired = CP_PWL_ZC_60;
+ i = 0;
+
+ cp_pwl_acl_frequency_detection (&cp);
+
+ test_begin (test, "Frequency 60 Hz")
+ {
+ test_fail_if (cp.pwl.frequency != CP_PWL_FREQ_60, "Wrong frequency");
+ test_fail_if (cp.pwl.bp_ntb != CP_PWL_BP_60, "Wrong BP");
+ test_fail_if (cp.pwl.zc_ntb != CP_PWL_ZC_60, "Wrong ZC NTB");
+ test_fail_if (cp.pwl.discover_period_max_bp != 300, "Wrong interval");
+ }
+ test_end;
+
+
+ // Coaxial.
+ zc_desired = 0;
+ i = 0;
+
+ cp_pwl_acl_frequency_detection (&cp);
+
+ test_begin (test, "Frequency coaxial")
+ {
+ test_fail_if (cp.pwl.frequency != CP_PWL_FREQ_50, "Wrong frequency");
+ test_fail_if (cp.pwl.bp_ntb != CP_PWL_BP_50, "Wrong BP");
+ test_fail_if (cp.pwl.zc_ntb != CP_PWL_ZC_50, "Wrong ZC NTB");
+ }
+ test_end;
+}
+
+/** Estimate beacon period
+ * \param test the test object.
+ *
+ * This test shall provide the same result as the scilab simulation.
+ * see cp/pwl/doc/scilab
+ */
+void
+test_case_pwl_estimate_beacon_period_ac_stable (test_t test)
+{
+ cp_t cp;
+ uint nb_iter;
+
+ test_case_begin (test, "Beacon period estimation");
+
+ *((uint*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((uint*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+
+ i = 0;
+ phy_type = TEST_PWL_PHY_AC_STABLE;
+
+ test_begin (test, "AC Stable : Verifying the period computed")
+ {
+ for (nb_iter = 0; nb_iter < ac_stable_length; nb_iter ++)
+ {
+ cp_pwl_estimate_beacon_period (&cp);
+
+ test_fail_if (cp.pwl.per_ntb != result_ac_stable[nb_iter],
+ "Estimation is false");
+ }
+ }
+ test_end;
+}
+
+/** Estimate beacon period, AC increase
+ * \param test the test object.
+ *
+ * This test shall provide the same result as the scilab simulation.
+ * see cp/pwl/doc/scilab
+ */
+void
+test_case_pwl_estimate_beacon_period_ac_increase (test_t test)
+{
+ cp_t cp;
+ uint nb_iter;
+
+ test_case_begin (test, "Beacon period estimation");
+
+ *((uint*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((uint*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+
+ cp.pwl.date_ntb[0] = 0;
+ cp.pwl.date_ntb[1] = 0;
+
+ i = 0;
+ phy_type = TEST_PWL_PHY_AC_INC;
+
+ test_begin (test, "AC Increase : Verifying the period computed")
+ {
+ for (nb_iter = 0; nb_iter < ac_stable_length; nb_iter ++)
+ {
+ cp_pwl_estimate_beacon_period (&cp);
+
+ test_fail_if (cp.pwl.per_ntb != result_ac_increase[nb_iter],
+ "Estimation is false");
+ }
+ }
+ test_end;
+}
+
+/** Estimate beacon period, AC decrease
+ * \param test the test object.
+ *
+ * This test shall provide the same result as the scilab simulation.
+ * see cp/pwl/doc/scilab
+ */
+void
+test_case_pwl_estimate_beacon_period_ac_decrease (test_t test)
+{
+ cp_t cp;
+ uint nb_iter;
+
+ test_case_begin (test, "Beacon period estimation");
+
+ *((uint*) &cp.pwl.frequency) = CP_PWL_FREQ_50;
+ *((uint*) &cp.pwl.bp_ntb) = CP_PWL_BP_50;
+ *((uint*) &cp.pwl.zc_ntb) = CP_PWL_ZC_50;
+
+ cp.pwl.date_ntb[0] = 0;
+ cp.pwl.date_ntb[1] = 0;
+
+ i = 0;
+ phy_type = TEST_PWL_PHY_AC_DEC;
+
+ test_begin (test, "AC Decrease : Verifying the period computed")
+ {
+ for (nb_iter = 0; nb_iter < ac_stable_length; nb_iter ++)
+ {
+ cp_pwl_estimate_beacon_period (&cp);
+
+ test_fail_if (cp.pwl.per_ntb != result_ac_decrease[nb_iter],
+ "Estimation is false");
+ }
+ }
+ test_end;
+}
+
+
+
+void
+my_thread_entry (cyg_addrword_t data)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_pwl_init (test);
+ test_case_pwl_frequency_detection (test);
+ test_case_pwl_estimate_beacon_period_ac_stable (test);
+ test_case_pwl_estimate_beacon_period_ac_increase (test);
+ test_case_pwl_estimate_beacon_period_ac_decrease (test);
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+}
+
+int
+main (void)
+{
+ // Create the thread object.
+ cyg_thread_create( 1, my_thread_entry, 0, "PWL", my_thread_stack,
+ CYGNUM_HAL_STACK_SIZE_TYPICAL, &my_thread_handle,
+ &my_thread);
+
+
+ // Activate the thread.
+ cyg_thread_resume (my_thread_handle);
+
+ return 0;
+}
+
+u32
+phy_clock_get_zero_cross_captured_date (phy_t *ctx)
+{
+ switch (phy_type)
+ {
+ case TEST_PWL_PHY_NONE:
+ if (i == 0)
+ {
+ i ++;
+ return 0;
+ }
+ else
+ {
+ return zc_desired;
+ }
+ break;
+ case TEST_PWL_PHY_AC_STABLE:
+ if (i == ac_stable_length)
+ return 0;
+ return ac_stable[i++];
+ break;
+ case TEST_PWL_PHY_AC_INC:
+ if (i == ac_increase_length)
+ return 0;
+ return ac_increase[i++];
+ break;
+ case TEST_PWL_PHY_AC_DEC:
+ if (i == ac_decrease_length)
+ return 0;
+ return ac_decrease[i++];
+ break;
+ }
+
+ return 0;
+}
+
diff --git a/cesar/cp/secu/Module b/cesar/cp/secu/Module
new file mode 100644
index 0000000000..c049dc3ec5
--- /dev/null
+++ b/cesar/cp/secu/Module
@@ -0,0 +1 @@
+SOURCES := sha256.c aes.c pbkdf1.c secu.c
diff --git a/cesar/cp/secu/aes.h b/cesar/cp/secu/aes.h
new file mode 100644
index 0000000000..ac47285ef6
--- /dev/null
+++ b/cesar/cp/secu/aes.h
@@ -0,0 +1,234 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/aes.h
+ * \brief AES method
+ * \ingroup cp_secu
+ */
+#include "lib/bitstream.h"
+
+#ifndef uint8
+#define uint8 unsigned char
+#endif
+
+#ifndef uint32
+#define uint32 unsigned long
+#endif
+
+#ifdef __sparc__
+ #ifndef GET_UINT32_BE
+ #define GET_UINT32_BE(n,b,i) \
+ { \
+ (n) = ( (uint32) (b)[(i)] ) \
+ | ( (uint32) (b)[(i) + 1] << 8 ) \
+ | ( (uint32) (b)[(i) + 2] << 16 ) \
+ | ( (uint32) (b)[(i) + 3] << 24 ); \
+ }
+ #endif
+ #ifndef PUT_UINT32_BE
+ #define PUT_UINT32_BE(n,b,i) \
+ { \
+ (b)[(i) ] = (uint8) ( (n) ); \
+ (b)[(i) + 1] = (uint8) ( (n) >> 8 ); \
+ (b)[(i) + 2] = (uint8) ( (n) >> 16 ); \
+ (b)[(i) + 3] = (uint8) ( (n) >> 24 ); \
+ }
+ #endif
+#else
+ /*
+ * 32-bit integer manipulation macros (big endian)
+ */
+ #ifndef GET_UINT32_BE
+ #define GET_UINT32_BE(n,b,i) \
+ { \
+ (n) = ( (uint32) (b)[(i)] << 24 ) \
+ | ( (uint32) (b)[(i) + 1] << 16 ) \
+ | ( (uint32) (b)[(i) + 2] << 8 ) \
+ | ( (uint32) (b)[(i) + 3] ); \
+ }
+ #endif
+ #ifndef PUT_UINT32_BE
+ #define PUT_UINT32_BE(n,b,i) \
+ { \
+ (b)[(i) ] = (uint8) ( (n) >> 24 ); \
+ (b)[(i) + 1] = (uint8) ( (n) >> 16 ); \
+ (b)[(i) + 2] = (uint8) ( (n) >> 8 ); \
+ (b)[(i) + 3] = (uint8) ( (n) ); \
+ }
+ #endif
+#endif
+
+#ifndef _AES_H
+#define _AES_H
+
+#include <string.h>
+
+/**
+ * \brief AES context structure
+ */
+typedef struct
+{
+ unsigned long erk[64]; /*!< encryption round keys */
+ unsigned long drk[64]; /*!< decryption round keys */
+ int nr; /*!< number of rounds */
+} aes_context;
+
+/**
+ * \brief AES key schedule
+ *
+ * \param ctx AES context to be initialized
+ * \param key the secret key
+ */
+void
+aes_set_key (aes_context *ctx, unsigned char *key);
+
+/**
+ * \brief AES block encryption (ECB mode)
+ *
+ * \param ctx AES context
+ * \param input plaintext block (16 bytes)
+ * \param output ciphertext block (16 bytes)
+ */
+void
+aes_encrypt (aes_context *ctx, unsigned char input[16],
+ unsigned char output[16]);
+
+/**
+ * \brief AES block encryption (ECB mode) SPC300
+ *
+ * \param ctx AES context
+ * \param input plaintext block (16 bytes)
+ * \param output ciphertext block (16 bytes)
+ */
+extern inline void
+aes_encrypt_le (aes_context *ctx, unsigned char buffer[16])
+{
+ u32 tmp[4] __attribute__((aligned (16)));
+
+ dbg_assert (ctx);
+
+ bitstream_memcpy (tmp, buffer, 16);
+ aes_encrypt (ctx, (unsigned char *) tmp, (unsigned char *) tmp);
+ bitstream_memcpy (buffer, tmp, 16);
+}
+
+/**
+ * \brief AES block decryption (ECB mode)
+ *
+ * \param ctx AES context
+ * \param input ciphertext block (16 bytes)
+ * \param output plaintext block (16 bytes)
+ */
+void
+aes_decrypt (aes_context *ctx, unsigned char input[16],
+ unsigned char output[16]);
+
+/**
+ * \brief AES block decryption (ECB mode) SPC300
+ *
+ * \param ctx AES context
+ * \param input plaintext block (16 bytes)
+ * \param output ciphertext block (16 bytes)
+ */
+extern inline void
+aes_decrypt_le (aes_context *ctx, unsigned char buffer[16])
+{
+ u32 tmp[4] __attribute__((aligned (16)));
+
+ dbg_assert (ctx);
+
+ bitstream_memcpy (tmp, buffer, 16);
+ aes_decrypt (ctx, (unsigned char *) tmp, (unsigned char *) tmp);
+ bitstream_memcpy (buffer, tmp, 16);
+}
+
+/**
+ * \brief AES-CBC buffer encryption
+ *
+ * \param ctx AES context
+ * \param iv initialization vector (modified after use) (16 bytes)
+ * \param input buffer holding the plaintext
+ * \param output buffer holding the ciphertext
+ * \param len length of the data to be encrypted
+ */
+void
+aes_cbc_encrypt (aes_context *ctx, unsigned char iv[16],
+ unsigned char *input, unsigned char *output, int len);
+
+/**
+ * \brief AES-CBC buffer encryption Specific to the SPC300
+ * Architecture.
+ *
+ * \param ctx AES context
+ * \param iv initialization vector (modified after use) (16 bytes)
+ * \param input buffer holding the plaintext
+ * \param output buffer holding the ciphertext
+ * \param len length of the data to be encrypted
+ */
+extern inline void
+aes_cbc_encrypt_le (aes_context *ctx, unsigned char iv[16],
+ unsigned char *buffer, uint len)
+{
+ u32 tmp[4] __attribute__((aligned(16)));
+ uint i;
+
+ dbg_assert (ctx);
+ dbg_assert (buffer);
+
+ for (i = 0; i < len; i += 16)
+ {
+ bitstream_memcpy (tmp, buffer + i, 16);
+ aes_cbc_encrypt (ctx, iv, (unsigned char *) tmp,
+ (unsigned char *) tmp, 16);
+ bitstream_memcpy (buffer + i, tmp, 16);
+ }
+}
+
+/**
+ * \brief AES-CBC buffer decryption
+ *
+ * \param ctx AES context
+ * \param iv initialization vector (modified after use)
+ * \param input buffer holding the ciphertext
+ * \param output buffer holding the plaintext
+ * \param len length of the data to be decrypted
+ */
+void
+aes_cbc_decrypt (aes_context *ctx, unsigned char iv[16],
+ unsigned char *input, unsigned char *output, int len);
+
+/**
+ * \brief AES-CBC buffer decryption Specific to the SPC300
+ * Architecture.
+ *
+ * \param ctx AES context
+ * \param iv initialization vector (modified after use) (16 bytes)
+ * \param input buffer holding the plaintext
+ * \param output buffer holding the ciphertext
+ * \param len length of the data to be encrypted
+ */
+extern inline void
+aes_cbc_decrypt_le (aes_context *ctx, unsigned char iv[16],
+ unsigned char *buffer, uint len)
+{
+ u32 tmp[4] __attribute__((aligned(16)));
+ uint i;
+
+ dbg_assert (ctx);
+ dbg_assert (buffer);
+
+ for (i = 0; i < len; i += 16)
+ {
+ bitstream_memcpy (tmp, buffer + i, 16);
+ aes_cbc_decrypt (ctx, iv, (unsigned char *) tmp,
+ (unsigned char *) tmp, 16);
+ bitstream_memcpy (buffer + i, tmp, 16);
+ }
+}
+
+#endif /* aes.h */
diff --git a/cesar/cp/secu/defs.h b/cesar/cp/secu/defs.h
new file mode 100644
index 0000000000..b0bd9feb8e
--- /dev/null
+++ b/cesar/cp/secu/defs.h
@@ -0,0 +1,38 @@
+#ifndef cp_secu_defs_h
+#define cp_secu_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/defs.h
+ * \brief Length definitions for the security module.
+ * \ingroup cp_secu
+ *
+ */
+
+/** MAX PASSWORD SIZE. */
+#define CP_SECU_PWD_SIZE_MAX 64
+
+/** Salt size. */
+#define CP_SECU_SALT_SIZE 8
+
+/** SHA 256 output size. */
+#define CP_SECU_SHA256_OUTPUT_SIZE 32
+
+/** pbkdf1 generated key size */
+#define CP_SECU_OUTPUT_KEY_SIZE 16
+
+/** PBKDF1 iteration. */
+#define CP_SECU_PBKDF1_ITERATION 1000
+
+/** PBKDF1 iteration for NID. */
+#define CP_SECU_PBKDF1_ITERATION_NID 5
+
+/** AES Size. */
+#define CP_SECU_AES_SIZE 16
+
+#endif /* cp_secu_defs_h */
diff --git a/cesar/cp/secu/inc/pbkdf1.h b/cesar/cp/secu/inc/pbkdf1.h
new file mode 100644
index 0000000000..bc5a4012b1
--- /dev/null
+++ b/cesar/cp/secu/inc/pbkdf1.h
@@ -0,0 +1,31 @@
+#ifndef cp_secu_inc_pbkdf1_h
+#define cp_secu_inc_pbkdf1_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/inc/pbkdf1.h
+ * \brief PBKDF1 function.
+ * \ingroup cp_secu
+ *
+ */
+
+/**
+ * pbkdf1
+ * \param input the input data to hash (can be a clear ascii password)
+ * \param input_len length of input
+ * \param salt salt to apply to input data
+ * \param salt_len length of salt
+ * \param it_count iteration number for the hash function
+ * \param outputkey the output buffer.
+ */
+void
+secu_pbkdf1 (u8 input[], uint input_len, u8 salt[],
+ uint salt_len, uint it_count, u8 output_key[]);
+
+
+#endif /* cp_secu_inc_pbkdf1_h */
diff --git a/cesar/cp/secu/inc/sha256.h b/cesar/cp/secu/inc/sha256.h
new file mode 100644
index 0000000000..cf883a2eb2
--- /dev/null
+++ b/cesar/cp/secu/inc/sha256.h
@@ -0,0 +1,25 @@
+#ifndef _SHA256_H
+#define _SHA256_H
+
+#ifndef uint8
+#define uint8 unsigned char
+#endif
+
+#ifndef uint32
+#define uint32 unsigned long int
+#endif
+
+typedef struct
+{
+ uint32 total[2];
+ uint32 state[8];
+ uint8 buffer[64];
+}
+sha256_context;
+
+void sha256_starts( sha256_context *ctx );
+void sha256_update( sha256_context *ctx, uint8 *input, uint32 length );
+void sha256_finish( sha256_context *ctx, uint8 digest[32] );
+
+#endif /* sha256.h */
+
diff --git a/cesar/cp/secu/pbkdf1.h b/cesar/cp/secu/pbkdf1.h
new file mode 100644
index 0000000000..a8de0a5106
--- /dev/null
+++ b/cesar/cp/secu/pbkdf1.h
@@ -0,0 +1,35 @@
+#ifndef CP2_SECU_PBKDF1_H_
+#define CP2_SECU_PBKDF1_H_
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/pbkdf1.h
+ * \brief Fonction PBKDF1.
+ * \ingroup cp_secu
+ */
+
+enum cp_secu_salt_kind_t
+{
+ CP_SECU_SALT_KEY_DAK,
+ CP_SECU_SALT_KEY_NMK_HS,
+ CP_SECU_SALT_KEY_NID,
+ CP_SECU_SALT_SPIDCOM,
+ CP_SECU_SALT_KEY_NB
+};
+typedef enum cp_secu_salt_kind_t cp_secu_salt_kind_t;
+
+/**
+ * PBKDF1 functions for the Secu module.
+ * \param buffer the input buffer.
+ * \param length the buffer length.
+ * \param key key kind.
+ */
+void
+cp_secu_pbkdf1 (u8 *buffer, uint length, cp_secu_salt_kind_t key);
+
+#endif /* CP2_SECU_PBKDF1_H_ */
diff --git a/cesar/cp/secu/secu.h b/cesar/cp/secu/secu.h
new file mode 100644
index 0000000000..bf5eea3b4d
--- /dev/null
+++ b/cesar/cp/secu/secu.h
@@ -0,0 +1,135 @@
+#ifndef secu__h__
+#define secu__h__
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file Cesare/cp/secu/secu.h
+ * \brief library of security related functions (crypto, ...)
+ * \ingroup cp/secu
+ *
+ * « long description »
+ */
+
+#include "cp/secu/pbkdf1.h"
+#include "cp/secu/aes.h"
+
+/** Data associated with a protocol run. */
+struct cp_secu_protocol_run_t
+{
+ /** Protocol identifier. */
+ u8 pid;
+ /** Protocol message number. */
+ u8 pmn;
+ /** Protocol run number. */
+ u16 prn;
+ /** My nonce. */
+ u32 my_nonce;
+ /** Other STA nonce. */
+ u32 your_nonce;
+};
+typedef struct cp_secu_protocol_run_t cp_secu_protocol_run_t;
+
+/** Protocol run check result. */
+enum cp_secu_protocol_run_check_result_t
+{
+ /** Correspond to the next message in the protocol run. */
+ CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT,
+ /** Correspond to the first message of a new protocol run. */
+ CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEW,
+ /** Does not correspond to anything, should drop this message. */
+ CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE,
+};
+
+BEGIN_DECLS
+
+/**
+ * Start a new protocol run and initialise the protocol run structure.
+ * \param prun protocol run to initialise.
+ * \param pid protocol identifier
+ * \param prun_rand the random number for the PRN.
+ * \param rand a random number.
+ */
+void
+cp_secu_protocol_run_new (cp_secu_protocol_run_t *prun, u8 pid,
+ uint prn_rand, uint rand);
+
+/**
+ * Check a received protocol run against the current one.
+ * \param prun current protocol run
+ * \param prun_recv received protocol run
+ * \return whether this is a new or old protocol run, or garbage
+ *
+ * The current protocol run can be NULL if there is no current protocol run.
+ * You can also use a pointer to an initialised protocol run if it is more
+ * convenient.
+ */
+enum cp_secu_protocol_run_check_result_t
+cp_secu_protocol_check (const cp_secu_protocol_run_t *prun,
+ const cp_secu_protocol_run_t *prun_recv);
+
+/**
+ * Update a protocol run for the next message.
+ * \param prun current protocol run
+ * \param last whether this is the last message
+ *
+ * Received protocol run should have been copied to the current one before
+ * this call.
+ */
+void
+cp_secu_protocol_next (cp_secu_protocol_run_t *prun, bool last);
+
+/**
+ * Generate the AES key.
+ * \param num a random number.
+ * \param output the key generated.
+ */
+void
+cp_secu_aes_generate_key (uint num, u8 *output);
+
+/**
+ * Generate the NMK from the NPW.
+ * \param buffer the buffer containing the NPW
+ * \param the buffer length.
+ *
+ * \warn the buffer provided will be replace by the hashed value.
+ */
+extern inline void
+cp_secu_npw2nmk (u8 *buffer, uint length)
+{
+ dbg_assert (buffer);
+
+ cp_secu_pbkdf1 (buffer, length, CP_SECU_SALT_KEY_NMK_HS);
+}
+
+/**
+ * Generate the DAK.
+ * \param buffer the buffer containing the NPW
+ * \param length the buffer length.
+ *
+ * \warn the buffer provided will be replace by the hashed value.
+ */
+extern inline void
+cp_secu_dak_gen (u8 *buffer, uint length)
+{
+ dbg_assert (buffer);
+
+ cp_secu_pbkdf1 (buffer, length, CP_SECU_SALT_KEY_DAK);
+}
+
+/**
+ * Generate the NID from the NMK and the security level.
+ * \param buffer the buffer containing the NMK.
+ * \param the Security level.
+ * \warn the buffer will contain the NID at the end.
+ */
+void
+cp_secu_nmk2nid(u8 *buffer, u8 security_level);
+
+END_DECLS
+
+#endif
diff --git a/cesar/cp/secu/sha256.h b/cesar/cp/secu/sha256.h
new file mode 100644
index 0000000000..679cec1b8d
--- /dev/null
+++ b/cesar/cp/secu/sha256.h
@@ -0,0 +1,27 @@
+#ifndef cp_secu_sha256_h
+#define cp_secu_sha256_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/sha256.h
+ * \brief SHA 256.
+ * \ingroup cp_secu
+ *
+ * see http://en.wikipedia.org/wiki/SHA256#SHA-2
+ */
+
+/** SHA 256
+ * \param data the buffer containing the data to hash.
+ * \param length the buffer length.
+ * \param the output buffer (can be the same as the input).
+ * \return the buffer with the hashed value.
+ */
+void
+cp_secu_sha256 (u8 *data, uint length, u8 *output);
+
+#endif /* cp_secu_sha256_h */
diff --git a/cesar/cp/secu/src/aes.c b/cesar/cp/secu/src/aes.c
new file mode 100644
index 0000000000..c4a1fe283b
--- /dev/null
+++ b/cesar/cp/secu/src/aes.c
@@ -0,0 +1,742 @@
+#ifndef _CRT_SECURE_NO_DEPRECATE
+#define _CRT_SECURE_NO_DEPRECATE 1
+#endif
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/secu_aes.c
+ * \brief AES functions
+ * \ingroup cp_
+ */
+
+#include "common/std.h"
+#include "cp/secu/aes.h"
+
+#include <stdio.h>
+
+/*
+ * Uncomment the following line to use pre-computed tables,
+ * otherwise the tables will be generated at the first run.
+ */
+#define FIXED_TABLES
+
+#if !defined(FIXED_TABLES)
+
+/*
+ * Forward S-box & tables
+ */
+static uint8 FSb[256];
+static uint32 FT0[256];
+static uint32 FT1[256];
+static uint32 FT2[256];
+static uint32 FT3[256];
+
+/*
+ * Reverse S-box & tables
+ */
+static uint8 RSb[256];
+static uint32 RT0[256];
+static uint32 RT1[256];
+static uint32 RT2[256];
+static uint32 RT3[256];
+
+/*
+ * Round constants
+ */
+static uint32 RCON[10];
+
+/*
+ * Tables generation code
+ */
+#define ROTR8(x) ( ( ( x << 24 ) & 0xFFFFFFFF ) | \
+ ( ( x & 0xFFFFFFFF ) >> 8 ) )
+#define XTIME(x) ( ( x << 1 ) ^ ( ( x & 0x80 ) ? 0x1B : 0x00 ) )
+#define MUL(x,y) ( ( x && y ) ? pow[(log[x] + log[y]) % 255] : 0 )
+
+static void aes_gen_tables( void )
+{
+ int i;
+ uint8 x, y;
+ uint8 pow[256];
+ uint8 log[256];
+
+ /*
+ * compute pow and log tables over GF(2^8)
+ */
+ for( i = 0, x = 1; i < 256; i++, x ^= XTIME( x ) )
+ {
+ pow[i] = x;
+ log[x] = i;
+ }
+ /*
+ * calculate the round constants
+ */
+ for( i = 0, x = 1; i < 10; i++, x = XTIME( x ) )
+ {
+ RCON[i] = (uint32) x << 24;
+ }
+ /*
+ * generate the forward and reverse S-boxes
+ */
+ FSb[0x00] = 0x63;
+ RSb[0x63] = 0x00;
+
+ for( i = 1; i < 256; i++ )
+ {
+ x = pow[255 - log[i]];
+
+ y = x; y = ( y << 1 ) | ( y >> 7 );
+ x ^= y; y = ( y << 1 ) | ( y >> 7 );
+ x ^= y; y = ( y << 1 ) | ( y >> 7 );
+ x ^= y; y = ( y << 1 ) | ( y >> 7 );
+ x ^= y ^ 0x63;
+
+ FSb[i] = x;
+ RSb[x] = i;
+ }
+
+ /*
+ * generate the forward and reverse tables
+ */
+ for( i = 0; i < 256; i++ )
+ {
+ x = FSb[i]; y = XTIME( x );
+
+ FT0[i] = (uint32) ( x ^ y ) ^
+ ( (uint32) x << 8 ) ^
+ ( (uint32) x << 16 ) ^
+ ( (uint32) y << 24 );
+
+ FT0[i] &= 0xFFFFFFFF;
+
+ FT1[i] = ROTR8( FT0[i] );
+ FT2[i] = ROTR8( FT1[i] );
+ FT3[i] = ROTR8( FT2[i] );
+
+ y = RSb[i];
+
+ RT0[i] = ( (uint32) MUL( 0x0B, y ) ) ^
+ ( (uint32) MUL( 0x0D, y ) << 8 ) ^
+ ( (uint32) MUL( 0x09, y ) << 16 ) ^
+ ( (uint32) MUL( 0x0E, y ) << 24 );
+
+ RT0[i] &= 0xFFFFFFFF;
+
+ RT1[i] = ROTR8( RT0[i] );
+ RT2[i] = ROTR8( RT1[i] );
+ RT3[i] = ROTR8( RT2[i] );
+ }
+}
+
+#else
+
+/*
+ * Forward S-box
+ */
+static const uint8 FSb[256] = { 0x63, 0x7C, 0x77, 0x7B, 0xF2, 0x6B, 0x6F,
+ 0xC5, 0x30, 0x01, 0x67, 0x2B, 0xFE, 0xD7, 0xAB, 0x76, 0xCA, 0x82,
+ 0xC9, 0x7D, 0xFA, 0x59, 0x47, 0xF0, 0xAD, 0xD4, 0xA2, 0xAF, 0x9C,
+ 0xA4, 0x72, 0xC0, 0xB7, 0xFD, 0x93, 0x26, 0x36, 0x3F, 0xF7, 0xCC,
+ 0x34, 0xA5, 0xE5, 0xF1, 0x71, 0xD8, 0x31, 0x15, 0x04, 0xC7, 0x23,
+ 0xC3, 0x18, 0x96, 0x05, 0x9A, 0x07, 0x12, 0x80, 0xE2, 0xEB, 0x27,
+ 0xB2, 0x75, 0x09, 0x83, 0x2C, 0x1A, 0x1B, 0x6E, 0x5A, 0xA0, 0x52,
+ 0x3B, 0xD6, 0xB3, 0x29, 0xE3, 0x2F, 0x84, 0x53, 0xD1, 0x00, 0xED,
+ 0x20, 0xFC, 0xB1, 0x5B, 0x6A, 0xCB, 0xBE, 0x39, 0x4A, 0x4C, 0x58,
+ 0xCF, 0xD0, 0xEF, 0xAA, 0xFB, 0x43, 0x4D, 0x33, 0x85, 0x45, 0xF9,
+ 0x02, 0x7F, 0x50, 0x3C, 0x9F, 0xA8, 0x51, 0xA3, 0x40, 0x8F, 0x92,
+ 0x9D, 0x38, 0xF5, 0xBC, 0xB6, 0xDA, 0x21, 0x10, 0xFF, 0xF3, 0xD2,
+ 0xCD, 0x0C, 0x13, 0xEC, 0x5F, 0x97, 0x44, 0x17, 0xC4, 0xA7, 0x7E,
+ 0x3D, 0x64, 0x5D, 0x19, 0x73, 0x60, 0x81, 0x4F, 0xDC, 0x22, 0x2A,
+ 0x90, 0x88, 0x46, 0xEE, 0xB8, 0x14, 0xDE, 0x5E, 0x0B, 0xDB, 0xE0,
+ 0x32, 0x3A, 0x0A, 0x49, 0x06, 0x24, 0x5C, 0xC2, 0xD3, 0xAC, 0x62,
+ 0x91, 0x95, 0xE4, 0x79, 0xE7, 0xC8, 0x37, 0x6D, 0x8D, 0xD5, 0x4E,
+ 0xA9, 0x6C, 0x56, 0xF4, 0xEA, 0x65, 0x7A, 0xAE, 0x08, 0xBA, 0x78,
+ 0x25, 0x2E, 0x1C, 0xA6, 0xB4, 0xC6, 0xE8, 0xDD, 0x74, 0x1F, 0x4B,
+ 0xBD, 0x8B, 0x8A, 0x70, 0x3E, 0xB5, 0x66, 0x48, 0x03, 0xF6, 0x0E,
+ 0x61, 0x35, 0x57, 0xB9, 0x86, 0xC1, 0x1D, 0x9E, 0xE1, 0xF8, 0x98,
+ 0x11, 0x69, 0xD9, 0x8E, 0x94, 0x9B, 0x1E, 0x87, 0xE9, 0xCE, 0x55,
+ 0x28, 0xDF, 0x8C, 0xA1, 0x89, 0x0D, 0xBF, 0xE6, 0x42, 0x68, 0x41,
+ 0x99, 0x2D, 0x0F, 0xB0, 0x54, 0xBB, 0x16 };
+
+/*
+ * Forward tables
+ */
+#define FT \
+\
+ V(C6,63,63,A5), V(F8,7C,7C,84), V(EE,77,77,99), V(F6,7B,7B,8D), \
+ V(FF,F2,F2,0D), V(D6,6B,6B,BD), V(DE,6F,6F,B1), V(91,C5,C5,54), \
+ V(60,30,30,50), V(02,01,01,03), V(CE,67,67,A9), V(56,2B,2B,7D), \
+ V(E7,FE,FE,19), V(B5,D7,D7,62), V(4D,AB,AB,E6), V(EC,76,76,9A), \
+ V(8F,CA,CA,45), V(1F,82,82,9D), V(89,C9,C9,40), V(FA,7D,7D,87), \
+ V(EF,FA,FA,15), V(B2,59,59,EB), V(8E,47,47,C9), V(FB,F0,F0,0B), \
+ V(41,AD,AD,EC), V(B3,D4,D4,67), V(5F,A2,A2,FD), V(45,AF,AF,EA), \
+ V(23,9C,9C,BF), V(53,A4,A4,F7), V(E4,72,72,96), V(9B,C0,C0,5B), \
+ V(75,B7,B7,C2), V(E1,FD,FD,1C), V(3D,93,93,AE), V(4C,26,26,6A), \
+ V(6C,36,36,5A), V(7E,3F,3F,41), V(F5,F7,F7,02), V(83,CC,CC,4F), \
+ V(68,34,34,5C), V(51,A5,A5,F4), V(D1,E5,E5,34), V(F9,F1,F1,08), \
+ V(E2,71,71,93), V(AB,D8,D8,73), V(62,31,31,53), V(2A,15,15,3F), \
+ V(08,04,04,0C), V(95,C7,C7,52), V(46,23,23,65), V(9D,C3,C3,5E), \
+ V(30,18,18,28), V(37,96,96,A1), V(0A,05,05,0F), V(2F,9A,9A,B5), \
+ V(0E,07,07,09), V(24,12,12,36), V(1B,80,80,9B), V(DF,E2,E2,3D), \
+ V(CD,EB,EB,26), V(4E,27,27,69), V(7F,B2,B2,CD), V(EA,75,75,9F), \
+ V(12,09,09,1B), V(1D,83,83,9E), V(58,2C,2C,74), V(34,1A,1A,2E), \
+ V(36,1B,1B,2D), V(DC,6E,6E,B2), V(B4,5A,5A,EE), V(5B,A0,A0,FB), \
+ V(A4,52,52,F6), V(76,3B,3B,4D), V(B7,D6,D6,61), V(7D,B3,B3,CE), \
+ V(52,29,29,7B), V(DD,E3,E3,3E), V(5E,2F,2F,71), V(13,84,84,97), \
+ V(A6,53,53,F5), V(B9,D1,D1,68), V(00,00,00,00), V(C1,ED,ED,2C), \
+ V(40,20,20,60), V(E3,FC,FC,1F), V(79,B1,B1,C8), V(B6,5B,5B,ED), \
+ V(D4,6A,6A,BE), V(8D,CB,CB,46), V(67,BE,BE,D9), V(72,39,39,4B), \
+ V(94,4A,4A,DE), V(98,4C,4C,D4), V(B0,58,58,E8), V(85,CF,CF,4A), \
+ V(BB,D0,D0,6B), V(C5,EF,EF,2A), V(4F,AA,AA,E5), V(ED,FB,FB,16), \
+ V(86,43,43,C5), V(9A,4D,4D,D7), V(66,33,33,55), V(11,85,85,94), \
+ V(8A,45,45,CF), V(E9,F9,F9,10), V(04,02,02,06), V(FE,7F,7F,81), \
+ V(A0,50,50,F0), V(78,3C,3C,44), V(25,9F,9F,BA), V(4B,A8,A8,E3), \
+ V(A2,51,51,F3), V(5D,A3,A3,FE), V(80,40,40,C0), V(05,8F,8F,8A), \
+ V(3F,92,92,AD), V(21,9D,9D,BC), V(70,38,38,48), V(F1,F5,F5,04), \
+ V(63,BC,BC,DF), V(77,B6,B6,C1), V(AF,DA,DA,75), V(42,21,21,63), \
+ V(20,10,10,30), V(E5,FF,FF,1A), V(FD,F3,F3,0E), V(BF,D2,D2,6D), \
+ V(81,CD,CD,4C), V(18,0C,0C,14), V(26,13,13,35), V(C3,EC,EC,2F), \
+ V(BE,5F,5F,E1), V(35,97,97,A2), V(88,44,44,CC), V(2E,17,17,39), \
+ V(93,C4,C4,57), V(55,A7,A7,F2), V(FC,7E,7E,82), V(7A,3D,3D,47), \
+ V(C8,64,64,AC), V(BA,5D,5D,E7), V(32,19,19,2B), V(E6,73,73,95), \
+ V(C0,60,60,A0), V(19,81,81,98), V(9E,4F,4F,D1), V(A3,DC,DC,7F), \
+ V(44,22,22,66), V(54,2A,2A,7E), V(3B,90,90,AB), V(0B,88,88,83), \
+ V(8C,46,46,CA), V(C7,EE,EE,29), V(6B,B8,B8,D3), V(28,14,14,3C), \
+ V(A7,DE,DE,79), V(BC,5E,5E,E2), V(16,0B,0B,1D), V(AD,DB,DB,76), \
+ V(DB,E0,E0,3B), V(64,32,32,56), V(74,3A,3A,4E), V(14,0A,0A,1E), \
+ V(92,49,49,DB), V(0C,06,06,0A), V(48,24,24,6C), V(B8,5C,5C,E4), \
+ V(9F,C2,C2,5D), V(BD,D3,D3,6E), V(43,AC,AC,EF), V(C4,62,62,A6), \
+ V(39,91,91,A8), V(31,95,95,A4), V(D3,E4,E4,37), V(F2,79,79,8B), \
+ V(D5,E7,E7,32), V(8B,C8,C8,43), V(6E,37,37,59), V(DA,6D,6D,B7), \
+ V(01,8D,8D,8C), V(B1,D5,D5,64), V(9C,4E,4E,D2), V(49,A9,A9,E0), \
+ V(D8,6C,6C,B4), V(AC,56,56,FA), V(F3,F4,F4,07), V(CF,EA,EA,25), \
+ V(CA,65,65,AF), V(F4,7A,7A,8E), V(47,AE,AE,E9), V(10,08,08,18), \
+ V(6F,BA,BA,D5), V(F0,78,78,88), V(4A,25,25,6F), V(5C,2E,2E,72), \
+ V(38,1C,1C,24), V(57,A6,A6,F1), V(73,B4,B4,C7), V(97,C6,C6,51), \
+ V(CB,E8,E8,23), V(A1,DD,DD,7C), V(E8,74,74,9C), V(3E,1F,1F,21), \
+ V(96,4B,4B,DD), V(61,BD,BD,DC), V(0D,8B,8B,86), V(0F,8A,8A,85), \
+ V(E0,70,70,90), V(7C,3E,3E,42), V(71,B5,B5,C4), V(CC,66,66,AA), \
+ V(90,48,48,D8), V(06,03,03,05), V(F7,F6,F6,01), V(1C,0E,0E,12), \
+ V(C2,61,61,A3), V(6A,35,35,5F), V(AE,57,57,F9), V(69,B9,B9,D0), \
+ V(17,86,86,91), V(99,C1,C1,58), V(3A,1D,1D,27), V(27,9E,9E,B9), \
+ V(D9,E1,E1,38), V(EB,F8,F8,13), V(2B,98,98,B3), V(22,11,11,33), \
+ V(D2,69,69,BB), V(A9,D9,D9,70), V(07,8E,8E,89), V(33,94,94,A7), \
+ V(2D,9B,9B,B6), V(3C,1E,1E,22), V(15,87,87,92), V(C9,E9,E9,20), \
+ V(87,CE,CE,49), V(AA,55,55,FF), V(50,28,28,78), V(A5,DF,DF,7A), \
+ V(03,8C,8C,8F), V(59,A1,A1,F8), V(09,89,89,80), V(1A,0D,0D,17), \
+ V(65,BF,BF,DA), V(D7,E6,E6,31), V(84,42,42,C6), V(D0,68,68,B8), \
+ V(82,41,41,C3), V(29,99,99,B0), V(5A,2D,2D,77), V(1E,0F,0F,11), \
+ V(7B,B0,B0,CB), V(A8,54,54,FC), V(6D,BB,BB,D6), V(2C,16,16,3A)
+
+#define V(a,b,c,d) 0x##a##b##c##d
+static const uint32 FT0[256] = { FT};
+#undef V
+
+#define V(a,b,c,d) 0x##d##a##b##c
+static const uint32 FT1[256] = { FT};
+#undef V
+
+#define V(a,b,c,d) 0x##c##d##a##b
+static const uint32 FT2[256] = { FT};
+#undef V
+
+#define V(a,b,c,d) 0x##b##c##d##a
+static const uint32 FT3[256] = { FT};
+#undef V
+
+#undef FT
+
+/*
+ * Reverse S-box
+ */
+static const uint8 RSb[256] = { 0x52, 0x09, 0x6A, 0xD5, 0x30, 0x36, 0xA5,
+ 0x38, 0xBF, 0x40, 0xA3, 0x9E, 0x81, 0xF3, 0xD7, 0xFB, 0x7C, 0xE3,
+ 0x39, 0x82, 0x9B, 0x2F, 0xFF, 0x87, 0x34, 0x8E, 0x43, 0x44, 0xC4,
+ 0xDE, 0xE9, 0xCB, 0x54, 0x7B, 0x94, 0x32, 0xA6, 0xC2, 0x23, 0x3D,
+ 0xEE, 0x4C, 0x95, 0x0B, 0x42, 0xFA, 0xC3, 0x4E, 0x08, 0x2E, 0xA1,
+ 0x66, 0x28, 0xD9, 0x24, 0xB2, 0x76, 0x5B, 0xA2, 0x49, 0x6D, 0x8B,
+ 0xD1, 0x25, 0x72, 0xF8, 0xF6, 0x64, 0x86, 0x68, 0x98, 0x16, 0xD4,
+ 0xA4, 0x5C, 0xCC, 0x5D, 0x65, 0xB6, 0x92, 0x6C, 0x70, 0x48, 0x50,
+ 0xFD, 0xED, 0xB9, 0xDA, 0x5E, 0x15, 0x46, 0x57, 0xA7, 0x8D, 0x9D,
+ 0x84, 0x90, 0xD8, 0xAB, 0x00, 0x8C, 0xBC, 0xD3, 0x0A, 0xF7, 0xE4,
+ 0x58, 0x05, 0xB8, 0xB3, 0x45, 0x06, 0xD0, 0x2C, 0x1E, 0x8F, 0xCA,
+ 0x3F, 0x0F, 0x02, 0xC1, 0xAF, 0xBD, 0x03, 0x01, 0x13, 0x8A, 0x6B,
+ 0x3A, 0x91, 0x11, 0x41, 0x4F, 0x67, 0xDC, 0xEA, 0x97, 0xF2, 0xCF,
+ 0xCE, 0xF0, 0xB4, 0xE6, 0x73, 0x96, 0xAC, 0x74, 0x22, 0xE7, 0xAD,
+ 0x35, 0x85, 0xE2, 0xF9, 0x37, 0xE8, 0x1C, 0x75, 0xDF, 0x6E, 0x47,
+ 0xF1, 0x1A, 0x71, 0x1D, 0x29, 0xC5, 0x89, 0x6F, 0xB7, 0x62, 0x0E,
+ 0xAA, 0x18, 0xBE, 0x1B, 0xFC, 0x56, 0x3E, 0x4B, 0xC6, 0xD2, 0x79,
+ 0x20, 0x9A, 0xDB, 0xC0, 0xFE, 0x78, 0xCD, 0x5A, 0xF4, 0x1F, 0xDD,
+ 0xA8, 0x33, 0x88, 0x07, 0xC7, 0x31, 0xB1, 0x12, 0x10, 0x59, 0x27,
+ 0x80, 0xEC, 0x5F, 0x60, 0x51, 0x7F, 0xA9, 0x19, 0xB5, 0x4A, 0x0D,
+ 0x2D, 0xE5, 0x7A, 0x9F, 0x93, 0xC9, 0x9C, 0xEF, 0xA0, 0xE0, 0x3B,
+ 0x4D, 0xAE, 0x2A, 0xF5, 0xB0, 0xC8, 0xEB, 0xBB, 0x3C, 0x83, 0x53,
+ 0x99, 0x61, 0x17, 0x2B, 0x04, 0x7E, 0xBA, 0x77, 0xD6, 0x26, 0xE1,
+ 0x69, 0x14, 0x63, 0x55, 0x21, 0x0C, 0x7D };
+
+/*
+ * Reverse tables
+ */
+#define RT \
+\
+ V(51,F4,A7,50), V(7E,41,65,53), V(1A,17,A4,C3), V(3A,27,5E,96), \
+ V(3B,AB,6B,CB), V(1F,9D,45,F1), V(AC,FA,58,AB), V(4B,E3,03,93), \
+ V(20,30,FA,55), V(AD,76,6D,F6), V(88,CC,76,91), V(F5,02,4C,25), \
+ V(4F,E5,D7,FC), V(C5,2A,CB,D7), V(26,35,44,80), V(B5,62,A3,8F), \
+ V(DE,B1,5A,49), V(25,BA,1B,67), V(45,EA,0E,98), V(5D,FE,C0,E1), \
+ V(C3,2F,75,02), V(81,4C,F0,12), V(8D,46,97,A3), V(6B,D3,F9,C6), \
+ V(03,8F,5F,E7), V(15,92,9C,95), V(BF,6D,7A,EB), V(95,52,59,DA), \
+ V(D4,BE,83,2D), V(58,74,21,D3), V(49,E0,69,29), V(8E,C9,C8,44), \
+ V(75,C2,89,6A), V(F4,8E,79,78), V(99,58,3E,6B), V(27,B9,71,DD), \
+ V(BE,E1,4F,B6), V(F0,88,AD,17), V(C9,20,AC,66), V(7D,CE,3A,B4), \
+ V(63,DF,4A,18), V(E5,1A,31,82), V(97,51,33,60), V(62,53,7F,45), \
+ V(B1,64,77,E0), V(BB,6B,AE,84), V(FE,81,A0,1C), V(F9,08,2B,94), \
+ V(70,48,68,58), V(8F,45,FD,19), V(94,DE,6C,87), V(52,7B,F8,B7), \
+ V(AB,73,D3,23), V(72,4B,02,E2), V(E3,1F,8F,57), V(66,55,AB,2A), \
+ V(B2,EB,28,07), V(2F,B5,C2,03), V(86,C5,7B,9A), V(D3,37,08,A5), \
+ V(30,28,87,F2), V(23,BF,A5,B2), V(02,03,6A,BA), V(ED,16,82,5C), \
+ V(8A,CF,1C,2B), V(A7,79,B4,92), V(F3,07,F2,F0), V(4E,69,E2,A1), \
+ V(65,DA,F4,CD), V(06,05,BE,D5), V(D1,34,62,1F), V(C4,A6,FE,8A), \
+ V(34,2E,53,9D), V(A2,F3,55,A0), V(05,8A,E1,32), V(A4,F6,EB,75), \
+ V(0B,83,EC,39), V(40,60,EF,AA), V(5E,71,9F,06), V(BD,6E,10,51), \
+ V(3E,21,8A,F9), V(96,DD,06,3D), V(DD,3E,05,AE), V(4D,E6,BD,46), \
+ V(91,54,8D,B5), V(71,C4,5D,05), V(04,06,D4,6F), V(60,50,15,FF), \
+ V(19,98,FB,24), V(D6,BD,E9,97), V(89,40,43,CC), V(67,D9,9E,77), \
+ V(B0,E8,42,BD), V(07,89,8B,88), V(E7,19,5B,38), V(79,C8,EE,DB), \
+ V(A1,7C,0A,47), V(7C,42,0F,E9), V(F8,84,1E,C9), V(00,00,00,00), \
+ V(09,80,86,83), V(32,2B,ED,48), V(1E,11,70,AC), V(6C,5A,72,4E), \
+ V(FD,0E,FF,FB), V(0F,85,38,56), V(3D,AE,D5,1E), V(36,2D,39,27), \
+ V(0A,0F,D9,64), V(68,5C,A6,21), V(9B,5B,54,D1), V(24,36,2E,3A), \
+ V(0C,0A,67,B1), V(93,57,E7,0F), V(B4,EE,96,D2), V(1B,9B,91,9E), \
+ V(80,C0,C5,4F), V(61,DC,20,A2), V(5A,77,4B,69), V(1C,12,1A,16), \
+ V(E2,93,BA,0A), V(C0,A0,2A,E5), V(3C,22,E0,43), V(12,1B,17,1D), \
+ V(0E,09,0D,0B), V(F2,8B,C7,AD), V(2D,B6,A8,B9), V(14,1E,A9,C8), \
+ V(57,F1,19,85), V(AF,75,07,4C), V(EE,99,DD,BB), V(A3,7F,60,FD), \
+ V(F7,01,26,9F), V(5C,72,F5,BC), V(44,66,3B,C5), V(5B,FB,7E,34), \
+ V(8B,43,29,76), V(CB,23,C6,DC), V(B6,ED,FC,68), V(B8,E4,F1,63), \
+ V(D7,31,DC,CA), V(42,63,85,10), V(13,97,22,40), V(84,C6,11,20), \
+ V(85,4A,24,7D), V(D2,BB,3D,F8), V(AE,F9,32,11), V(C7,29,A1,6D), \
+ V(1D,9E,2F,4B), V(DC,B2,30,F3), V(0D,86,52,EC), V(77,C1,E3,D0), \
+ V(2B,B3,16,6C), V(A9,70,B9,99), V(11,94,48,FA), V(47,E9,64,22), \
+ V(A8,FC,8C,C4), V(A0,F0,3F,1A), V(56,7D,2C,D8), V(22,33,90,EF), \
+ V(87,49,4E,C7), V(D9,38,D1,C1), V(8C,CA,A2,FE), V(98,D4,0B,36), \
+ V(A6,F5,81,CF), V(A5,7A,DE,28), V(DA,B7,8E,26), V(3F,AD,BF,A4), \
+ V(2C,3A,9D,E4), V(50,78,92,0D), V(6A,5F,CC,9B), V(54,7E,46,62), \
+ V(F6,8D,13,C2), V(90,D8,B8,E8), V(2E,39,F7,5E), V(82,C3,AF,F5), \
+ V(9F,5D,80,BE), V(69,D0,93,7C), V(6F,D5,2D,A9), V(CF,25,12,B3), \
+ V(C8,AC,99,3B), V(10,18,7D,A7), V(E8,9C,63,6E), V(DB,3B,BB,7B), \
+ V(CD,26,78,09), V(6E,59,18,F4), V(EC,9A,B7,01), V(83,4F,9A,A8), \
+ V(E6,95,6E,65), V(AA,FF,E6,7E), V(21,BC,CF,08), V(EF,15,E8,E6), \
+ V(BA,E7,9B,D9), V(4A,6F,36,CE), V(EA,9F,09,D4), V(29,B0,7C,D6), \
+ V(31,A4,B2,AF), V(2A,3F,23,31), V(C6,A5,94,30), V(35,A2,66,C0), \
+ V(74,4E,BC,37), V(FC,82,CA,A6), V(E0,90,D0,B0), V(33,A7,D8,15), \
+ V(F1,04,98,4A), V(41,EC,DA,F7), V(7F,CD,50,0E), V(17,91,F6,2F), \
+ V(76,4D,D6,8D), V(43,EF,B0,4D), V(CC,AA,4D,54), V(E4,96,04,DF), \
+ V(9E,D1,B5,E3), V(4C,6A,88,1B), V(C1,2C,1F,B8), V(46,65,51,7F), \
+ V(9D,5E,EA,04), V(01,8C,35,5D), V(FA,87,74,73), V(FB,0B,41,2E), \
+ V(B3,67,1D,5A), V(92,DB,D2,52), V(E9,10,56,33), V(6D,D6,47,13), \
+ V(9A,D7,61,8C), V(37,A1,0C,7A), V(59,F8,14,8E), V(EB,13,3C,89), \
+ V(CE,A9,27,EE), V(B7,61,C9,35), V(E1,1C,E5,ED), V(7A,47,B1,3C), \
+ V(9C,D2,DF,59), V(55,F2,73,3F), V(18,14,CE,79), V(73,C7,37,BF), \
+ V(53,F7,CD,EA), V(5F,FD,AA,5B), V(DF,3D,6F,14), V(78,44,DB,86), \
+ V(CA,AF,F3,81), V(B9,68,C4,3E), V(38,24,34,2C), V(C2,A3,40,5F), \
+ V(16,1D,C3,72), V(BC,E2,25,0C), V(28,3C,49,8B), V(FF,0D,95,41), \
+ V(39,A8,01,71), V(08,0C,B3,DE), V(D8,B4,E4,9C), V(64,56,C1,90), \
+ V(7B,CB,84,61), V(D5,32,B6,70), V(48,6C,5C,74), V(D0,B8,57,42)
+
+#define V(a,b,c,d) 0x##a##b##c##d
+static const uint32 RT0[256] = { RT};
+#undef V
+
+#define V(a,b,c,d) 0x##d##a##b##c
+static const uint32 RT1[256] = { RT};
+#undef V
+
+#define V(a,b,c,d) 0x##c##d##a##b
+static const uint32 RT2[256] = { RT};
+#undef V
+
+#define V(a,b,c,d) 0x##b##c##d##a
+static const uint32 RT3[256] = { RT};
+#undef V
+
+#undef RT
+
+/*
+ * Round constants
+ */
+static const uint32 RCON[10] = { 0x01000000, 0x02000000, 0x04000000,
+ 0x08000000, 0x10000000, 0x20000000, 0x40000000, 0x80000000,
+ 0x1B000000, 0x36000000 };
+
+static void aes_gen_tables (void)
+{
+}
+
+#endif
+
+/*
+ * Decryption key schedule tables
+ */
+static uint32 KT0[256];
+static uint32 KT1[256];
+static uint32 KT2[256];
+static uint32 KT3[256];
+
+/*
+ * AES key schedule
+ */
+void
+aes_set_key (aes_context *ctx, uint8 *key)
+{
+ int i;
+ uint32 *RK, *SK;
+ static int ft_init = 0;
+ static int kt_init = 0;
+
+ dbg_assert (ctx);
+ dbg_assert (key);
+
+ if (ft_init == 0)
+ {
+ aes_gen_tables ();
+ ft_init = 1;
+ }
+
+ // 10 for 128 bits key size.
+ ctx->nr = 10;
+ RK = ctx->erk;
+
+ for (i = 0; i < (128 >> 5); i++)
+ {
+ GET_UINT32_BE (RK[i], key, i << 2);
+ }
+
+ /*
+ * setup encryption round keys
+ */
+ for (i = 0; i < 10; i++, RK += 4)
+ {
+ RK[4] = RK[0]
+ ^ RCON[i]
+ ^ (FSb[ (uint8) ( RK[3] >> 16 ) ] << 24)
+ ^ (FSb[ (uint8) ( RK[3] >> 8 ) ] << 16)
+ ^ (FSb[ (uint8) ( RK[3] ) ] << 8)
+ ^ (FSb[ (uint8) ( RK[3] >> 24 ) ] );
+
+ RK[5] = RK[1] ^ RK[4];
+ RK[6] = RK[2] ^ RK[5];
+ RK[7] = RK[3] ^ RK[6];
+ }
+
+ /*
+ * setup decryption round keys
+ */
+ if (kt_init == 0)
+ {
+ for (i = 0; i < 256; i++)
+ {
+ KT0[i] = RT0[ FSb[i] ];
+ KT1[i] = RT1[ FSb[i] ];
+ KT2[i] = RT2[ FSb[i] ];
+ KT3[i] = RT3[ FSb[i] ];
+ }
+
+ kt_init = 1;
+ }
+
+ SK = ctx->drk;
+
+ *SK++ = *RK++;
+ *SK++ = *RK++;
+ *SK++ = *RK++;
+ *SK++ = *RK++;
+
+ for (i = 1; i < ctx->nr; i++)
+ {
+ RK -= 8;
+
+ *SK++ = KT0[ (uint8) ( *RK >> 24 ) ]
+ ^KT1[ (uint8) ( *RK >> 16 ) ]
+ ^KT2[ (uint8) ( *RK >> 8 ) ]
+ ^KT3[ (uint8) ( *RK ) ];
+ RK++;
+
+ *SK++ = KT0[ (uint8) ( *RK >> 24 ) ]
+ ^KT1[ (uint8) ( *RK >> 16 ) ]
+ ^KT2[ (uint8) ( *RK >> 8 ) ]
+ ^KT3[ (uint8) ( *RK ) ];
+ RK++;
+
+ *SK++ = KT0[ (uint8) ( *RK >> 24 ) ]
+ ^KT1[ (uint8) ( *RK >> 16 ) ]
+ ^KT2[ (uint8) ( *RK >> 8 ) ]
+ ^KT3[ (uint8) ( *RK ) ];
+ RK++;
+
+ *SK++ = KT0[ (uint8) ( *RK >> 24 ) ]
+ ^KT1[ (uint8) ( *RK >> 16 ) ]
+ ^KT2[ (uint8) ( *RK >> 8 ) ]
+ ^KT3[ (uint8) ( *RK ) ];
+ RK++;
+ }
+
+ RK -= 8;
+
+ *SK++ = *RK++;
+ *SK++ = *RK++;
+ *SK++ = *RK++;
+ *SK++ = *RK++;
+}
+
+/**
+ * AES block encryption (ECB mode)
+ */
+void
+aes_encrypt (aes_context *ctx, unsigned char input[16],
+ unsigned char output[16])
+{
+ uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
+
+ dbg_assert (ctx);
+ dbg_assert (input);
+ dbg_assert (output);
+
+ RK = ctx->erk;
+
+ GET_UINT32_BE (X0, input, 0);
+ X0 ^= RK[0];
+ GET_UINT32_BE (X1, input, 4);
+ X1 ^= RK[1];
+ GET_UINT32_BE (X2, input, 8);
+ X2 ^= RK[2];
+ GET_UINT32_BE (X3, input, 12);
+ X3 ^= RK[3];
+
+#define AES_FROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \
+{ \
+ RK += 4; \
+ \
+ X0 = RK[0] ^ FT0[ (uint8) ( Y0 >> 24 ) ] ^ \
+ FT1[ (uint8) ( Y1 >> 16 ) ] ^ \
+ FT2[ (uint8) ( Y2 >> 8 ) ] ^ \
+ FT3[ (uint8) ( Y3 ) ]; \
+ \
+ X1 = RK[1] ^ FT0[ (uint8) ( Y1 >> 24 ) ] ^ \
+ FT1[ (uint8) ( Y2 >> 16 ) ] ^ \
+ FT2[ (uint8) ( Y3 >> 8 ) ] ^ \
+ FT3[ (uint8) ( Y0 ) ]; \
+ \
+ X2 = RK[2] ^ FT0[ (uint8) ( Y2 >> 24 ) ] ^ \
+ FT1[ (uint8) ( Y3 >> 16 ) ] ^ \
+ FT2[ (uint8) ( Y0 >> 8 ) ] ^ \
+ FT3[ (uint8) ( Y1 ) ]; \
+ \
+ X3 = RK[3] ^ FT0[ (uint8) ( Y3 >> 24 ) ] ^ \
+ FT1[ (uint8) ( Y0 >> 16 ) ] ^ \
+ FT2[ (uint8) ( Y1 >> 8 ) ] ^ \
+ FT3[ (uint8) ( Y2 ) ]; \
+}
+
+ AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+ AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
+ AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+ AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
+ AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+ AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
+ AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+ AES_FROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
+ AES_FROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+
+ RK += 4;
+
+ X0 = RK[0]
+ ^ (FSb[ (uint8) ( Y0 >> 24 ) ] << 24)
+ ^(FSb[ (uint8) ( Y1 >> 16 ) ] << 16)
+ ^(FSb[ (uint8) ( Y2 >> 8 ) ] << 8)
+ ^(FSb[ (uint8) ( Y3 ) ] );
+
+ X1 = RK[1]
+ ^ (FSb[ (uint8) ( Y1 >> 24 ) ] << 24)
+ ^(FSb[ (uint8) ( Y2 >> 16 ) ] << 16)
+ ^(FSb[ (uint8) ( Y3 >> 8 ) ] << 8)
+ ^(FSb[ (uint8) ( Y0 ) ] );
+
+ X2 = RK[2]
+ ^ (FSb[ (uint8) ( Y2 >> 24 ) ] << 24)
+ ^(FSb[ (uint8) ( Y3 >> 16 ) ] << 16)
+ ^(FSb[ (uint8) ( Y0 >> 8 ) ] << 8)
+ ^(FSb[ (uint8) ( Y1 ) ] );
+
+ X3 = RK[3]
+ ^ (FSb[ (uint8) ( Y3 >> 24 ) ] << 24)
+ ^(FSb[ (uint8) ( Y0 >> 16 ) ] << 16)
+ ^(FSb[ (uint8) ( Y1 >> 8 ) ] << 8)
+ ^(FSb[ (uint8) ( Y2 ) ] );
+
+ PUT_UINT32_BE (X0, output, 0);
+ PUT_UINT32_BE (X1, output, 4);
+ PUT_UINT32_BE (X2, output, 8);
+ PUT_UINT32_BE (X3, output, 12);
+}
+
+/*
+ * AES block decryption (ECB mode)
+ */
+void
+aes_decrypt (aes_context *ctx, unsigned char input[16],
+ unsigned char output[16])
+{
+ uint32 *RK, X0, X1, X2, X3, Y0, Y1, Y2, Y3;
+
+ dbg_assert (ctx);
+ dbg_assert (input);
+ dbg_assert (output);
+
+ RK = ctx->drk;
+
+ GET_UINT32_BE (X0, input, 0);
+ X0 ^= RK[0];
+ GET_UINT32_BE (X1, input, 4);
+ X1 ^= RK[1];
+ GET_UINT32_BE (X2, input, 8);
+ X2 ^= RK[2];
+ GET_UINT32_BE (X3, input, 12);
+ X3 ^= RK[3];
+
+#define AES_RROUND(X0,X1,X2,X3,Y0,Y1,Y2,Y3) \
+{ \
+ RK += 4; \
+ \
+ X0 = RK[0] ^ RT0[ (uint8) ( Y0 >> 24 ) ] ^ \
+ RT1[ (uint8) ( Y3 >> 16 ) ] ^ \
+ RT2[ (uint8) ( Y2 >> 8 ) ] ^ \
+ RT3[ (uint8) ( Y1 ) ]; \
+ \
+ X1 = RK[1] ^ RT0[ (uint8) ( Y1 >> 24 ) ] ^ \
+ RT1[ (uint8) ( Y0 >> 16 ) ] ^ \
+ RT2[ (uint8) ( Y3 >> 8 ) ] ^ \
+ RT3[ (uint8) ( Y2 ) ]; \
+ \
+ X2 = RK[2] ^ RT0[ (uint8) ( Y2 >> 24 ) ] ^ \
+ RT1[ (uint8) ( Y1 >> 16 ) ] ^ \
+ RT2[ (uint8) ( Y0 >> 8 ) ] ^ \
+ RT3[ (uint8) ( Y3 ) ]; \
+ \
+ X3 = RK[3] ^ RT0[ (uint8) ( Y3 >> 24 ) ] ^ \
+ RT1[ (uint8) ( Y2 >> 16 ) ] ^ \
+ RT2[ (uint8) ( Y1 >> 8 ) ] ^ \
+ RT3[ (uint8) ( Y0 ) ]; \
+}
+
+ AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+ AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
+ AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+ AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
+ AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+ AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
+ AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+ AES_RROUND( X0, X1, X2, X3, Y0, Y1, Y2, Y3 );
+ AES_RROUND( Y0, Y1, Y2, Y3, X0, X1, X2, X3 );
+
+ RK += 4;
+
+ X0 = RK[0]
+ ^ (RSb[ (uint8) ( Y0 >> 24 ) ] << 24)
+ ^(RSb[ (uint8) ( Y3 >> 16 ) ] << 16)
+ ^(RSb[ (uint8) ( Y2 >> 8 ) ] << 8)
+ ^(RSb[ (uint8) ( Y1 ) ] );
+
+ X1 = RK[1]
+ ^ (RSb[ (uint8) ( Y1 >> 24 ) ] << 24)
+ ^(RSb[ (uint8) ( Y0 >> 16 ) ] << 16)
+ ^(RSb[ (uint8) ( Y3 >> 8 ) ] << 8)
+ ^(RSb[ (uint8) ( Y2 ) ] );
+
+ X2 = RK[2]
+ ^ (RSb[ (uint8) ( Y2 >> 24 ) ] << 24)
+ ^(RSb[ (uint8) ( Y1 >> 16 ) ] << 16)
+ ^(RSb[ (uint8) ( Y0 >> 8 ) ] << 8)
+ ^(RSb[ (uint8) ( Y3 ) ] );
+
+ X3 = RK[3]
+ ^ (RSb[ (uint8) ( Y3 >> 24 ) ] << 24)
+ ^(RSb[ (uint8) ( Y2 >> 16 ) ] << 16)
+ ^(RSb[ (uint8) ( Y1 >> 8 ) ] << 8)
+ ^(RSb[ (uint8) ( Y0 ) ] );
+
+ PUT_UINT32_BE (X0, output, 0);
+ PUT_UINT32_BE (X1, output, 4);
+ PUT_UINT32_BE (X2, output, 8);
+ PUT_UINT32_BE (X3, output, 12);
+}
+
+/*
+ * AES-CBC buffer encryption
+ */
+void
+aes_cbc_encrypt (aes_context *ctx, unsigned char iv[16],
+ unsigned char *input, unsigned char *output, int len)
+{
+ int i;
+ unsigned char tmp;
+
+ dbg_assert (ctx);
+ dbg_assert (iv);
+ dbg_assert (input);
+ dbg_assert (output);
+
+ while (len > 0)
+ {
+ for (i = 0; i < 16; i++)
+ {
+ output[i] = input[i] ^ iv[i];
+ tmp = output[i];
+ }
+
+ aes_encrypt (ctx, output, output );
+ memcpy (iv, output, 16);
+
+ input += 16;
+ output += 16;
+ len -= 16;
+ }
+}
+
+/*
+ * AES-CBC buffer decryption
+ */
+void
+aes_cbc_decrypt (aes_context *ctx, unsigned char iv[16],
+ unsigned char *input, unsigned char *output, int len)
+{
+ int i;
+ unsigned char temp[16];
+
+ dbg_assert (ctx);
+ dbg_assert (iv);
+ dbg_assert (input);
+ dbg_assert (output);
+
+ while (len > 0)
+ {
+ memcpy (temp, input, 16);
+
+ aes_decrypt (ctx, input, output );
+
+ for (i = 0; i < 16; i++)
+ output[i] ^= iv[i];
+
+ memcpy (iv, temp, 16);
+
+ input += 16;
+ output += 16;
+ len -= 16;
+ }
+}
+
diff --git a/cesar/cp/secu/src/pbkdf1.c b/cesar/cp/secu/src/pbkdf1.c
new file mode 100644
index 0000000000..542ed5c9e8
--- /dev/null
+++ b/cesar/cp/secu/src/pbkdf1.c
@@ -0,0 +1,106 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/secu_pbkdf1.c
+ * \brief The pbkdf1 function
+ * \ingroup cp_secu
+ */
+#include <string.h>
+
+#include "common/std.h"
+#include "cp/secu/defs.h"
+
+#include "cp/secu/sha256.h"
+#include "cp/secu/pbkdf1.h"
+
+
+#include "cp/secu/inc/pbkdf1.h"
+
+void
+secu_pbkdf1 (u8 input[], uint input_len, u8 salt[],
+ uint salt_len, uint it_count, u8 output_key[])
+{
+
+ u8 dk[68] = "";
+ u8 sha_output[CP_SECU_SHA256_OUTPUT_SIZE];
+ uint dp_size, i;
+
+ dbg_assert (input);
+ dbg_assert (output_key);
+ if (salt_len)
+ dbg_assert (salt);
+ /*
+ * Copy input to DK (max size cannot be greater than DK buffer)
+ */
+ for (dp_size = 0;
+ (dp_size < input_len) && (dp_size < CP_SECU_PWD_SIZE_MAX);
+ dp_size++)
+ {
+ dk[dp_size] = input[dp_size];
+ }
+ /*
+ * Concat salt with input on DK and count total input size
+ */
+ for (i=0 ; i < salt_len ; i++)
+ {
+ dk[dp_size+i] = salt[i];
+ }
+ dp_size += salt_len;
+ /*
+ * Compute the first derived key with sha256
+ */
+ cp_secu_sha256 (dk, dp_size, sha_output);
+ /*
+ * compute the following iterations
+ */
+ for(i=1 ; i < it_count ; i++)
+ {
+ memcpy (dk, sha_output, CP_SECU_SHA256_OUTPUT_SIZE);
+ cp_secu_sha256 (dk, CP_SECU_SHA256_OUTPUT_SIZE, sha_output);
+ }
+ /*
+ * we keep only the OutputKeySize leftmost bytes
+ */
+ memcpy(output_key, sha_output, CP_SECU_OUTPUT_KEY_SIZE);
+}
+
+/**
+ * PBKDF1 functions for the Secu module.
+ * \param buffer the input buffer.
+ * \param length the buffer length.
+ * \param key key kind.
+ */
+void
+cp_secu_pbkdf1 (u8 *buffer, uint length, cp_secu_salt_kind_t key)
+{
+ u8 salt [8] = {0x08, 0x85, 0x6d, 0xaf, 0x7c, 0xf5, 0x81, 0x00};
+
+ dbg_assert (buffer);
+ dbg_assert (key < CP_SECU_SALT_KEY_NB);
+
+ switch (key)
+ {
+ case CP_SECU_SALT_KEY_DAK:
+ salt[7] = 0x85;
+ break;
+ case CP_SECU_SALT_KEY_NMK_HS:
+ salt[7] = 0x86;
+ break;
+ case CP_SECU_SALT_SPIDCOM:
+ salt[0] += 2;
+ salt[4] = 0xA2;
+ break;
+ default:
+ dbg_assert (false);
+ }
+
+ secu_pbkdf1 (buffer, length, salt,
+ CP_SECU_SALT_SIZE,
+ CP_SECU_PBKDF1_ITERATION, buffer);
+}
+
diff --git a/cesar/cp/secu/src/secu.c b/cesar/cp/secu/src/secu.c
new file mode 100644
index 0000000000..eece5764ed
--- /dev/null
+++ b/cesar/cp/secu/src/secu.c
@@ -0,0 +1,140 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/src/secu.c
+ * \brief Security functions.
+ * \ingroup cp_secu
+ *
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "cp/defs.h"
+#include "cp/secu/defs.h"
+#include "cp/secu/secu.h"
+#include "cp/secu/pbkdf1.h"
+
+#include "cp/secu/inc/pbkdf1.h"
+
+/**
+ * Start a new protocol run and initialise the protocol run structure.
+ * \param prun protocol run to initialise.
+ * \param pid protocol identifier
+ * \param prun_rand the random number for the PRN.
+ * \param rand a random number.
+ */
+void
+cp_secu_protocol_run_new (cp_secu_protocol_run_t *prun, u8 pid,
+ uint prn_rand, uint rand)
+{
+ dbg_assert (prun);
+ dbg_assert (pid <= 4);
+
+ memset (prun, 0, sizeof (cp_secu_protocol_run_t));
+ prun->pmn = 1;
+ prun->pid = pid;
+ prun->prn = prn_rand;
+ prun->my_nonce = rand;
+}
+
+/**
+ * Check a received protocol run against the current one.
+ * \param prun current protocol run
+ * \param prun_recv received protocol run
+ * \return whether this is a new or old protocol run, or garbage
+ *
+ * The current protocol run can be NULL if there is no current protocol run.
+ * You can also use a pointer to an initialised protocol run if it is more
+ * convenient.
+ */
+enum cp_secu_protocol_run_check_result_t
+cp_secu_protocol_check (const cp_secu_protocol_run_t *prun,
+ const cp_secu_protocol_run_t *prun_recv)
+{
+ dbg_assert (prun_recv);
+
+ if (prun_recv->pmn == 1)
+ return CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEW;
+ else if (prun)
+ {
+ if (prun->prn == prun_recv->prn
+ && prun->pmn != 0xff
+ && (prun->pmn + 1 == prun_recv->pmn || prun_recv->pmn == 0xff)
+ && prun->pid == prun_recv->pid
+ && prun->my_nonce == prun_recv->my_nonce)
+ return CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT;
+ else
+ return CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE;
+ }
+ else
+ return CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE;
+}
+
+/**
+ * Update a protocol run for the next message.
+ * \param prun current protocol run
+ * \param last whether this is the last message
+ *
+ * Received protocol run should have been copied to the current one before
+ * this call.
+ */
+void
+cp_secu_protocol_next (cp_secu_protocol_run_t *prun, bool last)
+{
+ dbg_assert (prun);
+
+ if (last)
+ prun->pmn = 0xff;
+ else
+ {
+ dbg_assert (prun->pmn != 0xff);
+ prun->pmn++;
+ }
+}
+
+/**
+ * Generate the AES key.
+ * \param num a random number.
+ * \param output the key generated.
+ */
+void
+cp_secu_aes_generate_key (uint num, u8 *output)
+{
+ dbg_assert (num);
+ dbg_assert (output);
+
+ memcpy (output, &num, 4);
+ cp_secu_pbkdf1 (output, CP_SECU_AES_SIZE, CP_SECU_SALT_SPIDCOM);
+}
+
+/**
+ * Generate the NID from the NMK and the security level.
+ * \param buffer the buffer containing the NMK.
+ * \param the Security level.
+ * \warn the buffer will contain the NID at the end.
+ */
+void
+cp_secu_nmk2nid(u8 *buffer, u8 security_level)
+{
+ dbg_assert (buffer);
+ dbg_assert (security_level <= 2);
+
+ secu_pbkdf1 (buffer, CP_NMK_SIZE, NULL, 0, CP_SECU_PBKDF1_ITERATION_NID,
+ buffer);
+
+ /* Set the right nibble of rightmost octet of NID = rightmost nibble
+ * of the 52 Bit Hashed NID offset*/
+ buffer[CP_NID_SIZE - 1] >>= 4;
+
+ /* Mask the left nibble of rightmost octet of NID... */
+ buffer[CP_NID_SIZE - 1] &= 0x0F;
+
+ /* ... and then, insert the Security Level */
+ buffer[CP_NID_SIZE - 1] |= ((security_level << 4) & 0xF0);
+}
+
diff --git a/cesar/cp/secu/src/sha256.c b/cesar/cp/secu/src/sha256.c
new file mode 100644
index 0000000000..de011f6ac5
--- /dev/null
+++ b/cesar/cp/secu/src/sha256.c
@@ -0,0 +1,278 @@
+/*
+ * FIPS-180-2 compliant SHA-256 implementation
+ *
+ * Copyright (C) 2001-2003 Christophe Devine
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ */
+#include "common/std.h"
+#include <string.h>
+#include "lib/swap.h"
+#include "cp/secu/defs.h"
+
+#include "cp/secu/inc/sha256.h"
+
+#define GET_UINT32(n,b,i) \
+{ \
+ (n) = ( (uint32) (b)[(i) ] << 24 ) \
+ | ( (uint32) (b)[(i) + 1] << 16 ) \
+ | ( (uint32) (b)[(i) + 2] << 8 ) \
+ | ( (uint32) (b)[(i) + 3] ); \
+}
+
+#define PUT_UINT32(n,b,i) \
+{ \
+ (b)[(i) ] = (uint8) ( (n) >> 24 ); \
+ (b)[(i) + 1] = (uint8) ( (n) >> 16 ); \
+ (b)[(i) + 2] = (uint8) ( (n) >> 8 ); \
+ (b)[(i) + 3] = (uint8) ( (n) ); \
+}
+
+void sha256_starts( sha256_context *ctx )
+{
+ ctx->total[0] = 0;
+ ctx->total[1] = 0;
+
+ ctx->state[0] = 0x6A09E667;
+ ctx->state[1] = 0xBB67AE85;
+ ctx->state[2] = 0x3C6EF372;
+ ctx->state[3] = 0xA54FF53A;
+ ctx->state[4] = 0x510E527F;
+ ctx->state[5] = 0x9B05688C;
+ ctx->state[6] = 0x1F83D9AB;
+ ctx->state[7] = 0x5BE0CD19;
+}
+
+void sha256_process( sha256_context *ctx, uint8 data[64] )
+{
+ uint32 temp1, temp2, W[64];
+ uint32 A, B, C, D, E, F, G, H;
+
+ GET_UINT32( W[0], data, 0 );
+ GET_UINT32( W[1], data, 4 );
+ GET_UINT32( W[2], data, 8 );
+ GET_UINT32( W[3], data, 12 );
+ GET_UINT32( W[4], data, 16 );
+ GET_UINT32( W[5], data, 20 );
+ GET_UINT32( W[6], data, 24 );
+ GET_UINT32( W[7], data, 28 );
+ GET_UINT32( W[8], data, 32 );
+ GET_UINT32( W[9], data, 36 );
+ GET_UINT32( W[10], data, 40 );
+ GET_UINT32( W[11], data, 44 );
+ GET_UINT32( W[12], data, 48 );
+ GET_UINT32( W[13], data, 52 );
+ GET_UINT32( W[14], data, 56 );
+ GET_UINT32( W[15], data, 60 );
+
+#define SHR(x,n) ((x & 0xFFFFFFFF) >> n)
+#define ROTR(x,n) (SHR(x,n) | (x << (32 - n)))
+
+#define S0(x) (ROTR(x, 7) ^ ROTR(x,18) ^ SHR(x, 3))
+#define S1(x) (ROTR(x,17) ^ ROTR(x,19) ^ SHR(x,10))
+
+#define S2(x) (ROTR(x, 2) ^ ROTR(x,13) ^ ROTR(x,22))
+#define S3(x) (ROTR(x, 6) ^ ROTR(x,11) ^ ROTR(x,25))
+
+#define F0(x,y,z) ((x & y) | (z & (x | y)))
+#define F1(x,y,z) (z ^ (x & (y ^ z)))
+
+#define R(t) \
+( \
+ W[t] = S1(W[t - 2]) + W[t - 7] + \
+ S0(W[t - 15]) + W[t - 16] \
+)
+
+#define P(a,b,c,d,e,f,g,h,x,K) \
+{ \
+ temp1 = h + S3(e) + F1(e,f,g) + K + x; \
+ temp2 = S2(a) + F0(a,b,c); \
+ d += temp1; h = temp1 + temp2; \
+}
+
+ A = ctx->state[0];
+ B = ctx->state[1];
+ C = ctx->state[2];
+ D = ctx->state[3];
+ E = ctx->state[4];
+ F = ctx->state[5];
+ G = ctx->state[6];
+ H = ctx->state[7];
+
+ P( A, B, C, D, E, F, G, H, W[ 0], 0x428A2F98 );
+ P( H, A, B, C, D, E, F, G, W[ 1], 0x71374491 );
+ P( G, H, A, B, C, D, E, F, W[ 2], 0xB5C0FBCF );
+ P( F, G, H, A, B, C, D, E, W[ 3], 0xE9B5DBA5 );
+ P( E, F, G, H, A, B, C, D, W[ 4], 0x3956C25B );
+ P( D, E, F, G, H, A, B, C, W[ 5], 0x59F111F1 );
+ P( C, D, E, F, G, H, A, B, W[ 6], 0x923F82A4 );
+ P( B, C, D, E, F, G, H, A, W[ 7], 0xAB1C5ED5 );
+ P( A, B, C, D, E, F, G, H, W[ 8], 0xD807AA98 );
+ P( H, A, B, C, D, E, F, G, W[ 9], 0x12835B01 );
+ P( G, H, A, B, C, D, E, F, W[10], 0x243185BE );
+ P( F, G, H, A, B, C, D, E, W[11], 0x550C7DC3 );
+ P( E, F, G, H, A, B, C, D, W[12], 0x72BE5D74 );
+ P( D, E, F, G, H, A, B, C, W[13], 0x80DEB1FE );
+ P( C, D, E, F, G, H, A, B, W[14], 0x9BDC06A7 );
+ P( B, C, D, E, F, G, H, A, W[15], 0xC19BF174 );
+ P( A, B, C, D, E, F, G, H, R(16), 0xE49B69C1 );
+ P( H, A, B, C, D, E, F, G, R(17), 0xEFBE4786 );
+ P( G, H, A, B, C, D, E, F, R(18), 0x0FC19DC6 );
+ P( F, G, H, A, B, C, D, E, R(19), 0x240CA1CC );
+ P( E, F, G, H, A, B, C, D, R(20), 0x2DE92C6F );
+ P( D, E, F, G, H, A, B, C, R(21), 0x4A7484AA );
+ P( C, D, E, F, G, H, A, B, R(22), 0x5CB0A9DC );
+ P( B, C, D, E, F, G, H, A, R(23), 0x76F988DA );
+ P( A, B, C, D, E, F, G, H, R(24), 0x983E5152 );
+ P( H, A, B, C, D, E, F, G, R(25), 0xA831C66D );
+ P( G, H, A, B, C, D, E, F, R(26), 0xB00327C8 );
+ P( F, G, H, A, B, C, D, E, R(27), 0xBF597FC7 );
+ P( E, F, G, H, A, B, C, D, R(28), 0xC6E00BF3 );
+ P( D, E, F, G, H, A, B, C, R(29), 0xD5A79147 );
+ P( C, D, E, F, G, H, A, B, R(30), 0x06CA6351 );
+ P( B, C, D, E, F, G, H, A, R(31), 0x14292967 );
+ P( A, B, C, D, E, F, G, H, R(32), 0x27B70A85 );
+ P( H, A, B, C, D, E, F, G, R(33), 0x2E1B2138 );
+ P( G, H, A, B, C, D, E, F, R(34), 0x4D2C6DFC );
+ P( F, G, H, A, B, C, D, E, R(35), 0x53380D13 );
+ P( E, F, G, H, A, B, C, D, R(36), 0x650A7354 );
+ P( D, E, F, G, H, A, B, C, R(37), 0x766A0ABB );
+ P( C, D, E, F, G, H, A, B, R(38), 0x81C2C92E );
+ P( B, C, D, E, F, G, H, A, R(39), 0x92722C85 );
+ P( A, B, C, D, E, F, G, H, R(40), 0xA2BFE8A1 );
+ P( H, A, B, C, D, E, F, G, R(41), 0xA81A664B );
+ P( G, H, A, B, C, D, E, F, R(42), 0xC24B8B70 );
+ P( F, G, H, A, B, C, D, E, R(43), 0xC76C51A3 );
+ P( E, F, G, H, A, B, C, D, R(44), 0xD192E819 );
+ P( D, E, F, G, H, A, B, C, R(45), 0xD6990624 );
+ P( C, D, E, F, G, H, A, B, R(46), 0xF40E3585 );
+ P( B, C, D, E, F, G, H, A, R(47), 0x106AA070 );
+ P( A, B, C, D, E, F, G, H, R(48), 0x19A4C116 );
+ P( H, A, B, C, D, E, F, G, R(49), 0x1E376C08 );
+ P( G, H, A, B, C, D, E, F, R(50), 0x2748774C );
+ P( F, G, H, A, B, C, D, E, R(51), 0x34B0BCB5 );
+ P( E, F, G, H, A, B, C, D, R(52), 0x391C0CB3 );
+ P( D, E, F, G, H, A, B, C, R(53), 0x4ED8AA4A );
+ P( C, D, E, F, G, H, A, B, R(54), 0x5B9CCA4F );
+ P( B, C, D, E, F, G, H, A, R(55), 0x682E6FF3 );
+ P( A, B, C, D, E, F, G, H, R(56), 0x748F82EE );
+ P( H, A, B, C, D, E, F, G, R(57), 0x78A5636F );
+ P( G, H, A, B, C, D, E, F, R(58), 0x84C87814 );
+ P( F, G, H, A, B, C, D, E, R(59), 0x8CC70208 );
+ P( E, F, G, H, A, B, C, D, R(60), 0x90BEFFFA );
+ P( D, E, F, G, H, A, B, C, R(61), 0xA4506CEB );
+ P( C, D, E, F, G, H, A, B, R(62), 0xBEF9A3F7 );
+ P( B, C, D, E, F, G, H, A, R(63), 0xC67178F2 );
+
+ ctx->state[0] += A;
+ ctx->state[1] += B;
+ ctx->state[2] += C;
+ ctx->state[3] += D;
+ ctx->state[4] += E;
+ ctx->state[5] += F;
+ ctx->state[6] += G;
+ ctx->state[7] += H;
+}
+
+void sha256_update( sha256_context *ctx, uint8 *input, uint32 length )
+{
+ uint32 left, fill;
+
+ if( ! length ) return;
+
+ left = ctx->total[0] & 0x3F;
+ fill = 64 - left;
+
+ ctx->total[0] += length;
+ ctx->total[0] &= 0xFFFFFFFF;
+
+ if( ctx->total[0] < length )
+ ctx->total[1]++;
+
+ if( left && length >= fill )
+ {
+ memcpy( (void *) (ctx->buffer + left),
+ (void *) input, fill );
+ sha256_process( ctx, ctx->buffer );
+ length -= fill;
+ input += fill;
+ left = 0;
+ }
+
+ while( length >= 64 )
+ {
+ sha256_process( ctx, input );
+ length -= 64;
+ input += 64;
+ }
+
+ if( length )
+ {
+ memcpy( (void *) (ctx->buffer + left),
+ (void *) input, length );
+ }
+}
+
+static uint8 sha256_padding[64] =
+{
+ 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
+};
+
+void sha256_finish( sha256_context *ctx, uint8 digest[32] )
+{
+ uint32 last, padn;
+ uint32 high, low;
+ uint8 msglen[8];
+
+ high = ( ctx->total[0] >> 29 )
+ | ( ctx->total[1] << 3 );
+ low = ( ctx->total[0] << 3 );
+
+ PUT_UINT32( high, msglen, 0 );
+ PUT_UINT32( low, msglen, 4 );
+
+ last = ctx->total[0] & 0x3F;
+ padn = ( last < 56 ) ? ( 56 - last ) : ( 120 - last );
+
+ sha256_update( ctx, sha256_padding, padn );
+ sha256_update( ctx, msglen, 8 );
+
+ PUT_UINT32( ctx->state[0], digest, 0 );
+ PUT_UINT32( ctx->state[1], digest, 4 );
+ PUT_UINT32( ctx->state[2], digest, 8 );
+ PUT_UINT32( ctx->state[3], digest, 12 );
+ PUT_UINT32( ctx->state[4], digest, 16 );
+ PUT_UINT32( ctx->state[5], digest, 20 );
+ PUT_UINT32( ctx->state[6], digest, 24 );
+ PUT_UINT32( ctx->state[7], digest, 28 );
+}
+
+/** Compute the SHA 256 Hash value.
+ */
+void
+cp_secu_sha256 (u8 *buffer, uint length, u8 *output)
+{
+
+ sha256_context ctx;
+ dbg_assert (buffer);
+ dbg_assert (output);
+
+ sha256_starts(&ctx);
+ sha256_update(&ctx, buffer, length);
+ sha256_finish(&ctx, output);
+}
diff --git a/cesar/cp/secu/test/Makefile b/cesar/cp/secu/test/Makefile
new file mode 100644
index 0000000000..4cf466fc3f
--- /dev/null
+++ b/cesar/cp/secu/test/Makefile
@@ -0,0 +1,10 @@
+all: host sparc
+
+host: host-Makefile
+ make -f host-Makefile
+
+sparc: sparc-Makefile sparc-ecos.ecc.sh
+ make -f sparc-Makefile
+
+clean :
+ rm -rf obj
diff --git a/cesar/cp/secu/test/host-Makefile b/cesar/cp/secu/test/host-Makefile
new file mode 100644
index 0000000000..4ac8c3750a
--- /dev/null
+++ b/cesar/cp/secu/test/host-Makefile
@@ -0,0 +1,19 @@
+BASE = ../../..
+
+HOST_PROGRAMS = test-sha2 test-aes test-prun test-nmk
+
+test-sha2_SOURCES = test-sha2.c
+test-sha2_MODULES = lib cp/secu
+
+test-aes_SOURCES = test-aes.c
+test-aes_MODULES = lib cp/secu
+
+test-prun_SOURCES = test-prun.c
+test-prun_MODULES = lib cp/secu
+
+test-nmk_SOURCES = test-nmk.c
+test-nmk_MODULES = lib cp/secu
+
+VARIANT = host
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/secu/test/sparc-Makefile b/cesar/cp/secu/test/sparc-Makefile
new file mode 100644
index 0000000000..da046afbac
--- /dev/null
+++ b/cesar/cp/secu/test/sparc-Makefile
@@ -0,0 +1,15 @@
+BASE = ../../..
+
+TARGET = sparc
+ECOS = y
+
+TARGET_PROGRAMS = test-sha2 test-aes
+
+test-sha2_SOURCES = test-sha2.c
+test-sha2_MODULES = lib cp/secu
+
+test-aes_SOURCES = test-aes.c
+test-aes_MODULES = lib cp/secu
+
+VARIANT = sparc
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/secu/test/sparc-ecos.ecc.sh b/cesar/cp/secu/test/sparc-ecos.ecc.sh
new file mode 100644
index 0000000000..db2208c6cc
--- /dev/null
+++ b/cesar/cp/secu/test/sparc-ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new sparc_leon default
+cat >> $config <<'EOF'
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/secu/test/src/test-aes.c b/cesar/cp/secu/test/src/test-aes.c
new file mode 100644
index 0000000000..674d22c84c
--- /dev/null
+++ b/cesar/cp/secu/test/src/test-aes.c
@@ -0,0 +1,127 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test-aes.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "lib/test.h"
+#include "lib/bitstream.h"
+#include "string.h"
+
+#include "cp/secu/aes.h"
+
+void
+test_case_aes (test_t test)
+{
+ aes_context aes;
+
+ u32 key[4] = {0x03020100, 0x08070605, 0x0D0C0B0A, 0x1211100F};
+
+ u32 input [4] = {0xA4126850, 0x89C8085F, 0x80597FB9, 0x59838B03};
+
+ u32 result [4] = {0x5332F5D8, 0x7DEF8982, 0xA406B506, 0xC9E95BFD};
+
+ u32 output [4];
+
+ aes_set_key (&aes, (u8*) key);
+ aes_encrypt (&aes, (u8*) input, (u8*) output);
+
+ test_case_begin (test, "AES");
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (memcmp(output, result, 16) != 0,
+ "Wrong encryption");
+
+ aes_decrypt (&aes, (u8*) output, (u8*) output);
+ test_fail_if (memcmp(output, input, 16) != 0,
+ "Wrong encryption");
+ }
+ test_end;
+}
+
+void
+test_case_aes_in_one_buffer (test_t test)
+{
+ aes_context aes;
+
+ u32 key[4] = {0x03020100, 0x08070605, 0x0D0C0B0A, 0x1211100F};
+
+ u32 input [4] = {0xA4126850, 0x89C8085F, 0x80597FB9, 0x59838B03};
+
+ u32 buffer [4] = {0xA4126850, 0x89C8085F, 0x80597FB9, 0x59838B03};
+
+ u32 result [4] = {0x5332F5D8, 0x7DEF8982, 0xA406B506, 0xC9E95BFD};
+
+ aes_set_key (&aes, (u8*) key);
+ aes_encrypt_le (&aes, (u8*) buffer);
+
+ test_case_begin (test, "AES");
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (memcmp(buffer, result, 16) != 0,
+ "Wrong encryption");
+
+ aes_decrypt_le (&aes, (unsigned char *) buffer);
+ test_fail_if (memcmp(buffer, input, 16) != 0,
+ "Wrong encryption");
+ }
+ test_end;
+}
+
+void
+test_case_aes_crypt_in_one_buffer (test_t test)
+{
+ aes_context aes;
+ uint i;
+
+ u32 key[4] = {0x03020100, 0x08070605, 0x0D0C0B0A, 0x1211100F};
+ u32 key_cp [4];
+
+ u8 input [224];
+ u8 buffer [224];
+
+ for ( i = 0; i < 224; i++)
+ input [i] = i;
+ memcpy (input, buffer, 224);
+
+ memcpy (key_cp, key, 16);
+ aes_set_key (&aes, (unsigned char *) key);
+ aes_cbc_encrypt_le (&aes, (unsigned char *) key, buffer, 224);
+
+ test_case_begin (test, "AES");
+
+ test_begin (test, "Verify")
+ {
+ aes_cbc_decrypt_le (&aes, (unsigned char *) key_cp,
+ buffer, 224);
+ test_fail_if (memcmp(buffer, input, 224) != 0,
+ "Wrong encryption");
+ }
+ test_end;
+}
+
+int
+main (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_aes (test);
+ test_case_aes_in_one_buffer (test);
+ test_case_aes_crypt_in_one_buffer (test);
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/secu/test/src/test-nmk.c b/cesar/cp/secu/test/src/test-nmk.c
new file mode 100644
index 0000000000..99830a8956
--- /dev/null
+++ b/cesar/cp/secu/test/src/test-nmk.c
@@ -0,0 +1,138 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test-nmk.c
+ * \brief Test the generation of the NMK
+ * \ingroup cp_secu
+ *
+ * Test the generation of the NMK with the data provided in section 13.5 table
+ * 13-342.
+ * Entry buffer "HomePlugAV0123"
+ * NMK 0xb59319d7e8157ba001b018669cce
+ */
+#include "common/std.h"
+#include "string.h"
+#include "stdio.h"
+#include "lib/test.h"
+
+#include "cp/secu/secu.h"
+#include "cp/secu/aes.h"
+#include "cp/secu/sha256.h"
+
+#include "cp/secu/inc/pbkdf1.h"
+
+void
+test_case_nmk_generation (test_t test)
+{
+ uint i;
+ uint memcpy_result;
+ u8 buffer[64] __attribute__((aligned(64))) = "HomePlugAV0123\0";
+ u8 result [64] __attribute__((aligned(64))) = {0xb5, 0x93, 0x19, 0xd7,
+ 0xe8, 0x15, 0x7b, 0xa0, 0x01, 0xb0, 0x18, 0x66, 0x9c, 0xce, 0xe3, 0x0d};
+
+ cp_secu_npw2nmk (buffer, 14);
+
+ test_case_begin (test, "NMK generation");
+
+ memcpy_result = memcmp(buffer, result, 16);
+ test_begin (test, "verify")
+ {
+ test_fail_if (memcpy_result != 0, "Wrong nmk");
+ }
+ test_end;
+
+ if (memcpy_result)
+ {
+ for ( i = 0; i < 16; i++)
+ {
+ printf ("%02x ", buffer[i]);
+ }
+ printf ("\n");
+ }
+}
+
+void
+test_case_dak_generation (test_t test)
+{
+ uint i;
+ uint memcpy_result;
+ u8 buffer[64] __attribute__((aligned(64)));
+ u8 result [64] __attribute__((aligned(64))) = {0xEE, 0x7F, 0x57, 0x88,
+ 0xE2, 0xA0, 0x21, 0xC9, 0x99, 0x46, 0x9A, 0xC5, 0x2A, 0xF3, 0x0A,
+ 0x06};
+
+
+ strcpy ((char *)buffer, "DAK_Password\0");
+
+ cp_secu_dak_gen (buffer, 12);
+
+ test_case_begin (test, "DAK generation");
+
+ memcpy_result = memcmp(buffer, result, 16);
+ test_begin (test, "verify")
+ {
+ test_fail_if (memcpy_result != 0, "Wrong DAK");
+ }
+ test_end;
+
+ if (memcpy_result)
+ {
+ for ( i = 0; i < 16; i++)
+ {
+ printf ("%02x ", buffer[i]);
+ }
+ printf ("\n");
+ }
+}
+
+void
+test_case_nid_generation (test_t test)
+{
+ uint i;
+ uint memcpy_result;
+ u8 buffer [64] __attribute__((aligned(64))) = {0xb5, 0x93, 0x19, 0xd7,
+ 0xe8, 0x15, 0x7b, 0xa0, 0x01, 0xb0, 0x18, 0x66, 0x9c, 0xce, 0xe3, 0x0d};
+ u8 result [64] __attribute__((aligned(64))) = {0x02, 0x6b, 0xcb, 0xa5,
+ 0x35, 0x4e, 0x18};
+
+ cp_secu_nmk2nid (buffer, 0x1);
+
+ test_case_begin (test, "NID generation");
+
+ memcpy_result = memcmp(buffer, result, 7);
+ test_begin (test, "verify")
+ {
+ test_fail_if (memcpy_result != 0, "Wrong NID");
+ }
+ test_end;
+
+ if (memcpy_result)
+ {
+ for ( i = 0; i < 7; i++)
+ {
+ printf ("%02x ", buffer[i]);
+ }
+ printf ("\n");
+ }
+}
+
+
+int
+main (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_nmk_generation (test);
+ test_case_dak_generation (test);
+ test_case_nid_generation (test);
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/secu/test/src/test-prun.c b/cesar/cp/secu/test/src/test-prun.c
new file mode 100644
index 0000000000..bf53fe81c9
--- /dev/null
+++ b/cesar/cp/secu/test/src/test-prun.c
@@ -0,0 +1,211 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test-prun.c
+ * \brief Test the protocol run
+ * \ingroup cp_secu
+ *
+ */
+#include "common/std.h"
+#include "lib/test.h"
+
+#include "cp/secu/secu.h"
+
+void
+test_case_secu_prun_init (test_t test)
+{
+ cp_secu_protocol_run_t prun;
+
+ cp_secu_protocol_run_new (&prun, 0x1, 0x54, 0x34);
+
+ test_case_begin (test, "Protocol Run");
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (prun.pmn != 0x1, "Wrong PMN");
+ test_fail_if (prun.pid != 0x1, "Wrong protocol run PID");
+ test_fail_if (prun.prn != 0x54, "Wrong PRN");
+ test_fail_if (prun.my_nonce != 0x34);
+ }
+ test_end;
+}
+
+void
+test_case_secu_protocol_check (test_t test)
+{
+ uint result;
+ cp_secu_protocol_run_t prun;
+ cp_secu_protocol_run_t prun_recv;
+
+ cp_secu_protocol_run_new (&prun, 0x1, 0x54, 0x34);
+ cp_secu_protocol_run_new (&prun_recv, 0x1, 0x54, 0x34);
+
+ prun.my_nonce = 0x12345;
+ prun.your_nonce = 0x3456;
+
+ prun_recv.my_nonce = 0x12345;
+ prun_recv.your_nonce = 0x3456;
+ prun_recv.pmn++;
+
+ test_case_begin (test, "Protocol Run check");
+
+ result = cp_secu_protocol_check (&prun, &prun_recv);
+ test_begin (test, "Success")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT,
+ "Wrong Result");
+ }
+ test_end;
+
+ prun_recv.pmn = 0xff;
+
+ result = cp_secu_protocol_check (&prun, &prun_recv);
+ test_begin (test, "Success, last message")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT,
+ "Wrong Result");
+ }
+ test_end;
+
+ prun.my_nonce = 0x12345;
+ prun.your_nonce = 0x3456;
+
+ prun_recv.your_nonce = 0x12345;
+ prun_recv.my_nonce = 0x3456;
+ prun_recv.pmn = prun.pmn + 1;
+
+ result = cp_secu_protocol_check (&prun, &prun_recv);
+ test_begin (test, "Failure, Nonce not correct")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE,
+ "Wrong Result");
+ }
+ test_end;
+
+ prun.my_nonce = 0x12345;
+ prun.your_nonce = 0x3456;
+
+ prun_recv.my_nonce = 0x12345;
+ prun_recv.your_nonce = 0x3456;
+ prun_recv.pmn = 42;
+
+ result = cp_secu_protocol_check (&prun, &prun_recv);
+ test_begin (test, "Failure, PMN not correct")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE,
+ "Wrong Result");
+ }
+ test_end;
+
+ prun.my_nonce = 0x12345;
+ prun.your_nonce = 0x3456;
+
+ prun_recv.my_nonce = 0x12345;
+ prun_recv.your_nonce = 0x3456;
+ prun_recv.pmn = 1;
+
+ result = cp_secu_protocol_check (&prun, &prun_recv);
+ test_begin (test, "Restart")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEW,
+ "Wrong Result");
+ }
+ test_end;
+
+ prun.my_nonce = 0x12345;
+ prun.your_nonce = 0x3456;
+ prun.pid = 1;
+
+ prun_recv.my_nonce = 0x12345;
+ prun_recv.your_nonce = 0x3456;
+ prun_recv.pmn = prun.pmn + 1;
+ prun_recv.pid = 2;
+
+ result = cp_secu_protocol_check (&prun, &prun_recv);
+ test_begin (test, "Failure, PID not correct")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE,
+ "Wrong Result");
+ }
+ test_end;
+
+ prun.my_nonce = 0x12345;
+ prun.your_nonce = 0x3456;
+ prun.pid = 1;
+
+ prun_recv.my_nonce = 0x12345;
+ prun_recv.your_nonce = 0x3456;
+ prun_recv.pmn = prun.pmn + 1;
+ prun_recv.pid = 1;
+ prun_recv.prn = prun.prn + 1;
+
+ result = cp_secu_protocol_check (&prun, &prun_recv);
+ test_begin (test, "Failure, PRN not correct")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE,
+ "Wrong Result");
+ }
+ test_end;
+
+ result = cp_secu_protocol_check (NULL, &prun);
+ test_begin (test, "Success, first message")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEW,
+ "Wrong Result");
+ }
+ test_end;
+
+ prun.pmn ++;
+ result = cp_secu_protocol_check (NULL, &prun);
+ test_begin (test, "FAILURE, NOT message")
+ {
+ test_fail_if (result != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_FAILURE,
+ "Wrong Result");
+ }
+ test_end;
+}
+
+void
+test_case_secu_protocol_next (test_t test)
+{
+ cp_secu_protocol_run_t prun;
+
+ cp_secu_protocol_run_new (&prun, 0x1, 0x54, 0x34);
+
+ test_case_begin (test, "Protocol run next");
+
+ cp_secu_protocol_next (&prun, false);
+ test_begin (test, "Verify")
+ {
+ test_fail_if (prun.pmn != 2, "Wrong PMN");
+ }
+ test_end;
+
+ cp_secu_protocol_next (&prun, true);
+ test_begin (test, "Verify")
+ {
+ test_fail_if (prun.pmn != 0xFF, "Wrong PMN");
+ }
+ test_end;
+
+}
+
+int
+main (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_secu_prun_init (test);
+ test_case_secu_protocol_check (test);
+ test_case_secu_protocol_next (test);
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/secu/test/src/test-sha2.c b/cesar/cp/secu/test/src/test-sha2.c
new file mode 100644
index 0000000000..48d5b128cb
--- /dev/null
+++ b/cesar/cp/secu/test/src/test-sha2.c
@@ -0,0 +1,87 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/secu/test/src/test-sha2.c
+ * \brief Test SHA 256.
+ * \ingroup cp_secu
+ *
+ */
+#include "common/std.h"
+#include "lib/test.h"
+#include "lib/read_word.h"
+#include "lib/bitstream.h"
+#include "string.h"
+
+#include "cp/secu/sha256.h"
+
+void
+test_case_sha2 (test_t test)
+{
+ u8 buffer[64] __attribute__((aligned(64))) =
+ "The quick brown fox jumps over the lazy dog\0";
+ u8 result [32] = {0xd7, 0xa8, 0xfb, 0xb3, 0x07, 0xd7, 0x80, 0x94,
+ 0x69, 0xca, 0x9a, 0xbc, 0xb0, 0x08, 0x2e, 0x4f, 0x8d, 0x56,
+ 0x51, 0xe4, 0x6d, 0x3c, 0xdb, 0x76, 0x2d, 0x02, 0xd0, 0xbf,
+ 0x37, 0xc9, 0xe5, 0x92};
+
+ u8 buffer2[64] __attribute__((aligned(64))) =
+ "The quick brown fox jumps over the lazy cog\0";
+ u8 result2 [32] = {0xe4, 0xc4, 0xd8, 0xf3, 0xbf, 0x76, 0xb6, 0x92, 0xde,
+ 0x79, 0x1a, 0x17, 0x3e, 0x05, 0x32, 0x11, 0x50, 0xf7, 0xa3, 0x45,
+ 0xb4, 0x64, 0x84, 0xfe, 0x42, 0x7f, 0x6a, 0xcc, 0x7e, 0xcc, 0x81,
+ 0xbe};
+
+ u8 buffer3[64] __attribute__((aligned(64))) =
+ "";
+ u8 result3 [32] = {0xe3, 0xb0, 0xc4, 0x42, 0x98, 0xfc, 0x1c, 0x14, 0x9a,
+ 0xfb, 0xf4, 0xc8, 0x99, 0x6f, 0xb9, 0x24, 0x27, 0xae, 0x41, 0xe4,
+ 0x64, 0x9b, 0x93, 0x4c, 0xa4, 0x95, 0x99, 0x1b, 0x78, 0x52, 0xb8,
+ 0x55};
+
+ cp_secu_sha256 (buffer, strlen((char*)buffer), buffer);
+
+ test_case_begin (test, "SHA 256");
+
+ test_begin (test, "SHA 256")
+ {
+ test_fail_if (bitstream_memcmp (buffer, result, 32) != true,
+ "Wrong buffer out value");
+ }
+ test_end;
+
+ cp_secu_sha256 (buffer2, strlen((char*)buffer2), buffer2);
+
+ test_begin (test, "SHA 256 Test 2")
+ {
+ test_fail_if (bitstream_memcmp (buffer2, result2, 32) != true,
+ "Wrong buffer out value");
+ }
+ test_end;
+
+ cp_secu_sha256 (buffer3, strlen((char*)buffer3), buffer3);
+
+ test_begin (test, "SHA 256 Test 3")
+ {
+ test_fail_if (bitstream_memcmp (buffer3, result3, 32) != true,
+ "Wrong buffer out value");
+ }
+ test_end;
+}
+
+int
+main (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_sha2 (test);
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/secu/test/utest/Makefile b/cesar/cp/secu/test/utest/Makefile
new file mode 100644
index 0000000000..8bd798503e
--- /dev/null
+++ b/cesar/cp/secu/test/utest/Makefile
@@ -0,0 +1,7 @@
+BASE = ../../../..
+
+HOST_PROGRAMS = test_secu
+test_secu_SOURCES = test_secu.c
+test_secu_MODULES = lib cp/secu
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/secu/test/utest/src/test_secu.c b/cesar/cp/secu/test/utest/src/test_secu.c
new file mode 100644
index 0000000000..3c51941aca
--- /dev/null
+++ b/cesar/cp/secu/test/utest/src/test_secu.c
@@ -0,0 +1,28 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_secu.c
+ * \brief Test secu module.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+
+/* For the moment, only test headers compilation. */
+#include "cp/secu/secu.h"
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ test_init (t, argc, argv);
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/spoc/Module b/cesar/cp/spoc/Module
new file mode 100644
index 0000000000..3eadb9ee3f
--- /dev/null
+++ b/cesar/cp/spoc/Module
@@ -0,0 +1 @@
+SOURCES := spoc.c
diff --git a/cesar/cp/spoc/spoc.h b/cesar/cp/spoc/spoc.h
new file mode 100644
index 0000000000..36cfca523e
--- /dev/null
+++ b/cesar/cp/spoc/spoc.h
@@ -0,0 +1,50 @@
+#ifndef spoc_h
+#define spoc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file spoc.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+//typedef float spoc_prec_t;
+typedef double spoc_prec_t; // en flottant sinx/x avec x=0.1ppm retourne 1
+
+
+#ifdef SPOC_COMPARE_SCILAB
+spoc_prec_t args_haut[41];
+spoc_prec_t args_bas[41];
+spoc_prec_t sinc_haut[41];
+spoc_prec_t sinc_bas[41];
+spoc_prec_t divisor[41];
+spoc_prec_t args_haut_rx[41];
+spoc_prec_t args_bas_rx[41];
+spoc_prec_t sinc_haut_rx[41];
+spoc_prec_t sinc_bas_rx[41];
+#endif
+spoc_prec_t reg_pente_tx[41];
+spoc_prec_t reg_ordo_tx[41];
+spoc_prec_t reg_pente_rx[41];
+spoc_prec_t reg_ordo_rx[41];
+
+spoc_prec_t reg_CG_N[21];
+spoc_prec_t reg_CG_FC10[21];
+spoc_prec_t reg_CG_PR1[21];
+spoc_prec_t reg_CG_PR2[21];
+
+
+void
+spoc_MCoeff (spoc_prec_t rho);
+
+void
+spoc_CG (spoc_prec_t rho, int n, spoc_prec_t *reg);
+
+#endif /* spoc_h */
diff --git a/cesar/cp/spoc/src/spoc.c b/cesar/cp/spoc/src/spoc.c
new file mode 100644
index 0000000000..ef258570a0
--- /dev/null
+++ b/cesar/cp/spoc/src/spoc.c
@@ -0,0 +1,175 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/spoc.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "hal/phy/defs.h"
+#include "cp/spoc/spoc.h"
+#include "math.h"
+
+#define SPOC_PMIN PHY_CARRIER_OFFSET
+#define SPOC_PMAX (PHY_CARRIER_NB + SPOC_PMIN - 1)
+#define SPOC_DIAGONAL_LENGTH PHY_CARRIER_NB
+
+spoc_prec_t kaiser[10] = { 0.9905, 0.9622, 0.9164, 0.8546, 0.7792, 0.6929, 0.5989, 0.5005, 0.4011, 0.304 };
+
+void
+spoc_CG (spoc_prec_t rho, int N, spoc_prec_t *reg)
+{
+ spoc_prec_t arg_p = N*M_PI*rho;
+ spoc_prec_t arg_n = arg_p;
+ spoc_prec_t sinus = sin (arg_p);
+ if (arg_p == 0) reg[10] = 1;
+ else reg[10] = sinus/arg_p;
+ int k;
+ spoc_prec_t kk;
+ for(k=1;k<=10; k++)
+ {
+ sinus = -sinus;
+ kk = kaiser[k-1]*sinus;
+ arg_p+=M_PI;
+ arg_n-=M_PI;
+ /* Remarque sur la division par arg_p = pi(k-N*rho).
+ * si |rho|<300ppm, N<3072, |k|<=1 alors arg_p != 0
+ * et lalors arg_p=0 que si rho=0 et k=0. voir au dessus. */
+ reg[k+10] = kk/arg_p;
+ reg[10-k] = kk/arg_n;
+ }
+}
+
+void
+spoc_MCoeff (spoc_prec_t rho)
+{
+ int k;
+ spoc_prec_t xi,xe;
+ spoc_prec_t sin_xi,sin_xe;
+ spoc_prec_t cos_xi,cos_xe;
+ spoc_prec_t pirho = M_PI * rho;
+ spoc_prec_t SIN_PIRHO = sin(pirho);
+ spoc_prec_t COS_PIRHO = cos(pirho);
+ spoc_prec_t delta;
+ uint len;
+ spoc_prec_t sin_prev;
+
+ spoc_prec_t rho_abs = rho;
+ if (rho < 0) rho_abs = -rho;
+ if (rho_abs >= 1e-8)
+ {
+ //printf ("normal computation\n");
+ xi = pirho * SPOC_PMIN;
+ xe = pirho * SPOC_PMAX;
+ sin_xi = sin(xi);
+ sin_xe = sin(xe);
+ cos_xi = cos(xi);
+ len = SPOC_DIAGONAL_LENGTH - 1; // interval nb in the diagonal.
+
+#ifdef SPOC_COMPARE_SCILAB
+ args_haut[20] = xi;
+ args_bas[20] = xe;
+ sinc_haut[20] = sin_xi/xi;
+ sinc_bas[20] = sin_xe/xe;
+ divisor[20] = len*len;
+ args_haut_rx[20] = -xi;
+ args_bas_rx[20] = -xe;
+ sinc_haut_rx[20] = sin_xi/xi;
+ sinc_bas_rx[20] = sin_xe/xe;
+#endif
+ if (xi == 0 )
+ {
+ reg_ordo_tx[20] = reg_ordo_rx[20] = 1;
+ reg_pente_tx[20] = reg_pente_rx[20] = 0;
+ }
+ else
+ {
+ reg_ordo_tx[20] = reg_ordo_rx[20] = sin_xi/xi;
+ reg_pente_tx[20] = reg_pente_rx[20] = (sin_xe/xe - reg_ordo_tx[20])/(len*len);
+ }
+
+ delta = 0;
+ /* Diagonales superieures */
+ for (k=1; k<=20; k++)
+ {
+ xi += (M_PI + pirho);
+ xe += M_PI;
+ delta += 2*M_PI;
+ sin_prev = sin_xi;
+ sin_xi = -sin_prev * COS_PIRHO - cos_xi * SIN_PIRHO;
+ cos_xi = sin_prev * SIN_PIRHO - cos_xi * COS_PIRHO;
+ sin_xe = -sin_xe;
+ sin_xi = sin(xi);
+ len -= 1;
+ spoc_prec_t mux = 1.0/len;
+ reg_ordo_tx[k+20] = sin_xi/xi;
+ reg_ordo_rx[k+20] = -sin_xi/(-xi+delta);
+ reg_pente_tx[k+20] = (sin_xe/xe - reg_ordo_tx[k+20])*mux;
+ reg_pente_rx[k+20] = (-sin_xe/(-xe+delta) - reg_ordo_rx[k+20])*mux;
+#ifdef SPOC_COMPARE_SCILAB
+ divisor[k+20] = len;
+ args_haut[k+20] = xi;
+ args_bas[k+20] = xe;
+ sinc_haut[k+20] = sin_xi/xi;
+ sinc_bas[k+20] = sin_xe/xe;
+ args_haut_rx[k+20] = -xi+delta;
+ args_bas_rx[k+20] = -xe+delta;
+ sinc_haut_rx[k+20] = -sin_xi/(-xi+delta);
+ sinc_bas_rx[k+20] = -sin_xe/(-xe+delta);
+#endif
+ }
+ xi = pirho * SPOC_PMIN;
+ xe = pirho * SPOC_PMAX;
+ sin_xi = reg_ordo_tx[20] * xi;
+ sin_xe = sin(xe);
+ cos_xe = cos(xe);
+ len = SPOC_DIAGONAL_LENGTH - 1;
+ delta=0;
+ /* Diagonales inferieures */
+ for (k=1; k<=20; k++)
+ {
+ xe -= (M_PI + pirho);
+ xi -= M_PI;
+ delta -= 2*M_PI;
+ sin_prev = sin_xe;
+ sin_xe = -sin_prev * COS_PIRHO + cos_xe * SIN_PIRHO;
+ cos_xe = -sin_prev * SIN_PIRHO - cos_xe * COS_PIRHO;
+ sin_xi = -sin_xi;
+ len -= 1;
+ spoc_prec_t mux = 1.0/len;
+ reg_ordo_tx[20-k] = sin_xi/xi;
+ reg_ordo_rx[20-k] = -sin_xi/(-xi+delta);
+ reg_pente_tx[20-k] = (sin_xe/xe - reg_ordo_tx[20-k])*mux;
+ reg_pente_rx[20-k] = (-sin_xe/(-xe+delta) - reg_ordo_rx[20-k])*mux;
+#ifdef SPOC_COMPARE_SCILAB
+ divisor[20-k] = len;
+ args_haut[20-k] = xi;
+ args_bas[20-k] = xe;
+ sinc_haut[20-k] = sin_xi/xi;
+ sinc_bas[20-k] = sin_xe/xe;
+ args_haut_rx[20-k] = -xi+delta;
+ args_bas_rx[20-k] = -xe+delta;
+ sinc_haut_rx[20-k] = -sin_xi/(-xi+delta);
+ sinc_bas_rx[20-k] = -sin_xe/(-xe+delta);
+#endif
+ }
+ }
+ else
+ {
+ //printf ("fast computation\n");
+ for (k=1; k<=20; k++)
+ {
+ reg_ordo_tx[k+20] = reg_ordo_tx[20-k] = reg_ordo_rx[k+20] = reg_ordo_rx [20-k] = 0;
+ reg_pente_tx[k+20] = reg_pente_tx[20-k]= reg_pente_rx[k+20] = reg_pente_rx [20-k] = 0;
+ }
+ reg_ordo_tx[20] = reg_ordo_rx[20] = 1;
+ reg_pente_tx[20] = reg_pente_rx[20] = 0;
+ }
+}
diff --git a/cesar/cp/spoc/test/ApproxOrder1ParamMCoeff.sci b/cesar/cp/spoc/test/ApproxOrder1ParamMCoeff.sci
new file mode 100644
index 0000000000..b76f650c69
--- /dev/null
+++ b/cesar/cp/spoc/test/ApproxOrder1ParamMCoeff.sci
@@ -0,0 +1,36 @@
+function [arg_i, arg_e, sinc_i, sinc_e, div, ordo, pente] = ApproxOrder1ParamMCoeff(rho,X0,N,Coeff_number)
+
+if Coeff_number<0
+ xi=X0 - Coeff_number;
+ xe=N-1;
+ qi= X0-Coeff_number;
+ qe=N-1;
+ ki=X0+ 0;
+ ke=N+Coeff_number-1;
+elseif Coeff_number>0
+ xi=X0;
+ xe=(N-1)-abs(Coeff_number);
+ qi=X0+ 0;
+ qe=N-Coeff_number-1;
+ ki=X0+ Coeff_number;
+ ke=N-1;
+else
+ xi=X0;
+ xe=(N-1)-abs(Coeff_number);
+ qi=X0;
+ qe=N-1;
+ ki=X0;
+ ke=N-1;
+end
+xi;
+xe;
+arg_i = %pi*(ki*(1+rho)-qi);
+arg_e = %pi*(ke*(1+rho) - qe);
+sinc_i=sinc( arg_i);
+sinc_e=sinc( arg_e);
+div = xe-xi;
+pente=(sinc_e-sinc_i)/(xe-xi);
+//pente=(sinc_e-sinc_i);
+ordo=sinc_i;
+
+endfunction
diff --git a/cesar/cp/spoc/test/ApproxOrder2ParamMCoeff.sci b/cesar/cp/spoc/test/ApproxOrder2ParamMCoeff.sci
new file mode 100644
index 0000000000..fca72b620f
--- /dev/null
+++ b/cesar/cp/spoc/test/ApproxOrder2ParamMCoeff.sci
@@ -0,0 +1,34 @@
+function [args_i,args_e, sinc_i, sinc_e, div, ordo, pente] = ApproxOrder2ParamMCoeff(rho,X0,N,Coeff_number)
+
+
+// calcul des points pour approximer
+if Coeff_number<21
+ x1= X0 + 21-Coeff_number;
+ x3=N-1;
+elseif Coeff_number>21
+ x1= X0;
+ x3=N-1 -(Coeff_number-21);
+else
+ x1= X0;
+ x3=N-1;
+
+end
+
+args_i = %pi*((x1 + (Coeff_number-21))*(1+rho) - x1 );
+args_e = %pi*((x3 + (Coeff_number-21))*(1+rho) - x3 );
+sinc_i=sinc(args_i);
+sinc_e=sinc(args_e);
+
+
+// calcul des coefficients when y=ax²+c
+div = (x3 - x1)^2;
+pente= (sinc_e-sinc_i)/(div);
+ordo = sinc_i;
+
+endfunction
+
+
+
+
+
+
diff --git a/cesar/cp/spoc/test/Makefile b/cesar/cp/spoc/test/Makefile
new file mode 100644
index 0000000000..439b2e2572
--- /dev/null
+++ b/cesar/cp/spoc/test/Makefile
@@ -0,0 +1,11 @@
+BASE = ../../..
+
+INCLUDES = cp/spoc/test
+
+EXTRA_HOST_CFLAGS=-O3
+EXTRA_HOST_LDFLAGS=-lm
+HOST_PROGRAMS = test_coeff_check
+test_coeff_check_SOURCES = test_coeff_check.c
+test_coeff_check_MODULES = lib
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/spoc/test/coeff_generation.scilab b/cesar/cp/spoc/test/coeff_generation.scilab
new file mode 100644
index 0000000000..f26946f208
--- /dev/null
+++ b/cesar/cp/spoc/test/coeff_generation.scilab
@@ -0,0 +1,22 @@
+pwd
+args = sciargs();
+rho = msscanf(args(5),"%lg")
+getf ("ApproxOrder1ParamMCoeff.sci");
+getf ("ApproxOrder2ParamMCoeff.sci");
+getf ("get_Approx1.sci");
+[args_tx_i,args_tx_e,sinc_tx_i, sinc_tx_e, div_tx, ordo_tx, pente_tx] = get_Approx1( rho,74,1155+74);
+[args_rx_i,args_rx_e,sinc_rx_i, sinc_rx_e, div_rx, ordo_rx, pente_rx] = get_Approx1(-rho,74,1155+74);
+fp = file("open","./obj/args_of_sinc.txt","unknown");
+fprintf (fp, "%5.15g %5.15g %5.15g %5.15g\n", args_tx_i, args_tx_e, args_rx_i, args_rx_e);
+file ("close", fp);
+fp = file("open","./obj/sinc.txt","unknown");
+fprintf (fp, "%5.15g %5.15g %5.15g %5.15g\n", sinc_tx_i, sinc_tx_e, sinc_rx_i, sinc_rx_e);
+file ("close", fp);
+fp = file("open","./obj/divisor.txt","unknown");
+fprintf (fp, "%5.15g %5.15g\n", div_tx, div_rx);
+file ("close", fp);
+fp = file("open","./obj/coeff.txt","unknown");
+fprintf (fp, "%5.15g %5.15g %5.15g %5.15g\n", ordo_tx, pente_tx, ordo_rx, pente_rx);
+file ("close", fp);
+exit;
+
diff --git a/cesar/cp/spoc/test/define_spoc_c.h b/cesar/cp/spoc/test/define_spoc_c.h
new file mode 100644
index 0000000000..325e6aa214
--- /dev/null
+++ b/cesar/cp/spoc/test/define_spoc_c.h
@@ -0,0 +1,20 @@
+#ifndef define_spoc_c_h
+#define define_spoc_c_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file define_spoc_c.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+#define SPOC_COMPARE_SCILAB
+#include "cp/spoc/src/spoc.c"
+#endif /* define_spoc_c_h */
diff --git a/cesar/cp/spoc/test/get_Approx1.sci b/cesar/cp/spoc/test/get_Approx1.sci
new file mode 100644
index 0000000000..4ec86afc2f
--- /dev/null
+++ b/cesar/cp/spoc/test/get_Approx1.sci
@@ -0,0 +1,21 @@
+function [args_i, args_e, sinc_i, sinc_e, divs, ordos, pentes] = get_Approx1(rho,X0,N)
+for i=-20:20
+ if (i==0)
+ [arg_i, arg_e, si, se, div, ordo,pente] = ApproxOrder2ParamMCoeff(rho,X0,N,21);
+ else
+ [arg_i, arg_e, si, se, div, ordo,pente] = ApproxOrder1ParamMCoeff(rho,X0,N,i);
+ end
+ args_i(i+21)=arg_i;
+ args_e(i+21)=arg_e;
+ sinc_i(i+21)=si;
+ sinc_e(i+21)=se;
+ divs(i+21) = div;
+ ordos(i+21)=ordo;
+ pentes(i+21)=pente;
+end
+
+
+
+
+endfunction
+
diff --git a/cesar/cp/spoc/test/src/test_coeff_check.c b/cesar/cp/spoc/test/src/test_coeff_check.c
new file mode 100644
index 0000000000..5a50d41d0b
--- /dev/null
+++ b/cesar/cp/spoc/test/src/test_coeff_check.c
@@ -0,0 +1,194 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_spoc.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "define_spoc_c.h"
+#include <stdio.h>
+#include <stdlib.h>
+#include "math.h"
+#include "lib/test.h"
+
+#define FAIL_LIMIT 1e-6
+#define SPOC_TEST_DBG 0
+
+double kaiser_d[10] = { 0.9905, 0.9622, 0.9164, 0.8546, 0.7792, 0.6929, 0.5989, 0.5005, 0.4011, 0.304 };
+
+double
+err (double a, double ref)
+{
+ double ret = 0;
+ //printf ("DBG : a=%5.15g ref=%5.15g\n", a, ref);
+ if (ref == 0)
+ {
+ ret = a;
+ }
+ else
+ {
+ if (a == 0) ret = ref;
+ else ret = (a-ref)/ref;
+ }
+ if (ret<0) ret = -ret;
+ return(ret);
+}
+
+double
+data_Mcheck_dbg_print (char* filestring, char* haut_str, char *bas_str,
+ spoc_prec_t *tx_coeff_haut, spoc_prec_t *tx_coeff_bas,
+ spoc_prec_t *rx_coeff_haut, spoc_prec_t *rx_coeff_bas )
+{
+ double tx_haut, tx_bas;
+ double rx_haut, rx_bas;
+ double tx_haut_err, tx_bas_err;
+ double rx_haut_err, rx_bas_err;
+ double ret=0;
+ FILE *fref = fopen (filestring, "r");
+ int i;
+ for (i=0; i<41; i++)
+ {
+ fscanf (fref, "%lg %lg %lg %lg", &tx_haut, &tx_bas, &rx_haut, &rx_bas);
+ tx_haut_err = err (tx_coeff_haut[i], tx_haut);
+ tx_bas_err = err(tx_coeff_bas[i], tx_bas);
+ rx_haut_err = err (rx_coeff_haut[i], rx_haut);
+ rx_bas_err = err(rx_coeff_bas[i], rx_bas);
+ if (ret < rx_haut_err) ret = rx_haut_err;
+ if (ret < rx_bas_err) ret = rx_bas_err;
+ if (ret < tx_haut_err) ret = tx_haut_err;
+ if (ret < tx_bas_err) ret = tx_bas_err;
+#if defined (SPOC_TEST_DBG) && (SPOC_TEST_DBG==2)
+ printf ("TX_%s[%d] %5.15g<-->%5.15g\t %5.15g\n", haut_str, i-20, tx_coeff_haut[i], tx_haut, tx_haut_err);
+ printf ("TX_%s[%d] %5.15g<-->%5.15g\t %5.15g ", bas_str, i-20, tx_coeff_bas[i], tx_bas, tx_bas_err);
+ if ((tx_bas_err > FAIL_LIMIT) || (tx_haut_err > FAIL_LIMIT)) printf (" * \n");
+ else printf ("\n");
+ printf ("RX_%s[%d] %5.15g<-->%5.15g\t %5.15g\n", haut_str, i-20, rx_coeff_haut[i], rx_haut, rx_haut_err);
+ printf ("RX_%s[%d] %5.15g<-->%5.15g\t %5.15g ", bas_str, i-20, rx_coeff_bas[i], rx_bas, rx_bas_err);
+ if ((rx_bas_err > FAIL_LIMIT) || (rx_haut_err > FAIL_LIMIT)) printf (" * \n");
+ else printf ("\n");
+#endif
+ }
+ fclose (fref);
+ return ret;
+}
+
+void
+test_Mcoeff_check (test_t test, double rho)
+{
+ char cmd_scilab[128];
+ char test_string[64];
+ sprintf (test_string, "rho=%lg\n", rho);
+ test_begin (test, test_string)
+ {
+ spoc_MCoeff (rho);
+ sprintf (cmd_scilab,"scilab -f ./coeff_generation.scilab -nogui -args %lg > ./obj/toto.log 2>./obj/titi.log </dev/null", rho);
+ system (cmd_scilab);
+#if defined (SPOC_TEST_DBG) && (SPOC_TEST_DBG==2)
+ printf ("\nargs\n");
+ data_Mcheck_dbg_print ("./obj/args_of_sinc.txt", "ARGS_HAUT", "ARGS_BAS ",
+ args_haut, args_bas, args_haut_rx, args_bas_rx);
+ printf ("\nsinc\n");
+ data_Mcheck_dbg_print ("./obj/sinc.txt", "SINC_HAUT", "SINC_BAS ",
+ sinc_haut, sinc_bas, sinc_haut_rx, sinc_bas_rx);
+ printf ("\ncoeff\n");
+#endif
+ double err = data_Mcheck_dbg_print ("./obj/coeff.txt", "ORDON", "PENTE",
+ reg_ordo_tx, reg_pente_tx, reg_ordo_rx, reg_pente_rx);
+#if defined (SPOC_TEST_DBG) && (SPOC_TEST_DBG>=1)
+ printf ("Matrix M ... err = %5.15g\n", err);
+#endif
+ test_fail_if (err > FAIL_LIMIT);
+ } test_end;
+}
+
+double
+sinc (double arg)
+{
+ if (arg == 0) return 1;
+ else return (sin(arg)/arg);
+}
+
+void
+test_CG_check (test_t test, double rho)
+{
+ char test_string[64];
+ sprintf (test_string, "rho=%lg\n", rho);
+ test_begin (test, test_string)
+ {
+ double CG_N[21], CG_FC10[21], CG_PR1[21], CG_PR2[21];
+ int k;
+ for (k=-10; k<=10; k++)
+ {
+ double kk, arg;
+ if (k==0) kk=1.0; else kk = kaiser_d[abs(k)-1];
+ arg = M_PI*(k-3072*rho); CG_N[k+10] = kk * sinc(arg);
+ arg = M_PI*(k+3072*rho); CG_FC10[k+10] = kk * sinc(arg);
+ arg = M_PI*(k+372*rho); CG_PR1[k+10] = kk * sinc(arg);
+ arg = M_PI*(k+1140*rho); CG_PR2[k+10] = kk * sinc(arg);
+ }
+ spoc_CG (rho, -3072, reg_CG_N);
+ spoc_CG (rho, 3072, reg_CG_FC10);
+ spoc_CG (rho, 372, reg_CG_PR1);
+ spoc_CG (rho, 1140, reg_CG_PR2);
+ double err_N, err_FC10, err_PR1, err_PR2, error_global;
+ error_global = 0;
+ for (k=-10; k<=10; k++)
+ {
+ double error = 0;
+ int i = 10+k;
+ err_N = err (CG_N[i], reg_CG_N[i]);
+ if (error < err_N) error = err_N;
+ err_FC10 = err (CG_FC10[i], reg_CG_FC10[i]);
+ if (error < err_FC10) error = err_FC10;
+ err_PR1 = err (CG_PR1[i], reg_CG_PR1[i]);
+ if (error < err_PR1) error = err_PR1;
+ err_PR2 = err (CG_PR2[i], reg_CG_PR2[i]);
+ if (error < err_PR2) error = err_PR2;
+ if (error_global< error) error_global=error;
+#if defined (SPOC_TEST_DBG) && (SPOC_TEST_DBG==2)
+ printf ("N[%d] %5.15g<-->%5.15g %5.15g\n", k, CG_N[i], reg_CG_N[i], err_N);
+ printf ("FC10[%d] %5.15g<-->%5.15g %5.15g\n", k, CG_FC10[i], reg_CG_FC10[i], err_FC10);
+ printf ("PR1[%d] %5.15g<-->%5.15g %5.15g\n", k, CG_PR1[i], reg_CG_PR1[i], err_PR1);
+ printf ("PR2[%d] %5.15g<-->%5.15g %5.15g", k, CG_PR2[i], reg_CG_PR2[i], err_PR2);
+ if (error > FAIL_LIMIT) printf (" *\n"); else printf ("\n");
+#endif
+ }
+#if defined (SPOC_TEST_DBG) && (SPOC_TEST_DBG>=1)
+ printf ("Vectors [N,FC10,PR1,PR2] ...err = %5.15g\n", error_global);
+#endif
+ test_fail_if (error_global > FAIL_LIMIT);
+ } test_end;
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t test;
+ test_init (test, argc, argv);
+ int step, rho_eps, max_eps;
+ for (step = 1; step<=100000; step = step*10)
+ {
+ rho_eps = -10 * step;
+ max_eps = 10 * step;
+ for (; rho_eps<=max_eps; rho_eps+=step)
+ {
+ double rho = rho_eps * 1e-9;
+#if defined (SPOC_TEST_DBG) && (SPOC_TEST_DBG>=1)
+ printf ("\nSPOC rho=%g \n", rho);
+#endif
+ test_case_begin(test, "check Mcoeff");
+ test_Mcoeff_check(test, rho);
+ test_case_begin(test, "check CGcoeff");
+ test_CG_check(test, rho);
+ }
+ }
+ test_result (test);
+ return (test_nb_failed (test) == 0 ? 0 : 1);
+}
diff --git a/cesar/cp/src/cp.c b/cesar/cp/src/cp.c
new file mode 100644
index 0000000000..aa611f3c2e
--- /dev/null
+++ b/cesar/cp/src/cp.c
@@ -0,0 +1,40 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/src/cp.c
+ * \brief CP functions.
+ * \ingroup cp
+ *
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+
+#include "cp/inc/context.h"
+
+/** Static data. */
+static cp_t cp_global;
+
+/**
+ * Initialise the Control plane.
+ * \param mac_config Mac configuration context.
+ * \param interface Interface context.
+ * \return The control plane context.
+ *
+ */
+cp_t *
+cp_init (mac_config_t * mac_config, interface_t * interface)
+{
+ dbg_assert (mac_config);
+ dbg_assert (interface);
+
+ cp_global.mac_config = mac_config;
+ cp_global.interface = interface;
+
+ return &cp_global;
+}
diff --git a/cesar/cp/sta/action/Module b/cesar/cp/sta/action/Module
new file mode 100644
index 0000000000..ef18c08d0d
--- /dev/null
+++ b/cesar/cp/sta/action/Module
@@ -0,0 +1 @@
+SOURCES := action.c assoc.c drv.c info.c key.c misc.c poweron.c
diff --git a/cesar/cp/sta/action/action.h b/cesar/cp/sta/action/action.h
new file mode 100644
index 0000000000..2eaa9ca674
--- /dev/null
+++ b/cesar/cp/sta/action/action.h
@@ -0,0 +1,53 @@
+#ifndef cp_sta_action_action_h
+#define cp_sta_action_action_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/action.h
+ * \brief STA action.
+ * \ingroup cp_sta_action
+ *
+ * This module implements actions defined in the FSM and actions corresponding
+ * to MME reception.
+ *
+ * Top level
+ * =========
+ *
+ * This part includes top level functions.
+ */
+#include "cp/types.h"
+#include "cp/mme.h"
+
+#include "cp/sta/action/assoc.h"
+#include "cp/sta/action/poweron.h"
+#include "cp/sta/action/info.h"
+#include "cp/sta/action/key.h"
+#include "cp/sta/action/misc.h"
+#include "cp/sta/action/drv.h"
+
+BEGIN_DECLS
+
+/**
+ * Initialise STA action.
+ * \param ctx control plane context
+ */
+void
+cp_sta_action_init (cp_t *ctx);
+
+/**
+ * Collect garbages, called regularly for background timed tasks.
+ * \param ctx control plane context
+ *
+ * Request STA manager to remove expired networks or stations.
+ */
+void
+cp_sta_action_garbage (cp_t *ctx);
+
+END_DECLS
+
+#endif /* cp_sta_action_action_h */
diff --git a/cesar/cp/sta/action/assoc.h b/cesar/cp/sta/action/assoc.h
new file mode 100644
index 0000000000..e608ca6660
--- /dev/null
+++ b/cesar/cp/sta/action/assoc.h
@@ -0,0 +1,314 @@
+#ifndef cp_sta_action_assoc_h
+#define cp_sta_action_assoc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/assoc.h
+ * \brief STA action, association related definitions.
+ * \ingroup cp_sta_action
+ *
+ * Association/disassociation
+ * ==========================
+ *
+ * This part relates to association and disassociation for a STA. A state
+ * machine is used to handle the association status of the station:
+ *
+ * \image html assoc.png "Association state machine"
+ *
+ * - (1) send CC_ASSOC.REQ
+ * - (2) send CM_GET_KEY.REQ
+ * - (3) send CC_ASSOC.REQ for renewal
+ * - (4) send CM_SET_KEY.CNF
+ * - (5) send CC_LEAVE.REQ
+ * - (6) send CC_LEAVE.RSP
+ * - (7) cleanup data plane
+ *
+ * For the moment, only one association scheme is supported: association with
+ * matching NID, without proxy network.
+ *
+ * Related: 7.3.2, 7.3.3, 7.3.4.1, 7.3.5.1, 7.3.6.
+ *
+ *
+ * Association
+ * -----------
+ *
+ * When the station wants to associate, it set the association parameters and
+ * trigger the "to assoc" event. This will send the CC_ASSOC.REQ message to
+ * the CCo and wait for response.
+ *
+ * If no response is received, retry. Retry is needed because we are not
+ * associated and broadcast is used.
+ *
+ * If a negative response is received, association has failed, this is
+ * remembered in order not to try to associate too often to the same CCo.
+ *
+ * If a positive response is received, go to associated state.
+ *
+ *
+ * Authentication
+ * --------------
+ *
+ * When entering this state, send a payload encrypted CM_GET_KEY.REQ to
+ * request the NEK.
+ *
+ * Once the station is authenticated, CC_SET_TEI_MAP.IND messages can be
+ * received.
+ *
+ * As unicast transmissions are used, a timeout will directly break the
+ * association sequence.
+ *
+ * If a negative response is received, association has failed, the CCo is
+ * using a different NMK. This is remembered in order not to associate with
+ * this CCo again (until keys are changed).
+ *
+ * If a positive response is received, the station is authenticated.
+ *
+ * Once authenticated, the CCo can change the NEK periodically.
+ *
+ * Lease renewal
+ * -------------
+ *
+ * Association is granted for a given time. When the station is associated,
+ * program a timer to renew the association. When this timer expires, send a
+ * CC_ASSOC.REQ for renewal and set the timer for a second chance.
+ *
+ * The station will not leave the AVLN by itself due to lease expiration. It
+ * will wait an eventual CC_LEAVE.IND message to do so.
+ *
+ * When the CCo confirms the renewal, the renew timer is reset to the value
+ * given in its confirmation message. Ignore renewal failure, will wait for
+ * the CC_LEAVE.IND message.
+ *
+ *
+ * Leaving
+ * -------
+ *
+ * If the request comes from the STA, trigger the "to leave" event. This will
+ * send the CC_LEAVE.REQ message to the CCo and wait for response. If no
+ * response cames for three beacon periods, resend and go to the "leave wait"
+ * state.
+ *
+ * If the request comes from the CCo (CC_LEAVE.IND), send a response and go to
+ * the "leave wait" state.
+ *
+ * The "leave wait" state is there to give time to the data plane to send the
+ * MME. After a fixed timer, go back to unassociated state and cleanup the
+ * data plane from all AVLN related parameters.
+ *
+ * Events
+ * ------
+ *
+ * When the authenticated state is entered, the join event is triggered.
+ *
+ * When the unassociated state is entered, the left event is triggered. This
+ * event means that the station has left the AVLN or that the association
+ * request failed.
+ */
+#include "cp/sta/mgr/net.h"
+
+BEGIN_DECLS
+
+/**
+ * Initialise association part.
+ * \param ctx control plane context
+ */
+void
+cp_sta_action_assoc_init (cp_t *ctx);
+
+/**
+ * Start a association procedure.
+ * \param ctx control plane context
+ * \param cco_net AVLN of the CCo to associate with
+ * \param cco CCo to associate with
+ *
+ * Trigger TO_ASSOC event.
+ *
+ * Need:
+ * - CCo to associate to (MAC, TEI, NID).
+ * - our CCo cap and proxy network cap.
+ */
+void
+cp_sta_action_assoc_start (cp_t *ctx, cp_net_t *cco_net, cp_sta_t *cco);
+
+/**
+ * Request to leave the current AVLN.
+ * \param ctx control plane context
+ *
+ * Trigger a TO_LEAVE event.
+ */
+void
+cp_sta_action_assoc_leave (cp_t *ctx);
+
+/**
+ * Handle entering UNASSOCIATED.
+ * \param ctx control plane context
+ *
+ * Trigger a LEFT event.
+ */
+void
+cp_sta_action_assoc__unassociated__enter (cp_t *ctx);
+
+/**
+ * Handle UNASSOCIATED => TO_ASSOC event.
+ * \param ctx control plane context
+ *
+ * Send a CC_ASSOC.REQ to the CCo.
+ */
+void
+cp_sta_action_assoc__unassociated__to_assoc (cp_t *ctx);
+
+/**
+ * Handle WAIT_ASSOC_CNF => CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * If the CCo accepted our association, update association information, send
+ * the CM_GET_KEY.REQ, and go to ASSOCIATED state. If the CCo refused, go
+ * back to UNASSOCIATED state and update the CCo information to remember the
+ * failure.
+ *
+ * Update:
+ * - our TEI.
+ * - our TEI lease time (update lease timer).
+ * - our AVLN.
+ * - our AVLN SNID.
+ * - CCo failure info.
+ */
+void
+cp_sta_action_assoc__wait_assoc_cnf__cc_assoc_cnf (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle WAIT_ASSOC_CNF => TIMEOUT.
+ * \param ctx control plane context
+ *
+ * If retry count is not zero, resend the CC_ASSOC.REQ.
+ *
+ * If retry count is zero, go back to UNASSOCIATED state.
+ */
+void
+cp_sta_action_assoc__wait_assoc_cnf__timeout (cp_t *ctx);
+
+/**
+ * Handle ASSOCIATED => CM_GET_KEY.CNF (PID=0).
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * If this is a success, go to AUTHENTICATED state, trigger JOINED event and
+ * update station status.
+ *
+ * If authentication has failed, remember this and go back to UNASSOCIATED
+ * state.
+ *
+ * Update:
+ * - authenticated status.
+ * - NEK.
+ * - CCo failure info.
+ */
+void
+cp_sta_action_assoc__associated__cm_get_key_cnf_pid_0 (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle ASSOCIATED => TIMEOUT.
+ * \param ctx control plane context
+ *
+ * Authentication failed, go back to UNASSOCIATED and update the CCo
+ * information to remember the failure.
+ */
+void
+cp_sta_action_assoc__associated__timeout (cp_t *ctx);
+
+/**
+ * Handle AUTHENTICATED => RENEW.
+ * \param ctx control plane context
+ *
+ * Time to renew our lease. Send a CC_ASSOC.REQ.
+ */
+void
+cp_sta_action_assoc__authenticated__renew (cp_t *ctx);
+
+/**
+ * Handle AUTHENTICATED => CC_ASSOC.CNF.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Update:
+ * - our TEI lease time (update lease timer).
+ */
+void
+cp_sta_action_assoc__authenticated__cc_assoc_cnf (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle AUTHENTICATED => CM_SET_KEY.REQ (PID=1), NEK renewal.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Sent periodically by the CCo to change the NEK.
+ *
+ * Update:
+ * - NEK.
+ */
+void
+cp_sta_action_assoc__authenticated__cm_set_key_req_pid_1 (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle AUTHENTICATED => TO_LEAVE.
+ * \param ctx control plane context
+ *
+ * Send the CC_LEAVE.REQ message to the CCo. Set a timeout in three beacon
+ * periods.
+ */
+void
+cp_sta_action_assoc__authenticated__to_leave (cp_t *ctx);
+
+/**
+ * Handle AUTHENTICATED => CC_LEAVE.IND.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * The CCo request us to leave the AVLN. Send a response and go to LEAVE_WAIT
+ * event.
+ */
+void
+cp_sta_action_assoc__authenticated__cc_leave_ind (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle LEAVING => CC_LEAVE.CNF.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Leave the AVLN and cleanup data plane.
+ */
+void
+cp_sta_action_assoc__leaving__cc_leave_cnf (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Handle LEAVING => TIMEOUT.
+ * \param ctx control plane context
+ *
+ * Send a CC_LEAVE.REQ again.
+ */
+void
+cp_sta_action_assoc__leaving__timeout (cp_t *ctx);
+
+/**
+ * Handle LEAVE_WAIT => TIMEOUT.
+ * \param ctx control plane context
+ *
+ * Leave the AVLN and cleanup data plane.
+ */
+void
+cp_sta_action_assoc__leave_wait__timeout (cp_t *ctx);
+
+END_DECLS
+
+#endif /* cp_sta_action_assoc_h */
diff --git a/cesar/cp/sta/action/doc/Makefile b/cesar/cp/sta/action/doc/Makefile
new file mode 100644
index 0000000000..8628fca568
--- /dev/null
+++ b/cesar/cp/sta/action/doc/Makefile
@@ -0,0 +1,47 @@
+PAGES = action assoc poweron info key misc drv
+GRAPHS = assoc poweron drv
+
+DOTFLAGS =
+CONVERTFLAGS = -border 1 -bordercolor '\#d7d7d7'
+
+TOOLS_DIR = ../../../../common/tools
+DOC_DIR = ../../../../common/doc
+SDL2DOT = $(TOOLS_DIR)/sdl2dot
+SDLPS = $(TOOLS_DIR)/sdl.ps
+EXTRACT_DOC = $(DOC_DIR)/extractdoc
+DOX2RST = $(DOC_DIR)/dox2rst
+
+all: png rst
+
+png: $(GRAPHS:%=%.png)
+ps: $(GRAPHS:%=%.ps)
+
+%.png: %.ps
+ convert $(CONVERTFLAGS) $< $@
+
+%.ps: %.dot Makefile
+ dot $(DOTFLAGS) -Tps -l $(SDLPS) -o $@ $<
+
+%.dot: %.sdl
+ $(SDL2DOT) $< > $@
+
+rst: top.rst
+html: png top.html
+odt: top.odt
+
+top.rst: $(PAGES:%=%.rst)
+ cat $^ > $@
+
+%.rst: ../%.h
+ $(EXTRACT_DOC) $< | $(DOX2RST) -s 50 > $@
+
+%.html: %.rst
+ rst2html $< $@
+
+%.odt: %.rst
+ rst2odt.py $< $@
+
+clean:
+ rm -f $(GRAPHS:%=%.ps) $(GRAPHS:%=%.png)
+ rm -f $(PAGES:%=%.rst) $(PAGES:%=%.html)
+ rm -f top.rst top.html top.odt
diff --git a/cesar/cp/sta/action/doc/assoc.sdl b/cesar/cp/sta/action/doc/assoc.sdl
new file mode 100644
index 0000000000..044d23c3e0
--- /dev/null
+++ b/cesar/cp/sta/action/doc/assoc.sdl
@@ -0,0 +1,23 @@
+(unassociated) -to assoc(1)-> (wait assoc cnf)
+
+(wait assoc cnf) -CC_ASSOC.CNF-> <w:ok?> -y(2)-> (associated)
+ <w:ok?> -n-> (unassociated)
+ <w:ok?> -unrelated-> (wait assoc cnf)
+(wait assoc cnf) -timeout-> <retry?> -y(1)-> (wait assoc cnf)
+ <retry?> -n-> (unassociated)
+
+(associated) -CM_GET_KEY.CNF PID=0-> <a:ok?> -y-> (authenticated)
+ <a:ok?> -n-> (unassociated)
+ <a:ok?> -unrelated-> (associated)
+(associated) -timeout-> (unassociated)
+
+(authenticated) -renew(3)-> (authenticated)
+(authenticated) -CC_ASSOC.CNF-> (authenticated)
+(authenticated) -CM_SET_KEY.REQ(4)-> (authenticated)
+(authenticated) -to leave(5)-> (leaving)
+(authenticated) -CC_LEAVE.IND(6)-> (leave wait)
+
+(leaving) -CC_LEAVE.CNF(7)-> (unassociated)
+(leaving) -timeout(5) (3bp)-> (leave wait)
+
+(leave wait) -timeout(7)-> (unassociated)
diff --git a/cesar/cp/sta/action/doc/cp_sta_action.odt b/cesar/cp/sta/action/doc/cp_sta_action.odt
new file mode 100644
index 0000000000..0ef32be88e
--- /dev/null
+++ b/cesar/cp/sta/action/doc/cp_sta_action.odt
Binary files differ
diff --git a/cesar/cp/sta/action/doc/drv.sdl b/cesar/cp/sta/action/doc/drv.sdl
new file mode 100644
index 0000000000..d790a4e434
--- /dev/null
+++ b/cesar/cp/sta/action/doc/drv.sdl
@@ -0,0 +1,6 @@
+(stopped) -DRV_STA_MAC_START.REQ(1)-> (started)
+... -DRV_STA_MAC_STOP.REQ-> <unassociated?> -y(2)-> (stopped)
+ <unassociated?> -n-> (stopping)
+(stopping) -left(2)-> (stopped)
+
+(stopped) -DRV_STA_SET_*.REQ(3)-> (stopped)
diff --git a/cesar/cp/sta/action/doc/poweron.sdl b/cesar/cp/sta/action/doc/poweron.sdl
new file mode 100644
index 0000000000..a10fd08286
--- /dev/null
+++ b/cesar/cp/sta/action/doc/poweron.sdl
@@ -0,0 +1,38 @@
+poweron:
+(poweron) -ustt timeout-> <:avln?> -n-> (poweron)
+ <:avln?> -y(1)-> (poweron)
+(poweron) -btt timeout-> <:NID match\n& CCo?> -y-> (cco)
+ <:NID match\n& CCo?> -n-> <b:avln?> -y-> (usta)
+ <b:avln?> -n-> (ucco)
+(poweron) -beacon-> <:NID match?> -n(2)-> (poweron)
+ <:NID match?> -y-> (poweron joining)
+(poweron joining) -left(2)-> (poweron)
+(poweron joining) -joined-> (sta)
+
+usta:
+(usta) -ustt timeout-> <:avln?> -n-> (usta)
+ <:avln?> -y(1)-> (usta)
+(usta) -beacon-> <:NID match?> -n(2)-> (usta)
+ <:NID match?> -y-> (usta joining)
+(usta) -usta ind-> <:NID match\n& CCo?> -y-> (cco)
+ <:NID match\n& CCo?> -n-> (usta)
+(usta) -net list empty-> (ucco)
+(usta joining) -left(2)-> (usta)
+(usta joining) -joined-> (sta)
+
+ucco:
+(ucco) -beacon-> (usta)
+(ucco) -association request-> (cco)
+
+sta:
+(sta) -left-> (usta)
+(sta) -beacon(3)-> (sta)
+(sta) -beacon not received-> <:avln failure?> -y-> (poweron)
+ <:avln failure?> -n-> (sta)
+
+cco:
+(cco) -join timeout-> <:sta joined> -y-> (cco)
+ <:sta joined> -n-> <:avln?> -y-> (usta)
+ <:avln?> -n-> (ucco)
+(cco) -all sta leaved-> <ccol:avln?> -y-> (usta)
+ <ccol:avln?> -n-> (ucco)
diff --git a/cesar/cp/sta/action/drv.h b/cesar/cp/sta/action/drv.h
new file mode 100644
index 0000000000..81e525fc2b
--- /dev/null
+++ b/cesar/cp/sta/action/drv.h
@@ -0,0 +1,188 @@
+#ifndef cp_sta_action_drv_h
+#define cp_sta_action_drv_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/drv.h
+ * \brief STA action, driver related definitions.
+ * \ingroup cp_sta_action
+ *
+ * Driver interface
+ * ================
+ *
+ * This part relates to interface with the driver using driver MME. This
+ * include station startup.
+ *
+ * Here is the state machine of this part:
+ *
+ * \image html drv.png "Driver interface state machine"
+ *
+ * - (1) send DRV_STA_MAC_START.CNF, start data plane, start power-on
+ * procedure
+ * - (2) send DRV_STA_MAC_STOP.CNF, clean up
+ * - (3) set requested parameter, send corresponding CNF
+ *
+ * This version is a light version, where parameters can only be changed if
+ * the station is stopped.
+ *
+ *
+ * Startup
+ * -------
+ *
+ * The driver send all parameters, then send the start order. The CP will
+ * initialise all layers and start the power-on procedure.
+ *
+ *
+ * Stop
+ * ----
+ *
+ * The stop request is asynchronous as the station will first leave the AVLN
+ * before the confirmation is sent.
+ */
+
+BEGIN_DECLS
+
+/**
+ * Handle STOPPED => DRV_STA_SET_MAC_ADDR.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_CCO_PREF.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_WAS_CCO.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_NPW.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_npw_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_DPW.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_SL.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_sl_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_NID.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_M_STA_HFID.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_m_sta_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_U_STA_HFID.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_u_sta_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_AVLN_HFID.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_avln_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_SET_TONEMASK.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPED => DRV_STA_MAC_START.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Initialise all layers and start the power-on procedure. Send a
+ * DRV_STA_MAC_START.CNF.
+ */
+void
+cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STARTED => DRV_STA_MAC_STOP.REQ.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * If station is unassociated, cleanup everything and send a
+ * DRV_STA_MAC_STOP.CNF, go to STOPPED state.
+ *
+ * If the station is not unassociated, request to leave the AVLN and wait
+ * until completed in the STOPPING state.
+ */
+void
+cp_sta_action_drv__started__drv_sta_mac_stop_req (cp_t *ctx,
+ cp_mme_rx_t *mme);
+
+/**
+ * Handle STOPPING => LEFT.
+ * \param ctx control plane context
+ *
+ * Now that we are unassociated, cleanup everything and send a
+ * DRV_STA_MAC_STOP.CNF.
+ */
+void
+cp_sta_action_drv__stopping__left (cp_t *ctx);
+
+END_DECLS
+
+#endif /* cp_sta_action_drv_h */
diff --git a/cesar/cp/sta/action/inc/context.h b/cesar/cp/sta/action/inc/context.h
new file mode 100644
index 0000000000..7d58acda84
--- /dev/null
+++ b/cesar/cp/sta/action/inc/context.h
@@ -0,0 +1,50 @@
+#ifndef cp_sta_action_inc_context_h
+#define cp_sta_action_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/inc/context.h
+ * \brief STA action context.
+ * \ingroup cp_sta_action
+ */
+#include "cp/secu/secu.h"
+#include "cp/sta/mgr/net.h"
+
+/** STA action/assoc sub-context. */
+struct cp_sta_action_assoc_t
+{
+ /** CCo AVLN. */
+ cp_net_t *cco_net;
+ /** CCo NID to which association is pending. */
+ cp_nid_t nid;
+ /** CCo peer structure to which association is pending. */
+ cp_mme_peer_t peer;
+ /** Retry count left for association. */
+ uint retry;
+ /** Protocol run used for authentication. */
+ cp_secu_protocol_run_t prun;
+};
+
+/** STA action/poweron sub-context. */
+struct cp_sta_action_poweron_t
+{
+ /** Number of lost central beacons since the last beacon reception. */
+ uint beacon_loss;
+};
+
+/** STA action context */
+struct cp_sta_action_t
+{
+ /** Assoc part. */
+ struct cp_sta_action_assoc_t assoc;
+ /** Power-on part. */
+ struct cp_sta_action_poweron_t poweron;
+};
+typedef struct cp_sta_action_t cp_sta_action_t;
+
+#endif /* cp_sta_action_inc_context_h */
diff --git a/cesar/cp/sta/action/info.h b/cesar/cp/sta/action/info.h
new file mode 100644
index 0000000000..74cbd62f95
--- /dev/null
+++ b/cesar/cp/sta/action/info.h
@@ -0,0 +1,53 @@
+#ifndef cp_sta_action_info_h
+#define cp_sta_action_info_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/info.h
+ * \brief STA action, information gathering definitions.
+ * \ingroup cp_sta_action
+ *
+ * Information gathering
+ * =====================
+ *
+ * Gather information from other stations. Use CM_UNASSOCIATED_STA.IND,
+ * beacons, TEI maps...
+ */
+
+BEGIN_DECLS
+
+/**
+ * Process a CC_SET_TEI_MAP.IND, 11.2.35.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * The CCo send an update of the AVLN list of STA. According to the mode,
+ * update the whole list, add or remove a STA.
+ *
+ * Update:
+ * - STA mgr.
+ */
+void
+cp_sta_action_process_cc_set_tei_map_ind (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_UNASSOCIATED_STA.IND, 11.5.1.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Update the STA list.
+ *
+ * Update:
+ * - STA mgr.
+ */
+void
+cp_sta_action_process_cm_unassociated_sta_ind (cp_t *ctx, cp_mme_rx_t *mme);
+
+END_DECLS
+
+#endif /* cp_sta_action_info_h */
diff --git a/cesar/cp/sta/action/key.h b/cesar/cp/sta/action/key.h
new file mode 100644
index 0000000000..4b06d023f4
--- /dev/null
+++ b/cesar/cp/sta/action/key.h
@@ -0,0 +1,101 @@
+#ifndef cp_sta_action_key_h
+#define cp_sta_action_key_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/key.h
+ * \brief STA action, key exchange messages.
+ * \ingroup cp_sta_action
+ *
+ * Key exchanges
+ * =============
+ *
+ * This part handle key exchange messages. As theses messages are used for
+ * many unrelated protocol, theses functions will only handle generic
+ * verifications and will then forward the message to the right recipient.
+ */
+
+BEGIN_DECLS
+
+/**
+ * Process a CM_SET_KEY.REQ, 11.5.4.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * This message is used in several protocols. First check that this message
+ * is legitimate, then depending of the protocol, trigger the corresponding
+ * event.
+ *
+ * Used to:
+ * - from STA to STA:
+ * - NMK provisioning using DAK (PID=2):
+ * - set TEK, DAK encrypted (not handled): used to start the protocol
+ * - set NMK, DAK encrypted (not handled)
+ * - NMK provisioning using UKE (PID=3):
+ * - set NMK, TEK encrypted (not handled)
+ * - from CCo to STA:
+ * - set NEK (PID=1), done periodically by the CCo
+ * - from HLE to STA:
+ * - set NMK (not handled)
+ */
+void
+cp_sta_action_process_cm_set_key_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_SET_KEY.CNF, 11.5.5.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Response from a preceding CM_SET_KEY.REQ. First check that this message is
+ * legitimate and that it correspond to a sent request, then trigger the
+ * corresponding event.
+ *
+ * This message can be forwarded to the CCo module.
+ */
+void
+cp_sta_action_process_cm_set_key_cnf (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_GET_KEY.REQ, 11.5.6.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * This message is used in several protocols. First check that this message
+ * is legitimate, then depending of the protocol, trigger the corresponding
+ * event.
+ *
+ * This message can be forwarded to the CCo module.
+ *
+ * Used to:
+ * - from STA to STA:
+ * - NMK provisioning using UKE (PID=3):
+ * - get HASH KEY, unencrypted unicast (not handled): used to derive the
+ * TEK
+ * - from STA to CCo:
+ * - get NEK, NMK encrypted (PID=0)
+ * - from HLE to STA:
+ * - get NMK (not handled)
+ */
+void
+cp_sta_action_process_cm_get_key_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_GET_KEY.CNF, 11.5.7.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Response from a preceding CM_GET_KEY.REQ. First check that this message is
+ * legitimate and that it correspond to a sent request, then trigger the
+ * corresponding event.
+ */
+void
+cp_sta_action_process_cm_get_key_cnf (cp_t *ctx, cp_mme_rx_t *mme);
+
+END_DECLS
+
+#endif /* cp_sta_action_key_h */
diff --git a/cesar/cp/sta/action/misc.h b/cesar/cp/sta/action/misc.h
new file mode 100644
index 0000000000..749e42f6de
--- /dev/null
+++ b/cesar/cp/sta/action/misc.h
@@ -0,0 +1,83 @@
+#ifndef cp_sta_action_misc_h
+#define cp_sta_action_misc_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/misc.h
+ * \brief STA action, miscellaneous definitions.
+ * \ingroup cp_sta_action
+ *
+ * Miscellaneous
+ * =============
+ *
+ * This part handle other miscellaneous STA function, most of theses are
+ * simple enough to be handled without any remembered state.
+ */
+
+BEGIN_DECLS
+
+/**
+ * Process a CC_WHO_RU.REQ, 11.2.26.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Provide AVLN identity and CCo MAC address. If the NID correspond to our
+ * NID, send a CC_WHO_RU.CNF. In other cases, drop.
+ *
+ * Need:
+ * - our CCo MAC address.
+ * - our AVLN HFID.
+ */
+void
+cp_sta_action_process_cc_who_ru_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CC_RELAY.REQ, 11.2.36.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Extract the payload from the MME, and encapsulate it in a CC_RELAY.IND to
+ * the final destination.
+ *
+ * There is special behaviour depending on the contained payload. If the
+ * relay request is not encrypted, only relay MME which are permitted to be
+ * unencrypted. If the relay request is not encrypted and contains a
+ * CM_ENCRYPTED_PAYLOAD.IND, the CC_RELAY.IND should be sent broadcast. This
+ * could be done by the cp_msg module.
+ *
+ * - What to do with the MAC address?
+ */
+void
+cp_sta_action_process_cc_relay_req (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CC_RELAY.IND, 11.2.37.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Extract the payload and insert the message back.
+ *
+ * Relay station is trusted as long as it is authenticated. It should have
+ * filtered unauthorised payload.
+ */
+void
+cp_sta_action_process_cc_relay_ind (cp_t *ctx, cp_mme_rx_t *mme);
+
+/**
+ * Process a CM_MME_ERROR.IND, 11.5.32.
+ * \param ctx control plane context
+ * \param mme received MME handle
+ *
+ * Used for debug. Trace the error.
+ */
+void
+cp_sta_action_process_cm_mme_error_ind (cp_t *ctx, cp_mme_rx_t *mme);
+
+END_DECLS
+
+#endif /* cp_sta_action_misc_h */
diff --git a/cesar/cp/sta/action/poweron.h b/cesar/cp/sta/action/poweron.h
new file mode 100644
index 0000000000..a985cd9587
--- /dev/null
+++ b/cesar/cp/sta/action/poweron.h
@@ -0,0 +1,194 @@
+#ifndef cp_sta_action_poweron_h
+#define cp_sta_action_poweron_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/poweron.h
+ * \brief STA action, power on procedure related definitions.
+ * \ingroup cp_sta_action
+ *
+ * Power-on procedure
+ * ==================
+ *
+ * This part handle power-on procedure, neighbourhood discovery and
+ * association decision. A state machine is used to handle the different
+ * states:
+ *
+ * \image html poweron.png "Power-on state machine"
+ *
+ * - (1) send CM_UNASSOCIATED_STA.IND
+ * - (2) select an AVLN to track
+ * - (3) clear beacon not received counter if our beacon
+ *
+ * Related: 7.1.
+ */
+#include "cp/sta/mgr/net.h"
+#include "cp/beacon/beacon_desc.h"
+
+BEGIN_DECLS
+
+/**
+ * Start the power-on procedure.
+ * \param ctx control plane context
+ *
+ * Initialise the data plane to receive beacons and CM_UNASSOCIATED_STA.IND
+ * messages.
+ *
+ * Initialise the BTT and USTT timers.
+ */
+void
+cp_sta_action_poweron_start (cp_t *ctx);
+
+/**
+ * Handle POWERON => USTT TIMEOUT.
+ * \param ctx control plane context
+ *
+ * If there is at least one AVLN in the discovered list, send a
+ * CM_UNASSOCIATED_STA.IND, then restart the USTT timer with a random value
+ * (in the right range).
+ */
+void
+cp_sta_action_poweron__poweron__ustt_timeout (cp_t *ctx);
+
+/**
+ * Handle POWERON => BTT TIMEOUT.
+ * \param ctx control plane context
+ *
+ * No beacon has been received during the BTT timer. Look in the discovered
+ * STA list to see if there is a NID match. If a NID match and the station
+ * should become CCo, go to CCO state.
+ *
+ * In other cases, if there is at least one AVLN in the discovered list, go to
+ * USTA state. If there is no AVLN discovered, go to UCCO state.
+ */
+void
+cp_sta_action_poweron__poweron__btt_timeout (cp_t *ctx);
+
+/**
+ * Handle POWERON => BEACON.
+ * \param ctx control plane context
+ * \param net STA net
+ * \param sta STA emitting the beacon
+ *
+ * When a beacon is received, if NID matches, go to corresponding JOINING
+ * states and start the association procedure. In the other case, select an
+ * AVLN to track in the list of discovered AVLN and continue searching.
+ */
+void
+cp_sta_action_poweron__poweron__beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta);
+
+/**
+ * Handle POWERON_JOINING => LEFT.
+ * \param ctx control plane context
+ *
+ * Select an AVLN to track and continue searching.
+ */
+void
+cp_sta_action_poweron__poweron_joining__left (cp_t *ctx);
+
+/**
+ * Handle USTA => USTT TIMEOUT.
+ * \param ctx control plane context
+ *
+ * If there is at least one AVLN in the discovered list, send a
+ * CM_UNASSOCIATED_STA.IND, then restart the USTT timer with a random value
+ * (in the right range).
+ */
+void
+cp_sta_action_poweron__usta__ustt_timeout (cp_t *ctx);
+
+/**
+ * Handle USTA => BEACON.
+ * \param ctx control plane context
+ * \param net STA net
+ * \param sta STA emitting the beacon
+ *
+ * When a beacon is received, if NID matches, go to corresponding JOINING
+ * states and start the association procedure. In the other case, select an
+ * AVLN to track in the list of discovered AVLN and continue searching.
+ */
+void
+cp_sta_action_poweron__usta__beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta);
+
+/**
+ * Handle USTA => USTA IND.
+ * \param ctx control plane context
+ * \param net STA net
+ * \param sta STA emitting CM_UNASSOCIATED_STA.IND
+ *
+ * If the NID match and the station should become CCo go to CCO state.
+ */
+void
+cp_sta_action_poweron__usta__usta_ind (cp_t *ctx, cp_net_t *net,
+ cp_sta_t *sta);
+
+/**
+ * Handle USTA_JOINING => LEFT.
+ * \param ctx control plane context
+ *
+ * Select an AVLN to track and continue searching.
+ */
+void
+cp_sta_action_poweron__usta_joining__left (cp_t *ctx);
+
+/**
+ * Handle entering STA.
+ * \param ctx control plane context
+ */
+void
+cp_sta_action_poweron__sta__enter (cp_t *ctx);
+
+/**
+ * Handle STA => BEACON.
+ * \param ctx control plane context
+ * \param net STA net
+ * \param sta STA emitting the beacon
+ *
+ * If the beacon is ours, reset the "beacon not received" counter.
+ */
+void
+cp_sta_action_poweron__sta__beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta);
+
+/**
+ * Handle STA => BEACON NOT RECEIVED.
+ * \param ctx control plane context
+ *
+ * Increment the "beacon not received" counter. If it reaches the limit,
+ * restart the power-on procedure.
+ *
+ * Inform the assoc FSM.
+ */
+void
+cp_sta_action_poweron__sta__beacon_not_received (cp_t *ctx);
+
+/**
+ * Handle CCO => JOIN TIMEOUT.
+ * \param ctx control plane context
+ *
+ * If there is no associated STA, stop being a CCo. In this case, if there is
+ * at least one discovered AVLN, go to USTA state. Else, go to UCCO state.
+ */
+void
+cp_sta_action_poweron__cco__join_timeout (cp_t *ctx);
+
+/**
+ * Handle CCO => ALL STA LEAVED.
+ * \param ctx control plane context
+ *
+ * If there is at least one discovered AVLN, go to USTA state. Else, go to
+ * UCCO state.
+ */
+void
+cp_sta_action_poweron__cco__all_sta_leaved (cp_t *ctx);
+
+END_DECLS
+
+#endif /* cp_sta_action_poweron_h */
diff --git a/cesar/cp/sta/action/src/action.c b/cesar/cp/sta/action/src/action.c
new file mode 100644
index 0000000000..6c180e21a5
--- /dev/null
+++ b/cesar/cp/sta/action/src/action.c
@@ -0,0 +1,27 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/action.c
+ * \brief STA action.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "action.h"
+
+void
+cp_sta_action_init (cp_t *ctx)
+{
+ cp_sta_action_assoc_init (ctx);
+}
+
+void
+cp_sta_action_garbage (cp_t *ctx)
+{
+}
+
diff --git a/cesar/cp/sta/action/src/assoc.c b/cesar/cp/sta/action/src/assoc.c
new file mode 100644
index 0000000000..87bed27aee
--- /dev/null
+++ b/cesar/cp/sta/action/src/assoc.c
@@ -0,0 +1,316 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/assoc.c
+ * \brief STA action, association related definitions.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "action.h"
+
+#include "cp/inc/context.h"
+#include "cp/fsm/fsm.h"
+#include "cp/msg/msg.h"
+#include "lib/rnd.h"
+
+void
+cp_sta_action_assoc_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ctx->sta_action.assoc.cco_net = NULL;
+ ctx->sta_action.assoc.nid = 0;
+}
+
+void
+cp_sta_action_assoc_start (cp_t *ctx, cp_net_t *cco_net, cp_sta_t *cco)
+{
+ dbg_assert (ctx);
+ dbg_assert (cco_net);
+ dbg_assert (cco);
+ /* Remember CCo to associate with. */
+ ctx->sta_action.assoc.cco_net = cco_net;
+ ctx->sta_action.assoc.nid = cp_net_get_nid (ctx, cco_net);
+ cp_sta_get_peer (cco, &ctx->sta_action.assoc.peer);
+ ctx->sta_action.assoc.retry = 3;
+ /* Trigger to_assoc event. */
+ cp_fsm_post_new_event (ctx, bare, to_assoc);
+}
+
+void
+cp_sta_action_assoc_leave (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ /* Trigger to_leave event. */
+ cp_fsm_post_new_event (ctx, bare, to_leave);
+}
+
+void
+cp_sta_action_assoc__unassociated__enter (cp_t *ctx)
+{
+ cp_fsm_post_new_event (ctx, bare, left);
+}
+
+void
+cp_sta_action_assoc__unassociated__to_assoc (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ dbg_assert (ctx->sta_action.assoc.nid);
+ /* Send association request. */
+ cp_msg_cc_assoc_req_t data = {
+ CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ ctx->sta_action.assoc.nid,
+ CP_CCO_LEVEL,
+ CP_PCO_CAP
+ };
+ cp_msg_cc_assoc_req_send (ctx, &ctx->sta_action.assoc.peer, &data);
+}
+
+void
+cp_sta_action_assoc__wait_assoc_cnf__cc_assoc_cnf (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ cp_msg_cc_assoc_cnf_t cnf;
+ dbg_assert (ctx);
+ dbg_assert (ctx->sta_action.assoc.nid);
+ dbg_assert (mme);
+ /* Check response. */
+ if (!cp_mme_peer_cmp (&mme->peer, &ctx->sta_action.assoc.peer)
+ || !cp_msg_cc_assoc_cnf_receive (ctx, mme, &cnf)
+ || cnf.nid != ctx->sta_action.assoc.nid)
+ {
+ /* Unrelated message, drop. */
+ cp_fsm_branch (ctx, WAIT_ASSOC_CONF, CC_ASSOC_CNF, unrelated);
+ }
+ else if (cnf.result != CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS)
+ {
+ /* Failure indication. */
+ cp_fsm_branch (ctx, WAIT_ASSOC_CONF, CC_ASSOC_CNF, nok);
+ }
+ else
+ {
+ /* Update state. */
+ cp_sta_mgr_merge_net (ctx, ctx->sta_action.assoc.cco_net);
+ cp_sta_own_data_set_tei (ctx, cnf.sta_tei);
+ /* Send get key request. */
+ cp_msg_cm_get_key_req_t get_key = {
+ .relayed = false, .key_type = CP_MSG_KEY_NEK,
+ .nid = ctx->sta_action.assoc.nid };
+ cp_secu_protocol_run_new (&ctx->sta_action.assoc.prun, 0,
+ lib_rnd32 (&ctx->rnd),
+ lib_rnd32 (&ctx->rnd));
+ cp_msg_cm_get_key_req_send (ctx, &mme->peer, CP_MME_PEKS_NMK,
+ &ctx->sta_action.assoc.prun, &get_key);
+ /* Change state. */
+ cp_fsm_branch (ctx, WAIT_ASSOC_CONF, CC_ASSOC_CNF, ok);
+ }
+}
+
+void
+cp_sta_action_assoc__wait_assoc_cnf__timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ctx->sta_action.assoc.retry--;
+ if (ctx->sta_action.assoc.retry)
+ {
+ /* Resend association request. */
+ cp_sta_action_assoc__unassociated__to_assoc (ctx);
+ cp_fsm_branch (ctx, WAIT_ASSOC_CONF, assoc_timeout, retry);
+ }
+ else
+ {
+ /* Give up. */
+ cp_fsm_branch (ctx, WAIT_ASSOC_CONF, assoc_timeout, no_retry);
+ }
+}
+
+void
+cp_sta_action_assoc__associated__cm_get_key_cnf_pid_0 (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ cp_msg_cm_get_key_cnf_t cnf;
+ /* Check response. */
+ if (!cp_mme_peer_cmp (&mme->peer, &ctx->sta_action.assoc.peer)
+ || !cp_msg_cm_get_key_cnf_receive (ctx, mme, &cnf)
+ || (cp_secu_protocol_check (&ctx->sta_action.assoc.prun, &mme->prun)
+ != CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEXT)
+ || cnf.nid != ctx->sta_action.assoc.nid
+ || cnf.key_type != CP_MSG_KEY_NEK)
+ {
+ /* Unrelated message, drop. */
+ cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF_PID0, unrelated);
+ }
+ else if (cnf.result != CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED)
+ {
+ /* Failure indication. */
+ cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF_PID0, nok);
+ }
+ else
+ {
+ cp_fsm_post_new_event (ctx, bare, joined);
+ cp_fsm_branch (ctx, ASSOCIATED, CM_GET_KEY_CNF_PID0, ok);
+ }
+}
+
+void
+cp_sta_action_assoc__associated__timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+}
+
+void
+cp_sta_action_assoc__authenticated__renew (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ /* Get our CCo. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_mme_peer_t peer;
+ cp_net_get_cco_peer (ctx, our_net, &peer);
+ /* Send CC_ASSOC.REQ to renew lease. */
+ cp_msg_cc_assoc_req_t req = {
+ CP_MSG_CC_ASSOC_REQ_TYPE_RENEW,
+ cp_net_get_nid (ctx, our_net),
+ CP_CCO_LEVEL, CP_PCO_CAP
+ };
+ cp_msg_cc_assoc_req_send (ctx, &peer, &req);
+}
+
+void
+cp_sta_action_assoc__authenticated__cc_assoc_cnf (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ /* Get our CCo. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_mme_peer_t peer;
+ cp_net_get_cco_peer (ctx, our_net, &peer);
+ /* Check received message. */
+ cp_msg_cc_assoc_cnf_t cnf;
+ if (cp_mme_peer_cmp (&mme->peer, &peer)
+ && cp_msg_cc_assoc_cnf_receive (ctx, mme, &cnf)
+ && cnf.result == CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS
+ && cnf.nid == cp_net_get_nid (ctx, our_net))
+ {
+ /* Update lease. */
+ }
+}
+
+void
+cp_sta_action_assoc__authenticated__cm_set_key_req_pid_1 (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ /* Get our CCo. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_mme_peer_t peer;
+ cp_net_get_cco_peer (ctx, our_net, &peer);
+ /* Check received message. */
+ cp_msg_cm_set_key_req_t req;
+ if (cp_mme_peer_cmp (&mme->peer, &peer)
+ && cp_msg_cm_set_key_req_receive (ctx, mme, &req)
+ && (cp_secu_protocol_check (NULL, &mme->prun)
+ == CP_SECU_PROTOCOL_RUN_CHECK_RESULT_NEW)
+ && req.nid == cp_net_get_nid (ctx, our_net)
+ && req.key_type == CP_MSG_KEY_NEK)
+ {
+ /* Send response. */
+ cp_msg_cm_set_key_cnf_t cnf = { CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS,
+ CP_CCO_LEVEL };
+ cp_secu_protocol_run_t prun = mme->prun;
+ cp_secu_protocol_next (&prun, true);
+ cp_msg_cm_set_key_cnf_send (ctx, &peer, CP_MME_PEKS_NONE, &prun,
+ &cnf);
+ /* Update NEK. */
+ }
+}
+
+void
+cp_sta_action_assoc__authenticated__to_leave (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ /* Get our CCo. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_mme_peer_t peer;
+ cp_net_get_cco_peer (ctx, our_net, &peer);
+ /* Send leave request. */
+ cp_msg_cc_leave_req_send (ctx, &peer,
+ CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST);
+}
+
+void
+cp_sta_action_assoc__authenticated__cc_leave_ind (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ /* Get our CCo. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_mme_peer_t peer;
+ cp_net_get_cco_peer (ctx, our_net, &peer);
+ /* Check received message. */
+ enum cp_msg_cc_leave_ind_reason_t reason;
+ cp_nid_t nid;
+ if (cp_mme_peer_cmp (&mme->peer, &peer)
+ && cp_msg_cc_leave_ind_receive (ctx, mme, &reason, &nid)
+ && nid == cp_net_get_nid (ctx, our_net))
+ {
+ cp_msg_cc_leave_rsp_send (ctx, &mme->peer);
+ cp_fsm_branch (ctx, AUTHENTICATED, CC_LEAVE_IND, ok);
+ }
+ else
+ {
+ cp_fsm_branch (ctx, AUTHENTICATED, CC_LEAVE_IND, nok);
+ }
+}
+
+void
+cp_sta_action_assoc__leaving__cc_leave_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ /* Get our CCo. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_mme_peer_t peer;
+ cp_net_get_cco_peer (ctx, our_net, &peer);
+ /* Check received message. */
+ if (cp_mme_peer_cmp (&mme->peer, &peer))
+ {
+ /* Ignore bad MME (confirmation is sufficient, we do not expect any
+ * parameter). */
+ cp_msg_cc_leave_cnf_receive (ctx, mme);
+ cp_fsm_branch (ctx, LEAVING, CC_LEAVE_CNF, ok);
+ }
+ else
+ {
+ cp_fsm_branch (ctx, LEAVING, CC_LEAVE_CNF, unrelated);
+ }
+}
+
+void
+cp_sta_action_assoc__leaving__timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ /* Get our CCo. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_mme_peer_t peer;
+ cp_net_get_cco_peer (ctx, our_net, &peer);
+ /* Send leave request again. */
+ cp_msg_cc_leave_req_send (ctx, &peer,
+ CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST);
+}
+
+void
+cp_sta_action_assoc__leave_wait__timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+}
+
diff --git a/cesar/cp/sta/action/src/drv.c b/cesar/cp/sta/action/src/drv.c
new file mode 100644
index 0000000000..4b04f80282
--- /dev/null
+++ b/cesar/cp/sta/action/src/drv.c
@@ -0,0 +1,186 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/drv.c
+ * \brief STA action, driver related definitions.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "action.h"
+
+#include "cp/msg/msg.h"
+#include "cp/inc/context.h"
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_mac_addr_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ mac_t mac;
+ bool ok = cp_msg_drv_sta_set_mac_addr_req_receive (ctx, mme, &mac);
+ if (ok)
+ cp_sta_own_data_set_mac_address (ctx, mac);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_MAC_ADDR_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_cco_pref_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ bool cco_pref;
+ bool ok = cp_msg_drv_sta_set_cco_pref_req_receive (ctx, mme, &cco_pref);
+ if (ok)
+ {
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ own->cco_prefered = cco_pref;
+ }
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_CCO_PREF_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_was_cco_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ bool was_cco;
+ bool ok = cp_msg_drv_sta_set_was_cco_req_receive (ctx, mme, &was_cco);
+ if (ok)
+ cp_sta_own_data_set_was_cco (ctx, was_cco);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_WAS_CCO_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_npw_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ char npw[CP_NPW_MAX_SIZE + 1];
+ bool ok = cp_msg_drv_sta_set_npw_req_receive (ctx, mme, npw);
+ if (ok)
+ cp_sta_own_data_set_npw (ctx, npw);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_NPW_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_dpw_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ char dpw[CP_DPW_MAX_SIZE + 1];
+ bool ok = cp_msg_drv_sta_set_dpw_req_receive (ctx, mme, dpw);
+ if (ok)
+ cp_sta_own_data_set_dpw (ctx, dpw);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_DPW_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_sl_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ cp_security_level_t sl;
+ bool ok = cp_msg_drv_sta_set_sl_req_receive (ctx, mme, &sl);
+ if (ok)
+ cp_sta_own_data_set_security_level (ctx, sl);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_SL_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_nid_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ cp_nid_t nid;
+ bool ok = cp_msg_drv_sta_set_nid_req_receive (ctx, mme, &nid);
+ if (ok)
+ cp_sta_mgr_update_our_avln_nid (ctx, nid);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_NID_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_m_sta_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ char m_sta_hfid[CP_HFID_SIZE + 1];
+ bool ok = cp_msg_drv_sta_set_m_sta_hfid_req_receive (ctx, mme,
+ m_sta_hfid);
+ if (ok)
+ cp_sta_own_data_set_hfid_manufacturer (ctx, m_sta_hfid);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_M_STA_HFID_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_u_sta_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ char u_sta_hfid[CP_HFID_SIZE + 1];
+ bool ok = cp_msg_drv_sta_set_u_sta_hfid_req_receive (ctx, mme,
+ u_sta_hfid);
+ if (ok)
+ cp_sta_own_data_set_hfid_user (ctx, u_sta_hfid);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_U_STA_HFID_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_avln_hfid_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ char avln_hfid[CP_HFID_SIZE + 1];
+ bool ok = cp_msg_drv_sta_set_avln_hfid_req_receive (ctx, mme, avln_hfid);
+ if (ok)
+ cp_sta_own_data_set_hfid_avln (ctx, avln_hfid);
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_AVLN_HFID_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_set_tonemask_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+ u32 tonemask[PHY_TONEMASK_WORDS];
+ bool ok = cp_msg_drv_sta_set_tonemask_req_receive (ctx, mme, tonemask);
+ if (ok)
+ {
+ /* TODO. */
+ }
+ cp_msg_drv_any_cnf_send (ctx, &mme->peer, DRV_STA_SET_TONEMASK_CNF,
+ ok ? CP_MSG_DRV_RESULT_SUCCESS
+ : CP_MSG_DRV_RESULT_FAILURE);
+}
+
+void
+cp_sta_action_drv__stopped__drv_sta_mac_start_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_sta_action_drv__started__drv_sta_mac_stop_req (cp_t *ctx,
+ cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_sta_action_drv__stopping__left (cp_t *ctx)
+{
+}
+
diff --git a/cesar/cp/sta/action/src/info.c b/cesar/cp/sta/action/src/info.c
new file mode 100644
index 0000000000..21702a69ad
--- /dev/null
+++ b/cesar/cp/sta/action/src/info.c
@@ -0,0 +1,99 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/info.c
+ * \brief STA action, information gathering definitions.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "action.h"
+
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "lib/slab.h"
+
+void
+cp_sta_action_process_cc_set_tei_map_ind (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ enum cp_msg_cc_set_tei_map_ind_mode_t mode;
+ uint i, sta_nb;
+ cp_net_t *our_net;
+ if (cp_msg_cc_set_tei_map_ind_receive_begin (ctx, mme, &mode, &sta_nb))
+ {
+ bool ok = true;
+ our_net = cp_sta_mgr_get_our_avln (ctx);
+ /* Setup a bit array to remember added station. */
+ u32 added[256 / 32];
+ memset (added, 0, sizeof (added));
+ added[0] = 1; /* 0 is not a valid TEI. */
+ /* Loop for each received station. */
+ for (i = 0; i < sta_nb; i++)
+ {
+ /* Read the station. */
+ cp_tei_t tei;
+ mac_t mac;
+ enum cp_msg_cc_set_tei_map_ind_status_t status;
+ ok = cp_msg_cc_set_tei_map_ind_receive_sta (ctx, mme, &tei, &mac,
+ &status);
+ if (!ok)
+ break;
+ /* Add or remove. */
+ if (mode != CP_MSG_CC_SET_TEI_MAP_IND_MODE_DELETE)
+ {
+ cp_sta_t *sta;
+ sta = cp_net_sta_add (ctx, our_net, tei, mac);
+ cp_sta_set_state (
+ sta,
+ status == CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED
+ ? CP_STA_STATE_AUTHENTICATED
+ : CP_STA_STATE_ASSOCIATED);
+ slab_release (sta);
+ added[tei / 32] |= 1 << (tei % 32);
+ }
+ else
+ cp_net_sta_remove_assoc (ctx, our_net, tei);
+ }
+ if (ok)
+ {
+ /* Remove unseen station if update. */
+ if (mode == CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE)
+ {
+ u32 w;
+ for (i = 0; i < 255; i++)
+ {
+ if (i % 32 == 0)
+ w = added[i / 32];
+ if (!(w & 1))
+ cp_net_sta_remove_assoc (ctx, our_net, i);
+ w >>= 1;
+ }
+ }
+ cp_msg_cc_set_tei_map_ind_receive_end (ctx, mme);
+ }
+ cp_net_commit_to_dataplane (ctx, our_net);
+ }
+}
+
+void
+cp_sta_action_process_cm_unassociated_sta_ind (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ cp_nid_t nid;
+ u8 cco_cap;
+ if (cp_msg_cm_unassociated_sta_ind_receive (ctx, mme, &nid, &cco_cap))
+ {
+ cp_net_t *net = cp_sta_mgr_add_avln (ctx, 0, nid);
+ if (net)
+ {
+ cp_sta_t *sta = cp_net_sta_add (ctx, net, 0, mme->peer.mac);
+ sta->cco_cap = cco_cap;
+ slab_release (sta);
+ }
+ }
+}
+
diff --git a/cesar/cp/sta/action/src/key.c b/cesar/cp/sta/action/src/key.c
new file mode 100644
index 0000000000..b2fa0a843f
--- /dev/null
+++ b/cesar/cp/sta/action/src/key.c
@@ -0,0 +1,54 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/key.c
+ * \brief STA action, key exchange messages.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "action.h"
+
+#include "cp/fsm/fsm.h"
+
+void
+cp_sta_action_process_cm_set_key_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ if (mme->prun.pid == 1)
+ cp_fsm_post_new_event (ctx, mme, CM_SET_KEY_REQ_PID1, mme);
+}
+
+void
+cp_sta_action_process_cm_set_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ if (mme->prun.pid == 1)
+ cp_fsm_post_new_event (ctx, mme, CM_SET_KEY_CNF_PID1, mme);
+}
+
+void
+cp_sta_action_process_cm_get_key_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ if (mme->prun.pid == 0)
+ cp_fsm_post_new_event (ctx, mme, CM_GET_KEY_REQ_PID0, mme);
+}
+
+void
+cp_sta_action_process_cm_get_key_cnf (cp_t *ctx, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ dbg_assert (mme);
+ if (mme->prun.pid == 0)
+ cp_fsm_post_new_event (ctx, mme, CM_GET_KEY_CNF_PID0, mme);
+}
+
diff --git a/cesar/cp/sta/action/src/misc.c b/cesar/cp/sta/action/src/misc.c
new file mode 100644
index 0000000000..d273cd05a5
--- /dev/null
+++ b/cesar/cp/sta/action/src/misc.c
@@ -0,0 +1,36 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/misc.c
+ * \brief STA action, miscellaneous definitions.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "action.h"
+
+void
+cp_sta_action_process_cc_who_ru_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_sta_action_process_cc_relay_req (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_sta_action_process_cc_relay_ind (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
+
+void
+cp_sta_action_process_cm_mme_error_ind (cp_t *ctx, cp_mme_rx_t *mme)
+{
+}
+
diff --git a/cesar/cp/sta/action/src/poweron.c b/cesar/cp/sta/action/src/poweron.c
new file mode 100644
index 0000000000..1c28d6a710
--- /dev/null
+++ b/cesar/cp/sta/action/src/poweron.c
@@ -0,0 +1,277 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/action/src/poweron.c
+ * \brief STA action, power on procedure related definitions.
+ * \ingroup cp_sta_action
+ */
+#include "common/std.h"
+
+#include "action.h"
+
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/fsm/fsm.h"
+
+#include "lib/slab.h"
+
+#include "cp/inc/context.h"
+
+/* Order of MAC address comparison is reversed to determine who will become
+ * CCo! As a direct consequence, some manufacturer will always become CCo. */
+#define MAC_REVERSE(mac) \
+ ( ((mac) & 0xff0000000000ull) >> 40 \
+ | ((mac) & 0x00ff00000000ull) >> 24 \
+ | ((mac) & 0x0000ff000000ull) >> 8 \
+ | ((mac) & 0x000000ff0000ull) << 8 \
+ | ((mac) & 0x00000000ff00ull) << 24 \
+ | ((mac) & 0x0000000000ffull) << 40)
+
+/**
+ * Common handling of POWERON and USTA => USTT TIMEOUT.
+ * \param ctx control plane context
+ * \param ustt_ms USTT timer maximum value
+ */
+static void
+cp_sta_action_poweron_ustt_timeout (cp_t *ctx, uint ustt_ms)
+{
+ if (!cp_sta_mgr_net_list_is_empty (ctx))
+ {
+ /* Send an CM_UNASSOCIATED_STA.IND. */
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_msg_cm_unassociated_sta_ind_send (ctx, &CP_MME_PEER (MAC_BROADCAST),
+ cp_net_get_nid (ctx, our_net),
+ CP_CCO_LEVEL);
+ }
+}
+
+/**
+ * Common handling of POWERON and USTA => BEACON.
+ * \param ctx control plane context
+ * \param net STA net
+ * \param sta STA emitting the beacon
+ * \param branch_match branch taken if NID match
+ * \param branch_no_match branch taken in other cases
+ */
+static void
+cp_sta_action_poweron_beacon_match_and_join (cp_t *ctx, cp_net_t *net,
+ cp_sta_t *sta,
+ cp_fsm_branch_t branch_match,
+ cp_fsm_branch_t branch_no_match)
+{
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_nid_t our_nid = cp_net_get_nid (ctx, our_net);
+ /* Does not support proxy networking for the moment, only join if CCo. */
+ if (cp_sta_get_cco_status (sta)
+ && cp_net_get_nid (ctx, net) == our_nid)
+ {
+ cp_sta_action_assoc_start (ctx, net, sta);
+ cp_fsm_branch_ (ctx, branch_match);
+ }
+ else
+ {
+ cp_fsm_branch_ (ctx, branch_no_match);
+ }
+}
+
+void
+cp_sta_action_poweron_start (cp_t *ctx)
+{
+}
+
+void
+cp_sta_action_poweron__poweron__ustt_timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ cp_sta_action_poweron_ustt_timeout (ctx, CP_USAI_S * 1000);
+}
+
+void
+cp_sta_action_poweron__poweron__btt_timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ if (cp_sta_mgr_net_list_is_empty (ctx))
+ {
+ cp_fsm_branch (ctx, POWERON, btt_timeout, no_avln);
+ }
+ else
+ {
+ /* I can become CCo only if at least one unassociated STA is seen. */
+ bool iam_cco = true, sta_seen = false;
+ mac_t rmac = MAC_REVERSE (cp_sta_own_data_get_mac_address (ctx));
+ /* Look for a net with a matching NID (XXX: sta_mgr interface could be
+ * improved on this point). */
+ cp_snid_t snid;
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ cp_nid_t nid = cp_net_get_nid (ctx, our_net);
+ for (snid = 0; iam_cco && snid < 16; snid++)
+ {
+ /* For each matching net, look at unassociated STA. */
+ cp_net_t *net = cp_sta_mgr_get_avln (ctx, snid, nid);
+ if (!net)
+ continue;
+ cp_sta_t *sta = cp_net_get_first (ctx, net, CP_STA_STATE_EXISTS);
+ if (sta)
+ sta_seen = true;
+ for (; sta; sta = cp_net_get_next (ctx, net, sta))
+ {
+ if (sta->cco_cap > CP_CCO_LEVEL
+ || (sta->cco_cap == CP_CCO_LEVEL
+ && MAC_REVERSE (cp_sta_get_mac_address (sta)) > rmac))
+ {
+ iam_cco = false;
+ /* Early stop, should release the STA. */
+ slab_release (sta);
+ break;
+ }
+ }
+ }
+ if (iam_cco && sta_seen)
+ cp_fsm_branch (ctx, POWERON, btt_timeout, nid_match_cco);
+ else
+ cp_fsm_branch (ctx, POWERON, btt_timeout, avln);
+ }
+}
+
+void
+cp_sta_action_poweron__poweron__beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (net);
+ dbg_assert (sta);
+ cp_sta_action_poweron_beacon_match_and_join (
+ ctx, net, sta,
+ CP_FSM_BRANCH (POWERON, BEACON, nid_match),
+ CP_FSM_BRANCH (POWERON, BEACON, no_nid_match));
+}
+
+void
+cp_sta_action_poweron__poweron_joining__left (cp_t *ctx)
+{
+}
+
+void
+cp_sta_action_poweron__usta__ustt_timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ cp_sta_action_poweron_ustt_timeout (ctx, CP_DISCOVER_PERIOD_MAX_S * 1000);
+}
+
+void
+cp_sta_action_poweron__usta__beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (net);
+ dbg_assert (sta);
+ cp_sta_action_poweron_beacon_match_and_join (
+ ctx, net, sta,
+ CP_FSM_BRANCH (USTA, BEACON, nid_match),
+ CP_FSM_BRANCH (USTA, BEACON, no_nid_match));
+}
+
+void
+cp_sta_action_poweron__usta__usta_ind (cp_t *ctx, cp_net_t *net,
+ cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (sta);
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ if (cp_net_get_nid (ctx, net) != cp_net_get_nid (ctx, our_net))
+ {
+ cp_fsm_branch (ctx, USTA, usta_ind, else);
+ }
+ else
+ {
+ if (sta->cco_cap > CP_CCO_LEVEL
+ || (sta->cco_cap == CP_CCO_LEVEL
+ && (MAC_REVERSE (cp_sta_get_mac_address (sta))
+ > MAC_REVERSE (cp_sta_own_data_get_mac_address (ctx)))))
+ cp_fsm_branch (ctx, USTA, usta_ind, else);
+ else
+ cp_fsm_branch (ctx, USTA, usta_ind, nid_match_cco);
+ }
+}
+
+void
+cp_sta_action_poweron__usta_joining__left (cp_t *ctx)
+{
+}
+
+void
+cp_sta_action_poweron__sta__enter (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ctx->sta_action.poweron.beacon_loss = 0;
+}
+
+void
+cp_sta_action_poweron__sta__beacon (cp_t *ctx, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (beacon);
+ dbg_assert (net);
+ dbg_assert (sta);
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ if (cp_net_get_nid (ctx, net) == cp_net_get_nid (ctx, our_net))
+ {
+ /* Only on central beacon, no support for proxy networking. */
+ if (cp_sta_get_cco_status (sta))
+ {
+ ctx->sta_action.poweron.beacon_loss = 0;
+ }
+ }
+}
+
+void
+cp_sta_action_poweron__sta__beacon_not_received (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ ctx->sta_action.poweron.beacon_loss++;
+ if (ctx->sta_action.poweron.beacon_loss > CP_MAX_NO_BEACON)
+ cp_fsm_branch (ctx, STA, BEACON_NOT_RECEIVED, avln_failure);
+ else
+ cp_fsm_branch (ctx, STA, BEACON_NOT_RECEIVED, else);
+}
+
+void
+cp_sta_action_poweron__cco__join_timeout (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ if (cp_net_is_empty (ctx, our_net))
+ {
+ /* Leave CCo role. */
+ if (cp_sta_mgr_net_list_is_empty (ctx))
+ cp_fsm_branch (ctx, CCO, join_timeout, no_sta_no_avln);
+ else
+ cp_fsm_branch (ctx, CCO, join_timeout, no_sta_avln);
+ }
+ else
+ {
+ /* Ok, stay CCo. */
+ cp_fsm_branch (ctx, CCO, join_timeout, sta);
+ }
+}
+
+void
+cp_sta_action_poweron__cco__all_sta_leaved (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ /* Leave CCo role. */
+ if (cp_sta_mgr_net_list_is_empty (ctx))
+ cp_fsm_branch (ctx, CCO, all_sta_leaved, no_avln);
+ else
+ cp_fsm_branch (ctx, CCO, all_sta_leaved, avln);
+}
+
diff --git a/cesar/cp/sta/action/test/utest/Makefile b/cesar/cp/sta/action/test/utest/Makefile
new file mode 100644
index 0000000000..a4a90eb5e0
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/Makefile
@@ -0,0 +1,17 @@
+BASE = ../../../../..
+
+INCLUDES = cp/sta/action/test/utest cp/sta/action/test/utest/override
+
+HOST_PROGRAMS = test_sta_action
+test_sta_action_SOURCES = test_sta_action.c assoc.c drv.c info.c key.c \
+ poweron.c \
+ msg_stub.c dataplane_stub.c fsm_stub.c \
+ scenario_actions.c
+test_sta_action_MODULES = lib lib/scenario cp/sta/action cp/sta/mgr \
+ cp/fsm cp/secu
+cp_fsm_MODULE_SOURCES = tables.c
+
+include $(BASE)/common/make/top.mk
+
+$(call src2obj,src/assoc.c,host): $(BASE)/cp/fsm/fsm.h
+$(call src2obj,src/fsm_stub.c,host): $(BASE)/cp/fsm/fsm.h
diff --git a/cesar/cp/sta/action/test/utest/inc/scenario_defs.h b/cesar/cp/sta/action/test/utest/inc/scenario_defs.h
new file mode 100644
index 0000000000..8583f06e9f
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/inc/scenario_defs.h
@@ -0,0 +1,348 @@
+#ifndef inc_scenario_defs_h
+#define inc_scenario_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/scenario_defs.h
+ * \brief Scenario definitions.
+ * \ingroup test
+ */
+
+#include "cp/msg/msg.h"
+#include "cp/sta/mgr/sta.h"
+#include "cp/sta/mgr/net.h"
+#include "cp/fsm/fsm.h"
+
+/* Scenario globals. */
+#define SCENARIO_DEFS_GLOBALS \
+ cp_t *cp; \
+ u16 prn; \
+ u32 my_nonce; \
+ u32 your_nonce;
+
+/* Scenario actions. */
+#define SCENARIO_DEFS_ACTIONS \
+ garbage, \
+ \
+ assoc_start, \
+ assoc_leave, \
+ assoc__unassociated__enter, \
+ assoc__unassociated__to_assoc, \
+ assoc__wait_assoc_cnf__cc_assoc_cnf, \
+ assoc__wait_assoc_cnf__timeout, \
+ assoc__associated__cm_get_key_cnf_pid_0, \
+ assoc__associated__timeout, \
+ assoc__authenticated__renew, \
+ assoc__authenticated__cc_assoc_cnf, \
+ assoc__authenticated__cm_set_key_req_pid_1, \
+ assoc__authenticated__to_leave, \
+ assoc__authenticated__cc_leave_ind, \
+ assoc__leaving__cc_leave_cnf, \
+ assoc__leaving__timeout, \
+ assoc__leave_wait__timeout, \
+ \
+ drv__stopped__drv_sta_set_mac_addr_req, \
+ drv__stopped__drv_sta_set_cco_pref_req, \
+ drv__stopped__drv_sta_set_was_cco_req, \
+ drv__stopped__drv_sta_set_npw_req, \
+ drv__stopped__drv_sta_set_dpw_req, \
+ drv__stopped__drv_sta_set_sl_req, \
+ drv__stopped__drv_sta_set_nid_req, \
+ drv__stopped__drv_sta_set_m_sta_hfid_req, \
+ drv__stopped__drv_sta_set_u_sta_hfid_req, \
+ drv__stopped__drv_sta_set_avln_hfid_req, \
+ drv__stopped__drv_sta_set_tonemask_req, \
+ drv__stopped__drv_sta_mac_start_req, \
+ drv__started__drv_sta_mac_stop_req, \
+ drv__stopping__left, \
+ \
+ process_cc_set_tei_map_ind, \
+ process_cm_unassociated_sta_ind, \
+ \
+ process_cm_set_key_req, \
+ process_cm_set_key_cnf, \
+ process_cm_get_key_req, \
+ process_cm_get_key_cnf, \
+ \
+ process_cc_who_ru_req, \
+ process_cc_relay_req, \
+ process_cc_relay_ind, \
+ process_cm_mme_error_ind, \
+ \
+ poweron_start, \
+ poweron__poweron__ustt_timeout, \
+ poweron__poweron__btt_timeout, \
+ poweron__poweron__beacon, \
+ poweron__poweron_joining__left, \
+ poweron__usta__ustt_timeout, \
+ poweron__usta__beacon, \
+ poweron__usta__usta_ind, \
+ poweron__usta_joining__left, \
+ poweron__sta__enter, \
+ poweron__sta__beacon, \
+ poweron__sta__beacon_not_received, \
+ poweron__cco__join_timeout, \
+ poweron__cco__all_sta_leaved
+
+/* Actions without parameter. */
+#define __0(action) \
+typedef scenario_empty_t scenario_action_ ## action ## _t; \
+void \
+scenario_action_ ## action ## _cb ( \
+ scenario_globals_t *globals, scenario_params_t *params);
+
+/* Actions with parameters. */
+#define __n(action, param...) \
+typedef struct \
+{ \
+ PREPROC_FOR_EACH (__n_, param) \
+} scenario_action_ ## action ## _t; \
+void \
+scenario_action_ ## action ## _cb ( \
+ scenario_globals_t *globals, scenario_params_t *params);
+#define __n_(param) param;
+
+/* Actions with MME and parameters. */
+#define __m(action, param...) \
+typedef struct \
+{ \
+ cp_mme_peer_t peer; \
+ PREPROC_FOR_EACH (__m_, param) \
+} scenario_action_ ## action ## _t; \
+void \
+scenario_action_ ## action ## _cb ( \
+ scenario_globals_t *globals, scenario_params_t *params);
+#define __m_(param) param;
+
+__0 (garbage)
+
+__n (assoc_start, cp_net_t *cco_net, cp_sta_t *cco)
+__0 (assoc_leave)
+__0 (assoc__unassociated__enter)
+__0 (assoc__unassociated__to_assoc)
+__m (assoc__wait_assoc_cnf__cc_assoc_cnf)
+__0 (assoc__wait_assoc_cnf__timeout)
+__m (assoc__associated__cm_get_key_cnf_pid_0)
+__0 (assoc__associated__timeout)
+__0 (assoc__authenticated__renew)
+__m (assoc__authenticated__cc_assoc_cnf)
+__m (assoc__authenticated__cm_set_key_req_pid_1)
+__0 (assoc__authenticated__to_leave)
+__m (assoc__authenticated__cc_leave_ind)
+__m (assoc__leaving__cc_leave_cnf)
+__0 (assoc__leaving__timeout)
+__0 (assoc__leave_wait__timeout)
+
+__m (drv__stopped__drv_sta_set_mac_addr_req)
+__m (drv__stopped__drv_sta_set_cco_pref_req)
+__m (drv__stopped__drv_sta_set_was_cco_req)
+__m (drv__stopped__drv_sta_set_npw_req)
+__m (drv__stopped__drv_sta_set_dpw_req)
+__m (drv__stopped__drv_sta_set_sl_req)
+__m (drv__stopped__drv_sta_set_nid_req)
+__m (drv__stopped__drv_sta_set_m_sta_hfid_req)
+__m (drv__stopped__drv_sta_set_u_sta_hfid_req)
+__m (drv__stopped__drv_sta_set_avln_hfid_req)
+__m (drv__stopped__drv_sta_set_tonemask_req)
+__m (drv__stopped__drv_sta_mac_start_req)
+__m (drv__started__drv_sta_mac_stop_req)
+__0 (drv__stopping__left)
+
+__m (process_cc_set_tei_map_ind)
+__m (process_cm_unassociated_sta_ind)
+
+__m (process_cm_set_key_req, u8 pid)
+__m (process_cm_set_key_cnf, u8 pid)
+__m (process_cm_get_key_req, u8 pid)
+__m (process_cm_get_key_cnf, u8 pid)
+
+__m (process_cc_who_ru_req)
+__m (process_cc_relay_req)
+__m (process_cc_relay_ind)
+__m (process_cm_mme_error_ind)
+
+__0 (poweron_start)
+__0 (poweron__poweron__ustt_timeout)
+__0 (poweron__poweron__btt_timeout)
+__n (poweron__poweron__beacon, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+__0 (poweron__poweron_joining__left)
+__0 (poweron__usta__ustt_timeout)
+__n (poweron__usta__beacon, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+__n (poweron__usta__usta_ind, cp_net_t *net, cp_sta_t *sta)
+__0 (poweron__usta_joining__left)
+__0 (poweron__sta__enter)
+__n (poweron__sta__beacon, cp_beacon_desc_t *beacon,
+ cp_net_t *net, cp_sta_t *sta)
+__0 (poweron__sta__beacon_not_received)
+__0 (poweron__cco__join_timeout)
+__0 (poweron__cco__all_sta_leaved)
+
+#undef __0
+#undef __n
+#undef __n_
+#undef __m
+#undef __m_
+
+/* Scenario events. */
+#define SCENARIO_DEFS_EVENTS \
+ cp_msg_cc_who_ru_req_receive, \
+ cp_msg_cc_who_ru_cnf_send, \
+ cp_msg_cc_assoc_req_send, \
+ cp_msg_cc_assoc_cnf_receive, \
+ cp_msg_cc_leave_req_send, \
+ cp_msg_cc_leave_cnf_receive, \
+ cp_msg_cc_leave_ind_receive, \
+ cp_msg_cc_leave_rsp_send, \
+ cp_msg_cc_set_tei_map_ind_receive_begin, \
+ cp_msg_cc_set_tei_map_ind_receive_sta, \
+ cp_msg_cc_set_tei_map_ind_receive_end, \
+ \
+ cp_msg_cm_unassociated_sta_ind_send, \
+ cp_msg_cm_unassociated_sta_ind_receive, \
+ cp_msg_cm_set_key_req_receive, \
+ cp_msg_cm_set_key_cnf_send, \
+ cp_msg_cm_get_key_req_send, \
+ cp_msg_cm_get_key_cnf_receive, \
+ cp_msg_cm_mme_error_ind_receive, \
+ \
+ cp_msg_drv_sta_set_mac_addr_req_receive, \
+ cp_msg_drv_sta_set_cco_pref_req_receive, \
+ cp_msg_drv_sta_set_was_cco_req_receive, \
+ cp_msg_drv_sta_set_npw_req_receive, \
+ cp_msg_drv_sta_set_dpw_req_receive, \
+ cp_msg_drv_sta_set_sl_req_receive, \
+ cp_msg_drv_sta_set_nid_req_receive, \
+ cp_msg_drv_sta_set_m_sta_hfid_req_receive, \
+ cp_msg_drv_sta_set_u_sta_hfid_req_receive, \
+ cp_msg_drv_sta_set_avln_hfid_req_receive, \
+ cp_msg_drv_sta_set_tonemask_req_receive, \
+ cp_msg_drv_sta_mac_start_req_receive, \
+ cp_msg_drv_sta_mac_stop_req_receive, \
+ cp_msg_drv_any_cnf_send, \
+ \
+ cp_fsm_event_bare_new, \
+ cp_fsm_event_mme_new, \
+ cp_fsm_branch, \
+ \
+ cl_mactotei_use_table
+
+/* MME send event. */
+#define __ms(event, param...) \
+typedef struct \
+{ \
+ cp_mme_peer_t peer; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME send event with encryption information. */
+#define __msk(event, param...) \
+typedef struct \
+{ \
+ cp_mme_peer_t peer; \
+ cp_mme_peks_t peks; \
+ u8 pid; \
+ u8 pmn; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME receive event. */
+#define __mr(event, param...) \
+typedef struct \
+{ \
+ bool ok; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+/* MME receive event with encryption information. */
+#define __mrk(event, param...) \
+typedef struct \
+{ \
+ bool ok; \
+ cp_mme_peks_t peks; \
+ u8 pid; \
+ u8 pmn; \
+ bool new_prn; \
+ bool new_my_nonce; \
+ bool new_your_nonce; \
+ PREPROC_FOR_EACH (__p_, ## param) \
+} scenario_event_ ## event ## _t;
+
+#define __p_(param) param;
+
+__mr (cp_msg_cc_who_ru_req_receive, cp_nid_t nid)
+__ms (cp_msg_cc_who_ru_cnf_send, cp_nid_t nid, mac_t cco_mac, char *avln_hfid)
+__ms (cp_msg_cc_assoc_req_send, enum cp_msg_cc_assoc_req_type_t request_type,
+ cp_nid_t nid, u8 cco_cap, u8 proxy_cap)
+__mr (cp_msg_cc_assoc_cnf_receive, enum cp_msg_cc_assoc_cnf_result_t result,
+ cp_nid_t nid, cp_snid_t snid, cp_tei_t sta_tei, u16 lease_time_min)
+__ms (cp_msg_cc_leave_req_send, enum cp_msg_cc_leave_req_reason_t reason)
+__mr (cp_msg_cc_leave_cnf_receive)
+__mr (cp_msg_cc_leave_ind_receive, enum cp_msg_cc_leave_ind_reason_t reason,
+ cp_nid_t nid)
+__ms (cp_msg_cc_leave_rsp_send)
+__mr (cp_msg_cc_set_tei_map_ind_receive_begin,
+ enum cp_msg_cc_set_tei_map_ind_mode_t mode, uint sta_nb)
+__mr (cp_msg_cc_set_tei_map_ind_receive_sta, cp_tei_t tei, mac_t mac,
+ enum cp_msg_cc_set_tei_map_ind_status_t status)
+__mr (cp_msg_cc_set_tei_map_ind_receive_end)
+
+__ms (cp_msg_cm_unassociated_sta_ind_send, cp_nid_t nid, u8 cco_cap)
+__mr (cp_msg_cm_unassociated_sta_ind_receive, cp_nid_t nid, u8 cco_cap)
+__mrk (cp_msg_cm_set_key_req_receive,
+ enum cp_msg_key_type_t key_type, u8 cco_cap, cp_nid_t nid, u8 new_eks,
+ cp_key_t new_key)
+__msk (cp_msg_cm_set_key_cnf_send, enum cp_msg_cm_set_key_cnf_result_t result,
+ u8 cco_cap)
+__msk (cp_msg_cm_get_key_req_send, bool relayed,
+ enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 *hash_key)
+__mrk (cp_msg_cm_get_key_cnf_receive,
+ enum cp_msg_cm_get_key_cnf_result_t result,
+ enum cp_msg_key_type_t key_type, cp_nid_t nid, u8 eks, u8 *hash_key,
+ cp_key_t *key)
+__mr (cp_msg_cm_mme_error_ind_receive,
+ enum cp_msg_cm_mme_error_ind_reason_t reason, u8 rx_mmv,
+ cp_mmtype_t rx_mmtype, uint offset)
+
+__mr (cp_msg_drv_sta_set_mac_addr_req_receive, mac_t mac)
+__mr (cp_msg_drv_sta_set_cco_pref_req_receive, bool cco_pref)
+__mr (cp_msg_drv_sta_set_was_cco_req_receive, bool was_cco)
+__mr (cp_msg_drv_sta_set_npw_req_receive, char *npw)
+__mr (cp_msg_drv_sta_set_dpw_req_receive, char *dpw)
+__mr (cp_msg_drv_sta_set_sl_req_receive, cp_security_level_t sl)
+__mr (cp_msg_drv_sta_set_nid_req_receive, cp_nid_t nid)
+__mr (cp_msg_drv_sta_set_m_sta_hfid_req_receive, char *m_sta_hfid)
+__mr (cp_msg_drv_sta_set_u_sta_hfid_req_receive, char *u_sta_hfid)
+__mr (cp_msg_drv_sta_set_avln_hfid_req_receive, char *avln_hfid)
+__mr (cp_msg_drv_sta_set_tonemask_req_receive, u32 *tonemask)
+__mr (cp_msg_drv_sta_mac_start_req_receive)
+__mr (cp_msg_drv_sta_mac_stop_req_receive)
+__ms (cp_msg_drv_any_cnf_send, cp_mmtype_t mmtype, cp_msg_drv_result_t result)
+
+#undef __ms
+#undef __msk
+#undef __mr
+#undef __mrk
+#undef __p_
+
+typedef struct
+{
+ cp_fsm_event_type_t type;
+} scenario_event_cp_fsm_event_bare_new_t;
+typedef struct
+{
+ cp_fsm_event_type_t type;
+} scenario_event_cp_fsm_event_mme_new_t;
+typedef struct
+{
+ cp_fsm_branch_t branch;
+} scenario_event_cp_fsm_branch_t;
+typedef scenario_empty_t scenario_event_cl_mactotei_use_table_t;
+
+#endif /* inc_scenario_defs_h */
diff --git a/cesar/cp/sta/action/test/utest/inc/test_sta_action.h b/cesar/cp/sta/action/test/utest/inc/test_sta_action.h
new file mode 100644
index 0000000000..ec427e880e
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/inc/test_sta_action.h
@@ -0,0 +1,46 @@
+#ifndef inc_test_sta_action_h
+#define inc_test_sta_action_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file inc/test_sta_action.h
+ * \brief Test sta/action.
+ * \ingroup test
+ */
+#include "cp/inc/context.h"
+
+/** Contexts used in tests. */
+struct test_sta_action_t
+{
+ cp_t cp;
+ mac_config_t mac_config;
+};
+typedef struct test_sta_action_t test_sta_action_t;
+
+/**
+ * Initialise test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_init (test_sta_action_t *ctx);
+
+/**
+ * Uninitialise test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_uninit (test_sta_action_t *ctx);
+
+/**
+ * Reset test contexts.
+ * \param ctx test context
+ */
+void
+test_sta_action_reset (test_sta_action_t *ctx);
+
+#endif /* inc_test_sta_action_h */
diff --git a/cesar/cp/sta/action/test/utest/override/cp2/inc/context.h b/cesar/cp/sta/action/test/utest/override/cp2/inc/context.h
new file mode 100644
index 0000000000..e52e8f0fa5
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/override/cp2/inc/context.h
@@ -0,0 +1,32 @@
+#ifndef override_cp_inc_context_h
+#define override_cp_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/inc/context.h
+ * \brief Control plane context override.
+ * \ingroup test
+ */
+#include "cp/types.h"
+#include "cp/sta/action/inc/context.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "cl/cl.h"
+#include "mac/common/config.h"
+#include "lib/rnd.h"
+
+struct cp_t
+{
+ cp_sta_action_t sta_action;
+ cp_sta_mgr_t sta_mgr;
+ lib_rnd_t rnd;
+ cl_t *cl;
+ mac_config_t *mac_config;
+};
+
+#endif /* override_cp_inc_context_h */
diff --git a/cesar/cp/sta/action/test/utest/override/cp2/sta/core/core.h b/cesar/cp/sta/action/test/utest/override/cp2/sta/core/core.h
new file mode 100644
index 0000000000..2fbf6732a1
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/override/cp2/sta/core/core.h
@@ -0,0 +1,17 @@
+#ifndef override_cp_sta_core_core_h
+#define override_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/sta/core/core.h
+ * \brief STA core override.
+ * \ingroup test
+ */
+
+
+#endif /* override_cp_sta_core_core_h */
diff --git a/cesar/cp/sta/action/test/utest/src/assoc.c b/cesar/cp/sta/action/test/utest/src/assoc.c
new file mode 100644
index 0000000000..80af57088e
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/assoc.c
@@ -0,0 +1,604 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/assoc.c
+ * \brief Test sta/action/assoc.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "inc/test_sta_action.h"
+
+void
+assoc_create_cco (test_t t, test_sta_action_t *ctx, cp_snid_t snid,
+ cp_nid_t nid, cp_tei_t cco_tei, mac_t cco_mac,
+ cp_net_t **cco_net, cp_sta_t **cco,
+ scenario_entry_t *assoc_entry)
+{
+ /* Clean current state. */
+ if (*cco)
+ slab_release (*cco);
+ cp_sta_mgr_uninit (&ctx->cp);
+ cp_sta_mgr_init (&ctx->cp);
+ /* Create a CCo to associate with. */
+ *cco_net = cp_sta_mgr_add_avln (&ctx->cp, snid, nid);
+ dbg_assert (*cco_net);
+ *cco = cp_net_sta_add (&ctx->cp, *cco_net, cco_tei, cco_mac);
+ cp_net_set_cco (&ctx->cp, *cco_net, cco_tei);
+ /* Update scenario. */
+ dbg_assert (assoc_entry->event_id == SCENARIO_ACTION_ID &&
+ assoc_entry->action_cb == scenario_action_assoc_start_cb);
+ assoc_entry->params.action_assoc_start.cco_net = *cco_net;
+ assoc_entry->params.action_assoc_start.cco = *cco;
+}
+
+void
+assoc_basic_test_cases (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ test_case_begin (t, "assoc");
+ /* Create a CCo to associate with. */
+ const cp_snid_t snid = 2;
+ const cp_nid_t nid = 0xf11111111111ull;
+ const cp_tei_t cco_tei = 1, sta_tei = 2;
+ const mac_t cco_mac = 0x111111111111ull;
+ cp_net_t *cco_net;
+ cp_sta_t *cco = NULL;
+ cp_mme_peer_t cco_peer = CP_MME_PEER (cco_mac, cco_tei);
+ /* Association test. */
+ scenario_entry_t associate_entries[] = {
+ SCENARIO_ACTION (assoc_start, .cco_net = cco_net, .cco = cco),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_assoc),
+ SCENARIO_ACTION (assoc__unassociated__to_assoc),
+ SCENARIO_EVENT (cp_msg_cc_assoc_req_send,
+ .peer = cco_peer,
+ .request_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ .nid = nid, .cco_cap = CP_CCO_LEVEL,
+ .proxy_cap = CP_PCO_CAP),
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__cc_assoc_cnf,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = true,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_msg_cm_get_key_req_send,
+ .peer = cco_peer, .peks = CP_MME_PEKS_NMK,
+ .pid = 0, .pmn = 1, .relayed = false,
+ .key_type = CP_MSG_KEY_NEK, .nid = nid),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ CC_ASSOC_CNF, ok)),
+ SCENARIO_END
+ };
+ test_begin (t, "ok")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_run (t, associate_entries, &globals);
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (&ctx.cp);
+ test_fail_unless (cp_net_get_nid (&ctx.cp, our_net) == nid);
+ test_fail_unless (cp_net_get_snid (&ctx.cp, our_net) == snid);
+ test_fail_unless (cp_sta_own_data_get_tei (&ctx.cp) == sta_tei);
+ cp_sta_t *our_cco = cp_net_get_cco (&ctx.cp, our_net);
+ test_fail_unless (our_cco == cco);
+ slab_release (our_cco);
+ } test_end;
+ test_begin (t, "errors")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (assoc_start, .cco_net = cco_net, .cco = cco),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_assoc),
+ SCENARIO_ACTION (assoc__unassociated__to_assoc),
+ SCENARIO_EVENT (cp_msg_cc_assoc_req_send,
+ .peer = cco_peer,
+ .request_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ .nid = nid, .cco_cap = CP_CCO_LEVEL,
+ .proxy_cap = CP_PCO_CAP),
+ /* Bad TEI. */
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__cc_assoc_cnf,
+ .peer = CP_MME_PEER (cco_mac, 42)),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ CC_ASSOC_CNF,
+ unrelated)),
+ /* Bad MAC. */
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__cc_assoc_cnf,
+ .peer = CP_MME_PEER (0x424242424242ull,
+ cco_tei)),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ CC_ASSOC_CNF,
+ unrelated)),
+ /* Bad MME. */
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__cc_assoc_cnf,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = false,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ CC_ASSOC_CNF,
+ unrelated)),
+ /* Bad NID. */
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__cc_assoc_cnf,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = true,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = nid + 1, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ CC_ASSOC_CNF,
+ unrelated)),
+ /* Failure. */
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__cc_assoc_cnf,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = true, .result
+ = CP_MSG_CC_ASSOC_CNF_RESULT_FAILURE_OTHER_REASON,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ CC_ASSOC_CNF,
+ nok)),
+ /* LEFT event. */
+ SCENARIO_ACTION (assoc__unassociated__enter),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_left),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "timeout")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (assoc_start, .cco_net = cco_net, .cco = cco),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_assoc),
+ SCENARIO_ACTION (assoc__unassociated__to_assoc),
+ SCENARIO_EVENT (cp_msg_cc_assoc_req_send,
+ .peer = cco_peer,
+ .request_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ .nid = nid, .cco_cap = CP_CCO_LEVEL,
+ .proxy_cap = CP_PCO_CAP),
+ /* First timeout. */
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__timeout),
+ SCENARIO_EVENT (cp_msg_cc_assoc_req_send,
+ .peer = cco_peer,
+ .request_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ .nid = nid, .cco_cap = CP_CCO_LEVEL,
+ .proxy_cap = CP_PCO_CAP),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ assoc_timeout, retry)),
+ /* Second timeout. */
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__timeout),
+ SCENARIO_EVENT (cp_msg_cc_assoc_req_send,
+ .peer = cco_peer,
+ .request_type = CP_MSG_CC_ASSOC_REQ_TYPE_NEW,
+ .nid = nid, .cco_cap = CP_CCO_LEVEL,
+ .proxy_cap = CP_PCO_CAP),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ assoc_timeout, retry)),
+ /* Third timeout, no retry. */
+ SCENARIO_ACTION (assoc__wait_assoc_cnf__timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (WAIT_ASSOC_CONF,
+ assoc_timeout,
+ no_retry)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_case_begin (t, "auth");
+ /* Authentication test. */
+ cp_key_t nek = { { 0x11112222, 0x33334444, 0x55556666, 0x77778888 } };
+ scenario_entry_t auth_entries[] = {
+ /* Associate. */
+ SCENARIO_SUB (associate_entries),
+ /* Authentication response. */
+ SCENARIO_ACTION (assoc__associated__cm_get_key_cnf_pid_0,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive, .ok = true,
+ .peks = CP_MME_PEKS_NMK, .pid = 0, .pmn = 0xff,
+ .new_prn = false, .new_my_nonce = false,
+ .new_your_nonce = true,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_NEK, .nid = nid, .eks = 1,
+ .key = &nek),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_joined),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF_PID0,
+ ok)),
+ SCENARIO_END
+ };
+ test_begin (t, "ok")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ SCENARIO_SUB (auth_entries),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "errors")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate. */
+ SCENARIO_SUB (associate_entries),
+ /* Bad TEI. */
+ SCENARIO_ACTION (assoc__associated__cm_get_key_cnf_pid_0,
+ .peer = CP_MME_PEER (cco_mac, 42)),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF_PID0,
+ unrelated)),
+ /* Bad MAC. */
+ SCENARIO_ACTION (assoc__associated__cm_get_key_cnf_pid_0,
+ .peer = CP_MME_PEER (0x424242424242ull,
+ cco_tei)),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF_PID0,
+ unrelated)),
+ /* Bad MME. */
+ SCENARIO_ACTION (assoc__associated__cm_get_key_cnf_pid_0,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive, .ok = false,
+ .peks = CP_MME_PEKS_NMK, .pid = 0, .pmn = 0xff,
+ .new_prn = false, .new_my_nonce = false,
+ .new_your_nonce = true,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_NEK, .nid = nid, .eks = 1,
+ .key = &nek),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF_PID0,
+ unrelated)),
+ /* Bad protocol run. */
+ SCENARIO_ACTION (assoc__associated__cm_get_key_cnf_pid_0,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive, .ok = true,
+ .peks = CP_MME_PEKS_NMK, .pid = 0, .pmn = 3,
+ .new_prn = false, .new_my_nonce = false,
+ .new_your_nonce = true,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_NEK, .nid = nid, .eks = 1,
+ .key = &nek),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF_PID0,
+ unrelated)),
+ /* Bad NID. */
+ SCENARIO_ACTION (assoc__associated__cm_get_key_cnf_pid_0,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive, .ok = true,
+ .peks = CP_MME_PEKS_NMK, .pid = 0, .pmn = 0xff,
+ .new_prn = false, .new_my_nonce = false,
+ .new_your_nonce = true,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_NEK, .nid = nid + 1,
+ .eks = 1, .key = &nek),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF_PID0,
+ unrelated)),
+ /* Bad key type. */
+ SCENARIO_ACTION (assoc__associated__cm_get_key_cnf_pid_0,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive, .ok = true,
+ .peks = CP_MME_PEKS_NMK, .pid = 0, .pmn = 0xff,
+ .new_prn = false, .new_my_nonce = false,
+ .new_your_nonce = true,
+ .result = CP_MSG_CM_GET_KEY_CNF_RESULT_KEY_GRANTED,
+ .key_type = CP_MSG_KEY_NMK, .nid = nid, .eks = 1,
+ .key = &nek),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF_PID0,
+ unrelated)),
+ /* Failure. */
+ SCENARIO_ACTION (assoc__associated__cm_get_key_cnf_pid_0,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cm_get_key_cnf_receive, .ok = true,
+ .peks = CP_MME_PEKS_NMK, .pid = 0, .pmn = 0xff,
+ .new_prn = false, .new_my_nonce = false,
+ .new_your_nonce = true,
+ .result =
+ CP_MSG_CM_GET_KEY_CNF_RESULT_REQUEST_REFUSED,
+ .key_type = CP_MSG_KEY_NEK, .nid = nid, .eks = 1,
+ .key = NULL),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (ASSOCIATED,
+ CM_GET_KEY_CNF_PID0,
+ nok)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "timeout")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate. */
+ SCENARIO_SUB (associate_entries),
+ /* Timeout. */
+ SCENARIO_ACTION (assoc__associated__timeout),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_case_begin (t, "authed");
+ /* Authenticated test. */
+ test_begin (t, "renew")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate and authenticate. */
+ SCENARIO_SUB (auth_entries),
+ /* Renew. */
+ SCENARIO_ACTION (assoc__authenticated__renew),
+ SCENARIO_EVENT (cp_msg_cc_assoc_req_send, .peer = cco_peer,
+ .request_type = CP_MSG_CC_ASSOC_REQ_TYPE_RENEW,
+ .nid = nid, .cco_cap = CP_CCO_LEVEL,
+ .proxy_cap = CP_PCO_CAP),
+ SCENARIO_ACTION (assoc__authenticated__cc_assoc_cnf,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = true,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "renew error")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate and authenticate. */
+ SCENARIO_SUB (auth_entries),
+ /* Bad TEI. */
+ SCENARIO_ACTION (assoc__authenticated__cc_assoc_cnf,
+ .peer = CP_MME_PEER (cco_mac, 42)),
+ /* Bad MAC. */
+ SCENARIO_ACTION (assoc__authenticated__cc_assoc_cnf,
+ .peer = CP_MME_PEER (0x424242424242ull,
+ cco_tei)),
+ /* Bad MME. */
+ SCENARIO_ACTION (assoc__authenticated__cc_assoc_cnf,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_assoc_cnf_receive, .ok = false,
+ .result = CP_MSG_CC_ASSOC_CNF_RESULT_SUCCESS,
+ .nid = nid, .snid = snid, .sta_tei = sta_tei,
+ .lease_time_min = 15),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ cp_key_t nek2 = { { 0x9999aaaa, 0xbbbbcccc, 0xddddeeee, 0xffff0000 } };
+ test_begin (t, "NEK renew")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate and authenticate. */
+ SCENARIO_SUB (auth_entries),
+ /* NEK renew. */
+ SCENARIO_ACTION (assoc__authenticated__cm_set_key_req_pid_1,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cm_set_key_req_receive, .ok = true,
+ .peks = CP_MME_PEKS_NONE, .pid = 1, .pmn = 1,
+ .new_prn = true, .new_your_nonce = true,
+ .key_type = CP_MSG_KEY_NEK, .cco_cap = 3,
+ .nid = nid, .new_eks = 2, .new_key = nek2),
+ SCENARIO_EVENT (cp_msg_cm_set_key_cnf_send, .peer = cco_peer,
+ .peks = CP_MME_PEKS_NONE, .pid = 1, .pmn = 0xff,
+ .result = CP_MSG_CM_SET_KEY_CNF_RESULT_SUCCESS,
+ .cco_cap = CP_CCO_LEVEL),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_case_begin (t, "leave");
+ /* Leave test. */
+ test_begin (t, "sta ok")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate and authenticate. */
+ SCENARIO_SUB (auth_entries),
+ /* Leave the AVLN. */
+ SCENARIO_ACTION (assoc_leave),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_leave),
+ SCENARIO_ACTION (assoc__authenticated__to_leave),
+ SCENARIO_EVENT (cp_msg_cc_leave_req_send, .peer = cco_peer,
+ .reason =
+ CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST),
+ SCENARIO_ACTION (assoc__leaving__cc_leave_cnf, .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_leave_cnf_receive, .ok = true),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (LEAVING, CC_LEAVE_CNF,
+ ok)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "sta errors")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate and authenticate. */
+ SCENARIO_SUB (auth_entries),
+ /* Leave the AVLN. */
+ SCENARIO_ACTION (assoc_leave),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_leave),
+ SCENARIO_ACTION (assoc__authenticated__to_leave),
+ SCENARIO_EVENT (cp_msg_cc_leave_req_send, .peer = cco_peer,
+ .reason =
+ CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST),
+ /* Bad TEI. */
+ SCENARIO_ACTION (assoc__leaving__cc_leave_cnf,
+ .peer = CP_MME_PEER (cco_mac, 42)),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (LEAVING, CC_LEAVE_CNF,
+ unrelated)),
+ /* Bad MAC. */
+ SCENARIO_ACTION (assoc__leaving__cc_leave_cnf,
+ .peer = CP_MME_PEER (0x424242424242ull,
+ cco_tei)),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (LEAVING, CC_LEAVE_CNF,
+ unrelated)),
+ /* Bad MME, ignored. */
+ SCENARIO_ACTION (assoc__leaving__cc_leave_cnf, .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_leave_cnf_receive, .ok = false),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (LEAVING, CC_LEAVE_CNF,
+ ok)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "sta timeout")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate and authenticate. */
+ SCENARIO_SUB (auth_entries),
+ /* Leave the AVLN. */
+ SCENARIO_ACTION (assoc_leave),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_leave),
+ SCENARIO_ACTION (assoc__authenticated__to_leave),
+ SCENARIO_EVENT (cp_msg_cc_leave_req_send, .peer = cco_peer,
+ .reason =
+ CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST),
+ /* Timeout. */
+ SCENARIO_ACTION (assoc__leaving__timeout),
+ SCENARIO_EVENT (cp_msg_cc_leave_req_send, .peer = cco_peer,
+ .reason =
+ CP_MSG_CC_LEAVE_REQ_REASON_USER_REQUEST),
+ /* Final timeout. */
+ SCENARIO_ACTION (assoc__leave_wait__timeout),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "cco ok")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate and authenticate. */
+ SCENARIO_SUB (auth_entries),
+ /* Asked to leave the AVLN. */
+ SCENARIO_ACTION (assoc__authenticated__cc_leave_ind,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_leave_ind_receive, .ok = true,
+ .reason = CP_MSG_CC_LEAVE_IND_REASON_USER_REQUEST,
+ .nid = nid),
+ SCENARIO_EVENT (cp_msg_cc_leave_rsp_send, .peer = cco_peer),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (AUTHENTICATED,
+ CC_LEAVE_IND, ok)),
+ /* Final timeout. */
+ SCENARIO_ACTION (assoc__leave_wait__timeout),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "cco errors")
+ {
+ assoc_create_cco (t, &ctx, snid, nid, cco_tei, cco_mac, &cco_net,
+ &cco, associate_entries);
+ scenario_entry_t entries[] = {
+ /* Associate and authenticate. */
+ SCENARIO_SUB (auth_entries),
+ /* Bad TEI. */
+ SCENARIO_ACTION (assoc__authenticated__cc_leave_ind,
+ .peer = CP_MME_PEER (cco_mac, 42)),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (AUTHENTICATED,
+ CC_LEAVE_IND,
+ nok)),
+ /* Bad MAC. */
+ SCENARIO_ACTION (assoc__authenticated__cc_leave_ind,
+ .peer = CP_MME_PEER (0x424242424242ull,
+ cco_tei)),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (AUTHENTICATED,
+ CC_LEAVE_IND,
+ nok)),
+ /* Bad MME. */
+ SCENARIO_ACTION (assoc__authenticated__cc_leave_ind,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_leave_ind_receive, .ok = false,
+ .reason = CP_MSG_CC_LEAVE_IND_REASON_USER_REQUEST,
+ .nid = nid),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (AUTHENTICATED,
+ CC_LEAVE_IND,
+ nok)),
+ /* Bad NID. */
+ SCENARIO_ACTION (assoc__authenticated__cc_leave_ind,
+ .peer = cco_peer),
+ SCENARIO_EVENT (cp_msg_cc_leave_ind_receive, .ok = true,
+ .reason = CP_MSG_CC_LEAVE_IND_REASON_USER_REQUEST,
+ .nid = nid + 1),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (AUTHENTICATED,
+ CC_LEAVE_IND,
+ nok)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* Cleanup. */
+ slab_release (cco);
+ test_sta_action_uninit (&ctx);
+}
+
+void
+assoc_test_suite (test_t t)
+{
+ test_suite_begin (t, "assoc");
+ assoc_basic_test_cases (t);
+ test_case_begin (t, "memory");
+ test_begin (t, "memory")
+ {
+ test_fail_unless (blk_check_memory ());
+ } test_end;
+}
diff --git a/cesar/cp/sta/action/test/utest/src/dataplane_stub.c b/cesar/cp/sta/action/test/utest/src/dataplane_stub.c
new file mode 100644
index 0000000000..2b5b3be62a
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/dataplane_stub.c
@@ -0,0 +1,42 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/dataplane_stub.c
+ * \brief Data plane layers stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "cl/cl_mactotei.h"
+
+cl_mactotei_blk_t *
+cl_mactotei_new (void)
+{
+ return INVALID_PTR;
+}
+
+void
+cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr, uint tei,
+ uint tag)
+{
+}
+
+void
+cl_mactotei_copy_tei_and_tag (cl_t *ctx, cl_mactotei_blk_t *table, u8 tei,
+ u8 tag)
+{
+}
+
+void
+cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
+{
+ scenario_event (cl_mactotei_use_table);
+}
+
diff --git a/cesar/cp/sta/action/test/utest/src/drv.c b/cesar/cp/sta/action/test/utest/src/drv.c
new file mode 100644
index 0000000000..d87b39d221
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/drv.c
@@ -0,0 +1,344 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/drv.c
+ * \brief Test sta/action/drv.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "inc/test_sta_action.h"
+
+#include <string.h>
+
+static void
+drv_set_params (cp_t *ctx,
+ mac_t mac,
+ bool cco_pref,
+ bool was_cco,
+ const char *npw,
+ const char *dpw,
+ cp_security_level_t sl,
+ cp_nid_t nid,
+ const char *m_sta_hfid,
+ const char *u_sta_hfid,
+ const char *avln_hfid,
+ const u32 *tonemask)
+{
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ cp_sta_own_data_set_mac_address (ctx, mac);
+ own->cco_prefered = cco_pref;
+ cp_sta_own_data_set_was_cco (ctx, was_cco);
+ cp_sta_own_data_set_npw (ctx, npw);
+ cp_sta_own_data_set_dpw (ctx, dpw);
+ cp_sta_own_data_set_security_level (ctx, sl);
+ cp_sta_mgr_update_our_avln_nid (ctx, nid);
+ cp_sta_own_data_set_hfid_manufacturer (ctx, m_sta_hfid);
+ cp_sta_own_data_set_hfid_user (ctx, u_sta_hfid);
+ cp_sta_own_data_set_hfid_avln (ctx, avln_hfid);
+ /* TODO tonemask. */
+}
+
+static void
+drv_check_params (cp_t *ctx,
+ test_t t,
+ mac_t mac,
+ bool cco_pref,
+ bool was_cco,
+ const char *npw,
+ const char *dpw,
+ cp_security_level_t sl,
+ cp_nid_t nid,
+ const char *m_sta_hfid,
+ const char *u_sta_hfid,
+ const char *avln_hfid,
+ const u32 *tonemask)
+{
+ test_within (t);
+ cp_sta_own_data_t *own = cp_sta_mgr_get_sta_own_data (ctx);
+ test_fail_unless (mac == cp_sta_own_data_get_mac_address (ctx));
+ test_fail_unless (cco_pref == own->cco_prefered);
+ test_fail_unless (was_cco == cp_sta_own_data_get_was_cco (ctx));
+ test_fail_unless (strcmp (npw, cp_sta_own_data_get_npw (ctx)) == 0);
+ test_fail_unless (strcmp (dpw, cp_sta_own_data_get_dpw (ctx)) == 0);
+ test_fail_unless (sl == cp_sta_own_data_get_security_level (ctx));
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (ctx);
+ test_fail_unless (nid == our_net->nid);
+ test_fail_unless (strcmp (m_sta_hfid, own->hfid_manufacturer) == 0);
+ test_fail_unless (strcmp (u_sta_hfid, own->hfid_user) == 0);
+ test_fail_unless (strcmp (avln_hfid, own->hfid_avln) == 0);
+ /* TODO tonemask. */
+}
+
+static void
+drv_basic_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ cp_mme_peer_t peer = CP_MME_PEER (0xaabbccddeeffull);
+ test_case_begin (t, "basic");
+ test_begin (t, "set")
+ {
+ drv_set_params (&ctx.cp, MAC_BROADCAST, false, false, "", "",
+ CP_SECURITY_LEVEL_SC, 1, "", "", "", NULL);
+ u32 tonemask[PHY_TONEMASK_WORDS];
+ uint i;
+ for (i = 0; i < PHY_TONEMASK_WORDS; i++)
+ tonemask[i] = i;
+ scenario_entry_t entries[] = {
+ /* Set MAC address. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_mac_addr_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_mac_addr_req_receive,
+ .ok = true,
+ .mac = 0x112233445566ull),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_MAC_ADDR_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set CCo preferred flag. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_cco_pref_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_cco_pref_req_receive,
+ .ok = true,
+ .cco_pref = true),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_CCO_PREF_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set was CCo flag. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_was_cco_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_was_cco_req_receive,
+ .ok = true,
+ .was_cco = true),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_WAS_CCO_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set NPW. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_npw_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_npw_req_receive,
+ .ok = true,
+ .npw = "p4ssw0rd"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_NPW_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set DPW. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_dpw_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_dpw_req_receive,
+ .ok = true,
+ .dpw = "s3cr3t"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_DPW_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set SL. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_sl_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_sl_req_receive,
+ .ok = true,
+ .sl = CP_SECURITY_LEVEL_HS),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_SL_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set NID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_nid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_nid_req_receive,
+ .ok = true,
+ .nid = 0x002233445566ull),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_NID_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set manufacturer STA HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_m_sta_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_m_sta_hfid_req_receive,
+ .ok = true,
+ .m_sta_hfid = "the M STA HFID"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_M_STA_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set user STA HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_u_sta_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_u_sta_hfid_req_receive,
+ .ok = true,
+ .u_sta_hfid = "the U STA HFID"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_U_STA_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set AVLN HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_avln_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_avln_hfid_req_receive,
+ .ok = true,
+ .avln_hfid = "the AVLN HFID"),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_AVLN_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ /* Set tonemask. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_tonemask_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_tonemask_req_receive,
+ .ok = true,
+ .tonemask = tonemask),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_TONEMASK_CNF,
+ .result = CP_MSG_DRV_RESULT_SUCCESS),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ scenario_run (t, entries, &globals);
+ drv_check_params (&ctx.cp, t, 0x112233445566ull, true, true,
+ "p4ssw0rd", "s3cr3t", CP_SECURITY_LEVEL_HS,
+ 0x002233445566ull, "the M STA HFID",
+ "the U STA HFID", "the AVLN HFID", NULL);
+ } test_end;
+ test_begin (t, "set error")
+ {
+ drv_set_params (&ctx.cp, MAC_BROADCAST, false, false, "", "",
+ CP_SECURITY_LEVEL_SC, 1, "", "", "", NULL);
+ scenario_entry_t entries[] = {
+ /* Set MAC address. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_mac_addr_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_mac_addr_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_MAC_ADDR_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set CCo preferred flag. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_cco_pref_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_cco_pref_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_CCO_PREF_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set was CCo flag. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_was_cco_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_was_cco_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_WAS_CCO_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set NPW. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_npw_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_npw_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_NPW_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set DPW. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_dpw_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_dpw_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_DPW_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set SL. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_sl_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_sl_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_SL_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set NID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_nid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_nid_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_NID_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set manufacturer STA HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_m_sta_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_m_sta_hfid_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_M_STA_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set user STA HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_u_sta_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_u_sta_hfid_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_U_STA_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set AVLN HFID. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_avln_hfid_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_avln_hfid_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_AVLN_HFID_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ /* Set tonemask. */
+ SCENARIO_ACTION (drv__stopped__drv_sta_set_tonemask_req,
+ .peer = peer),
+ SCENARIO_EVENT (cp_msg_drv_sta_set_tonemask_req_receive,
+ .ok = false),
+ SCENARIO_EVENT (cp_msg_drv_any_cnf_send,
+ .peer = peer,
+ .mmtype = DRV_STA_SET_TONEMASK_CNF,
+ .result = CP_MSG_DRV_RESULT_FAILURE),
+ SCENARIO_END
+ };
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ scenario_run (t, entries, &globals);
+ drv_check_params (&ctx.cp, t, MAC_BROADCAST, false, false, "", "",
+ CP_SECURITY_LEVEL_SC, 1, "", "", "", NULL);
+ } test_end;
+ test_sta_action_uninit (&ctx);
+}
+
+void
+drv_test_suite (test_t t)
+{
+ test_suite_begin (t, "drv");
+ drv_basic_test_case (t);
+ test_case_begin (t, "memory");
+ test_begin (t, "memory")
+ {
+ test_fail_unless (blk_check_memory ());
+ } test_end;
+}
+
diff --git a/cesar/cp/sta/action/test/utest/src/fsm_stub.c b/cesar/cp/sta/action/test/utest/src/fsm_stub.c
new file mode 100644
index 0000000000..c73350d7c5
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/fsm_stub.c
@@ -0,0 +1,54 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief FSM stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+#include "lib/scenario/scenario.h"
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ dbg_assert (ctx);
+ if (type == CP_FSM_EVENT_TYPE_snid_conflict
+ || type == CP_FSM_EVENT_TYPE_net_list_empty)
+ return INVALID_PTR;
+ scenario_event (cp_fsm_event_bare_new, param);
+ test_fail_unless (type == param->type);
+ return INVALID_PTR;
+}
+
+cp_fsm_event_t *
+cp_fsm_event_mme_new (cp_t *ctx, cp_fsm_event_type_t type, cp_mme_rx_t *mme)
+{
+ dbg_assert (ctx);
+ if (type == CP_FSM_EVENT_TYPE_snid_conflict
+ || type == CP_FSM_EVENT_TYPE_net_list_empty)
+ return INVALID_PTR;
+ scenario_event (cp_fsm_event_mme_new, param);
+ test_fail_unless (type == param->type);
+ return INVALID_PTR;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
+
+void
+cp_fsm_branch_ (cp_t *ctx, cp_fsm_branch_t branch)
+{
+ dbg_assert (ctx);
+ scenario_event (cp_fsm_branch, param);
+ test_fail_unless (branch == param->branch);
+}
+
diff --git a/cesar/cp/sta/action/test/utest/src/info.c b/cesar/cp/sta/action/test/utest/src/info.c
new file mode 100644
index 0000000000..658920baf0
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/info.c
@@ -0,0 +1,565 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/info.c
+ * \brief Test sta/action/info.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "inc/test_sta_action.h"
+
+#include "lib/slab.h"
+
+struct info_set_tei_map_check_t
+{
+ cp_tei_t tei;
+ mac_t mac;
+ bool authenticated;
+};
+typedef struct info_set_tei_map_check_t info_set_tei_map_check_t;
+#define INFO_SET_TEI_MAP_CHECK_END { 0xff, 0, false }
+
+static void
+info_set_tei_map_check (test_t t, cp_t *cp, info_set_tei_map_check_t *check)
+{
+ test_within (t);
+ cp_tei_t tei;
+ info_set_tei_map_check_t *p;
+ cp_net_t *our_net;
+ our_net = cp_sta_mgr_get_our_avln (cp);
+ for (tei = 1, p = check; tei < 0xff; tei++)
+ {
+ cp_sta_t *sta = cp_net_get_sta (cp, our_net, tei);
+ if (tei == p->tei)
+ {
+ test_fail_unless (sta, "station %d: should exist", tei);
+ cp_tei_t sta_tei = cp_sta_get_tei (sta);
+ mac_t sta_mac = cp_sta_get_mac_address (sta);
+ cp_sta_state_t sta_state = cp_sta_get_state (sta);
+ slab_release (sta);
+ test_fail_unless (sta_tei == p->tei);
+ test_fail_unless (sta_mac == p->mac,
+ "station %d: bad mac", tei);
+ test_fail_unless (sta_state == (p->authenticated
+ ? CP_STA_STATE_AUTHENTICATED
+ : CP_STA_STATE_ASSOCIATED),
+ "station %d: bad authenticated status", tei);
+ p++;
+ }
+ else
+ {
+ bool sta_present = !!sta;
+ if (sta)
+ slab_release (sta);
+ test_fail_unless (!sta_present, "station %d: should not exist",
+ tei);
+ }
+ }
+}
+
+static void
+info_set_tei_map_test_cases (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ cp_mme_peer_t peer = CP_MME_PEER (0xaabbccddeeffull);
+ test_case_begin (t, "set_tei_map");
+ test_begin (t, "add first")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = true,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_ADD,
+ .sta_nb = 1),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 1, .mac = 0x111111111111ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_end,
+ .ok = true),
+ SCENARIO_EVENT (cl_mactotei_use_table),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 1, 0x111111111111ull, true },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_begin (t, "add second and third")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = true,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_ADD,
+ .sta_nb = 2),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 3, .mac = 0x333333333333ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 2, .mac = 0x222222222222ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_end,
+ .ok = true),
+ SCENARIO_EVENT (cl_mactotei_use_table),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 1, 0x111111111111ull, true },
+ { 2, 0x222222222222ull, false },
+ { 3, 0x333333333333ull, true },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_begin (t, "delete")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = true,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_DELETE,
+ .sta_nb = 1),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 1, .mac = 0x111111111111ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_DISASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_end,
+ .ok = true),
+ SCENARIO_EVENT (cl_mactotei_use_table),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 2, 0x222222222222ull, false },
+ { 3, 0x333333333333ull, true },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_begin (t, "update")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = true,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE,
+ .sta_nb = 2),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 4, .mac = 0x444444444444ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 2, .mac = 0xbbbbbbbbbbbbull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_end,
+ .ok = true),
+ SCENARIO_EVENT (cl_mactotei_use_table),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 2, 0xbbbbbbbbbbbbull, true },
+ { 4, 0x444444444444ull, false },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_begin (t, "update add specials")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = true,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE,
+ .sta_nb = 8),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 4, .mac = 0x444444444444ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 2, .mac = 0xbbbbbbbbbbbbull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 0x01, .mac = 0x010101010101ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 0x1f, .mac = 0x1f1f1f1f1f1full, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 0x20, .mac = 0x202020202020ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 0xdf, .mac = 0xdfdfdfdfdfdfull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 0xe0, .mac = 0xe0e0e0e0e0e0ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 0xfe, .mac = 0xfefefefefefeull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_end,
+ .ok = true),
+ SCENARIO_EVENT (cl_mactotei_use_table),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 0x01, 0x010101010101ull, true },
+ { 2, 0xbbbbbbbbbbbbull, false },
+ { 4, 0x444444444444ull, true },
+ { 0x1f, 0x1f1f1f1f1f1full, false },
+ { 0x20, 0x202020202020ull, true },
+ { 0xdf, 0xdfdfdfdfdfdfull, false },
+ { 0xe0, 0xe0e0e0e0e0e0ull, true },
+ { 0xfe, 0xfefefefefefeull, false },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_begin (t, "update remove specials")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = true,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE,
+ .sta_nb = 2),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 4, .mac = 0x444444444444ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 2, .mac = 0xbbbbbbbbbbbbull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_end,
+ .ok = true),
+ SCENARIO_EVENT (cl_mactotei_use_table),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 2, 0xbbbbbbbbbbbbull, true },
+ { 4, 0x444444444444ull, false },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_case_begin (t, "set_tei_map errors");
+ test_begin (t, "initial error")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = false,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE,
+ .sta_nb = 2),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 2, 0xbbbbbbbbbbbbull, true },
+ { 4, 0x444444444444ull, false },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_begin (t, "add error")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = true,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE,
+ .sta_nb = 2),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 5, .mac = 0x555555555555ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_ASSOCIATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = false,
+ .tei = 6, .mac = 0x666666666666ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cl_mactotei_use_table),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 2, 0xbbbbbbbbbbbbull, true },
+ { 4, 0x444444444444ull, false },
+ { 5, 0x555555555555ull, false },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_begin (t, "update error")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cc_set_tei_map_ind, .peer = peer),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_begin,
+ .ok = true,
+ .mode = CP_MSG_CC_SET_TEI_MAP_IND_MODE_UPDATE,
+ .sta_nb = 2),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = true,
+ .tei = 5, .mac = 0x555555555555ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cp_msg_cc_set_tei_map_ind_receive_sta,
+ .ok = false,
+ .tei = 6, .mac = 0x666666666666ull, .status =
+ CP_MSG_CC_SET_TEI_MAP_IND_STATUS_AUTHENTICATED),
+ SCENARIO_EVENT (cl_mactotei_use_table),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_set_tei_map_check_t stmc[] = {
+ { 2, 0xbbbbbbbbbbbbull, true },
+ { 4, 0x444444444444ull, false },
+ { 5, 0x555555555555ull, true },
+ INFO_SET_TEI_MAP_CHECK_END
+ };
+ info_set_tei_map_check (t, &ctx.cp, stmc);
+ } test_end;
+ test_sta_action_uninit (&ctx);
+}
+
+struct info_unassociated_sta_check_t
+{
+ mac_t mac;
+ cp_nid_t nid;
+ u8 cco_cap;
+ bool present;
+};
+typedef struct info_unassociated_sta_check_t info_unassociated_sta_check_t;
+#define INFO_UNASSOCIATED_STA_CHECK_END { MAC_ZERO, 0, 0, false }
+
+static void
+info_unassociated_sta_check (test_t t, cp_t *cp,
+ info_unassociated_sta_check_t *check)
+{
+ test_within (t);
+ info_unassociated_sta_check_t *p;
+ for (p = check; p->mac; p++)
+ {
+ cp_net_t *net = cp_sta_mgr_get_avln (cp, 0, p->nid);
+ test_fail_unless (net || !p->present, "missing net 0x%llx", p->nid);
+ if (net)
+ {
+ cp_sta_t *sta = cp_net_get_sta_unassoc (cp, net, p->mac);
+ bool present = !!sta;
+ u8 cco_cap = sta ? sta->cco_cap : 0xff;
+ if (sta)
+ slab_release (sta);
+ test_fail_unless (present == p->present);
+ test_fail_unless (cco_cap == p->cco_cap || !p->present);
+ }
+ }
+}
+
+static void
+info_unassociated_sta_test_cases (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ test_case_begin (t, "unassociated_sta");
+ test_begin (t, "add one")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x111111111111ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf11111111111ull, .cco_cap = 0),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_unassociated_sta_check_t usc[] = {
+ { 0x111111111111ull, 0xf11111111111ull, 0, true },
+ INFO_UNASSOCIATED_STA_CHECK_END
+ };
+ info_unassociated_sta_check (t, &ctx.cp, usc);
+ } test_end;
+ test_begin (t, "add more")
+ {
+ scenario_entry_t entries[] = {
+ /* More STA. */
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x222222222222ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf22222222222ull, .cco_cap = 1),
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x333333333333ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf33333333333ull, .cco_cap = 2),
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x444444444444ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf44444444444ull, .cco_cap = 0),
+ /* More STA with the same NID. */
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0xaaaaaaaaaaaaull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf11111111111ull, .cco_cap = 1),
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0xbbbbbbbbbbbbull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf22222222222ull, .cco_cap = 2),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_unassociated_sta_check_t usc[] = {
+ { 0x111111111111ull, 0xf11111111111ull, 0, true },
+ { 0x222222222222ull, 0xf22222222222ull, 1, true },
+ { 0x333333333333ull, 0xf33333333333ull, 2, true },
+ { 0x444444444444ull, 0xf44444444444ull, 0, true },
+ { 0xaaaaaaaaaaaaull, 0xf11111111111ull, 1, true },
+ { 0xbbbbbbbbbbbbull, 0xf22222222222ull, 2, true },
+ INFO_UNASSOCIATED_STA_CHECK_END
+ };
+ info_unassociated_sta_check (t, &ctx.cp, usc);
+ } test_end;
+ test_begin (t, "updates")
+ {
+ scenario_entry_t entries[] = {
+ /* Change of cco_cap. */
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x111111111111ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf11111111111ull, .cco_cap = 2),
+ /* Update, no change. */
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x222222222222ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf22222222222ull, .cco_cap = 1),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_unassociated_sta_check_t usc[] = {
+ { 0x111111111111ull, 0xf11111111111ull, 2, true },
+ { 0x222222222222ull, 0xf22222222222ull, 1, true },
+ { 0x333333333333ull, 0xf33333333333ull, 2, true },
+ { 0x444444444444ull, 0xf44444444444ull, 0, true },
+ { 0xaaaaaaaaaaaaull, 0xf11111111111ull, 1, true },
+ { 0xbbbbbbbbbbbbull, 0xf22222222222ull, 2, true },
+ INFO_UNASSOCIATED_STA_CHECK_END
+ };
+ info_unassociated_sta_check (t, &ctx.cp, usc);
+ } test_end;
+ /* TODO: NID change? */
+ test_case_begin (t, "unassociated_sta errors");
+ test_begin (t, "mme error")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x888888888888ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = false,
+ .nid = 0xf88888888888ull, .cco_cap = 2),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_unassociated_sta_check_t usc[] = {
+ { 0x111111111111ull, 0xf11111111111ull, 2, true },
+ { 0x222222222222ull, 0xf22222222222ull, 1, true },
+ { 0x333333333333ull, 0xf33333333333ull, 2, true },
+ { 0x444444444444ull, 0xf44444444444ull, 0, true },
+ { 0xaaaaaaaaaaaaull, 0xf11111111111ull, 1, true },
+ { 0xbbbbbbbbbbbbull, 0xf22222222222ull, 2, true },
+ { 0x888888888888ull, 0xf88888888888ull, 0, false },
+ INFO_UNASSOCIATED_STA_CHECK_END
+ };
+ info_unassociated_sta_check (t, &ctx.cp, usc);
+ } test_end;
+ test_begin (t, "no room error")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x555555555555ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf55555555555ull, .cco_cap = 0),
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x666666666666ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf66666666666ull, .cco_cap = 0),
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x777777777777ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf77777777777ull, .cco_cap = 0),
+ /* No more room. */
+ SCENARIO_ACTION (process_cm_unassociated_sta_ind,
+ .peer = CP_MME_PEER (0x888888888888ull)),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_receive,
+ .ok = true,
+ .nid = 0xf88888888888ull, .cco_cap = 0),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ info_unassociated_sta_check_t usc[] = {
+ { 0x111111111111ull, 0xf11111111111ull, 2, true },
+ { 0x222222222222ull, 0xf22222222222ull, 1, true },
+ { 0x333333333333ull, 0xf33333333333ull, 2, true },
+ { 0x444444444444ull, 0xf44444444444ull, 0, true },
+ { 0xaaaaaaaaaaaaull, 0xf11111111111ull, 1, true },
+ { 0xbbbbbbbbbbbbull, 0xf22222222222ull, 2, true },
+ { 0x555555555555ull, 0xf55555555555ull, 0, true },
+ { 0x666666666666ull, 0xf66666666666ull, 0, true },
+ { 0x777777777777ull, 0xf77777777777ull, 0, true },
+ { 0x888888888888ull, 0xf88888888888ull, 0, false },
+ INFO_UNASSOCIATED_STA_CHECK_END
+ };
+ info_unassociated_sta_check (t, &ctx.cp, usc);
+ } test_end;
+ test_sta_action_uninit (&ctx);
+}
+
+void
+info_test_suite (test_t t)
+{
+ test_suite_begin (t, "info");
+ info_set_tei_map_test_cases (t);
+ info_unassociated_sta_test_cases (t);
+ test_case_begin (t, "memory");
+ test_begin (t, "memory")
+ {
+ test_fail_unless (blk_check_memory ());
+ } test_end;
+}
diff --git a/cesar/cp/sta/action/test/utest/src/key.c b/cesar/cp/sta/action/test/utest/src/key.c
new file mode 100644
index 0000000000..340cf7b300
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/key.c
@@ -0,0 +1,73 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/key.c
+ * \brief Test sta/action/key.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "inc/test_sta_action.h"
+
+void
+key_basic_test_case (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ scenario_globals_t globals = {
+ .cp = &ctx.cp,
+ };
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445566ull, 1);
+ test_case_begin (t, "basic");
+ test_begin (t, "ok")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_set_key_req, .peer = peer, .pid = 1),
+ SCENARIO_EVENT (cp_fsm_event_mme_new, .type =
+ CP_FSM_EVENT_TYPE_CM_SET_KEY_REQ_PID1),
+ SCENARIO_ACTION (process_cm_set_key_cnf, .peer = peer, .pid = 1),
+ SCENARIO_EVENT (cp_fsm_event_mme_new, .type =
+ CP_FSM_EVENT_TYPE_CM_SET_KEY_CNF_PID1),
+ SCENARIO_ACTION (process_cm_get_key_req, .peer = peer, .pid = 0),
+ SCENARIO_EVENT (cp_fsm_event_mme_new, .type =
+ CP_FSM_EVENT_TYPE_CM_GET_KEY_REQ_PID0),
+ SCENARIO_ACTION (process_cm_get_key_cnf, .peer = peer, .pid = 0),
+ SCENARIO_EVENT (cp_fsm_event_mme_new, .type =
+ CP_FSM_EVENT_TYPE_CM_GET_KEY_CNF_PID0),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "ignored")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (process_cm_set_key_req, .peer = peer, .pid = 3),
+ SCENARIO_ACTION (process_cm_set_key_cnf, .peer = peer, .pid = 3),
+ SCENARIO_ACTION (process_cm_get_key_req, .peer = peer, .pid = 3),
+ SCENARIO_ACTION (process_cm_get_key_cnf, .peer = peer, .pid = 3),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* Cleanup. */
+ test_sta_action_uninit (&ctx);
+}
+
+void
+key_test_suite (test_t t)
+{
+ test_suite_begin (t, "key");
+ key_basic_test_case (t);
+ test_case_begin (t, "memory");
+ test_begin (t, "memory")
+ {
+ test_fail_unless (blk_check_memory ());
+ } test_end;
+}
diff --git a/cesar/cp/sta/action/test/utest/src/msg_stub.c b/cesar/cp/sta/action/test/utest/src/msg_stub.c
new file mode 100644
index 0000000000..cb1f3facb7
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/msg_stub.c
@@ -0,0 +1,264 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/msg_stub.c
+ * \brief cp/msg module stub.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "cp/inc/context.h"
+#include "cp/msg/msg.h"
+#include "hal/phy/defs.h"
+
+#include <string.h>
+
+#define __ptr_(TYPE) PASTE_EXPAND (__ptr__, TYPE)
+#define __ptr__assign *
+#define __ptr__string
+#define __ptr__tonemask
+#define __ptr__hash_key
+
+/* Code for MME transmission. */
+#define __ms(EVENT, PARAMS...) \
+void \
+EVENT (cp_t *ctx, cp_mme_peer_t *peer \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_pdecl_, ## PARAMS)) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (peer); \
+ scenario_event (EVENT, param); \
+ __ms_test_peer \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __ms_test_, ## PARAMS) \
+}
+
+#define __ms_pdecl_(TYPE, PARAM, KIND) , TYPE PARAM
+#define __ms_test_(TYPE, PARAM, KIND) \
+ PASTE_EXPAND (__ms_test__, KIND) (PARAM)
+#define __ms_test__assign(PARAM) \
+ test_fail_unless (PARAM == param->PARAM);
+#define __ms_test__string(PARAM) \
+ test_fail_unless (strcmp (PARAM, param->PARAM) == 0);
+#define __ms_test_peer \
+ test_fail_unless (peer->mac == param->peer.mac); \
+ test_fail_unless (peer->vlan_tag == param->peer.vlan_tag); \
+ test_fail_unless (peer->tei == param->peer.tei); \
+ test_fail_unless (peer->all_sta == param->peer.all_sta);
+
+/* Code for MME transmission with a data structure. */
+#define __msd(EVENT, DATA, PARAMS...) \
+void \
+EVENT (cp_t *ctx, cp_mme_peer_t *peer, const DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (peer); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param); \
+ __ms_test_peer \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __msd_test_, ## PARAMS) \
+}
+
+#define __msd_test_(TYPE, PARAM, KIND) \
+ PASTE_EXPAND (__msd_test__, KIND) (PARAM)
+#define __msd_test__assign(PARAM) \
+ test_fail_unless (data->PARAM == param->PARAM);
+#define __msd_test__string(PARAM) \
+ test_fail_unless (strcmp (data->PARAM, param->PARAM) == 0);
+#define __msd_test__hash_key(PARAM) \
+ test_fail_unless (!param->PARAM || memcmp (data->PARAM, param->PARAM, \
+ CP_HASH_KEY_SIZE) == 0);
+
+/* Code for MME transmission with a data structure with encryption
+ * information. */
+#define __msk(EVENT, DATA, PARAMS...) \
+void \
+EVENT (cp_t *ctx, cp_mme_peer_t *peer, cp_mme_peks_t peks, \
+ const cp_secu_protocol_run_t *prun, const DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (peer); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param, global); \
+ __ms_test_peer \
+ test_fail_unless (peks == param->peks); \
+ test_fail_unless (prun->pid == param->pid); \
+ test_fail_unless (prun->pmn == param->pmn); \
+ global->prn = prun->prn; \
+ global->my_nonce = prun->my_nonce; \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __msd_test_, ## PARAMS) \
+}
+
+/* Code for MME reception. */
+#define __mr(EVENT, PARAMS...) \
+bool \
+EVENT (cp_t *ctx, cp_mme_rx_t *mme \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mr_pdecl_, ## PARAMS)) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (mme); \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mr_assert_, ## PARAMS) \
+ scenario_event (EVENT, param); \
+ if (param->ok) \
+ { \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mr_copy_, ## PARAMS) \
+ return true; \
+ } \
+ else \
+ return false; \
+}
+
+#define __mr_pdecl_(TYPE, PARAM, KIND) , TYPE __ptr_ (KIND) PARAM
+#define __mr_assert_(TYPE, PARAM, KIND) dbg_assert_ptr (PARAM);
+#define __mr_copy_(TYPE, PARAM, KIND) PASTE_EXPAND (__mr_copy__, KIND) (PARAM)
+
+#define __mr_copy__assign(PARAM) *PARAM = param->PARAM;
+#define __mr_copy__string(PARAM) strcpy (PARAM, param->PARAM);
+#define __mr_copy__tonemask(PARAM) \
+ memcpy (PARAM, param->PARAM, PHY_TONEMASK_SIZE);
+
+/* Code for MME reception with a data structure. */
+#define __mrd(EVENT, DATA, PARAMS...) \
+bool \
+EVENT (cp_t *ctx, cp_mme_rx_t *mme, DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (mme); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param); \
+ if (param->ok) \
+ { \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mrd_copy_, PARAMS) \
+ return true; \
+ } \
+ else \
+ return false; \
+}
+
+#define __mrd_copy_(TYPE, PARAM, KIND) \
+ PASTE_EXPAND (__mrd_copy__, KIND) (PARAM)
+
+#define __mrd_copy__assign(PARAM) data->PARAM = param->PARAM;
+#define __mrd_copy__string(PARAM) strcpy (data->PARAM, param->PARAM);
+#define __mrd_copy__tonemask(PARAM) \
+ memcpy (data->PARAM, param->PARAM, PHY_TONEMASK_SIZE);
+#define __mrd_copy__hash_key(PARAM) \
+ if (param->PARAM) memcpy (data->PARAM, param->PARAM, CP_HASH_KEY_SIZE);
+#define __mrd_copy__assign_deref(PARAM) \
+ if (param->PARAM) data->PARAM = *param->PARAM;
+
+/* Code for MME reception with a data structure with encryption
+ * information. */
+#define __mrk(EVENT, DATA, PARAMS...) \
+bool \
+EVENT (cp_t *ctx, cp_mme_rx_t *mme, DATA *data) \
+{ \
+ dbg_assert (ctx); \
+ dbg_assert (mme); \
+ dbg_assert (data); \
+ scenario_event (EVENT, param, g); \
+ if (param->ok) \
+ { \
+ mme->peks = param->peks; \
+ if (param->new_prn) g->prn = lib_rnd32 (&ctx->rnd) & 0xffff; \
+ if (param->new_my_nonce) g->my_nonce = lib_rnd32 (&ctx->rnd); \
+ if (param->new_your_nonce) g->your_nonce = lib_rnd32 (&ctx->rnd); \
+ mme->prun.pid = param->pid; \
+ mme->prun.pmn = param->pmn; \
+ mme->prun.prn = g->prn; \
+ mme->prun.my_nonce = g->my_nonce; \
+ mme->prun.your_nonce = g->your_nonce; \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, __mrd_copy_, PARAMS) \
+ return true; \
+ } \
+ else \
+ return false; \
+}
+
+__mr (cp_msg_cc_who_ru_req_receive,
+ (cp_nid_t, nid, assign))
+__msd (cp_msg_cc_who_ru_cnf_send, cp_msg_cc_who_ru_cnf_t,
+ (cp_nid_t, nid, assign),
+ (mac_t, cco_mac, assign),
+ (char *, avln_hfid, string))
+__msd (cp_msg_cc_assoc_req_send, cp_msg_cc_assoc_req_t,
+ (enum cp_msg_cc_assoc_req_type_t, request_type, assign),
+ (cp_nid_t, nid, assign),
+ (u8, cco_cap, assign),
+ (u8, proxy_cap, assign))
+__mrd (cp_msg_cc_assoc_cnf_receive, cp_msg_cc_assoc_cnf_t,
+ (enum cp_msg_cc_assoc_cnf_result_t *, result, assign),
+ (cp_nid_t, nid, assign),
+ (cp_snid_t, snid, assign),
+ (cp_tei_t, sta_tei, assign),
+ (u16, lease_time_min, assign))
+__ms (cp_msg_cc_leave_req_send,
+ (enum cp_msg_cc_leave_req_reason_t, reason, assign))
+__mr (cp_msg_cc_leave_cnf_receive)
+__mr (cp_msg_cc_leave_ind_receive,
+ (enum cp_msg_cc_leave_ind_reason_t, reason, assign),
+ (cp_nid_t, nid, assign))
+__ms (cp_msg_cc_leave_rsp_send)
+__mr (cp_msg_cc_set_tei_map_ind_receive_begin,
+ (enum cp_msg_cc_set_tei_map_ind_mode_t, mode, assign),
+ (uint, sta_nb, assign))
+__mr (cp_msg_cc_set_tei_map_ind_receive_sta,
+ (cp_tei_t, tei, assign),
+ (mac_t, mac, assign),
+ (enum cp_msg_cc_set_tei_map_ind_status_t, status, assign))
+__mr (cp_msg_cc_set_tei_map_ind_receive_end)
+
+__ms (cp_msg_cm_unassociated_sta_ind_send,
+ (cp_nid_t, nid, assign),
+ (u8, cco_cap, assign))
+__mr (cp_msg_cm_unassociated_sta_ind_receive,
+ (cp_nid_t, nid, assign),
+ (u8, cco_cap, assign))
+__mrk (cp_msg_cm_set_key_req_receive, cp_msg_cm_set_key_req_t,
+ (enum cp_msg_key_type_t, key_type, assign),
+ (u8, cco_cap, assign),
+ (cp_nid_t, nid, assign),
+ (u8, new_eks, assign),
+ (cp_key_t, new_key, assign))
+__msk (cp_msg_cm_set_key_cnf_send, cp_msg_cm_set_key_cnf_t,
+ (enum cp_msg_cm_set_key_cnf_result_t, result, assign),
+ (u8, cco_cap, assign))
+__msk (cp_msg_cm_get_key_req_send, cp_msg_cm_get_key_req_t,
+ (bool, relayed, assign),
+ (enum cp_msg_key_type_t, key_type, assign),
+ (cp_nid_t, nid, assign),
+ (u8 *, hash_key, hash_key))
+__mrk (cp_msg_cm_get_key_cnf_receive, cp_msg_cm_get_key_cnf_t,
+ (enum cp_msg_cm_get_key_cnf_result_t, result, assign),
+ (enum cp_msg_key_type_t, key_type, assign),
+ (cp_nid_t, nid, assign),
+ (u8, eks, assign),
+ (u8 *, hash_key, hash_key),
+ (cp_key_t, key, assign_deref))
+__mrd (cp_msg_cm_mme_error_ind_receive, cp_msg_cm_mme_error_ind_t,
+ (enum cp_msg_cm_mme_error_ind_reason_t, reason, assign),
+ (u8, rx_mmv, assign),
+ (cp_mmtype_t, rx_mmtype, assign),
+ (uint, offset, assign))
+
+__mr (cp_msg_drv_sta_set_mac_addr_req_receive, (mac_t, mac, assign))
+__mr (cp_msg_drv_sta_set_cco_pref_req_receive, (bool, cco_pref, assign))
+__mr (cp_msg_drv_sta_set_was_cco_req_receive, (bool, was_cco, assign))
+__mr (cp_msg_drv_sta_set_npw_req_receive, (char *, npw, string))
+__mr (cp_msg_drv_sta_set_dpw_req_receive, (char *, dpw, string))
+__mr (cp_msg_drv_sta_set_sl_req_receive, (cp_security_level_t, sl, assign))
+__mr (cp_msg_drv_sta_set_nid_req_receive, (cp_nid_t, nid, assign))
+__mr (cp_msg_drv_sta_set_m_sta_hfid_req_receive, (char *, m_sta_hfid, string))
+__mr (cp_msg_drv_sta_set_u_sta_hfid_req_receive, (char *, u_sta_hfid, string))
+__mr (cp_msg_drv_sta_set_avln_hfid_req_receive, (char *, avln_hfid, string))
+__mr (cp_msg_drv_sta_set_tonemask_req_receive, (u32 *, tonemask, tonemask))
+__ms (cp_msg_drv_any_cnf_send,
+ (cp_mmtype_t, mmtype, assign),
+ (cp_msg_drv_result_t, result, assign))
+
diff --git a/cesar/cp/sta/action/test/utest/src/poweron.c b/cesar/cp/sta/action/test/utest/src/poweron.c
new file mode 100644
index 0000000000..6010d6b02d
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/poweron.c
@@ -0,0 +1,472 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/poweron.c
+ * \brief Test sta/action/poweron.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "lib/scenario/scenario.h"
+
+#include "inc/test_sta_action.h"
+
+void
+poweron_test_cases (test_t t)
+{
+ test_sta_action_t ctx;
+ test_sta_action_init (&ctx);
+ cp_t *cp = &ctx.cp;
+ scenario_globals_t globals = {
+ .cp = cp,
+ };
+ cp_nid_t nid = 0x111111111111ull;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_beacon_desc_t *beacon = INVALID_PTR;
+ /* USTT timeout. */
+ test_case_begin (t, "poweron-usta ustt");
+ test_sta_action_reset (&ctx);
+ cp_sta_mgr_update_our_avln_nid (cp, nid);
+ /* Without any other AVLN. */
+ test_begin (t, "no avln")
+ {
+ scenario_entry_t entries[] = {
+ /* POWERON. */
+ SCENARIO_ACTION (poweron__poweron__ustt_timeout),
+ /* USTA. */
+ SCENARIO_ACTION (poweron__usta__ustt_timeout),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* With other AVLN. */
+ test_begin (t, "avln")
+ {
+ cp_sta_mgr_add_avln (cp, 1, 0x111111111111ull);
+ scenario_entry_t entries[] = {
+ /* POWERON. */
+ SCENARIO_ACTION (poweron__poweron__ustt_timeout),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_send,
+ .peer = CP_MME_PEER (MAC_BROADCAST), .nid = nid,
+ .cco_cap = CP_CCO_LEVEL),
+ /* USTA. */
+ SCENARIO_ACTION (poweron__usta__ustt_timeout),
+ SCENARIO_EVENT (cp_msg_cm_unassociated_sta_ind_send,
+ .peer = CP_MME_PEER (MAC_BROADCAST), .nid = nid,
+ .cco_cap = CP_CCO_LEVEL),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* Beacon. */
+ test_case_begin (t, "poweron-usta beacon");
+ test_sta_action_reset (&ctx);
+ cp_sta_mgr_update_our_avln_nid (cp, nid);
+ /* NID do not match. */
+ test_begin (t, "no nid match")
+ {
+ net = cp_sta_mgr_add_avln (cp, 2, nid + 1);
+ sta = cp_net_sta_add (cp, net, 1, 0x112233445566ull);
+ cp_net_set_cco (cp, net, 1);
+ slab_release (sta);
+ scenario_entry_t entries[] = {
+ /* POWERON. */
+ SCENARIO_ACTION (poweron__poweron__beacon, .beacon = beacon,
+ .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (POWERON, BEACON,
+ no_nid_match)),
+ /* USTA. */
+ SCENARIO_ACTION (poweron__usta__beacon, .beacon = beacon,
+ .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (USTA, BEACON,
+ no_nid_match)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* NID do match, not CCo. */
+ test_begin (t, "nid match no cco")
+ {
+ net = cp_sta_mgr_add_avln (cp, 1, nid);
+ sta = cp_net_sta_add (cp, net, 1, 0x0123456789abull);
+ slab_release (sta);
+ scenario_entry_t entries[] = {
+ /* POWERON. */
+ SCENARIO_ACTION (poweron__poweron__beacon, .beacon = beacon,
+ .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (POWERON, BEACON,
+ no_nid_match)),
+ /* USTA. */
+ SCENARIO_ACTION (poweron__usta__beacon, .beacon = beacon,
+ .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (USTA, BEACON,
+ no_nid_match)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* NID do match. */
+ test_begin (t, "nid match cco")
+ {
+ cp_net_set_cco (cp, net, 1);
+ scenario_entry_t entries[] = {
+ /* POWERON. */
+ SCENARIO_ACTION (poweron__poweron__beacon, .beacon = beacon,
+ .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_assoc),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (POWERON, BEACON,
+ nid_match)),
+ /* USTA. */
+ SCENARIO_ACTION (poweron__usta__beacon, .beacon = beacon,
+ .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_event_bare_new,
+ .type = CP_FSM_EVENT_TYPE_to_assoc),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (USTA, BEACON,
+ nid_match)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* BTT timeout. */
+ test_case_begin (t, "poweron btt");
+ test_sta_action_reset (&ctx);
+ cp_sta_mgr_update_our_avln_nid (cp, nid);
+ cp_sta_own_data_set_mac_address (cp, 0x112233445566ull);
+ test_begin (t, "no avln")
+ {
+ /* No AVLN. */
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__poweron__btt_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (POWERON, btt_timeout,
+ no_avln)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* AVLN no NID match. */
+ test_begin (t, "no nid match")
+ {
+ net = cp_sta_mgr_add_avln (cp, 3, nid + 1);
+ sta = cp_net_sta_add (cp, net, 0, 0x0123456789abull);
+ slab_release (sta);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__poweron__btt_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (POWERON, btt_timeout,
+ avln)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* AVLN NID match, not CCo. */
+ test_begin (t, "not cco")
+ {
+ /* Because of CCo cap. */
+ net = cp_sta_mgr_add_avln (cp, 1, nid);
+ sta = cp_net_sta_add (cp, net, 0, 0x012345678901ull);
+ sta->cco_cap = 3;
+ slab_release (sta);
+ scenario_entry_t entries0[] = {
+ SCENARIO_ACTION (poweron__poweron__btt_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (POWERON, btt_timeout,
+ avln)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries0, &globals);
+ cp_net_sta_remove_unassoc (cp, net, 0x012345678901ull);
+ /* Because of CCo MAC address. */
+ sta = cp_net_sta_add (cp, net, 0, 0x0123456789abull);
+ sta->cco_cap = CP_CCO_LEVEL;
+ slab_release (sta);
+ scenario_entry_t entries1[] = {
+ SCENARIO_ACTION (poweron__poweron__btt_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (POWERON, btt_timeout,
+ avln)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries1, &globals);
+ cp_net_sta_remove_unassoc (cp, net, 0x0123456789abull);
+ } test_end;
+ /* AVLN NID match, CCo. */
+ test_begin (t, "cco")
+ {
+ sta = cp_net_sta_add (cp, net, 0, 0x012345678901ull);
+ sta->cco_cap = CP_CCO_LEVEL;
+ slab_release (sta);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__poweron__btt_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (POWERON, btt_timeout,
+ nid_match_cco)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ cp_net_sta_remove_unassoc (cp, net, 0x012345678901ull);
+ } test_end;
+ /* USTA indication. */
+ test_case_begin (t, "usta usta ind");
+ test_sta_action_reset (&ctx);
+ cp_sta_mgr_update_our_avln_nid (cp, nid);
+ cp_sta_own_data_set_mac_address (cp, 0x112233445566ull);
+ /* NID do not match. */
+ test_begin (t, "no nid match")
+ {
+ net = cp_sta_mgr_add_avln (cp, 3, nid + 1);
+ sta = cp_net_sta_add (cp, net, 0, 0x0123456789abull);
+ slab_release (sta);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__usta__usta_ind, .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (USTA, usta_ind, else)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* Not CCo. */
+ test_begin (t, "not cco")
+ {
+ /* Because of CCo cap. */
+ net = cp_sta_mgr_add_avln (cp, 1, nid);
+ sta = cp_net_sta_add (cp, net, 0, 0x012345678901ull);
+ sta->cco_cap = 3;
+ slab_release (sta);
+ scenario_entry_t entries0[] = {
+ SCENARIO_ACTION (poweron__usta__usta_ind, .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (USTA, usta_ind, else)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries0, &globals);
+ cp_net_sta_remove_unassoc (cp, net, 0x012345678901ull);
+ /* Because of CCo MAC address. */
+ sta = cp_net_sta_add (cp, net, 0, 0x0123456789abull);
+ sta->cco_cap = CP_CCO_LEVEL;
+ slab_release (sta);
+ scenario_entry_t entries1[] = {
+ SCENARIO_ACTION (poweron__usta__usta_ind, .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (USTA, usta_ind, else)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries1, &globals);
+ cp_net_sta_remove_unassoc (cp, net, 0x0123456789abull);
+ } test_end;
+ /* CCo. */
+ test_begin (t, "cco")
+ {
+ sta = cp_net_sta_add (cp, net, 0, 0x012345678901ull);
+ sta->cco_cap = CP_CCO_LEVEL;
+ slab_release (sta);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__usta__usta_ind, .net = net, .sta = sta),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (USTA, usta_ind,
+ nid_match_cco)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ cp_net_sta_remove_unassoc (cp, net, 0x012345678901ull);
+ } test_end;
+ /* POWERON, USTA JOINING. */
+ test_case_begin (t, "poweron-usta joining");
+ test_sta_action_reset (&ctx);
+ /* Not much to test for the moment. */
+ test_begin (t, "unassociated")
+ {
+ scenario_entry_t entries[] = {
+ /* POWERON. */
+ SCENARIO_ACTION (poweron__poweron_joining__left),
+ /* USTA. */
+ SCENARIO_ACTION (poweron__usta_joining__left),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* STA beacon. */
+ test_case_begin (t, "sta beacon");
+ test_sta_action_reset (&ctx);
+ cp_sta_mgr_update_our_avln_nid (cp, nid);
+ test_begin (t, "avln failure")
+ {
+ cp_sta_t *cco, *not_cco, *bad_nid;
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (cp);
+ cco = cp_net_sta_add (cp, our_net, 1, 0x112233445566ull);
+ cp_net_set_cco (cp, our_net, 1);
+ slab_release (cco);
+ not_cco = cp_net_sta_add (cp, our_net, 2, 0x223344556677ull);
+ slab_release (not_cco);
+ net = cp_sta_mgr_add_avln (cp, 3, nid + 1);
+ bad_nid = cp_net_sta_add (cp, net, 1, 0x334455667788ull);
+ slab_release (bad_nid);
+#define SCENARIO_AVLN_OK \
+ SCENARIO_ACTION (poweron__sta__beacon_not_received), \
+ SCENARIO_EVENT (cp_fsm_branch, \
+ .branch = CP_FSM_BRANCH (STA, \
+ BEACON_NOT_RECEIVED, \
+ else)),
+#define SCENARIO_AVLN_KO \
+ SCENARIO_ACTION (poweron__sta__beacon_not_received), \
+ SCENARIO_EVENT (cp_fsm_branch, \
+ .branch = CP_FSM_BRANCH (STA, \
+ BEACON_NOT_RECEIVED, \
+ avln_failure)),
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__sta__enter),
+ /* Normal situation, some loss of beacon. */
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = cco),
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = cco),
+ SCENARIO_AVLN_OK
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = cco),
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = cco),
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = cco),
+ /* Critical situation, AVLN almost failed. */
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = cco),
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = cco),
+ /* AVLN fail. */
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = cco),
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = net, .sta = bad_nid),
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = not_cco),
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = net, .sta = bad_nid),
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = not_cco),
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_OK
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = net, .sta = bad_nid),
+ SCENARIO_ACTION (poweron__sta__beacon, .beacon = beacon,
+ .net = our_net, .sta = not_cco),
+ SCENARIO_AVLN_OK
+ SCENARIO_AVLN_KO
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ /* CCO. */
+ test_case_begin (t, "cco");
+ test_sta_action_reset (&ctx);
+ cp_sta_mgr_update_our_avln_nid (cp, nid);
+ test_begin (t, "join timeout sta")
+ {
+ cp_net_t *our_net = cp_sta_mgr_get_our_avln (cp);
+ sta = cp_net_sta_add (cp, our_net, 1, 0x112233445566ull);
+ slab_release (sta);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__cco__join_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (CCO, join_timeout,
+ sta)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ cp_net_sta_remove_assoc (cp, our_net, 1);
+ } test_end;
+ test_begin (t, "join timeout no sta no avln")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__cco__join_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (CCO, join_timeout,
+ no_sta_no_avln)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "join timeout no sta avln")
+ {
+ cp_sta_mgr_add_avln (cp, 1, 0x111111111111ull);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__cco__join_timeout),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (CCO, join_timeout,
+ no_sta_avln)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ cp_sta_mgr_remove_avln (cp, 1, 0x111111111111ull);
+ } test_end;
+ test_begin (t, "all sta leaved no avln")
+ {
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__cco__all_sta_leaved),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (CCO, all_sta_leaved,
+ no_avln)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ } test_end;
+ test_begin (t, "all sta leaved avln")
+ {
+ cp_sta_mgr_add_avln (cp, 1, 0x111111111111ull);
+ scenario_entry_t entries[] = {
+ SCENARIO_ACTION (poweron__cco__all_sta_leaved),
+ SCENARIO_EVENT (cp_fsm_branch,
+ .branch = CP_FSM_BRANCH (CCO, all_sta_leaved,
+ avln)),
+ SCENARIO_END
+ };
+ scenario_run (t, entries, &globals);
+ cp_sta_mgr_remove_avln (cp, 1, 0x111111111111ull);
+ } test_end;
+ /* Cleanup. */
+ test_sta_action_uninit (&ctx);
+}
+
+void
+poweron_test_suite (test_t t)
+{
+ test_suite_begin (t, "poweron");
+ poweron_test_cases (t);
+ test_case_begin (t, "memory");
+ test_begin (t, "memory")
+ {
+ test_fail_unless (blk_check_memory ());
+ } test_end;
+}
+
diff --git a/cesar/cp/sta/action/test/utest/src/scenario_actions.c b/cesar/cp/sta/action/test/utest/src/scenario_actions.c
new file mode 100644
index 0000000000..525c0e0e7f
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/scenario_actions.c
@@ -0,0 +1,137 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/scenario_actions.c
+ * \brief Scenario actions.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "cp/sta/action/action.h"
+
+#include "lib/scenario/scenario.h"
+
+#define __m(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ static cp_mme_rx_t mme; \
+ mme.peer = params->action_ ## ACTION.peer; \
+ cp_sta_action_ ## ACTION (globals->cp, &mme); \
+}
+
+#define __mp(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ static cp_mme_rx_t mme; \
+ mme.peer = params->action_ ## ACTION.peer; \
+ mme.prun.pid = params->action_ ## ACTION.pid; \
+ cp_sta_action_ ## ACTION (globals->cp, &mme); \
+}
+
+#define __0(ACTION) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ cp_sta_action_ ## ACTION (globals->cp); \
+}
+
+#define __n(ACTION, PARAMS...) \
+void \
+scenario_action_ ## ACTION ## _cb (scenario_globals_t *globals, \
+ scenario_params_t *params) \
+{ \
+ scenario_action_ ## ACTION ## _t *p = &params->action_ ## ACTION; \
+ cp_sta_action_ ## ACTION (globals->cp \
+ PREPROC_FOR_EACH_PARAM (PREPROC_CALL_UNPACK, \
+ __n_args, ## PARAMS) \
+ ); \
+}
+
+#define __n_args(TYPE, PARAM) \
+ , p->PARAM
+
+__0 (garbage)
+
+__n (assoc_start,
+ (cp_net_t *, cco_net),
+ (cp_sta_t *, cco))
+__0 (assoc_leave)
+__0 (assoc__unassociated__enter)
+__0 (assoc__unassociated__to_assoc)
+__m (assoc__wait_assoc_cnf__cc_assoc_cnf)
+__0 (assoc__wait_assoc_cnf__timeout)
+__m (assoc__associated__cm_get_key_cnf_pid_0)
+__0 (assoc__associated__timeout)
+__0 (assoc__authenticated__renew)
+__m (assoc__authenticated__cc_assoc_cnf)
+__m (assoc__authenticated__cm_set_key_req_pid_1)
+__0 (assoc__authenticated__to_leave)
+__m (assoc__authenticated__cc_leave_ind)
+__m (assoc__leaving__cc_leave_cnf)
+__0 (assoc__leaving__timeout)
+__0 (assoc__leave_wait__timeout)
+
+__m (drv__stopped__drv_sta_set_mac_addr_req)
+__m (drv__stopped__drv_sta_set_cco_pref_req)
+__m (drv__stopped__drv_sta_set_was_cco_req)
+__m (drv__stopped__drv_sta_set_dpw_req)
+__m (drv__stopped__drv_sta_set_npw_req)
+__m (drv__stopped__drv_sta_set_sl_req)
+__m (drv__stopped__drv_sta_set_nid_req)
+__m (drv__stopped__drv_sta_set_m_sta_hfid_req)
+__m (drv__stopped__drv_sta_set_u_sta_hfid_req)
+__m (drv__stopped__drv_sta_set_avln_hfid_req)
+__m (drv__stopped__drv_sta_set_tonemask_req)
+__m (drv__stopped__drv_sta_mac_start_req)
+__m (drv__started__drv_sta_mac_stop_req)
+__0 (drv__stopping__left)
+
+__m (process_cc_set_tei_map_ind)
+__m (process_cm_unassociated_sta_ind)
+
+__mp (process_cm_set_key_req)
+__mp (process_cm_set_key_cnf)
+__mp (process_cm_get_key_req)
+__mp (process_cm_get_key_cnf)
+
+__m (process_cc_who_ru_req)
+__m (process_cc_relay_req)
+__m (process_cc_relay_ind)
+__m (process_cm_mme_error_ind)
+
+__0 (poweron_start)
+__0 (poweron__poweron__ustt_timeout)
+__0 (poweron__poweron__btt_timeout)
+__n (poweron__poweron__beacon,
+ (cp_beacon_desc_t *, beacon),
+ (cp_net_t *, net),
+ (cp_sta_t *, sta))
+__0 (poweron__poweron_joining__left)
+__0 (poweron__usta__ustt_timeout)
+__n (poweron__usta__beacon,
+ (cp_beacon_desc_t *, beacon),
+ (cp_net_t *, net),
+ (cp_sta_t *, sta))
+__n (poweron__usta__usta_ind,
+ (cp_net_t *, net),
+ (cp_sta_t *, sta))
+__0 (poweron__usta_joining__left)
+__0 (poweron__sta__enter)
+__n (poweron__sta__beacon,
+ (cp_beacon_desc_t *, beacon),
+ (cp_net_t *, net),
+ (cp_sta_t *, sta))
+__0 (poweron__sta__beacon_not_received)
+__0 (poweron__cco__join_timeout)
+__0 (poweron__cco__all_sta_leaved)
+
diff --git a/cesar/cp/sta/action/test/utest/src/test_sta_action.c b/cesar/cp/sta/action/test/utest/src/test_sta_action.c
new file mode 100644
index 0000000000..a8029bb2f0
--- /dev/null
+++ b/cesar/cp/sta/action/test/utest/src/test_sta_action.c
@@ -0,0 +1,68 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_sta_action.c
+ * \brief Test sta/action.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "inc/test_sta_action.h"
+
+#include "lib/test.h"
+
+void
+assoc_test_suite (test_t t);
+
+void
+drv_test_suite (test_t t);
+
+void
+info_test_suite (test_t t);
+
+void
+key_test_suite (test_t t);
+
+void
+poweron_test_suite (test_t t);
+
+void
+test_sta_action_init (test_sta_action_t *ctx)
+{
+ ctx->cp.mac_config = &ctx->mac_config;
+ cp_sta_mgr_init (&ctx->cp);
+ lib_rnd_init (&ctx->cp.rnd, 1234);
+}
+
+void
+test_sta_action_uninit (test_sta_action_t *ctx)
+{
+ cp_sta_mgr_uninit (&ctx->cp);
+}
+
+void
+test_sta_action_reset (test_sta_action_t *ctx)
+{
+ cp_sta_mgr_uninit (&ctx->cp);
+ cp_sta_mgr_init (&ctx->cp);
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ test_init (t, argc, argv);
+ assoc_test_suite (t);
+ drv_test_suite (t);
+ info_test_suite (t);
+ key_test_suite (t);
+ poweron_test_suite (t);
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/sta/core/Module b/cesar/cp/sta/core/Module
new file mode 100644
index 0000000000..2230bcc543
--- /dev/null
+++ b/cesar/cp/sta/core/Module
@@ -0,0 +1 @@
+SOURCES:= core.c
diff --git a/cesar/cp/sta/core/core.h b/cesar/cp/sta/core/core.h
new file mode 100644
index 0000000000..9988a2fb15
--- /dev/null
+++ b/cesar/cp/sta/core/core.h
@@ -0,0 +1,153 @@
+#ifndef cp_sta_core_core_h
+#define cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/core/core.h
+ * \brief STA core.
+ * \ingroup cp_sta
+ *
+ * station core module implements following elements and functionalities
+ * *CP thread
+ * *main CP thread wait event loop
+ * station events as eCos event flags
+ * eCos event flag mask initialisation, event masking & unmasking,
+ * categories of events to manage = MME, beacon, FSM and garbage events
+ * garbage collector event flag
+ * manage (set/stop) the garbage collector timer
+ * *garbage collector timer DSR function (activation of the garbage flag,
+ * the garbage collector event flag will be taken into account with the
+ * lowest priority by the main wait event loop)
+ * *in case of garbage flag event activated, garbage collector consists in
+ * freeing "not terminated" MME messages buffers (i.e. MME messages which
+ * were not fully re-assembled, that is, which have a recorded date exceeding
+ * the current date + 1 second)
+ * dispatch a MME message beeing received
+ * in case of MME event flag activated, call the cp_interf() function which
+ * takes the available MME in the Rx FIFO and then calls the msg_dispatch()
+ * function that will post the relevant FSM event in the FSM event FIFO
+ * manage beacon data
+ * in case of beacon event flag activated
+ * implement various utility functions
+ * launch/stop a timer
+ * timer callback function for each sort of timer
+ * API function to put a FSM event in the FSM event FIFO.
+ */
+#include "cp/types.h"
+
+#include "cp/sta/core/defs.h"
+
+BEGIN_DECLS
+
+/**
+ * initialisation of station core.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * 1) init the real-time clock
+ * 2) init the (wait) event flags
+ * 3) create & launch the cp sta core thread
+ */
+void
+cp_sta_core_init(cp_t *cp_ctx);
+
+/**
+ * un-initialisation of station core.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * Makes the cp sta core thread terminate and free resources.
+ */
+void
+cp_sta_core_uninit(cp_t *cp_ctx);
+
+/**
+ * signal sta core that a beacon has been received.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_recv_beacon_event(cp_t *cp_ctx);
+
+/**
+ * signal sta core that a MME message has been received.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_recv_mme_event(cp_t *cp_ctx);
+
+/**
+ * create a cyclic alarm that will generate a cp sta core event
+ * and associated (specified) FSM event at the given period of occurrence.
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_cyclic_event pointer to cyclic event structure where cyclic
+ * event info will be stored
+ * \param fsm_event the FSM event to set
+ * \param event_period_ms the period of event re-occurrence in millisecond
+ *
+ * when timer elapsed the specified FSM event will be added to the FSM fifo
+ * and a CP_STA_CORE_EVENT_FLAG_FSM core event will be set to be taken into account
+ * by the wait-event loop of the cp sta core thread
+ */
+void
+cp_sta_core_gen_cyclic_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_cyclic_event,
+ cp_fsm_event_t *fsm_event,
+ uint event_period_ms);
+
+/**
+ * create a one-shot alarm that will generate a cp sta core event
+ * and associated (specified) FSM event after the specified delay.
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_timed_event pointer to timed event structure where timed
+ * event info will be stored
+ * \param fsm_event the FSM event to set
+ * \param event_delay_ms the amount of time to wait in millisecond
+ *
+ * when timer elapsed the specified FSM event will be added to the FSM fifo
+ * and a CP_STA_CORE_EVENT_FLAG_FSM core event will be set to be taken into account
+ * by the wait-event loop of the cp sta core thread
+ */
+void
+cp_sta_core_gen_timed_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_fsm_event_t *fsm_event,
+ uint event_delay_ms);
+
+/**
+ * will stop (disable and delete) an alarm previously created with
+ * cp_sta_core_gen_timed_event(),
+ * cp_sta_core_gen_cyclic_event(), or an alarm previously created internally
+ * by sta core with cp_sta_core_gen_core_timed_event()
+ * or cp_sta_core_gen_core_cyclic_event().
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_timed_event pointer to timed or cyclic event info structure
+ */
+void
+cp_sta_core_stop_timed_or_cyclic_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event);
+
+/**
+ * Get the current clock in milliseconds.
+ * \param ctx the CP context.
+ * \return the current date in milliseconds
+ *
+ * This returns the current eCos system tick counter converted to milliseconds.
+ */
+u32
+cp_sta_core_get_date_ms (cp_t *ctx);
+
+END_DECLS
+
+#endif /* cp_sta_core_core_h */
diff --git a/cesar/cp/sta/core/defs.h b/cesar/cp/sta/core/defs.h
new file mode 100644
index 0000000000..4a3c3937e6
--- /dev/null
+++ b/cesar/cp/sta/core/defs.h
@@ -0,0 +1,58 @@
+#ifndef cp_sta_core_defs_h
+#define cp_sta_core_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/core/defs.h
+ * \brief Sta core defs.
+ * \ingroup cp/sta/core
+ *
+ */
+#include <cyg/kernel/kapi.h>
+#include "cp/fsm/forward.h"
+
+/** Forward declaration. */
+typedef struct cp_sta_core_t cp_sta_core_t;
+
+/*
+ * the sta core event flags
+ * these are some flags, so take care to give a value with all bits set to 0 but one.
+ */
+enum cp_sta_core_event_flag_t
+{
+ CP_STA_CORE_EVENT_FLAG_RECV_BEACON = 0x1,
+ CP_STA_CORE_EVENT_FLAG_RECV_MME = 0x2,
+ CP_STA_CORE_EVENT_FLAG_FSM = 0x4,
+ CP_STA_CORE_EVENT_FLAG_GARBAGE = 0x8,
+ CP_STA_CORE_EVENT_FLAG_TERMINATE = 0x10
+};
+typedef enum cp_sta_core_event_flag_t cp_sta_core_event_flag_t;
+
+/** Definition of alarm info structure
+ * (applications should not use it directly but use "alias" defined just below) */
+struct cp_sta_core_timed_event_def_t
+{
+ /* eCos alarm. */
+ cyg_alarm alarm;
+ /* eCos alarm handle. */
+ cyg_handle_t alarm_handle;
+ /* the sta core event flag to set
+ * (auto or user-specified when creating/launching timer alarm). */
+ cp_sta_core_event_flag_t event_flag;
+ /* FSM event specified when creating/launching timer alarm
+ * (set if the previous flag is CP_STA_CORE_EVENT_FLAG_FSM). */
+ cp_fsm_event_t *fsm_event;
+ /* flag indicating a periodic alarm (if set to true)
+ * or one-shot alarm (if set to false). */
+ bool cyclic_alarm;
+ /* pointer to CP context. */
+ cp_t *cp_ctx;
+};
+typedef struct cp_sta_core_timed_event_def_t cp_sta_core_timed_event_def_t;
+
+#endif /* cp_sta_core_defs_h */
diff --git a/cesar/cp/sta/core/doc/sta_core.odt b/cesar/cp/sta/core/doc/sta_core.odt
new file mode 100644
index 0000000000..4f24aff8f0
--- /dev/null
+++ b/cesar/cp/sta/core/doc/sta_core.odt
Binary files differ
diff --git a/cesar/cp/sta/core/doc/sta_core.xmi b/cesar/cp/sta/core/doc/sta_core.xmi
new file mode 100644
index 0000000000..763cab4568
--- /dev/null
+++ b/cesar/cp/sta/core/doc/sta_core.xmi
@@ -0,0 +1,382 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-04-21T18:19:54" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.8</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WHsGhr6cL3qV" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1lLAIoXrLdtJ" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BsXuVmQldfSS" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="l2nnsImcbvsP" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Shk6a1xmtUeN" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="G46rjYKTY5EP" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="O01xtrLMY3S6" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5NqwrUH5XNxE" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="tFhSKvrguqen" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="hz7D2ZH5u80l" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="aHp7fmMY11yJ" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vntVp1gw0ZB8" isRoot="false" isAbstract="false" name="cp_reassembly_ctx_t *" elementReference="wuDYnfojrSWv" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oZHHg64PKBaq" isRoot="false" isAbstract="false" name="uint" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DcaQZXHCYAUY" isRoot="false" isAbstract="false" name="cp_sta_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nnvOyvzkSE17" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="J5WdE6USg2qD" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="X7Q5Iud3fXPb" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QPMsbNxuTUYh" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TRzc3eNXqLr1" isRoot="false" isAbstract="false" name="cp_net_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="wuDYnfojrSWv" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Q4TYO2bRfXJq" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="RTeIWtKTDaZV" isRoot="false" isAbstract="false" name="cp_reassembly_ctx_t" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="YSgJHO5LmrvO" aggregation="aggregate" type="wuDYnfojrSWv" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="vhpMu3Ol9ygf" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KJlZ5h5b9luO" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="7yirnbGiI55A" aggregation="none" type="wuDYnfojrSWv" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6RuFPYtjreHu" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LMVU5OrCMZ27" aggregation="none" type="wuDYnfojrSWv" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="AIqQLtZQKRdh" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zWOqBfkW1Dz6" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="boHvNJ3VZrts" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="iSI0twhqS5gb" aggregation="none" type="wuDYnfojrSWv" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Package stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3Vny4m2DHl2U" isRoot="false" isAbstract="false" name="Classes" >
+ <UML:Namespace.ownedElement>
+ <UML:Class comment="NTB sample history (beacon timestamp data and synchronization data being calculated)." isSpecification="false" isLeaf="false" visibility="public" namespace="3Vny4m2DHl2U" xmi.id="QCdiA5hU9IAb" isRoot="false" isAbstract="false" name="ntb_histo_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="k Factor value for &quot;w&quot; weighting constant (w = 1 / 2^k)." isSpecification="false" visibility="public" xmi.id="9PZYdnDFOfZz" type="hz7D2ZH5u80l" name="k" />
+ <UML:Attribute comment="beacon index." isSpecification="false" visibility="public" xmi.id="I2w0DZg3Mq2z" type="hz7D2ZH5u80l" name="beacon" />
+ <UML:Attribute comment="BTS (Beacon Time Stamp) = CCo NTB date in entire ticks." isSpecification="false" visibility="public" xmi.id="2DXPazSjM1H0" type="hz7D2ZH5u80l" name="bts_ticks" />
+ <UML:Attribute comment="LTmr = STAn NTB date in decimal ticks." isSpecification="false" visibility="public" xmi.id="ze320s3xsETH" type="Shk6a1xmtUeN" name="sta_ntb_date_decticks" />
+ <UML:Attribute comment="LTmr = STAn NTB date in entire ticks." isSpecification="false" visibility="public" xmi.id="oQkVnlklYCyk" type="hz7D2ZH5u80l" name="sta_ntb_date_ticks" />
+ <UML:Attribute comment="PHY LTmr = STA1 25Mhz PHY date (not corrected) in decimal ticks." isSpecification="false" visibility="public" xmi.id="HiveU00Ud1Ud" type="Shk6a1xmtUeN" name="sta_phy_date_decticks" />
+ <UML:Attribute comment="PHY LTmr = STA1 25Mhz PHY date (not corrected) in entire ticks." isSpecification="false" visibility="public" xmi.id="tVZmk23YSl2D" type="hz7D2ZH5u80l" name="sta_phy_date_ticks" />
+ <UML:Attribute comment="FreqError." isSpecification="false" visibility="public" xmi.id="PZbDOoBbG3Ga" type="Shk6a1xmtUeN" name="sta_hpav_frequ_error" />
+ <UML:Attribute comment="Offset calculated by formula from paragraph 5.5 of HP_AV specification." isSpecification="false" visibility="public" xmi.id="vu1sNip10eTF" type="tGaBn52o26ZT" name="sta_hpav_offset" />
+ <UML:Attribute comment="Offset of NTB STA clock relative to CCo clock." isSpecification="false" visibility="public" xmi.id="12iP2IX4iuZV" type="tGaBn52o26ZT" name="sta_offset" />
+ <UML:Attribute comment="STAn NTB date derive from CCo NTB in entire ticks." isSpecification="false" visibility="public" xmi.id="TJBC2d791ceG" type="O01xtrLMY3S6" name="sta_deriv_from_cco_ntb_ticks" />
+ <UML:Attribute comment="STA NTB date relative derive from CCo NTB in entire ticks." isSpecification="false" visibility="public" xmi.id="uph521FYdhgf" type="O01xtrLMY3S6" name="sta_relative_deriv_from_cco_ntb_ticks" />
+ <UML:Attribute comment="STAn current numerator for PHY_Clk divisor." isSpecification="false" visibility="public" xmi.id="aWuXmeAj2r8J" type="hz7D2ZH5u80l" name="sta_numerator" />
+ <UML:Attribute comment="STAn current STA_Clk frenquency in Hz." isSpecification="false" visibility="public" xmi.id="0i5d3BEMdYEu" type="Shk6a1xmtUeN" name="sta_clk_frequ" />
+ <UML:Attribute comment="Predicted value of CCo NTB date [next BTS] at next beacon (in entire ticks)." isSpecification="false" visibility="public" xmi.id="lg26NjLnDlUL" type="hz7D2ZH5u80l" name="sta_predict_next_bts_ticks" />
+ <UML:Attribute comment="Predicted value of STAn NTB date at next beacon if no correction (in entire ticks)." isSpecification="false" visibility="public" xmi.id="YLi6zEQnge4L" type="hz7D2ZH5u80l" name="sta_predict_next_sta_ticks" />
+ <UML:Attribute comment="Predicted error of STAn NTB date at next beacon (compared to next BTS value) if no correction (in entire ticks)." isSpecification="false" visibility="public" xmi.id="BXmpzfZGDcVv" type="O01xtrLMY3S6" name="sta_predict_error_of_next_sta_ticks" />
+ <UML:Attribute comment="STAn STA clock should be adjusted to (in Hz)." isSpecification="false" visibility="public" xmi.id="HMot9TL3ZMNJ" type="Shk6a1xmtUeN" name="sta_clk_frequ_should_be" />
+ <UML:Attribute comment="For max. derive of 25 ticks (25 ticks = 1 ppm @ 25Mhz), STAn STA/PHY clock ratio should be adjusted to (decimal numerator)." isSpecification="false" visibility="public" xmi.id="Vq6eEbIzxkV1" type="Shk6a1xmtUeN" name="sta_decimal_numerator_should_be" />
+ <UML:Attribute comment="STAn STA/PHY clock ratio should be adjusted to (pure integer numerator)." isSpecification="false" visibility="public" xmi.id="fSsc3eyAlMjO" type="hz7D2ZH5u80l" name="sta_integer_numerator_should_be" />
+ <UML:Attribute comment="STAn STA clock will be adjusted to (in Hz)." isSpecification="false" visibility="public" xmi.id="kfcOO2lh80fL" type="Shk6a1xmtUeN" name="sta_clk_frequ_will_be" />
+ <UML:Attribute comment="NTB date estimation in decimal ticks." isSpecification="false" visibility="public" xmi.id="rrov4443oTJh" type="Shk6a1xmtUeN" name="sta_ntb_estimated_decticks" />
+ <UML:Attribute comment="NTB date estimation in entire ticks." isSpecification="false" visibility="public" xmi.id="iAanwTF1WWI6" type="hz7D2ZH5u80l" name="sta_ntb_estimated_ticks" />
+ <UML:Attribute comment="STA clk freq sync ratio." isSpecification="false" visibility="public" xmi.id="MIx3EeGHnNhx" type="Shk6a1xmtUeN" name="sta_clk_frequ_sync_ratio" />
+ <UML:Attribute comment="count of samples for calculating the average of derive." isSpecification="false" visibility="public" xmi.id="JMKXRzfkAe0M" type="hz7D2ZH5u80l" name="sta_count_samples_for_average_deriv" />
+ <UML:Operation comment="Store into NTB histo the BTS, SYS_Ltmr and STA_Ltmr timestamp data of the received beacon." isSpecification="false" isLeaf="false" visibility="public" xmi.id="heL2xof0ahkF" isRoot="false" isAbstract="false" isQuery="false" name="record_sample" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fT6xnWlPyZed" value="" type="hz7D2ZH5u80l" name="beacon_bts" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WloebbNBjZsK" value="" type="hz7D2ZH5u80l" name="beacon_sys_ltmr" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wejvRpEVnOj3" value="" type="hz7D2ZH5u80l" name="beacon_sta_ltmr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Reset the NTB history data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="3UBqgc2KKU2C" isRoot="false" isAbstract="false" isQuery="false" name="reset_histo" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="contexte NTB" isSpecification="false" isLeaf="false" visibility="public" namespace="3Vny4m2DHl2U" xmi.id="L2ASUCoHdFZ0" isRoot="false" isAbstract="false" name="ntb_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="count of beacons" isSpecification="false" visibility="public" xmi.id="tcysk13dBnvN" type="v2bgoPxiwYdm" name="beacon_count" />
+ <UML:Attribute comment="NTB sample history (beacon timestamp data and synchronization data being calculated)" isSpecification="false" visibility="public" xmi.id="8nLnUu53vPCa" type="ysHmdByyGThj" name="histo" />
+ <UML:Operation comment="Synchronize local clock to be as close as possible to estimated value of the NTB clock reference (and update the NTB offset in the MAC Config).
+
+pointer to NTB context (ntb_t *ntb_ctx) is needed and found in the CP context passed in argument
+local STA clock is synchronized by adjusting its clock divisor as needed,
+depending on
+
+ - current beacon timestamp (BTS),
+ - SYS-base local receive time of current beacon (SYS LTmr, based on 25 Mhz local clock frequency not adjusted onto CCo clock frequency),
+ - STA-base local receive time of current beacon (STA LTmr, based on 25 Mhz local clock frequency adjusted onto CCo clock frequency)." isSpecification="false" isLeaf="false" visibility="public" xmi.id="bxBBvbAGs7Q5" isRoot="false" isAbstract="false" isQuery="false" name="clk_sync" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="current beacon timestamp (BTS)" isSpecification="false" visibility="private" xmi.id="T1X9Lf2gB76e" value="" type="hz7D2ZH5u80l" name="beacon_bts" />
+ <UML:Parameter comment="SYS local time captured when receiving beacon" isSpecification="false" visibility="private" xmi.id="kNcqVA8WLyXP" value="" type="hz7D2ZH5u80l" name="beacon_sys_ltmr" />
+ <UML:Parameter comment="STA local time captured when receiving beacon" isSpecification="false" visibility="private" xmi.id="1cD3Csl3or7J" value="" type="hz7D2ZH5u80l" name="beacon_sta_ltmr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initialise the NTB clock synchronization manager.
+
+following contexts are needed and found in the CP context passed in argument
+pointer to phy context (phy_t *phy_ctx)
+pointer to mac config (mac_config_t *mac_config)
+returned pointer to allocated ntb context shall be saved in the CP context
+by the calling application to be retrieved through the CP context pointer
+passed in argument to other NTB API function calls" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qHxkg2dtESUh" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Uninitialise the NTB clock synchronization manager.
+
+reset the history of beacon timestamps / NTB data samples
+free the NTB context allocated at init()" isSpecification="false" isLeaf="false" visibility="public" xmi.id="2gQknmKqTzYm" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Set or update NTB offset in the MAC Config." isSpecification="false" isLeaf="false" visibility="private" xmi.id="qKwzHvkVkXXm" isRoot="false" isAbstract="false" isQuery="false" name="update_offset_in_mac_config" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="offset between NTB date (CCo date) and NTB_STA date (station date)" isSpecification="false" visibility="private" xmi.id="qZhzkTw8B1b2" value="" type="O01xtrLMY3S6" name="offset" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Calculate the number of beacons lost (if any) between 2 beacons received." isSpecification="false" isLeaf="false" visibility="private" xmi.id="6HEYTNnWQoGE" isRoot="false" isAbstract="false" isQuery="false" name="get_count_of_lost_beacons" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Qoevq3nkC9QA" type="hz7D2ZH5u80l" />
+ <UML:Parameter comment="difference of BTS timestamp between 2 last received beacons" isSpecification="false" visibility="private" xmi.id="4meWZ9OS6ujN" value="" type="hz7D2ZH5u80l" name="delta_ticks" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="8xImlyaBNYwN" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="8eRxgW93cmvX" aggregation="aggregate" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="IhAHkl6j3n7P" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="fVlZqtZMrzdT" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="68ToBI6JuYGa" aggregation="aggregate" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="2Nbd7WAPCJfw" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="2uIgsGr4ejEG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="2le6WjTcrwR0" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="DVJ73Xg4sHhz" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="0UqhrhEJ8WDS" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="mpOy63s9mUDG" aggregation="aggregate" type="QCdiA5hU9IAb" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Dgr2cI2plJvn" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="HgZ8mwwYQvS4" isRoot="false" isAbstract="false" name="sta_hpav_offset" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tGaBn52o26ZT" isRoot="false" isAbstract="false" name="signed long long" />
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Vd6MhjybKlo7" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="D8szRlmGKbw8" aggregation="composite" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="7cjSeFujcTZU" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="v2bgoPxiwYdm" isRoot="false" isAbstract="false" name="unsigned long long" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="XJ9zosl58k58" isRoot="false" isAbstract="true" name="pratic_registers_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="LfHLbsrMkSNd" initialValue="1000000" type="hz7D2ZH5u80l" name="clock_divisor_numerator" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="XevhFJolmvE4" initialValue="3000000" type="hz7D2ZH5u80l" name="clock_divisor_denominator" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="S1YLpeJh4oXt" isRoot="false" isAbstract="false" name="mac_config_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="c9zEMmXQs8UX" type="hz7D2ZH5u80l" name="ntb_offset_tck" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="JD1yKqZUviuE" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="yjsgJcqe8EHD" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="Z1PTV34DaKYd" aggregation="none" type="S1YLpeJh4oXt" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="Dv7QUbCmB2YY" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="9KtdgsgcaWIt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="67WCLlPsmmMG" aggregation="none" type="XJ9zosl58k58" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ysHmdByyGThj" isRoot="false" isAbstract="false" name="ntb_histo_t" />
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1016" snapy="10" showatts="1" xmi.id="bZ62yFKbgidF" documentation="25Mhz clock management and synchronization functions.
+
+NTB clock management module initialisation
+
+Synchronize local STA clock by adjusting its clock divisor as needed
+(and set or update the NTB offset in the MAC Config)" type="1" showops="1" showpackage="0" name="diagramme de classes" localid="" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="862" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="702" showattsigs="601" x="19" fillcolor="#ffffc0" y="23" showopsigs="601" linewidth="none" height="448" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="QCdiA5hU9IAb" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="665" showattsigs="601" x="19" fillcolor="#ffffc0" y="675" showopsigs="601" linewidth="none" height="128" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="L2ASUCoHdFZ0" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="351" showattsigs="601" x="379" fillcolor="#ffffc0" y="501" drawascircle="0" showopsigs="601" linewidth="none" height="56" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="XJ9zosl58k58" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="209" showattsigs="601" x="305" fillcolor="#ffffc0" y="573" showopsigs="601" linewidth="none" height="40" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="S1YLpeJh4oXt" showoperations="1" showpackage="0" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="4" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="QCdiA5hU9IAb" widgetaid="L2ASUCoHdFZ0" xmi.id="8nLnUu53vPCa" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="185" starty="675" />
+ <endpoint endx="370" endy="471" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="16" x="182" fillcolor="none" y="631" linewidth="none" posttext="" role="701" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="ND5AzROnnpBV" text="1" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="16" x="328" fillcolor="none" y="474" linewidth="none" posttext="" role="702" height="20" usefillcolor="1" pretext="" isinstance="0" xmi.id="l8L30lxgqTxO" text="1" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="47" x="234" fillcolor="none" y="545" linewidth="none" posttext="" role="710" height="20" usefillcolor="1" pretext="+" isinstance="0" xmi.id="i6WIaoAeteqF" showstereotype="1" text="histo" usesdiagramusefillcolor="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="S1YLpeJh4oXt" widgetaid="L2ASUCoHdFZ0" xmi.id="JD1yKqZUviuE" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="351" starty="675" />
+ <endpoint endx="409" endy="613" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="3" totalcountb="2" indexb="1" linewidth="none" widgetbid="XJ9zosl58k58" widgetaid="L2ASUCoHdFZ0" xmi.id="Dv7QUbCmB2YY" type="512" linecolor="none" >
+ <linepath>
+ <startpoint startx="517" starty="675" />
+ <endpoint endx="554" endy="557" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="g2RmQlkG6CqM" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="folder" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="bZ62yFKbgidF" documentation="actions of CCo responsability.
+
+CCo action module implements actions of CCo responsability
+
+manage SNID &quot;collisions&quot; (if SNID conflict, a new SNID value shall be chosen)
+
+manage TEI leases (create, suppress, expire)
+
+manage sta association
+
+manage authentication with relevant keys (NEK, NMK) and security-level
+
+Initialisation of SNID &amp; management of SNID conflicts" uniqueid="Qoevq3nkC9QA" />
+ <listview>
+ <listitem open="1" type="800" label="Vues" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="1" type="803" id="3Vny4m2DHl2U" >
+ <listitem open="0" type="813" id="QCdiA5hU9IAb" >
+ <listitem open="0" type="814" id="9PZYdnDFOfZz" />
+ <listitem open="0" type="814" id="I2w0DZg3Mq2z" />
+ <listitem open="0" type="814" id="2DXPazSjM1H0" />
+ <listitem open="0" type="814" id="ze320s3xsETH" />
+ <listitem open="0" type="814" id="oQkVnlklYCyk" />
+ <listitem open="0" type="814" id="HiveU00Ud1Ud" />
+ <listitem open="0" type="814" id="tVZmk23YSl2D" />
+ <listitem open="0" type="814" id="PZbDOoBbG3Ga" />
+ <listitem open="0" type="814" id="vu1sNip10eTF" />
+ <listitem open="0" type="814" id="12iP2IX4iuZV" />
+ <listitem open="0" type="814" id="TJBC2d791ceG" />
+ <listitem open="0" type="814" id="uph521FYdhgf" />
+ <listitem open="0" type="814" id="aWuXmeAj2r8J" />
+ <listitem open="0" type="814" id="0i5d3BEMdYEu" />
+ <listitem open="0" type="814" id="lg26NjLnDlUL" />
+ <listitem open="0" type="814" id="YLi6zEQnge4L" />
+ <listitem open="0" type="814" id="BXmpzfZGDcVv" />
+ <listitem open="0" type="814" id="HMot9TL3ZMNJ" />
+ <listitem open="0" type="814" id="Vq6eEbIzxkV1" />
+ <listitem open="0" type="814" id="fSsc3eyAlMjO" />
+ <listitem open="0" type="814" id="kfcOO2lh80fL" />
+ <listitem open="0" type="814" id="rrov4443oTJh" />
+ <listitem open="0" type="814" id="iAanwTF1WWI6" />
+ <listitem open="0" type="814" id="MIx3EeGHnNhx" />
+ <listitem open="0" type="814" id="JMKXRzfkAe0M" />
+ <listitem open="0" type="815" id="heL2xof0ahkF" />
+ <listitem open="0" type="815" id="3UBqgc2KKU2C" />
+ </listitem>
+ <listitem open="0" type="813" id="L2ASUCoHdFZ0" >
+ <listitem open="0" type="814" id="tcysk13dBnvN" />
+ <listitem open="0" type="814" id="8nLnUu53vPCa" />
+ <listitem open="0" type="815" id="bxBBvbAGs7Q5" />
+ <listitem open="0" type="815" id="qHxkg2dtESUh" />
+ <listitem open="0" type="815" id="2gQknmKqTzYm" />
+ <listitem open="0" type="815" id="qKwzHvkVkXXm" />
+ <listitem open="0" type="815" id="6HEYTNnWQoGE" />
+ </listitem>
+ </listitem>
+ <listitem open="0" type="807" id="bZ62yFKbgidF" label="diagramme de classes" />
+ <listitem open="0" type="813" id="S1YLpeJh4oXt" >
+ <listitem open="0" type="814" id="c9zEMmXQs8UX" />
+ </listitem>
+ <listitem open="1" type="813" id="ysHmdByyGThj" />
+ <listitem open="0" type="813" id="XJ9zosl58k58" >
+ <listitem open="0" type="814" id="LfHLbsrMkSNd" />
+ <listitem open="0" type="814" id="XevhFJolmvE4" />
+ </listitem>
+ <listitem open="1" type="829" id="tGaBn52o26ZT" />
+ <listitem open="1" type="829" id="HgZ8mwwYQvS4" />
+ <listitem open="1" type="829" id="v2bgoPxiwYdm" />
+ <listitem open="0" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="BsXuVmQldfSS" />
+ <listitem open="1" type="829" id="1lLAIoXrLdtJ" />
+ <listitem open="1" type="829" id="TRzc3eNXqLr1" />
+ <listitem open="1" type="829" id="RTeIWtKTDaZV" />
+ <listitem open="0" type="829" id="vntVp1gw0ZB8" />
+ <listitem open="1" type="829" id="DcaQZXHCYAUY" />
+ <listitem open="1" type="829" id="Shk6a1xmtUeN" />
+ <listitem open="1" type="829" id="l2nnsImcbvsP" />
+ <listitem open="1" type="829" id="WHsGhr6cL3qV" />
+ <listitem open="1" type="829" id="O01xtrLMY3S6" />
+ <listitem open="1" type="829" id="Q4TYO2bRfXJq" />
+ <listitem open="1" type="829" id="G46rjYKTY5EP" />
+ <listitem open="1" type="829" id="aHp7fmMY11yJ" />
+ <listitem open="1" type="829" id="J5WdE6USg2qD" />
+ <listitem open="1" type="829" id="X7Q5Iud3fXPb" />
+ <listitem open="1" type="829" id="QPMsbNxuTUYh" />
+ <listitem open="1" type="829" id="nnvOyvzkSE17" />
+ <listitem open="1" type="829" id="oZHHg64PKBaq" />
+ <listitem open="0" type="829" id="wuDYnfojrSWv" />
+ <listitem open="1" type="829" id="5NqwrUH5XNxE" />
+ <listitem open="1" type="829" id="hz7D2ZH5u80l" />
+ <listitem open="1" type="829" id="tFhSKvrguqen" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="g2RmQlkG6CqM" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/sta/core/inc/core.h b/cesar/cp/sta/core/inc/core.h
new file mode 100644
index 0000000000..233061fbc3
--- /dev/null
+++ b/cesar/cp/sta/core/inc/core.h
@@ -0,0 +1,351 @@
+#ifndef cp_sta_core_inc_core_h
+#define cp_sta_core_inc_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/core/inc/core.h
+ * \brief STA core.
+ * \ingroup cp_sta
+ *
+ * station core module implements following elements and functionalities
+ * *CP thread
+ * *main CP thread wait event loop
+ * station events as eCos event flags
+ * eCos event flag mask initialisation, event masking & unmasking,
+ * categories of events to manage = MME, beacon, FSM and garbage events
+ * garbage collector event flag
+ * manage (set/stop) the garbage collector timer
+ * *garbage collector timer DSR function (activation of the garbage flag,
+ * the garbage collector event flag will be taken into account with the
+ * lowest priority by the main wait event loop)
+ * *in case of garbage flag event activated, garbage collector consists in
+ * freeing "not terminated" MME messages buffers (i.e. MME messages which
+ * were not fully re-assembled, that is, which have a recorded date exceeding
+ * the current date + 1 second)
+ * dispatch a MME message beeing received
+ * in case of MME event flag activated, call the cp_interf() function which
+ * takes the available MME in the Rx FIFO and then calls the msg_dispatch()
+ * function that will post the relevant FSM event in the FSM event FIFO
+ * manage beacon data
+ * in case of beacon event flag activated
+ * implement various utility functions
+ * launch/stop a timer
+ * timer callback function for each sort of timer
+ * API function to put a FSM event in the FSM event FIFO.
+ */
+#include <cyg/kernel/kapi.h>
+#include <cyg/hal/hal_arch.h>
+
+#include "cp/sta/core/core.h"
+#include "cp/sta/core/defs.h"
+
+#include "cp/fsm/forward.h"
+
+#include "cp/types.h"
+
+/** cp sta core thread name string. */
+#define CP_STA_CORE_THREAD_NAME "STA_CORE"
+#define CP_STA_CORE_THREAD_PRIORITY 9 // TODO TO BE DEFINE
+
+/** periodicity of cp sta core garbage collector activation */
+#define CP_STA_CORE_GARBAGE_COLLECTOR_PERIOD_MS 1000
+
+/** cp sta core context data. */
+struct cp_sta_core_t
+{
+ /** eCos real-time clock handle needed
+ * to manage real-time clock timers/alarms. */
+ cyg_handle_t real_time_clock_handle;
+
+ /** eCos counter needed to manage real-time clock timers/alarms. */
+ cyg_handle_t real_time_counter;
+
+ /** eCos event flag used to manage station core events. */
+ cyg_flag_t wait_event_core_flag;
+
+ /** flag controlling the CP sta core thread wait event loop. */
+ bool terminate_flag;
+
+ /** garbage collector timer/event management structure. */
+ cp_sta_core_timed_event_def_t garbage_collector_event;
+
+ /** cp sta core thread resources. */
+ u8 thread_stack[CYGNUM_HAL_STACK_SIZE_TYPICAL];
+ cyg_handle_t thread_handle;
+ cyg_thread thread;
+};
+
+/** Definition for sta core array of (event , action function). */
+struct cp_sta_core_event_action_t
+{
+ cyg_flag_value_t event_flag;
+ void (*func) (cp_t *);
+};
+typedef struct cp_sta_core_event_action_t cp_sta_core_event_action_t;
+
+
+BEGIN_DECLS
+
+/**
+ * process current beacon (nothing else but calling the dedicated function in beacon module).
+ *
+ * \param cp_ctx pointer to control plane context
+ */
+void
+cp_sta_core_run_beacon_processing(cp_t *cp_ctx);
+
+/**
+ * get MME message and process it (nothing else but calling the dedicated CP-CL interface function).
+ *
+ * \param cp_ctx pointer to control plane context
+ */
+void
+cp_sta_core_run_mme_processing(cp_t *cp_ctx);
+
+/**
+ * run the FSM relating to Control-Plane specific operations in HP_AV protocol.
+ *
+ * \param cp_ctx pointer to control plane context
+ */
+void
+cp_sta_core_run_cp_fsm(cp_t *cp_ctx);
+
+/**
+ * HP_AV station global garbage collector.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * 1) perform garbage actions of "sta action" responsibility
+ * this is done by calling cp_sta_action_garbage() function
+ *
+ * 2) if CCo (STA acting as CCo), do garbage actions of CCo's responsability
+ * (like checking TEI leases of STAs belonging to its AVLN and free TEI leases,
+ * that is, remove STAs which have a lease time being elapsed)
+ * this is done (if CCo) by calling cp_cco_action_garbage() function
+ *
+ * 3) perform garbage actions of "sta manager" responsibility
+ * this is done by calling cp_sta_mgr_garbage() function
+ *
+ * 4) Release "not terminated" MME messages buffers (i.e. fragmented MME messages
+ * which were not fully re-assembled, that is, which have their last fragment
+ * receive date older than the garbage period), so, release the buffers relating
+ * to "not terminated" MMEs
+ * this is done by calling the cp_cl_interf_garbage_collector() function
+ *
+ */
+void
+cp_sta_core_garbage_collector(cp_t *cp_ctx);
+
+/**
+ * garbage collector timer DSR (set the relevant event flag).
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * Set the garbage event flag (nothing else to do)
+ */
+void
+cp_sta_core_garbage_collector_timer_dsr(cp_t *cp_ctx);
+
+/**
+ * signal sta core that an FSM event is ready to be processed.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_fsm_event(cp_t *cp_ctx);
+
+/**
+ * signal sta core that garbage collector shall be performed.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_garbage_collector_event(cp_t *cp_ctx);
+
+/**
+ * signal the cp sta core thread to terminate.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_terminate_thread_event(cp_t *cp_ctx);
+
+/**
+ * Convert a time in millisecond to a number of system ticks.
+ *
+ * \param the value to convert
+ * \return the converted value
+ */
+cyg_tick_count_t
+cp_sta_core_ms_to_cyg_tick (const uint ms);
+
+/**
+ * create a core alarm that will generate a one-shot or periodic core event
+ * (with FSM event eventually associated to it and added to the FSM event fifo)
+ * after the specified delay or at the specified period of occurrence.
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_alarm pointer to alarm structure where alarm info will
+ * be stored
+ * \param event_flag the sta core event flag (CP_STA_CORE_EVENT_FLAG_xxx)
+ * when timer elapsed
+ * \param fsm_event the FSM event to set
+ * (when core_event_flag == CP_STA_CORE_EVENT_FLAG_FSM)
+ * \param event_period_or_delay_ms the period or delay of event occurrence
+ * in millisecond
+ * \param cyclic_alarm flag indicating a periodic alarm (if set to true)
+ * or one-shot alarm (if set to false)
+ *
+ * each time the alarm occurs, the specified CP_STA_CORE_EVENT_FLAG_xxx
+ * core event flag is set to be taken into account by the wait-event loop
+ * of the cp sta core thread and, if the core event flag was a
+ * CP_STA_CORE_EVENT_FLAG_FSM, the specified FSM event is added to
+ * the FSM event fifo
+ */
+void
+cp_sta_core_gen_core_alarm(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_alarm,
+ cp_sta_core_event_flag_t event_flag,
+ cp_fsm_event_t *fsm_event,
+ uint event_period_or_delay_ms,
+ bool cyclic_alarm);
+
+/**
+ * create a core alarm that will generate a cyclic core event (with FSM
+ * event eventually associated to it and added to the FSM event fifo)
+ * at the specified period of occurrence.
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_cyclic_event pointer to cyclic event structure where cyclic
+ * event info will be stored
+ * \param event_flag the sta core event flag (CP_STA_CORE_EVENT_FLAG_xxx)
+ * set each time the timer elapses
+ * \param fsm_event the FSM event to set
+ * (when core_event_flag == CP_STA_CORE_EVENT_FLAG_FSM)
+ * \param event_period_ms the period of event re-occurrence in millisecond
+ *
+ * each time the alarm occurs, the specified CP_STA_CORE_EVENT_FLAG_xxx
+ * core event flag is set to be taken into account by the wait-event loop
+ * of the cp sta core thread and, if the core event flag was a
+ * CP_STA_CORE_EVENT_FLAG_FSM,the specified FSM event is added to the FSM event fifo
+ */
+extern inline void
+cp_sta_core_gen_core_cyclic_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_cyclic_event,
+ cp_sta_core_event_flag_t event_flag,
+ cp_fsm_event_t *fsm_event,
+ uint event_period_ms)
+{
+ cp_sta_core_gen_core_alarm( cp_ctx,
+ sta_core_cyclic_event,
+ event_flag,
+ fsm_event,
+ event_period_ms,
+ true
+ );
+}
+
+/**
+ * create a core alarm that will generate a core event (with FSM event eventually
+ * associated to it and added to the FSM event fifo) after the specified delay.
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_timed_event pointer to timed_event structure where timed
+ * event info will be stored
+ * \param event_flag the sta core event flag
+ * (CP_STA_CORE_EVENT_FLAG_xxx) when timer elapsed
+ * \param fsm_event the FSM event to set
+ * (when core_event_flag == CP_STA_CORE_EVENT_FLAG_FSM)
+ * \param event_delay_ms the amount of time to wait in millisecond
+ *
+ * when timer elapsed, the specified CP_STA_CORE_EVENT_FLAG_xxx
+ * core event flag will be set to be taken into account by the
+ * wait-event loop of the cp sta core thread and, if the core
+ * event flag was a CP_STA_CORE_EVENT_FLAG_FSM, the specified
+ * FSM event is added to the FSM event fifo
+ */
+extern inline void
+cp_sta_core_gen_core_timed_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_sta_core_event_flag_t event_flag,
+ cp_fsm_event_t *fsm_event,
+ uint event_delay_ms)
+{
+ cp_sta_core_gen_core_alarm( cp_ctx,
+ sta_core_timed_event,
+ event_flag,
+ fsm_event,
+ event_delay_ms,
+ false
+ );
+}
+
+/**
+ * this function is called when a one-shot alarm, created with
+ * cp_sta_core_gen_core_timed_event() private function or
+ * cp_sta_core_gen_timed_event() public function, has elapsed or when
+ * a cyclic alarm, created with cp_sta_core_gen_core_cyclic_event() private function
+ * or cp_sta_core_gen_user_cyclic_event() public function, occurs.
+ *
+ * \param alarm handle to the alarm
+ * \param data pointer to alarm info structure relating to occurring alarm
+ *
+ * see eCos manual about alarm
+ * warning : this function is called in DSR context
+ */
+void
+cp_sta_core_alarm_handler(cyg_handle_t alarm, cyg_addrword_t data);
+
+/**
+ * prepare to quit station core main wait event loop.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_quit_wait_event_loop(cp_t *cp_ctx);
+
+/**
+ * station core main wait event loop.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * 1) init the garbage collector timer (1 minute period)
+ *
+ * 2) Waits for possible events set in the CP thread eCos event flag
+ * (an eCos event flag that we allocate/dedicate explicitely to the CP thread
+ * for that purpose), according to the current event mask enabling one or more
+ * of the possible events to be set
+ *
+ * The order in which events are taken into account in the event flag
+ * acts as event priority order, we must be careful with that
+ */
+void
+cp_sta_core_wait_event_loop(cp_t *cp_ctx);
+
+/**
+ * main CP thread (Control-Plane station core thread).
+ *
+ * \param data thread entry data
+ *
+ * 1) evaluate (and, eventually set arbitrary) power-line frequency,
+ * which gives the beacon period (33ms for 60Hz, 40ms for 50Hz,
+ * and 40ms if COAX cable, that is, 0Hz considered as if 50Hz)
+ * This is done by calling cp_pwl_acl_frequency_detection()
+ *
+ * 2) call the station core wait event loop
+ */
+void
+cp_sta_core_cp_thread(cyg_addrword_t data);
+
+END_DECLS
+
+#endif /* cp_sta_core_inc_core_h */
diff --git a/cesar/cp/sta/core/src/core.c b/cesar/cp/sta/core/src/core.c
new file mode 100644
index 0000000000..f9510510b8
--- /dev/null
+++ b/cesar/cp/sta/core/src/core.c
@@ -0,0 +1,613 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/core/src/core.c
+ * \brief STA core.
+ * \ingroup cp_sta
+ *
+ * station core module implements following elements and functionalities
+ * *CP thread
+ * *main CP thread wait event loop
+ * station events as eCos event flags
+ * eCos event flag mask initialisation, event masking & unmasking,
+ * categories of events to manage = MME, beacon, FSM and garbage events
+ * garbage collector event flag
+ * manage (set/stop) the garbage collector timer
+ * *garbage collector timer DSR function (activation of the garbage flag,
+ * the garbage collector event flag will be taken into account with the
+ * lowest priority by the main wait event loop)
+ * *in case of garbage flag event activated, garbage collector consists in
+ * freeing "not terminated" MME messages buffers (i.e. MME messages which
+ * were not fully re-assembled, that is, which have a recorded date exceeding
+ * the current date + 1 second)
+ * dispatch a MME message beeing received
+ * in case of MME event flag activated, call the cp_interf() function which
+ * takes the available MME in the Rx FIFO and then calls the msg_dispatch()
+ * function that will post the relevant FSM event in the FSM event FIFO
+ * manage beacon data
+ * in case of beacon event flag activated
+ * implement various utility functions
+ * launch/stop a timer
+ * timer callback function for each sort of timer
+ * API function to put a FSM event in the FSM event FIFO.
+ */
+#include "common/std.h"
+#include "cp/types.h"
+
+#include "cp/inc/context.h"
+#include "cp/fsm/fsm.h"
+#include "cp_fsm_defs.h"
+
+#include "cp/sta/core/defs.h"
+
+#include "cp/cl_interf/cl_interf.h"
+#include "cp/sta/action/action.h"
+#include "cp/cco/action/cco_action.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/pwl/pwl.h"
+
+#include "cp/sta/core/inc/core.h"
+
+/** array of cp sta core events/actions. */
+static const cp_sta_core_event_action_t cp_sta_core_event_action[] =
+{
+ /* this calls cp_beacon_get_and_process_beacon(), and
+ * TODO (?) : add beacon event to FSM event FIFO ?
+ */
+ { CP_STA_CORE_EVENT_FLAG_RECV_BEACON, cp_sta_core_run_beacon_processing },
+ /* this calls cp_cl_interf_give_last_mme() */
+ { CP_STA_CORE_EVENT_FLAG_RECV_MME, cp_sta_core_run_mme_processing },
+ /* call CP FSM... */
+ { CP_STA_CORE_EVENT_FLAG_FSM, cp_sta_core_run_cp_fsm },
+ /* global CP garbage collector */
+ { CP_STA_CORE_EVENT_FLAG_GARBAGE, cp_sta_core_garbage_collector },
+ /* terminate CP thread */
+ { CP_STA_CORE_EVENT_FLAG_TERMINATE, cp_sta_core_quit_wait_event_loop }
+};
+
+/**
+ * initialisation of station core.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * 1) init the real-time clock
+ * 2) init the (wait) event flags
+ * 3) create & launch the cp sta core thread
+ */
+void
+cp_sta_core_init(cp_t *ctx)
+{
+ dbg_assert(ctx);
+
+ // init the real-time clock counter
+ ctx->sta_core.real_time_clock_handle = cyg_real_time_clock ();
+ cyg_clock_to_counter (ctx->sta_core.real_time_clock_handle,
+ &ctx->sta_core.real_time_counter);
+
+ // init the event flags
+ cyg_flag_init (&ctx->sta_core.wait_event_core_flag);
+
+#ifndef STA_CORE_UNIT_TEST
+ // create and launch the CP sta core thread
+ cyg_thread_create (
+ CP_STA_CORE_THREAD_PRIORITY,
+ &cp_sta_core_cp_thread,
+ (cyg_addrword_t)ctx,
+ CP_STA_CORE_THREAD_NAME,
+ ctx->sta_core.thread_stack,
+ sizeof(ctx->sta_core.thread_stack),
+ &ctx->sta_core.thread_handle,
+ &ctx->sta_core.thread
+ );
+
+ cyg_thread_resume (ctx->sta_core.thread_handle);
+
+#endif /* STA_CORE_UNIT_TEST */
+}
+
+/**
+ * un-initialisation of station core.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * Makes the cp sta core thread terminate and free resources.
+ */
+void
+cp_sta_core_uninit(cp_t *cp_ctx)
+{
+ dbg_assert(cp_ctx);
+ cp_sta_core_signal_terminate_thread_event(cp_ctx);
+}
+
+/**
+ * signal sta core that a beacon has been received.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_recv_beacon_event(cp_t *cp_ctx)
+{
+ dbg_assert(cp_ctx);
+ cyg_flag_setbits (&cp_ctx->sta_core.wait_event_core_flag,
+ CP_STA_CORE_EVENT_FLAG_RECV_BEACON);
+}
+
+/**
+ * signal sta core that a MME message has been received.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_recv_mme_event(cp_t *cp_ctx)
+{
+ dbg_assert(cp_ctx);
+ cyg_flag_setbits (&cp_ctx->sta_core.wait_event_core_flag,
+ CP_STA_CORE_EVENT_FLAG_RECV_MME);
+}
+
+/**
+ * signal sta core that an FSM event is ready to be processed.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_fsm_event(cp_t *cp_ctx)
+{
+ dbg_assert(cp_ctx);
+ cyg_flag_setbits (&cp_ctx->sta_core.wait_event_core_flag,
+ CP_STA_CORE_EVENT_FLAG_FSM);
+}
+
+/**
+ * signal sta core that garbage collector shall be performed.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_garbage_collector_event(cp_t *cp_ctx)
+{
+ dbg_assert(cp_ctx);
+ cyg_flag_setbits (&cp_ctx->sta_core.wait_event_core_flag,
+ CP_STA_CORE_EVENT_FLAG_GARBAGE);
+}
+
+/**
+ * signal the cp sta core thread to terminate.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_signal_terminate_thread_event(cp_t *cp_ctx)
+{
+ dbg_assert(cp_ctx);
+ cyg_flag_setbits (&cp_ctx->sta_core.wait_event_core_flag,
+ CP_STA_CORE_EVENT_FLAG_TERMINATE);
+}
+
+/**
+ * Convert a time in ms to a number of system ticks.
+ *
+ * \param the value to convert
+ * \return the converted value
+ */
+cyg_tick_count_t
+cp_sta_core_ms_to_cyg_tick (const uint ms)
+{
+ cyg_resolution_t resolution;
+ cyg_tick_count_t return_value;
+
+ return_value = ms;
+ // convert it from ms to ns
+ return_value *= 1000000;
+ // and then convert it to system ticks
+ resolution = cyg_clock_get_resolution (cyg_real_time_clock ());
+ return_value *= resolution.divisor;
+ return_value /= resolution.dividend;
+ return return_value;
+}
+
+/**
+ * create a core alarm that will generate a one-shot or periodic core event
+ * (with FSM event eventually associated to it and added to the FSM event fifo)
+ * after the specified delay or at the specified period of occurrence.
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_alarm pointer to alarm structure where alarm info will be stored
+ * \param event_flag the sta core event flag (CP_STA_CORE_EVENT_FLAG_xxx)
+ * when timer elapsed
+ * \param fsm_event the FSM event to set
+ * (when core_event_flag == CP_STA_CORE_EVENT_FLAG_FSM)
+ * \param event_period_or_delay_ms the period or delay of event occurrence in millisecond
+ * \param cyclic_alarm flag indicating a periodic alarm (if set to true)
+ * or one-shot alarm (if set to false)
+ *
+ * each time the alarm occurs, the specified CP_STA_CORE_EVENT_FLAG_xxx
+ * core event flag is set to be taken into account by the wait-event loop
+ * of the cp sta core thread and, if the core event flag was a CP_STA_CORE_EVENT_FLAG_FSM,
+ * the specified FSM event is added to the FSM event fifo
+ */
+void
+cp_sta_core_gen_core_alarm(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_alarm,
+ cp_sta_core_event_flag_t event_flag,
+ cp_fsm_event_t *fsm_event,
+ uint event_period_or_delay_ms,
+ bool cyclic_alarm)
+{
+ cyg_tick_count_t trigger_time;
+
+ dbg_assert(cp_ctx);
+ dbg_assert(sta_core_alarm);
+ dbg_assert(event_flag);
+
+ // create the alarm
+ cyg_alarm_create ( cp_ctx->sta_core.real_time_counter,
+ cp_sta_core_alarm_handler,
+ (cyg_addrword_t)sta_core_alarm,
+ &sta_core_alarm->alarm_handle,
+ &sta_core_alarm->alarm
+ );
+ sta_core_alarm->event_flag = event_flag;
+ sta_core_alarm->fsm_event = fsm_event;
+ sta_core_alarm->cyclic_alarm = cyclic_alarm;
+ sta_core_alarm->cp_ctx = cp_ctx;
+
+ // initialize the alarm
+ trigger_time = cp_sta_core_ms_to_cyg_tick(event_period_or_delay_ms)
+ + cyg_current_time();
+ if (cyclic_alarm)
+ {
+ cyg_alarm_initialize(sta_core_alarm->alarm_handle,
+ trigger_time,
+ cp_sta_core_ms_to_cyg_tick(event_period_or_delay_ms));
+ }
+ else
+ {
+ cyg_alarm_initialize(sta_core_alarm->alarm_handle, trigger_time, 0);
+ }
+}
+
+/**
+ * create a cyclic alarm that will generate a cp sta core event
+ * and associated (specified) FSM event at the given period of occurrence.
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_cyclic_event pointer to cyclic event structure where cyclic
+ * event info will be stored
+ * \param fsm_event the FSM event to set
+ * \param event_period_ms the period of event re-occurrence in millisecond
+ *
+ * when timer elapsed the specified FSM event will be added to the FSM fifo
+ * and a CP_STA_CORE_EVENT_FLAG_FSM core event will be set to be taken into account
+ * by the wait-event loop of the cp sta core thread
+ */
+void
+cp_sta_core_gen_cyclic_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_cyclic_event,
+ cp_fsm_event_t *fsm_event,
+ uint event_period_ms)
+{
+ dbg_assert(cp_ctx);
+ dbg_assert(sta_core_cyclic_event);
+ dbg_assert(fsm_event);
+
+ cp_sta_core_gen_core_cyclic_event(cp_ctx,
+ sta_core_cyclic_event,
+ CP_STA_CORE_EVENT_FLAG_FSM,
+ fsm_event,
+ event_period_ms);
+}
+
+/**
+ * create a one-shot alarm that will generate a cp sta core event
+ * and associated (specified) FSM event after the specified delay.
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_timed_event pointer to timed event structure where timed
+ * event info will be stored
+ * \param fsm_event the FSM event to set
+ * \param event_delay_ms the amount of time to wait in millisecond
+ *
+ * when timer elapsed the specified FSM event will be added to the FSM fifo
+ * and a CP_STA_CORE_EVENT_FLAG_FSM core event will be set to be taken into account
+ * by the wait-event loop of the cp sta core thread
+ */
+void
+cp_sta_core_gen_timed_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event,
+ cp_fsm_event_t *fsm_event,
+ uint event_delay_ms)
+{
+ dbg_assert(cp_ctx);
+ dbg_assert(sta_core_timed_event);
+ dbg_assert(fsm_event);
+
+ cp_sta_core_gen_core_timed_event(cp_ctx,
+ sta_core_timed_event,
+ CP_STA_CORE_EVENT_FLAG_FSM,
+ fsm_event,
+ event_delay_ms);
+}
+
+/**
+ * will stop (disable and delete) an alarm previously created with
+ * cp_sta_core_gen_timed_event(),
+ * cp_sta_core_gen_cyclic_event(), or an alarm previously created internally
+ * by sta core with cp_sta_core_gen_core_timed_event()
+ * or cp_sta_core_gen_core_cyclic_event().
+ *
+ * \param cp_ctx pointer to control plane context
+ * \param sta_core_timed_event pointer to timed or cyclic event info structure
+ */
+void
+cp_sta_core_stop_timed_or_cyclic_event(cp_t *cp_ctx,
+ cp_sta_core_timed_event_def_t *sta_core_timed_event)
+{
+ dbg_assert(cp_ctx);
+ dbg_assert(sta_core_timed_event);
+
+
+ // disable and delete alarm
+ cyg_alarm_disable(sta_core_timed_event->alarm_handle);
+ cyg_alarm_delete(sta_core_timed_event->alarm_handle);
+
+ // resetting alarm handle (useful for detection by external garbage collector)
+ sta_core_timed_event->alarm_handle = (cyg_handle_t)0;
+}
+
+/**
+ * Get the current clock in milliseconds.
+ * \param ctx the CP context.
+ * \return the current date in milliseconds
+ *
+ * This returns the current eCos system tick counter converted to milliseconds.
+ */
+u32
+cp_sta_core_get_date_ms (cp_t *ctx)
+{
+ return cyg_current_time() *
+ ((cyg_clock_get_resolution(cyg_real_time_clock()).dividend
+ / cyg_clock_get_resolution(cyg_real_time_clock()).divisor)
+ / 1000000);
+}
+
+/**
+ * this function is called when a one-shot alarm, created with
+ * cp_sta_core_gen_core_timed_event() private function or
+ * cp_sta_core_gen_timed_event() public function, has elapsed or when
+ * a cyclic alarm, created with cp_sta_core_gen_core_cyclic_event() private function
+ * or cp_sta_core_gen_user_cyclic_event() public function, occurs.
+ *
+ * \param alarm handle to the alarm
+ * \param data pointer to alarm info structure relating to occurring alarm
+ *
+ * see eCos manual about alarm
+ * warning : this function is called in DSR context
+ */
+void
+cp_sta_core_alarm_handler(cyg_handle_t alarm, cyg_addrword_t data)
+{
+ cp_sta_core_timed_event_def_t *sta_core_alarm;
+
+ dbg_assert(data);
+ sta_core_alarm = (cp_sta_core_timed_event_def_t *)data;
+ dbg_assert(sta_core_alarm->cp_ctx);
+
+ // depending on elapsed timer, signal sta core wait-event loop
+ // with relevant core event
+ switch (sta_core_alarm->event_flag)
+ {
+ case CP_STA_CORE_EVENT_FLAG_FSM: // user timer => generate the associated FSM event
+ // (1) add the FSM event in the FSM event FIFO
+ cp_fsm_post(sta_core_alarm->cp_ctx, sta_core_alarm->fsm_event);
+ // (2) signal the relevant sta core event
+ cp_sta_core_signal_fsm_event(sta_core_alarm->cp_ctx);
+ break;
+
+ case CP_STA_CORE_EVENT_FLAG_GARBAGE: // sta core garbage collector timer
+ // signal the relevant sta core event
+ cp_sta_core_signal_garbage_collector_event(sta_core_alarm->cp_ctx);
+ break;
+ default: // (should never happen !)
+ dbg_assert (0);
+ break;
+ }
+
+ if (!sta_core_alarm->cyclic_alarm
+ && ((sta_core_alarm->event_flag == CP_STA_CORE_EVENT_FLAG_FSM)
+ || (sta_core_alarm->event_flag == CP_STA_CORE_EVENT_FLAG_GARBAGE)))
+ {
+ cyg_alarm_delete(sta_core_alarm->alarm_handle);
+ // resetting alarm handle (useful for detection by external garbage collector)
+ sta_core_alarm->alarm_handle = (cyg_handle_t)0;
+ }
+}
+
+/**
+ * process current beacon (nothing else but calling the dedicated function in beacon module).
+ *
+ * \param cp_ctx pointer to control plane context
+ */
+void
+cp_sta_core_run_beacon_processing(cp_t *cp_ctx)
+{
+ // call the dedicated function in beacon module
+ cp_beacon_get_and_process_beacon(cp_ctx);
+}
+
+/**
+ * get MME message and process it
+ * (nothing else but calling the dedicated CP-CL interface function).
+ *
+ * \param cp_ctx pointer to control plane context
+ */
+void
+cp_sta_core_run_mme_processing(cp_t *cp_ctx)
+{
+ /* call the dedicated function in CP-CL interface module */
+ cp_cl_interf_process_mme (cp_ctx);
+}
+
+/**
+ * run the FSM relating to Control-Plane specific operations in HP_AV protocol.
+ *
+ * \param cp_ctx pointer to control plane context
+ */
+void
+cp_sta_core_run_cp_fsm(cp_t *cp_ctx)
+{
+ cp_fsm_process(cp_ctx);
+}
+
+/**
+ * HP_AV station global garbage collector.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * 1) perform garbage actions of "sta action" responsibility
+ * this is done by calling cp_sta_action_garbage() function
+ *
+ * 2) if CCo (STA acting as CCo), do garbage actions of CCo's responsability
+ * (like checking TEI leases of STAs belonging to its AVLN and free TEI leases,
+ * that is, remove STAs which have a lease time being elapsed)
+ * this is done (if CCo) by calling cp_cco_action_garbage() function
+ *
+ * 3) perform garbage actions of "sta manager" responsibility
+ * this is done by calling cp_sta_mgr_garbage() function
+ *
+ * 4) Release "not terminated" MME messages buffers (i.e. fragmented MME messages
+ * which were not fully re-assembled, that is, which have their last fragment
+ * receive date older than the garbage period), so, release the buffers relating
+ * to "not terminated" MMEs
+ * this is done by calling the cp_cl_interf_garbage_collector() function
+ *
+ */
+void
+cp_sta_core_garbage_collector(cp_t *cp_ctx)
+{
+ dbg_assert(cp_ctx);
+ cp_sta_action_garbage(cp_ctx);
+ cp_cco_action_garbage(cp_ctx);
+ cp_sta_mgr_garbage(cp_ctx);
+ cp_cl_interf_garbage_collector(cp_ctx);
+}
+
+/**
+ * prepare to quit station core main wait event loop.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ */
+void
+cp_sta_core_quit_wait_event_loop(cp_t *cp_ctx)
+{
+ cp_ctx->sta_core.terminate_flag = true;
+}
+
+/**
+ * station core main wait event loop.
+ *
+ * \param cp_ctx pointer to control plane context
+ *
+ * 1) init the garbage collector timer (1 minute period)
+ *
+ * 2) Waits for possible events set in the CP thread eCos event flag
+ * (an eCos event flag that we allocate/dedicate explicitely to the CP thread
+ * for that purpose), according to the current event mask enabling one or more
+ * of the possible events to be set
+ *
+ * The order in which events are taken into account in the event flag
+ * acts as event priority order, we must be careful with that
+ */
+void
+cp_sta_core_wait_event_loop(cp_t *cp_ctx)
+{
+ cyg_flag_value_t flag_value, flag_mask;
+ uint i;
+
+ dbg_assert(cp_ctx);
+
+ // create the flag mask
+ flag_mask = 0;
+ for(i = 0; i < COUNT(cp_sta_core_event_action); i++)
+ {
+ flag_mask |= cp_sta_core_event_action[i].event_flag;
+ }
+
+ // init the garbage collector periodic event timer
+ cp_sta_core_gen_core_cyclic_event (cp_ctx,
+ &cp_ctx->sta_core.garbage_collector_event,
+ CP_STA_CORE_EVENT_FLAG_GARBAGE,
+ NULL,
+ CP_STA_CORE_GARBAGE_COLLECTOR_PERIOD_MS);
+
+ // wait-event loop
+ cp_ctx->sta_core.terminate_flag = false;
+ while (!cp_ctx->sta_core.terminate_flag)
+ {
+ // wait for a cp sta core event
+ flag_value = cyg_flag_wait (&cp_ctx->sta_core.wait_event_core_flag, flag_mask, CYG_FLAG_WAITMODE_OR | CYG_FLAG_WAITMODE_CLR );
+ // process the event(s) in respect of event category priority order
+ // priority 0 = BEACON recv event (highest priority, NTB clock sync depends on this!)
+ // priority 1 = MME recv event
+ // priority 2 = some event ready to be processed in the FSM (can be due to a user application timer being elapsed)
+ // priority 3 = garbage collector event (garbage timer elapsed = lowest priority)
+ // priority 4 = request for CP station core thread termination
+ for (i = 0; i < COUNT (cp_sta_core_event_action); i++)
+ {
+ if (flag_value & cp_sta_core_event_action[i].event_flag)
+ {
+ // we find an event, so we clear it
+ //cyg_flag_maskbits (&cp_ctx->sta_core.wait_event_core_flag, ~cp_sta_core_event_action[i].event_flag);
+ flag_value &= ~cp_sta_core_event_action[i].event_flag;
+ // and then we process it
+ if ( cp_sta_core_event_action[i].func == NULL)
+ {
+ //dbg_assert (cp_sta_core_event_action[i].func);
+ }
+ else
+ cp_sta_core_event_action[i].func (cp_ctx);
+ break;
+ }
+ }
+ cyg_flag_setbits(&cp_ctx->sta_core.wait_event_core_flag,flag_value);
+ }
+ cp_sta_core_stop_timed_or_cyclic_event(cp_ctx,
+ &cp_ctx->sta_core.garbage_collector_event);
+ cyg_flag_destroy(&cp_ctx->sta_core.wait_event_core_flag);
+}
+
+/**
+ * main CP thread (Control-Plane station core thread).
+ *
+ * \param data thread entry data
+ *
+ * 1) evaluate (and, eventually set arbitrary) power-line frequency,
+ * which gives the beacon period (33ms for 60Hz, 40ms for 50Hz,
+ * and 40ms if COAX cable, that is, 0Hz considered as if 50Hz)
+ * This is done by calling cp_pwl_acl_frequency_detection()
+ *
+ * 2) call the station core wait event loop
+ */
+void cp_sta_core_cp_thread(cyg_addrword_t data)
+{
+ cp_t *cp_ctx = (cp_t *)data;
+
+ dbg_assert(data);
+
+ // Power-Line frequency detection (50Hz or 60Hz)
+ cp_pwl_acl_frequency_detection(cp_ctx);
+
+ // run the wait-event loop of the thread...
+ cp_sta_core_wait_event_loop(cp_ctx);
+}
diff --git a/cesar/cp/sta/core/test/Makefile b/cesar/cp/sta/core/test/Makefile
new file mode 100644
index 0000000000..e8eeec55f8
--- /dev/null
+++ b/cesar/cp/sta/core/test/Makefile
@@ -0,0 +1,21 @@
+BASE = ../../../..
+
+DEFS = -DSTA_CORE_UNIT_TEST=1
+ECOS = y
+
+INCLUDES = cp/sta/core/test/override
+
+TARGET_PROGRAMS = core_events core core_thread
+
+core_events_SOURCES = core_events.c fsm_stub.c cp_cl_interf_stub.c action_stub.c \
+ cco_action_stub.c sta_mgr_stub.c pwl_stub.c beacon_stub.c
+core_events_MODULES = lib cp/sta/core
+
+core_SOURCES = core.c cp_cl_interf_stub.c action_stub.c \
+ cco_action_stub.c sta_mgr_stub.c pwl_stub.c beacon_stub.c
+core_MODULES = lib cp/sta/core
+
+core_thread_SOURCES = core_thread.c
+core_thread_MODULES = lib cp/sta/core
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/sta/core/test/ecos.ecc.sh b/cesar/cp/sta/core/test/ecos.ecc.sh
new file mode 100644
index 0000000000..2443d0e40f
--- /dev/null
+++ b/cesar/cp/sta/core/test/ecos.ecc.sh
@@ -0,0 +1,5 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new linux default
+cat >> $config <<'EOF'
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/cp/sta/core/test/override/cp2/inc/context.h b/cesar/cp/sta/core/test/override/cp2/inc/context.h
new file mode 100644
index 0000000000..bee6fa2e00
--- /dev/null
+++ b/cesar/cp/sta/core/test/override/cp2/inc/context.h
@@ -0,0 +1,27 @@
+#ifndef override_cp_cp_h
+#define override_cp_cp_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file override/cp/cp.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "cp/sta/core/core.h"
+#include "cp/sta/core/inc/core.h"
+
+#include "cp/sta/core/defs.h"
+
+struct cp_t
+{
+ cp_sta_core_t sta_core;
+};
+
+#endif /* override_cp_cp_h */
diff --git a/cesar/cp/sta/core/test/override/cp_fsm_defs.h b/cesar/cp/sta/core/test/override/cp_fsm_defs.h
new file mode 100644
index 0000000000..e8364b6da9
--- /dev/null
+++ b/cesar/cp/sta/core/test/override/cp_fsm_defs.h
@@ -0,0 +1,40 @@
+#ifndef overide_cp_fsm_defs_h
+#define overide_cp_fsm_defs_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp_fsm_defs.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_all_sta_leaved,
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict,
+ CP_FSM_EVENT_TYPE_BEACON_TIMER_EXPIRES,
+ CP_FSM_EVENT_TYPE_BEACON
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* overide_cp_fsm_defs_h */
diff --git a/cesar/cp/sta/core/test/src/action_stub.c b/cesar/cp/sta/core/test/src/action_stub.c
new file mode 100644
index 0000000000..066c0815bf
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/action_stub.c
@@ -0,0 +1,23 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/action_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/sta/action/action.h"
+
+void
+cp_sta_action_garbage (cp_t *ctx)
+{
+}
+
diff --git a/cesar/cp/sta/core/test/src/beacon_stub.c b/cesar/cp/sta/core/test/src/beacon_stub.c
new file mode 100644
index 0000000000..d91490f6c4
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/beacon_stub.c
@@ -0,0 +1,22 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/beacon_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+
+void
+cp_beacon_get_and_process_beacon(cp_t *ctx)
+{
+}
diff --git a/cesar/cp/sta/core/test/src/cco_action_stub.c b/cesar/cp/sta/core/test/src/cco_action_stub.c
new file mode 100644
index 0000000000..cc9c9d988c
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/cco_action_stub.c
@@ -0,0 +1,28 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/cco_action_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+#include "cp/cco/action/cco_action.h"
+
+/**
+ * perform garbage actions of CCo's responsibility.
+ * \param ctx the module context.
+ */
+void
+cp_cco_action_garbage (cp_t *ctx)
+{
+}
+
diff --git a/cesar/cp/sta/core/test/src/core.c b/cesar/cp/sta/core/test/src/core.c
new file mode 100644
index 0000000000..b80be01f74
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/core.c
@@ -0,0 +1,200 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/core.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include <cyg/kernel/kapi.h>
+#include <cyg/hal/hal_arch.h>
+
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/blk.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/sta/core/core.h"
+#include "cp/sta/core/inc/core.h"
+#include "cp/fsm/forward.h"
+#include "cp/fsm/inc/events.h"
+
+static cp_t ctx;
+
+static bool test_fsm_post;
+
+void
+test_case_core_alarm (test_t test)
+{
+ cp_sta_core_timed_event_def_t sta_core_alarm;
+ cp_sta_core_event_flag_t event_flag;
+ cp_fsm_event_t fsm_event;
+ uint event_period_or_delay_ms;
+ bool cyclic_alarm;
+
+ test_case_begin (test, "Core Alarm");
+
+ test_begin (test, "Core alarm create")
+ {
+ cp_sta_core_init (&ctx);
+
+ memset (&sta_core_alarm, 0, sizeof (cp_sta_core_timed_event_def_t));
+
+ event_flag = CP_STA_CORE_EVENT_FLAG_FSM;
+ event_period_or_delay_ms = 10;
+ cyclic_alarm = true;
+
+ cp_sta_core_gen_core_alarm (&ctx, &sta_core_alarm,
+ event_flag,
+ &fsm_event,
+ event_period_or_delay_ms,
+ cyclic_alarm);
+
+ test_fail_if (sta_core_alarm.event_flag != event_flag);
+ test_fail_if (sta_core_alarm.fsm_event != &fsm_event);
+ test_fail_if (sta_core_alarm.cyclic_alarm != cyclic_alarm);
+ test_fail_if (sta_core_alarm.alarm_handle == 0);
+ }
+ test_end;
+
+ test_case_begin (test, "Stop Alarm");
+
+ test_begin (test, "Check data")
+ {
+ cp_sta_core_stop_timed_or_cyclic_event (&ctx, &sta_core_alarm);
+ test_fail_if (sta_core_alarm.alarm_handle != 0);
+ }
+ test_end;
+}
+
+void
+test_suite_core_alarm (test_t test)
+{
+ cp_sta_core_timed_event_def_t sta_core_alarm;
+ uint flag;
+
+ test_suite_begin (test, "Alarm handler");
+
+ test_case_begin (test, "FSM");
+
+ test_begin (test, "FSM Alarm create")
+ {
+ cp_sta_core_init (&ctx);
+
+ memset (&sta_core_alarm, 0, sizeof (cp_sta_core_timed_event_def_t));
+ test_fsm_post = false;
+
+ sta_core_alarm.event_flag = CP_STA_CORE_EVENT_FLAG_FSM;
+ sta_core_alarm.cyclic_alarm = true;
+ sta_core_alarm.cp_ctx = &ctx;
+ cp_sta_core_alarm_handler (sta_core_alarm.alarm_handle,
+ (cyg_addrword_t) &sta_core_alarm);
+
+ test_fail_if (test_fsm_post == false);
+ flag = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag != CP_STA_CORE_EVENT_FLAG_FSM);
+ }
+ test_end;
+
+ test_case_begin (test, "Garbage");
+
+ test_begin (test, "garbage Alarm create")
+ {
+ cp_sta_core_init (&ctx);
+
+ memset (&sta_core_alarm, 0, sizeof (cp_sta_core_timed_event_def_t));
+
+ sta_core_alarm.event_flag = CP_STA_CORE_EVENT_FLAG_GARBAGE;
+ sta_core_alarm.cyclic_alarm = true;
+ sta_core_alarm.cp_ctx = &ctx;
+ cp_sta_core_alarm_handler (sta_core_alarm.alarm_handle,
+ (cyg_addrword_t) &sta_core_alarm);
+
+ flag = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag != CP_STA_CORE_EVENT_FLAG_GARBAGE);
+ }
+ test_end;
+
+ test_case_begin (test, "Core Alarm");
+
+ test_begin (test, "Core alarm create")
+ {
+ cp_sta_core_event_flag_t event_flag;
+ cp_fsm_event_t fsm_event;
+
+ cp_sta_core_init (&ctx);
+
+ memset (&sta_core_alarm, 0, sizeof (cp_sta_core_timed_event_def_t));
+
+ event_flag = CP_STA_CORE_EVENT_FLAG_FSM;
+
+ cp_sta_core_gen_core_alarm (&ctx, &sta_core_alarm,
+ event_flag,
+ &fsm_event,
+ 10,
+ false);
+
+ test_fail_if (sta_core_alarm.event_flag != event_flag);
+ test_fail_if (sta_core_alarm.fsm_event != &fsm_event);
+ test_fail_if (sta_core_alarm.cyclic_alarm != false);
+ test_fail_if (sta_core_alarm.alarm_handle == 0);
+
+ cp_sta_core_alarm_handler (sta_core_alarm.alarm_handle,
+ (cyg_addrword_t) &sta_core_alarm);
+
+ flag = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag != CP_STA_CORE_EVENT_FLAG_FSM);
+ test_fail_if (sta_core_alarm.alarm_handle != 0);
+ }
+ test_end;
+}
+
+int
+cyg_user_start (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_core_alarm (test);
+ test_suite_core_alarm (test);
+
+ test_case_begin (test, "Memory");
+ test_begin (test, "Verify memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true);
+ }
+ test_end;
+
+ test_result (test);
+
+ cyg_thread_delay (30);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return (test_nb_failed (test) == 0 ? 0 : 1);
+}
+
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return NULL;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+ test_fsm_post = true;
+}
+
+void
+cp_fsm_process (cp_t *ctx)
+{
+}
diff --git a/cesar/cp/sta/core/test/src/core_events.c b/cesar/cp/sta/core/test/src/core_events.c
new file mode 100644
index 0000000000..52654daa70
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/core_events.c
@@ -0,0 +1,187 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/events.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * Test the events flags.
+ */
+#include <cyg/kernel/kapi.h>
+#include <cyg/hal/hal_arch.h>
+
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/blk.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/sta/core/core.h"
+#include "cp/sta/core/inc/core.h"
+
+void
+test_case_sta_core_init (test_t test)
+{
+ cp_t ctx;
+ uint flag_value;
+
+ test_case_begin (test, "Core init");
+
+ cp_sta_core_init (&ctx);
+
+ test_begin (test, "Verify core init")
+ {
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0);
+ }
+ test_end;
+}
+
+void
+test_case_sta_core_beacon_events_flag (test_t test)
+{
+ cp_t ctx;
+ uint flag_value;
+
+ test_case_begin (test, "Receive beacon event");
+
+ cp_sta_core_init (&ctx);
+
+ test_begin (test, "Flag")
+ {
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0);
+
+ cp_sta_core_signal_recv_beacon_event(&ctx);
+
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0x1);
+ }
+ test_end;
+}
+
+void
+test_case_sta_core_mme_events_flag (test_t test)
+{
+ cp_t ctx;
+ uint flag_value;
+
+ test_case_begin (test, "Receive MME event");
+
+ cp_sta_core_init (&ctx);
+
+ test_begin (test, "Flag")
+ {
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0);
+
+ cp_sta_core_signal_recv_mme_event(&ctx);
+
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0x2);
+ }
+ test_end;
+}
+
+void
+test_case_sta_core_fsm_event (test_t test)
+{
+ cp_t ctx;
+ uint flag_value;
+
+ test_case_begin (test, "Receive FSM event");
+
+ cp_sta_core_init (&ctx);
+
+ test_begin (test, "Flag")
+ {
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0);
+
+ cp_sta_core_signal_fsm_event (&ctx);
+
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0x4);
+ }
+ test_end;
+}
+
+void
+test_case_sta_core_garbage_event (test_t test)
+{
+ cp_t ctx;
+ uint flag_value;
+
+ test_case_begin (test, "Receive garbage event");
+
+ cp_sta_core_init (&ctx);
+
+ test_begin (test, "Flag")
+ {
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0);
+
+ cp_sta_core_signal_garbage_collector_event(&ctx);
+
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0x8);
+ }
+ test_end;
+}
+
+void
+test_case_sta_core_end (test_t test)
+{
+ cp_t ctx;
+ uint flag_value;
+
+ test_case_begin (test, "Receive End event");
+
+ cp_sta_core_init (&ctx);
+
+ test_begin (test, "Flag")
+ {
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0);
+
+ cp_sta_core_signal_terminate_thread_event (&ctx);
+
+ flag_value = cyg_flag_peek(&ctx.sta_core.wait_event_core_flag);
+ test_fail_if (flag_value != 0x10);
+ }
+ test_end;
+}
+
+int
+cyg_user_start (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+
+ test_case_sta_core_init (test);
+ test_case_sta_core_beacon_events_flag (test);
+ test_case_sta_core_mme_events_flag (test);
+ test_case_sta_core_fsm_event (test);
+ test_case_sta_core_garbage_event (test);
+ test_case_sta_core_end (test);
+
+ test_case_begin (test, "Memory");
+
+ test_begin (test, "Verify memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true);
+ }
+ test_end;
+
+ test_result (test);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+ return (test_nb_failed (test) == 0 ? 0 : 1);
+}
diff --git a/cesar/cp/sta/core/test/src/core_thread.c b/cesar/cp/sta/core/test/src/core_thread.c
new file mode 100644
index 0000000000..f53a24236e
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/core_thread.c
@@ -0,0 +1,196 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/core_thread.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include <cyg/kernel/kapi.h>
+#include <cyg/hal/hal_arch.h>
+
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "lib/blk.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+#include "cp/sta/core/core.h"
+#include "cp/sta/core/inc/core.h"
+
+#include <stdio.h>
+
+static cyg_thread my_test_thread;
+static cyg_handle_t my_test_thread_handle;
+static u8 my_test_thread_stack [CYGNUM_HAL_STACK_SIZE_TYPICAL];
+
+static cp_t ctx;
+
+static bool test_fsm_post;
+static bool test_cl_interf;
+static bool test_fsm_process;
+static bool test_action_garbage;
+static bool test_sta_mgr_garbage;
+static bool test_cl_interf_garbage;
+static bool test_beacon;
+
+void
+test_thread_process (cyg_addrword_t data)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_suite_begin (test, "Events");
+
+ test_case_begin (test, "Testing the main loop");
+
+ test_begin (test, "Check Garbage.")
+ {
+ test_action_garbage = false;
+ test_sta_mgr_garbage = false;
+ test_cl_interf_garbage = false;
+
+ cyg_thread_delay (CP_STA_CORE_GARBAGE_COLLECTOR_PERIOD_MS + 10);
+
+ test_fail_if (test_action_garbage == false);
+ test_fail_if (test_sta_mgr_garbage == false);
+ test_fail_if (test_cl_interf_garbage == false);
+ }
+ test_end;
+
+ test_begin (test, "Check FSM")
+ {
+ test_fsm_process = false;
+
+ cp_sta_core_signal_fsm_event (&ctx);
+ cyg_thread_delay (10);
+
+ test_fail_if (test_fsm_process == false);
+ }
+ test_end;
+
+ test_begin (test, "Check MME recv")
+ {
+ test_cl_interf = false;
+
+ cyg_thread_delay (10);
+ cp_sta_core_signal_recv_mme_event (&ctx);
+ test_fail_if (test_cl_interf == false);
+ }
+ test_end;
+
+ test_begin (test, "Check beacon recv")
+ {
+ test_beacon = false;
+
+ cyg_thread_delay (10);
+ cp_sta_core_signal_recv_beacon_event (&ctx);
+ test_fail_if (test_beacon == false);
+ }
+ test_end;
+
+ cyg_thread_delay (100);
+ test_case_begin (test, "Memory");
+ test_begin (test, "Verify memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true);
+ }
+ test_end;
+
+ test_result (test);
+ cyg_thread_suspend (ctx.sta_core.thread_handle);
+ HAL_PLATFORM_EXIT (test_nb_failed (test) == 0 ? 0 : 1);
+}
+
+
+int
+cyg_user_start (void)
+{
+ cp_sta_core_init (&ctx);
+
+ // Create the thread.
+ cyg_thread_create( 9,
+ &test_thread_process,
+ (cyg_addrword_t) 0,
+ "TEST_THREAD",
+ my_test_thread_stack,
+ CYGNUM_HAL_STACK_SIZE_TYPICAL,
+ &my_test_thread_handle,
+ &my_test_thread);
+ cyg_thread_resume (my_test_thread_handle);
+
+ // Create the thread.
+ cyg_thread_create( 8,
+ &cp_sta_core_cp_thread,
+ (cyg_addrword_t) &ctx,
+ "TEST_THREAD_STA_CORE",
+ ctx.sta_core.thread_stack,
+ CYGNUM_HAL_STACK_SIZE_TYPICAL,
+ &ctx.sta_core.thread_handle,
+ &ctx.sta_core.thread);
+ cyg_thread_resume (ctx.sta_core.thread_handle);
+
+ return (0);
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+ test_fsm_post = true;
+}
+
+void
+cp_cl_interf_process_mme (cp_t *ctx)
+{
+ test_cl_interf = true;
+}
+
+void
+cp_fsm_process(cp_t *ctx)
+{
+ test_fsm_process = true;
+}
+
+void
+cp_sta_action_garbage(cp_t *ctx)
+{
+ test_action_garbage = true;
+}
+
+void
+cp_cco_action_garbage(cp_t *ctx)
+{
+ test_action_garbage = true;
+}
+
+void
+cp_sta_mgr_garbage(cp_t *ctx)
+{
+ test_sta_mgr_garbage = true;
+}
+
+void
+cp_cl_interf_garbage_collector(cp_t *ctx)
+{
+ test_cl_interf_garbage = true;
+}
+
+void
+cp_pwl_acl_frequency_detection(cp_t *ctx)
+{
+
+}
+
+void
+cp_beacon_get_and_process_beacon(cp_t *ctx)
+{
+ test_beacon = true;
+}
diff --git a/cesar/cp/sta/core/test/src/cp_cl_interf_stub.c b/cesar/cp/sta/core/test/src/cp_cl_interf_stub.c
new file mode 100644
index 0000000000..648e0ad562
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/cp_cl_interf_stub.c
@@ -0,0 +1,44 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/cp_cl_interf_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+
+/**
+ * Process the MME received.
+ * \param ctx the module context.
+ *
+ * It shall use the MSG function to read the header and get a mme_rx_t
+ * context.
+ * - If the MME is complete, it process it and store the data need in
+ * the mme_rx_t context and call the MSG dispatch function.
+ * - if the MMe is fragmented, it shall verify if the segment has not
+ * already been process.
+ * * if it was process, it shall drop it.
+ * * If not, process it
+ */
+void
+cp_cl_interf_process_mme (cp_t *ctx)
+{
+}
+
+/**
+ * Remove all oldest MME received.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_cl_interf_garbage_collector (cp_t *ctx)
+{
+}
diff --git a/cesar/cp/sta/core/test/src/fsm_stub.c b/cesar/cp/sta/core/test/src/fsm_stub.c
new file mode 100644
index 0000000000..f09c0a954b
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/fsm_stub.c
@@ -0,0 +1,47 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+#include "lib/slab.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
+
+cp_fsm_event_t *
+cp_fsm_event_beacon_new (cp_t *ctx, cp_fsm_event_type_t type,
+ cp_beacon_desc_t *beacon, cp_net_t *net,
+ cp_sta_t *sta)
+{
+ dbg_assert (sta);
+ slab_release (sta);
+
+ return &fsm_event;
+}
+
+void
+cp_fsm_process (cp_t *ctx)
+{
+}
+
diff --git a/cesar/cp/sta/core/test/src/pwl_stub.c b/cesar/cp/sta/core/test/src/pwl_stub.c
new file mode 100644
index 0000000000..00cc105b33
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/pwl_stub.c
@@ -0,0 +1,23 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/pwl_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+#include "cp/pwl/pwl.h"
+
+void
+cp_pwl_acl_frequency_detection (cp_t *ctx)
+{
+}
diff --git a/cesar/cp/sta/core/test/src/sta_mgr_stub.c b/cesar/cp/sta/core/test/src/sta_mgr_stub.c
new file mode 100644
index 0000000000..e0c4408420
--- /dev/null
+++ b/cesar/cp/sta/core/test/src/sta_mgr_stub.c
@@ -0,0 +1,27 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/sta_mgr_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+
+#include "cp/cp.h"
+#include "cp/sta/mgr/sta_mgr.h"
+
+/**
+ * Call all the sub garbage functions.
+ * \param ctx the module context.
+ */
+void
+cp_sta_mgr_garbage (cp_t *ctx)
+{
+}
diff --git a/cesar/cp/sta/mgr/Module b/cesar/cp/sta/mgr/Module
new file mode 100644
index 0000000000..2a089a7fad
--- /dev/null
+++ b/cesar/cp/sta/mgr/Module
@@ -0,0 +1 @@
+SOURCES:=sta.c net.c net_list.c sta_mgr.c sta_own_data.c
diff --git a/cesar/cp/sta/mgr/doc/sta_manager.odt b/cesar/cp/sta/mgr/doc/sta_manager.odt
new file mode 100644
index 0000000000..204a5033c2
--- /dev/null
+++ b/cesar/cp/sta/mgr/doc/sta_manager.odt
Binary files differ
diff --git a/cesar/cp/sta/mgr/doc/sta_mgr.xmi b/cesar/cp/sta/mgr/doc/sta_mgr.xmi
new file mode 100644
index 0000000000..446d866268
--- /dev/null
+++ b/cesar/cp/sta/mgr/doc/sta_mgr.xmi
@@ -0,0 +1,994 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-07-17T17:59:30" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.5</XMI.exporterVersion>
+ <XMI.exporterEncoding>UnicodeUTF8</XMI.exporterEncoding>
+ </XMI.documentation>
+ <XMI.metamodel xmi.name="UML" href="UML.xml" xmi.version="1.3" />
+ </XMI.header>
+ <XMI.content>
+ <UML:Model isSpecification="false" isLeaf="false" isRoot="false" xmi.id="m1" isAbstract="false" name="Modèle UML" >
+ <UML:Namespace.ownedElement>
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="folder" isRoot="false" isAbstract="false" name="folder" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="datatype" isRoot="false" isAbstract="false" name="datatype" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="enum" isRoot="false" isAbstract="false" name="enum" />
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Logical View" isRoot="false" isAbstract="false" name="Logical View" >
+ <UML:Namespace.ownedElement>
+ <UML:Package stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Datatypes" isRoot="false" isAbstract="false" name="Datatypes" >
+ <UML:Namespace.ownedElement>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WHsGhr6cL3qV" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1lLAIoXrLdtJ" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BsXuVmQldfSS" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="l2nnsImcbvsP" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Shk6a1xmtUeN" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="G46rjYKTY5EP" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="O01xtrLMY3S6" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5NqwrUH5XNxE" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="tFhSKvrguqen" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="hz7D2ZH5u80l" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="aHp7fmMY11yJ" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vntVp1gw0ZB8" isRoot="false" isAbstract="false" name="cp_reassembly_ctx_t *" elementReference="nyW3ZjsRDxWm" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oZHHg64PKBaq" isRoot="false" isAbstract="false" name="uint" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DcaQZXHCYAUY" isRoot="false" isAbstract="false" name="cp_sta_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nnvOyvzkSE17" isRoot="false" isAbstract="false" name="u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="J5WdE6USg2qD" isRoot="false" isAbstract="false" name="u16" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="X7Q5Iud3fXPb" isRoot="false" isAbstract="false" name="u32" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QPMsbNxuTUYh" isRoot="false" isAbstract="false" name="u64" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TRzc3eNXqLr1" isRoot="false" isAbstract="false" name="cp_net_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Q4TYO2bRfXJq" isRoot="false" isAbstract="false" name="mac_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="RTeIWtKTDaZV" isRoot="false" isAbstract="false" name="cp_reassembly_ctx_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="yVCl3jm3PB1C" isRoot="false" isAbstract="false" name="cp_sta_own_data_t *" />
+ <UML:DataType stereotype="datatype" comment="This value is equal to 8 bytes." isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="sXqfrqwPid2x" isRoot="false" isAbstract="false" name="NPW_MIN_SIZE" />
+ <UML:DataType stereotype="datatype" comment="NPW max size. 64 bytes." isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZsN7qO5uod0W" isRoot="false" isAbstract="false" name="NPW_MAX_SIZE" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LyzcKuBtjfar" isRoot="false" isAbstract="false" name="u8 *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="2TKfUnESr7J6" isRoot="false" isAbstract="false" name="const u8 *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="bdvfq1CcRFQV" isRoot="false" isAbstract="false" name="const u8" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="cignRXiUIpXF" isRoot="false" isAbstract="false" name="cp_net_list_t *" elementReference="nyW3ZjsRDxWm" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nyW3ZjsRDxWm" isRoot="false" isAbstract="false" name="undef" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="OF2Sin3o242W" isRoot="false" isAbstract="false" name="set_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="6agIp7Rg7jXE" isRoot="false" isAbstract="false" name="cp_sta_mgr_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="EhNquCdzHTzv" isRoot="false" isAbstract="false" name="cp_key_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="GXVTJzZt05VA" isRoot="false" isAbstract="false" name="cp_key_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="F0y42ZDGGZ49" isRoot="false" isAbstract="false" name="const cp_key_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="NMq7yPI15TF8" isRoot="false" isAbstract="false" name="const char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8MlMJZOa2gQQ" isRoot="false" isAbstract="false" name="const char *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="m7hYSy5qW7Uv" isRoot="false" isAbstract="false" name="cp_t *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0mEev7QHu3Xw" isRoot="false" isAbstract="false" name="cp_snid_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="f1lxWwdNwvpr" isRoot="false" isAbstract="false" name="cp_nid_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="emAuInlIaxvV" isRoot="false" isAbstract="false" name="cp_tei_t" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class comment="Station own data." isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="dQQc692tOFUS" isRoot="false" isAbstract="false" name="cp_sta_own_data_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="station's TEI." isSpecification="false" visibility="private" xmi.id="hcbUh4JlIu5E" type="emAuInlIaxvV" name="tei" />
+ <UML:Attribute comment="Station's Mac address." isSpecification="false" visibility="private" xmi.id="MyhwT7zZG8oO" type="Q4TYO2bRfXJq" name="mac_addr" />
+ <UML:Attribute comment="Network Password, use by the station to crypt MMEs." isSpecification="false" visibility="private" xmi.id="x5HJsnaGxZDg" type="1lLAIoXrLdtJ" name="npw [NPW_MAX_SIZE + 1]" />
+ <UML:Attribute comment="AVLN's NMK." isSpecification="false" visibility="private" xmi.id="RrbeL3wI6BZy" type="EhNquCdzHTzv" name="nmk" />
+ <UML:Attribute comment="Device password." isSpecification="false" visibility="private" xmi.id="I16y7R8xSEes" type="1lLAIoXrLdtJ" name="dpw [DPW_MAX_SIZE + 1]" />
+ <UML:Attribute comment="Indicate if the station was CCo during the last use." isSpecification="false" visibility="private" xmi.id="VZjK8y2Pz9L4" type="BsXuVmQldfSS" name="was_cco" />
+ <UML:Attribute comment="Security level. It can be changed by a specific message or by the HLE. See section 7.10.3.1.3 and section 13.3" isSpecification="false" visibility="private" xmi.id="0grlCK0Zd2kv" type="SsuRPlPUGZjG" name="security_level" />
+ <UML:Attribute comment="The PCO Glid." isSpecification="false" visibility="private" xmi.id="roOeP5mqSzsY" type="nnvOyvzkSE17" name="pco_glid" />
+ <UML:Attribute comment="Date to change the NEK in eCos ticks." isSpecification="false" visibility="public" xmi.id="y8EthSZ1UdAy" type="oZHHg64PKBaq" name="nek_change_rtc" />
+ <UML:Attribute comment="Indicate if the station was CCo prefered." isSpecification="false" visibility="public" xmi.id="TO2c4YFuL4qQ" type="BsXuVmQldfSS" name="cco_prefered" />
+ <UML:Attribute comment="The user HFID." isSpecification="false" visibility="public" xmi.id="Rxzl1nBWMvpT" type="NMq7yPI15TF8" name="hfid_user [HFID_SIZE + 1]" />
+ <UML:Attribute comment="The manufacturer HFID." isSpecification="false" visibility="public" xmi.id="gBfRCRdglWVE" type="NMq7yPI15TF8" name="hfid_manufacturer [HFID_SIZE + 1]" />
+ <UML:Attribute comment="The AVLN HFID." isSpecification="false" visibility="public" xmi.id="3951" type="NMq7yPI15TF8" name="hfid_avln[HFID_SIZE + 1]" />
+ <UML:Attribute comment="Current hybrid mode." isSpecification="false" visibility="public" xmi.id="xAmypZKxOlvo" type="nnvOyvzkSE17" name="hybrid_mode" />
+ <UML:Attribute comment="The current snid being tracked for the ntb synchronization." isSpecification="false" visibility="public" xmi.id="919bTPKjqxKs" type="0mEev7QHu3Xw" name="snid_track" />
+ <UML:Attribute comment="The current nid being track for the ntb synchronization." isSpecification="false" visibility="public" xmi.id="MW7N3XqbJLli" type="f1lxWwdNwvpr" name="nid_track" />
+ <UML:Attribute comment="The current eks." isSpecification="false" visibility="public" xmi.id="mDBIcASUSrMN" type="nnvOyvzkSE17" name="eks_current" />
+ <UML:Attribute comment="The PCo to discuss with." isSpecification="false" visibility="public" xmi.id="aTEnETRcBPSB" type="DcaQZXHCYAUY" name="pco" />
+ <UML:Attribute comment="Indiciate if the station is CCo actually or not." isSpecification="false" visibility="public" xmi.id="21vGqBho1x7N" type="BsXuVmQldfSS" name="is_cco" />
+ <UML:Attribute comment="Indiciarte if the stations Is authenticated." isSpecification="false" visibility="public" xmi.id="OsE9bhvHgqdb" type="BsXuVmQldfSS" name="is_authenticated" />
+ <UML:Operation comment="Initialise the station own data to default values." isSpecification="false" isLeaf="false" visibility="public" xmi.id="l9iApQ5k7p4V" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Set the TEI of the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="PNzGVGMN7IZO" isRoot="false" isAbstract="false" isQuery="false" name="set_tei" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The the TEI station." isSpecification="false" visibility="private" xmi.id="IChxmt614D8Y" value="" type="emAuInlIaxvV" name="tei" />
+ <UML:Parameter comment="Control plane context." isSpecification="false" visibility="private" xmi.id="2v2ZjkQ87kAJ" value="" type="m7hYSy5qW7Uv" name="cp" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of the constante TEI." isSpecification="false" isLeaf="false" visibility="public" xmi.id="oS3q3CNSaLg5" isRoot="false" isAbstract="false" isQuery="false" name="get_tei" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4048" type="emAuInlIaxvV" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station Mac address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="9tv3PTcwJuk2" isRoot="false" isAbstract="false" isQuery="false" name="set_mac_address" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The Mac address of the station." isSpecification="false" visibility="private" xmi.id="GmJdTFwP5LIE" value="" type="Q4TYO2bRfXJq" name="mac_addr" />
+ <UML:Parameter comment="The control plane context." isSpecification="false" visibility="private" xmi.id="5Sh2WLpXokrR" value="" type="m7hYSy5qW7Uv" name="cp" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station mac address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="DbAcS8Pc1KdP" isRoot="false" isAbstract="false" isQuery="false" name="get_mac_address" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4049" type="Q4TYO2bRfXJq" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the Station NPW." isSpecification="false" isLeaf="false" visibility="public" xmi.id="lEJ2633MpMzJ" isRoot="false" isAbstract="false" isQuery="false" name="set_npw" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The new npw." isSpecification="false" visibility="private" xmi.id="99dfWsqi6SFH" value="" type="8MlMJZOa2gQQ" name="npw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the pointer to the NPW as a constante data. The user shall call the set_npw function to modify the NPW." isSpecification="false" isLeaf="false" visibility="public" xmi.id="bLozAc1Tby5t" isRoot="false" isAbstract="false" isQuery="false" name="get_npw" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4050" type="8MlMJZOa2gQQ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station NMK." isSpecification="false" isLeaf="false" visibility="public" xmi.id="QacAXGqLr88z" isRoot="false" isAbstract="false" isQuery="false" name="set_nmk" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The nmk to set." isSpecification="false" visibility="private" xmi.id="V67Yq0lvqWek" value="" type="F0y42ZDGGZ49" name="nmk" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the NMK of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="XBpdlbprByih" isRoot="false" isAbstract="false" isQuery="false" name="get_nmk" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4051" type="F0y42ZDGGZ49" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the device password." isSpecification="false" isLeaf="false" visibility="public" xmi.id="x2pgMFGxFwzE" isRoot="false" isAbstract="false" isQuery="false" name="set_dpw" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The new device password." isSpecification="false" visibility="private" xmi.id="K4OvTT41dteO" value="" type="8MlMJZOa2gQQ" name="dpw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the Device password." isSpecification="false" isLeaf="false" visibility="public" xmi.id="YWiBOMZqmmSC" isRoot="false" isAbstract="false" isQuery="false" name="get_dpw" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4052" type="8MlMJZOa2gQQ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the security level. And send a message to the HLE." isSpecification="false" isLeaf="false" visibility="public" xmi.id="gkXbpZt9r3e4" isRoot="false" isAbstract="false" isQuery="false" name="set_security_level" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The security level." isSpecification="false" visibility="private" xmi.id="DPaRU282XpEv" value="" type="SsuRPlPUGZjG" name="sl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the security level." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Cgo2iS6vpgKJ" isRoot="false" isAbstract="false" isQuery="false" name="get_security_level" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4053" type="SsuRPlPUGZjG" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the CCo status of the station. It shall send a message to the Linux Driver." isSpecification="false" isLeaf="false" visibility="public" xmi.id="4vv3FEH8vlii" isRoot="false" isAbstract="false" isQuery="false" name="set_was_cco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The current CCo status of the station." isSpecification="false" visibility="private" xmi.id="ZoePxqjuXWU6" value="" type="BsXuVmQldfSS" name="status" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the the CCo status of the station after a reboot." isSpecification="false" isLeaf="false" visibility="public" xmi.id="h933zRw1Mr2a" isRoot="false" isAbstract="false" isQuery="false" name="get_was_cco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4054" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the HFID value." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Z2pjniRb4U5p" isRoot="false" isAbstract="false" isQuery="false" name="set_hfid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The HFID to set (user or manufacturer)." isSpecification="false" visibility="private" xmi.id="EuSjWJa3LNm8" value="" type="8MlMJZOa2gQQ" name="hfid" />
+ <UML:Parameter comment="The new HFID value to set." isSpecification="false" visibility="private" xmi.id="VAPcPDExC4vS" value="" type="8MlMJZOa2gQQ" name="data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set thenew User HFID in the station own data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="6Di8flw9tLlH" isRoot="false" isAbstract="true" isQuery="false" name="set_hfid_user" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Set the new User HFID." isSpecification="false" visibility="private" xmi.id="YxEj17BGzexV" value="" type="8MlMJZOa2gQQ" name="data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the new manufacturer HFID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="xXWGuINyU377" isRoot="false" isAbstract="true" isQuery="false" name="set_hfid_manufacturer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The new Manufacturer HFID." isSpecification="false" visibility="private" xmi.id="m3GgO0xwx9fz" value="" type="8MlMJZOa2gQQ" name="data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the GLID to send proxy data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="b2NRxvTAG4Im" isRoot="false" isAbstract="false" isQuery="false" name="set_pco_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The glid to use when a proxy beacon shall be sent." isSpecification="false" visibility="private" xmi.id="QRFWIDV91tnP" value="" type="nnvOyvzkSE17" name="glid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the PCO GLID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="wXFOX5u66GX3" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4055" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the PCO status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="4DPM1C2ZHS5c" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4056" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the PCO status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="tS98bISnuM92" isRoot="false" isAbstract="false" isQuery="false" name="set_pco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The PCO status." isSpecification="false" visibility="private" xmi.id="es20nPIqcgCb" value="" type="BsXuVmQldfSS" name="pco" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="L2ASUCoHdFZ0" isRoot="false" isAbstract="false" name="cp_sta_mgr_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Station own data." isSpecification="false" visibility="private" xmi.id="AIGGTnEPvRIa" type="dQQc692tOFUS" name="sta_own_data" />
+ <UML:Attribute comment="The network list." isSpecification="false" visibility="private" xmi.id="5n92zk1smX9k" type="qIWnFzBd9oKJ" name="netwoks_list" />
+ <UML:Operation comment="Add a AVLN to the manager list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="QXnrJp4mc3nZ" isRoot="false" isAbstract="false" isQuery="false" name="add_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4057" type="TRzc3eNXqLr1" />
+ <UML:Parameter comment="The AVLN's SNID to add." isSpecification="false" visibility="private" xmi.id="xXla9cfmTC0K" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's nid to add." isSpecification="false" visibility="private" xmi.id="Dq4iCYzb5lSM" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove an AVLN," isSpecification="false" isLeaf="false" visibility="public" xmi.id="bxBBvbAGs7Q5" isRoot="false" isAbstract="false" isQuery="false" name="remove_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The AVLN's snid to remove." isSpecification="false" visibility="private" xmi.id="CwB2Bb8CvUZS" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's nid to remove." isSpecification="false" visibility="private" xmi.id="c8bNpTbQOlcJ" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get an AVLN from the net_list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="vk7FSeQIaeIS" isRoot="false" isAbstract="false" isQuery="false" name="get_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4058" type="TRzc3eNXqLr1" />
+ <UML:Parameter comment="The AVLN's snid to get." isSpecification="false" visibility="private" xmi.id="5KU6Vjz8WLNP" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's nid to get." isSpecification="false" visibility="private" xmi.id="Jy7i8GX3ycIR" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get our AVLN network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="5SqO4seTjRSa" isRoot="false" isAbstract="false" isQuery="false" name="get_our_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4059" type="TRzc3eNXqLr1" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initialise the sta manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="qHxkg2dtESUh" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Uninitialise the sta manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="2gQknmKqTzYm" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Lookup and return all the snids already in use in the different AVLN. The return data is a flag of 16 bits. The bit0 corresponds to the the snid 0, the bit1 to the snid 1 and so on." isSpecification="false" isLeaf="false" visibility="public" xmi.id="DC8mABArXbfX" isRoot="false" isAbstract="false" isQuery="false" name="get_present_snids" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4060" type="J5WdE6USg2qD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Call all the sub garbage functions." isSpecification="false" isLeaf="false" visibility="public" xmi.id="MulJvMHR2JsJ" isRoot="false" isAbstract="false" isQuery="false" name="garbage" />
+ <UML:Operation comment="Update the our avln's snid." isSpecification="false" isLeaf="false" visibility="public" xmi.id="FQgbp6OOPmCi" isRoot="false" isAbstract="false" isQuery="false" name="update_our_avln_snid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Our AVLN new SNID." isSpecification="false" visibility="private" xmi.id="2admxeRh1KsW" value="" type="0mEev7QHu3Xw" name="snid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Update the AVLN's NID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="BwEmjKrCkKxW" isRoot="false" isAbstract="false" isQuery="false" name="update_our_avln_nid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The AVLN's NID." isSpecification="false" visibility="private" xmi.id="9oSA8eNGsmf5" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Returns a reference on our own station data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="i2znmIk8bVQ3" isRoot="false" isAbstract="false" isQuery="false" name="get_sta_own_data" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4061" type="yVCl3jm3PB1C" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the network slot usage." isSpecification="false" isLeaf="false" visibility="public" xmi.id="o7bH8l102RHc" isRoot="false" isAbstract="false" isQuery="false" name="get_slot_usage" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4062" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of discovered stations." isSpecification="false" isLeaf="false" visibility="public" xmi.id="NDGrlwJSDY8B" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discovered_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4063" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of discovered networks." isSpecification="false" isLeaf="false" visibility="public" xmi.id="HwdXOmbaswch" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discovered_net" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4064" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Verify the net list status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="1551" isRoot="false" isAbstract="false" isQuery="false" name="net_list_is_empty" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4065" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Merge the network to our net." isSpecification="false" isLeaf="false" visibility="public" xmi.id="2495" isRoot="false" isAbstract="false" isQuery="false" name="merge_net" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="the network to merge." isSpecification="false" visibility="private" xmi.id="2496" value="" type="TRzc3eNXqLr1" name="net" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="Control plane station." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tftTuiZXSv4R" isRoot="false" isAbstract="false" name="cp_sta_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="Station's tei." isSpecification="false" visibility="private" xmi.id="w2lpqlcRNBky" type="emAuInlIaxvV" name="tei" />
+ <UML:Attribute comment="Station's mac address." isSpecification="false" visibility="private" xmi.id="KjxDjNipVmH6" type="Q4TYO2bRfXJq" name="mac_address" />
+ <UML:Attribute comment="Indicate if the station is Visible by our station." isSpecification="false" visibility="private" xmi.id="nJw1e6ulB8mV" type="BsXuVmQldfSS" name="visible" />
+ <UML:Attribute comment="Indicate if the station is CCo." isSpecification="false" visibility="private" xmi.id="9SydFFh3ENAt" type="BsXuVmQldfSS" name="is_cco" />
+ <UML:Attribute comment="GLID provided to the PCO to transmit a proxy beacon." isSpecification="false" visibility="private" xmi.id="76E3M1i7iJGy" type="nnvOyvzkSE17" name="pco_glid" />
+ <UML:Attribute comment="Indicate the state of the station." isSpecification="false" visibility="private" xmi.id="njbBHkqZRmmB" type="pBzpcllJMdsq" name="station_state" />
+ <UML:Attribute comment="Indicate if the station is Backup CCo." isSpecification="false" visibility="public" xmi.id="15VSrGbyiZbv" type="BsXuVmQldfSS" name="is_backup_cco" />
+ <UML:Attribute comment="Last date seen in the AVLN." isSpecification="false" visibility="public" xmi.id="7SdojrmkwHBl" type="oZHHg64PKBaq" name="last_seen_ms" />
+ <UML:Attribute comment="The Reassembly context for the cl_interf." isSpecification="false" visibility="public" xmi.id="61vH7gnD8O1s" type="RTeIWtKTDaZV" name="reassembly_ctx" />
+ <UML:Attribute comment="The tei expiration date." isSpecification="false" visibility="public" xmi.id="O3jgPKW1znfn" type="oZHHg64PKBaq" name="tei_lease_ms" />
+ <UML:Attribute comment="The station CCo capability." isSpecification="false" visibility="public" xmi.id="uZ2PRCIQqOal" type="nnvOyvzkSE17" name="cco_cap" />
+ <UML:Attribute comment="Indicate if the station can be PCo." isSpecification="false" visibility="public" xmi.id="SKPVcXpzB5Y4" type="BsXuVmQldfSS" name="pco_cap" />
+ <UML:Attribute comment="Indicate if the stations can be backup CCo." isSpecification="false" visibility="public" xmi.id="FcAqRxkJWmhw" type="BsXuVmQldfSS" name="backup_cco_cap" />
+ <UML:Attribute comment="Number of discover stations." isSpecification="false" visibility="public" xmi.id="R3na9McOwmEN" type="nnvOyvzkSE17" name="numDisSta" />
+ <UML:Attribute comment="Number of discover networks." isSpecification="false" visibility="public" xmi.id="jwhEhOAeLWRh" type="nnvOyvzkSE17" name="numDisNet" />
+ <UML:Attribute comment="Temporary encryption key." isSpecification="false" visibility="public" xmi.id="4ZF47cpCPQyM" type="nnvOyvzkSE17" name="tek [TEK_SIZE]" />
+ <UML:Operation comment="Return a station object initialised." isSpecification="false" isLeaf="false" visibility="private" xmi.id="AaNPCwE5GYpL" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4066" type="DcaQZXHCYAUY" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Uninitialise the station." isSpecification="false" isLeaf="false" visibility="private" xmi.id="1HLA3MQK09Yr" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Get the station's TEI." isSpecification="false" isLeaf="false" visibility="public" xmi.id="BxTRzdcxFOCK" isRoot="false" isAbstract="false" isQuery="false" name="get_tei" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4067" type="emAuInlIaxvV" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station's mac address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="feEeHoZUCjo5" isRoot="false" isAbstract="false" isQuery="false" name="get_mac_address" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4068" type="Q4TYO2bRfXJq" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station's cco status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="MEr8fhvtbOQD" isRoot="false" isAbstract="false" isQuery="false" name="get_cco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4069" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the PCO status." isSpecification="false" isLeaf="false" visibility="public" xmi.id="azzTtnO4ApfB" isRoot="false" isAbstract="false" isQuery="false" name="set_pco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The PCO status." isSpecification="false" visibility="private" xmi.id="JdJOFu68mh8a" value="" type="BsXuVmQldfSS" name="pco" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the Proxy CCo status of the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="aCtLsOAUOvwU" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4070" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the visible status of the station on the medium." isSpecification="false" isLeaf="false" visibility="public" xmi.id="OSlCnQfCxj2t" isRoot="false" isAbstract="false" isQuery="false" name="get_visible_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4071" type="7PSrs3lMwQVn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Verify that the station cannot exits if the TEI is different from 0." isSpecification="false" isLeaf="false" visibility="public" xmi.id="kS58ufMfkgpT" isRoot="false" isAbstract="false" isQuery="false" name="set_state" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station state." isSpecification="false" visibility="private" xmi.id="87h1cfOrYfwO" value="" type="pBzpcllJMdsq" name="state" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station state." isSpecification="false" isLeaf="false" visibility="public" xmi.id="bymR7cTq4Wyz" isRoot="false" isAbstract="false" isQuery="false" name="get_state" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4072" type="pBzpcllJMdsq" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the PCO GLID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="H29zTi1CMn0S" isRoot="false" isAbstract="false" isQuery="false" name="get_pco_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4073" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station GLID to use as PCO." isSpecification="false" isLeaf="false" visibility="public" xmi.id="xjmXt0pRpbh7" isRoot="false" isAbstract="false" isQuery="false" name="set_pco_glid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station GLID." isSpecification="false" visibility="private" xmi.id="SNF25bArqwZ3" value="" type="nnvOyvzkSE17" name="glid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="QCdiA5hU9IAb" isRoot="false" isAbstract="false" name="cp_net_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="AVLN's SNID." isSpecification="false" visibility="private" xmi.id="9PZYdnDFOfZz" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Attribute comment="AVLN's NID." isSpecification="false" visibility="private" xmi.id="I2w0DZg3Mq2z" type="f1lxWwdNwvpr" name="nid" />
+ <UML:Attribute comment="Indicate if the AVLN is present on the medium." isSpecification="false" visibility="private" xmi.id="oQkVnlklYCyk" type="BsXuVmQldfSS" name="present" />
+ <UML:Attribute comment="The pointer to the CCo station." isSpecification="false" visibility="private" xmi.id="HiveU00Ud1Ud" type="DcaQZXHCYAUY" name="cco" />
+ <UML:Attribute comment="the pointer to the Pco station." isSpecification="false" visibility="private" xmi.id="tVZmk23YSl2D" type="DcaQZXHCYAUY" name="pco" />
+ <UML:Attribute comment="The expiration date at the one this AVLN should be removed from the list. This will be verified in the garbage function." isSpecification="false" visibility="private" xmi.id="fU07vNLGT9Ie" type="oZHHg64PKBaq" name="expiration_ms" />
+ <UML:Attribute comment="The list of associated stations in the AVLN." isSpecification="false" visibility="private" xmi.id="bJPnIIOxkO2f" type="OF2Sin3o242W" name="associated_stas" />
+ <UML:Attribute comment="The list of unassociated stations in the AVLN." isSpecification="false" visibility="private" xmi.id="kNvDWBsghjTC" type="OF2Sin3o242W" name="unassociated_stas" />
+ <UML:Attribute comment="Indicate if it is the station's avln. If not the commit to dataplane will not have any effect." isSpecification="false" visibility="private" xmi.id="jIkt6HtZ4hx8" type="BsXuVmQldfSS" name="stations_avln" />
+ <UML:Attribute comment="AVLN slot id." isSpecification="false" visibility="private" xmi.id="AqQWPXxzCapd" type="nnvOyvzkSE17" name="avln_slot_id" />
+ <UML:Attribute comment="The slot usage read in the AVLN's central beacon." isSpecification="false" visibility="private" xmi.id="p8FRmwBNLQgP" type="nnvOyvzkSE17" name="avln_slot_usage" />
+ <UML:Attribute comment="Number of visible stations in the AVLN, correspond to the station visible or discovered by the station." isSpecification="false" visibility="private" xmi.id="kr6KLUaiRjIH" type="nnvOyvzkSE17" name="num_visible_stas" />
+ <UML:Attribute comment="The number of stations contained in the network." isSpecification="false" visibility="private" xmi.id="0qvffRz2S8ru" type="nnvOyvzkSE17" name="num_stas" />
+ <UML:Attribute comment="The network mode." isSpecification="false" visibility="private" xmi.id="S6pIWhJZQV41" type="cxkkcPlqeSGi" name="network_mode" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="L8nWSpKOxfIH" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Indicate if it corresponds to the station's avln." isSpecification="false" visibility="private" xmi.id="GVgAWD6b5uCt" value="" type="BsXuVmQldfSS" name="station_avln" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Unitialise the network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="025OblSx0TOi" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Remove old station which has not been seen for a while." isSpecification="false" isLeaf="false" visibility="public" xmi.id="heL2xof0ahkF" isRoot="false" isAbstract="false" isQuery="false" name="garbage_stations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Current date in milliseconds." isSpecification="false" visibility="private" xmi.id="8jokj53GTXuc" value="" type="X7Q5Iud3fXPb" name="date_ms" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the CCo in the Network list.
+Shall update the data bases." isSpecification="false" isLeaf="false" visibility="public" xmi.id="3UBqgc2KKU2C" isRoot="false" isAbstract="true" isQuery="false" name="set_cco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The Station's TEI which is the CCo." isSpecification="false" visibility="private" xmi.id="tUrReG3DLDos" value="" type="emAuInlIaxvV" name="tei" />
+ <UML:Parameter comment="The station manager." isSpecification="false" visibility="private" xmi.id="GUOpz3ZW6daE" value="" type="6agIp7Rg7jXE" name="sta_mgr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the CCo of this AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="3ABOLzFXlfcB" isRoot="false" isAbstract="false" isQuery="false" name="get_cco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4074" type="DcaQZXHCYAUY" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the PCo for this station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="3tINqVucAXnG" isRoot="false" isAbstract="false" isQuery="false" name="set_pco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="PCo's tei." isSpecification="false" visibility="private" xmi.id="nQGtNqOhHcnd" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the PCo of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="iaLbV3XXwoul" isRoot="false" isAbstract="false" isQuery="false" name="get_pco" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4075" type="DcaQZXHCYAUY" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add a station to the AVLN. This function shall update the data of the AVLN if it has changed i.e. cco, pco." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Yphrc2Jt91yg" isRoot="false" isAbstract="false" isQuery="false" name="sta_add" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4076" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="Station's TEI." isSpecification="false" visibility="private" xmi.id="ywaiG8k9TNmQ" value="" type="emAuInlIaxvV" name="tei" />
+ <UML:Parameter comment="Station's mac address." isSpecification="false" visibility="private" xmi.id="L0oLkiIGXx87" value="" type="Q4TYO2bRfXJq" name="mac_address" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove the station from the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="LX3kth6enYII" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove_assoc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The Station's TEI." isSpecification="false" visibility="private" xmi.id="oWB9No6GmL47" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove an unassociated station from the list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="iG9yQ3L5sqEx" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove_unassc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station's mac address." isSpecification="false" visibility="private" xmi.id="AggzfMy1LEO8" value="" type="Q4TYO2bRfXJq" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove the station from the net.
+The user shall release the reference." isSpecification="false" isLeaf="false" visibility="public" xmi.id="1mIfdDNMRWIp" isRoot="false" isAbstract="false" isQuery="false" name="sta_remove" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The station to remove." isSpecification="false" visibility="private" xmi.id="ZduRT6Nem1bR" value="" type="DcaQZXHCYAUY" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station identified by its TEI. returns NULL if the station does not exists. It only returns a new reference on the station (one reference is still kept by the network), when the user does not use it any more, it must release it." isSpecification="false" isLeaf="false" visibility="public" xmi.id="KaVaqfkWnW3C" isRoot="false" isAbstract="false" isQuery="false" name="get_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4077" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="The station's tei." isSpecification="false" visibility="private" xmi.id="TZF5HQhLblHC" value="" type="emAuInlIaxvV" name="tei" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get an unassociated station identified by its mac address." isSpecification="false" isLeaf="false" visibility="public" xmi.id="KQuOiqL0MaDu" isRoot="false" isAbstract="false" isQuery="false" name="get_sta_unassoc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4078" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="Unassaociated station's mac address." isSpecification="false" visibility="private" xmi.id="iTllvuA9nkes" value="" type="Q4TYO2bRfXJq" name="mac_addr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Commit the changes of the AVLN. Use to commit the changes in the others databases.
+Only call this function when all the stations have been added, or all stations have been removed. This will check the modifications of the network station list to update at least the mactotei table. It is useful to synchronize those tables because the mactotei table does not have the possibility to remove stations it only have the possibility to remove the station by excluding it from the copy to the new one." isSpecification="false" isLeaf="false" visibility="public" xmi.id="2TdT5mMiol3i" isRoot="false" isAbstract="false" isQuery="false" name="commit_to_dataplane" />
+ <UML:Operation comment="Returns the first station of an AVLN. The user has the responsibility to release the reference on the returned station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="W8rOQJZys2Nh" isRoot="false" isAbstract="false" isQuery="false" name="get_first" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4079" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="to search in the associated stations or unassociated STAs." isSpecification="false" visibility="private" xmi.id="uegtnCaW6HvZ" value="" type="pBzpcllJMdsq" name="assoc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the next station from the AVLN stating by the previous one already request. This function shall be call after get_first.
+The user have the responsibility to release the reference on both stations i.e. prev_sta and the returned sta." isSpecification="false" isLeaf="false" visibility="public" xmi.id="LSNW129OipWM" isRoot="false" isAbstract="false" isQuery="false" name="get_next_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4080" type="DcaQZXHCYAUY" />
+ <UML:Parameter comment="The previous station requested." isSpecification="false" visibility="private" xmi.id="QpgFnJlzqGcm" value="" type="DcaQZXHCYAUY" name="prev_sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the network SNID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ihLtnkq61iHr" isRoot="false" isAbstract="false" isQuery="false" name="get_snid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4081" type="0mEev7QHu3Xw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the AVLN NID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ljJ5Ao4US5yj" isRoot="false" isAbstract="false" isQuery="false" name="get_nid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4082" type="f1lxWwdNwvpr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the AVLN slot id." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Nsj0r8ybFTqj" isRoot="false" isAbstract="false" isQuery="false" name="set_slot_id_and_usage" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The AVLN Slot id." isSpecification="false" visibility="private" xmi.id="YBDZ7f07dRHq" value="" type="nnvOyvzkSE17" name="slot_id" />
+ <UML:Parameter comment="The slot usage mask." isSpecification="false" visibility="private" xmi.id="A9M6Rbk9UhsU" value="" type="nnvOyvzkSE17" name="slot_usage" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the slot identifier of the network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="tXX7yCe6ABln" isRoot="false" isAbstract="false" isQuery="false" name="get_slot_id" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4083" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return the slot usage mask of the AVLN read in the central beacon of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="po8WMv8qvmgP" isRoot="false" isAbstract="false" isQuery="false" name="get_slot_usage_mask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4084" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of station discovered in this AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="eOkr2PyKZULL" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discovered_stas" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4085" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of station of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="pq6Gp6gvxZjX" isRoot="false" isAbstract="false" isQuery="false" name="get_num_stas" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4086" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the current network mode of the network." isSpecification="false" isLeaf="false" visibility="public" xmi.id="EQSO9Nrh7vtl" isRoot="false" isAbstract="false" isQuery="false" name="set_nm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The current network mode of the network." isSpecification="false" visibility="private" xmi.id="0k5Hjgz6Os8M" value="" type="cxkkcPlqeSGi" name="nm" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the current network mode of the AVLN." isSpecification="false" isLeaf="false" visibility="public" xmi.id="z1wK2LaEl0as" isRoot="false" isAbstract="false" isQuery="false" name="get_nm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4087" type="cxkkcPlqeSGi" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the visible status of the station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Jjld2KdMoLhV" isRoot="false" isAbstract="false" isQuery="false" name="sta_set_visible_status" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Set the visible status of the station." isSpecification="false" visibility="private" xmi.id="PW4syr1TIgWP" value="" type="DcaQZXHCYAUY" name="sta" />
+ <UML:Parameter comment="The visible status." isSpecification="false" visibility="private" xmi.id="0ZgxJhpqiCfQ" value="" type="7PSrs3lMwQVn" name="status" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="qIWnFzBd9oKJ" isRoot="false" isAbstract="false" name="cp_net_list_t" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="The possibles AVLN, index 0 corresponds to our AVLN." isSpecification="false" visibility="private" xmi.id="YMFSnX2eMexo" type="QCdiA5hU9IAb" name="networks [8]" />
+ <UML:Operation comment="Inititliase the network list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Qd9Ie0K9YadK" isRoot="false" isAbstract="false" isQuery="false" name="init" />
+ <UML:Operation comment="Unitialise the network list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="fhhadu0Xv5sq" isRoot="false" isAbstract="false" isQuery="false" name="uninit" />
+ <UML:Operation comment="Calls the sub modules garbage to remove old data." isSpecification="false" isLeaf="false" visibility="public" xmi.id="qF2AzTzTvsRh" isRoot="false" isAbstract="false" isQuery="false" name="garbage_net" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The current date in milliseconds." isSpecification="false" visibility="private" xmi.id="YBhJPHujWWR7" value="" type="X7Q5Iud3fXPb" name="date_ms" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add an AVLN to the list." isSpecification="false" isLeaf="false" visibility="public" xmi.id="dvGudEhkvNbD" isRoot="false" isAbstract="false" isQuery="false" name="add_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4088" type="TRzc3eNXqLr1" />
+ <UML:Parameter comment="The AVLN's SNID to add." isSpecification="false" visibility="private" xmi.id="k5UOGYbYkzwv" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's NID to add." isSpecification="false" visibility="private" xmi.id="WkkbSbh3Uxx8" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Removes an AVLN from the sta manager." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ads5yTHiXj5l" isRoot="false" isAbstract="false" isQuery="false" name="remove_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The AVLN's SNID to remove." isSpecification="false" visibility="private" xmi.id="FgKxfGs90bkR" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's NID to remove." isSpecification="false" visibility="private" xmi.id="5rhaamLoQfl3" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Returns the AVLN corresponding to the snid and nid." isSpecification="false" isLeaf="false" visibility="public" xmi.id="vcDuDxLNPn0k" isRoot="false" isAbstract="false" isQuery="false" name="get_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4089" type="TRzc3eNXqLr1" />
+ <UML:Parameter comment="The AVLN's snid to get." isSpecification="false" visibility="private" xmi.id="DlHEPrDSht2F" value="" type="0mEev7QHu3Xw" name="snid" />
+ <UML:Parameter comment="The AVLN's NID to get." isSpecification="false" visibility="private" xmi.id="dN341p7uPKoa" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Return a new reference on our avln." isSpecification="false" isLeaf="false" visibility="public" xmi.id="TWW8PYO3uR7v" isRoot="false" isAbstract="false" isQuery="false" name="get_our_avln" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4090" type="TRzc3eNXqLr1" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Update our AVLN snid." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Zuczoz8sRjYE" isRoot="false" isAbstract="false" isQuery="false" name="update_our_avln_snid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="Our AVLN new SNID." isSpecification="false" visibility="private" xmi.id="wGzSnnYX32hQ" value="" type="0mEev7QHu3Xw" name="snid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Update the AVLN's NID." isSpecification="false" isLeaf="false" visibility="public" xmi.id="BwEmjKrCkKxW" isRoot="false" isAbstract="false" isQuery="false" name="update_our_avln_nid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter comment="The AVLN's NID." isSpecification="false" visibility="private" xmi.id="9oSA8eNGsmf5" value="" type="f1lxWwdNwvpr" name="nid" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Verify if the network list is empty and return true if it is." isSpecification="false" isLeaf="false" visibility="public" xmi.id="thTkEhFFV82W" isRoot="false" isAbstract="false" isQuery="false" name="is_empty" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4091" type="BsXuVmQldfSS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Create a 16 bits flag indicating which SNID are in use." isSpecification="false" isLeaf="false" visibility="public" xmi.id="fEG2VdimBUrx" isRoot="false" isAbstract="false" isQuery="false" name="get_snid_present" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4092" type="J5WdE6USg2qD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the slot usage of the AVLNs computed on the slots IDs of each AVLN present.
+It corresponds to a 8 bits field." isSpecification="false" isLeaf="false" visibility="public" xmi.id="dEIri7aEIlnP" isRoot="false" isAbstract="false" isQuery="false" name="get_slot_usage" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4093" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the number of discovered station on all AVLNs." isSpecification="false" isLeaf="false" visibility="public" xmi.id="0swcx8FCE83L" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discover_stas" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4094" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the quantity of network discovered." isSpecification="false" isLeaf="false" visibility="public" xmi.id="iz4t8GAcZAqw" isRoot="false" isAbstract="false" isQuery="false" name="get_num_discovered_net" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4095" type="nnvOyvzkSE17" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="pBzpcllJMdsq" isRoot="false" isAbstract="false" name="cp_sta_state_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="pBzpcllJMdsq" xmi.id="AYBjv2FiBCYl" isRoot="false" isAbstract="false" name="EXISTS" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="pBzpcllJMdsq" xmi.id="TS9huSQ4zbmu" isRoot="false" isAbstract="false" name="ASSOCIATED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="pBzpcllJMdsq" xmi.id="WTF7ViJwASd4" isRoot="false" isAbstract="false" name="AUTHENTICATED" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="SsuRPlPUGZjG" isRoot="false" isAbstract="false" name="cp_security_level_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="SsuRPlPUGZjG" xmi.id="YGOeDlDfb740" isRoot="false" isAbstract="false" name="CP_SECURITY_LEVEL_SC" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="SsuRPlPUGZjG" xmi.id="8rMiHZwnqIP3" isRoot="false" isAbstract="false" name="CP_SECURITY_LEVEL_HS" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="cxkkcPlqeSGi" isRoot="false" isAbstract="false" name="cp_net_network_mode_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="cxkkcPlqeSGi" xmi.id="7AfLHTarQIb0" isRoot="false" isAbstract="false" name="CP_NET_NM_UNCOORDINATED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="cxkkcPlqeSGi" xmi.id="1IbnbOCiWr4l" isRoot="false" isAbstract="false" name="CP_NET_NM_COORDINATED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="cxkkcPlqeSGi" xmi.id="UsJ25EL4Uwr6" isRoot="false" isAbstract="false" name="CP_NET_NM_CSMA_ONLY" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="cxkkcPlqeSGi" xmi.id="MWptygBQWUQa" isRoot="false" isAbstract="false" name="CP_NET_NM_ASSERT" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="7PSrs3lMwQVn" isRoot="false" isAbstract="false" name="cp_sta_visible_state_t" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="7PSrs3lMwQVn" xmi.id="200XB2ebUTRX" isRoot="false" isAbstract="false" name="CP_STA_VISIBLE_STATE_HIDDEN" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="7PSrs3lMwQVn" xmi.id="v7wHq2ss2qNB" isRoot="false" isAbstract="false" name="CP_STA_VISIBLE_STATE_VISIBLE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="7PSrs3lMwQVn" xmi.id="VkDZ8Ke4QYJG" isRoot="false" isAbstract="false" name="CP_STA_VISIBLE_STATE_ASSERT" />
+ </UML:Enumeration>
+ <UML:Package stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="rLUcIo7kRV6u" isRoot="false" isAbstract="false" name="" >
+ <UML:Namespace.ownedElement/>
+ </UML:Package>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="BzDeGrof35i3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="lQBEo3VLdIiB" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="yIVQyeIGHNsQ" aggregation="none" type="QCdiA5hU9IAb" name="" multiplicity="8" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="DWwHbcINxulG" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="L3waWG7FgHRS" aggregation="aggregate" type="L2ASUCoHdFZ0" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="KwlxER9BkcZg" aggregation="none" type="qIWnFzBd9oKJ" name="" multiplicity="1" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="UODsawo5TGgC" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="EqxWDnuWpq6J" aggregation="aggregate" type="QCdiA5hU9IAb" name="" multiplicity="1" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="4BZiS08nxui9" aggregation="none" type="tftTuiZXSv4R" name="" multiplicity="*" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="c6v3mGeXVqXR" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="LpI3SskggfAt" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="S4PFsTZuc8c5" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="T1xzpUO46GR3" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="false" xmi.id="8lq3fWDyKT2m" aggregation="none" type="L2ASUCoHdFZ0" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="LkQ1PZspdF5U" aggregation="none" type="tftTuiZXSv4R" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="rvcDZX0ujXxy" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="g5L0YLks59tS" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="ikIJzLnexCvh" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5IZpnXnsVu7G" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="BHXvPRI3Ud43" aggregation="aggregate" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="zmv2vmVbWlvU" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ <UML:Association isSpecification="false" visibility="public" namespace="Logical View" xmi.id="5eDSOP8QymCv" name="" >
+ <UML:Association.connection>
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="6i63s1i3IFyh" aggregation="composite" type="qIWnFzBd9oKJ" name="" />
+ <UML:AssociationEnd isSpecification="false" visibility="public" changeability="changeable" isNavigable="true" xmi.id="fGk9smCpX5rQ" aggregation="none" type="QCdiA5hU9IAb" name="" />
+ </UML:Association.connection>
+ </UML:Association>
+ </UML:Namespace.ownedElement>
+ <XMI.extension xmi.extender="umbrello" >
+ <diagrams>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="954" snapy="10" showatts="1" xmi.id="1" documentation="" type="1" showops="1" showpackage="0" name="class diagram" localid="900000" showstereotype="0" showscope="1" snapcsgrid="0" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1308" >
+ <widgets>
+ <classwidget usesdiagramfillcolour="1" width="324" showattsigs="601" usesdiagramusefillcolour="1" x="496" y="28" showopsigs="601" linewidth="none" fillcolour="none" height="240" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="qIWnFzBd9oKJ" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolour="1" width="426" showattsigs="601" usesdiagramusefillcolour="1" x="0" y="24" showopsigs="601" linewidth="none" fillcolour="none" height="615" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="QCdiA5hU9IAb" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,50,1,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolour="0" width="324" showattsigs="601" usesdiagramusefillcolour="0" x="490" y="317" showopsigs="601" linewidth="none" fillcolour="#ffffc0" height="285" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="L2ASUCoHdFZ0" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="0" width="302" showattsigs="601" usesdiagramusefillcolour="0" x="321" y="674" showopsigs="601" linewidth="none" fillcolour="#ffffc0" height="645" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="dQQc692tOFUS" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,50,1,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolour="1" width="271" showattsigs="601" usesdiagramusefillcolour="1" x="2" y="673" showopsigs="601" linewidth="none" fillcolour="none" height="435" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="tftTuiZXSv4R" showoperations="1" showpackage="0" showscope="1" font="Sans Serif,9,-1,5,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="4" indexa="1" totalcountb="5" indexb="1" linewidth="none" widgetbid="QCdiA5hU9IAb" widgetaid="qIWnFzBd9oKJ" xmi.id="BzDeGrof35i3" linecolor="none" >
+ <linepath>
+ <startpoint startx="496" starty="88" />
+ <endpoint endx="426" endy="147" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="804" y="310" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="118" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="436" y="409" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="118" text="8" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="2" totalcountb="5" indexb="2" linewidth="none" widgetbid="QCdiA5hU9IAb" widgetaid="qIWnFzBd9oKJ" xmi.id="5eDSOP8QymCv" linecolor="none" >
+ <linepath>
+ <startpoint startx="496" starty="148" />
+ <endpoint endx="426" endy="270" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="4" indexa="3" visibilityB="200" totalcountb="5" indexb="3" linewidth="none" widgetbid="QCdiA5hU9IAb" widgetaid="qIWnFzBd9oKJ" xmi.id="YMFSnX2eMexo" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="496" starty="208" />
+ <endpoint endx="426" endy="393" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="88" usesdiagramusefillcolour="1" x="660" y="687" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="+" isinstance="0" xmi.id="119" text="networks [8]" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="3" indexb="1" linewidth="none" widgetbid="qIWnFzBd9oKJ" widgetaid="L2ASUCoHdFZ0" xmi.id="DWwHbcINxulG" linecolor="none" >
+ <linepath>
+ <startpoint startx="598" starty="317" />
+ <endpoint endx="604" endy="268" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="618" y="283" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="120" showstereotype="1" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="660" y="270" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="121" showstereotype="1" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" totalcountb="5" indexb="4" linewidth="none" widgetbid="QCdiA5hU9IAb" widgetaid="L2ASUCoHdFZ0" xmi.id="c6v3mGeXVqXR" linecolor="none" >
+ <linepath>
+ <startpoint startx="490" starty="412" />
+ <endpoint endx="426" endy="516" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" visibilityB="200" totalcountb="3" indexb="2" linewidth="none" widgetbid="qIWnFzBd9oKJ" widgetaid="L2ASUCoHdFZ0" xmi.id="5n92zk1smX9k" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="706" starty="317" />
+ <endpoint endx="712" endy="268" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="87" usesdiagramusefillcolour="1" x="803" y="268" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="+" isinstance="0" xmi.id="122" showstereotype="1" text="netwoks_list" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="dQQc692tOFUS" widgetaid="L2ASUCoHdFZ0" xmi.id="AIGGTnEPvRIa" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="652" starty="602" />
+ <endpoint endx="472" endy="674" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="95" usesdiagramusefillcolour="1" x="474" y="653" linewidth="none" posttext="" role="710" fillcolour="none" height="19" usefillcolor="1" pretext="+" isinstance="0" xmi.id="123" text="sta_own_data" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="tftTuiZXSv4R" widgetaid="QCdiA5hU9IAb" xmi.id="UODsawo5TGgC" linecolor="none" >
+ <linepath>
+ <startpoint startx="213" starty="639" />
+ <endpoint endx="137" endy="673" />
+ </linepath>
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="208" y="639" linewidth="none" posttext="" role="701" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="124" showstereotype="1" text="1" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolour="1" width="32" usesdiagramusefillcolour="1" x="109" y="641" linewidth="none" posttext="" role="702" fillcolour="none" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="125" text="*" font="Sans Serif,9,-1,5,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" totalcountb="2" indexb="1" linewidth="none" widgetbid="tftTuiZXSv4R" widgetaid="L2ASUCoHdFZ0" xmi.id="T1xzpUO46GR3" linecolor="none" >
+ <linepath>
+ <startpoint startx="490" starty="507" />
+ <endpoint endx="273" endy="890" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ </diagrams>
+ </XMI.extension>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Use Case View" isRoot="false" isAbstract="false" name="Use Case View" >
+ <UML:Namespace.ownedElement>
+ <UML:Actor isSpecification="false" isLeaf="false" visibility="public" namespace="Use Case View" xmi.id="g2RmQlkG6CqM" isRoot="false" isAbstract="false" name="CP" />
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Component View" isRoot="false" isAbstract="false" name="Component View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Deployment View" isRoot="false" isAbstract="false" name="Deployment View" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ <UML:Model stereotype="2" isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="Entity Relationship Model" isRoot="false" isAbstract="false" name="Entity Relationship Model" >
+ <UML:Namespace.ownedElement/>
+ </UML:Model>
+ </UML:Namespace.ownedElement>
+ </UML:Model>
+ </XMI.content>
+ <XMI.extensions xmi.extender="umbrello" >
+ <docsettings viewid="1" documentation="" uniqueid="4095" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="803" id="rLUcIo7kRV6u" >
+ <listitem open="0" type="810" id="AP5TiteE7LRQ" label="add_avln" />
+ <listitem open="0" type="810" id="7H0owQzfSQY2" label="add_one_sta" />
+ <listitem open="0" type="810" id="RSnHUDavlWhS" label="add_some_stas" />
+ <listitem open="0" type="810" id="neR6JQh9hknw" label="get_avln" />
+ <listitem open="0" type="810" id="fx8vI9va2Fiw" label="get_sta" />
+ <listitem open="0" type="810" id="poqwIOBuIxHD" label="remove_avln" />
+ <listitem open="0" type="810" id="TXHwr69BCMDJ" label="remove_some_stas" />
+ <listitem open="0" type="810" id="m64ppNaUHAGt" label="remove_sta" />
+ </listitem>
+ <listitem open="0" type="807" id="1" label="class diagram" />
+ <listitem open="0" type="807" id="bZ62yFKbgidF" label="diagramme de classes" />
+ <listitem open="0" type="813" id="qIWnFzBd9oKJ" >
+ <listitem open="0" type="814" id="YMFSnX2eMexo" />
+ <listitem open="0" type="815" id="Qd9Ie0K9YadK" />
+ <listitem open="0" type="815" id="fhhadu0Xv5sq" />
+ <listitem open="0" type="815" id="qF2AzTzTvsRh" />
+ <listitem open="0" type="815" id="dvGudEhkvNbD" />
+ <listitem open="0" type="815" id="Ads5yTHiXj5l" />
+ <listitem open="0" type="815" id="vcDuDxLNPn0k" />
+ <listitem open="0" type="815" id="TWW8PYO3uR7v" />
+ <listitem open="0" type="815" id="Zuczoz8sRjYE" />
+ <listitem open="0" type="815" id="BwEmjKrCkKxW" />
+ <listitem open="0" type="815" id="thTkEhFFV82W" />
+ <listitem open="0" type="815" id="fEG2VdimBUrx" />
+ <listitem open="0" type="815" id="dEIri7aEIlnP" />
+ <listitem open="0" type="815" id="0swcx8FCE83L" />
+ <listitem open="0" type="815" id="iz4t8GAcZAqw" />
+ </listitem>
+ <listitem open="0" type="813" id="QCdiA5hU9IAb" >
+ <listitem open="0" type="814" id="9PZYdnDFOfZz" />
+ <listitem open="0" type="814" id="I2w0DZg3Mq2z" />
+ <listitem open="0" type="814" id="oQkVnlklYCyk" />
+ <listitem open="0" type="814" id="HiveU00Ud1Ud" />
+ <listitem open="0" type="814" id="tVZmk23YSl2D" />
+ <listitem open="0" type="814" id="fU07vNLGT9Ie" />
+ <listitem open="0" type="814" id="bJPnIIOxkO2f" />
+ <listitem open="0" type="814" id="kNvDWBsghjTC" />
+ <listitem open="0" type="814" id="jIkt6HtZ4hx8" />
+ <listitem open="0" type="814" id="AqQWPXxzCapd" />
+ <listitem open="0" type="814" id="p8FRmwBNLQgP" />
+ <listitem open="0" type="814" id="kr6KLUaiRjIH" />
+ <listitem open="0" type="814" id="0qvffRz2S8ru" />
+ <listitem open="0" type="814" id="S6pIWhJZQV41" />
+ <listitem open="0" type="815" id="L8nWSpKOxfIH" />
+ <listitem open="0" type="815" id="025OblSx0TOi" />
+ <listitem open="0" type="815" id="heL2xof0ahkF" />
+ <listitem open="0" type="815" id="3UBqgc2KKU2C" />
+ <listitem open="0" type="815" id="3ABOLzFXlfcB" />
+ <listitem open="0" type="815" id="3tINqVucAXnG" />
+ <listitem open="0" type="815" id="iaLbV3XXwoul" />
+ <listitem open="0" type="815" id="Yphrc2Jt91yg" />
+ <listitem open="0" type="815" id="LX3kth6enYII" />
+ <listitem open="0" type="815" id="iG9yQ3L5sqEx" />
+ <listitem open="0" type="815" id="1mIfdDNMRWIp" />
+ <listitem open="0" type="815" id="KaVaqfkWnW3C" />
+ <listitem open="0" type="815" id="KQuOiqL0MaDu" />
+ <listitem open="0" type="815" id="2TdT5mMiol3i" />
+ <listitem open="0" type="815" id="W8rOQJZys2Nh" />
+ <listitem open="0" type="815" id="LSNW129OipWM" />
+ <listitem open="0" type="815" id="ihLtnkq61iHr" />
+ <listitem open="0" type="815" id="ljJ5Ao4US5yj" />
+ <listitem open="0" type="815" id="Nsj0r8ybFTqj" />
+ <listitem open="0" type="815" id="tXX7yCe6ABln" />
+ <listitem open="0" type="815" id="po8WMv8qvmgP" />
+ <listitem open="0" type="815" id="eOkr2PyKZULL" />
+ <listitem open="0" type="815" id="pq6Gp6gvxZjX" />
+ <listitem open="0" type="815" id="EQSO9Nrh7vtl" />
+ <listitem open="0" type="815" id="z1wK2LaEl0as" />
+ <listitem open="0" type="815" id="Jjld2KdMoLhV" />
+ </listitem>
+ <listitem open="1" type="813" id="L2ASUCoHdFZ0" >
+ <listitem open="0" type="814" id="AIGGTnEPvRIa" />
+ <listitem open="0" type="814" id="5n92zk1smX9k" />
+ <listitem open="0" type="815" id="QXnrJp4mc3nZ" />
+ <listitem open="0" type="815" id="bxBBvbAGs7Q5" />
+ <listitem open="0" type="815" id="vk7FSeQIaeIS" />
+ <listitem open="0" type="815" id="5SqO4seTjRSa" />
+ <listitem open="0" type="815" id="qHxkg2dtESUh" />
+ <listitem open="0" type="815" id="2gQknmKqTzYm" />
+ <listitem open="0" type="815" id="DC8mABArXbfX" />
+ <listitem open="0" type="815" id="MulJvMHR2JsJ" />
+ <listitem open="0" type="815" id="FQgbp6OOPmCi" />
+ <listitem open="0" type="815" id="BwEmjKrCkKxW" />
+ <listitem open="0" type="815" id="i2znmIk8bVQ3" />
+ <listitem open="0" type="815" id="o7bH8l102RHc" />
+ <listitem open="0" type="815" id="NDGrlwJSDY8B" />
+ <listitem open="0" type="815" id="HwdXOmbaswch" />
+ <listitem open="0" type="815" id="1551" />
+ <listitem open="0" type="815" id="2495" />
+ </listitem>
+ <listitem open="1" type="813" id="dQQc692tOFUS" >
+ <listitem open="0" type="814" id="hcbUh4JlIu5E" />
+ <listitem open="0" type="814" id="MyhwT7zZG8oO" />
+ <listitem open="0" type="814" id="x5HJsnaGxZDg" />
+ <listitem open="0" type="814" id="RrbeL3wI6BZy" />
+ <listitem open="0" type="814" id="I16y7R8xSEes" />
+ <listitem open="0" type="814" id="VZjK8y2Pz9L4" />
+ <listitem open="0" type="814" id="0grlCK0Zd2kv" />
+ <listitem open="0" type="814" id="roOeP5mqSzsY" />
+ <listitem open="0" type="814" id="y8EthSZ1UdAy" />
+ <listitem open="0" type="814" id="TO2c4YFuL4qQ" />
+ <listitem open="0" type="814" id="Rxzl1nBWMvpT" />
+ <listitem open="0" type="814" id="gBfRCRdglWVE" />
+ <listitem open="0" type="814" id="3951" />
+ <listitem open="0" type="814" id="xAmypZKxOlvo" />
+ <listitem open="0" type="814" id="919bTPKjqxKs" />
+ <listitem open="0" type="814" id="MW7N3XqbJLli" />
+ <listitem open="0" type="814" id="mDBIcASUSrMN" />
+ <listitem open="0" type="814" id="aTEnETRcBPSB" />
+ <listitem open="0" type="814" id="21vGqBho1x7N" />
+ <listitem open="0" type="814" id="OsE9bhvHgqdb" />
+ <listitem open="0" type="815" id="l9iApQ5k7p4V" />
+ <listitem open="0" type="815" id="PNzGVGMN7IZO" />
+ <listitem open="0" type="815" id="oS3q3CNSaLg5" />
+ <listitem open="0" type="815" id="9tv3PTcwJuk2" />
+ <listitem open="0" type="815" id="DbAcS8Pc1KdP" />
+ <listitem open="0" type="815" id="lEJ2633MpMzJ" />
+ <listitem open="0" type="815" id="bLozAc1Tby5t" />
+ <listitem open="0" type="815" id="QacAXGqLr88z" />
+ <listitem open="0" type="815" id="XBpdlbprByih" />
+ <listitem open="0" type="815" id="x2pgMFGxFwzE" />
+ <listitem open="0" type="815" id="YWiBOMZqmmSC" />
+ <listitem open="0" type="815" id="gkXbpZt9r3e4" />
+ <listitem open="0" type="815" id="Cgo2iS6vpgKJ" />
+ <listitem open="0" type="815" id="4vv3FEH8vlii" />
+ <listitem open="0" type="815" id="h933zRw1Mr2a" />
+ <listitem open="0" type="815" id="Z2pjniRb4U5p" />
+ <listitem open="0" type="815" id="6Di8flw9tLlH" />
+ <listitem open="0" type="815" id="xXWGuINyU377" />
+ <listitem open="0" type="815" id="b2NRxvTAG4Im" />
+ <listitem open="0" type="815" id="wXFOX5u66GX3" />
+ <listitem open="0" type="815" id="4DPM1C2ZHS5c" />
+ <listitem open="0" type="815" id="tS98bISnuM92" />
+ </listitem>
+ <listitem open="0" type="813" id="tftTuiZXSv4R" >
+ <listitem open="0" type="814" id="w2lpqlcRNBky" />
+ <listitem open="0" type="814" id="KjxDjNipVmH6" />
+ <listitem open="0" type="814" id="nJw1e6ulB8mV" />
+ <listitem open="0" type="814" id="9SydFFh3ENAt" />
+ <listitem open="0" type="814" id="76E3M1i7iJGy" />
+ <listitem open="0" type="814" id="njbBHkqZRmmB" />
+ <listitem open="0" type="814" id="15VSrGbyiZbv" />
+ <listitem open="0" type="814" id="7SdojrmkwHBl" />
+ <listitem open="0" type="814" id="61vH7gnD8O1s" />
+ <listitem open="0" type="814" id="O3jgPKW1znfn" />
+ <listitem open="0" type="814" id="uZ2PRCIQqOal" />
+ <listitem open="0" type="814" id="SKPVcXpzB5Y4" />
+ <listitem open="0" type="814" id="FcAqRxkJWmhw" />
+ <listitem open="0" type="814" id="R3na9McOwmEN" />
+ <listitem open="0" type="814" id="jwhEhOAeLWRh" />
+ <listitem open="0" type="814" id="4ZF47cpCPQyM" />
+ <listitem open="0" type="815" id="AaNPCwE5GYpL" />
+ <listitem open="0" type="815" id="1HLA3MQK09Yr" />
+ <listitem open="0" type="815" id="BxTRzdcxFOCK" />
+ <listitem open="0" type="815" id="feEeHoZUCjo5" />
+ <listitem open="0" type="815" id="MEr8fhvtbOQD" />
+ <listitem open="0" type="815" id="azzTtnO4ApfB" />
+ <listitem open="0" type="815" id="aCtLsOAUOvwU" />
+ <listitem open="0" type="815" id="OSlCnQfCxj2t" />
+ <listitem open="0" type="815" id="kS58ufMfkgpT" />
+ <listitem open="0" type="815" id="bymR7cTq4Wyz" />
+ <listitem open="0" type="815" id="H29zTi1CMn0S" />
+ <listitem open="0" type="815" id="xjmXt0pRpbh7" />
+ </listitem>
+ <listitem open="1" type="830" id="Datatypes" >
+ <listitem open="1" type="829" id="ZsN7qO5uod0W" />
+ <listitem open="1" type="829" id="sXqfrqwPid2x" />
+ <listitem open="1" type="829" id="BsXuVmQldfSS" />
+ <listitem open="1" type="829" id="1lLAIoXrLdtJ" />
+ <listitem open="1" type="829" id="NMq7yPI15TF8" />
+ <listitem open="1" type="829" id="8MlMJZOa2gQQ" />
+ <listitem open="1" type="829" id="F0y42ZDGGZ49" />
+ <listitem open="1" type="829" id="bdvfq1CcRFQV" />
+ <listitem open="1" type="829" id="2TKfUnESr7J6" />
+ <listitem open="1" type="829" id="EhNquCdzHTzv" />
+ <listitem open="1" type="829" id="GXVTJzZt05VA" />
+ <listitem open="0" type="829" id="cignRXiUIpXF" />
+ <listitem open="1" type="829" id="TRzc3eNXqLr1" />
+ <listitem open="1" type="829" id="f1lxWwdNwvpr" />
+ <listitem open="1" type="829" id="RTeIWtKTDaZV" />
+ <listitem open="0" type="829" id="vntVp1gw0ZB8" />
+ <listitem open="1" type="829" id="0mEev7QHu3Xw" />
+ <listitem open="1" type="829" id="6agIp7Rg7jXE" />
+ <listitem open="1" type="829" id="yVCl3jm3PB1C" />
+ <listitem open="1" type="829" id="DcaQZXHCYAUY" />
+ <listitem open="1" type="829" id="m7hYSy5qW7Uv" />
+ <listitem open="1" type="829" id="emAuInlIaxvV" />
+ <listitem open="1" type="829" id="Shk6a1xmtUeN" />
+ <listitem open="1" type="829" id="l2nnsImcbvsP" />
+ <listitem open="1" type="829" id="WHsGhr6cL3qV" />
+ <listitem open="1" type="829" id="O01xtrLMY3S6" />
+ <listitem open="1" type="829" id="Q4TYO2bRfXJq" />
+ <listitem open="1" type="829" id="OF2Sin3o242W" />
+ <listitem open="1" type="829" id="G46rjYKTY5EP" />
+ <listitem open="1" type="829" id="aHp7fmMY11yJ" />
+ <listitem open="1" type="829" id="J5WdE6USg2qD" />
+ <listitem open="1" type="829" id="X7Q5Iud3fXPb" />
+ <listitem open="1" type="829" id="QPMsbNxuTUYh" />
+ <listitem open="1" type="829" id="nnvOyvzkSE17" />
+ <listitem open="1" type="829" id="LyzcKuBtjfar" />
+ <listitem open="1" type="829" id="oZHHg64PKBaq" />
+ <listitem open="0" type="829" id="nyW3ZjsRDxWm" />
+ <listitem open="1" type="829" id="5NqwrUH5XNxE" />
+ <listitem open="1" type="829" id="hz7D2ZH5u80l" />
+ <listitem open="1" type="829" id="tFhSKvrguqen" />
+ </listitem>
+ <listitem open="1" type="831" id="cxkkcPlqeSGi" >
+ <listitem open="0" type="839" id="7AfLHTarQIb0" />
+ <listitem open="0" type="839" id="1IbnbOCiWr4l" />
+ <listitem open="0" type="839" id="UsJ25EL4Uwr6" />
+ <listitem open="0" type="839" id="MWptygBQWUQa" />
+ </listitem>
+ <listitem open="1" type="831" id="SsuRPlPUGZjG" >
+ <listitem open="0" type="839" id="YGOeDlDfb740" />
+ <listitem open="0" type="839" id="8rMiHZwnqIP3" />
+ </listitem>
+ <listitem open="0" type="831" id="pBzpcllJMdsq" >
+ <listitem open="0" type="839" id="AYBjv2FiBCYl" />
+ <listitem open="0" type="839" id="TS9huSQ4zbmu" />
+ <listitem open="0" type="839" id="WTF7ViJwASd4" />
+ </listitem>
+ <listitem open="1" type="831" id="7PSrs3lMwQVn" >
+ <listitem open="0" type="839" id="200XB2ebUTRX" />
+ <listitem open="0" type="839" id="v7wHq2ss2qNB" />
+ <listitem open="0" type="839" id="VkDZ8Ke4QYJG" />
+ </listitem>
+ </listitem>
+ <listitem open="1" type="802" id="Use Case View" >
+ <listitem open="1" type="811" id="g2RmQlkG6CqM" />
+ </listitem>
+ <listitem open="1" type="821" id="Component View" />
+ <listitem open="1" type="827" id="Deployment View" />
+ <listitem open="1" type="836" id="Entity Relationship Model" />
+ </listitem>
+ </listview>
+ <codegeneration>
+ <codegenerator language="Java" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/cp/sta/mgr/inc/net.h b/cesar/cp/sta/mgr/inc/net.h
new file mode 100644
index 0000000000..6fcd5148a7
--- /dev/null
+++ b/cesar/cp/sta/mgr/inc/net.h
@@ -0,0 +1,127 @@
+#ifndef cp_sta_mgr_inc_net
+#define cp_sta_mgr_inc_net
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/inc/net.h
+ * \brief Private Network data.
+ * \ingroup cp_sta_mgr
+ *
+ * Get all the data about an AVLN.
+ *
+ * Context of a Network.
+ */
+
+#include "lib/set.h"
+#include "lib/slab.h"
+
+/** Enumerator for the mac to tei table in the CL. */
+enum cp_mactotei_tags_t
+{
+ CP_MACTOTEI_TAGS_LIST,
+ CP_MACTOTEI_TAGS_BRIDGE,
+ CP_MACTOTEI_TAGS_MAX
+};
+
+
+struct cp_net_t
+{
+ /** Indicate if it is the station's AVLN. If not the commit to
+ * dataplane will not have any effect. */
+ bool station_avln;
+
+ /** AVLN's SNID. */
+ cp_snid_t snid;
+
+ /** AVLN's NID. */
+ cp_nid_t nid;
+
+ /** The pointer to the CCo station. */
+ cp_sta_t * cco;
+
+ /** the pointer to the Pco station. */
+ cp_sta_t * pco;
+
+ /**
+ * The expiration date at the one this AVLN should be removed
+ * from the list. This will be verified in the garbage function.
+ */
+ uint expiration_ms;
+
+ /** The list of associated stations in the AVLN. */
+ set_t associated_stas;
+
+ /** Th list of unassociated stations in the AVLN. */
+ set_t unassociated_stas;
+
+ /** Present flag. */
+ bool present;
+
+ /** AVLN slot id. */
+ u8 avln_slot_id;
+
+ /**
+ * Slot usage mask read in the AVLN central beacon.
+ */
+ u8 avln_slot_usage;
+
+ /**
+ * Number of station in the network.
+ */
+ u8 num_stas;
+
+ /**
+ * Number of visible stations in the AVLN, correspond to the station
+ * visible or discovered by the station.
+ */
+ u8 num_visible_stas;
+
+ /**
+ * The network mode.
+ */
+ cp_net_network_mode_t network_mode;
+
+ /** Slab Cache. */
+ slab_cache_t sta_slab_cache;
+};
+
+
+/**
+ * Station Associated lesser.
+ *
+ * \param left left node station.
+ * \param right right node station.
+ * \return true if left is lesser than right
+ */
+bool
+cp_net_station_assoc_less (set_node_t *left, set_node_t *right);
+
+/**
+ * Station Unassociated lesser.
+ *
+ * \param left left node station.
+ * \param right right node station.
+ * \return true if left is lesser than right
+ */
+bool
+cp_net_station_unassoc_less (set_node_t *left, set_node_t *right);
+
+/**
+ * Garbage function for the unassociated station list and the associated
+ * station list.
+ *
+ * \param ctx the module context.
+ * \param net the network.
+ * \param date_ms the current date in milliseconds.
+ * \param status the station list to expire.
+ */
+void
+cp_net_garbage_station_list (cp_t *ctx, cp_net_t *net, u32 date_ms,
+ enum cp_sta_state_t status);
+
+#endif /* cp_sta_mgr_inc_net */
diff --git a/cesar/cp/sta/mgr/inc/net_list.h b/cesar/cp/sta/mgr/inc/net_list.h
new file mode 100644
index 0000000000..307e2d3c27
--- /dev/null
+++ b/cesar/cp/sta/mgr/inc/net_list.h
@@ -0,0 +1,35 @@
+#ifndef cp_sta_mgr_inc_net_list_h
+#define cp_sta_mgr_inc_net_list_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/inc/net_list_h
+ * \brief Private interface of the net list.
+ * \ingroup cp_sta_mgr
+ *
+ * « long description »
+ */
+
+#include "cp/sta/mgr/net_list.h"
+#include "cp/sta/mgr/net.h"
+
+/* Private interfaces. */
+#include "cp/sta/mgr/inc/net.h"
+
+/** Number of AVLNs. */
+#define CP_NET_LIST_NB_AVLN 8
+
+struct cp_net_list_t
+{
+ /**
+ * The possibles AVLN, index 0 corresponds to our AVLN.
+ */
+ cp_net_t networks [8];
+};
+
+#endif /* cp_sta_mgr_inc_net_list_h */
diff --git a/cesar/cp/sta/mgr/inc/sta.h b/cesar/cp/sta/mgr/inc/sta.h
new file mode 100644
index 0000000000..d42f4d49c3
--- /dev/null
+++ b/cesar/cp/sta/mgr/inc/sta.h
@@ -0,0 +1,77 @@
+#ifndef cp_sta_mgr_inc_sta_h
+#define cp_sta_mgr_inc_sta_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/inc/sta.h
+ * \brief Stations data.
+ * \ingroup cp_sta_mgr
+ *
+ * « long description »
+ */
+
+#include "cp/sta/mgr/sta.h"
+
+/**
+ * Control plane station.
+ */
+struct cp_sta_private_t
+{
+ /** Public interface. */
+ cp_sta_t public_data;
+
+ /**
+ * Station's tei.
+ */
+ cp_tei_t tei;
+
+ /**
+ * Station's mac address.
+ */
+ mac_t mac_address;
+
+ /**
+ * Indicate if the station is Visible by our station.
+ */
+ bool visible;
+
+ /**
+ * Indicate if the station is CCo.
+ */
+ bool is_cco;
+
+ /**
+ * GLID provided to the PCO to transmit a proxy beacon.
+ */
+ u8 pco_glid;
+
+ /**
+ * Indicate the state of the station.
+ */
+ cp_sta_state_t station_state;
+};
+typedef struct cp_sta_private_t cp_sta_private_t;
+
+
+/**
+ * Return a station object initialised.
+ *
+ * \return a station object initialised.
+ */
+cp_sta_t *
+cp_sta_init (void);
+
+/**
+ * Uninit the station.
+ * \param sta the station to uninit.
+ */
+void
+cp_sta_uninit (cp_sta_t *sta);
+
+
+#endif /* cp_sta_mgr_inc_sta_h */
diff --git a/cesar/cp/sta/mgr/inc/sta_mgr.h b/cesar/cp/sta/mgr/inc/sta_mgr.h
new file mode 100644
index 0000000000..1fc3788fde
--- /dev/null
+++ b/cesar/cp/sta/mgr/inc/sta_mgr.h
@@ -0,0 +1,32 @@
+#ifndef cp_sta_mgr_inc_context_h
+#define cp_sta_mgr_inc_context_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/inc/context.h
+ * \brief Station manager context.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "cp/sta/mgr/net_list.h"
+
+/* Private interfaces. */
+#include "cp/sta/mgr/inc/net_list.h"
+#include "cp/sta/mgr/inc/sta_own_data.h"
+
+struct cp_sta_mgr_t
+{
+ /** Network list. */
+ cp_net_list_t network_list;
+
+ /** Stations own data. */
+ cp_sta_own_data_private_t sta_own_data;
+};
+
+
+#endif /* cp_sta_mgr_inc_context_h */
diff --git a/cesar/cp/sta/mgr/inc/sta_own_data.h b/cesar/cp/sta/mgr/inc/sta_own_data.h
new file mode 100644
index 0000000000..fe80cc491d
--- /dev/null
+++ b/cesar/cp/sta/mgr/inc/sta_own_data.h
@@ -0,0 +1,82 @@
+#ifndef cp_sta_data_inc_sta_own_data_h
+#define cp_sta_data_inc_sta_own_data_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/data/inc/sta_own_data.h
+ * \brief Station own data.
+ * \ingroup cp_sta_data
+ *
+ */
+
+#include "cp/defs.h"
+
+#include "cp/sta/mgr/sta_own_data.h"
+
+/**
+ * Station own data.
+ */
+struct cp_sta_own_data_private_t
+{
+ /** Public data. */
+ cp_sta_own_data_t public;
+
+ /**
+ * station's TEI.
+ */
+ cp_tei_t tei;
+
+ /**
+ * Station's Mac address.
+ */
+ mac_t mac_addr;
+
+ /**
+ * Network Password, use by the station to crypt MMEs.
+ */
+ char npw [CP_NPW_MAX_SIZE + 1];
+
+ /**
+ * AVLN's NMK.
+ */
+ cp_key_t nmk;
+
+ /**
+ * Device password.
+ */
+ char dpw [CP_DPW_MAX_SIZE + 1];
+
+ /**
+ * Indicate if the station was CCo during the last use.
+ */
+ bool was_cco;
+
+ /**
+ * Security level. It can be changed by a specific message or by the
+ * HLE. See section 7.10.3.1.3 and section 13.3
+ */
+ cp_security_level_t security_level;
+
+ /**
+ * The PCO Glid.
+ */
+ u8 pco_glid;
+};
+
+/**
+ * Set the HFID.
+ *
+ * \param hfid the HFID to set.
+ * \param sta the station own data.
+ * \param data the human identifier.
+ */
+void
+cp_sta_own_data_set_hfid (const char *hfid, const char *data);
+
+
+#endif /* cp_sta_data_inc_sta_own_data_h */
diff --git a/cesar/cp/sta/mgr/net.h b/cesar/cp/sta/mgr/net.h
new file mode 100644
index 0000000000..ff4709d31f
--- /dev/null
+++ b/cesar/cp/sta/mgr/net.h
@@ -0,0 +1,399 @@
+#ifndef cp_net_h
+#define cp_net_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/net.h
+ * \brief Network data.
+ * \ingroup cp_sta_mgr
+ *
+ * Get all the data about an AVLN.
+ */
+
+#include "cp/cp.h"
+#include "cp/sta/mgr/sta.h"
+
+enum cp_net_network_mode_t
+{
+ CP_NET_NM_UNCOORDINATED,
+ CP_NET_NM_COORDINATED,
+ CP_NET_NM_CSMA_ONLY,
+ CP_NET_NM_ASSERT
+};
+typedef enum cp_net_network_mode_t cp_net_network_mode_t;
+
+/** Forward declaration. */
+typedef struct cp_net_t cp_net_t;
+
+/**
+ * Initialise the net.
+ * \param ctx the CP context.
+ * \param net the net to initialise.
+ * \param station_avln Indicate if it corresponds to the station's avln.
+ */
+void
+cp_net_init (cp_t *ctx, cp_net_t *net, bool station_avln);
+
+/**
+ * Uninitialise the net.
+ * \param ctx the module context.
+ * \param the net module.
+ */
+void
+cp_net_uninit (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Remove old station which has not been seen for a while.
+ * \param ctx the module context.
+ * \param net the network to garbage.
+ * \param date_ms the current date in milliseconds.
+ *
+ * Remove old station which has not been seen for a while.
+ */
+void
+cp_net_garbage_stations (cp_t *ctx, cp_net_t *net, u32 date_ms);
+
+/**
+ * Set the CCo or the PCo in the AVLN.
+ * \param ctx the module context.
+ * \param net the network module.
+ * \param cp the control plane context (set only if cco is true).
+ * \param tei the station's TEI.
+ * \param cco inform if it is the CCo (true) or the PCo (false).
+ */
+void
+cp_net_set_xco (cp_t *ctx, cp_net_t *net, cp_tei_t tei, bool cco);
+
+/**
+ * Set the CCo in the Network list.
+ * \param ctx the module context.
+ * \param net the network.
+ * \param tei The Station's TEI which is the CCo.
+ *
+ * Shall update the data bases.
+ */
+extern inline void
+cp_net_set_cco (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
+{
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (tei);
+ cp_net_set_xco (ctx, net, tei, true);
+}
+
+/**
+ * Set the PCo for this station.
+ * \param ctx the module context.
+ * \param net the network.
+ * \param tei PCo's tei.
+ *
+ * Set the PCo for this network to communicate to another network.
+ */
+extern inline void
+cp_net_set_pco (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
+{
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (tei);
+ cp_net_set_xco (ctx, net, tei, false);
+}
+
+/**
+ * Get the CCo of this AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \return A reference on the CCo station or NULL if this station is CCo.
+ * The user is responsible to release the reference.
+ */
+cp_sta_t *
+cp_net_get_cco (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Get the peer structure of the CCo of this AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \param peer peer structure pointer.
+ *
+ * This is a fatal error if there is no CCo or this station is the CCo.
+ */
+void
+cp_net_get_cco_peer (cp_t *ctx, cp_net_t *net, cp_mme_peer_t *peer);
+
+/**
+ * Get the PCo of the AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \return A reference on the PCo station.
+ *
+ * The user is responsible to release the reference.
+ */
+cp_sta_t *
+cp_net_get_pco (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Get the peer structure of the PCo of the AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \param peer peer structure pointer.
+ *
+ * This is a fatal error if there is no PCo.
+ */
+void
+cp_net_get_pco_peer (cp_t *ctx, cp_net_t *net, cp_mme_peer_t *peer);
+
+/**
+ * Add a station to the AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \param tei Station's TEI.
+ * \param mac_address Station's mac address.
+ * \return A reference on the station just created.
+ *
+ * This function shall update the data of the AVLN if it has changed
+ * i.e. cco, pco.
+ */
+cp_sta_t *
+cp_net_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address);
+
+/**
+ * Remove the station from the AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param tei The Station's TEI.
+ *
+ * Remove the station from the AVLN.
+ */
+void
+cp_net_sta_remove_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei);
+
+/**
+ * Remove an unassociated station from the list.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param mac_addr The station's mac address.
+ *
+ */
+void
+cp_net_sta_remove_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac_addr);
+
+/**
+ * Remove the station from the net.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param sta The station to remove.
+ *
+ * The user shall release the reference
+ */
+void
+cp_net_sta_remove (cp_t *ctx, cp_net_t *net, cp_sta_t * sta);
+
+/**
+ * Get the station identified by its TEI.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param tei The station's tei.
+ * \return A reference on the station.
+ *
+ * returns NULL if the station does not exists. It only returns a new
+ * reference on the station (one reference is still kept by the network),
+ * when the user does not use it any more, it must release it.
+ */
+cp_sta_t *
+cp_net_get_sta (cp_t *ctx, cp_net_t *net, cp_tei_t tei);
+
+/**
+ * Get the associated station identified by its Mac address.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param mac_address The station's mac_address.
+ * \return A reference on the station.
+ *
+ * returns NULL if the station does not exists. It only returns a new
+ * reference on the station (one reference is still kept by the network),
+ * when the user does not use it any more, it must release it.
+ */
+cp_sta_t *
+cp_net_get_sta_from_mac (cp_t *ctx, cp_net_t *net, mac_t mac_addr);
+
+/**
+ * Get the unassociated station identified by its Mac address.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param mac_address The station's mac_address.
+ * \return A reference on the station.
+ *
+ * returns NULL if the station does not exists. It only returns a new
+ * reference on the station (one reference is still kept by the network),
+ * when the user does not use it any more, it must release it.
+ */
+cp_sta_t *
+cp_net_get_sta_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac_addr);
+
+/**
+ * Commit the changes of the AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ *
+ * Use to commit the changes in the others databases. Only call this
+ * function when all the stations have been added, or all stations have
+ * been removed. This will check the modifications of the network station
+ * list to update at least the mactotei table. It is useful to synchronize
+ * those tables because the mactotei table does not have the possibility
+ * to remove stations it only have the possibility to remove the station
+ * by excluding it from the copy to the new one.
+ */
+void
+cp_net_commit_to_dataplane (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Returns the first station of an AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param status to search in the associated stations or unassociated STAs.
+ * \return the Station with the minimal TEI for the associated stations, the
+ * one with the minimal mac address for the unassociated.
+ *
+ * Returns a reference to the first station of an AVLN.
+ */
+cp_sta_t *
+cp_net_get_first (cp_t *ctx, cp_net_t *net, enum cp_sta_state_t status);
+
+/**
+ * Get the next station from the AVLN stating by the previous one already
+ * request.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param prev_sta the previous station requested, whose reference is
+ * released.
+ * \return the next station.
+ *
+ * This function shall be call after get_first.
+ *
+ * Returns a reference to the next station, release a reference to the
+ * previous station. This is done to make this kind of loop easy:
+ *
+ * \code
+ * for (sta = cp_net_get_first (ctx, net, CP_STA_STATE_EXISTS;
+ * sta; sta = cp_net_get_next (ctx, net, sta))
+ * {
+ * ...
+ * }
+ * \endcode
+ */
+cp_sta_t *
+cp_net_get_next (cp_t *ctx, cp_net_t *net, cp_sta_t *prev_sta);
+
+/**
+ * Get the network SNID.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return The network SNID.
+ */
+cp_snid_t
+cp_net_get_snid (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Get the AVLN NID.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return The network NID.
+ */
+cp_nid_t
+cp_net_get_nid (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Set the AVLN slot id and slot usage.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param slot_id The AVLN Slot id.
+ * \param slot_usage the AVLN slot usage mask
+ */
+void
+cp_net_set_slot_id_and_usage (cp_t *ctx, cp_net_t *net,
+ u8 slot_id, u8 slot_usage);
+
+/**
+ * Get the slot id of the network.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return the slot id of the central beacon.
+ */
+u8
+cp_net_get_slot_id (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Return the slot usage mask of the AVLN read in the central beacon of
+ * the AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return The slot usage mask read in the central beacon.
+ *
+ */
+u8
+cp_net_get_slot_usage_mask (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Get the number of station discovered in the AVLN.
+ * \param net the network context.
+ * \return the number of discovered stations.
+ */
+u8
+cp_net_get_num_discovered_stas (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Get the number of station of the AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return Return the number of station in the AVLN.
+ *
+ */
+u8
+cp_net_get_num_stas (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Set the current network mode.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param mode the mode.
+ */
+void
+cp_net_set_nm (cp_t *ctx, cp_net_t *net, cp_net_network_mode_t mode);
+
+/**
+ * Get the current network mode.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return mode the mode.
+ */
+cp_net_network_mode_t
+cp_net_get_nm (cp_t *ctx, cp_net_t *net);
+
+/**
+ * Set the visible status of the station.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param sta Set the visible status of the station.
+ * \param status the status.
+ *
+ */
+void
+cp_net_sta_set_visible_status (cp_t *ctx, cp_net_t *net, cp_sta_t * sta,
+ cp_sta_visible_state_t status);
+
+/**
+ * Get the status of the network.
+ * \param ctx the context module.
+ * \param net the network context.
+ * \return true if empty, false otherwise.
+ *
+ * This function only check the associated station list in the network.
+ */
+bool
+cp_net_is_empty (cp_t *ctx, cp_net_t *net);
+
+#endif /* cp_net_h */
diff --git a/cesar/cp/sta/mgr/net_list.h b/cesar/cp/sta/mgr/net_list.h
new file mode 100644
index 0000000000..93d83a150a
--- /dev/null
+++ b/cesar/cp/sta/mgr/net_list.h
@@ -0,0 +1,158 @@
+#ifndef cp_sta_mgr_net_list_h
+#define cp_sta_mgr_net_list_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/net_list_h
+ * \brief Public interface for the net list.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "cp/types.h"
+
+#include "cp/sta/mgr/net.h"
+
+/** Forward declaration. */
+typedef struct cp_net_list_t cp_net_list_t;
+
+/**
+ * Initialise the lists.
+ * \param ctx the module context.
+ * \param network the network list.
+ */
+void
+cp_net_list_init (cp_t *ctx, cp_net_list_t *network);
+
+/** Uninitialise the network list.
+ * \param ctx the module context.
+ * \param network the network list.
+ */
+void
+cp_net_list_uninit (cp_t *ctx, cp_net_list_t *network);
+
+/**
+ * Calls the sub modules garbage to remove old data.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param date_ms the current date in milliseconds.
+ */
+void
+cp_net_list_garbage_net (cp_t *ctx, cp_net_list_t *network, u32 date_ms);
+
+/**
+ * Add an AVLN to the list.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param snid The AVLN's SNID to add.
+ * \param nid The AVLN's NID to add.
+ * \return return the network added.
+ */
+cp_net_t *
+cp_net_list_add_avln (cp_t *ctx, cp_net_list_t *network,
+ cp_snid_t snid, cp_nid_t nid);
+
+/**
+ * Removes an AVLN from the sta manager.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param snid The AVLN's SNID to remove.
+ * \param nid The AVLN's NID to remove.
+ */
+void
+cp_net_list_remove_avln (cp_t *ctx, cp_net_list_t *network,
+ cp_snid_t snid, cp_nid_t nid);
+
+/**
+ * Returns the AVLN corresponding to the snid and nid.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param snid The AVLN's snid to get.
+ * \param nid The AVLN's NID to get.
+ * \return return the network.
+ */
+cp_net_t *
+cp_net_list_get_avln (cp_t *ctx, cp_net_list_t *network,
+ cp_snid_t snid, cp_nid_t nid);
+
+/**
+ * Return a new reference on our avln.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return return the network.
+ */
+cp_net_t *
+cp_net_list_get_our_avln (cp_t *ctx, cp_net_list_t *network);
+
+/**
+ * Update our AVLN snid.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param snid Our AVLN new SNID.
+ */
+void
+cp_net_list_update_our_avln_snid (cp_t *ctx, cp_net_list_t *network,
+ cp_snid_t snid);
+
+/**
+ * Update our AVLN NID.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param nid Our AVLN new NID.
+ */
+void
+cp_net_list_update_our_avln_nid (cp_t *ctx, cp_net_list_t *network,
+ cp_nid_t nid);
+
+/**
+ * Verify if the network list is empty and return true if it is.
+ * \param ctx the module context.
+ * \param network the network module.
+ * \return true if network list is empty, false otherwise.
+ */
+bool
+cp_net_list_is_empty (cp_t *ctx, cp_net_list_t *network);
+
+/**
+ * Create a 16 bits flag indicating which SNID are in use.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return A 16 bits flag
+ */
+u16
+cp_net_list_get_snid_present (cp_t *ctx, cp_net_list_t *network);
+
+/**
+ * Get the slot usage of the AVLNs.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return the slot usage mask.
+ *
+ * It corresponds to a 8 bits field
+ */
+u8
+cp_net_list_get_slot_usage (cp_t *ctx, cp_net_list_t *network);
+
+/**
+ * Get the number of discovered station on all AVLNs.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return the number of discovered station.
+ */
+u8
+cp_net_list_get_num_discovered_stas (cp_t *ctx, cp_net_list_t *network);
+
+/**
+ * Get the number of discovered networks.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return the number of discovered networks.
+ */
+u8
+cp_net_list_get_num_discovered_net (cp_t *ctx, cp_net_list_t *network);
+
+#endif /* cp_sta_mgr_net_list_h */
diff --git a/cesar/cp/sta/mgr/src/net.c b/cesar/cp/sta/mgr/src/net.c
new file mode 100644
index 0000000000..6865d26a85
--- /dev/null
+++ b/cesar/cp/sta/mgr/src/net.c
@@ -0,0 +1,969 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/src/net.c
+ * \brief Network APIs.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "lib/blk.h"
+
+#include "cl/cl_mactotei.h"
+#include "mac/common/ntb.h"
+#include "mac/common/timings.h"
+
+#include "cp/defs.h"
+#include "cp/fsm/fsm.h"
+#include "cp/sta/mgr/net.h"
+#include "cp/sta/mgr/sta.h"
+#include "cp/sta/mgr/sta_own_data.h"
+#include "cp/sta/mgr/sta_mgr.h"
+
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/net.h"
+#include "cp/sta/mgr/inc/sta.h"
+
+/**
+ * Station Associated lesser.
+ *
+ * \param left left node station.
+ * \param right right node station.
+ * \return true if left is lesser than right
+ */
+bool
+cp_net_station_assoc_less (set_node_t *left, set_node_t *right)
+{
+ cp_sta_private_t *sta_left;
+ cp_sta_private_t *sta_right;
+
+ dbg_assert (left);
+ dbg_assert (right);
+
+ sta_left = (cp_sta_private_t *) PARENT_OF (cp_sta_t,
+ node, left);
+ sta_right = (cp_sta_private_t *) PARENT_OF (cp_sta_t,
+ node, right);
+
+ if (sta_left->tei < sta_right->tei)
+ return true;
+ else
+ return false;
+}
+
+/**
+ * Station Unassociated lesser.
+ *
+ * \param left left node station.
+ * \param right right node station.
+ * \return true if left is lesser than right
+ */
+bool
+cp_net_station_unassoc_less (set_node_t *left, set_node_t *right)
+{
+ cp_sta_private_t *sta_left;
+ cp_sta_private_t *sta_right;
+
+ dbg_assert (left);
+ dbg_assert (right);
+
+ sta_left = (cp_sta_private_t *) PARENT_OF (cp_sta_t,
+ node, left);
+ sta_right = (cp_sta_private_t *) PARENT_OF (cp_sta_t,
+ node, right);
+
+ if (sta_left->mac_address < sta_right->mac_address)
+ return true;
+ else
+ return false;
+}
+
+
+/**
+ * Initialise the net.
+ * \param ctx the CP context.
+ * \param net the net to initialise.
+ * \param station_avln Indicate if it corresponds to the station's avln.
+ */
+void
+cp_net_init (cp_t *ctx, cp_net_t *net, bool station_avln)
+{
+ dbg_assert (net);
+
+ memset (net, 0, sizeof (cp_net_t));
+
+ net->station_avln = station_avln;
+ net->present = station_avln;
+ net->expiration_ms = MAC_SEC_TO_MS(CP_NET_EXPIRATION_DELAY_S);
+ net->network_mode = CP_NET_NM_CSMA_ONLY;
+
+ set_init (&net->associated_stas, cp_net_station_assoc_less);
+ set_init (&net->unassociated_stas, cp_net_station_unassoc_less);
+
+ slab_cache_init (&net->sta_slab_cache,
+ "Station cache",
+ sizeof (cp_sta_private_t),
+ (slab_object_destructor_t) cp_sta_uninit);
+}
+
+/**
+ * Uninitialise the net.
+ * \param ctx the module context.
+ * \param net the net to uninitialise.
+ */
+void
+cp_net_uninit (cp_t *ctx, cp_net_t *net)
+{
+ cp_sta_t *sta;
+
+ dbg_assert (net);
+
+ while (!set_empty (&net->unassociated_stas))
+ {
+ sta = PARENT_OF (cp_sta_t, node,
+ set_begin (&net->unassociated_stas));
+
+ set_remove (&net->unassociated_stas, &sta->node);
+ slab_release (sta);
+ }
+
+ while (!set_empty (&net->associated_stas))
+ {
+ sta = PARENT_OF (cp_sta_t, node,
+ set_begin (&net->associated_stas));
+
+ set_remove (&net->associated_stas, &sta->node);
+ slab_release (sta);
+ }
+
+ // Uninitialise the slabs cache.
+ slab_cache_uninit (&net->sta_slab_cache);
+ cp_net_init (ctx, net, net->station_avln);
+}
+
+/**
+ * Garbage function for the unassociated station list and the associated
+ * station list.
+ *
+ * \param ctx the module context.
+ * \param net the network.
+ * \param date_ms the current date in milliseconds.
+ * \param status the station list to expire.
+ */
+void
+cp_net_garbage_station_list (cp_t *ctx, cp_net_t *net, u32 date_ms,
+ enum cp_sta_state_t status)
+{
+ cp_sta_t *sta_next;
+ cp_sta_t *sta;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+
+ if (status >= CP_STA_STATE_ASSERT)
+ return;
+
+ for (sta = cp_net_get_first (ctx, net, status); sta; sta = sta_next)
+ {
+ slab_addref (sta);
+ sta_next = cp_net_get_next (ctx, net, sta);
+
+ if (less_mod2p32(sta->last_seen_ms
+ + MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S),
+ date_ms))
+ {
+ cp_net_sta_remove (ctx, net, sta);
+ }
+
+ slab_release (sta);
+ }
+}
+
+/**
+ * Remove old station which has not been seen for a while.
+ * \param ctx the module context.
+ * \param net the network to garbage.
+ * \param date_ms the current date in milliseconds.
+ *
+ * Remove old station which has not been seen for a while.
+ */
+void
+cp_net_garbage_stations (cp_t *ctx, cp_net_t *net, u32 date_ms)
+{
+ dbg_assert (ctx);
+ dbg_assert (net);
+
+ cp_net_garbage_station_list (ctx, net, date_ms, CP_STA_STATE_EXISTS);
+ cp_net_garbage_station_list (ctx, net, date_ms, CP_STA_STATE_ASSOCIATED);
+
+ // Verify if the list not empty.
+ if (set_empty (&net->associated_stas)
+ && set_empty (&net->unassociated_stas))
+ {
+ //TODO Post the event in the FSM.
+ net->present = false;
+ }
+}
+
+/**
+ * Set the CCo or the PCo in the AVLN.
+ * \param ctx the module context.
+ * \param cp the control plane context (set only if cco is true).
+ * \param tei the station's TEI.
+ * \param cco inform if it is the CCo (true) or the PCo (false).
+ */
+void
+cp_net_set_xco (cp_t *ctx, cp_net_t *net, cp_tei_t tei, bool cco)
+{
+ cp_sta_t *sta = NULL;
+ bool not_my_sta = true;
+
+ dbg_assert (net);
+ dbg_assert (tei);
+
+ if (net->station_avln && cco)
+ {
+ dbg_assert (ctx);
+ cp_sta_own_data_t *my_sta;
+
+ my_sta = cp_sta_mgr_get_sta_own_data (ctx);
+ if (cp_sta_own_data_get_tei (ctx) == tei)
+ {
+ my_sta = cp_sta_mgr_get_sta_own_data (ctx);
+ my_sta->is_cco = true;
+ not_my_sta = false;
+ }
+ else
+ {
+ my_sta->is_cco = false;
+ }
+ }
+
+ if (not_my_sta)
+ sta = cp_net_get_sta (ctx, net, tei);
+
+ if (cco)
+ {
+ net->cco = sta;
+ if (not_my_sta)
+ ((cp_sta_private_t*)sta)->is_cco = true;
+ }
+ else
+ {
+ net->pco = sta;
+ if (not_my_sta)
+ ((cp_sta_private_t*)sta)->pco_glid = (0x80);
+ }
+
+ if (sta)
+ slab_release (sta);
+}
+
+/**
+ * Get the CCo of this AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \return A reference on the CCo station or NULL if this station is CCo.
+ * The user is responsible to release the reference.
+ */
+cp_sta_t *
+cp_net_get_cco (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ if (net->cco)
+ {
+ slab_addref (net->cco);
+ return net->cco;
+ }
+ else
+ return NULL;
+}
+
+/**
+ * Get the peer structure of the CCo of this AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \param peer peer structure pointer.
+ *
+ * This is a fatal error if there is no CCo or this station is the CCo.
+ */
+void
+cp_net_get_cco_peer (cp_t *ctx, cp_net_t *net, cp_mme_peer_t *peer)
+{
+ dbg_assert (net);
+ dbg_assert (peer);
+ dbg_assert (net->cco);
+ cp_sta_get_peer (net->cco, peer);
+}
+
+/**
+ * Get the PCo of the AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \return A reference on the PCo station.
+ *
+ * The user is responsible to release the reference.
+ */
+cp_sta_t *
+cp_net_get_pco (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ if (net->pco)
+ {
+ slab_addref (net->pco);
+ return net->pco;
+ }
+ else
+ return NULL;
+}
+
+/**
+ * Get the peer structure of the PCo of the AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \param peer peer structure pointer.
+ *
+ * This is a fatal error if there is no PCo.
+ */
+void
+cp_net_get_pco_peer (cp_t *ctx, cp_net_t *net, cp_mme_peer_t *peer)
+{
+ dbg_assert (net);
+ dbg_assert (peer);
+ dbg_assert (net->pco);
+ cp_sta_get_peer (net->pco, peer);
+}
+
+/**
+ * Add a station to the AVLN.
+ * \param ctx the module context.
+ * \param net the network.
+ * \param tei Station's TEI.
+ * \param mac_address Station's mac address.
+ * \return A reference on the station just created.
+ *
+ * This function shall update the data of the AVLN if it has changed
+ * i.e. cco, pco.
+ */
+cp_sta_t *
+cp_net_sta_add (cp_t *ctx, cp_net_t *net, cp_tei_t tei, mac_t mac_address)
+{
+ cp_sta_private_t *sta = NULL;
+ bool already_exists;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (tei || mac_address);
+
+ // Try to get the station.
+ if (tei)
+ sta = (cp_sta_private_t *) cp_net_get_sta (ctx, net, tei);
+ else
+ /* Try to get the sta from the mac address. */
+ sta = (cp_sta_private_t *) cp_net_get_sta_unassoc (ctx, net,
+ mac_address);
+
+ if (!sta)
+ {
+ sta = (cp_sta_private_t *) cp_sta_init ();
+ already_exists = false;
+ }
+ else
+ {
+ slab_release (sta);
+ already_exists = true;
+ }
+
+ if (tei)
+ sta->station_state = CP_STA_STATE_ASSOCIATED;
+ sta->tei = tei;
+
+ if (mac_address != 0)
+ sta->mac_address = mac_address;
+
+ if (!already_exists)
+ {
+ net->num_visible_stas ++;
+ net->num_stas ++;
+ sta->visible = true;
+
+ set_node_init (&((cp_sta_t *)sta)->node);
+
+ // Add the station to the non unassociated list.
+ if (tei == 0)
+ {
+ bool state;
+ state = set_insert (&net->unassociated_stas,
+ &((cp_sta_t *)sta)->node);
+ dbg_check (state);
+ }
+ // Add the station to the authenticated list.
+ else
+ {
+ bool state;
+ state = set_insert (&net->associated_stas,
+ &((cp_sta_t *)sta)->node);
+ dbg_check (state);
+ }
+ }
+
+ // Add a reference on the station.
+ slab_addref (sta);
+ return (cp_sta_t *) sta;
+}
+
+/**
+ * Remove the station from the AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param tei The Station's TEI.
+ *
+ * Remove the station from the AVLN.
+ */
+void
+cp_net_sta_remove_assoc (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
+{
+ cp_sta_private_t *sta;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (tei);
+
+ sta = (cp_sta_private_t *) cp_net_get_sta (ctx, net, tei);
+
+ // Verify the node and delete the node from the set.
+ if (sta)
+ {
+ // The get STA returns another reference on the station which we
+ // want to release this reference is not useful, this release
+ // allows to remove the reference just added by the get STA.
+ slab_release (sta);
+
+ // decrease the visible counter
+ if (sta->visible)
+ net->num_visible_stas --;
+
+ // If the station is CCo, modify the net CCo pointer to NULL.
+ if (sta->is_cco)
+ net->cco = NULL;
+
+ // If the station is PCo to communicate with the CCo, modify the
+ // pointer in the net.
+ if ((sta->pco_glid >= 0x80) && (net->pco == (cp_sta_t *) sta))
+ net->pco = NULL;
+
+ set_remove (&net->associated_stas, &((cp_sta_t *)sta)->node);
+
+ net->num_stas --;
+ //release the station.
+ slab_release (sta);
+ }
+
+ if (cp_sta_mgr_net_list_is_empty (ctx))
+ {
+ cp_fsm_event_t *event;
+ event = cp_fsm_event_bare_new (ctx,
+ CP_FSM_EVENT_TYPE_net_list_empty);
+ cp_fsm_post (ctx, event);
+ }
+}
+
+/**
+ * Remove an unassociated station from the list.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param mac_addr The station's mac address.
+ *
+ */
+void
+cp_net_sta_remove_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac_addr)
+{
+ cp_sta_t *sta;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (mac_addr);
+
+ sta = cp_net_get_sta_unassoc (ctx, net, mac_addr);
+
+ // Verify the node and delete the node from the set.
+ if (sta)
+ {
+ // decrease the visible counter
+ if (((cp_sta_private_t *)sta)->visible)
+ net->num_visible_stas --;
+
+ // The get STA returns another reference on the station which we
+ // want to release this reference is not useful, this release
+ // allows to remove the reference just added by the get STA.
+ slab_release (sta);
+
+ set_remove (&net->unassociated_stas, &sta->node);
+
+ net->num_stas --;
+ //release the station.
+ slab_release (sta);
+ }
+}
+
+/**
+ * Remove the station from the net.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param sta The station to remove.
+ *
+ * The user shall release the reference
+ */
+void
+cp_net_sta_remove (cp_t *ctx, cp_net_t *net, cp_sta_t * sta)
+{
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (sta);
+
+ if(cp_sta_get_state(sta) != CP_STA_STATE_EXISTS)
+ cp_net_sta_remove_assoc (ctx, net, ((cp_sta_private_t *)sta)->tei);
+ else
+ cp_net_sta_remove_unassoc (ctx, net, ((cp_sta_private_t
+ *)sta)->mac_address);
+}
+
+/**
+ * Get the associated station identified by its Mac address.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param mac_address The station's mac_address.
+ * \return A reference on the station.
+ *
+ * returns NULL if the station does not exists. It only returns a new
+ * reference on the station (one reference is still kept by the network),
+ * when the user does not use it any more, it must release it.
+ */
+cp_sta_t *
+cp_net_get_sta_from_mac (cp_t *ctx, cp_net_t *net, mac_t mac_addr)
+{
+ cp_sta_t *sta;
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (mac_addr);
+
+ sta = cp_net_get_first (ctx, net, CP_STA_STATE_ASSOCIATED);
+ while (sta && cp_sta_get_mac_address (sta) != mac_addr)
+ {
+ sta = cp_net_get_next (ctx, net, sta);
+ }
+
+ return sta;
+}
+
+/**
+ * Get the unassociated station identified by its Mac address.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param mac_address The station's mac_address.
+ * \return A reference on the station.
+ *
+ * returns NULL if the station does not exists. It only returns a new
+ * reference on the station (one reference is still kept by the network),
+ * when the user does not use it any more, it must release it.
+ */
+cp_sta_t *
+cp_net_get_sta_unassoc (cp_t *ctx, cp_net_t *net, mac_t mac_addr)
+{
+ cp_sta_t *sta;
+ cp_sta_private_t sta_to_find;
+ set_node_t *sta_node;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (mac_addr);
+
+ // if list is empty do nothing.
+ if (set_empty (&net->unassociated_stas))
+ return NULL;
+
+ sta_to_find.mac_address = mac_addr;
+ set_node_init (&sta_to_find.public_data.node);
+
+ sta_node = set_find (&net->unassociated_stas,
+ &sta_to_find.public_data.node);
+
+ if (!sta_node)
+ return NULL;
+
+ sta = PARENT_OF (cp_sta_t, node, sta_node);
+ slab_addref (sta);
+ return (cp_sta_t *) sta;
+}
+
+
+/**
+ * Get the station identified by its TEI.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param tei The station's tei.
+ * \return A reference on the station.
+ *
+ * returns NULL if the station does not exists. It only returns a new
+ * reference on the station (one reference is still kept by the network),
+ * when the user does not use it any more, it must release it.
+ */
+cp_sta_t *
+cp_net_get_sta (cp_t *ctx, cp_net_t *net, cp_tei_t tei)
+{
+ cp_sta_t *sta;
+ cp_sta_private_t sta_to_find;
+ set_node_t *sta_node;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+ dbg_assert (tei);
+
+ // if list is empty do nothing.
+ if (set_empty (&net->associated_stas))
+ return NULL;
+
+ sta_to_find.tei = tei;
+ set_node_init (&sta_to_find.public_data.node);
+
+ sta_node = set_find (&net->associated_stas,
+ &sta_to_find.public_data.node);
+
+ if (!sta_node)
+ return NULL;
+
+ sta = PARENT_OF (cp_sta_t, node, sta_node);
+ slab_addref (sta);
+ return sta;
+}
+
+/**
+ * Commit the changes of the AVLN.
+ * \param ctx the module context.
+ * \param cp the CP context.
+ *
+ * Use to commit the changes in the others databases. Only call this
+ * function when all the stations have been added, or all stations have
+ * been removed. This will check the modifications of the network station
+ * list to update at least the mactotei table. It is useful to synchronize
+ * those tables because the mactotei table does not have the possibility
+ * to remove stations it only have the possibility to remove the station
+ * by excluding it from the copy to the new one.
+ */
+void
+cp_net_commit_to_dataplane (cp_t *ctx, cp_net_t *net)
+{
+ cp_sta_t *sta;
+ cl_mactotei_blk_t *mactotei;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+
+ // If the net does not correspond to the AVLN, do not commit.
+ if (!net->station_avln)
+ return;
+
+ // Get the first station from the set.
+ if (set_empty (&net->associated_stas))
+ return;
+
+ // There is at least a station in the network list.
+ mactotei = cl_mactotei_new ();
+
+ for (sta = cp_net_get_first (ctx, net, CP_STA_STATE_ASSOCIATED);
+ sta; sta = cp_net_get_next (ctx, net, sta))
+ {
+ cp_sta_private_t *sta_private = (cp_sta_private_t *) sta;
+ // Copy all the bridge table from the previous list.
+ cl_mactotei_copy_tei_and_tag (ctx->cl, mactotei, sta_private->tei,
+ CP_MACTOTEI_TAGS_BRIDGE);
+ // Add the current station.
+ cl_mactotei_addr_add (mactotei, sta_private->mac_address,
+ sta_private->tei, CP_MACTOTEI_TAGS_LIST);
+
+ }
+
+ // Request the CL to use the table.
+ cl_mactotei_use_table (ctx->cl, mactotei);
+}
+
+/**
+ * Returns the first station of an AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param status to search in the associated stations or unassociated STAs.
+ * \return the Station with the minimal TEI for the associated stations, the
+ * one with the minimal mac address for the unassociated.
+ *
+ * Returns the first station of an AVLN.
+ * The user has the responsibility to release the reference.
+ */
+cp_sta_t *
+cp_net_get_first (cp_t *ctx, cp_net_t *net, enum cp_sta_state_t status)
+{
+ set_t *set;
+ cp_sta_t *sta;
+
+ dbg_assert (net);
+ dbg_assert (ctx);
+
+ if (status == CP_STA_STATE_EXISTS)
+ set = &net->unassociated_stas;
+ else
+ set = &net->associated_stas;
+
+ // Verify if the set contains a sta.
+ if (set_empty (set))
+ return NULL;
+
+ sta = PARENT_OF (cp_sta_t, node, set_begin (set));
+ slab_addref (sta);
+
+ return sta;
+}
+
+/**
+ * Get the next station from the AVLN stating by the previous one already
+ * request.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param prev_sta the previous station requested, whose reference is
+ * released.
+ * \return the next station.
+ *
+ * This function shall be call after get_first.
+ *
+ * Returns a reference to the next station, release a reference to the
+ * previous station. This is done to make this kind of loop easy:
+ *
+ * \code
+ * for (sta = cp_net_get_first (ctx, net, CP_STA_STATE_EXISTS;
+ * sta; sta = cp_net_get_next (ctx, net, sta))
+ * {
+ * ...
+ * }
+ * \endcode
+ */
+cp_sta_t *
+cp_net_get_next (cp_t *ctx, cp_net_t *net, cp_sta_t *prev_sta)
+{
+ set_t *set;
+ set_node_t *node;
+ cp_sta_t *sta;
+
+ dbg_assert (ctx);
+ dbg_assert (prev_sta);
+
+ // Verify if the station is associated or not
+ if (cp_sta_get_state(prev_sta) == CP_STA_STATE_EXISTS)
+ set = &net->unassociated_stas;
+ else
+ set = &net->associated_stas;
+
+ // Get the next node.
+ node = set_next (set, &prev_sta->node);
+ slab_release (prev_sta);
+
+ if (node)
+ {
+ sta = PARENT_OF (cp_sta_t, node, node);
+ slab_addref (sta);
+ return sta;
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+/**
+ * Get the network SNID.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return The network SNID.
+ */
+cp_snid_t
+cp_net_get_snid (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ return net->snid;
+}
+
+/**
+ * Get the AVLN NID.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return The network NID.
+ */
+cp_nid_t
+cp_net_get_nid (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ return net->nid;
+}
+
+/**
+ * Set the AVLN slot id and slot usage.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param slot_id The AVLN Slot id.
+ * \param slot_usage the AVLN slot usage mask
+ */
+void
+cp_net_set_slot_id_and_usage (cp_t *ctx, cp_net_t *net,
+ u8 slot_id, u8 slot_usage)
+{
+ dbg_assert (net);
+
+ net->avln_slot_id = slot_id;
+ net->avln_slot_usage = slot_usage;
+}
+
+
+/**
+ * Get the slot id of the network.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return the slot id of the central beacon.
+ */
+u8
+cp_net_get_slot_id (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ return net->avln_slot_id;
+}
+
+/**
+ * Return the slot usage mask of the AVLN read in the central beacon of
+ * the AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return The slot usage mask read in the central beacon.
+ *
+ */
+u8
+cp_net_get_slot_usage_mask (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ return net->avln_slot_usage;
+}
+
+/**
+ * Get the number of station discovered in the AVLN.
+ * \param net the network context.
+ * \return the number of discovered stations.
+ */
+u8
+cp_net_get_num_discovered_stas (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ return net->num_visible_stas;
+}
+
+/**
+ * Get the number of station of the AVLN.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return Return the number of station in the AVLN.
+ *
+ */
+u8
+cp_net_get_num_stas (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ return net->num_stas;
+}
+
+/**
+ * Set the current network mode.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param mode the mode.
+ */
+void
+cp_net_set_nm (cp_t *ctx, cp_net_t *net, cp_net_network_mode_t mode)
+{
+ dbg_assert (net);
+ dbg_assert (mode < CP_NET_NM_ASSERT);
+
+ net->network_mode = mode;
+}
+
+/**
+ * Get the current network mode.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \return mode the mode.
+ */
+cp_net_network_mode_t
+cp_net_get_nm (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (net);
+
+ return net->network_mode;
+}
+
+/**
+ * Set the visible status of the station.
+ * \param ctx the module context.
+ * \param net the network context.
+ * \param sta Set the visible status of the station.
+ * \param status the status.
+ *
+ */
+void
+cp_net_sta_set_visible_status (cp_t *ctx, cp_net_t *net, cp_sta_t * sta,
+ cp_sta_visible_state_t status)
+{
+ dbg_assert (net);
+ dbg_assert (sta);
+ dbg_assert (status < CP_STA_VISIBLE_STATE_ASSERT);
+
+ if (((cp_sta_private_t *) sta)->visible ^ status)
+ {
+ ((cp_sta_private_t *) sta)->visible = status;
+
+ if (status)
+ net->num_visible_stas ++;
+ else
+ net->num_visible_stas --;
+ }
+}
+
+/**
+ * Get the status of the network.
+ * \param ctx the context module.
+ * \param net the network context.
+ * \return true if empty, false otherwise.
+ *
+ * This function only check the associated station list in the network.
+ */
+bool
+cp_net_is_empty (cp_t *ctx, cp_net_t *net)
+{
+ dbg_assert (ctx);
+ dbg_assert (net);
+
+ // Check the associated list.
+ if (set_empty (&net->associated_stas))
+ {
+ return true;
+ }
+ return false;
+}
+
diff --git a/cesar/cp/sta/mgr/src/net_list.c b/cesar/cp/sta/mgr/src/net_list.c
new file mode 100644
index 0000000000..33ffa8bce3
--- /dev/null
+++ b/cesar/cp/sta/mgr/src/net_list.c
@@ -0,0 +1,339 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/src/net_list.c
+ * \brief Network list manager.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "common/std.h"
+#include "mac/common/timings.h"
+
+#include "cp/defs.h"
+#include "cp/sta/mgr/net_list.h"
+
+#include "cp/sta/mgr/inc/net_list.h"
+
+/**
+ * Initialise the lists.
+ * \param ctx the module context.
+ * \param network the network list.
+ */
+void
+cp_net_list_init (cp_t *ctx, cp_net_list_t *network)
+{
+ uint i;
+
+ dbg_assert (ctx);
+ dbg_assert (network);
+
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ cp_net_init (ctx, &network->networks[i], i == 0 ? true : false);
+ }
+}
+
+/** Uninitialise the network list.
+ * \param ctx the module context.
+ * \param network the network list.
+ */
+void
+cp_net_list_uninit (cp_t *ctx, cp_net_list_t *network)
+{
+ uint i;
+ dbg_assert (ctx);
+ dbg_assert (network);
+
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ cp_net_uninit (ctx, &network->networks[i]);
+ }
+}
+
+/**
+ * Calls the sub modules garbage to remove old data.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param date_ms the current date in milliseconds.
+ */
+void
+cp_net_list_garbage_net (cp_t *ctx, cp_net_list_t *network, u32 date_ms)
+{
+ uint i;
+ dbg_assert (ctx);
+ dbg_assert (network);
+
+ for (i = 1; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ cp_net_garbage_stations (ctx, &network->networks[i], date_ms);
+ }
+}
+
+/**
+ * Add an AVLN to the list.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param snid The AVLN's SNID to add.
+ * \param nid The AVLN's NID to add.
+ * \return return the network added.
+ */
+cp_net_t *
+cp_net_list_add_avln (cp_t *ctx, cp_net_list_t *network,
+ cp_snid_t snid, cp_nid_t nid)
+{
+ uint i;
+ cp_net_t *net;
+ dbg_assert (ctx);
+ dbg_assert (network);
+ dbg_assert (nid);
+
+ net = cp_net_list_get_avln (ctx, network, snid, nid);
+
+ if (!net)
+ {
+ for (i = 1; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ if (network->networks[i].present == false)
+ {
+ net = &network->networks[i];
+ break;
+ }
+ }
+ }
+
+ // No net available.
+ if (!net)
+ return NULL;
+
+ // Insert it as present.
+ net->present = true;
+ net->snid = snid;
+ net->nid = nid;
+ net->expiration_ms = MAC_SEC_TO_MS(CP_NET_EXPIRATION_DELAY_S);
+
+ return net;
+}
+
+/**
+ * Removes an AVLN from the sta manager.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param snid The AVLN's SNID to remove.
+ * \param nid The AVLN's NID to remove.
+ */
+void
+cp_net_list_remove_avln (cp_t *ctx, cp_net_list_t *network,
+ cp_snid_t snid, cp_nid_t nid)
+{
+ cp_net_t *net;
+
+ dbg_assert (network);
+ dbg_assert (nid);
+ dbg_assert (ctx);
+
+ net = cp_net_list_get_avln (ctx, network, snid, nid);
+
+ // Test if the network exist
+ if (!net)
+ return;
+
+ cp_net_uninit (ctx, net);
+}
+
+/**
+ * Returns the AVLN corresponding to the snid and nid.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param snid The AVLN's snid to get.
+ * \param nid The AVLN's NID to get.
+ * \return return the network.
+ */
+cp_net_t *
+cp_net_list_get_avln (cp_t *ctx, cp_net_list_t *network,
+ cp_snid_t snid, cp_nid_t nid)
+{
+ uint i;
+ cp_net_t *net = NULL;
+
+ dbg_assert (network);
+ dbg_assert (nid);
+ dbg_assert (ctx);
+
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ if ((nid == network->networks[i].nid)
+ && (snid == network->networks[i].snid))
+ {
+ net = &network->networks[i];
+ break;
+ }
+ }
+
+ return net;
+}
+
+/**
+ * Return a new reference on our avln.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return return the network.
+ */
+cp_net_t *
+cp_net_list_get_our_avln (cp_t *ctx, cp_net_list_t *network)
+{
+ dbg_assert (network);
+
+ return &network->networks[0];
+}
+
+/**
+ * Update our AVLN snid.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param snid Our AVLN new SNID.
+ */
+void
+cp_net_list_update_our_avln_snid (cp_t *ctx, cp_net_list_t *network,
+ cp_snid_t snid)
+{
+ dbg_assert (ctx);
+
+ network->networks[0].snid = snid;
+}
+
+/**
+ * Update our AVLN NID.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \param nid Our AVLN new NID.
+ */
+void
+cp_net_list_update_our_avln_nid (cp_t *ctx, cp_net_list_t *network,
+ cp_nid_t nid)
+{
+ dbg_assert (network);
+
+ network->networks[0].nid = nid;
+}
+
+/**
+ * Verify if the network list is empty and return true if it is.
+ * \param ctx the module context.
+ * \param network the network module.
+ * \return true if network list is empty, false otherwise.
+ */
+bool
+cp_net_list_is_empty (cp_t *ctx, cp_net_list_t *network)
+{
+ uint i;
+ dbg_assert (ctx);
+
+ for (i = 1; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ if (network->networks[i].present == true)
+ return false;
+ }
+
+ return true;
+}
+
+/**
+ * Create a 16 bits flag indicating which SNID are in use.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return A 16 bits flag
+ */
+u16
+cp_net_list_get_snid_present (cp_t *ctx, cp_net_list_t *network)
+{
+ u16 snidflags = 0;
+ uint i;
+
+ dbg_assert (ctx);
+
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ if (network->networks[i].present)
+ {
+ snidflags |= (u16) (1 << (network->networks[i].snid));
+ }
+ }
+
+ return snidflags;
+}
+
+/**
+ * Get the slot usage of the AVLNs.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return the slot usage mask.
+ *
+ * It corresponds to a 8 bits field
+ */
+u8
+cp_net_list_get_slot_usage (cp_t *ctx, cp_net_list_t *network)
+{
+ u8 slot_usage = 0;
+ uint i;
+
+ dbg_assert (ctx);
+
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ if (network->networks[i].present)
+ slot_usage |= 1 << (network->networks[i].avln_slot_id);
+ }
+
+ return slot_usage;
+}
+
+/**
+ * Get the number of discovered station on all AVLNs.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return the number of discovered station.
+ */
+u8
+cp_net_list_get_num_discovered_stas (cp_t *ctx, cp_net_list_t *network)
+{
+ u8 num = 0;
+ uint i;
+
+ dbg_assert (ctx);
+
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ num += cp_net_get_num_discovered_stas (ctx, &network->networks[i]);
+ }
+
+ return num;
+}
+
+/**
+ * Get the number of discovered networks.
+ * \param ctx the module context.
+ * \param network the network list.
+ * \return the number of discovered networks.
+ */
+u8
+cp_net_list_get_num_discovered_net (cp_t *ctx, cp_net_list_t *network)
+{
+ u8 num = 0;
+ uint i;
+
+ dbg_assert (network);
+
+ for (i = 1; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ if (network->networks[i].present)
+ num ++;
+ }
+
+ return num;
+}
+
diff --git a/cesar/cp/sta/mgr/src/sta.c b/cesar/cp/sta/mgr/src/sta.c
new file mode 100644
index 0000000000..109650d93e
--- /dev/null
+++ b/cesar/cp/sta/mgr/src/sta.c
@@ -0,0 +1,213 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/src/sta.c
+ * \brief Station API implementation.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "lib/blk.h"
+
+#include "cp/sta/mgr/sta.h"
+
+#include "cp/sta/mgr/inc/sta.h"
+
+/**
+ * Return a station object initialised.
+ *
+ * \return a station object initialised.
+ */
+cp_sta_t *
+cp_sta_init (void)
+{
+ cp_sta_private_t *sta;
+
+ sta = blk_new ((blk_destructor_t) cp_sta_uninit);
+ memset (sta, 0, sizeof (cp_sta_private_t));
+
+ return (cp_sta_t *) sta;
+}
+
+/**
+ * Uninit the station.
+ * \param sta the station to uninit.
+ */
+void
+cp_sta_uninit (cp_sta_t *sta)
+{
+ blk_t *current;
+
+ while (sta->reassembly_ctx.head)
+ {
+ current = (blk_t *) sta->reassembly_ctx.head;
+ sta->reassembly_ctx.head = sta->reassembly_ctx.head->next;
+ blk_release_desc (current);
+ }
+}
+
+/**
+ * Get the station's TEI.
+ * \param ctx the module context.
+ * \return The station TEI.
+ *
+ */
+cp_tei_t
+cp_sta_get_tei (cp_sta_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ((cp_sta_private_t *)ctx)->tei;
+}
+
+/**
+ * Get the station's mac address.
+ * \param ctx the module context.
+ * \return The station mac address.
+ *
+ */
+mac_t
+cp_sta_get_mac_address (cp_sta_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ((cp_sta_private_t *)ctx)->mac_address;
+}
+
+/**
+ * Fill peer structure with station TEI and MAC address.
+ * \param ctx the module context.
+ * \param peer peer structure to fill.
+ */
+void
+cp_sta_get_peer (cp_sta_t *ctx, cp_mme_peer_t *peer)
+{
+ dbg_assert (ctx);
+ cp_sta_private_t *sta = (cp_sta_private_t *) ctx;
+
+ *peer = CP_MME_PEER (sta->mac_address, sta->tei);
+}
+
+/**
+ * Get the station's CCo status.
+ * \param ctx the module context.
+ * \return the CCo status of the station.
+ *
+ */
+bool
+cp_sta_get_cco_status (cp_sta_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ((cp_sta_private_t *)ctx)->is_cco;
+}
+
+/**
+ * Set the PCO status.
+ * \param ctx the module context.
+ * \param pco The PCO status.
+ */
+void
+cp_sta_set_pco_status (cp_sta_t *ctx, bool pco)
+{
+ dbg_assert (ctx);
+
+ ((cp_sta_private_t *)ctx)->pco_glid = (pco << 7);
+}
+
+/**
+ * Get the Proxy CCo status of the station.
+ * \param ctx the module context.
+ * \return The PCo status of the station.
+ *
+ */
+bool
+cp_sta_get_pco_status (cp_sta_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ((cp_sta_private_t *)ctx)->pco_glid >> 7;
+}
+
+/**
+ * Get the visible status of the station on the medium.
+ * \param ctx the module context.
+ * \return the visible status.
+ *
+ */
+cp_sta_visible_state_t
+cp_sta_get_visible_status (cp_sta_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ((cp_sta_private_t *)ctx)->visible;
+}
+
+/**
+ * Verify that the station cannot exits if the TEI is different from 0.
+ * \param ctx the module context.
+ * \param state The station state.
+ */
+void
+cp_sta_set_state (cp_sta_t *ctx, cp_sta_state_t state)
+{
+ cp_sta_private_t *sta;
+ dbg_assert (ctx);
+
+ sta = (cp_sta_private_t *) ctx;
+
+ dbg_assert (((sta->tei != 0) && (state != CP_STA_STATE_EXISTS))
+ ^ ((sta->tei == 0) && (state == CP_STA_STATE_EXISTS))
+ && (state < CP_STA_STATE_ASSERT));
+
+ sta->station_state = state;
+}
+
+/**
+ * Get the station state.
+ * \param ctx the module context.
+ * \return The station status.
+ *
+ */
+cp_sta_state_t
+cp_sta_get_state (cp_sta_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ((cp_sta_private_t *)ctx)->station_state;
+}
+
+/**
+ * Return the PCO GLID.
+ * \param ctx the module context.
+ * \return Return the PCO GLID.
+ */
+u8
+cp_sta_get_pco_glid (cp_sta_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ((cp_sta_private_t *)ctx)->pco_glid;
+}
+
+/**
+ * Set the station GLID to use as PCO.
+ * \param ctx the module context.
+ * \param glid The station GLID.
+ */
+void
+cp_sta_set_pco_glid (cp_sta_t *ctx, u8 glid)
+{
+ dbg_assert (ctx);
+ dbg_assert (glid >> 7);
+
+ ((cp_sta_private_t *)ctx)->pco_glid = glid;
+}
+
diff --git a/cesar/cp/sta/mgr/src/sta_mgr.c b/cesar/cp/sta/mgr/src/sta_mgr.c
new file mode 100644
index 0000000000..98dbbf8986
--- /dev/null
+++ b/cesar/cp/sta/mgr/src/sta_mgr.c
@@ -0,0 +1,290 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/src/sta_mgr.c
+ * \brief Station manager source.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "common/std.h"
+
+#include "cp/defs.h"
+#include "cp/cp.h"
+#include "cp/fsm/fsm.h"
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/net_list.h"
+#include "cp/sta/mgr/sta_own_data.h"
+#include "cp/sta/core/core.h"
+
+
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "cp/sta/mgr/inc/net_list.h"
+#include "cp/sta/mgr/inc/sta_own_data.h"
+
+/**
+ * Initialise the sta manager.
+ * \param ctx the module context.
+ */
+void
+cp_sta_mgr_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ // Initialise the network list.
+ cp_net_list_init (ctx, &ctx->sta_mgr.network_list);
+
+ // Initialise the station own data.
+ cp_sta_own_data_init (ctx);
+}
+
+/**
+ * Uninitialise the sta manager.
+ * \param ctx the module context.
+ */
+void
+cp_sta_mgr_uninit (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ // uninitialise the network list.
+ cp_net_list_uninit (ctx, &ctx->sta_mgr.network_list);
+
+ // Uninitialise the station own data.
+ cp_sta_own_data_uninit (ctx);
+}
+
+/**
+ * Add a AVLN to the manager list.
+ * \param ctx the module context.
+ * \param snid The AVLN's SNID to add.
+ * \param nid The AVLN's NID to add.
+ * \return A reference on the AVLN.
+ */
+cp_net_t *
+cp_sta_mgr_add_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid)
+{
+ cp_net_t *our_sta_net;
+
+ dbg_assert (ctx);
+ dbg_assert (nid);
+
+ // Check SNID conflict.
+ our_sta_net = cp_net_list_get_our_avln (ctx, &ctx->sta_mgr.network_list);
+
+ // Verify SNID collisions.
+ if ((cp_net_get_nid (ctx, our_sta_net) != nid)
+ && (cp_net_get_snid (ctx, our_sta_net) == snid))
+ {
+ cp_fsm_event_t *event;
+ event = cp_fsm_event_bare_new (ctx, CP_FSM_EVENT_TYPE_snid_conflict);
+ cp_fsm_post (ctx, event);
+ }
+
+ return cp_net_list_add_avln (ctx, &ctx->sta_mgr.network_list, snid, nid);
+}
+
+/**
+ * Remove an AVLN,.
+ * \param ctx the module context.
+ * \param snid The AVLN's snid to remove.
+ * \param nid The AVLN's nid to remove.
+ */
+void
+cp_sta_mgr_remove_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid)
+{
+ dbg_assert (ctx);
+
+ cp_net_list_remove_avln (ctx, &ctx->sta_mgr.network_list, snid, nid);
+
+ // verify if the network list is empty.
+ if (cp_net_list_is_empty (ctx, &ctx->sta_mgr.network_list))
+ {
+ cp_fsm_event_t *event;
+ event = cp_fsm_event_bare_new (ctx, CP_FSM_EVENT_TYPE_net_list_empty);
+ cp_fsm_post (ctx, event);
+ }
+}
+
+/**
+ * Get an AVLN from the net_list.
+ * \param ctx the module context.
+ * \param snid The AVLN's snid to get.
+ * \param nid The AVLN's nid to get.
+ * \return Get a reference on the AVLN.
+ */
+cp_net_t *
+cp_sta_mgr_get_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid)
+{
+ dbg_assert (ctx);
+
+ return cp_net_list_get_avln (ctx, &ctx->sta_mgr.network_list, snid, nid);
+}
+
+/**
+ * Get our AVLN network.
+ * \param ctx the module context.
+ * \return Return a reference on the station AVLN. DO not release the
+ * reference.
+ *
+ */
+cp_net_t *
+cp_sta_mgr_get_our_avln (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return cp_net_list_get_our_avln (ctx, &ctx->sta_mgr.network_list);
+}
+
+/**
+ * Lookup and return all the snids already in use in the different AVLN.
+ * \param ctx the module context.
+ * \return A bit field u16 corresponding to the SNID in use.
+ *
+ * The return data is a flag of 16 bits. The bit0 corresponds to the
+ * the snid 0, the bit1 to the snid 1 and so on
+ */
+u16
+cp_sta_mgr_get_present_snids (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return cp_net_list_get_snid_present (ctx, &ctx->sta_mgr.network_list);
+}
+
+/**
+ * Call all the sub garbage functions.
+ * \param ctx the module context.
+ */
+void
+cp_sta_mgr_garbage (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ // TODO
+ cp_net_list_garbage_net (ctx, &ctx->sta_mgr.network_list,
+ /*cp_sta_core_date_ms(ctx)*/ 0);
+}
+
+/**
+ * Update the our avln's snid.
+ * \param ctx the module context.
+ * \param snid Our AVLN new SNID.
+ */
+void
+cp_sta_mgr_update_our_avln_snid (cp_t *ctx, cp_snid_t snid)
+{
+ dbg_assert (ctx);
+
+ cp_net_list_update_our_avln_snid (ctx, &ctx->sta_mgr.network_list, snid);
+}
+
+/**
+ * Update the AVLN's NID.
+ * \param ctx the module context.
+ * \param nid The AVLN's NID.
+ *
+ */
+void
+cp_sta_mgr_update_our_avln_nid (cp_t *ctx, cp_nid_t nid)
+{
+ dbg_assert (ctx);
+ dbg_assert (nid);
+
+ cp_net_list_update_our_avln_nid (ctx, &ctx->sta_mgr.network_list, nid);
+}
+
+/**
+ * Returns a reference on our own station data.
+ * \param ctx the module context.
+ * \return A reference on the sta own data. Do not release It it not a block.
+ */
+cp_sta_own_data_t *
+cp_sta_mgr_get_sta_own_data (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return (cp_sta_own_data_t *) &ctx->sta_mgr.sta_own_data;
+}
+
+/**
+ * Get the network slot usage.
+ * \param ctx the module context.
+ * \return Return a 8 bit fields of slot usage for the beacon module.
+ */
+u8
+cp_sta_mgr_get_slot_usage (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return cp_net_list_get_slot_usage (ctx, &ctx->sta_mgr.network_list);
+}
+
+/**
+ * Get the number of discovered station on all AVLNs.
+ * \param ctx the module context.
+ * \return the number of discovered station.
+ */
+u8
+cp_sta_mgr_get_num_discovered_stas (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return cp_net_list_get_num_discovered_stas (ctx,
+ &ctx->sta_mgr.network_list);
+}
+
+/**
+ * Get the number of discovered networks.
+ * \param ctx the module context.
+ * \return the number of discovered networks.
+ */
+u8
+cp_sta_mgr_get_num_discovered_net (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return cp_net_list_get_num_discovered_net (ctx, &ctx->sta_mgr.network_list);
+}
+
+/**
+ * Verify the net list status.
+ * \param ctx the module context.
+ * \return true if empty, false otherwise.
+ */
+bool
+cp_sta_mgr_net_list_is_empty (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return cp_net_list_is_empty (ctx, &ctx->sta_mgr.network_list);
+}
+
+/**
+ * Merge the network to our net.
+ * \param ctx the module context.
+ * \param net the network to merge.
+ */
+void
+cp_sta_mgr_merge_net (cp_t *ctx, cp_net_t *net)
+{
+ cp_net_t *our_net;
+
+ dbg_assert (ctx);
+ dbg_assert (net);
+
+ our_net = cp_sta_mgr_get_our_avln (ctx);
+
+ *our_net = *net;
+
+ /* Initialise the sets of unassociated and associated stations. */
+ set_init (&net->associated_stas, cp_net_station_assoc_less);
+ set_init (&net->unassociated_stas, cp_net_station_unassoc_less);
+
+ cp_net_init (ctx, net, false);
+}
+
diff --git a/cesar/cp/sta/mgr/src/sta_own_data.c b/cesar/cp/sta/mgr/src/sta_own_data.c
new file mode 100644
index 0000000000..e4b1f54861
--- /dev/null
+++ b/cesar/cp/sta/mgr/src/sta_own_data.c
@@ -0,0 +1,391 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/data/src/sta_own_data.c
+ * \brief Station data source.
+ * \ingroup cp_sta_data
+ *
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "lib/dbg.h"
+#include "lib/bitstream.h"
+
+/* Public interfaces. */
+#include "cp/sta/mgr/sta_own_data.h"
+
+/* Private interfaces. */
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/sta_own_data.h"
+
+/**
+ * Initialise the station own data to default values.
+ * \param ctx the module context.
+ */
+void
+cp_sta_own_data_init (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ memset ((u8*) &ctx->sta_mgr.sta_own_data,
+ 0, sizeof (cp_sta_own_data_private_t));
+}
+
+/**
+ * Uninitialise the station own data to default values.
+ * \param ctx the module context.
+ */
+void
+cp_sta_own_data_uninit (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ if (ctx->sta_mgr.sta_own_data.public.pco)
+ {
+ blk_release (ctx->sta_mgr.sta_own_data.public.pco);
+ ctx->sta_mgr.sta_own_data.public.pco = NULL;
+ }
+}
+
+/**
+ * Set the TEI of the station.
+ * \param ctx the module context.
+ * \param tei The TEI station.
+ */
+void
+cp_sta_own_data_set_tei (cp_t * ctx, u8 tei)
+{
+ dbg_assert (ctx);
+ dbg_assert (tei);
+ dbg_assert (ctx->mac_config);
+
+ // Add the TEI to the ctx.
+ ctx->sta_mgr.sta_own_data.tei = tei;
+
+ // Add the TEI to the mac config in the CP context.
+ ctx->mac_config->tei = tei;
+}
+
+/**
+ * Get the value of the constant TEI.
+ * \param ctx the module context.
+ * \return Get the station TEI.
+ */
+u8
+cp_sta_own_data_get_tei (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ctx->sta_mgr.sta_own_data.tei;
+}
+
+/**
+ * Set the station Mac address.
+ * \param ctx the module context.
+ * \param mac_addr The Mac address of the station.
+ */
+void
+cp_sta_own_data_set_mac_address (cp_t *ctx, mac_t mac_addr)
+{
+ dbg_assert (ctx);
+ dbg_assert (mac_addr);
+
+ // Add the mac address to the sta own data.
+ ctx->sta_mgr.sta_own_data.mac_addr = mac_addr;
+
+ // Add the mac address to the mac config referred in the CP.
+ ctx->mac_config->sta_mac_address = mac_addr;
+}
+
+/**
+ * Get the station mac address.
+ * \param ctx the module context.
+ * \return Get the station Mac address.
+ *
+ */
+mac_t
+cp_sta_own_data_get_mac_address (cp_t *ctx)
+{
+ return ctx->sta_mgr.sta_own_data.mac_addr;
+}
+
+/**
+ * Set the Station NPW.
+ * \param ctx the module context.
+ * \param npw The new NPW.
+ *
+ * TODO : inform the driver ?
+ */
+void
+cp_sta_own_data_set_npw (cp_t *ctx, const char * npw)
+{
+ dbg_assert (ctx);
+ dbg_assert (npw);
+
+ // Store the NPW.
+ strcpy(ctx->sta_mgr.sta_own_data.npw, npw);
+
+ // TODO : inform the driver ?
+}
+
+/**
+ * Return the pointer to the NPW as a constant data.
+ * \param ctx the module context.
+ * \return Get the station NPW.
+ *
+ * The user shall call the set_npw function to modify the NPW
+ */
+const char *
+cp_sta_own_data_get_npw (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return ctx->sta_mgr.sta_own_data.npw;
+}
+
+/**
+ * Set the station NMK.
+ * \param ctx the module context.
+ * \param nmk The NMK to set.
+ * \param length The NMK length.
+ *
+ * \todo Call the MSG to send a MME to the linux Driver.
+ */
+void
+cp_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk)
+{
+ dbg_assert (ctx);
+
+ ctx->sta_mgr.sta_own_data.nmk = nmk;
+
+ // TODO : inform the driver ?
+}
+
+/**
+ * Get the NMK of the AVLN.
+ * \param ctx the module context.
+ * \return Get the station NMK
+ */
+cp_key_t
+cp_sta_own_data_get_nmk (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return ctx->sta_mgr.sta_own_data.nmk;
+}
+
+/**
+ * Set the device password.
+ * \param ctx the module context.
+ * \param dpw The new device password.
+ * \param length The length in bytes of the DPW provided.
+ *
+ * // TODO : inform the driver ?
+ */
+void
+cp_sta_own_data_set_dpw (cp_t *ctx, const char *dpw)
+{
+ dbg_assert (ctx);
+ dbg_assert (dpw);
+
+ strcpy (ctx->sta_mgr.sta_own_data.dpw, dpw);
+
+ // TODO : inform the driver ?
+}
+
+/**
+ * Return the Device password.
+ * \param ctx the module context.
+ * \return Get the station DPW.
+ */
+const char*
+cp_sta_own_data_get_dpw (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ctx->sta_mgr.sta_own_data.dpw;
+}
+
+/**
+ * Set the security level.
+ * \param ctx the module context.
+ * \param sl The security level.
+ *
+ * // TODO : inform the driver ?
+ */
+void
+cp_sta_own_data_set_security_level (cp_t *ctx,
+ cp_security_level_t sl)
+{
+ dbg_assert (ctx);
+
+ ctx->sta_mgr.sta_own_data.security_level = sl;
+
+ // TODO : inform the driver ?
+}
+
+/**
+ * Return the security level.
+ * \param ctx the module context.
+ * \return Get the security level.
+ *
+ */
+cp_security_level_t
+cp_sta_own_data_get_security_level (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return ctx->sta_mgr.sta_own_data.security_level;
+}
+
+/**
+ * Set the CCo status of the station.
+ * \param ctx the module context.
+ * \param status The current CCo status of the station.
+ *
+ * It shall send a message to the Linux Driver
+ */
+void
+cp_sta_own_data_set_was_cco (cp_t *ctx, bool status)
+{
+ dbg_assert (ctx);
+ ctx->sta_mgr.sta_own_data.was_cco = status;
+
+ // inform the driver
+ // TODO.
+}
+
+/**
+ * Get the CCo status of the station after a reboot.
+ * \param ctx the module context.
+ * \return \todo fill this
+ *
+ */
+bool
+cp_sta_own_data_get_was_cco (cp_t *ctx)
+{
+ dbg_assert (ctx);
+ return ctx->sta_mgr.sta_own_data.was_cco;
+}
+
+/**
+ * Set the HFID.
+ *
+ * \param hfid the HFID to set.
+ * \param data the human identifier.
+ */
+void
+cp_sta_own_data_set_hfid (const char *hfid, const char *data)
+{
+ dbg_assert (data);
+ dbg_assert (hfid);
+
+ strcpy ((char *) hfid, (char *) data);
+}
+
+/**
+ * Set the AVLN HFID.
+ *
+ * \param ctx the module context.
+ * \param data the human identifier.
+ */
+void
+cp_sta_own_data_set_hfid_avln (cp_t *ctx, const char* data)
+{
+ cp_sta_own_data_t *sta;
+
+ dbg_assert (ctx);
+ sta = cp_sta_mgr_get_sta_own_data (ctx);
+ cp_sta_own_data_set_hfid (sta->hfid_avln, data);
+}
+
+/**
+ * Set the User HFID.
+ *
+ * \param ctx the module context.
+ * \param data the human identifier.
+ */
+void
+cp_sta_own_data_set_hfid_user (cp_t *ctx, const char* data)
+{
+ cp_sta_own_data_t *sta;
+
+ dbg_assert (ctx);
+ sta = cp_sta_mgr_get_sta_own_data (ctx);
+ cp_sta_own_data_set_hfid (sta->hfid_user, data);
+}
+
+/**
+ * Set the Manufacturer HFID.
+ *
+ * \param ctx the module context.
+ * \param data the human identifier.
+ */
+void
+cp_sta_own_data_set_hfid_manufacturer (cp_t *ctx, const char* data)
+{
+ cp_sta_own_data_t *sta;
+
+ dbg_assert (ctx);
+ sta = cp_sta_mgr_get_sta_own_data (ctx);
+ cp_sta_own_data_set_hfid (sta->hfid_manufacturer, data);
+}
+
+/**
+ * Set the GLID to send proxy data.
+ * \param ctx the module context.
+ * \param glid The GLID to use when a proxy beacon shall be sent.
+ */
+void
+cp_sta_own_data_set_pco_glid (cp_t *ctx, u8 glid)
+{
+ dbg_assert (ctx);
+ dbg_assert (glid >> 7);
+
+ ctx->sta_mgr.sta_own_data.pco_glid = glid;
+}
+
+/**
+ * Get the PCO GLID.
+ * \param ctx the module context.
+ * \return The GLID to send proxy data.
+ */
+u8
+cp_sta_own_data_get_pco_glid (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return ctx->sta_mgr.sta_own_data.pco_glid;
+}
+
+/**
+ * Get the PCO status.
+ * \param ctx the module context.
+ * \return The PCO status.
+ *
+ */
+bool
+cp_sta_own_data_get_pco_status (cp_t *ctx)
+{
+ dbg_assert (ctx);
+
+ return (ctx->sta_mgr.sta_own_data.pco_glid >> 7);
+}
+
+/**
+ * Set the PCO status.
+ * \param ctx the module context.
+ * \param pco The PCO status.
+ *
+ */
+void
+cp_sta_own_data_set_pco_status (cp_t *ctx, bool pco)
+{
+ dbg_assert (ctx);
+
+ ctx->sta_mgr.sta_own_data.pco_glid = (pco << 7);
+}
+
diff --git a/cesar/cp/sta/mgr/sta.h b/cesar/cp/sta/mgr/sta.h
new file mode 100644
index 0000000000..cf15b12ff6
--- /dev/null
+++ b/cesar/cp/sta/mgr/sta.h
@@ -0,0 +1,215 @@
+#ifndef cp_sta_mgr_sta_h
+#define cp_sta_mgr_sta_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/sta.h
+ * \brief Stations data.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "lib/set.h"
+#include "cp/types.h"
+#include "cp/mme.h"
+
+/** Enum. */
+enum cp_sta_state_t
+{
+ CP_STA_STATE_EXISTS,
+ CP_STA_STATE_ASSOCIATED,
+ CP_STA_STATE_AUTHENTICATED,
+ CP_STA_STATE_ASSERT
+};
+typedef enum cp_sta_state_t cp_sta_state_t;
+
+/** Enum */
+enum cp_sta_visible_state_t
+{
+ CP_STA_VISIBLE_STATE_HIDDEN,
+ CP_STA_VISIBLE_STATE_VISIBLE,
+ CP_STA_VISIBLE_STATE_ASSERT
+};
+typedef enum cp_sta_visible_state_t cp_sta_visible_state_t;
+
+/** Reassembly context block. */
+struct cp_sta_reassembly_ctx_blk_t
+{
+ /** Pointer on the next block. */
+ struct cp_sta_reassembly_ctx_blk_t *next;
+ /** Pointer on the MME payload. */
+ u8 *data;
+ /** Length of the payload in the block. */
+ uint length;
+ /** Sequence number (FMI SSN). */
+ uint ssn;
+};
+typedef struct cp_sta_reassembly_ctx_blk_t cp_sta_reassembly_ctx_blk_t;
+
+/** Reassembly context. */
+struct cp_sta_reassembly_ctx_t
+{
+ /** Last segment received. */
+ uint last_seg_ssn;
+ /** MME fragment head. */
+ cp_sta_reassembly_ctx_blk_t *head;
+ /** MMe fragment tail. */
+ cp_sta_reassembly_ctx_blk_t *tail;
+};
+typedef struct cp_sta_reassembly_ctx_t cp_sta_reassembly_ctx_t;
+
+/**
+ * Control plane station.
+ */
+struct cp_sta_t
+{
+ /**
+ * Indicate if the station is Backup CCo.
+ */
+ bool is_backup_cco;
+
+ /**
+ * Last date seen in the AVLN.
+ */
+ uint last_seen_ms;
+
+ /**
+ * The Reassembly context for the cl_interf.
+ */
+ cp_sta_reassembly_ctx_t reassembly_ctx;
+
+ /**
+ * The tei expiration date.
+ */
+ uint tei_lease_ms;
+
+ /**
+ * The station CCo capability.
+ */
+ u8 cco_cap;
+
+ /**
+ * Indicate if the station can be PCo.
+ */
+ bool pco_cap;
+
+ /**
+ * Indicate if the stations can be backup CCo.
+ */
+ bool backup_cco_cap;
+
+ /**
+ * Number of discover stations.
+ */
+ u8 numDisSta;
+
+ /**
+ * Number of discover networks.
+ */
+ u8 numDisNet;
+
+ /** Set node. */
+ set_node_t node;
+};
+typedef struct cp_sta_t cp_sta_t;
+
+/**
+ * Get the station's TEI.
+ * \param ctx the module context.
+ * \return The station TEI.
+ *
+ */
+cp_tei_t
+cp_sta_get_tei (cp_sta_t *ctx);
+
+/**
+ * Get the station's mac address.
+ * \param ctx the module context.
+ * \return The station mac address.
+ *
+ */
+mac_t
+cp_sta_get_mac_address (cp_sta_t *ctx);
+
+/**
+ * Fill peer structure with station TEI and MAC address.
+ * \param ctx the module context.
+ * \param peer peer structure to fill.
+ */
+void
+cp_sta_get_peer (cp_sta_t *ctx, cp_mme_peer_t *peer);
+
+/**
+ * Get the station's cco status.
+ * \param ctx the module context.
+ * \return the CCo status of the station.
+ */
+bool
+cp_sta_get_cco_status (cp_sta_t *ctx);
+
+/**
+ * Set the PCO status.
+ * \param ctx the module context.
+ * \param pco The PCO status.
+ */
+void
+cp_sta_set_pco_status (cp_sta_t *ctx, bool pco);
+
+/**
+**
+ * Get the Proxy CCo status of the station.
+ * \param ctx the module context.
+ * \return The PCo status of the station.
+ *
+ */
+bool
+cp_sta_get_pco_status (cp_sta_t *ctx);
+
+/**
+ * Get the visible status of the station on the medium.
+ * \param ctx the module context.
+ * \return the visible status.
+ *
+ */
+cp_sta_visible_state_t
+cp_sta_get_visible_status (cp_sta_t *ctx);
+
+/**
+ * Verify that the station cannot exits if the TEI is different from 0.
+ * \param ctx the module context.
+ * \param state The station state.
+ */
+void
+cp_sta_set_state (cp_sta_t *ctx, cp_sta_state_t state);
+
+/**
+ * Get the station state.
+ * \param ctx the module context.
+ * \return The station status.
+ */
+cp_sta_state_t
+cp_sta_get_state (cp_sta_t *ctx);
+
+/**
+ * Return the PCO GLID.
+ * \param ctx the module context.
+ * \return \todo fill this
+ *
+ */
+u8
+cp_sta_get_pco_glid (cp_sta_t *ctx);
+
+/**
+ * Set the station GLID to use as PCO.
+ * \param ctx the module context.
+ * \param glid The station GLID.
+ *
+ */
+void
+cp_sta_set_pco_glid (cp_sta_t *ctx, u8 glid);
+
+#endif /* cp_sta_mgr_sta_h */
diff --git a/cesar/cp/sta/mgr/sta_mgr.h b/cesar/cp/sta/mgr/sta_mgr.h
new file mode 100644
index 0000000000..74e108e4e2
--- /dev/null
+++ b/cesar/cp/sta/mgr/sta_mgr.h
@@ -0,0 +1,159 @@
+#ifndef cp_sta_mgr_h
+#define cp_sta_mgr_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/mgr/sta_mgr.h
+ * \brief Station Manager.
+ * \ingroup cp_sta_mgr
+ *
+ * Station and AVLN manager.
+ */
+#include "cp/sta/mgr/net.h"
+#include "cp/sta/mgr/sta_own_data.h"
+
+/* Forward declaration. */
+typedef struct cp_sta_mgr_t cp_sta_mgr_t;
+
+/**
+ * Add a AVLN to the manager list.
+ * \param ctx the module context.
+ * \param snid The AVLN's SNID to add.
+ * \param nid The AVLN's nid to add.
+ * \return A reference on the AVLN.
+ */
+cp_net_t *
+cp_sta_mgr_add_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid);
+
+/**
+ * Remove an AVLN,.
+ * \param ctx the module context.
+ * \param snid The AVLN's snid to remove.
+ * \param nid The AVLN's nid to remove.
+ */
+void
+cp_sta_mgr_remove_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid);
+
+/**
+ * Get an AVLN from the net_list.
+ * \param ctx the module context.
+ * \param snid The AVLN's snid to get.
+ * \param nid The AVLN's nid to get.
+ * \return Get a reference on the AVLN.
+ */
+cp_net_t *
+cp_sta_mgr_get_avln (cp_t *ctx, cp_snid_t snid, cp_nid_t nid);
+
+/**
+ * Get our AVLN network.
+ * \param ctx the module context.
+ * \return \todo fill this
+ *
+ */
+cp_net_t *
+cp_sta_mgr_get_our_avln (cp_t *ctx);
+
+/**
+ * Initialise the sta manager.
+ * \param ctx the module context.
+ */
+void
+cp_sta_mgr_init (cp_t *ctx);
+
+/**
+ * Uninitialise the sta manager.
+ * \param ctx the module context.
+ */
+void
+cp_sta_mgr_uninit (cp_t *ctx);
+
+/**
+ * Lookup and return all the snids already in use in the different AVLN.
+ * \param ctx the module context.
+ * \return A bit field u16 corresponding to the SNID in use.
+ *
+ * The return data is a flag of 16 bits. The bit0 corresponds to the
+ * the snid 0, the bit1 to the snid 1 and so on
+ */
+u16
+cp_sta_mgr_get_present_snids (cp_t *ctx);
+
+/**
+ * Call all the sub garbage functions.
+ * \param ctx the module context.
+ *
+ */
+void
+cp_sta_mgr_garbage (cp_t *ctx);
+
+/**
+ * Update the our avln's snid.
+ * \param ctx the module context.
+ * \param snid Our AVLN new SNID.
+ */
+void
+cp_sta_mgr_update_our_avln_snid (cp_t *ctx, cp_snid_t snid);
+
+/**
+ * Update the AVLN's NID.
+ * \param ctx the module context.
+ * \param nid The AVLN's NID.
+ *
+ */
+void
+cp_sta_mgr_update_our_avln_nid (cp_t *ctx, cp_nid_t nid);
+
+/**
+ * Returns a reference on our own station data.
+ * \param ctx the module context.
+ * \return A reference on the sta own data. Do not release It it not a block.
+ */
+cp_sta_own_data_t *
+cp_sta_mgr_get_sta_own_data (cp_t *ctx);
+
+/**
+ * Get the network slot usage.
+ * \param ctx the module context.
+ * \return Return a 8 bit fields of slot usage for the beacon module.
+ */
+u8
+cp_sta_mgr_get_slot_usage (cp_t *ctx);
+
+/**
+ * Get the number of discovered station on all AVLNs.
+ * \param ctx the module context.
+ * \return the number of discovered station.
+ */
+u8
+cp_sta_mgr_get_num_discovered_stas (cp_t *ctx);
+
+/**
+ * Get the number of discovered networks.
+ * \param ctx the module context.
+ * \return the number of discovered networks.
+ */
+u8
+cp_sta_mgr_get_num_discovered_net (cp_t *ctx);
+
+/**
+ * Verify the net list status.
+ * \param ctx the module context.
+ * \return true if empty, false otherwise.
+ */
+bool
+cp_sta_mgr_net_list_is_empty (cp_t *ctx);
+
+/**
+ * Merge the network to our net.
+ * \param ctx the module context.
+ * \param net the network to merge.
+ */
+void
+cp_sta_mgr_merge_net (cp_t *ctx, cp_net_t *net);
+
+#endif /* cp_sta_mgr_h */
diff --git a/cesar/cp/sta/mgr/sta_own_data.h b/cesar/cp/sta/mgr/sta_own_data.h
new file mode 100644
index 0000000000..2a1fdad365
--- /dev/null
+++ b/cesar/cp/sta/mgr/sta_own_data.h
@@ -0,0 +1,301 @@
+#ifndef cp_sta_data_sta_own_data_h
+#define cp_sta_data_sta_own_data_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/sta/data/sta_own_data.h
+ * \brief Station own data.
+ * \ingroup cp_sta_data
+ *
+ */
+
+#include "cp/defs.h"
+#include "cp/cp.h"
+
+#include "cp/sta/mgr/sta.h"
+
+#include <string.h>
+
+/** Forward declaration. */
+typedef struct cp_sta_own_data_private_t cp_sta_own_data_private_t;
+
+/**
+ * Station own data.
+ */
+struct cp_sta_own_data_t
+{
+ /**
+ * Date to change the NEK in eCos ticks.
+ */
+ uint nek_change_rtc;
+
+ /**
+ * Indicate if the station was CCo preferred.
+ */
+ bool cco_prefered;
+
+ /**
+ * The AVLN HFID.
+ */
+ const char hfid_avln [CP_HFID_SIZE + 1];
+
+ /**
+ * The user HFID.
+ */
+ const char hfid_user [CP_HFID_SIZE + 1];
+
+ /**
+ * The manufacturer HFID.
+ */
+ const char hfid_manufacturer [CP_HFID_SIZE + 1];
+
+ /**
+ * Current hybrid mode.
+ */
+ u8 hybrid_mode;
+
+ /**
+ * The current SNID being tracked for the NTB synchronization.
+ */
+ cp_snid_t snid_track;
+
+ /**
+ * The current NID being track for the NTB synchronization.
+ */
+ cp_nid_t nid_track;
+
+ /**
+ * The current EKS.
+ */
+ u8 eks_current;
+
+ /**
+ * The PCo to discuss with.
+ */
+ cp_sta_t * pco;
+
+ /**
+ * Indicate if the station is CCo.
+ */
+ bool is_cco;
+
+ /**
+ * Indicate if the station is authenticated or not.
+ */
+ bool authenticated;
+};
+typedef struct cp_sta_own_data_t cp_sta_own_data_t;
+
+/**
+ * Initialise the station own data to default values.
+ * \param ctx the module context.
+ */
+void
+cp_sta_own_data_init (cp_t *ctx);
+
+/**
+ * Uninitialise the station own data to default values.
+ * \param ctx the module context.
+ */
+void
+cp_sta_own_data_uninit (cp_t *ctx);
+
+/**
+ * Set the TEI of the station.
+ * \param ctx the module context.
+ * \param tei The TEI station.
+ */
+void
+cp_sta_own_data_set_tei (cp_t * ctx, u8 tei);
+
+/**
+ * Get the value of the constant TEI.
+ * \param ctx the module context.
+ * \return Get the station TEI.
+ *
+ */
+cp_tei_t
+cp_sta_own_data_get_tei (cp_t *ctx);
+
+/**
+ * Set the station Mac address.
+ * \param ctx the module context.
+ * \param mac_addr The Mac address of the station.
+ */
+void
+cp_sta_own_data_set_mac_address (cp_t *ctx, mac_t mac_addr);
+
+/**
+ * Get the station mac address.
+ * \param ctx the module context.
+ * \return Get the station Mac address.
+ */
+mac_t
+cp_sta_own_data_get_mac_address (cp_t *ctx);
+
+/**
+ * Set the Station NPW.
+ * \param ctx the module context.
+ * \param sta the station own data.
+ * \param npw The new NPW.
+ *
+ * TODO : inform the driver ?
+ */
+void
+cp_sta_own_data_set_npw (cp_t *ctx, const char * npw);
+
+/**
+ * Return the pointer to the NPW as a constant data.
+ * \param ctx the module context.
+ * \return Get the station NPW.
+ *
+ * The user shall call the set_npw function to modify the NPW
+ */
+const char *
+cp_sta_own_data_get_npw (cp_t *ctx);
+
+/**
+ * Set the station NMK.
+ * \param ctx the module context.
+ * \param nmk The NMK to set.
+ *
+ * \todo Call the MSG to send a MME to the linux Driver.
+ */
+void
+cp_sta_own_data_set_nmk (cp_t *ctx, const cp_key_t nmk);
+
+/**
+ * Get the NMK of the AVLN.
+ * \param ctx the module context.
+ * \return Get the station NMK
+ *
+ */
+cp_key_t
+cp_sta_own_data_get_nmk (cp_t *ctx);
+
+/**
+ * Set the device password.
+ * \param ctx the module context.
+ * \param dpw The new device password.
+ *
+ * // TODO : inform the driver ?
+ */
+void
+cp_sta_own_data_set_dpw (cp_t *ctx, const char *dpw);
+
+/**
+ * Return the Device password.
+ * \param ctx the module context.
+ * \return Get the station DPW.
+ */
+const char *
+cp_sta_own_data_get_dpw (cp_t *ctx);
+
+/**
+ * Set the security level.
+ * \param ctx the module context.
+ * \param sl The security level.
+ *
+ * And send a message to the HLE
+ */
+void
+cp_sta_own_data_set_security_level (cp_t *ctx,
+ cp_security_level_t sl);
+
+/**
+ * Return the security level.
+ * \param ctx the module context.
+ * \param sta the station own data.
+ * \return Get the security level.
+ *
+ */
+cp_security_level_t
+cp_sta_own_data_get_security_level (cp_t *ctx);
+
+/**
+ * Set the CCo status of the station.
+ * \param ctx the module context.
+ * \param status The current CCo status of the station.
+ *
+ * It shall send a message to the Linux Driver
+ */
+void
+cp_sta_own_data_set_was_cco (cp_t *ctx, bool status);
+
+/**
+ * Get the the CCo status of the station after a reboot.
+ * \param ctx the module context.
+ * \return the CCo status.
+ */
+bool
+cp_sta_own_data_get_was_cco (cp_t *ctx);
+
+
+/**
+ * Set the AVLN HFID.
+ *
+ * \param ctx the module context.
+ * \param data the human identifier.
+ */
+void
+cp_sta_own_data_set_hfid_avln (cp_t *ctx, const char* data);
+
+/**
+ * Set the User HFID.
+ *
+ * \param ctx the module context.
+ * \param data the human identifier.
+ */
+void
+cp_sta_own_data_set_hfid_user (cp_t *ctx, const char* data);
+
+/**
+ * Set the Manufacturer HFID.
+ *
+ * \param ctx the module context.
+ * \param data the human identifier.
+ */
+void
+cp_sta_own_data_set_hfid_manufacturer (cp_t *ctx, const char* data);
+
+/**
+ * Set the GLID to send proxy data.
+ * \param ctx the module context.
+ * \param glid The GLID to use when a proxy beacon shall be sent.
+ */
+void
+cp_sta_own_data_set_pco_glid (cp_t *ctx, u8 glid);
+
+/**
+ * Get the PCO GLID.
+ * \param ctx the module context.
+ * \param sta the station own data.
+ * \return The GLID to send proxy data.
+ */
+u8
+cp_sta_own_data_get_pco_glid (cp_t *ctx);
+
+/**
+ * Get the PCO status.
+ * \param ctx the module context.
+ * \param sta the station own data.
+ * \return True if the station is PCO, false otherwise.
+ */
+bool
+cp_sta_own_data_get_pco_status (cp_t *ctx);
+
+/**
+ * Set the PCO status.
+ * \param ctx the module context.
+ * \param sta the station own data.
+ * \param pco The PCO status.
+ */
+void
+cp_sta_own_data_set_pco_status (cp_t *ctx, bool pco);
+
+#endif /* cp_sta_data_sta_own_data_h */
diff --git a/cesar/cp/sta/mgr/test/Makefile b/cesar/cp/sta/mgr/test/Makefile
new file mode 100644
index 0000000000..07651e2b9e
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/Makefile
@@ -0,0 +1,22 @@
+BASE = ../../../..
+
+INCLUDES = cp/sta/mgr/test/overide
+
+HOST_PROGRAMS = station_test net_test net_list_test sta_mgr_test sta_own
+
+station_test_SOURCES = station_test.c core_stub.c cl_stub.c fsm_stub.c
+station_test_MODULES = lib cp/sta/mgr
+
+net_test_SOURCES = net_test.c cl_stub.c core_stub.c fsm_stub.c
+net_test_MODULES = lib cp/sta/mgr mac/common
+
+net_list_test_SOURCES= net_list_test.c cl_stub.c core_stub.c fsm_stub.c
+net_list_test_MODULES= lib cp/sta/mgr mac/common
+
+sta_mgr_test_SOURCES= sta_mgr_test.c cl_stub.c core_stub.c fsm_stub.c
+sta_mgr_test_MODULES= lib cp/sta/mgr mac/common
+
+sta_own_SOURCES= sta-test.c core_stub.c cl_stub.c fsm_stub.c
+sta_own_MODULES= lib cp/sta/mgr mac/common
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/sta/mgr/test/doc/Makefile b/cesar/cp/sta/mgr/test/doc/Makefile
new file mode 100644
index 0000000000..25c6b6b03d
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/doc/Makefile
@@ -0,0 +1,20 @@
+PAGES= sta_mgr.txt sta.txt net.txt net_list.txt
+
+ODT=$(PAGES:%.txt=%.odt)
+HTML=$(PAGES:%.txt=%.html)
+
+all: $(ODT) $(HTML)
+
+odt: $(ODT)
+
+html: $(HTML)
+
+%.odt: %.txt
+ rst2odt.py $< $@
+
+%.html: %.txt
+ rst2html $< $@
+
+clean:
+ rm -f $(ODT)
+ rm -f $(HTML)
diff --git a/cesar/cp/sta/mgr/test/doc/net.txt b/cesar/cp/sta/mgr/test/doc/net.txt
new file mode 100644
index 0000000000..3424c2ba52
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/doc/net.txt
@@ -0,0 +1,190 @@
+Network test
+============
+
+Test the APIs available in the cp_net.
+
+sta_add
+-------
+
+Test 1 : Unassociated STAs
+~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some station to the net list and verify the data. The STA are added with a
+TEI null and a known mac address.
+
+The Station shall be added as unassociated stations and be added in the set of
+unassociated stations.
+
+Their status shall be equal to CP_STA_STATE_EXISTS.
+The Mac address shall be set.
+
+Test 2 : Associated STAs
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some stations to the net list and verify the data. The STA are added with
+a TEI different of any one already present in the Net list.
+
+The mac address is not necessary if the TEI is set, the station status shall
+be equal to CP_STA_STATE_ASSOCIATED.
+
+Test 3 : Authenticated STAs
+~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some authenticated stations to the net list. The STAs are added with a TEI
+different of any one already present in the Net list.
+
+The stations status shall be equal to CP_STA_STATE_AUTHENTICATED.
+
+Test 4 : Modifying the CCo in the NET
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add a station authenticated and set it as a CCo in the AVLN.
+
+The station shall be in the CP_STA_STATE_AUTHENTICATED, and the AVLN shall
+have a pointer to this station in the cco variable.
+
+Test 5 : Modifying the PCo in the NET
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add a station authenticated and set it as a PCo in the AVLN.
+
+The station shall be in the CP_STA_STATE_AUTHENTICATED, and the AVLN shall
+have a pointer to this station in the pco variable.
+
+Remove Sta
+----------
+
+Test 1 : Removing a Associated station (not CCo, not PCo)
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some station and remove it.
+At the end the list must be empty.
+
+Test 2 : Removing the CCo station of the net.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some station in the net list as associated, one of those stations is the
+CCo (TEI = 3 for examples).
+
+At the beginning of the test, the station with the TEI = 3, shall have its
+status cco flag setted and the network has its cco pointer corresponding to
+this station.
+
+At the end, the station shall not exist in the network and the pointer to the
+CCo in the network shall be null.
+The other stations of the AVLN shall remain present.
+
+Test 3 : Removing the PCo Station of the net.
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Add some station in the net list as associated, one of those stations is the
+PCo (TEI = 3 for examples).
+
+At the beginning of the test, the station with the TEI = 3, shall have its
+status pco flag setted and the network has its pco pointer corresponding to
+this station.
+
+At the end, the station shall not exist in the network and the pointer to the
+PCo in the network shall be null.
+The other stations of the AVLN shall remain present.
+
+Commit to data plane
+--------------------
+
+Add some station to the list and call the commit to data plane function.
+
+The function of the CL have been overwritten in the cl_stub.c file (see in the
+src directory).
+
+It will normally allocate a block and all the station present in the network
+list will be present in it.
+
++-----+-----+-------+
+| Tag | TEI | MAC @ |
++-----+-----+-------+
+
+Garbage
+-------
+
+Verify the expiration date of all the station in the network. It the network
+is empty it shall post an event in the FSM.
+
+Environment
+~~~~~~~~~~~
+
+Add an AVLN and some station with different status.
+
+Three associated and three not associated stations.
+
++-----+-------+-----+-------+-----------+
+| sta | assoc | tei | mac @ | last seen |
++-----+-------+-----+-------+-----------+
+| 1 | false | 0 | 1 | 5 |
++-----+-------+-----+-------+-----------+
+| 2 | false | 0 | 2 | 7 |
++-----+-------+-----+-------+-----------+
+| 3 | false | 0 | 3 | 9 |
++-----+-------+-----+-------+-----------+
+| 4 | true | 1 | 1 | 6 |
++-----+-------+-----+-------+-----------+
+| 5 | true | 2 | 5 | 8 |
++-----+-------+-----+-------+-----------+
+| 6 | true | 3 | 9 | 10 |
++-----+-------+-----+-------+-----------+
+
+Result
+~~~~~~
+
+The station 1 and the station 4 shall be expired and shall not appear in the
+list after the garbage.
+
+The others shall be still present.
+
+Set slot id
+-----------
+
+Add an AVLN and set the slot id to 5.
+
+Result
+ The slot id shall be equal to 5.
+
+Network mode
+------------
+
+This test case shall test the function to set and get the network mode of an
+AVLN.
+
+Net configuration
+ After the initialization of the network the network mode is CSMA-Only.
+ At the second modification the network mode shall be setted to coordinated mode.
+
+Result
+ The network shall be in CSMA only mode at the first read of the network mode.
+ The network shall be in Coordinated mode at the second read.
+
+Set sta visible
+---------------
+
+This function has for job to set the neighbour station as visible allowing to
+increase or decrease the counter of visible stations in the network.
+
+Test 1 : Adding a STA
+~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+ Add a station to the network and set it as visible.
+
+Result
+ The network shall have one station as visible.
+
+Test 2 : Adding two STAs
+~~~~~~~~~~~~~~~~~~~~~~~~
+
+Environment
+ Add two station to the AVLN configured as followed :
+
+ * STA 1 : visible
+ * STA 2 : hidden
+
+Result
+ The network shall have two station and only one visible.
diff --git a/cesar/cp/sta/mgr/test/doc/net_list.txt b/cesar/cp/sta/mgr/test/doc/net_list.txt
new file mode 100644
index 0000000000..758b4754b5
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/doc/net_list.txt
@@ -0,0 +1,114 @@
+Network list
+============
+
+Initialise
+-----------
+
+Shall initialise all the networks list (index greater than 1, the index 0 corresponds to the station AVLN):
+ - present flag shall be false.
+ - snid = 0
+ - nid = 0
+ - cco = null
+ - pco = null
+ - expiration_ntb = CP_NET_EXPIRATION_DELAY (see defs file in cp)
+ - associated_stas shall be empty.
+ - unssociated_stas shall be empty.
+
+The AVLN with the index 0 (the Stations AVLN) shall be present, i.e. the present flag shall be setted.
+
+Uninitialise
+------------
+
+Shall reset all the networks and call on each one the uninit function.
+
+For that some station will be create in each AVLN.
+
+AVLN 0:
+ - Station 1, TEI = 1, Mac @ = 11, is_cco = true.
+ - Station 2, TEI = 2, Mac @ = 12, is_cco = false, is_pco = true.
+
+AVLN 1:
+ - Station 1, TEI = 1, Mac @ = 21, is_cco = true.
+ - Station 2, TEI = 2, Mac @ = 22, is_cco = false, is_pco = true.
+ - Station 3, TEI = 3, Mac @ = 23.
+ - Station 4, TEI = 4, Mac @ = 24.
+
+AVLN 2:
+ - Station 1, TEI = 1, Mac @ = 31, is_cco = true.
+ - Station 2, TEI = 2, Mac @ = 32.
+ - Station 3, TEI = 3, Mac @ = 33.
+ - Station 4, TEI = 4, Mac @ = 34.
+
+At the end of this test case, all the station list shall be empty and the CCo, PCo pointer reseted.
+
+
+Add an AVLN
+-----------
+
+Create the AVLN and verify that it is possible to get it back using the get
+AVLN function.
+
+AVLN data:
+ - SNID = 1
+ - NID = 1
+
+The AVLN returned by the add function shall be in the following state:
+ - SNID = 1
+ - NID = 1
+ - present = true
+ - station_avln = false
+ - cco = null
+ - pco = null
+ - expiration_ntb = CP_NET_EXPIRATION_DELAY (see cp/defs.h)
+ - associated_stas = empty (use set_empty function).
+ - unassociated_stas = empty (use set_empty function).
+
+Remove an AVLN
+--------------
+
+Same thing as uninitializing an AVLN.
+
+Add an AVLN and remove it only using the SNID and NID.
+
+AVLN Data:
+ - SNID = 1
+ - NID = 1.
+
+At the end of the test this AVLN shall not exists.
+
+Update Station's SNID
+---------------------
+
+Modify the AVLN's SNID.
+
+Is empty
+--------
+
+Verify the presence of others AVLN on the medium.
+
+SNID present
+------------
+
+Return a flag indicating which SNID is currently in use.
+
+Environment 3 AVLNs with SNID 1, 5, 10.
+
+At the end of the test the flag shall contain 0x211.
+
+Get slot usage
+--------------
+
+Environment
+
+Result
+ This function shall return 0x94.
+ Add three AVLN in the station manager configured as followed:
+
+ * AVLN 1 : Slot id = 4;
+ * AVLN 2 : Slot id = 7;
+ * AVLN 3 : Slot id = 2;
+
+ This makes a slot usage equal to 0x94.
+
+Result
+ This function shall return 0x94.
diff --git a/cesar/cp/sta/mgr/test/doc/sta.txt b/cesar/cp/sta/mgr/test/doc/sta.txt
new file mode 100644
index 0000000000..e711621277
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/doc/sta.txt
@@ -0,0 +1,44 @@
+Station
+=======
+
+Get tei
+-------
+
+Allow any user to get a copy of the station TEI.
+
+Result
+~~~~~~
+
+Returns the correct value.
+
+Get Mac address
+---------------
+
+Allow any user to get a copy of the Station's Mac address.
+
+Result
+~~~~~~
+
+Returns the correct value.
+
+Get CCo status
+--------------
+
+Allow any user to get a copy of the station CCo status.
+
+Result
+~~~~~~
+
+Returns the correct value.
+
+
+Get PCo status
+---------------
+
+Allow any user to get a copy of the Station's Pco.
+
+Result
+~~~~~~
+
+Returns the correct value.
+
diff --git a/cesar/cp/sta/mgr/test/doc/sta_mgr.txt b/cesar/cp/sta/mgr/test/doc/sta_mgr.txt
new file mode 100644
index 0000000000..6fcf407725
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/doc/sta_mgr.txt
@@ -0,0 +1,14 @@
+Station Manager
+===============
+
+Initialise
+----------
+
+This shall call the function init of the net_list and the init function of the
+STA own data.
+
+Uninitialise
+------------
+
+This will call the uninit function to the net_list and the station own data.
+
diff --git a/cesar/cp/sta/mgr/test/doc/sta_own_data.txt b/cesar/cp/sta/mgr/test/doc/sta_own_data.txt
new file mode 100644
index 0000000000..ab302bcdd0
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/doc/sta_own_data.txt
@@ -0,0 +1,111 @@
+Sta own data
+============
+
+Test the Sta own data private attributes which shall only be modified by the
+accessors.
+
+Status
+------
+
+Tested : under test.
+
+Initialise
+----------
+
+Initialise the private structure (this structure contains the public
+structure) and verify if all the data are setted to 0.
+
+Result
+~~~~~~
+
+- If all the values are equals to 0, the test succeed.
+- If any value is not equal to 0, the test fail.
+
+TEI
+---
+
+Shall update the STA own data to set the station TEI, and modified the Mac
+config structure data referenced in the CP to update the station TEI.
+
+Result
+~~~~~~
+
+- The mac config contains the correct TEI.
+- The station own data contains the correct TEI.
+
+Mac address
+-----------
+
+Shall update the sta own data to set the mac address and modified the mac
+config structure referenced in the CP to update the mac address.
+
+Result
+~~~~~~
+
+- The mac config contains the correct Mac address
+- The station own data contains the correct mac address.
+
+NPW
+---
+
+Shall set up the NPW in the station own data and request the module MSG to
+send a MME to the PLC Driver to store the modification in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The NPW is stored correctly in the STA own data.
+
+NMK
+---
+
+Shall set up the NMK in the station own data and request the module MSG to
+send a MME to the PLC Driver to store the modification in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The NMK is stored correctly in the STA own data.
+
+DPW
+---
+
+Shall set up the DPW in the station own data and request the module MSG to
+send a MME to the PLC Driver to store the modification in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The DPW is stored correctly in the STA own data.
+
+Security level
+--------------
+
+Shall set the security level of the station and send a message to the PLC
+driver to store the SL in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The security level is setted correctly in the station own data.
+
+Was CCo Status
+--------------
+
+Shall set the was CCo status and send a MME to the PLC driver to store the
+station cco status in the flash memory.
+
+*TODO* : Add the API in the MSG module.
+
+Result
+~~~~~~
+
+- The was_cco status is setted in the station own data.
diff --git a/cesar/cp/sta/mgr/test/overide/cp2/inc/context.h b/cesar/cp/sta/mgr/test/overide/cp2/inc/context.h
new file mode 100644
index 0000000000..8d813b42f4
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/overide/cp2/inc/context.h
@@ -0,0 +1,38 @@
+#ifndef cp_inc_cp_h
+#define cp_inc_cp_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/inc/cp_private.h
+ * \brief Control plane context.
+ * \ingroup cp
+ *
+ */
+#include "lib/rnd.h"
+
+/* Public interfaces. */
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cl/cl.h"
+#include "mac/common/config.h"
+
+/* Private interfaces. */
+#include "cp/sta/mgr/inc/sta_mgr.h"
+
+struct cp_t
+{
+ /** station manager context. */
+ cp_sta_mgr_t sta_mgr;
+
+ /** Cl context. */
+ cl_t *cl;
+
+ /** Mac config */
+ mac_config_t *mac_config;
+};
+
+#endif /* cp_inc_cp_h */
diff --git a/cesar/cp/sta/mgr/test/overide/cp2/sta/core/core.h b/cesar/cp/sta/mgr/test/overide/cp2/sta/core/core.h
new file mode 100644
index 0000000000..f3e69ad422
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/overide/cp2/sta/core/core.h
@@ -0,0 +1,22 @@
+#ifndef overide_cp_sta_core_core_h
+#define overide_cp_sta_core_core_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file overide/cp/sta/core/core.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+u32
+cp_sta_core_date_ms (cp_t *cp);
+
+
+#endif /* overide_cp_sta_core_core_h */
diff --git a/cesar/cp/sta/mgr/test/overide/cp_fsm_defs.h b/cesar/cp/sta/mgr/test/overide/cp_fsm_defs.h
new file mode 100644
index 0000000000..f64f9c368f
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/overide/cp_fsm_defs.h
@@ -0,0 +1,38 @@
+#ifndef fsm_events_h
+#define fsm_events_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file fsm_events.h
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+
+enum cp_fsm_event_type_t
+{
+ CP_FSM_EVENT_TYPE_net_list_empty,
+ CP_FSM_EVENT_TYPE_snid_conflict,
+ CP_FSM_EVENT_TYPE_NB
+};
+typedef enum cp_fsm_event_type_t cp_fsm_event_type_t;
+
+struct cp_fsm_transition_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_transition_t cp_fsm_transition_t;
+
+struct cp_fsm_branch_t
+{
+ uint titi;
+};
+typedef struct cp_fsm_branch_t cp_fsm_branch_t;
+
+#endif /* fsm_events_h */
diff --git a/cesar/cp/sta/mgr/test/src/cl_stub.c b/cesar/cp/sta/mgr/test/src/cl_stub.c
new file mode 100644
index 0000000000..e9ff2f1556
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/src/cl_stub.c
@@ -0,0 +1,119 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cl/cl_mactotei.h
+ * \brief mac to tei table interface between the CL and the CP
+ * \ingroup cl
+ *
+ */
+#include "common/std.h"
+#include "cl/cl_mactotei.h"
+
+#include "lib/bitstream.h"
+#include <string.h>
+
+/**
+ * Create a new table to be filled by the CP.
+ *
+ * \return a pointer to the new block to be fill with the mac to tei table
+ * data
+ */
+cl_mactotei_blk_t *
+cl_mactotei_new (void)
+{
+ u8 *my_data;
+
+ my_data = blk_alloc ();
+ my_data[0] = 0;
+ return (cl_mactotei_blk_t *) my_data;
+}
+
+/**
+ * Add a new tupple of data to the table.
+ *
+ * \param table the table pointer to add a new mac to tei correspondance.
+ * \param mac_addr the mac addr to add
+ * \param tei the tei corresponding to the STA.
+ * \param tag the CP tag provide to indentifier a network.
+ */
+void cl_mactotei_addr_add (cl_mactotei_blk_t *table, mac_t mac_addr,
+ uint tei, uint tag)
+{
+ bitstream_t bitstream;
+ u8 *data;
+ uint pos;
+
+ dbg_assert (table);
+ dbg_assert (tei);
+
+ data = (u8 *) table;
+ pos = 8 * data[0] + 1;
+
+ bitstream_init (&bitstream, &data[pos],
+ 8, BITSTREAM_WRITE);
+ bitstream_access (&bitstream, &tag, 8);
+ bitstream_access (&bitstream, &tei, 8);
+ bitstream_access (&bitstream, &mac_addr, 48);
+ bitstream_finalise (&bitstream);
+
+ data[0] ++;
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tag)
+{
+}
+
+/**
+ * Request the CL to copy all the data corresponding to the tag and the tei.
+ *
+ * \param ctx the cl context.
+ * \param table the mactotei new table to fill
+ * \param tei the tei to copy.
+ * \param tag the tag to copy
+ */
+void
+cl_mactotei_copy_tei_and_tag (cl_t *ctx,
+ cl_mactotei_blk_t *table, u8 tei, u8 tag)
+{
+}
+
+/**
+ * Request the CL to use the new table and remove the old one.
+ *
+ * \param ctx the CL context
+ * \param table the new table to use.
+ */
+void
+cl_mactotei_use_table (cl_t *ctx, cl_mactotei_blk_t *table)
+{
+ dbg_assert (ctx);
+ dbg_assert (table);
+
+ memcpy ((u8 *) ctx, (u8 *)table, 512) ;
+
+ blk_release (table);
+}
+
+/**
+ * Release the complete table from the memory.
+ *
+ * \param ctx the convergence layer context
+ */
+void cl_mactotei_release_table (cl_t *ctx)
+{
+}
+
diff --git a/cesar/cp/sta/mgr/test/src/core_stub.c b/cesar/cp/sta/mgr/test/src/core_stub.c
new file mode 100644
index 0000000000..127367a5c5
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/src/core_stub.c
@@ -0,0 +1,23 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/core_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/cp.h"
+
+u32
+cp_sta_core_date_ms (cp_t *cp)
+{
+ return 0;
+}
+
diff --git a/cesar/cp/sta/mgr/test/src/fsm_stub.c b/cesar/cp/sta/mgr/test/src/fsm_stub.c
new file mode 100644
index 0000000000..849f375270
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/src/fsm_stub.c
@@ -0,0 +1,29 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/fsm_stub.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "cp/fsm/fsm.h"
+
+static cp_fsm_event_t fsm_event;
+
+cp_fsm_event_t *
+cp_fsm_event_bare_new (cp_t *ctx, cp_fsm_event_type_t type)
+{
+ return &fsm_event;
+}
+
+void
+cp_fsm_post (cp_t *ctx, cp_fsm_event_t *event)
+{
+}
diff --git a/cesar/cp/sta/mgr/test/src/net_list_test.c b/cesar/cp/sta/mgr/test/src/net_list_test.c
new file mode 100644
index 0000000000..e913477eed
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/src/net_list_test.c
@@ -0,0 +1,499 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/net_list_test.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include <string.h>
+
+#include "common/std.h"
+#include "lib/test.h"
+#include "mac/common/timings.h"
+
+#include "cp/defs.h"
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/net_list.h"
+
+#include "cp/sta/mgr/inc/net_list.h"
+
+/** Initialise
+ * \param test the test object.
+ *
+ * Shall initialise all the networks list (index greater than 1, the
+ * index 0 corresponds to the station AVLN):
+ * - present flag shall be false.
+ * - snid = 0
+ * - nid = 0
+ * - cco = null
+ * - pco = null
+ * - expiration_ntb = CP_NET_EXPIRATION_DELAY (see defs file in cp)
+ * - associated_stas shall be empty.
+ * - unssociated_stas shall be empty.
+ *
+ * The AVLN with the index 0 (the Stations AVLN) shall be present, i.e.
+ * the present flag shall be setted.
+ */
+void
+test_case_network_init (test_t test)
+{
+ uint i;
+ cp_t cp;
+ cp_net_list_t network;
+ cp_net_t *net;
+
+ test_case_begin (test, "Initialise");
+
+ cp_net_list_init (&cp, &network);
+
+ test_begin (test, "verify init")
+ {
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ net = &network.networks[i];
+ test_fail_if (net->present != (i == 0 ? true : false),
+ "Present flag wrong.");
+ test_fail_if (net->station_avln != (i == 0 ? true : false),
+ "Station AVLN flag false");
+ test_fail_if (net->snid != 0, "Wrong SNID");
+ test_fail_if (net->nid != 0, "Wrong NID");
+ test_fail_if (net->cco != 0, "Wrong CCo");
+ test_fail_if (net->pco != 0, "Wrong PCo");
+ test_fail_if (net->expiration_ms !=
+ MAC_SEC_TO_MS(CP_NET_EXPIRATION_DELAY_S),
+ "Wrong PCo");
+ test_fail_if (set_empty (&net->associated_stas) != true,
+ "Qte of associated stations is wrong");
+ test_fail_if (set_empty (&net->unassociated_stas) != true,
+ "Qte of associated stations is wrong");
+ }
+ }
+ test_end;
+}
+
+/** Uninitialise
+ *
+ * \param test the test object.
+ *
+ * Shall reset all the networks and call on each one the uninit function.
+ * For that some station will be create in each AVLN.
+ *
+ * AVLN 0:
+ * - Station 1, TEI = 1, Mac @ = 11, is_cco = true.
+ * - Station 2, TEI = 2, Mac @ = 12, is_cco = false, is_pco = true.
+ *
+ * AVLN 1:
+ * - Station 1, TEI = 1, Mac @ = 21, is_cco = true.
+ * - Station 2, TEI = 2, Mac @ = 22, is_cco = false, is_pco = true.
+ * - Station 3, TEI = 3, Mac @ = 23.
+ * - Station 4, TEI = 4, Mac @ = 24.
+ *
+ * AVLN 2:
+ * - Station 1, TEI = 1, Mac @ = 31, is_cco = true.
+ * - Station 2, TEI = 2, Mac @ = 32.
+ * - Station 3, TEI = 3, Mac @ = 33.
+ * - Station 4, TEI = 4, Mac @ = 34.
+ *
+ * At the end of this test case, all the station list shall be empty
+ * and the CCo, PCo pointer reseted.
+ */
+void
+test_case_network_uninit (test_t test)
+{
+ cp_t cp;
+ uint i;
+ cp_net_list_t network;
+ cp_net_t *net;
+ cp_sta_t *sta;
+
+ test_case_begin (test, "Initialise");
+
+ cp_net_list_init (&cp, &network);
+
+ // Add station to the station AVLN.
+ net = cp_net_list_get_our_avln (&cp, &network);
+ net->snid = 1;
+ net->nid = 1;
+
+ sta = cp_net_sta_add (&cp, net, 1 , 11);
+ cp_net_set_cco (&cp, net, 1);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 2 , 12);
+ cp_net_set_pco (&cp, net, 2);
+ slab_release (sta);
+
+ // Add station to the next AVLN.
+ net = &network.networks[1];
+ net->snid = 2;
+ net->nid = 2;
+ net->present = true;
+
+ sta = cp_net_sta_add (&cp, net, 1, 21);
+ cp_net_set_cco (&cp, net, 1);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 2, 22);
+ cp_net_set_pco (&cp, net, 2);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 3, 23);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 4, 24);
+ slab_release (sta);
+
+ // Add station to the next AVLN.
+ net = &network.networks[2];
+ net->snid = 3;
+ net->nid = 3;
+ net->present = true;
+
+ sta = cp_net_sta_add (&cp, net, 1, 31);
+ cp_net_set_cco (&cp, net, 1);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 2, 32);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 3, 33);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 4, 34);
+ slab_release (sta);
+
+ test_begin (test, "verify the environment")
+ {
+ test_fail_if (network.networks[0].cco == NULL, "Wrong CCo value");
+ test_fail_if (cp_sta_get_cco_status(network.networks[0].cco) != true,
+ "Station CCo flag not setted");
+ test_fail_if (network.networks[0].pco == NULL, "Wrong PCo value");
+ test_fail_if (cp_sta_get_pco_status(network.networks[0].pco) != true,
+ "Station PCo flag not setted");
+
+ test_fail_if (network.networks[1].cco == NULL, "Wrong CCo value");
+ test_fail_if (cp_sta_get_cco_status(network.networks[1].cco) != true,
+ "Station CCo flag not setted");
+ test_fail_if (network.networks[1].pco == NULL, "Wrong PCo value");
+ test_fail_if (cp_sta_get_pco_status(network.networks[1].pco) != true,
+ "Station PCo flag not setted");
+
+ test_fail_if (network.networks[2].cco == NULL, "Wrong CCo value");
+ test_fail_if (cp_sta_get_cco_status(network.networks[2].cco) != true,
+ "Station CCo flag not setted");
+ }
+ test_end;
+
+ cp_net_list_uninit (&cp, &network);
+
+ test_begin (test, "verify")
+ {
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ test_fail_if (network.networks[i].cco != NULL, "Wrong CCo value");
+ test_fail_if (network.networks[i].pco != NULL, "Wrong CCo value");
+ }
+ }
+ test_end;
+}
+
+/** Add an AVLN
+ *
+ * \param test the test object.
+ *
+ * Create the AVLN and verify that it is possible to get it back using the
+ * get AVLN function.
+ *
+ * AVLN data:
+ * - SNID = 1
+ * - NID = 1
+ *
+ * The AVLN returned by the add function shall be in the following state:
+ * - SNID = 1
+ * - NID = 1
+ * - present = true
+ * - station_avln = false
+ * - cco = null
+ * - pco = null
+ * - expiration_ntb = CP_NET_EXPIRATION_DELAY (see cp/defs.h)
+ * - associated_stas = empty (use set_empty function).
+ * - unassociated_stas = empty (use set_empty function).
+ */
+void
+test_case_network_add_avln (test_t test)
+{
+ cp_t cp;
+ cp_net_list_t network;
+ cp_net_t *net;
+
+ cp_net_list_init (&cp, &network);
+
+ net = cp_net_list_add_avln (&cp, &network, 1, 1);
+
+ test_case_begin (test, "Add an AVLN");
+
+ test_begin (test, "verifying the data")
+ {
+ test_fail_if (net->snid != 1, "Wrong SNID");
+ test_fail_if (net->nid != 1, "Wrong NID");
+ test_fail_if (net->present != true, "Wrong presence state flag");
+ test_fail_if (net->station_avln != false, "Wong stations AVLN flag");
+ test_fail_if (net->cco != NULL, "CCo should not exists yet");
+ test_fail_if (net->pco != NULL, "PCo should not exists yet");
+ test_fail_if (set_empty (&net->associated_stas) != true,
+ "Shall not contain any station yet");
+ test_fail_if (set_empty (&net->unassociated_stas) != true,
+ "Shall not contain any station yet");
+ test_fail_if (net->expiration_ms !=
+ MAC_SEC_TO_MS(CP_NET_EXPIRATION_DELAY_S),
+ "Incorrect expiration value");
+ }
+ test_end;
+}
+
+/** Remove an AVLN
+ *
+ * \param test the test object.
+ *
+ * Same thing as uninitializing an AVLN.
+ * Add an AVLN and remove it only using the SNID and NID.
+ *
+ * AVLN Data:
+ * - SNID = 1
+ * - NID = 1.
+ *
+ * At the end of the test this AVLN shall not exists.
+ */
+void
+test_case_network_remove_avln (test_t test)
+{
+ cp_t cp;
+ cp_net_list_t network;
+ cp_net_t *net;
+
+ cp_net_list_init (&cp, &network);
+
+ test_case_begin (test, "Remove an AVLN");
+
+ net = cp_net_list_add_avln (&cp, &network, 1, 1);
+
+ test_begin (test, "verify net")
+ {
+ test_fail_if (net == NULL, "AVLN shall be created");
+ }
+ test_end;
+
+ cp_net_list_remove_avln (&cp, &network, 1, 1);
+
+ test_begin (test, "Data after removing")
+ {
+ test_fail_if (net->snid != 0, "Wrong SNID");
+ test_fail_if (net->nid != 0, "Wrong NID");
+ test_fail_if (net->present != false, "Wrong presence state flag");
+ test_fail_if (net->station_avln != false, "Wong stations AVLN flag");
+ test_fail_if (net->cco != NULL, "CCo should not exists yet");
+ test_fail_if (net->pco != NULL, "PCo should not exists yet");
+ test_fail_if (set_empty (&net->associated_stas) != true,
+ "Shall not contain any station yet");
+ test_fail_if (set_empty (&net->unassociated_stas) != true,
+ "Shall not contain any station yet");
+ test_fail_if (net->expiration_ms !=
+ MAC_SEC_TO_MS(CP_NET_EXPIRATION_DELAY_S),
+ "Incorrect expiration value");
+ }
+ test_end;
+}
+
+/** Update Station's SNID
+ *
+ * \param test the test object.
+ *
+ * Modify the AVLN's SNID.
+ */
+void
+test_case_network_update_snid (test_t test)
+{
+ cp_t cp;
+ cp_net_list_t network;
+
+ cp_net_list_init (&cp, &network);
+
+ network.networks[0].snid = 1;
+
+ test_case_begin (test, "updating the station's AVLN SNID");
+
+ cp_net_list_update_our_avln_snid (&cp, &network, 2);
+ test_begin (test, "verifying data")
+ {
+ test_fail_if (network.networks[0].snid != 2, "Wrong SNID value");
+ }
+ test_end;
+}
+
+/** Is empty
+ *
+ * \param test the test object.
+ *
+ * Verify the presence of others AVLN on the medium.
+ */
+void
+test_case_network_is_empyt (test_t test)
+{
+ cp_t cp;
+ cp_net_list_t network;
+
+ cp_net_list_init (&cp, &network);
+
+ test_case_begin (test, "Empty function test");
+
+ test_begin (test, "Empty list")
+ {
+ test_fail_if (cp_net_list_is_empty (&cp, &network) != true,
+ "List is empty");
+ }
+ test_end;
+
+ cp_net_list_add_avln (&cp, &network, 1, 1);
+
+ test_begin (test, "Empty list, not empty")
+ {
+ test_fail_if (cp_net_list_is_empty (&cp, &network) != false,
+ "List is not empty");
+ }
+ test_end;
+}
+
+/** SNID present
+ *
+ * \param test the test object.
+ *
+ * Return a flag indicating which SNID is currently in use.
+ * environment 3 AVLNs with SNID 1, 5, 10.
+ * At the end of the test the flag shall contain 0x211.
+ */
+void
+test_case_network_snid_present (test_t test)
+{
+ cp_t cp;
+ u16 snidFlags;
+ cp_net_list_t network;
+
+ cp_net_list_init (&cp, &network);
+
+ test_case_begin (test, "Getting present SNID");
+
+ cp_net_list_update_our_avln_snid (&cp, &network, 1);
+ cp_net_list_add_avln (&cp, &network, 5, 5);
+ cp_net_list_add_avln (&cp, &network, 10, 10);
+
+ snidFlags = cp_net_list_get_snid_present (&cp, &network);
+
+ test_begin (test, "Verifying the flags")
+ {
+ test_fail_if (snidFlags != 0x422, "Wrong flags");
+ }
+ test_end;
+}
+
+/** Get slot usage
+ * \param test the test object.
+ *
+ * Environment
+ * Add three AVLN in the station manager configured as followed:
+ *
+ * * AVLN 1 : Slot id = 4;
+ * * AVLN 2 : Slot id = 7;
+ * * AVLN 3 : Slot id = 2;
+ *
+ * This makes a slot usage equal to 0x94.
+ *
+ * Result
+ * This function shall return 0x94.
+ */
+void
+test_case_network_slot_usage (test_t test)
+{
+ cp_t cp;
+ cp_net_list_t network;
+ cp_net_t *net;
+
+ cp_net_list_init (&cp, &network);
+
+ test_case_begin (test, "Getting the slot usage");
+
+ // Add the first AVLN.
+ net = cp_net_list_get_our_avln (&cp, &network);
+ cp_net_set_slot_id_and_usage (&cp, net, 4, 5);
+
+ net = cp_net_list_add_avln (&cp, &network, 0x2, 0x2);
+ cp_net_set_slot_id_and_usage (&cp, net, 7, 7);
+
+ net = cp_net_list_add_avln (&cp, &network, 0x3, 0x3);
+ cp_net_set_slot_id_and_usage (&cp, net, 2, 3);
+
+ test_begin (test, "Verify")
+ {
+ test_fail_if (cp_net_list_get_slot_usage (&cp, &network) != 0x94,
+ "Wrong Slot usage bit fields");
+ }
+ test_end;
+}
+
+
+/** Add an AVLN which is already present in the station manager.
+ * \param test the test object.
+ *
+ * Add an AVLN with the SNID and NID = 1, add the same AVLN.
+ * Adding again the same AVLN will return the same reference on the object it
+ * is only initialised once.
+ */
+void
+test_case_network_add_existing_avln (test_t test)
+{
+ cp_t cp;
+ cp_net_list_t network;
+ cp_net_t *net;
+ cp_net_t *net2;
+
+ cp_net_list_init (&cp, &network);
+ net = cp_net_list_add_avln (&cp, &network, 1,1);
+ net2 = cp_net_list_add_avln (&cp, &network, 1,1);
+
+ test_case_begin (test, "Adding an existing AVLN");
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (net != net2, "Nets shall be equals");
+ test_fail_if (memcmp(net, net2, sizeof (cp_net_t)) != 0,
+ "Nets shall be identical");
+ }
+ test_end;
+}
+
+int
+main (void)
+{
+ test_t test;
+ test_init (test, 0, NULL);
+
+ test_case_network_init (test);
+ test_case_network_uninit (test);
+ test_case_network_add_avln (test);
+ test_case_network_remove_avln (test);
+ test_case_network_update_snid (test);
+ test_case_network_is_empyt (test);
+ test_case_network_snid_present (test);
+ test_case_network_slot_usage (test);
+ test_case_network_add_existing_avln (test);
+
+ test_case_begin (test, "Memory allocation");
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/sta/mgr/test/src/net_test.c b/cesar/cp/sta/mgr/test/src/net_test.c
new file mode 100644
index 0000000000..e4f5304c4a
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/src/net_test.c
@@ -0,0 +1,1117 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/net_test.c
+ * \brief Test the net APIs
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "common/std.h"
+#include "string.h"
+
+#include "lib/test.h"
+#include "lib/blk.h"
+#include "lib/bitstream.h"
+
+#include "mac/common/ntb.h"
+#include "mac/common/timings.h"
+
+#include "cp/sta/mgr/net.h"
+#include "cp/sta/mgr/inc/net.h"
+
+#include "cp/inc/context.h"
+
+/**
+ * Add an unassociated station to the net.
+ *
+ * \param test the test object result.
+ *
+ * Add some station to the network and verify the data.
+ */
+void
+test_case_network_add_unassoc_stations (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[4];
+ mac_t mac_addr[3];
+ uint i;
+
+ cp_net_init (&cp, &net, 0);
+
+ for (i = 0; i < 3 ; i++)
+ {
+ mac_addr[i] = 0x12345678 + i;
+ }
+
+ test_case_begin (test, "Add unassociated stations");
+
+ for (i = 0; i < 3; i++)
+ {
+ sta[i] = cp_net_sta_add (&cp, &net, 0x0, mac_addr[i]);
+ }
+
+ // Verify the station add.
+ test_begin (test, "Unassoc stas added")
+ {
+ test_fail_if (set_empty (&net.unassociated_stas) == true,
+ "List shall not be empty");
+
+ for (i = 0; i < 3; i++)
+ {
+ test_fail_if (sta[i] == NULL, "Station should exist");
+ test_fail_if (cp_sta_get_mac_address(sta[i]) != mac_addr[i],
+ "Station mac address is wrong");
+ test_fail_if (cp_sta_get_tei (sta[i]) != 0, "Wrong TEI");
+ test_fail_if (cp_sta_get_cco_status (sta[i]) != false,
+ "Wrong CCo status");
+ test_fail_if (cp_sta_get_pco_status (sta[i]) != false,
+ "Wrong PCo status");
+ test_fail_if (cp_sta_get_state(sta[i]) != CP_STA_STATE_EXISTS,
+ "Wrong station state");
+ slab_release (sta[i]);
+ }
+ }
+ test_end;
+
+ sta[3] = cp_net_sta_add (&cp, &net, 0x0, mac_addr[1]);
+
+ test_begin (test, "Duplicated Sta")
+ {
+ test_fail_if (sta[3] != sta[1]);
+ }
+ test_end;
+ slab_release (sta[3]);
+
+ cp_net_uninit (&cp, &net);
+}
+
+/**
+ * Add an associated station to the net.
+ *
+ * \param test the test object result.
+ *
+ * Add some station to the network and verify the data.
+ */
+void
+test_case_network_add_assoc_stations (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[3];
+ mac_t mac_addr[3];
+ uint i;
+
+ cp_net_init (&cp, &net, 0);
+
+ for (i = 0; i < 3 ; i++)
+ {
+ mac_addr[i] = 0x12345678 + i;
+ }
+
+ test_case_begin (test, "Add associated stations");
+
+ for (i = 0; i < 3; i++)
+ {
+ sta[i] = cp_net_sta_add (&cp, &net, i + 1, mac_addr[i]);
+ cp_sta_set_state (sta[i], CP_STA_STATE_ASSOCIATED);
+ }
+
+ // Verify the station add.
+ test_begin (test, "assoc stas added")
+ {
+ test_fail_if (set_empty (&net.associated_stas) != false,
+ "List shall not be empty");
+
+ for (i = 0; i < 3; i++)
+ {
+ test_fail_if (sta[i] == NULL, "Station should exist");
+ test_fail_if (cp_sta_get_mac_address(sta[i]) != mac_addr[i],
+ "Station mac address is wrong");
+ test_fail_if (cp_sta_get_tei (sta[i]) != i + 1, "Wrong TEI");
+ test_fail_if (cp_sta_get_cco_status (sta[i]) != false,
+ "Wrong CCo status");
+ test_fail_if (cp_sta_get_pco_status (sta[i]) != false,
+ "Wrong PCo status");
+ test_fail_if (cp_sta_get_state (sta[i]) != CP_STA_STATE_ASSOCIATED,
+ "Wrong station state");
+ slab_release (sta[i]);
+
+ cp_net_sta_remove_assoc (&cp, &net, i + 1);
+ }
+
+ test_fail_if (set_empty (&net.associated_stas) != true,
+ "List shall be empty");
+ }
+ test_end;
+
+ cp_net_uninit (&cp, &net);
+}
+
+/**
+ * Add an authenticated station to the net.
+ *
+ * \param test the test object result.
+ *
+ * Add some station to the network and verify the data.
+ */
+void
+test_case_network_add_auth_stations (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[3];
+ mac_t mac_addr[3];
+ uint i;
+
+ cp_net_init (&cp, &net, 0);
+
+ for (i = 0; i < 3 ; i++)
+ {
+ mac_addr[i] = 0x12345678 + i;
+ }
+
+ test_case_begin (test, "Add authenticated stations");
+
+ for (i = 0; i < 3; i++)
+ {
+ sta[i] = cp_net_sta_add (&cp, &net, i + 1, mac_addr[i]);
+ cp_sta_set_state (sta[i], CP_STA_STATE_AUTHENTICATED);
+ }
+
+ // Verify the station add.
+ test_begin (test, "assoc stas added")
+ {
+ test_fail_if (set_empty (&net.associated_stas) != false,
+ "List shall not be empty");
+
+ for (i = 0; i < 3; i++)
+ {
+ test_fail_if (sta[i] == NULL, "Station should exist");
+ test_fail_if (cp_sta_get_mac_address(sta[i]) != mac_addr[i],
+ "Station mac address is wrong");
+ test_fail_if (cp_sta_get_tei (sta[i]) != i + 1, "Wrong TEI");
+ test_fail_if (cp_sta_get_cco_status (sta[i]) != false,
+ "Wrong CCo status");
+ test_fail_if (cp_sta_get_pco_status (sta[i]) != false,
+ "Wrong PCo status");
+ test_fail_if (cp_sta_get_state(sta[i])!= CP_STA_STATE_AUTHENTICATED,
+ "Wrong station state");
+ slab_release (sta[i]);
+
+ cp_net_sta_remove_assoc (&cp, &net, i + 1);
+ }
+
+ test_fail_if (set_empty (&net.associated_stas) != true,
+ "List shall be empty");
+ }
+ test_end;
+ cp_net_uninit (&cp, &net);
+}
+
+/**
+ * Add three authenticated station to the net.
+ * The last station is the CCo.
+ *
+ * \param test the test object result.
+ *
+ * Add some station to the network and verify the data.
+ */
+void
+test_case_network_add_auth_stations_last_is_cco (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[3];
+ mac_t mac_addr[3];
+ uint i;
+
+ cp_net_init (&cp, &net, 0);
+
+ for (i = 0; i < 3 ; i++)
+ {
+ mac_addr[i] = 0x12345678 + i;
+ }
+
+ test_case_begin (test, "Add authenticated stations last is CCo");
+
+ for (i = 0; i < 3; i++)
+ {
+ sta[i] = cp_net_sta_add (&cp, &net, i + 1, mac_addr[i]);
+ cp_sta_set_state (sta[i], CP_STA_STATE_AUTHENTICATED);
+ }
+ cp_net_set_cco (&cp, &net, 3);
+
+ // Verify the station add.
+ test_begin (test, "assoc stas added")
+ {
+ test_fail_if (set_empty (&net.associated_stas) != false,
+ "List shall not be empty");
+
+ for (i = 0; i < 3; i++)
+ {
+ test_fail_if (sta[i] == NULL, "Station should exist");
+ test_fail_if (cp_sta_get_mac_address(sta[i]) != mac_addr[i],
+ "Station mac address is wrong");
+ test_fail_if (cp_sta_get_tei (sta[i]) != i + 1, "Wrong TEI");
+ test_fail_if (cp_sta_get_pco_status (sta[i]) != false,
+ "Wrong PCo status");
+ test_fail_if (cp_sta_get_state(sta[i])!= CP_STA_STATE_AUTHENTICATED,
+ "Wrong station state");
+
+ test_fail_if (i == 2 ? net.cco != sta[i] : net.cco == sta[i],
+ "Wrong CCo sta[%d]", i);
+ test_fail_if (i == 2 ? cp_sta_get_cco_status (sta[i]) != true :
+ cp_sta_get_cco_status (sta[i]) != false,
+ "wrong CCo status sta[%d]", i);
+
+ slab_release (sta[i]);
+ cp_net_sta_remove_assoc (&cp, &net, i + 1);
+ }
+
+ test_fail_if (set_empty (&net.associated_stas) != true,
+ "List shall be empty");
+ }
+ test_end;
+ cp_net_uninit (&cp, &net);
+}
+
+/**
+ * Add three authenticated station to the net.
+ * The last station is the PCo.
+ *
+ * \param test the test object result.
+ *
+ * Add some station to the network and verify the data.
+ */
+void
+test_case_network_add_auth_stations_last_is_pco (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[3];
+ mac_t mac_addr[3];
+ uint i;
+
+ cp_net_init (&cp, &net, 0);
+
+ for (i = 0; i < 3 ; i++)
+ {
+ mac_addr[i] = 0x12345678 + i;
+ }
+
+ test_case_begin (test, "Add authenticated stations last is CCo");
+
+ for (i = 0; i < 3; i++)
+ {
+ sta[i] = cp_net_sta_add (&cp, &net, i + 1, mac_addr[i]);
+ cp_sta_set_state (sta[i], CP_STA_STATE_AUTHENTICATED);
+ }
+ cp_net_set_pco (&cp, &net, 3);
+
+ // Verify the station add.
+ test_begin (test, "assoc stas added")
+ {
+ test_fail_if (set_empty (&net.associated_stas) != false,
+ "List shall not be empty");
+
+ for (i = 0; i < 3; i++)
+ {
+ test_fail_if (sta[i] == NULL, "Station should exist");
+ test_fail_if (cp_sta_get_mac_address(sta[i]) != mac_addr[i],
+ "Station mac address is wrong");
+ test_fail_if (cp_sta_get_tei (sta[i]) != i + 1, "Wrong TEI");
+ test_fail_if (cp_sta_get_cco_status (sta[i]) != false,
+ "Wrong CCo status");
+ test_fail_if (cp_sta_get_state(sta[i])!= CP_STA_STATE_AUTHENTICATED,
+ "Wrong station state");
+
+ test_fail_if (i == 2 ? net.pco != sta[i] : net.pco == sta[i],
+ "Wrong PCo sta[%d]", i);
+ test_fail_if (i == 2 ? cp_sta_get_pco_status (sta[i]) != true :
+ cp_sta_get_pco_status (sta[i]) != false,
+ "wrong PCo status sta[%d]", i);
+
+ slab_release (sta[i]);
+ cp_net_sta_remove_assoc (&cp, &net, i + 1);
+ }
+
+ test_fail_if (set_empty (&net.associated_stas) != true,
+ "List shall be empty");
+ }
+ test_end;
+ cp_net_uninit (&cp, &net);
+}
+
+/** Removing a Associated station (not CCo, not PCo)
+ *
+ * \param test the test object.
+ */
+void
+test_case_remove_stations (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[10];
+ uint i;
+
+ cp_net_init (&cp, &net, 0);
+
+ for (i = 0; i < 10; i++)
+ {
+ sta[i] = cp_net_sta_add (&cp, &net, i + 1, i + 1);
+ slab_release (sta[i]);
+ }
+
+ test_case_begin (test, "Remove stations");
+
+ test_begin (test, "Verify if list is empty")
+ {
+ test_fail_if (set_empty (&net.associated_stas) != false,
+ "List shall not be empty");
+ }
+ test_end;
+
+ for (i = 0; i < 10; i++)
+ {
+ cp_net_sta_remove_assoc (&cp, &net, i + 1);
+ }
+
+ test_begin (test, "Verify if list is empty")
+ {
+ test_fail_if (set_empty (&net.associated_stas) != true,
+ "List shall be empty");
+ }
+ test_end;
+ cp_net_uninit (&cp, &net);
+}
+
+/** Removing the CCo station of the net.
+ *
+ * \param test the test object.
+ *
+ * Add some station in the net list as associated, one of those stations is
+ * the CCo (TEI = 3 for examples).
+ *
+ * At the beginning of the test, the station with the TEI = 3, shall have its
+ * status cco flag setted and the network has its cco pointer corresponding to
+ * this station.
+ *
+ * At the end, the station shall not exist in the network and the pointer
+ * to the CCo in the network shall be null.
+ * The other stations of the AVLN shall remain present.
+ */
+void
+test_case_remove_sta_cco_station (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[10], *s;
+ uint i;
+
+ cp_net_init (&cp, &net, 0);
+
+ for (i = 0; i < 10; i++)
+ {
+ sta[i] = cp_net_sta_add (&cp, &net, i + 1, i + 1);
+ }
+ cp_net_set_cco (&cp, &net, 3);
+
+ test_case_begin (test, "Remove sta : Remove CCo station");
+
+ test_begin (test, "Verify begin data")
+ {
+ test_fail_if (net.cco != sta[2], "Wrong CCo pointer value");
+
+ for (i = 0; i < 10; i++)
+ {
+ test_fail_if (cp_sta_get_tei (sta[i]) != i + 1,
+ "Wrong TEI");
+ test_fail_if (cp_sta_get_cco_status (sta[i]) != (i == 2 ? true :
+ false), "Wrong station CCo status");
+ slab_release (sta[i]);
+ }
+ }
+ test_end;
+
+
+ // remove the CCo.
+ cp_net_sta_remove_assoc (&cp, &net, 3);
+
+ test_begin (test, "Verifying the absence of CCo in the AVLN")
+ {
+ for (i = 0, s = cp_net_get_first (&cp, &net, CP_STA_STATE_ASSOCIATED);
+ s;
+ i++, s = cp_net_get_next (&cp, &net, s))
+ {
+ test_fail_if (cp_sta_get_tei (s) != (i < 2 ? i + 1 : i + 2),
+ "Wrong tei");
+ }
+ }
+ test_end;
+
+ cp_net_uninit (&cp, &net);
+}
+
+/** Removing the PCo Station of the net.
+ *
+ * \param test the object test
+ *
+ * Add some station in the net list as associated, one of those stations is
+ * the PCo (TEI = 3 for examples).
+ *
+ * At the beginning of the test, the station with the TEI = 3, shall have
+ * its status pco flag setted and the network has its pco pointer
+ * corresponding to this station.
+ *
+ * At the end, the station shall not exist in the network and the pointer
+ * to the PCo in the network shall be null.
+ * The other stations of the AVLN shall remain present.
+ */
+void
+test_case_remove_sta_pco_station (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[10], *s;
+ uint i;
+
+ cp_net_init (&cp, &net, 0);
+
+ for (i = 0; i < 10; i++)
+ {
+ sta[i] = cp_net_sta_add (&cp, &net, i + 1, i + 1);
+ }
+ cp_net_set_pco(&cp, &net, 3);
+
+ test_case_begin (test, "Remove sta : Remove PCo station");
+
+ test_begin (test, "Verify begin data")
+ {
+ test_fail_if (net.pco != sta[2], "Wrong PCo pointer value");
+
+ for (i = 0; i < 10; i++)
+ {
+ test_fail_if (cp_sta_get_tei (sta[i]) != i + 1,
+ "Wrong TEI");
+ test_fail_if (cp_sta_get_pco_status (sta[i]) != (i == 2 ? true :
+ false), "Wrong station CCo status");
+ slab_release (sta[i]);
+ }
+ }
+ test_end;
+
+
+ // remove the PCo.
+ cp_net_sta_remove_assoc (&cp, &net, 3);
+
+ test_begin (test, "Verifying the absence of PCo in the AVLN")
+ {
+ for (i = 0, s = cp_net_get_first (&cp, &net, CP_STA_STATE_ASSOCIATED);
+ s;
+ i++, s = cp_net_get_next (&cp, &net, s))
+ {
+ test_fail_if (cp_sta_get_tei (s) != (i < 2 ? i + 1 : i + 2),
+ "Wrong tei");
+ }
+ }
+ test_end;
+
+ cp_net_uninit (&cp, &net);
+}
+
+/** Add a CCo station to the net.
+ *
+ * \param test the test object.
+ *
+ * Add a station to be the CCo it will test the get_cco and set CCo
+ * functions.
+ */
+void
+test_case_cco (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[2];
+ cp_sta_t *cco;
+ cp_mme_peer_t peer;
+
+ cp_net_init (&cp, &net, 0);
+
+ // the cco station.
+ sta[0] = cp_net_sta_add (&cp, &net, 1, 11);
+ cp_net_set_cco (&cp, &net, 1);
+
+ // another station in the avln.
+ sta[1] = cp_net_sta_add (&cp, &net, 2, 22);
+
+ test_case_begin (test, "set and get cco");
+
+ test_begin (test, "get cco")
+ {
+ cco = cp_net_get_cco (&cp, &net);
+ test_fail_if (cco != sta[0], "wrong cco station");
+ cp_net_get_cco_peer (&cp, &net, &peer);
+ test_fail_if (!cp_mme_peer_cmp (&peer, &CP_MME_PEER (11, 1)));
+ }
+ test_end;
+ slab_release (cco);
+
+ // remove the cco.
+ cp_net_sta_remove_assoc (&cp, &net, 1);
+
+ test_begin (test, "get cco, cco doesn't exists anymore")
+ {
+ cco = cp_net_get_cco (&cp, &net);
+ test_fail_if (cco != NULL, "wrong cco station");
+ }
+ test_end;
+
+ // set the new cco.
+ cp_net_set_cco (&cp, &net, 2);
+
+ test_begin (test, "get cco")
+ {
+ cco = cp_net_get_cco (&cp, &net);
+ test_fail_if (cco != sta[1], "wrong cco station");
+ cp_net_get_cco_peer (&cp, &net, &peer);
+ test_fail_if (!cp_mme_peer_cmp (&peer, &CP_MME_PEER (22, 2)));
+ }
+ test_end;
+ slab_release (cco);
+
+ slab_release (sta[0]);
+ slab_release (sta[1]);
+ cp_net_uninit (&cp, &net);
+}
+
+/** Add a PCo station to the net.
+ *
+ * \param test the test object.
+ *
+ * Add a station to be the PCo it will test the get_pco function.
+ */
+void
+test_case_pco (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[2];
+ cp_sta_t *pco;
+ cp_mme_peer_t peer;
+
+ cp_net_init (&cp, &net, 0);
+
+ // the pco station.
+ sta[0] = cp_net_sta_add (&cp, &net, 1, 11);
+ cp_net_set_pco (&cp, &net, 1);
+
+ // another station in the avln.
+ sta[1] = cp_net_sta_add (&cp, &net, 2, 22);
+
+ test_case_begin (test, "set and get pco");
+
+ test_begin (test, "get pco")
+ {
+ pco = cp_net_get_pco (&cp, &net);
+ test_fail_if (pco != sta[0], "wrong pco station");
+ cp_net_get_pco_peer (&cp, &net, &peer);
+ test_fail_if (!cp_mme_peer_cmp (&peer, &CP_MME_PEER (11, 1)));
+ }
+ test_end;
+ slab_release (pco);
+
+ // remove the pco.
+ cp_net_sta_remove_assoc (&cp, &net, 1);
+
+ test_begin (test, "get pco, pco doesn't exists anymore")
+ {
+ pco = cp_net_get_pco (&cp, &net);
+ test_fail_if (pco != NULL, "wrong cco station");
+ }
+ test_end;
+
+ // set the new pco.
+ cp_net_set_pco (&cp, &net, 2);
+
+ test_begin (test, "get pco")
+ {
+ pco = cp_net_get_pco (&cp, &net);
+ test_fail_if (pco != sta[1], "wrong pco station");
+ cp_net_get_pco_peer (&cp, &net, &peer);
+ test_fail_if (!cp_mme_peer_cmp (&peer, &CP_MME_PEER (22, 2)));
+ }
+ test_end;
+ slab_release (pco);
+
+ slab_release (sta[0]);
+ slab_release (sta[1]);
+ cp_net_uninit (&cp, &net);
+}
+
+
+/** Add twice the same station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_add_twice_same_sta (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta[2];
+
+ cp_net_init (&cp, &net, 0);
+
+ sta[0] = cp_net_sta_add (&cp, &net, 1, 1);
+ sta[1] = cp_net_sta_add (&cp, &net, 1, 1);
+
+ test_case_begin (test, "Add twice the same station");
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (sta[0] != sta[1], "Shall be equal");
+ }
+ test_end;
+
+ cp_net_uninit (&cp, &net);
+ slab_release (sta[0]);
+ slab_release (sta[1]);
+}
+
+/** Test the commit function.
+ *
+ * \param test the test object.
+ */
+void
+test_case_commit (test_t test)
+{
+ bitstream_t bitstream;
+ cp_net_t net;
+ cp_sta_t *sta[2];
+ cp_t cp;
+ uint sta1_tag;
+ uint sta1_tei;
+ u64 sta1_mac_addr;
+ uint sta2_tag;
+ uint sta2_tei;
+ u64 sta2_mac_addr;
+
+ cp.cl = blk_alloc();
+ cp_net_init (&cp, &net, 0);
+ net.station_avln = true;
+
+ // the CCo station.
+ sta[0] = cp_net_sta_add (&cp, &net, 1, 1);
+
+ // another station in the AVLN.
+ sta[1] = cp_net_sta_add (&cp, &net, 2, 2);
+
+ test_case_begin (test, "commit function");
+
+ cp_net_commit_to_dataplane (&cp, &net);
+
+ // Get the table.
+ bitstream_init (&bitstream, ((u8*) cp.cl + 1), 2*8, BITSTREAM_READ);
+ bitstream_access (&bitstream, &sta1_tag, 8);
+ bitstream_access (&bitstream, &sta1_tei, 8);
+ bitstream_access (&bitstream, &sta1_mac_addr, 48);
+ bitstream_access (&bitstream, &sta2_tag, 8);
+ bitstream_access (&bitstream, &sta2_tei, 8);
+ bitstream_access (&bitstream, &sta2_mac_addr, 48);
+ bitstream_finalise (&bitstream);
+
+ test_begin (test, "Verify commit")
+ {
+ test_fail_if (((u8*)cp.cl)[0] != 2, "Wrong qte of mac sta");
+
+ test_fail_if (sta1_tag != CP_MACTOTEI_TAGS_LIST, "Wrong tag");
+ test_fail_if (sta1_tei != cp_sta_get_tei(sta[0]),
+ "Wrong station TEI");
+ test_fail_if (sta1_mac_addr != cp_sta_get_mac_address(sta[0]),
+ "Wrong station mac address");
+
+ test_fail_if (sta2_tag != CP_MACTOTEI_TAGS_LIST, "Wrong tag");
+ test_fail_if (sta2_tei != cp_sta_get_tei(sta[1]),
+ "Wrong station TEI");
+ test_fail_if (sta2_mac_addr != cp_sta_get_mac_address(sta[1]),
+ "Wrong station mac address");
+
+ }
+ test_end;
+
+ slab_release (sta[0]);
+ slab_release (sta[1]);
+ blk_release (cp.cl);
+ cp_net_uninit (&cp, &net);
+}
+
+/**
+ * Verify the garbage function.
+ *
+ * \param test the test object
+ *
+ *
+ * Shall create some station and modify the last seen date to be deleted by
+ * the garbage collector of the net.
+ */
+void
+test_case_garbage (test_t test, phy_t *phy)
+{
+ cp_t cp;
+ cp_sta_t *sta;
+ cp_net_t net;
+ uint i;
+
+ test_case_begin (test, "Garbage");
+
+ cp_net_init (&cp, &net, false);
+
+ for (i = 0; i < 3; i++)
+ {
+ // unassoc sta.
+ sta = cp_net_sta_add (&cp, &net, 0, i + 1);
+ sta->last_seen_ms = 2 * i + 5;
+ cp_sta_set_state (sta, CP_STA_STATE_EXISTS);
+ slab_release (sta);
+
+ // assoc sta.
+ sta = cp_net_sta_add (&cp, &net, i + 1, 4*i + 1);
+ sta->last_seen_ms = 2 * i + 6;
+ cp_sta_set_state (sta, CP_STA_STATE_AUTHENTICATED);
+ slab_release (sta);
+ }
+
+ *((uint*)phy) = MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S) + 8;
+ cp_net_garbage_stations (&cp, &net,
+ MAC_SEC_TO_MS(CP_STA_EXPIRATION_DELAY_S) + 8);
+
+ test_begin (test, "Expiration of 2 stations")
+ {
+ sta = cp_net_get_first(&cp, &net, CP_STA_STATE_ASSOCIATED);
+
+ test_fail_if (sta == NULL,
+ "list shall not be empty");
+
+ test_fail_if (cp_sta_get_tei (sta) != 2,
+ "Station 1 has not been expired");
+ slab_release (sta);
+
+ sta = cp_net_get_first(&cp, &net, CP_STA_STATE_EXISTS);
+
+ test_fail_if (cp_sta_get_mac_address (sta) == 1,
+ "Station with Mac@ 1 has not been expired");
+ slab_release (sta);
+
+ }
+ test_end;
+
+ cp_net_uninit (&cp, &net);
+}
+
+/** Set slot id
+ * \param test the test object.
+ *
+ * Add an AVLN and set the slot id to 5.
+ *
+ * Result
+ * The slot id shall be equal to 5.
+ */
+void
+test_case_network_set_slot_id (test_t test)
+{
+ cp_net_t net;
+ cp_t cp;
+
+ cp_net_init (&cp, &net, false);
+
+ test_case_begin (test, "Set slot id");
+
+ cp_net_set_slot_id_and_usage (&cp, &net, 5, 10);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (net.avln_slot_id != 5, "Wrong slot id");
+ test_fail_if (net.avln_slot_usage != 10, "Wrong slot usage mask");
+ }
+ test_end;
+}
+
+/** Verify if use of the counter of visible stations.
+ * \param test the test object.
+ */
+void
+test_case_network_get_num_discovered_sta (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta;
+
+ cp_net_init (&cp, &net, false);
+
+ test_case_begin (test, "Get number discovered stations");
+
+ sta = cp_net_sta_add (&cp, &net, 1, 1);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (net.num_visible_stas != 1, "One station discovered");
+ }
+ test_end;
+
+ cp_net_sta_remove (&cp, &net, sta);
+
+ test_begin (test, "verify")
+ {
+ test_fail_if (net.num_visible_stas != 0, "No station discovered");
+ }
+ test_end;
+
+
+ slab_release (sta);
+
+ cp_net_uninit (&cp, &net);
+}
+
+/**
+ * Network mode function test.
+ * \param test the test object.
+ */
+void
+test_case_network_mode (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+
+ cp_net_init (&cp, &net, true);
+
+ test_case_begin (test, "Network mode");
+
+ test_begin (test, "First mode read")
+ {
+ test_fail_if (cp_net_get_nm (&cp, &net) != CP_NET_NM_CSMA_ONLY,
+ "Network mode is wrong");
+ }
+ test_end;
+
+ cp_net_set_nm (&cp, &net, CP_NET_NM_COORDINATED);
+
+ test_begin (test, "First mode read")
+ {
+ test_fail_if (cp_net_get_nm (&cp, &net) != CP_NET_NM_COORDINATED,
+ "Network mode is wrong");
+ }
+ test_end;
+
+
+ cp_net_uninit (&cp, &net);
+}
+
+/**
+ * Test the set station visible status.
+ * \param test the test object.
+ */
+void
+test_case_sta_visible_status (test_t test)
+{
+ cp_t cp;
+ cp_net_t net;
+ cp_sta_t *sta;
+
+ test_case_begin (test, "STA set visible status");
+
+ cp_net_init (&cp, &net, false);
+
+ sta = cp_net_sta_add (&cp, &net, 0x1, 0x1);
+ cp_net_sta_set_visible_status (&cp, &net, sta, CP_STA_VISIBLE_STATE_VISIBLE);
+
+ test_begin (test, "Verify the visibility of the station")
+ {
+ test_fail_if (cp_sta_get_visible_status (sta) != true,
+ "Wrong visible status");
+ test_fail_if (cp_net_get_num_discovered_stas (&cp, &net) != 1,
+ "Wrong discovered sta");
+ }
+ test_end;
+ slab_release (sta);
+
+ sta = cp_net_sta_add (&cp, &net, 0x2, 0x2);
+ cp_net_sta_set_visible_status (&cp, &net, sta, CP_STA_VISIBLE_STATE_HIDDEN);
+
+ test_begin (test, "Verify the hidden status")
+ {
+ test_fail_if (cp_sta_get_visible_status (sta) !=
+ CP_STA_VISIBLE_STATE_HIDDEN, "Wrong visible status");
+ test_fail_if (cp_net_get_num_discovered_stas (&cp, &net) != 1,
+ "Wrong discovered sta");
+ test_fail_if (cp_net_get_num_stas (&cp, &net) != 2,
+ "Wrong number of stations");
+ }
+ test_end;
+
+ slab_release (sta);
+
+
+ test_begin (test, "Remove stations")
+ {
+ cp_net_sta_remove_assoc (&cp, &net, 0x1);
+
+ test_fail_if (cp_net_get_num_discovered_stas (&cp, &net) != 0,
+ "Wrong discovered sta");
+ test_fail_if (cp_net_get_num_stas (&cp, &net) != 1,
+ "Wrong number of stations");
+
+ cp_net_sta_remove_assoc (&cp, &net, 0x2);
+
+ test_fail_if (cp_net_get_num_discovered_stas (&cp, &net) != 0,
+ "Wrong discovered sta");
+ test_fail_if (cp_net_get_num_stas (&cp, &net) != 0,
+ "Wrong number of stations");
+ }
+ test_end;
+
+ cp_net_uninit (&cp, &net);
+}
+
+void
+test_case_get_sta_from_mac (test_t test)
+{
+ cp_t cp;
+ cp_sta_t *sta;
+ cp_net_t *net;
+ uint i;
+
+ test_case_begin (test, "Get station from mac address associated");
+
+ cp_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+
+ for (i = 1; i < 10; i++)
+ {
+ sta = cp_net_sta_add (&cp, net, i, i);
+ slab_release (sta);
+ }
+
+ sta = cp_net_get_sta_from_mac (&cp, net, 0x5);
+ test_begin (test, "verify")
+ {
+ test_fail_if (sta == NULL, "Station shall exist");
+ test_fail_if (cp_sta_get_tei (sta) != 5, "Wrong TEI");
+ test_fail_if (cp_sta_get_mac_address (sta) != 5, "Wrong Mac @");
+ }
+ test_end;
+ slab_release (sta);
+
+ cp_sta_mgr_uninit (&cp);
+}
+
+/** Verify if the net_empty function.
+ * \param test the test object.
+ *
+ * The function shall return true if the associated set is empty even if the
+ * unassociated set is not empty.
+ */
+void
+test_case_net_empty (test_t test)
+{
+ cp_net_t net;
+ cp_t cp;
+ cp_sta_t *sta;
+
+ cp_net_init (&cp, &net, true);
+ test_case_begin (test, "Network empty");
+
+ test_begin (test, "verify, assoc list empty, unassoc empty")
+ {
+ test_fail_if (cp_net_is_empty (&cp, &net) != true,
+ "net is empty function shall return true");
+ }
+ test_end;
+
+ sta = cp_net_sta_add (&cp, &net, 0x1, 0x1);
+ slab_release (sta);
+
+ test_begin (test, "verify, assoc list not empty, unassoc not empty")
+ {
+ test_fail_if (cp_net_is_empty (&cp, &net) != false,
+ "net is empty function shall return false");
+ }
+ test_end;
+ cp_net_sta_remove_assoc (&cp, &net, 0x1);
+
+ sta = cp_net_sta_add (&cp, &net, 0x0, 0x1);
+ slab_release (sta);
+
+ test_begin (test, "verify, assoc list empty, unassoc not empty")
+ {
+ test_fail_if (cp_net_is_empty (&cp, &net) != true,
+ "net is empty function shall return true");
+ }
+ test_end;
+
+ cp_net_uninit (&cp, &net);
+}
+
+int
+main (void)
+{
+ test_t test;
+ uint phy = 0;
+ mac_config_t mac_config;
+
+ test_init (test, 0, NULL);
+ mac_ntb_init ((phy_t*) &phy, &mac_config);
+
+ test_case_network_add_unassoc_stations (test);
+ test_case_network_add_assoc_stations (test);
+ test_case_network_add_auth_stations (test);
+ test_case_network_add_auth_stations_last_is_cco (test);
+ test_case_network_add_auth_stations_last_is_pco (test);
+ test_case_remove_stations (test);
+ test_case_remove_sta_cco_station (test);
+ test_case_remove_sta_pco_station (test);
+ test_case_cco (test);
+ test_case_pco (test);
+ test_case_commit (test);
+ test_case_add_twice_same_sta (test);
+ test_case_garbage (test, (phy_t *) &phy);
+ test_case_network_set_slot_id (test);
+ test_case_network_get_num_discovered_sta (test);
+ test_case_network_mode (test);
+ test_case_sta_visible_status (test);
+ test_case_get_sta_from_mac (test);
+ test_case_net_empty (test);
+
+ test_case_begin (test, "Memory allocation");
+
+ test_begin (test, "memory leaks")
+ {
+ test_fail_if (blk_check_memory () != true, "Memory leaks");
+ }
+ test_end;
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
+/**
+ * Create a phy_date weak function to do not have to include the phy on test
+ * when it is not necessary.
+ *
+ * \param phy the phy context.
+ * \return the phy date.
+ */
+u32
+phy_date (phy_t *phy)
+{
+ dbg_assert (phy);
+
+ return *((uint*) phy);
+}
+
diff --git a/cesar/cp/sta/mgr/test/src/sta-test.c b/cesar/cp/sta/mgr/test/src/sta-test.c
new file mode 100644
index 0000000000..b8055a79e7
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/src/sta-test.c
@@ -0,0 +1,371 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/sta-test.c
+ * \brief « brief description »
+ * \ingroup « module »
+ *
+ * « long description »
+ */
+#include "common/std.h"
+#include "lib/test.h"
+#include "lib/bitstream.h"
+
+#include "cp/sta/mgr/sta_own_data.h"
+
+#include "cp/inc/context.h"
+#include "cp/sta/mgr/inc/sta_own_data.h"
+
+/**
+ * Test the init of the module.
+ *
+ * \param test the test object.
+ */
+void
+test_case_sta_own_data_init (test_t test)
+{
+ cp_t cp;
+ cp_sta_own_data_private_t *data;
+
+ test_case_begin (test, "Station own data init");
+
+ cp_sta_own_data_init (&cp);
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+
+ test_begin (test, "Initialise")
+ {
+ /* Public data. */
+ test_fail_if (data->public.nek_change_rtc != 0, "Wrong nek rtc");
+ test_fail_if (data->public.cco_prefered != 0, "Wrong cco preferred");
+ test_fail_if (data->public.hfid_avln[0] != 0, "Wrong hfid AVLN");
+ test_fail_if (data->public.hfid_user[0] != 0, "Wrong hfid user");
+ test_fail_if (data->public.hfid_manufacturer [0] != 0,
+ "Wrong hfid manufacturer");
+ test_fail_if (data->public.hybrid_mode != 0, "Wrong hybrid mode");
+ test_fail_if (data->public.snid_track != 0, "Wrong snid track");
+ test_fail_if (data->public.nid_track != 0, "Wrong nid track");
+ test_fail_if (data->public.eks_current != 0, "Wrong EKS");
+ test_fail_if (data->pco_glid != 0, "Wrong PCo status");
+ test_fail_if (data->public.pco != 0, "Wrong Pco");
+ test_fail_if (data->public.authenticated != false,
+ "Wrong authenticated status");
+
+ /* Private data. */
+ test_fail_if (data->tei != 0, "Wrong tei");
+ test_fail_if (data->mac_addr != 0, "Wrong Mac Address");
+ test_fail_if (data->npw[0] != 0, "Wrong NPW");
+ test_fail_if (data->nmk.key[0] != 0, "Wrong NMK");
+ test_fail_if (data->dpw[0] != 0, "Wrong DPW");
+ test_fail_if (data->was_cco != 0, "Wrong Was CCo");
+ test_fail_if (data->security_level != 0, "Wrong Was SL");
+ }
+ test_end;
+}
+
+/**
+ * Test the set and get TEI procedure.
+ *
+ * \param test the test object.
+ *
+ * This function will test that the TEI is correctly stored in both ma config
+ * and station own data.
+ */
+void
+test_case_sta_tei (test_t test)
+{
+ mac_config_t mac_config;
+ cp_t cp;
+ cp_sta_own_data_private_t *data;
+
+ test_case_begin (test, "TEI");
+
+ // initialise.
+ cp_sta_own_data_init (&cp);
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+
+ // Add the mac config to the CP.
+ cp.mac_config = &mac_config;
+
+ mac_config.tei = 0xb;
+ data->tei = 0xb;
+
+ cp_sta_own_data_set_tei (&cp, 0xA);
+
+ test_begin (test, "verify data->stored")
+ {
+ test_fail_if (data->tei != 0xA, "Wrong tei");
+ test_fail_if (mac_config.tei != 0xA, "Wrong tei");
+ }
+ test_end;
+
+ test_begin (test, "get the TEI with accessor")
+ {
+ test_fail_if (cp_sta_own_data_get_tei (&cp) !=
+ 0xA, "Wrong tei");
+ }
+ test_end;
+}
+
+/**
+ * Test the set and get Mac Address procedure.
+ *
+ * \param test the test object.
+ *
+ * This function will test that the mac address is correctly stored in
+ * both ma config and station own data.
+ */
+void
+test_case_sta_mac_address (test_t test)
+{
+ mac_config_t mac_config;
+ mac_t mac_addr;
+ cp_t cp;
+ cp_sta_own_data_private_t *data;
+
+ test_case_begin (test, "Mac address");
+
+ // initialise.
+ cp_sta_own_data_init (&cp);
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+
+ // Add the mac config to the CP.
+ cp.mac_config = &mac_config;
+
+ mac_addr = 0x123456789abcull;
+ mac_config.sta_mac_address = mac_addr;
+ data->tei = mac_addr;
+
+ mac_addr = 0x9876543210abull;
+ cp_sta_own_data_set_mac_address (&cp, mac_addr);
+
+ test_begin (test, "verify data stored")
+ {
+ test_fail_if (data->mac_addr != mac_addr, "Wrong tei");
+ test_fail_if (mac_config.sta_mac_address != mac_addr, "Wrong tei");
+ }
+ test_end;
+
+ test_begin (test, "get the Mac address with accessor")
+ {
+ test_fail_if (cp_sta_own_data_get_mac_address (&cp) !=
+ mac_addr, "Wrong Mac address");
+ }
+ test_end;
+}
+
+/**
+ * Test the set and get NPW procedure.
+ *
+ * \param test the test object.
+ *
+ * This function will test that the NPW is correctly stored in
+ * station own data.
+ */
+void
+test_case_sta_npw (test_t test)
+{
+ cp_t cp;
+ u8 npw [CP_NPW_MAX_SIZE] = "HPAV_1.1\0";
+ cp_sta_own_data_private_t *data;
+
+ // initialise.
+ cp_sta_own_data_init (&cp);
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+
+ test_case_begin (test, "NPW");
+
+ cp_sta_own_data_set_npw (&cp, (char*) npw);
+
+ test_begin (test, "store of the NPW")
+ {
+ test_fail_if (memcmp(data->npw, npw, sizeof(npw)) != 0,
+ "wrong NPW");
+ }
+ test_end;
+
+ test_begin (test, "get the NPW")
+ {
+ test_fail_if (memcmp (
+ (u8 *) cp_sta_own_data_get_npw(&cp),
+ npw, sizeof (npw)) != 0, "Wrong NPW");
+ }
+ test_end;
+}
+
+/**
+ * Test the set and get NMK procedure.
+ *
+ * \param test the test object.
+ *
+ * This function will test that the NMK is correctly stored in
+ * station own data.
+ */
+void
+test_case_sta_nmk (test_t test)
+{
+ cp_t cp;
+ cp_key_t nmk;
+ cp_sta_own_data_private_t *data;
+
+ // initialise.
+ cp_sta_own_data_init (&cp);
+
+ test_case_begin (test, "NMK");
+
+ nmk.key[0] = 0x5426;
+ cp_sta_own_data_set_nmk (&cp, nmk);
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+
+ test_begin (test, "store of the NMK")
+ {
+ test_fail_if (data->nmk.key[0] != nmk.key[0],
+ "wrong NMK");
+ }
+ test_end;
+
+ test_begin (test, "get the NMK")
+ {
+ test_fail_if (cp_sta_own_data_get_nmk(&cp).key[0] !=
+ nmk.key[0], "Wrong NMK");
+ }
+ test_end;
+}
+
+/**
+ * Test the set and get DPW procedure.
+ *
+ * \param test the test object.
+ *
+ * This function will test that the DPW is correctly stored in
+ * station own data.
+ */
+void
+test_case_sta_dpw (test_t test)
+{
+ cp_t cp;
+ u8 dpw [CP_DPW_MAX_SIZE] = "HPAV_1.1\0";
+ cp_sta_own_data_private_t *data;
+
+ // initialise.
+ cp_sta_own_data_init (&cp);
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+
+ test_case_begin (test, "DPW");
+
+ cp_sta_own_data_set_dpw (&cp, (char*)dpw);
+
+ test_begin (test, "store of the DPW")
+ {
+ test_fail_if (memcmp(data->dpw, dpw, sizeof(dpw)) != 0,
+ "wrong DPW");
+ }
+ test_end;
+
+ test_begin (test, "get the DPW")
+ {
+ test_fail_if (memcmp (
+ (u8 *) cp_sta_own_data_get_dpw(&cp),
+ dpw, sizeof (dpw)) != 0, "Wrong NMK");
+ }
+ test_end;
+}
+
+/**
+ * Test the security level APIs set and get.
+ *
+ * \param test the test object.
+ */
+void
+test_case_security_level (test_t test)
+{
+ cp_t cp;
+ uint sl;
+ cp_sta_own_data_private_t *data;
+
+ // initialise.
+ cp_sta_own_data_init (&cp);
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+
+ test_case_begin (test, "SL");
+
+ data->security_level = 0xF;
+ sl = 1;
+
+ cp_sta_own_data_set_security_level (&cp, sl);
+
+ test_begin (test, "Security level storage")
+ {
+ test_fail_if (sl != data->security_level, "Wrong SL");
+ }
+ test_end;
+
+ test_begin (test, "get Security level")
+ {
+ test_fail_if (sl != cp_sta_own_data_get_security_level(&cp),
+ "Wrong SL");
+ }
+ test_end;
+}
+
+/**
+ * Test the was CCo APIs set and get.
+ *
+ * \param test the test object.
+ */
+void
+test_case_was_cco (test_t test)
+{
+ cp_t cp;
+ bool was_cco;
+ cp_sta_own_data_private_t *data;
+
+ // initialise.
+ cp_sta_own_data_init (&cp);
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+
+ test_case_begin (test, "Was CCo");
+
+ data->was_cco = false;
+ was_cco = true;
+
+ cp_sta_own_data_set_was_cco (&cp, was_cco);
+
+ test_begin (test, "Was CCo storage")
+ {
+ test_fail_if (was_cco != data->was_cco, "Wrong Was CCo status");
+ }
+ test_end;
+
+ test_begin (test, "get Security level")
+ {
+ test_fail_if (was_cco != cp_sta_own_data_get_was_cco (&cp),
+ "Wrong Was cco status");
+ }
+ test_end;
+}
+
+int
+main (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_sta_own_data_init (test);
+ test_case_sta_tei (test);
+ test_case_sta_mac_address (test);
+ test_case_sta_npw (test);
+ test_case_sta_nmk (test);
+ test_case_sta_dpw (test);
+ test_case_security_level (test);
+ test_case_was_cco (test);
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/sta/mgr/test/src/sta_mgr_test.c b/cesar/cp/sta/mgr/test/src/sta_mgr_test.c
new file mode 100644
index 0000000000..379588b9ba
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/src/sta_mgr_test.c
@@ -0,0 +1,289 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/sta_mgr_test.c
+ * \brief station manager test.
+ * \ingroup cp_sta_mgr
+ *
+ */
+#include "common/std.h"
+
+#include "lib/test.h"
+#include "mac/common/timings.h"
+
+#include "cp/cp.h"
+#include "cp/inc/context.h"
+
+#include "cp/sta/mgr/sta_mgr.h"
+#include "cp/sta/mgr/net_list.h"
+#include "cp/sta/mgr/net.h"
+
+#include "cp/sta/mgr/inc/sta_mgr.h"
+#include "cp/sta/mgr/inc/net_list.h"
+#include "cp/sta/mgr/inc/net.h"
+
+/** Initialise
+ * \param test the test object.
+ *
+ * This shall call the function init of the net_list and the
+ * init function of the STA own data.
+ */
+void
+test_sta_mgr_init (test_t test)
+{
+ uint i;
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_own_data_private_t *data;
+
+ cp_sta_mgr_init (&cp);
+
+ test_case_begin (test, "Init the STA manager");
+
+ test_begin (test, "sta manager")
+ {
+ for (i = 0; i < CP_NET_LIST_NB_AVLN; i++)
+ {
+ net = &cp.sta_mgr.network_list.networks[i];
+ test_fail_if (net->present != (i == 0 ? true : false),
+ "Present flag wrong.");
+ test_fail_if (net->station_avln != (i == 0 ? true : false),
+ "Station AVLN flag false");
+ test_fail_if (net->snid != 0, "Wrong SNID");
+ test_fail_if (net->nid != 0, "Wrong NID");
+ test_fail_if (net->cco != 0, "Wrong CCo");
+ test_fail_if (net->pco != 0, "Wrong PCo");
+ test_fail_if (net->expiration_ms !=
+ MAC_SEC_TO_MS(CP_NET_EXPIRATION_DELAY_S),
+ "Wrong PCo");
+ test_fail_if (set_empty (&net->associated_stas) != true,
+ "Qte of associated stations is wrong");
+ test_fail_if (set_empty (&net->unassociated_stas) != true,
+ "Qte of associated stations is wrong");
+ }
+
+ /* sta own data. */
+ data = &cp.sta_mgr.sta_own_data;
+ /* Public data. */
+ test_fail_if (data->public.nek_change_rtc != 0, "Wrong nek rtc");
+ test_fail_if (data->public.cco_prefered != 0, "Wrong cco preferred");
+ test_fail_if (data->public.hfid_avln[0] != 0, "Wrong hfid AVLN");
+ test_fail_if (data->public.hfid_user[0] != 0, "Wrong hfid user");
+ test_fail_if (data->public.hfid_manufacturer [0] != 0,
+ "Wrong hfid manufacturer");
+ test_fail_if (data->public.hybrid_mode != 0, "Wrong hybrid mode");
+ test_fail_if (data->public.snid_track != 0, "Wrong snid track");
+ test_fail_if (data->public.nid_track != 0, "Wrong nid track");
+ test_fail_if (data->public.eks_current != 0, "Wrong EKS");
+ test_fail_if (data->pco_glid != 0, "Wrong PCo status");
+ test_fail_if (data->public.pco != 0, "Wrong Pco");
+
+ /* Private data */
+ test_fail_if (data->tei != 0, "Wrong tei");
+ test_fail_if (data->mac_addr != 0, "Wrong Mac Address");
+ test_fail_if (data->npw[0] != 0, "Wrong NPW");
+ test_fail_if (data->nmk.key[0] != 0, "Wrong NMK");
+ test_fail_if (data->dpw[0] != 0, "Wrong DPW");
+ test_fail_if (data->was_cco != 0, "Wrong Was CCo");
+ test_fail_if (data->security_level != 0, "Wrong Was SL");
+ }
+ test_end;
+}
+
+/** Uninitialise
+ *
+ * \param test the test object.
+ *
+ * This will call the uninit function to the net_list and the station own data.
+ */
+void
+test_case_sta_mgr_uninit (test_t test)
+{
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_own_data_private_t *data;
+
+
+ cp_sta_mgr_init (&cp);
+
+ // Add an avln.
+ net = cp_net_list_add_avln (&cp, &cp.sta_mgr.network_list, 1, 1);
+
+ sta = cp_net_sta_add (&cp, net, 1, 1);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 0, 3);
+ slab_release (sta);
+
+ // In the station AVLN.
+ net = cp_sta_mgr_get_our_avln (&cp);
+
+ sta = cp_net_sta_add (&cp, net, 1, 1);
+ slab_release (sta);
+ sta = cp_net_sta_add (&cp, net, 2, 3);
+
+ data = (cp_sta_own_data_private_t *) cp_sta_mgr_get_sta_own_data (&cp);
+ data->public.pco = sta;
+
+ test_case_begin (test, "Init the STA manager");
+
+ test_begin (test, "sta manager")
+ {
+ test_fail_if (cp_net_list_is_empty (&cp, &cp.sta_mgr.network_list)
+ != false,
+ "Network list is empty");
+ }
+ test_end;
+
+ cp_sta_mgr_uninit (&cp);
+
+ test_begin (test, "sta manager uinit")
+ {
+ test_fail_if (cp_net_list_is_empty (&cp, &cp.sta_mgr.network_list)
+ != true,
+ "Network list is not empty");
+ test_fail_if (data->public.pco != NULL, "sta own data not reseted");
+ }
+ test_end;
+}
+
+/** Simulation of an Handover.
+ * \param test the test object.
+ *
+ * Add a station to our AVLN and set it as CCo.
+ * Then set the CCo as our own sta.
+ */
+void
+test_case_sta_mgr_set_cco_as_our_own_sta (test_t test)
+{
+ cp_t cp;
+ mac_config_t mac_config;
+ cp_sta_own_data_t *own;
+ cp_net_t *net;
+ cp_sta_t *sta;
+ cp_sta_t *xco;
+
+ cp_sta_mgr_init (&cp);
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ // Add a station.
+ sta = cp_net_sta_add (&cp, net, 0xA /* tei */,
+ 0x123456 /* mac @. */);
+ slab_release (sta);
+
+ cp_net_set_cco (&cp, net, 0xA);
+
+ test_case_begin (test, "Handover simulation to our own sta");
+
+ test_begin (test, "verify current CCo")
+ {
+ xco = cp_net_get_cco (&cp, net);
+ test_fail_if (xco != sta, "Wrong CCo");
+ }
+ test_end;
+ slab_release (xco);
+
+
+ cp.mac_config = &mac_config;
+ cp_sta_own_data_set_tei (&cp, 0xB);
+ cp_net_set_cco (&cp, net, 0xB);
+
+ xco = cp_net_get_cco (&cp, net);
+ own = cp_sta_mgr_get_sta_own_data (&cp);
+ test_begin (test, "verify current CCo as our data")
+ {
+ test_fail_if (xco != NULL,
+ "Function shall return NULL");
+ test_fail_if (own->is_cco != true, "Boolean shall be true");
+ }
+ test_end;
+
+ cp_net_set_cco (&cp, net, 0xA);
+ xco = cp_net_get_cco (&cp, net);
+
+ test_begin (test, "verify current CCo again")
+ {
+ test_fail_if (xco != sta, "Wrong CCo");
+ test_fail_if (own->is_cco != false, "Own sta shall not be CCo");
+ }
+ test_end;
+ slab_release (xco);
+
+ cp_sta_mgr_uninit (&cp);
+}
+
+void
+test_case_sta_mgr_merge_net (test_t test)
+{
+ cp_t cp;
+ cp_net_t *net;
+ cp_sta_t *sta;
+
+ cp_sta_mgr_init (&cp);
+
+ test_case_begin (test, "Merge nets");
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ test_begin (test, "Verify current net")
+ {
+ test_fail_if (net->present != true, "Net shall be present");
+ test_fail_if (set_empty (&net->associated_stas) != true,
+ "Set shall be empty");
+ test_fail_if (set_empty (&net->unassociated_stas) != true,
+ "Set shall be empty");
+ }
+ test_end;
+
+ net = cp_sta_mgr_add_avln (&cp, 0x1, 0x12345679);
+ sta = cp_net_sta_add (&cp, net, 0x0, 0x1);
+ slab_release (sta);
+
+ sta = cp_net_sta_add (&cp, net, 0x1, 0x2);
+ slab_release (sta);
+
+ cp_sta_mgr_merge_net (&cp, net);
+
+ test_begin (test, "Verify current net")
+ {
+ test_fail_if (net->present != false, "Net shall not be present");
+ test_fail_if (set_empty (&net->associated_stas) != true,
+ "Set shall be empty");
+ test_fail_if (set_empty (&net->unassociated_stas) != true,
+ "Set shall be empty");
+ }
+ test_end;
+
+ net = cp_sta_mgr_get_our_avln (&cp);
+ test_begin (test, "Verify our net")
+ {
+ test_fail_if (net->present != true , "Net shall be present");
+ test_fail_if (set_empty (&net->associated_stas) != false,
+ "Set shall be empty");
+ test_fail_if (set_empty (&net->unassociated_stas) != false,
+ "Set shall be empty");
+ }
+ test_end;
+
+ cp_sta_mgr_uninit (&cp);
+}
+
+int
+main (void)
+{
+ test_t test;
+ test_init (test, 0, NULL);
+
+ test_sta_mgr_init (test);
+ test_case_sta_mgr_uninit (test);
+ test_case_sta_mgr_set_cco_as_our_own_sta (test);
+ test_case_sta_mgr_merge_net (test);
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/sta/mgr/test/src/station_test.c b/cesar/cp/sta/mgr/test/src/station_test.c
new file mode 100644
index 0000000000..c6021dd118
--- /dev/null
+++ b/cesar/cp/sta/mgr/test/src/station_test.c
@@ -0,0 +1,209 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/station_test.c
+ * \brief Test the station.
+ * \ingroup cp_sta_mgr
+ *
+ */
+
+#include "common/std.h"
+#include "string.h"
+
+#include "lib/test.h"
+#include "lib/bitstream.h"
+#include "lib/slab.h"
+
+#include "cp/sta/mgr/sta.h"
+
+#include "cp/sta/mgr/inc/sta.h"
+
+/**
+ * Initialise a station.
+ *
+ */
+void
+test_case_station_init (test_t test)
+{
+ cp_sta_t *sta;
+ cp_sta_private_t station;
+
+ memset (&station, 0, sizeof (cp_sta_private_t));
+ sta = cp_sta_init ();
+
+ test_case_begin (test, "Station init");
+ test_begin (test, "verify data")
+ {
+ test_fail_if (memcmp(sta, &station,
+ sizeof(cp_sta_private_t)) != 0,
+ "Wrong sta is not initialised");
+ }
+ test_end;
+ slab_release (sta);
+}
+
+/**
+ * Get the TEI of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_tei (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station TEI");
+
+ station.tei = 0xA;
+
+ test_begin (test, "Getting TEI")
+ {
+ test_fail_if (cp_sta_get_tei ((cp_sta_t *) &station) != 0xA,
+ "Wrong TEI");
+ }
+ test_end;
+}
+
+/**
+ * Get the Mac address of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_mac_addr (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station Mac address");
+
+ station.mac_address = 0x123456789abcull;
+
+ test_begin (test, "Getting Mac address")
+ {
+ test_fail_if (cp_sta_get_mac_address ((cp_sta_t *) &station)
+ != 0x123456789abcull,
+ "Wrong Mac address");
+ }
+ test_end;
+}
+
+/**
+ * Get the peer structure of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_peer (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station peer");
+
+ station.tei = 0xA;
+ station.mac_address = 0x123456789abcull;
+
+ test_begin (test, "Getting peer")
+ {
+ cp_mme_peer_t peer;
+ cp_sta_get_peer ((cp_sta_t *) &station, &peer);
+ test_fail_if (!cp_mme_peer_cmp (
+ &peer, &CP_MME_PEER (0x123456789abcull, 0xA)),
+ "Wrong peer");
+ }
+ test_end;
+}
+
+/**
+ * Get the CCo status of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_cco_status (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station CCo status");
+
+ test_begin (test, "Getting CCo status")
+ {
+ test_fail_if (cp_sta_get_cco_status ((cp_sta_t *) &station)
+ != false,
+ "Wrong CCo status");
+ }
+ test_end;
+
+ station.is_cco = true;
+
+ test_begin (test, "Getting CCo status true")
+ {
+ test_fail_if (cp_sta_get_cco_status ((cp_sta_t *) &station)
+ != true,
+ "Wrong CCo status");
+ }
+ test_end;
+}
+
+/**
+ * Get the PCo status of the station.
+ *
+ * \param test the test object.
+ */
+void
+test_case_get_pco_status (test_t test)
+{
+ cp_sta_private_t station;
+
+ memset (&station, '\0', sizeof (cp_sta_private_t));
+
+ test_case_begin (test, "get station PCo status");
+
+ test_begin (test, "Getting PCo status")
+ {
+ test_fail_if (cp_sta_get_pco_status ((cp_sta_t *) &station)
+ != false,
+ "Wrong PCo status");
+ }
+ test_end;
+
+ station.pco_glid = 0x80;
+
+ test_begin (test, "Getting PCo status true")
+ {
+ test_fail_if (cp_sta_get_pco_status ((cp_sta_t *) &station)
+ != true,
+ "Wrong PCo status");
+ }
+ test_end;
+}
+
+int
+main (void)
+{
+ test_t test;
+
+ test_init (test, 0, NULL);
+
+ test_case_station_init (test);
+ test_case_get_tei (test);
+ test_case_get_mac_addr (test);
+ test_case_get_peer (test);
+ test_case_get_cco_status (test);
+ test_case_get_pco_status (test);
+
+ test_result (test);
+ return test_nb_failed (test) == 0 ? 0 : 1;
+}
diff --git a/cesar/cp/test/doc/CP Functionnal test plan.odt b/cesar/cp/test/doc/CP Functionnal test plan.odt
new file mode 100644
index 0000000000..06e190bd1a
--- /dev/null
+++ b/cesar/cp/test/doc/CP Functionnal test plan.odt
Binary files differ
diff --git a/cesar/cp/test/doc/station_manager_function_call.odt b/cesar/cp/test/doc/station_manager_function_call.odt
new file mode 100644
index 0000000000..243089f167
--- /dev/null
+++ b/cesar/cp/test/doc/station_manager_function_call.odt
Binary files differ
diff --git a/cesar/cp/test/mme/Config b/cesar/cp/test/mme/Config
new file mode 100644
index 0000000000..4bad3cc185
--- /dev/null
+++ b/cesar/cp/test/mme/Config
@@ -0,0 +1 @@
+CONFIG_DEBUG = n
diff --git a/cesar/cp/test/mme/Makefile b/cesar/cp/test/mme/Makefile
new file mode 100644
index 0000000000..8876e7cfd3
--- /dev/null
+++ b/cesar/cp/test/mme/Makefile
@@ -0,0 +1,14 @@
+BASE = ../../..
+
+TARGET = sparc
+
+HOST_PROGRAMS = test_mme
+TARGET_PROGRAMS = test_mme_target
+
+test_mme_SOURCES = test_mme.c
+test_mme_MODULES = lib
+
+test_mme_target_SOURCES = test_mme.c
+test_mme_target_MODULES = lib
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/cp/test/mme/src/test_mme.c b/cesar/cp/test/mme/src/test_mme.c
new file mode 100644
index 0000000000..a327d5e8cb
--- /dev/null
+++ b/cesar/cp/test/mme/src/test_mme.c
@@ -0,0 +1,174 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file src/test_mme.c
+ * \brief Test MME header.
+ * \ingroup test
+ */
+#include "common/std.h"
+
+#include "cp/mme.h"
+
+#include "lib/test.h"
+
+#define mem_barrier() asm volatile ("" : : : "memory")
+
+cp_mme_peer_t
+test_peer_return (void)
+{
+ return CP_MME_PEER (0x112233445566ull, 0x12);
+}
+
+void
+test_peer_param (cp_mme_peer_t *p)
+{
+ *p = CP_MME_PEER (0x112233445566ull, 0x12);
+}
+
+extern inline bool
+test_peer_param_inline (cp_mme_peer_t p1, cp_mme_peer_t p2)
+{
+ return p1.mac == p2.mac && p1.tei == p2.tei;
+}
+
+extern inline bool
+test_peer_paramp_inline (cp_mme_peer_t *p1, cp_mme_peer_t *p2)
+{
+ return p1->mac == p2->mac && p1->tei == p2->tei;
+}
+
+void
+test_code_1 (void)
+{
+ mem_barrier ();
+ cp_mme_peer_t peer = { 0x112233445566ull, 0, 0x12, false };
+ mem_barrier ();
+ (void) peer;
+}
+
+void
+test_code_2 (void)
+{
+ mem_barrier ();
+ cp_mme_peer_t peer = CP_MME_PEER (0x112233445566ull, 0x12);
+ mem_barrier ();
+ (void) peer;
+}
+
+void
+test_code_21 (void)
+{
+ mem_barrier ();
+ cp_mme_peer_t *peer = &CP_MME_PEER (0x112233445566ull, 0x12);
+ mem_barrier ();
+ (void) peer;
+}
+
+void
+test_code_3 (void)
+{
+ mem_barrier ();
+ cp_mme_peer_t peer = test_peer_return ();
+ mem_barrier ();
+ (void) peer;
+}
+
+void
+test_code_4 (void)
+{
+ mem_barrier ();
+ cp_mme_peer_t peer;
+ test_peer_param (&peer);
+ mem_barrier ();
+}
+
+bool
+test_code_5 (void)
+{
+ cp_mme_peer_t peer1, peer2;
+ test_peer_param (&peer1);
+ test_peer_param (&peer2);
+ bool same;
+ mem_barrier ();
+ same = test_peer_param_inline (peer1, peer2);
+ mem_barrier ();
+ return same;
+}
+
+bool
+test_code_6 (void)
+{
+ cp_mme_peer_t peer1, peer2;
+ test_peer_param (&peer1);
+ test_peer_param (&peer2);
+ bool same;
+ mem_barrier ();
+ same = test_peer_paramp_inline (&peer1, &peer2);
+ mem_barrier ();
+ return same;
+}
+
+bool
+test_code_7 (void)
+{
+ cp_mme_peer_t peer1, peer2;
+ test_peer_param (&peer1);
+ test_peer_param (&peer2);
+ bool same;
+ mem_barrier ();
+ same = (peer1.mac == peer2.mac && peer1.tei == peer2.tei);
+ mem_barrier ();
+ return same;
+}
+
+void
+mme_peer_test_suite (test_t t)
+{
+ test_suite_begin (t, "mme peer");
+ test_case_begin (t, "basic");
+ test_begin (t, "assign")
+ {
+ cp_mme_peer_t peer1 = CP_MME_PEER (0x0123456789abull, 0xab);
+ test_fail_unless (peer1.mac == 0x0123456789abull);
+ test_fail_unless (peer1.tei == 0xab);
+ test_fail_unless (peer1.all_sta == false);
+ test_fail_unless (peer1.vlan_tag == 0);
+ cp_mme_peer_t peer2 = CP_MME_PEER (0x0123456789abull);
+ test_fail_unless (peer2.mac == 0x0123456789abull);
+ test_fail_unless (peer2.tei == 0xff);
+ test_fail_unless (peer2.all_sta == false);
+ test_fail_unless (peer2.vlan_tag == 0);
+ cp_mme_peer_t peer3 = CP_MME_PEER_ALL_STA;
+ test_fail_unless (peer3.mac == 0);
+ test_fail_unless (peer3.tei == 0);
+ test_fail_unless (peer3.all_sta == true);
+ test_fail_unless (peer3.vlan_tag == 0);
+ } test_end;
+ test_begin (t, "cmp")
+ {
+ cp_mme_peer_t peer1 = { .mac = 0x0123456789abull, .tei = 0xab,
+ .all_sta = false, .vlan_tag = 0x89abcdef };
+ cp_mme_peer_t peer2 = CP_MME_PEER (0x0123456789abull, 0xab);
+ cp_mme_peer_t peer3 = CP_MME_PEER (0x111111111111ull, 0xab);
+ cp_mme_peer_t peer4 = CP_MME_PEER (0x0123456789abull, 0x22);
+ test_fail_unless (cp_mme_peer_cmp (&peer1, &peer2));
+ test_fail_unless (!cp_mme_peer_cmp (&peer2, &peer3));
+ test_fail_unless (!cp_mme_peer_cmp (&peer2, &peer4));
+ } test_end;
+}
+
+int
+main (int argc, char **argv)
+{
+ test_t t;
+ test_init (t, argc, argv);
+ mme_peer_test_suite (t);
+ test_result (t);
+ return test_nb_failed (t) == 0 ? 0 : 1;
+}
+
diff --git a/cesar/cp/types.h b/cesar/cp/types.h
new file mode 100644
index 0000000000..f1fe167dd6
--- /dev/null
+++ b/cesar/cp/types.h
@@ -0,0 +1,46 @@
+#ifndef cp_types_h
+#define cp_types_h
+/* Cesar project {{{
+ *
+ * Copyright (C) 2008 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file cp/types.h
+ * \brief Types definition for the CP.
+ * \ingroup cp
+ *
+ */
+#include "cp/defs.h"
+
+/** Forward declaration. */
+typedef struct cp_t cp_t;
+
+/** Terminal Equipment Identifier (TEI). */
+typedef u8 cp_tei_t;
+
+/** Short Network Identifier (SNID). */
+typedef u8 cp_snid_t;
+
+/** Network Identifier, 54 bits (NID). */
+typedef u64 cp_nid_t;
+
+/** 128 bit AES key. */
+struct cp_key_t
+{
+ u32 key[4];
+};
+typedef struct cp_key_t cp_key_t;
+
+/** Security level. */
+enum cp_security_level_t
+{
+ CP_SECURITY_LEVEL_SC,
+ CP_SECURITY_LEVEL_HS,
+ CP_SECURITY_LEVEL_NB
+};
+typedef enum cp_security_level_t cp_security_level_t;
+
+#endif /* cp_types_h */