summaryrefslogtreecommitdiff
path: root/cesar/maximus
diff options
context:
space:
mode:
authorsave2008-04-07 14:17:42 +0000
committersave2008-04-07 14:17:42 +0000
commit3d58a62727346b7ac1a6cb36fed1a06ed72228dd (patch)
treed7788c3cf9f76426aef0286d0202e2097f0fa0eb /cesar/maximus
parent095dca4b0a8d4924093bab424f71f588fdd84613 (diff)
Moved the complete svn base into the cesar directory.
git-svn-id: svn+ssh://pessac/svn/cesar/trunk@1769 017c9cb6-072f-447c-8318-d5b54f68fe89
Diffstat (limited to 'cesar/maximus')
-rw-r--r--cesar/maximus/Module6
-rw-r--r--cesar/maximus/channel/Module5
-rw-r--r--cesar/maximus/channel/inc/ChannelComputer.h316
-rw-r--r--cesar/maximus/channel/inc/ChannelComputerTest.h40
-rw-r--r--cesar/maximus/channel/inc/ChannelMapping.h198
-rw-r--r--cesar/maximus/channel/inc/ChannelMappingTest.h40
-rw-r--r--cesar/maximus/channel/inc/ChannelPoint.h126
-rw-r--r--cesar/maximus/channel/inc/ChannelPointTest.h34
-rw-r--r--cesar/maximus/channel/inc/ChannelSettings.h204
-rw-r--r--cesar/maximus/channel/inc/ChannelSettingsTest.h38
-rw-r--r--cesar/maximus/channel/inc/IChannel.h164
-rw-r--r--cesar/maximus/channel/src/ChannelComputer.cpp886
-rw-r--r--cesar/maximus/channel/src/ChannelComputerTest.cpp298
-rw-r--r--cesar/maximus/channel/src/ChannelMapping.cpp494
-rw-r--r--cesar/maximus/channel/src/ChannelMappingTest.cpp430
-rw-r--r--cesar/maximus/channel/src/ChannelPoint.cpp156
-rw-r--r--cesar/maximus/channel/src/ChannelPointTest.cpp41
-rw-r--r--cesar/maximus/channel/src/ChannelSettings.cpp229
-rw-r--r--cesar/maximus/channel/src/ChannelSettingsTest.cpp114
-rw-r--r--cesar/maximus/common/interfaces/Maximus.h351
-rw-r--r--cesar/maximus/common/interfaces/Msg.h312
-rw-r--r--cesar/maximus/common/interfaces/Sta.h169
-rw-r--r--cesar/maximus/common/types/channel_types.h56
-rw-r--r--cesar/maximus/common/types/ethernet_types.h87
-rw-r--r--cesar/maximus/common/types/functioncall_types.h79
-rw-r--r--cesar/maximus/common/types/hal_phy_types.h75
-rw-r--r--cesar/maximus/common/types/networkclock_types.h73
-rw-r--r--cesar/maximus/common/types/phy_types.h112
-rw-r--r--cesar/maximus/common/types/sci_types.h117
-rw-r--r--cesar/maximus/common/types/system_types.h69
-rw-r--r--cesar/maximus/coreengine/Module5
-rw-r--r--cesar/maximus/coreengine/inc/CoreEngine.h187
-rw-r--r--cesar/maximus/coreengine/inc/CoreEngineTest.h36
-rw-r--r--cesar/maximus/coreengine/inc/MaximusTest.h68
-rw-r--r--cesar/maximus/coreengine/inc/Msg.tpp117
-rw-r--r--cesar/maximus/coreengine/inc/MsgTest.h58
-rw-r--r--cesar/maximus/coreengine/inc/StaTest.h54
-rw-r--r--cesar/maximus/coreengine/src/CoreEngine.cpp293
-rw-r--r--cesar/maximus/coreengine/src/CoreEngineTest.cpp71
-rw-r--r--cesar/maximus/coreengine/src/Maximus.cpp1289
-rw-r--r--cesar/maximus/coreengine/src/MaximusTest.cpp445
-rw-r--r--cesar/maximus/coreengine/src/Msg.cpp545
-rw-r--r--cesar/maximus/coreengine/src/MsgTest.cpp302
-rw-r--r--cesar/maximus/coreengine/src/Sta.cpp262
-rw-r--r--cesar/maximus/coreengine/src/StaTest.cpp185
-rwxr-xr-xcesar/maximus/doc/fulminata_ecos_specs.odtbin0 -> 53907 bytes
-rwxr-xr-xcesar/maximus/doc/fulminata_general_specs.odtbin0 -> 44544 bytes
-rwxr-xr-xcesar/maximus/doc/fulminata_maximus_architecture.odtbin0 -> 1799405 bytes
-rwxr-xr-xcesar/maximus/doc/fulminata_maximus_architecture.xmi8039
-rwxr-xr-xcesar/maximus/doc/fulminata_maximus_user_guide.odtbin0 -> 256281 bytes
-rwxr-xr-xcesar/maximus/doc/fulminata_maximus_user_guide.xmi950
-rw-r--r--cesar/maximus/ethernet/Module5
-rw-r--r--cesar/maximus/ethernet/inc/EtherSciMsg.h227
-rw-r--r--cesar/maximus/ethernet/inc/EtherSciMsgTest.h60
-rw-r--r--cesar/maximus/ethernet/inc/EthernetProcessor.h169
-rw-r--r--cesar/maximus/ethernet/inc/EthernetProcessorTest.h44
-rw-r--r--cesar/maximus/ethernet/inc/IEthernet.h105
-rw-r--r--cesar/maximus/ethernet/src/EtherSciMsg.cpp372
-rw-r--r--cesar/maximus/ethernet/src/EtherSciMsgTest.cpp225
-rw-r--r--cesar/maximus/ethernet/src/EthernetProcessor.cpp292
-rw-r--r--cesar/maximus/ethernet/src/EthernetProcessorTest.cpp139
-rw-r--r--cesar/maximus/functioncall/Module5
-rw-r--r--cesar/maximus/functioncall/inc/FunctionCallManager.h147
-rw-r--r--cesar/maximus/functioncall/inc/FunctionCallManagerTest.h43
-rw-r--r--cesar/maximus/functioncall/inc/FunctionCallParameter.h167
-rw-r--r--cesar/maximus/functioncall/inc/FunctionCallParameterTest.h40
-rw-r--r--cesar/maximus/functioncall/inc/FunctionSciMsg.h332
-rw-r--r--cesar/maximus/functioncall/inc/FunctionSciMsgTest.h44
-rw-r--r--cesar/maximus/functioncall/inc/IFunctionCall.h116
-rw-r--r--cesar/maximus/functioncall/inc/IFunctionCallTest.h34
-rw-r--r--cesar/maximus/functioncall/src/FunctionCallManager.cpp316
-rw-r--r--cesar/maximus/functioncall/src/FunctionCallManagerTest.cpp128
-rw-r--r--cesar/maximus/functioncall/src/FunctionCallParameter.cpp277
-rw-r--r--cesar/maximus/functioncall/src/FunctionCallParameterTest.cpp162
-rw-r--r--cesar/maximus/functioncall/src/FunctionSciMsg.cpp865
-rw-r--r--cesar/maximus/functioncall/src/FunctionSciMsgTest.cpp206
-rw-r--r--cesar/maximus/functioncall/src/IFunctionCallTest.cpp89
-rw-r--r--cesar/maximus/networkclock/Module5
-rw-r--r--cesar/maximus/networkclock/inc/ClockSciMsg.h212
-rw-r--r--cesar/maximus/networkclock/inc/INetworkClock.h104
-rw-r--r--cesar/maximus/networkclock/inc/NetworkClockEvt.h184
-rw-r--r--cesar/maximus/networkclock/inc/NetworkClockEvtList.h171
-rw-r--r--cesar/maximus/networkclock/inc/NetworkClockEvtListTest.h40
-rw-r--r--cesar/maximus/networkclock/inc/NetworkClockEvtTest.h34
-rw-r--r--cesar/maximus/networkclock/inc/NetworkClockProcessor.h238
-rw-r--r--cesar/maximus/networkclock/inc/NetworkClockProcessorTest.h64
-rw-r--r--cesar/maximus/networkclock/src/ClockSciMsg.cpp399
-rw-r--r--cesar/maximus/networkclock/src/NetworkClockEvt.cpp269
-rw-r--r--cesar/maximus/networkclock/src/NetworkClockEvtList.cpp314
-rw-r--r--cesar/maximus/networkclock/src/NetworkClockEvtListTest.cpp227
-rw-r--r--cesar/maximus/networkclock/src/NetworkClockEvtTest.cpp45
-rw-r--r--cesar/maximus/networkclock/src/NetworkClockProcessor.cpp523
-rw-r--r--cesar/maximus/networkclock/src/NetworkClockProcessorTest.cpp401
-rw-r--r--cesar/maximus/phy/Module5
-rw-r--r--cesar/maximus/phy/inc/IPhy.h234
-rw-r--r--cesar/maximus/phy/inc/PhyProcessor.h512
-rw-r--r--cesar/maximus/phy/inc/PhyProcessorTest.h74
-rw-r--r--cesar/maximus/phy/inc/PhySciMsg.h524
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgFc.h148
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgFcTest.h42
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgMpdu.h290
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgMpduTest.h48
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgNoise.h87
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgNoiseTest.h38
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgPre.h116
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgPreTest.h38
-rw-r--r--cesar/maximus/phy/inc/PhySciMsgTest.h38
-rw-r--r--cesar/maximus/phy/src/PhyProcessor.cpp1530
-rw-r--r--cesar/maximus/phy/src/PhyProcessorTest.cpp583
-rw-r--r--cesar/maximus/phy/src/PhySciMsg.cpp944
-rw-r--r--cesar/maximus/phy/src/PhySciMsgFc.cpp189
-rw-r--r--cesar/maximus/phy/src/PhySciMsgFcTest.cpp131
-rw-r--r--cesar/maximus/phy/src/PhySciMsgMpdu.cpp529
-rw-r--r--cesar/maximus/phy/src/PhySciMsgMpduTest.cpp321
-rw-r--r--cesar/maximus/phy/src/PhySciMsgNoise.cpp86
-rw-r--r--cesar/maximus/phy/src/PhySciMsgNoiseTest.cpp64
-rw-r--r--cesar/maximus/phy/src/PhySciMsgPre.cpp124
-rw-r--r--cesar/maximus/phy/src/PhySciMsgPreTest.cpp72
-rw-r--r--cesar/maximus/phy/src/PhySciMsgTest.cpp77
-rw-r--r--cesar/maximus/python/Makefile9
-rwxr-xr-xcesar/maximus/python/doc/fulminata_maximus_scenario_engine.odtbin0 -> 343674 bytes
-rwxr-xr-xcesar/maximus/python/doc/fulminata_maximus_scenario_engine.xmi1386
-rw-r--r--cesar/maximus/python/lib/cesar/maximus_dur.py97
-rw-r--r--cesar/maximus/python/lib/cesar/sta_cesar.py44
-rw-r--r--cesar/maximus/python/lib/fcVf/__init__.py1
-rw-r--r--cesar/maximus/python/lib/fcVf/crc24/__init__.py1
-rw-r--r--cesar/maximus/python/lib/fcVf/crc24/crc24.py84
-rw-r--r--cesar/maximus/python/lib/fcVf/crc24/crc24_algorithms.py172
-rw-r--r--cesar/maximus/python/lib/fcVf/crc24/pycrc24.py44
-rw-r--r--cesar/maximus/python/lib/fcVf/fcVfFields.py758
-rw-r--r--cesar/maximus/python/lib/framing.py45
-rw-r--r--cesar/maximus/python/lib/macFrame.py122
-rw-r--r--cesar/maximus/python/lib/mmentry/Constants.py317
-rw-r--r--cesar/maximus/python/lib/mmentry/__init__.py1
-rw-r--r--cesar/maximus/python/lib/mmentry/aes128/AES.py31
-rw-r--r--cesar/maximus/python/lib/mmentry/aes128/Python_AES.py68
-rw-r--r--cesar/maximus/python/lib/mmentry/aes128/__init__.py1
-rw-r--r--cesar/maximus/python/lib/mmentry/aes128/compat.py140
-rw-r--r--cesar/maximus/python/lib/mmentry/aes128/cryptomath.py400
-rw-r--r--cesar/maximus/python/lib/mmentry/aes128/rijndael.py392
-rw-r--r--cesar/maximus/python/lib/mmentry/bmi/__init__.py1
-rw-r--r--cesar/maximus/python/lib/mmentry/bmi/bmiBody.py21
-rw-r--r--cesar/maximus/python/lib/mmentry/bmi/bmiMethod.py482
-rw-r--r--cesar/maximus/python/lib/mmentry/encapsulation/__init__.py1
-rw-r--r--cesar/maximus/python/lib/mmentry/encapsulation/encapsulation.py250
-rw-r--r--cesar/maximus/python/lib/mmentry/fid/__init__.py1
-rw-r--r--cesar/maximus/python/lib/mmentry/fid/fidBody.py39
-rw-r--r--cesar/maximus/python/lib/mmentry/fid/fidMethod.py528
-rw-r--r--cesar/maximus/python/lib/mmentry/mmentry.py121
-rw-r--r--cesar/maximus/python/lib/mmentry/mmentryFields.py3258
-rw-r--r--cesar/maximus/python/lib/mmentry/mmentryMethod.py2089
-rw-r--r--cesar/maximus/python/lib/proto/fcall.py349
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/CHANGES.txt171
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/LICENSE.txt61
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/PKG-INFO21
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/README.txt244
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/enhancedserial.py62
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/miniterm.py165
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/scan.py27
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/setup_demo.py35
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/tcp_serial_redirect.py150
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/test.py186
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/test_advanced.py164
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/test_high_load.py67
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/wxSerialConfigDialog.py259
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/wxSerialConfigDialog.wxg262
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/wxTerminal.py332
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/examples/wxTerminal.wxg127
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/serial/__init__.py20
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/serial/serialjava.py212
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/serial/serialposix.py406
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/serial/serialutil.py366
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/serial/serialwin32.py314
-rw-r--r--cesar/maximus/python/lib/proto/pyserial/setup.py38
-rw-r--r--cesar/maximus/python/lib/proto/uspp/AUTHORS4
-rw-r--r--cesar/maximus/python/lib/proto/uspp/Copyright21
-rw-r--r--cesar/maximus/python/lib/proto/uspp/Readme190
-rw-r--r--cesar/maximus/python/lib/proto/uspp/Readme_es199
-rw-r--r--cesar/maximus/python/lib/proto/uspp/SerialPort_darwin.py326
-rw-r--r--cesar/maximus/python/lib/proto/uspp/SerialPort_linux.py329
-rw-r--r--cesar/maximus/python/lib/proto/uspp/SerialPort_win.py239
-rw-r--r--cesar/maximus/python/lib/proto/uspp/lesser.txt504
-rw-r--r--cesar/maximus/python/lib/proto/uspp/uspp.htm635
-rw-r--r--cesar/maximus/python/lib/proto/uspp/uspp.py193
-rw-r--r--cesar/maximus/python/lib/proto/uspp/uspp_es.htm629
-rw-r--r--cesar/maximus/python/lib/script.py173
-rwxr-xr-xcesar/maximus/python/lib/station/test_tx_rx.elfbin0 -> 966377 bytes
-rw-r--r--cesar/maximus/python/maximus/__init__.py16
-rw-r--r--cesar/maximus/python/maximus/channel/__init__.py7
-rw-r--r--cesar/maximus/python/maximus/channel/snr.py52
-rw-r--r--cesar/maximus/python/maximus/cli/__init__.py5
-rw-r--r--cesar/maximus/python/maximus/ethernet/__init__.py10
-rw-r--r--cesar/maximus/python/maximus/ethernet/buffer.py189
-rw-r--r--cesar/maximus/python/maximus/ethernet/create.py22
-rw-r--r--cesar/maximus/python/maximus/ethernet/eth.py109
-rw-r--r--cesar/maximus/python/maximus/ethernet/scapy.py13244
-rw-r--r--cesar/maximus/python/maximus/ethernet/sniffer.py128
-rw-r--r--cesar/maximus/python/maximus/fsm/FSM.py263
-rw-r--r--cesar/maximus/python/maximus/fsm/__init__.py7
-rw-r--r--cesar/maximus/python/maximus/macframe/__init__.py13
-rw-r--r--cesar/maximus/python/maximus/macframe/create.py10
-rw-r--r--cesar/maximus/python/maximus/macframe/fc_10.py135
-rw-r--r--cesar/maximus/python/maximus/macframe/fc_av.py173
-rw-r--r--cesar/maximus/python/maximus/macframe/macframe.py252
-rw-r--r--cesar/maximus/python/maximus/macframe/macframeheader.py80
-rw-r--r--cesar/maximus/python/maximus/macframe/macframequeue.py90
-rw-r--r--cesar/maximus/python/maximus/macframe/mpdu.py187
-rw-r--r--cesar/maximus/python/maximus/macframe/msdu.py66
-rw-r--r--cesar/maximus/python/maximus/macframe/pb.py59
-rw-r--r--cesar/maximus/python/maximus/macframe/pbheader.py95
-rw-r--r--cesar/maximus/python/maximus/mme/__init__.py10
-rw-r--r--cesar/maximus/python/maximus/mme/create.py10
-rw-r--r--cesar/maximus/python/maximus/mme/mme.py130
-rw-r--r--cesar/maximus/python/maximus/mme/mmentry.py33
-rw-r--r--cesar/maximus/python/maximus/mme/mmheader.py298
-rw-r--r--cesar/maximus/python/maximus/mme/mmtype.py20
-rw-r--r--cesar/maximus/python/maximus/result/__init__.py5
-rw-r--r--cesar/maximus/python/maximus/simu/__init__.py8
-rw-r--r--cesar/maximus/python/maximus/simu/rx.py136
-rw-r--r--cesar/maximus/python/maximus/simu/tx.py9
-rw-r--r--cesar/maximus/python/maximus/station/__init__.py8
-rw-r--r--cesar/maximus/python/maximus/station/config.py98
-rw-r--r--cesar/maximus/python/maximus/station/sta.py1052
-rw-r--r--cesar/maximus/python/maximus/utils/__init__.py10
-rw-r--r--cesar/maximus/python/maximus/utils/converter.py106
-rw-r--r--cesar/maximus/python/maximus/utils/crc.py102
-rw-r--r--cesar/maximus/python/maximus/utils/exception.py21
-rw-r--r--cesar/maximus/python/maximus/utils/format.py263
-rw-r--r--cesar/maximus/python/py/script_example.py140
-rw-r--r--cesar/maximus/python/py/test_cb.py84
-rw-r--r--cesar/maximus/python/py/test_ether.py227
-rw-r--r--cesar/maximus/python/py/test_false_alarm.py74
-rw-r--r--cesar/maximus/python/py/test_send_mpdu.py158
-rw-r--r--cesar/maximus/python/py/test_send_noise.py86
-rw-r--r--cesar/maximus/python/py/test_tx_rx.py217
-rw-r--r--cesar/maximus/python/src/interface_module.cpp745
-rwxr-xr-xcesar/maximus/python/test/startup.py29
-rw-r--r--cesar/maximus/python/test/test.txt94
-rw-r--r--cesar/maximus/python/test/test_channel.py80
-rw-r--r--cesar/maximus/python/test/test_cli.py26
-rw-r--r--cesar/maximus/python/test/test_ethernet.py489
-rw-r--r--cesar/maximus/python/test/test_fsm.py75
-rw-r--r--cesar/maximus/python/test/test_interface.py461
-rw-r--r--cesar/maximus/python/test/test_lib_cesar.py330
-rw-r--r--cesar/maximus/python/test/test_lib_proto.py376
-rw-r--r--cesar/maximus/python/test/test_macframe.py547
-rw-r--r--cesar/maximus/python/test/test_maximus.py47
-rw-r--r--cesar/maximus/python/test/test_mme.py304
-rw-r--r--cesar/maximus/python/test/test_result.py26
-rw-r--r--cesar/maximus/python/test/test_simu.py120
-rw-r--r--cesar/maximus/python/test/test_station.py268
-rw-r--r--cesar/maximus/python/test/test_utils.py107
-rw-r--r--cesar/maximus/sci/Module5
-rw-r--r--cesar/maximus/sci/inc/ISci.h143
-rw-r--r--cesar/maximus/sci/inc/SciMsg.h333
-rw-r--r--cesar/maximus/sci/inc/SciMsgTest.h50
-rw-r--r--cesar/maximus/sci/inc/SciServer.h248
-rw-r--r--cesar/maximus/sci/inc/SciServerTest.h62
-rw-r--r--cesar/maximus/sci/src/SciMsg.cpp711
-rw-r--r--cesar/maximus/sci/src/SciMsgTest.cpp129
-rw-r--r--cesar/maximus/sci/src/SciServer.cpp1005
-rw-r--r--cesar/maximus/sci/src/SciServerTest.cpp510
-rw-r--r--cesar/maximus/stationtest/Config2
-rw-r--r--cesar/maximus/stationtest/Makefile47
-rw-r--r--cesar/maximus/stationtest/ecos.ecc.sh104
-rw-r--r--cesar/maximus/stationtest/src/exception.c74
-rw-r--r--cesar/maximus/stationtest/src/hello_world.c28
-rw-r--r--cesar/maximus/stationtest/src/main_example.c392
-rw-r--r--cesar/maximus/stationtest/src/one_thread.c47
-rw-r--r--cesar/maximus/stationtest/src/test_cb.c41
-rw-r--r--cesar/maximus/stationtest/src/test_ether.c143
-rw-r--r--cesar/maximus/stationtest/src/test_false_alarm.c158
-rw-r--r--cesar/maximus/stationtest/src/test_lib_cesar.c93
-rw-r--r--cesar/maximus/stationtest/src/test_send.c231
-rw-r--r--cesar/maximus/stationtest/src/test_station.c91
-rw-r--r--cesar/maximus/stationtest/src/test_tx_rx.c339
-rw-r--r--cesar/maximus/stationtest/src/threaddelay.c50
-rw-r--r--cesar/maximus/system/Module5
-rw-r--r--cesar/maximus/system/inc/ISystem.h158
-rw-r--r--cesar/maximus/system/inc/Station.h233
-rw-r--r--cesar/maximus/system/inc/StationConfiguration.h130
-rw-r--r--cesar/maximus/system/inc/StationConfigurationTest.h34
-rw-r--r--cesar/maximus/system/inc/StationTest.h34
-rw-r--r--cesar/maximus/system/inc/SystemManager.h229
-rw-r--r--cesar/maximus/system/inc/SystemManagerTest.h52
-rw-r--r--cesar/maximus/system/inc/SystemSciMsg.h170
-rw-r--r--cesar/maximus/system/inc/SystemSciMsgTest.h38
-rw-r--r--cesar/maximus/system/src/Station.cpp555
-rw-r--r--cesar/maximus/system/src/StationConfiguration.cpp142
-rw-r--r--cesar/maximus/system/src/StationConfigurationTest.cpp51
-rw-r--r--cesar/maximus/system/src/StationTest.cpp61
-rw-r--r--cesar/maximus/system/src/SystemManager.cpp546
-rw-r--r--cesar/maximus/system/src/SystemManagerTest.cpp202
-rw-r--r--cesar/maximus/system/src/SystemSciMsg.cpp285
-rw-r--r--cesar/maximus/system/src/SystemSciMsgTest.cpp108
-rwxr-xr-xcesar/maximus/test/test.sh71
-rwxr-xr-xcesar/maximus/test/test_python.sh110
-rw-r--r--cesar/maximus/unittest/Makefile12
-rw-r--r--cesar/maximus/unittest/src/main.cpp99
-rw-r--r--cesar/maximus/usertest/Makefile7
-rw-r--r--cesar/maximus/usertest/src/main_example.cpp166
-rw-r--r--cesar/maximus/utils/Module5
-rw-r--r--cesar/maximus/utils/inc/Error.h36
-rw-r--r--cesar/maximus/utils/inc/ErrorTest.h34
-rw-r--r--cesar/maximus/utils/inc/Logger.h104
-rw-r--r--cesar/maximus/utils/inc/LoggerTest.h34
-rw-r--r--cesar/maximus/utils/src/Error.cpp27
-rw-r--r--cesar/maximus/utils/src/ErrorTest.cpp46
-rw-r--r--cesar/maximus/utils/src/Logger.cpp130
-rw-r--r--cesar/maximus/utils/src/LoggerTest.cpp39
310 files changed, 82922 insertions, 0 deletions
diff --git a/cesar/maximus/Module b/cesar/maximus/Module
new file mode 100644
index 0000000000..a4584e7ce9
--- /dev/null
+++ b/cesar/maximus/Module
@@ -0,0 +1,6 @@
+MODULES := maximus/utils maximus/functioncall maximus/channel \
+ maximus/networkclock maximus/phy maximus/sci maximus/system \
+ maximus/coreengine maximus/ethernet \
+ hal/phy/maximus/dur
+HOST_INCLUDES += maximus/common/interfaces maximus/common/types
+EXTRA_HOST_LDLIBS += -lpthread
diff --git a/cesar/maximus/channel/Module b/cesar/maximus/channel/Module
new file mode 100644
index 0000000000..132955f88e
--- /dev/null
+++ b/cesar/maximus/channel/Module
@@ -0,0 +1,5 @@
+SOURCES := ChannelComputer.cpp ChannelSettings.cpp ChannelMapping.cpp ChannelPoint.cpp
+ifdef UNITTEST
+SOURCES += ChannelComputerTest.cpp ChannelSettingsTest.cpp ChannelMappingTest.cpp ChannelPointTest.cpp
+endif
+HOST_INCLUDES += maximus/channel/inc
diff --git a/cesar/maximus/channel/inc/ChannelComputer.h b/cesar/maximus/channel/inc/ChannelComputer.h
new file mode 100644
index 0000000000..479ca5999d
--- /dev/null
+++ b/cesar/maximus/channel/inc/ChannelComputer.h
@@ -0,0 +1,316 @@
+/************************************************************************
+ ChannelComputer.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelComputer.h
+**************************************************************************/
+
+#ifndef CHANNELCOMPUTER_H
+#define CHANNELCOMPUTER_H
+
+#include "IChannel.h"
+#include "SystemManager.h" // for 'StationsList'
+
+#include "hal/phy/defs.h" // for 'PHY_CARRIER_NB'
+#include "channel_types.h" // for 'MAXIMUS_CHANNEL_MOD_NB'
+
+#include <map>
+#include <boost/random/mersenne_twister.hpp> // for random
+
+class IPhy;
+class PhySciMsgNoise;
+class ChannelSettings;
+class PhySciMsgMpdu;
+class ChannelPoint;
+
+struct Channel_Settings_Key
+{
+ Sci_Msg_Station_Id tx_station_id;
+ Sci_Msg_Station_Id rx_station_id;
+};
+struct ltkey
+{
+ bool operator()(const Channel_Settings_Key & key1, const Channel_Settings_Key & key2) const
+ {
+ if (key1.tx_station_id != key2.tx_station_id)
+ {
+ return key1.tx_station_id < key2.tx_station_id;
+ }
+ else
+ {
+ return key1.rx_station_id < key2.rx_station_id;
+ }
+ }
+};
+typedef std::map<const Channel_Settings_Key, ChannelSettings *, ltkey> ChannelSettingsList;
+
+
+/**
+ * class ChannelComputer
+ */
+
+class ChannelComputer : public IChannel
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ boost::mt19937 mEngine; // for random
+
+ static unsigned short int mNumberOfCopiesArray[PHY_MOD_ROBO_NB];
+ static float mPowerScaleArray[MAXIMUS_CHANNEL_MOD_NB];
+ uint8_t * mpTonemask;
+ StationsList * mpListOfStations;
+ ChannelSettingsList mListOfChannelSettings;
+ unsigned int mBeaconPeriod;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ ChannelComputer ( IPhy * p_phy, ISystem * p_system );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~ChannelComputer ( );
+
+ // public methods
+ //
+
+ /**
+ * Duplicate the MPDU payload.
+ * @param mpdu a PHY SCI message MPDU that contains the complete received MPDU payload
+ * @return bool
+ */
+ bool duplicateMpduPayload ( PhySciMsgMpdu & mpdu );
+
+ /**
+ * Compute PB measurement and NOISE.
+ * @param pb_measurement_array the PB measurement to fill in (for all PBs composing the MPDU)
+ * @param noise the PHY SCI message NOISE to fill in
+ * @param pb_header_array the PB header of each PB composing the MPDU
+ * @param mpdu a PHY SCI message MPDU that contains the duplicated MPDU payload
+ * @param tx_station_id the ID of the transmitting station
+ * @param rx_station_id the ID of the destination station
+ * @param current_tick the current Network Clock tick
+ * @return bool
+ */
+ bool addPerturbation ( uint32_t * pb_measurement_array,
+ PhySciMsgNoise & noise,
+ const uint32_t * pb_header_array,
+ const PhySciMsgMpdu & mpdu,
+ const Sci_Msg_Station_Id tx_station_id,
+ const Sci_Msg_Station_Id rx_station_id,
+ const Network_Clock_Tick current_tick );
+
+ /**
+ * Add Channel Settings to the list.
+ * Called when a station is created => create its associated Channel Settings.
+ * @return bool
+ */
+ bool addChannelSettings ( const Sci_Msg_Station_Id created_station_id );
+
+ /**
+ * Find Channel Settings.
+ * @param tx_station_id the ID of the transmitting station
+ * @param rx_station_id the ID of the destination station
+ * @return a list of Channel Settings
+ */
+ std::vector<ChannelSettings *> & findChannelSettings ( const Sci_Msg_Station_Id tx_station_id,
+ const Sci_Msg_Station_Id rx_station_id,
+ const bool both_directions );
+
+ /**
+ * Called when the PHY processor receives a preamble.
+ * @param current_tick the current Network Clock tick
+ * @param tx_station_id the ID of the transmitting station
+ * @return bool
+ */
+ bool receivePre ( const Sci_Msg_Station_Id tx_station_id, const Network_Clock_Tick current_tick );
+
+ /**
+ * Called when the PHY processor receives a frame control.
+ * @param current_tick the current Network Clock tick
+ * @param tx_station_id the ID of the transmitting station
+ * @return bool
+ */
+ bool receiveFc ( const Sci_Msg_Station_Id tx_station_id, const Network_Clock_Tick current_tick );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Sets the tonemask.
+ * @param p_tonemask the new value of mpTonemask
+ * @return bool
+ */
+ bool setTonemask ( const uint8_t * p_tonemask );
+
+ /**
+ * Sets the tonemap of the current transmission.
+ * @return bool
+ * @param tx_station_id the ID of the transmitting station
+ * @param length the tonemap length in octets
+ * @param p_tonemap the tonemap
+ */
+ bool setTonemap ( const Sci_Msg_Station_Id tx_station_id,
+ const unsigned long length,
+ const unsigned char * p_tonemap );
+
+ /**
+ * Sets the beacon period in ticks 25 MHz.
+ * @return bool
+ * @param frequency the power-line frequency
+ */
+ bool setBeaconPeriod ( const float frequency );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the Channel Computer class attributes.
+ */
+ void initAttributes ( );
+
+ /**
+ * Gets a tonemask value.
+ * @param carrier_index
+ * @return a boolean value indicating if the requested carrier is enabled or not
+ */
+ const bool getTonemask ( const unsigned short int carrier_index ) const;
+
+ /**
+ * Update the list of Channel Settings.
+ * Called when channel perturbation has to be added.
+ * Check if stations have been removed => remove their associated Channel Settings.
+ */
+ void updateListOfChannelSettings ( );
+
+ /**
+ * Gets the beacon period in ticks 25 MHz.
+ * @return mBeaconPeriod
+ */
+ const unsigned int getBeaconPeriod ( ) const;
+
+protected:
+
+ // protected methods
+ // All following protected methods could be declared as private methods,
+ // but they are declared as protected methods to be unitarly tested.
+ //
+
+ /**
+ * Gets the sigma factor.
+ * @param modulation the tonemap modulation
+ * @param snr_in_db the SNR value in dB
+ * @return the sigma factor
+ */
+ const double getSigma ( const Channel_Mod modulation, const float snr_in_db ) const;
+
+ /**
+ * Gets the PowerScale.
+ * @param modulation the tonemap modulation
+ * @return 1 / (PowerScale^2)
+ */
+ const float getPowerScale ( const Channel_Mod modulation ) const;
+
+ /**
+ * Gets the linear SNR.
+ * @param snr_in_db the SNR value in dB
+ * @return the linear SNR value
+ */
+ const double getLinearSnr ( const float snr_in_db ) const;
+
+ /**
+ * Add noise.
+ * @param point the original point coordinates
+ * @param sigma the sigma factor
+ * @return the noise point coordinates
+ */
+ const ChannelPoint addNoise ( const ChannelPoint & point, const double sigma );
+
+ /**
+ * Compute the BER.
+ * @param codeA / codeB the 2 codes to compare
+ * @return the BER
+ */
+ const unsigned short int computeBer ( const unsigned short int codeA,
+ const unsigned short int codeB ) const;
+
+ /**
+ * Compute the noise.
+ * @param pointA / pointB the 2 points coordinates
+ * @return the (distance)^2 between the 2 points
+ */
+ const unsigned int computeNoise ( const ChannelPoint & pointA,
+ const ChannelPoint & pointB ) const;
+
+ /**
+ * Compute the FER.
+ * @param ber the BER of the current PB
+ * @param n the average number of bits coded per carrier on the current PB
+ * @param modulation the tonemap modulation
+ * @return the FER
+ */
+ const float computeFer ( const unsigned short int ber,
+ const unsigned int n,
+ const Channel_Mod modulation ) const;
+
+ /**
+ * Compute the CRC error.
+ * @param fer the FER of the current PB
+ * @return the CRC error
+ */
+ const bool computeCrcError ( const float fer );
+};
+
+
+#endif /* CHANNELCOMPUTER_H */
diff --git a/cesar/maximus/channel/inc/ChannelComputerTest.h b/cesar/maximus/channel/inc/ChannelComputerTest.h
new file mode 100644
index 0000000000..159c01857b
--- /dev/null
+++ b/cesar/maximus/channel/inc/ChannelComputerTest.h
@@ -0,0 +1,40 @@
+
+#ifndef CHANNELCOMPUTERTEST_H
+#define CHANNELCOMPUTERTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class ChannelComputer;
+class CoreEngine;
+
+
+class ChannelComputerTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (ChannelComputerTest);
+ CPPUNIT_TEST (duplicateMpduPayloadTest);
+ CPPUNIT_TEST (addPerturbationTest);
+ CPPUNIT_TEST (protectedTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void duplicateMpduPayloadTest (void);
+ void addPerturbationTest (void);
+ void protectedTest (void);
+
+private:
+
+ ChannelComputer * mpChannelComputer;
+ CoreEngine * mpCoreEngine;
+
+};
+
+
+#endif /* CHANNELCOMPUTERTEST_H */
diff --git a/cesar/maximus/channel/inc/ChannelMapping.h b/cesar/maximus/channel/inc/ChannelMapping.h
new file mode 100644
index 0000000000..7a919e8180
--- /dev/null
+++ b/cesar/maximus/channel/inc/ChannelMapping.h
@@ -0,0 +1,198 @@
+/************************************************************************
+ ChannelMapping.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelMapping.h
+**************************************************************************/
+
+#ifndef CHANNEL_MAPPING_H
+#define CHANNEL_MAPPING_H
+
+#include "ChannelPoint.h"
+
+#include "channel_types.h" // for 'Channel_Mod'
+
+
+/**
+ * class ChannelMapping
+ */
+
+class ChannelMapping
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ ChannelPoint mPoint;
+ unsigned short int mCode;
+ static unsigned short int mNbOfBitsArray[MAXIMUS_CHANNEL_MOD_NB];
+ static short int mMappingArray[MAXIMUS_CHANNEL_VALUE_MAX_NB][MAXIMUS_CHANNEL_MOD_NB];
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ ChannelMapping ( );
+
+ /**
+ * Constructors
+ */
+ ChannelMapping ( const unsigned short int code );
+ ChannelMapping ( const ChannelPoint & point );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~ChannelMapping ( );
+
+ // public methods
+ //
+
+ /**
+ * Computes the code from the already set I and Q coordinates.
+ * @param modulation the used modulation
+ * @return bool
+ */
+ const unsigned short int computeCode ( const Channel_Mod modulation );
+
+ /**
+ * Computes the I and Q coordinates from an already set code.
+ * @param modulation the used modulation
+ * @return bool
+ */
+ const ChannelPoint & computePoint ( const Channel_Mod modulation );
+
+ /**
+ * Retrieve the integer (except for QAM8) I and Q coordinates from the already set I and Q coordinates.
+ * @param modulation the used modulation
+ * @return bool
+ */
+ const ChannelPoint retrievePoint ( const Channel_Mod modulation );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Sets the code.
+ * @param modulation the used modulation
+ * @param mpdu_payload_length the length of the MPDU payload
+ * @param p_mpdu_payload pointer to the MPDU payload
+ * @param mpdu_index indicates the current index of the MPDU payload (in bits)
+ * @return bool (and update mpdu_index)
+ */
+ bool setCode ( const Channel_Mod modulation,
+ const unsigned long mpdu_payload_length,
+ const unsigned char * p_mpdu_payload,
+ unsigned int & mpdu_index );
+
+ /**
+ * Sets the code.
+ * @param code the new value of mCode
+ * @return bool
+ */
+ bool setCode ( const unsigned short int code );
+
+ /**
+ * Gets the code.
+ * @return mCode
+ */
+ unsigned short int getCode ( ) const;
+
+ /**
+ * Sets the coordinates.
+ * @param point the new value of mPoint
+ * @return bool
+ */
+ bool setPoint ( const ChannelPoint & point );
+
+ /**
+ * Gets the Channel Point.
+ * @return mPoint
+ */
+ ChannelPoint & getPoint ( );
+
+ /**
+ * Sets the I coordinate.
+ * @param i the new value of mPoint.I
+ * @return bool
+ */
+ bool setI ( const float i );
+
+ /**
+ * Gets the I coordinate.
+ * @return mPoint.I
+ */
+ const float getI ( );
+
+ /**
+ * Sets the Q coordinate.
+ * @param q mPoint.Q
+ * @return bool
+ */
+ bool setQ ( const float q );
+
+ /**
+ * Gets the Q coordinate.
+ * @return mPoint.Q
+ */
+ const float getQ ( );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif /* CHANNEL_MAPPING_H */
diff --git a/cesar/maximus/channel/inc/ChannelMappingTest.h b/cesar/maximus/channel/inc/ChannelMappingTest.h
new file mode 100644
index 0000000000..14faf88080
--- /dev/null
+++ b/cesar/maximus/channel/inc/ChannelMappingTest.h
@@ -0,0 +1,40 @@
+
+#ifndef CHANNELMAPPINGTEST_H
+#define CHANNELMAPPINGTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class ChannelMapping;
+
+
+class ChannelMappingTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (ChannelMappingTest);
+ CPPUNIT_TEST (setCodeTest);
+ CPPUNIT_TEST (computeCodeTest);
+ CPPUNIT_TEST (computePointTest);
+ CPPUNIT_TEST (retrievePointTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void setCodeTest (void);
+ void computeCodeTest (void);
+ void computePointTest (void);
+ void retrievePointTest (void);
+
+private:
+
+ ChannelMapping * mpChannelMapping;
+
+};
+
+
+#endif /* CHANNELMAPPINGTEST_H */
diff --git a/cesar/maximus/channel/inc/ChannelPoint.h b/cesar/maximus/channel/inc/ChannelPoint.h
new file mode 100644
index 0000000000..2d6ec72249
--- /dev/null
+++ b/cesar/maximus/channel/inc/ChannelPoint.h
@@ -0,0 +1,126 @@
+/************************************************************************
+ ChannelPoint.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelPoint.h
+**************************************************************************/
+
+#ifndef CHANNEL_POINT_H
+#define CHANNEL_POINT_H
+
+
+/**
+ * class ChannelPoint
+ */
+
+class ChannelPoint
+{
+
+public:
+
+ // public attributes
+ //
+
+ float I; // abscissa
+ float Q; // ordinate
+
+private:
+
+ // private attributes
+ //
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ ChannelPoint ( );
+
+ /**
+ * Constructor
+ */
+ ChannelPoint ( float i, const float q );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~ChannelPoint ( );
+
+ // public methods
+ //
+
+ /**
+ * Operator =
+ * @param channel_point
+ * @return ChannelPoint &
+ */
+ ChannelPoint & operator= ( const ChannelPoint & channel_point );
+
+ /**
+ * Operator ==
+ * @param channel_point
+ * @return bool
+ */
+ bool operator== ( const ChannelPoint & channel_point ) const;
+
+ /**
+ * Checks Channel Point values ranges,
+ * i.e. checks I and Q coordinates validity.
+ * @return bool
+ */
+ bool checkValidity ( );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif /* CHANNEL_POINT_H */
diff --git a/cesar/maximus/channel/inc/ChannelPointTest.h b/cesar/maximus/channel/inc/ChannelPointTest.h
new file mode 100644
index 0000000000..11001a3101
--- /dev/null
+++ b/cesar/maximus/channel/inc/ChannelPointTest.h
@@ -0,0 +1,34 @@
+
+#ifndef CHANNELPOINTTEST_H
+#define CHANNELPOINTTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class ChannelPoint;
+
+
+class ChannelPointTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (ChannelPointTest);
+ CPPUNIT_TEST (checkValidityTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void checkValidityTest (void);
+
+private:
+
+ ChannelPoint * mpChannelPoint;
+
+};
+
+
+#endif /* CHANNELPOINTTEST_H */
diff --git a/cesar/maximus/channel/inc/ChannelSettings.h b/cesar/maximus/channel/inc/ChannelSettings.h
new file mode 100644
index 0000000000..1ec40409dc
--- /dev/null
+++ b/cesar/maximus/channel/inc/ChannelSettings.h
@@ -0,0 +1,204 @@
+/************************************************************************
+ ChannelSettings.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelSettings.h
+**************************************************************************/
+
+#ifndef CHANNELSETTINGS_H
+#define CHANNELSETTINGS_H
+
+#include "networkclock_types.h" // for 'Network_Clock_Tick'
+#include "channel_types.h" // for 'Channel_Mod' and 'MAXIMUS_CHANNEL_INTERVAL_MAX_NB'
+
+#include "hal/phy/defs.h" // for 'PHY_CARRIER_NB'
+
+
+/**
+ * class ChannelSettings
+ */
+
+class ChannelSettings
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ bool mIsConfigured;
+ float mSnrArray[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1];
+ Channel_Mod mTonemapArray[PHY_CARRIER_NB];
+ Network_Clock_Tick mPreDetectionDate;
+ Network_Clock_Tick mFcReceptionDate;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ ChannelSettings ( );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~ChannelSettings ( );
+
+ // public methods
+ //
+
+ /**
+ * Gets the first symbol start date (in ticks).
+ * @return tick at which the first symbol has started
+ */
+ const Network_Clock_Tick getFirstSymbolStartDate ( ) const;
+
+ /**
+ * Gets the tonemap modulation.
+ * @param carrier the current carrier number
+ * @return the tonemap modulation
+ */
+ const Channel_Mod getModulation ( const unsigned int carrier ) const;
+
+ /**
+ * Gets the SNR in dB.
+ * @param interval the current interval number
+ * @param carrier the current carrier number
+ * @return the SNR in dB
+ */
+ const float getSnr ( const Network_Clock_Tick beacon_period,
+ const Network_Clock_Tick symbol_start_date,
+ const unsigned int carrier ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Gets if the channel has been configured.
+ * @return mIsConfigured
+ */
+ const bool isConfigured ( ) const;
+
+ /**
+ * Sets the SNR.
+ * @param snr_value SNR value in dB
+ * @return bool
+ */
+ bool setSnr ( const float snr_value );
+
+ /**
+ * Sets the SNR.
+ * @param snr array of SNR values in dB
+ * @return bool
+ */
+ bool setSnr ( const float snr_values[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1] );
+
+ /**
+ * Sets the tonemap of the current transmission.
+ * @return bool
+ * @param tonemap_array the new value of mTonemapArray
+ */
+ bool setTonemap ( const Channel_Mod tonemap_array[PHY_CARRIER_NB + 1] );
+
+ /**
+ * Sets the PRE detection date.
+ * @param date tick at which the preamble has been received
+ * @return bool
+ */
+ bool setPreDetectionDate ( const Network_Clock_Tick date );
+
+ /**
+ * Sets the FC reception date.
+ * @param date tick at which the frame control has been received
+ * @return bool
+ */
+ bool setFcReceptionDate ( const Network_Clock_Tick date );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the Channel Settings class attributes.
+ */
+ void initAttributes ( );
+
+ /**
+ * Sets if the channel is configured.
+ * @param is_configured the new value of mIsConfigured
+ * @return bool
+ */
+ bool setIsConfigured ( const bool is_configured = true );
+
+ /**
+ * Gets the PRE detection date.
+ * @return mPreDetectionDate tick at which the preamble has been received
+ */
+ const Network_Clock_Tick getPreDetectionDate ( ) const;
+
+ /**
+ * Gets the FC reception date.
+ * @return mFcReceptionDate tick at which the frame control has been received
+ */
+ const Network_Clock_Tick getFcReceptionDate ( ) const;
+
+ /**
+ * Gets the time interval.
+ * @param symbol_start_date the current symbol start date in ticks
+ * @return the interval number
+ */
+ const unsigned int getInterval ( const Network_Clock_Tick beacon_period,
+ const Network_Clock_Tick symbol_start_date ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif /* CHANNELSETTINGS_H */
diff --git a/cesar/maximus/channel/inc/ChannelSettingsTest.h b/cesar/maximus/channel/inc/ChannelSettingsTest.h
new file mode 100644
index 0000000000..667365395d
--- /dev/null
+++ b/cesar/maximus/channel/inc/ChannelSettingsTest.h
@@ -0,0 +1,38 @@
+
+#ifndef CHANNELSETTINGSTEST_H
+#define CHANNELSETTINGSTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class ChannelSettings;
+
+
+class ChannelSettingsTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (ChannelSettingsTest);
+ CPPUNIT_TEST (getFirstSymbolStartDateTest);
+ CPPUNIT_TEST (getModulationTest);
+ CPPUNIT_TEST (getSnrTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void getFirstSymbolStartDateTest ( );
+ void getModulationTest ( );
+ void getSnrTest ( );
+
+private:
+
+ ChannelSettings * mpChannelSettings;
+
+};
+
+
+#endif /* CHANNELSETTINGSTEST_H */
diff --git a/cesar/maximus/channel/inc/IChannel.h b/cesar/maximus/channel/inc/IChannel.h
new file mode 100644
index 0000000000..6967762b64
--- /dev/null
+++ b/cesar/maximus/channel/inc/IChannel.h
@@ -0,0 +1,164 @@
+/************************************************************************
+ IChannel.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/IChannel.h
+**************************************************************************/
+
+#ifndef ICHANNEL_H
+#define ICHANNEL_H
+
+#include "sci_types.h" // for 'Sci_Msg_Station_Id'
+#include "networkclock_types.h" // for 'Network_Clock_Tick'
+#include "phy_types.h" // for 'MAC_MAX_PB_PER_MPDU'
+
+#include <stdint.h> // for 'uint8_t' type
+#include <vector>
+
+class PhySciMsgNoise;
+class PhySciMsgMpdu;
+class ChannelSettings;
+
+
+/**
+ * class IChannel
+ */
+
+class IChannel
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ IChannel ( ) { }
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~IChannel ( ) { }
+
+ // public methods
+ //
+
+ /**
+ * Duplicate the MPDU payload.
+ * @param mpdu a PHY SCI message MPDU that contains the complete received MPDU payload
+ * @return bool
+ */
+ virtual bool duplicateMpduPayload ( PhySciMsgMpdu & mpdu ) = 0;
+
+ /**
+ * Compute PB measurement and NOISE.
+ * @param pb_measurement_array the PB measurement to fill in
+ * @param noise the PHY SCI message NOISE to fill in
+ * @param pb_header_array the PB header of each PB composing the MPDU
+ * @param mpdu a PHY SCI message MPDU that contains the duplicated MPDU payload
+ * @param tx_station_id the ID of the transmitting station
+ * @param rx_station_id the ID of the destination station
+ * @param current_tick the current Network Clock tick
+ * @return bool
+ */
+ virtual bool addPerturbation ( uint32_t * pb_measurement_array,
+ PhySciMsgNoise & noise,
+ const uint32_t * pb_header_array,
+ const PhySciMsgMpdu & mpdu,
+ const Sci_Msg_Station_Id tx_station_id,
+ const Sci_Msg_Station_Id rx_station_id,
+ const Network_Clock_Tick current_tick ) = 0;
+
+ /**
+ * Add Channel Settings to the list.
+ * Called when a station is created => create its associated Channel Settings.
+ * @return bool
+ */
+ virtual bool addChannelSettings ( const Sci_Msg_Station_Id created_station_id ) = 0;
+
+ /**
+ * Find Channel Settings.
+ * @param tx_station_id the ID of the transmitting station
+ * @param rx_station_id the ID of the destination station
+ * @return a list of Channel Settings
+ */
+ virtual std::vector<ChannelSettings *> & findChannelSettings ( const Sci_Msg_Station_Id tx_station_id,
+ const Sci_Msg_Station_Id rx_station_id,
+ const bool both_directions ) = 0;
+
+ /**
+ * Called when the PHY processor receives a preamble.
+ * @param tx_station_id the ID of the transmitting station
+ * @param current_tick the current Network Clock tick
+ * @return bool
+ */
+ virtual bool receivePre ( const Sci_Msg_Station_Id tx_station_id, const Network_Clock_Tick current_tick ) = 0;
+
+ /**
+ * Called when the PHY processor receives a frame control.
+ * @param tx_station_id the ID of the transmitting station
+ * @param current_tick the current Network Clock tick
+ * @return bool
+ */
+ virtual bool receiveFc ( const Sci_Msg_Station_Id tx_station_id, const Network_Clock_Tick current_tick ) = 0;
+
+ /**
+ * Sets the tonemask.
+ * @param p_tonemask the new value of mpTonemask
+ * @return bool
+ */
+ virtual bool setTonemask ( const uint8_t * p_tonemask ) = 0;
+
+ /**
+ * Sets the tonemap of the current transmission.
+ * @return bool
+ * @param tx_station_id the ID of the transmitting station
+ * @param length the tonemap length in octets
+ * @param p_tonemap the tonemap
+ */
+ virtual bool setTonemap ( const Sci_Msg_Station_Id tx_station_id,
+ const unsigned long length,
+ const unsigned char * p_tonemap ) = 0;
+
+ /**
+ * Sets the beacon period in ticks 25 MHz.
+ * @return bool
+ * @param frequency the power-line frequency
+ */
+ virtual bool setBeaconPeriod ( const float frequency ) = 0;
+
+ /**
+ * Gets the beacon period in ticks 25 MHz.
+ * @return mBeaconPeriod
+ */
+ virtual const unsigned int getBeaconPeriod ( ) const = 0;
+
+};
+
+
+#endif /* ICHANNEL_H */
diff --git a/cesar/maximus/channel/src/ChannelComputer.cpp b/cesar/maximus/channel/src/ChannelComputer.cpp
new file mode 100644
index 0000000000..581bad6cf2
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelComputer.cpp
@@ -0,0 +1,886 @@
+/************************************************************************
+ ChannelComputer.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/src/ChannelComputer.cpp
+**************************************************************************/
+
+#include "ChannelComputer.h"
+#include "ChannelSettings.h"
+#include "ChannelMapping.h"
+#include "IPhy.h"
+#include "PhySciMsgNoise.h"
+#include "Station.h"
+#include "PhySciMsgMpdu.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include "mac/common/timings.h" // for 'MAC_DX417_TCK', 'MAC_DX567_TCK', 'MAC_DX3534_TCK'
+
+#include <cstdlib> // for 'rand()'
+#include <netinet/in.h> // for 'htonl()' and 'htons()'
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <math.h> // for 'pow()', 'sqrt()', 'exp()'
+#include <boost/random/normal_distribution.hpp>
+#include <boost/random/variate_generator.hpp>
+#include <boost/random/uniform_01.hpp>
+
+/* Following tables are extracted from the HomePlug AV Specification Version 1.0.10 (March 20, 2007)
+ * Chapter 3.5.5 */
+
+// Init number of copies array
+unsigned short int ChannelComputer::mNumberOfCopiesArray[PHY_MOD_ROBO_NB] = { 4, /* PHY_MOD_ROBO */
+ 2, /* PHY_MOD_HS_ROBO */
+ 5 }; /* PHY_MOD_MINI_ROBO */
+
+// Table 3-24: Modulation Normalization Scales
+float ChannelComputer::mPowerScaleArray[MAXIMUS_CHANNEL_MOD_NB] = { 0, /* NONE */
+ 1, /* BPSK */
+ 2, /* QPSK */
+ 5 + pow(1.29, 2), /* QAM8 */
+ 10, /* QAM16 */
+ 42, /* QAM64 */
+ 170, /* QAM256 */
+ 682 }; /* QAM1024 */
+
+
+// Constructors/Destructors
+//
+
+
+ChannelComputer::ChannelComputer ( IPhy * p_phy, ISystem * p_system ):
+mpTonemask(NULL),
+mpListOfStations(NULL),
+mBeaconPeriod(0)
+{
+ logFunction();
+
+ if ((NULL == p_phy) || (NULL == p_system))
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY and/or System pointers are NULL", errno);
+ }
+
+ // Register channel to PHY
+ if (!p_phy->setChannel(this))
+ {
+ throw Error(__PRETTY_FUNCTION__, "cannot set channel to PHY");
+ }
+
+ // Get list of stations
+ if (NULL == (mpListOfStations = p_system->getListOfStations()))
+ {
+ throw Error(__PRETTY_FUNCTION__, "error when getting list of stations");
+ }
+
+ initAttributes();
+}
+
+
+void ChannelComputer::initAttributes ( )
+{
+ logFunction();
+
+ // Instanciate one ChannelSettings object per channel,
+ // i.e. (number of stations * (number of stations - 1)) objects
+ for (StationsList::iterator i = mpListOfStations->begin(); i != mpListOfStations->end(); ++i)
+ {
+ for (StationsList::iterator j = mpListOfStations->begin(); j != mpListOfStations->end(); ++j)
+ {
+ if ( (NULL == (*i)) || (NULL == (*j)) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "a station pointer is NULL");
+ }
+ else
+ {
+ Channel_Settings_Key key;
+ key.tx_station_id = (*i)->getStationId();
+ key.rx_station_id = (*j)->getStationId();
+ if (key.tx_station_id != key.rx_station_id)
+ {
+ mListOfChannelSettings[key] = new ChannelSettings();
+ }
+ }
+ }
+ }
+}
+
+
+ChannelComputer::~ChannelComputer ( )
+{
+ logFunction();
+
+ mpTonemask = NULL;
+ mpListOfStations = NULL;
+
+ for (ChannelSettingsList::const_iterator it = mListOfChannelSettings.begin(); it != mListOfChannelSettings.end(); ++it)
+ {
+ if (NULL != it->second)
+ {
+ delete(it->second);
+ }
+ }
+ mListOfChannelSettings.clear();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool ChannelComputer::duplicateMpduPayload ( PhySciMsgMpdu & mpdu )
+{
+ logFunction();
+
+ /* 1. Each PB must be resized to 520 octets (or 136 octets).
+ * Add 8 octets for each PB: 4 octets for PB header and 4 octets for ICV (CRC-32). */
+ unsigned long payloadLength = mpdu.getNbOfPbs() * (mpdu.getPbSize() + sizeof(uint32_t) * 2);
+
+ /* 2. Data corresponding to bits added by the FEC processing are included in the MPDU payload. */
+ if (PHY_FEC_RATE_1_2 == mpdu.getFecrate())
+ {
+ payloadLength *= 2;
+ }
+ else if (PHY_FEC_RATE_16_21 == mpdu.getFecrate())
+ {
+ payloadLength = (unsigned long)(payloadLength * 21/16);
+ }
+
+ /* 3. In case of ROBO mode, duplicate the new MPDU payload by number of copies. */
+ if (PHY_MOD_ROBO_NB > mpdu.getMod())
+ {
+ payloadLength *= mNumberOfCopiesArray[mpdu.getMod()];
+ }
+
+ unsigned char payload[payloadLength];
+ unsigned int l=0;
+ for (l=0; l<payloadLength/mpdu.getPayloadLength(); l++)
+ {
+ memcpy(&payload[l * mpdu.getPayloadLength()], mpdu.getPayload(), mpdu.getPayloadLength());
+ }
+ memcpy(&payload[l * mpdu.getPayloadLength()], mpdu.getPayload(), payloadLength % mpdu.getPayloadLength());
+
+ return mpdu.setMpdu(payloadLength, payload);
+}
+
+
+bool ChannelComputer::addPerturbation ( uint32_t * pb_measurement_array,
+ PhySciMsgNoise & noise,
+ const uint32_t * pb_header_array,
+ const PhySciMsgMpdu & mpdu,
+ const Sci_Msg_Station_Id tx_station_id,
+ const Sci_Msg_Station_Id rx_station_id,
+ const Network_Clock_Tick current_tick )
+{
+ logFunction();
+ bool bAddPerturbation = false;
+
+ uint16_t noiseData[PHY_CARRIER_NB /* frequency_noise */ + MAC_MAX_SYMB_PER_MPDU /* time_noise */];
+
+ updateListOfChannelSettings();
+ Channel_Settings_Key key = { tx_station_id, rx_station_id };
+
+ // If channel from TX station to RX station has not been configured,
+ // send default noise values
+ //
+ if ( (0 == mListOfChannelSettings.count(key))
+ || ( (1 == mListOfChannelSettings.count(key))
+ && (NULL != mListOfChannelSettings.find(key)->second)
+ && !mListOfChannelSettings.find(key)->second->isConfigured() ) )
+ {
+ // Set PB measurement of PHY SCI messages MPDU
+ clog << logger(LOG_DEBUG) << "PB measurement = " << endl;
+ for (unsigned int i=0; i<MAC_MAX_PB_PER_MPDU; i++)
+ {
+ *(pb_measurement_array + i) = ((i%2) << 21) /* crc_error */ | (4 << 16) /* halfit */ | (1 << (i%16)) /* ber */;
+ clog << logger(LOG_DEBUG) << "\tPB " << i << " -> 0x" << setfill('0') << setw(8) << uppercase << hex << ntohl(*(pb_measurement_array + i)) << endl;
+ }
+
+ // Set PHY SCI message NOISE data
+ for (unsigned int i=0; i<PHY_CARRIER_NB; i++)
+ {
+ noiseData[i] = (uint16_t)i; // frequency noise
+ }
+ for (unsigned int i=0; i<MAC_MAX_SYMB_PER_MPDU; i++)
+ {
+ noiseData[PHY_CARRIER_NB+i] = (uint16_t)(PHY_CARRIER_NB+i); // time noise
+ }
+
+ // Set PHY SCI message NOISE data length and data
+ bAddPerturbation = noise.setSpecializedSciMsgDataLength(PHY_CARRIER_NB*sizeof(uint16_t) + MAC_MAX_SYMB_PER_MPDU*sizeof(uint16_t));
+ bAddPerturbation &= noise.setSpecializedSciMsgData((unsigned char *)noiseData);
+ }
+
+ // If channel from TX station to RX station has been configured,
+ // compute noise values
+ //
+ else
+ {
+ ChannelSettings * pSettings = mListOfChannelSettings.find(key)->second;
+ if (NULL == pSettings)
+ {
+ throw Error(__PRETTY_FUNCTION__, "channel settings pointer is NULL");
+ }
+
+ // Initialize frequency noise, time noise, and PHY SCI message NOISE data
+ unsigned long frequencyNoise[PHY_CARRIER_NB];
+ unsigned long timeNoise[MAC_MAX_SYMB_PER_MPDU];
+ for (int i=0; i<PHY_CARRIER_NB; i++)
+ {
+ frequencyNoise[i]= 0;
+ noiseData[i] = 0;
+ }
+ for (int i=0; i<MAC_MAX_SYMB_PER_MPDU; i++)
+ {
+ timeNoise[i] = 0;
+ noiseData[PHY_CARRIER_NB + i] = 0;
+ }
+
+ // Initiliaze BER and CRC error
+ unsigned short int ber[MAC_MAX_PB_PER_MPDU];
+ bool crcError[MAC_MAX_PB_PER_MPDU];
+ for (int i=0; i<MAC_MAX_SYMB_PER_MPDU; i++)
+ {
+ ber[i] = 0;
+ crcError[i] = false;
+ }
+
+ Network_Clock_Tick currentSymbolStartDate = pSettings->getFirstSymbolStartDate();
+ Channel_Mod currentModulation = MAXIMUS_CHANNEL_MOD_NONE;
+ unsigned short int currentSymbol = 0; /* index of current symbol */
+ unsigned short int currentPb = 0; /* index of current PB */
+ unsigned int currentCarrierNbOfBits = 0; /* number of bits coded on current carrier */
+ unsigned int currentPbNbOfCarriers = 0; /* number of carriers on current PB */
+
+ // Set modulation in case of ROBO mode
+ if (PHY_MOD_ROBO_NB > mpdu.getMod())
+ {
+ // Table 3-18 and Chapter 3.5.6:
+ // For ROBO-AV modulation,
+ // the majority of non-masked carriers are mapped with coherent QPSK modulation
+ currentModulation = MAXIMUS_CHANNEL_MOD_QPSK;
+ }
+
+ // For all bits
+ for (unsigned int mpduIndex = 0; mpduIndex<8*mpdu.getPayloadLength() ;) /* total number of bits read */
+ {
+ // For each carrier
+ for (unsigned short int currentCarrier=0; currentCarrier<PHY_CARRIER_NB; currentCarrier++)
+ {
+ // Initiliaze number of bits coded on current carrier
+ currentCarrierNbOfBits = mpduIndex;
+
+ // Update number of carriers on current PB
+ currentPbNbOfCarriers++;
+
+ // Find modulation in case of tonemap
+ if (PHY_MOD_TM == mpdu.getMod())
+ {
+ currentModulation = pSettings->getModulation(currentCarrier);
+ }
+
+ // Check if carrier is non-masked
+ if (getTonemask(currentCarrier))
+ {
+ // Calculate sigma factor
+ double sigma = getSigma(currentModulation,
+ // find time interval and SNR value in dB
+ pSettings->getSnr(getBeaconPeriod(), currentSymbolStartDate, currentCarrier));
+
+ // Create a Channel Mapping for P0 / C0
+ ChannelMapping mapping0;
+ bAddPerturbation = mapping0.setCode(currentModulation,
+ mpdu.getPayloadLength(),
+ mpdu.getPayload(),
+ mpduIndex); // MPDU index is updated
+ ChannelPoint P0 = mapping0.computePoint(currentModulation); // get original point coordinates
+ unsigned short int C0 = mapping0.getCode(); // get code
+
+ // Create a Channel Mapping for P1
+ ChannelPoint P1 = addNoise(P0, sigma); // get intermediate noise point coordinates
+ ChannelMapping mapping1(P1);
+
+ // Create a Channel Mapping for P2 / C2
+ ChannelPoint P2 = mapping1.retrievePoint(currentModulation); // get noise point coordinates
+ ChannelMapping mapping2(P2);
+ unsigned short int C2 = mapping2.computeCode(currentModulation); // get noise code
+
+ // Calculate BER
+ ber[currentPb] += computeBer(C0, C2);
+
+ // Update number of bits coded on current carrier
+ currentCarrierNbOfBits = mpduIndex - currentCarrierNbOfBits;
+
+ // Update index of current PB if needed
+ if (mpduIndex % mpdu.getPbSize() <= currentCarrierNbOfBits)
+ {
+ // Calculate FER
+ float fer = computeFer(ber[currentPb],
+ // average number of bits coded per carrier on current PB
+ 8 * mpdu.getPbSize() / currentPbNbOfCarriers,
+ currentModulation);
+
+ // Calculate CRC error
+ crcError[currentPb] = computeCrcError(fer);
+
+ // Update index of current PB
+ currentPb++;
+
+ // Reset number of carriers on current PB
+ currentPbNbOfCarriers = 0;
+ }
+
+ // Calculate noise
+ unsigned int noise;
+ if (PHY_MPDU_FORMAT_SOUND == mpdu.getMpduFormat())
+ {
+ noise = computeNoise(P0, P1);
+ }
+ else
+ {
+ noise = computeNoise(P1, P2);
+ }
+
+ // Update frequency noise (PHY_CARRIER_NB) and time noise (MAC_MAX_SYMB_PER_MPDU)
+ frequencyNoise[currentCarrier] += noise;
+ timeNoise[currentSymbol] += noise;
+ }
+ }
+ // After each symbol, calculate average time noise
+ noiseData[PHY_CARRIER_NB + currentSymbol] = timeNoise[currentSymbol] / PHY_CARRIER_NB;
+
+ // Update index of current symbol
+ currentSymbol++;
+
+ // Update start date of current symbol
+ if ( (2 >= currentSymbol) || (PHY_GIL_567 == mpdu.getGil()) )
+ {
+ currentSymbolStartDate += MAC_DX567_TCK;
+ }
+ else if (PHY_GIL_417 == mpdu.getGil())
+ {
+ currentSymbolStartDate += MAC_DX417_TCK;
+ }
+ else if (PHY_GIL_3534 == mpdu.getGil())
+ {
+ currentSymbolStartDate += MAC_DX3534_TCK;
+ }
+ }
+ // Check number of symbols
+ if (mpdu.getNbOfSymbols() != currentSymbol)
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "number of symbols is incorrect", errno);
+ }
+
+ // For each carrier, calculate average frequency noise
+ for (unsigned short int currentCarrier=0; currentCarrier<PHY_CARRIER_NB; currentCarrier++)
+ {
+ noiseData[currentCarrier] = frequencyNoise[currentCarrier] / currentSymbol;
+ }
+
+ // Set PB measurement of PHY SCI messages MPDU
+ clog << logger(LOG_DEBUG) << "PB measurement = " << endl;
+ for (unsigned int i=0; i<MAC_MAX_PB_PER_MPDU; i++)
+ {
+ *(pb_measurement_array + i) = (crcError[i] << 21) /* crc_error */ | (4 << 16) /* halfit */ | (1 << ber[i]) /* ber */;
+ clog << logger(LOG_DEBUG) << "\tPB " << i << " -> 0x" << setfill('0') << setw(8) << uppercase << hex << ntohl(*(pb_measurement_array + i)) << endl;
+ }
+
+ // Set PHY SCI message NOISE data length and data
+ bAddPerturbation = noise.setSpecializedSciMsgDataLength(PHY_CARRIER_NB*sizeof(uint16_t) + MAC_MAX_SYMB_PER_MPDU*sizeof(uint16_t));
+ bAddPerturbation &= noise.setSpecializedSciMsgData((unsigned char *)noiseData);
+
+ pSettings = NULL;
+ }
+
+ return bAddPerturbation;
+}
+
+
+bool ChannelComputer::addChannelSettings ( const Sci_Msg_Station_Id created_station_id )
+{
+ logFunction();
+ bool bAddSettings = false;
+
+ if (0 == created_station_id)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "station ID equals 0", errno);
+ }
+ else
+ {
+ for (StationsList::iterator it = mpListOfStations->begin(); it != mpListOfStations->end(); ++it)
+ {
+ if (NULL == (*it))
+ {
+ throw Error(__PRETTY_FUNCTION__, "a station pointer is NULL");
+ }
+ else
+ {
+ Channel_Settings_Key key;
+ key.tx_station_id = created_station_id;
+ key.rx_station_id = (*it)->getStationId();
+ if (key.tx_station_id != key.rx_station_id)
+ {
+ mListOfChannelSettings[key] = new ChannelSettings();
+ bAddSettings = true;
+ }
+ key.tx_station_id = (*it)->getStationId();
+ key.rx_station_id = created_station_id;
+ if (key.tx_station_id != key.rx_station_id)
+ {
+ mListOfChannelSettings[key] = new ChannelSettings();
+ bAddSettings = true;
+ }
+ }
+ }
+ }
+
+ return bAddSettings;
+}
+
+
+std::vector<ChannelSettings *> & ChannelComputer::findChannelSettings ( const Sci_Msg_Station_Id tx_station_id,
+ const Sci_Msg_Station_Id rx_station_id,
+ const bool both_directions )
+{
+ logFunction();
+ static std::vector<ChannelSettings *> listOfChannelSettings;
+
+ listOfChannelSettings.clear();
+ Channel_Settings_Key key;
+ key.tx_station_id = tx_station_id;
+ key.rx_station_id = rx_station_id;
+
+ if ((0 != tx_station_id) && (0 != rx_station_id))
+ {
+ listOfChannelSettings.push_back(mListOfChannelSettings[key]);
+ clog << logger(LOG_DEBUG) << "\tfind channel " << key.tx_station_id << " -> " << key.rx_station_id << endl;
+ if (both_directions)
+ {
+ key.tx_station_id = rx_station_id;
+ key.rx_station_id = tx_station_id;
+ listOfChannelSettings.push_back(mListOfChannelSettings[key]);
+ clog << logger(LOG_DEBUG) << "\tfind channel " << key.tx_station_id << " -> " << key.rx_station_id << endl;
+ }
+ }
+ else if ((0 == tx_station_id) && (0 == rx_station_id))
+ {
+ for (ChannelSettingsList::iterator it = mListOfChannelSettings.begin(); it != mListOfChannelSettings.end(); ++it)
+ {
+ if (NULL == it->second)
+ {
+ throw Error(__PRETTY_FUNCTION__, "a channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.push_back(it->second);
+ clog << logger(LOG_DEBUG) << "\tfind channel " << it->first.tx_station_id << " -> " << it->first.rx_station_id << endl;
+ }
+ }
+ }
+ else // (0 == tx_station_id) xor (0 == rx_station_id)
+ {
+ for (StationsList::iterator it = mpListOfStations->begin(); it != mpListOfStations->end(); ++it)
+ {
+ if (NULL == (*it))
+ {
+ throw Error(__PRETTY_FUNCTION__, "a station pointer is NULL");
+ }
+ else
+ {
+ if (0 == tx_station_id)
+ {
+ key.tx_station_id = (*it)->getStationId();
+ }
+ else // 0 == rx_station_id
+ {
+ key.rx_station_id = (*it)->getStationId();
+ }
+ if (0 != mListOfChannelSettings.count(key))
+ {
+ listOfChannelSettings.push_back(mListOfChannelSettings[key]);
+ clog << logger(LOG_DEBUG) << "\tfind channel " << key.tx_station_id << " -> " << key.rx_station_id << endl;
+ }
+ if (both_directions)
+ {
+ Channel_Settings_Key reverseKey;
+ reverseKey.tx_station_id = key.rx_station_id;
+ reverseKey.rx_station_id = key.tx_station_id;
+ if (0 != mListOfChannelSettings.count(reverseKey))
+ {
+ listOfChannelSettings.push_back(mListOfChannelSettings[reverseKey]);
+ clog << logger(LOG_DEBUG) << "\tfind channel " << reverseKey.tx_station_id << " -> " << reverseKey.rx_station_id << endl;
+ }
+ }
+ }
+ }
+ }
+
+ return listOfChannelSettings;
+}
+
+
+bool ChannelComputer::receivePre ( const Sci_Msg_Station_Id tx_station_id, const Network_Clock_Tick current_tick )
+{
+ logFunction();
+ bool bPre = false;
+
+ for (ChannelSettingsList::iterator it = mListOfChannelSettings.begin(); it != mListOfChannelSettings.end(); ++it)
+ {
+ if (NULL == it->second)
+ {
+ throw Error(__PRETTY_FUNCTION__, "a channel settings pointer is NULL");
+ }
+ else if (tx_station_id == it->first.tx_station_id)
+ {
+ bPre = it->second->setPreDetectionDate(current_tick);
+ }
+ }
+
+ return bPre;
+}
+
+
+bool ChannelComputer::receiveFc ( const Sci_Msg_Station_Id tx_station_id, const Network_Clock_Tick current_tick )
+{
+ logFunction();
+ bool bFc = false;
+
+ for (ChannelSettingsList::iterator it = mListOfChannelSettings.begin(); it != mListOfChannelSettings.end(); ++it)
+ {
+ if (NULL == it->second)
+ {
+ throw Error(__PRETTY_FUNCTION__, "a channel settings pointer is NULL");
+ }
+ else if (tx_station_id == it->first.tx_station_id)
+ {
+ bFc = it->second->setFcReceptionDate(current_tick);
+ }
+ }
+
+ return bFc;
+}
+
+
+// private methods
+//
+
+
+const bool ChannelComputer::getTonemask ( const unsigned short int carrier_index ) const
+{
+ if (NULL == mpTonemask)
+ {
+ throw Error(__PRETTY_FUNCTION__, "tonemask pointer is NULL");
+ }
+ if (PHY_CARRIER_NB <= carrier_index)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "carrier index exceeds max size of tonemask", errno);
+ }
+
+ uint8_t tonemaskValue = *(mpTonemask + carrier_index/8);
+
+ return (tonemaskValue >> (carrier_index % 8)) & 0x01;
+}
+
+
+void ChannelComputer::updateListOfChannelSettings ( )
+{
+ logFunction();
+
+ bool toRemove;
+ for (ChannelSettingsList::iterator it = mListOfChannelSettings.begin(); it != mListOfChannelSettings.end();)
+ {
+ ChannelSettingsList::iterator settings = it;
+ ++it;
+ if (NULL == settings->second)
+ {
+ throw Error(__PRETTY_FUNCTION__, "a channel settings pointer is NULL");
+ }
+ else
+ {
+ toRemove = true;
+ for (StationsList::iterator station = mpListOfStations->begin(); station != mpListOfStations->end(); ++station)
+ {
+ if (NULL == (*station))
+ {
+ throw Error(__PRETTY_FUNCTION__, "a station pointer is NULL");
+ }
+ else if ((settings->first.tx_station_id == (*station)->getStationId())
+ || (settings->first.rx_station_id == (*station)->getStationId()))
+ {
+ toRemove = false;
+ break;
+ }
+ }
+ if (toRemove)
+ {
+ delete(settings->second);
+ mListOfChannelSettings.erase(settings);
+ }
+ }
+ }
+}
+
+
+const unsigned int ChannelComputer::getBeaconPeriod ( ) const
+{
+ if (0 == mBeaconPeriod)
+ {
+ throw Error(__PRETTY_FUNCTION__, "beacon period equals 0");
+ }
+
+ return mBeaconPeriod;
+}
+
+
+// protected methods
+//
+
+
+const double ChannelComputer::getSigma ( const Channel_Mod modulation, const float snr_in_db ) const
+{
+ if (0 == getLinearSnr(snr_in_db))
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "linear SNR equals 0", errno);
+ }
+
+ return sqrt(getPowerScale(modulation) / (2 * getLinearSnr(snr_in_db)));
+}
+
+
+const float ChannelComputer::getPowerScale ( const Channel_Mod modulation ) const
+{
+ return mPowerScaleArray[modulation];
+}
+
+
+const double ChannelComputer::getLinearSnr ( const float snr_in_db ) const
+{
+ return pow(10, snr_in_db/10);
+}
+
+
+const ChannelPoint ChannelComputer::addNoise ( const ChannelPoint & point, const double sigma )
+{
+ //logFunction();
+
+ mEngine.seed(static_cast<unsigned int>(time(0)));
+ boost::normal_distribution<double> norm(0,1);
+ boost::variate_generator<boost::mt19937, boost::normal_distribution<double> > normal(mEngine, norm);
+
+ return ChannelPoint(point.I + sigma * normal(), point.Q + sigma * normal());
+}
+
+
+const unsigned short int ChannelComputer::computeBer ( const unsigned short int codeA,
+ const unsigned short int codeB ) const
+{
+ //logFunction();
+ unsigned short int ber = 0;
+
+ if ( (codeA > MAXIMUS_CHANNEL_CODE_MAX_VALUE) || (codeB > MAXIMUS_CHANNEL_CODE_MAX_VALUE) )
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "code value exceeds max value", errno);
+ }
+
+ // Comparison for each bit
+ for (unsigned int i=0; i<8*sizeof(unsigned short int); i++)
+ {
+ if ( ((codeA >> i) & 0x0001) != ((codeB >> i) & 0x0001) )
+ {
+ ber++;
+ }
+ }
+
+ return ber;
+}
+
+
+const unsigned int ChannelComputer::computeNoise ( const ChannelPoint & pointA,
+ const ChannelPoint & pointB ) const
+{
+ //logFunction();
+
+ return (unsigned int)(pow(pointB.I - pointA.I , 2) + pow(pointB.Q - pointA.Q , 2));
+}
+
+
+const float ChannelComputer::computeFer ( const unsigned short int ber,
+ const unsigned int n,
+ const Channel_Mod modulation ) const
+{
+ //logFunction();
+
+ float t, x;
+ const unsigned short int A = 50;
+ const unsigned short int K = 100;
+
+ // Caluclate t(n)
+ if (n < 2)
+ {
+ t = 0.3;
+ }
+ else if ( (n > 2) && (n <= 8) )
+ {
+ t = 0.65 * n - 1;
+ }
+ else // n > 8
+ {
+ t = 0.2 * n + 2.6;
+ }
+
+ // Calculate x
+ if (MAXIMUS_CHANNEL_MOD_BPSK == modulation)
+ {
+ x = ber;
+ }
+ else
+ {
+ x = ber - 0.01 * t;
+ }
+
+ // Calculate g(x)
+ return pow(10, -K * exp(-pow(A * x, 2)));
+}
+
+
+const bool ChannelComputer::computeCrcError ( const float fer )
+{
+ //logFunction();
+ bool crcError = false;
+
+ mEngine.seed(static_cast<unsigned int>(time(0)));
+ boost::uniform_01<boost::mt19937, float> uni(mEngine);
+
+ if (uni() < fer)
+ {
+ crcError = true;
+ }
+
+ return crcError;
+}
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+bool ChannelComputer::setTonemask ( const uint8_t * p_tonemask )
+{
+ if (NULL == p_tonemask)
+ {
+ throw Error(__PRETTY_FUNCTION__, "tonemask pointer is NULL");
+ }
+
+ mpTonemask = const_cast<uint8_t *>(p_tonemask);
+
+ return true;
+}
+
+
+bool ChannelComputer::setTonemap ( const Sci_Msg_Station_Id tx_station_id,
+ const unsigned long length,
+ const unsigned char * p_tonemap )
+{
+ bool bSetTonemap = true;
+
+ if (((PHY_CARRIER_NB+1)/2 != length) || (NULL == p_tonemap))
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "tonemap length is incorrect and/or tonemap pointer is NULL", errno);
+ }
+ if (0 == tx_station_id)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "transmitting station ID equals 0", errno);
+ }
+
+ // Fill the tonemap array
+ Channel_Mod tonemapArray[PHY_CARRIER_NB + 1];
+ for (int i=0; i<(PHY_CARRIER_NB+1)/2; i++)
+ {
+ tonemapArray[i*2] = (Channel_Mod)(*(p_tonemap + i) & 0x0F);
+ tonemapArray[i*2+1] = (Channel_Mod)(*(p_tonemap + i) & 0xF0);
+ }
+
+ std::vector<ChannelSettings *> listOfChannelSettings = findChannelSettings(tx_station_id, 0 /* rx_station_id */, false /* both_directions */);
+ for (std::vector<ChannelSettings *>::size_type i=0; i<listOfChannelSettings.size(); i++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "a channel settings pointer is NULL");
+ }
+ else
+ {
+ bSetTonemap &= listOfChannelSettings.back()->setTonemap(tonemapArray);
+ }
+ listOfChannelSettings.pop_back();
+ }
+
+ return bSetTonemap;
+}
+
+
+bool ChannelComputer::setBeaconPeriod ( const float frequency )
+{
+ if (0 == frequency)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "frequency equals 0", errno);
+ }
+
+ mBeaconPeriod = (unsigned int)((1/frequency) * 2 * 25000000); // in ticks 25 MHz
+
+ return true;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/channel/src/ChannelComputerTest.cpp b/cesar/maximus/channel/src/ChannelComputerTest.cpp
new file mode 100644
index 0000000000..8615a272b1
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelComputerTest.cpp
@@ -0,0 +1,298 @@
+
+#include "ChannelComputerTest.h"
+
+#include "ChannelComputer.h"
+#include "ChannelPoint.h"
+#include "CoreEngine.h"
+#include "PhySciMsgMpdu.h"
+#include "PhySciMsgNoise.h"
+#include "INetworkClock.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+#include <math.h> // for 'pow()' and 'sqrt()'
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (ChannelComputerTest);
+
+class ProtectedTest : public ChannelComputer
+{
+public:
+ ProtectedTest(IPhy * p_phy, ISystem * p_system) : ChannelComputer(p_phy, p_system) {}
+ ~ProtectedTest() {}
+ const double getSigmaTest ( const Channel_Mod modulation, const float snr_in_db ) const
+ {
+ return getSigma(modulation, snr_in_db);
+ }
+ const float getPowerScaleTest ( const Channel_Mod modulation ) const
+ {
+ return getPowerScale(modulation);
+ }
+ const double getLinearSnrTest ( const float snr_in_db ) const
+ {
+ return getLinearSnr(snr_in_db);
+ }
+ const ChannelPoint addNoiseTest ( const ChannelPoint & point, const double sigma )
+ {
+ return addNoise(point, sigma);
+ }
+ const unsigned short int computeBerTest ( const unsigned short int codeA, const unsigned short int codeB ) const
+ {
+ return computeBer(codeA, codeB);
+ }
+ const unsigned int computeNoiseTest ( const ChannelPoint & pointA, const ChannelPoint & pointB ) const
+ {
+ return computeNoise(pointA, pointB);
+ }
+ const float computeFerTest ( const unsigned short int ber, const unsigned int n, const Channel_Mod modulation ) const
+ {
+ return computeFer(ber, n, modulation);
+ }
+ const bool computeCrcErrorTest ( const float fer )
+ {
+ return computeCrcError(fer);
+ }
+};
+
+
+void ChannelComputerTest::setUp (void)
+{
+ logTest();
+
+ mpCoreEngine = new CoreEngine();
+ CPPUNIT_ASSERT_MESSAGE ( "Core Engine pointer is NULL", NULL != mpCoreEngine );
+ mpChannelComputer = new ChannelComputer(mpCoreEngine->getPhy(), mpCoreEngine->getSystem());
+ CPPUNIT_ASSERT_MESSAGE ( "Channel computer pointer is NULL", NULL != mpChannelComputer );
+}
+
+
+void ChannelComputerTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpChannelComputer)
+ {
+ delete (mpChannelComputer);
+ mpChannelComputer = NULL;
+ }
+ if (NULL != mpCoreEngine)
+ {
+ delete (mpCoreEngine);
+ mpCoreEngine = NULL;
+ }
+}
+
+
+void ChannelComputerTest::duplicateMpduPayloadTest (void)
+{
+ logTest();
+
+ PhySciMsgMpdu mpdu(mpCoreEngine->getPhy());
+ unsigned long length = 512;
+ unsigned char payload[length];
+ mpdu.setMpdu(length, payload);
+ mpdu.setPbSize(512);
+ mpdu.setNbOfPbs(2);
+ mpdu.setFecrate(PHY_FEC_RATE_1_2);
+ mpdu.setMod(PHY_MOD_ROBO);
+ CPPUNIT_ASSERT_MESSAGE ( "duplicateMpduPayload failed",
+ mpChannelComputer->duplicateMpduPayload(mpdu)
+ && (1040*2*4 == mpdu.getPayloadLength()) );
+}
+
+
+void ChannelComputerTest::addPerturbationTest (void)
+{
+ logTest();
+
+ PhySciMsgMpdu mpdu(mpCoreEngine->getPhy());
+ PhySciMsgNoise noise(mpCoreEngine->getPhy());
+ uint32_t pbMeasurement[MAC_MAX_PB_PER_MPDU];
+ uint32_t pbMeasurementResult[MAC_MAX_PB_PER_MPDU];
+ memset(pbMeasurement, '\0', MAC_MAX_PB_PER_MPDU);
+ memset(pbMeasurementResult, '\0', MAC_MAX_PB_PER_MPDU);
+ uint32_t pbHdr[MAC_MAX_PB_PER_MPDU];
+ memset(pbHdr, 0x12, MAC_MAX_PB_PER_MPDU);
+ CPPUNIT_ASSERT_MESSAGE ( "addPerturbation failed",
+ (mpChannelComputer->addPerturbation(pbMeasurementResult,
+ noise,
+ pbHdr,
+ mpdu,
+ 0,
+ 0,
+ mpCoreEngine->getNetworkClock()->getCurrentTickValue()))
+ && (NULL != pbMeasurementResult)
+ && (0 != memcmp(pbMeasurement, pbMeasurementResult, MAC_MAX_PB_PER_MPDU))
+ && (NULL != noise.getSpecializedSciMsgData())
+ && ((PHY_CARRIER_NB*sizeof(uint16_t) + MAC_MAX_SYMB_PER_MPDU*sizeof(uint16_t)) == noise.getSpecializedSciMsgDataLength()) );
+}
+
+
+void ChannelComputerTest::protectedTest (void)
+{
+ logTest();
+
+ if (NULL != mpChannelComputer)
+ {
+ delete (mpChannelComputer);
+ mpChannelComputer = NULL;
+ }
+
+ ProtectedTest channelComputer(mpCoreEngine->getPhy(), mpCoreEngine->getSystem());
+
+ // Test PowerScale
+ Channel_Mod modulation = MAXIMUS_CHANNEL_MOD_BPSK;
+ float powerScale = channelComputer.getPowerScaleTest(modulation);
+ CPPUNIT_ASSERT_MESSAGE ( "getPowerScale failed", 1 == powerScale);
+ modulation = MAXIMUS_CHANNEL_MOD_QPSK;
+ powerScale = channelComputer.getPowerScaleTest(modulation);
+ CPPUNIT_ASSERT_MESSAGE ( "getPowerScale failed", 2 == powerScale);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM8;
+ powerScale = channelComputer.getPowerScaleTest(modulation);
+ CPPUNIT_ASSERT_MESSAGE ( "getPowerScale failed", (float)(5+pow(1.29,2)) == powerScale);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM16;
+ powerScale = channelComputer.getPowerScaleTest(modulation);
+ CPPUNIT_ASSERT_MESSAGE ( "getPowerScale failed", 10 == powerScale);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM64;
+ powerScale = channelComputer.getPowerScaleTest(modulation);
+ CPPUNIT_ASSERT_MESSAGE ( "getPowerScale failed", 42 == powerScale);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM256;
+ powerScale = channelComputer.getPowerScaleTest(modulation);
+ CPPUNIT_ASSERT_MESSAGE ( "getPowerScale failed", 170 == powerScale);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM1024;
+ powerScale = channelComputer.getPowerScaleTest(modulation);
+ CPPUNIT_ASSERT_MESSAGE ( "getPowerScale failed", 682 == powerScale);
+
+ // Test linear SNR
+ float snr = 10; // in dB
+ double linearSnr = channelComputer.getLinearSnrTest(snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getLinearSnr failed", 10 == linearSnr);
+ snr = 16; // in dB
+ linearSnr = channelComputer.getLinearSnrTest(snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getLinearSnr failed", (float)pow(10, 1.6) == linearSnr);
+ snr = 15.55555; // in dB
+ linearSnr = channelComputer.getLinearSnrTest(snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getLinearSnr failed", (float)pow(10, 1.555555) == linearSnr);
+
+ // Test sigma factor
+ modulation = MAXIMUS_CHANNEL_MOD_BPSK;
+ snr = 10; // in dB
+ double sigma = channelComputer.getSigmaTest(modulation, snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getSigma failed", (double)sqrt(1/(2*channelComputer.getLinearSnrTest(snr))) == sigma);
+ modulation = MAXIMUS_CHANNEL_MOD_QPSK;
+ snr = 11.1; // in dB
+ sigma = channelComputer.getSigmaTest(modulation, snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getSigma failed", (double)sqrt(2/(2*channelComputer.getLinearSnrTest(snr))) == sigma);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM8;
+ snr = 12.2; // in dB
+ sigma = channelComputer.getSigmaTest(modulation, snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getSigma failed", (double)sqrt((float)(5+pow(1.29, 2))/(2*channelComputer.getLinearSnrTest(snr))) == sigma);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM16;
+ snr = 13.3; // in dB
+ sigma = channelComputer.getSigmaTest(modulation, snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getSigma failed", (double)sqrt(10/(2*channelComputer.getLinearSnrTest(snr))) == sigma);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM64;
+ snr = 14.4; // in dB
+ sigma = channelComputer.getSigmaTest(modulation, snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getSigma failed", (double)sqrt(42/(2*channelComputer.getLinearSnrTest(snr))) == sigma);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM256;
+ snr = 15.5; // in dB
+ sigma = channelComputer.getSigmaTest(modulation, snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getSigma failed", (double)sqrt(170/(2*channelComputer.getLinearSnrTest(snr))) == sigma);
+ modulation = MAXIMUS_CHANNEL_MOD_QAM1024;
+ snr = 16.6; // in dB
+ sigma = channelComputer.getSigmaTest(modulation, snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getSigma failed", (double)sqrt(682/(2*channelComputer.getLinearSnrTest(snr))) == sigma);
+ snr = 0; // in dB
+ sigma = channelComputer.getSigmaTest(modulation, snr);
+ CPPUNIT_ASSERT_MESSAGE ( "getSigma failed", (double)sqrt(682/(2*channelComputer.getLinearSnrTest(snr))) == sigma);
+
+ // Test noise point
+ ChannelPoint point(1, 0);
+ ChannelPoint noisePoint = channelComputer.addNoiseTest(point, sigma);
+ CPPUNIT_ASSERT_MESSAGE ( "addNoise failed",
+ (point.I != noisePoint.I)
+ && (point.Q != noisePoint.Q));
+
+ // Test BER
+ unsigned short int codeA = 0x3;
+ unsigned short int codeB = 0x2;
+ unsigned short int ber = channelComputer.computeBerTest(codeA, codeB);
+ CPPUNIT_ASSERT_MESSAGE ( "computeBer failed", 1 == ber);
+ codeA = 0x3FF;
+ codeB = 0x0;
+ ber = channelComputer.computeBerTest(codeA, codeB);
+ CPPUNIT_ASSERT_MESSAGE ( "computeBer failed", 10 == ber);
+ codeA = 0xFF;
+ codeB = 0xF;
+ ber = channelComputer.computeBerTest(codeA, codeB);
+ CPPUNIT_ASSERT_MESSAGE ( "computeBer failed", 4 == ber);
+ codeA = 0x44;
+ codeB = 0x44;
+ ber = channelComputer.computeBerTest(codeA, codeB);
+ CPPUNIT_ASSERT_MESSAGE ( "computeBer failed", 0 == ber);
+ bool b = false;
+ try
+ {
+ codeA = 0xFFF;
+ ber = channelComputer.computeBerTest(codeA, codeB);
+ }
+ catch (Error & e)
+ {
+ b = true;
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "computeBer failed", b);
+
+ // Test noise
+ ChannelPoint pointA(0, 0);
+ ChannelPoint pointB(0, 0);
+ unsigned int noise = channelComputer.computeNoiseTest(pointA, pointB);
+ CPPUNIT_ASSERT_MESSAGE ( "computeNoise failed", 0 == noise);
+ pointB.I = 1;
+ pointB.Q = 1;
+ noise = channelComputer.computeNoiseTest(pointA, pointB);
+ CPPUNIT_ASSERT_MESSAGE ( "computeNoise failed", 2 == noise);
+ pointA.I = -3;
+ pointA.Q = -1;
+ noise = channelComputer.computeNoiseTest(pointA, pointB);
+ CPPUNIT_ASSERT_MESSAGE ( "computeNoise failed", 20 == noise);
+ pointB.I = -0.12345;
+ pointB.Q = 6.789;
+ noise = channelComputer.computeNoiseTest(pointA, pointB);
+ CPPUNIT_ASSERT_MESSAGE ( "computeNoise failed", (unsigned int)pow(7.789, 2) + (unsigned int)pow(2.87655, 2) == noise);
+
+ // Test FER
+ unsigned int n = 10;
+ modulation = MAXIMUS_CHANNEL_MOD_BPSK;
+ float fer = channelComputer.computeFerTest(ber, n, modulation);
+ float expectedFer = pow(10, 1-(unsigned short int)100*exp(-pow((unsigned short int)50*ber, 2)))/10;
+ CPPUNIT_ASSERT_MESSAGE ( "computeFer 1 failed", expectedFer == fer);
+ modulation = MAXIMUS_CHANNEL_MOD_QPSK;
+ fer = channelComputer.computeFerTest(ber, n, modulation);
+ expectedFer = pow(10, 1-(unsigned short int)100*exp(-pow((unsigned short int)50*(ber-0.01*(float)4.6), 2)))/10;
+ float result = (fer > expectedFer) ? fer - expectedFer : expectedFer - fer;
+ CPPUNIT_ASSERT_MESSAGE ( "computeFer 2 failed", result < 0.001);
+ n = 5;
+ fer = channelComputer.computeFerTest(ber, n, modulation);
+ expectedFer = pow(10, 1-(unsigned short int)100*exp(-pow((unsigned short int)50*(ber-0.01*(float)2.25), 2)))/10;
+ CPPUNIT_ASSERT_MESSAGE ( "computeFer 3 failed", result < 0.001);
+ n = 0;
+ fer = channelComputer.computeFerTest(ber, n, modulation);
+ expectedFer = pow(10, 1-(unsigned short int)100*exp(-pow((unsigned short int)50*(ber-0.01*(float)0.3), 2)))/10;
+ CPPUNIT_ASSERT_MESSAGE ( "computeFer 4 failed", result < 0.001);
+
+ // Test CRC
+ int count = 0;
+ fer = 0;
+ for (int i=0; i<11; i++)
+ {
+ if (channelComputer.computeCrcErrorTest(fer))
+ {
+ count++;
+ }
+ fer += 0.1;
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "computeCrcError failed", (count > 0) && (count < 11));
+}
+
diff --git a/cesar/maximus/channel/src/ChannelMapping.cpp b/cesar/maximus/channel/src/ChannelMapping.cpp
new file mode 100644
index 0000000000..2013b07fc2
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelMapping.cpp
@@ -0,0 +1,494 @@
+/************************************************************************
+ ChannelMapping.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/src/ChannelMapping.cpp
+**************************************************************************/
+
+#include "ChannelMapping.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <math.h> // for 'pow()'
+
+#define NONE 0xFFFF
+
+/* Following tables are extracted from the HomePlug AV Specification Version 1.0.10 (March 20, 2007)
+ * Chapter 3.5.5 */
+
+// Table 3-18: Modulation Characteristics
+unsigned short int ChannelMapping::mNbOfBitsArray[MAXIMUS_CHANNEL_MOD_NB] = { 0, /* NONE */
+ 1, /* BPSK */
+ 2, /* QPSK */
+ 3, /* QAM8 */
+ 4, /* QAM16 */
+ 6, /* QAM64 */
+ 8, /* QAM256 */
+ 10 }; /* QAM1024 */
+
+// Table 3-22: Symbol Mapping (Except 8-QAM)
+// and Table 3-23: Symbol Mapping for 8-QAM
+short int ChannelMapping::mMappingArray[MAXIMUS_CHANNEL_VALUE_MAX_NB][MAXIMUS_CHANNEL_MOD_NB] =
+/* I/Q *//* code */
+ /*BPSK*//*QPSK*//*8*/ /*16*//*64*//*256*//*1024*/
+{ { 31, NONE, NONE, NONE, NONE, NONE, NONE, 0x18 },
+ { 29, NONE, NONE, NONE, NONE, NONE, NONE, 0x19 },
+ { 27, NONE, NONE, NONE, NONE, NONE, NONE, 0x1B },
+ { 25, NONE, NONE, NONE, NONE, NONE, NONE, 0x1A },
+ { 23, NONE, NONE, NONE, NONE, NONE, NONE, 0x1E },
+ { 21, NONE, NONE, NONE, NONE, NONE, NONE, 0x1F },
+ { 19, NONE, NONE, NONE, NONE, NONE, NONE, 0x1D },
+ { 17, NONE, NONE, NONE, NONE, NONE, NONE, 0x1C },
+ { 15, NONE, NONE, NONE, NONE, NONE, 0xC, 0x14 },
+ { 13, NONE, NONE, NONE, NONE, NONE, 0xD, 0x15 },
+ { 11, NONE, NONE, NONE, NONE, NONE, 0xF, 0x17 },
+ { 9, NONE, NONE, NONE, NONE, NONE, 0xE, 0x16 },
+ { 7, NONE, NONE, NONE, NONE, 0x6, 0xA, 0x12 },
+ { 5, NONE, NONE, NONE, NONE, 0x7, 0xB, 0x13 },
+ { 3, NONE, NONE, 0x3, 0x3, 0x5, 0x9, 0x11 },
+ { 1, 0x1, 0x1, 0x2, 0x2, 0x4, 0x8, 0x10 },
+ { -1, 0X0, 0X0, 0x0, 0x0, 0x0, 0x0, 0X00 },
+ { -3, NONE, NONE, 0x1, 0x1, 0x1, 0x1, 0x01 },
+ { -5, NONE, NONE, NONE, NONE, 0x3, 0x3, 0x03 },
+ { -7, NONE, NONE, NONE, NONE, 0x2, 0x2, 0x02 },
+ { -9, NONE, NONE, NONE, NONE, NONE, 0x6, 0x06 },
+ { -11, NONE, NONE, NONE, NONE, NONE, 0x7, 0x07 },
+ { -13, NONE, NONE, NONE, NONE, NONE, 0x5, 0x05 },
+ { -15, NONE, NONE, NONE, NONE, NONE, 0x4, 0x04 },
+ { -17, NONE, NONE, NONE, NONE, NONE, NONE, 0x0C },
+ { -19, NONE, NONE, NONE, NONE, NONE, NONE, 0x0D },
+ { -21, NONE, NONE, NONE, NONE, NONE, NONE, 0x0F },
+ { -23, NONE, NONE, NONE, NONE, NONE, NONE, 0x0E },
+ { -25, NONE, NONE, NONE, NONE, NONE, NONE, 0x0A },
+ { -27, NONE, NONE, NONE, NONE, NONE, NONE, 0x0B },
+ { -29, NONE, NONE, NONE, NONE, NONE, NONE, 0x09 },
+ { -31, NONE, NONE, NONE, NONE, NONE, NONE, 0x08 } };
+
+
+// Constructors/Destructors
+//
+
+
+ChannelMapping::ChannelMapping ( ):
+mCode(0)
+{
+ //logFunction();
+}
+
+
+ChannelMapping::ChannelMapping ( const unsigned short int code ):
+mCode(0)
+{
+ //logFunction();
+
+ setCode(code);
+}
+
+
+ChannelMapping::ChannelMapping ( const ChannelPoint & point ):
+mCode(0)
+{
+ //logFunction();
+
+ setPoint(point);
+}
+
+
+ChannelMapping::~ChannelMapping ( )
+{
+ //logFunction();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+const unsigned short int ChannelMapping::computeCode ( const Channel_Mod modulation )
+{
+ //logFunction();
+ unsigned short int codeI = 0, codeQ = 0;
+
+ if (MAXIMUS_CHANNEL_MOD_NB <= modulation)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Modulation is out-of-range", errno);
+ }
+ else if (getPoint().checkValidity())
+ {
+ /* Retrieve the code from the I and Q coordinates and the used modulation. */
+ for (int i=0; i<MAXIMUS_CHANNEL_VALUE_MAX_NB; i++)
+ {
+ // Retrieve the code corresponding to I value
+ if (getI() == mMappingArray[i][MAXIMUS_CHANNEL_I_Q_VALUE])
+ {
+ codeI = mMappingArray[i][modulation];
+ }
+ // Retrieve the code corresponding to Q value
+ if (getQ() == mMappingArray[i][MAXIMUS_CHANNEL_I_Q_VALUE])
+ {
+ codeQ = mMappingArray[i][modulation];
+ }
+ }
+
+ /* Compute the code depending on the used modulation. */
+ /* (Table 3-21: Bit Mapping, Chapter 3.5) */
+
+ if (MAXIMUS_CHANNEL_MOD_BPSK == modulation)
+ {
+ // For BPSK, the code equals to the code corresponding to I value
+ setCode(codeI);
+ }
+ else if (MAXIMUS_CHANNEL_MOD_QAM8 == modulation)
+ {
+ // For QAM8, the code equals to the code corresponding to I value
+ // + 0b100 if Q = 1.29
+ if (MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE == getQ())
+ {
+ setCode(0x4 | codeI);
+ }
+ else if (-MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE == getQ())
+ {
+ setCode(codeI);
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Q value is out-of-range", errno);
+ }
+ }
+ else
+ {
+ // For other modulations, the code is composed of:
+ // - the code corresponding to I value (LSB)
+ // - and the code corresponding to Q value (MSB)
+ unsigned short int halfNbOfBits = mNbOfBitsArray[modulation] >> 1; // mNbOfBitsArray[modulation] / 2
+ setCode((codeQ << halfNbOfBits) | codeI);
+ }
+ }
+
+ return getCode();
+}
+
+
+const ChannelPoint & ChannelMapping::computePoint ( const Channel_Mod modulation )
+{
+ //logFunction();
+
+ /* Retrieve the I and Q coordinates from the code and the used modulation. */
+ if (MAXIMUS_CHANNEL_MOD_BPSK == modulation)
+ {
+ // For BPSK, the Q value is not used
+ for (int i=0; i<MAXIMUS_CHANNEL_VALUE_MAX_NB; i++)
+ {
+ if (getCode() == mMappingArray[i][modulation])
+ {
+ setI(mMappingArray[i][MAXIMUS_CHANNEL_I_Q_VALUE]);
+ setQ(0);
+ break;
+ }
+ }
+ }
+ else if (MAXIMUS_CHANNEL_MOD_QAM8 == modulation)
+ {
+ // For QAM8, the I value equals to the 2 LSB of the code,
+ // and the Q value sign depends on the 3rd bit value
+ // (Q is positive 0 if the 3rd bit is set to 0b1, else Q is negative)
+ for (int i=0; i<MAXIMUS_CHANNEL_VALUE_MAX_NB; i++)
+ {
+ if ((getCode() & 0x3) == mMappingArray[i][modulation])
+ {
+ setI(mMappingArray[i][MAXIMUS_CHANNEL_I_Q_VALUE]);
+ setQ((getCode() > 0x3) ? MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE : -MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE);
+ break;
+ }
+ }
+ }
+ else
+ {
+ // For other modulations:
+ // - the I value equals to the LSB of the code
+ // - the Q value equals to the MSB of the code
+ unsigned short int halfNbOfBits = mNbOfBitsArray[modulation] >> 1; // mNbOfBitsArray[modulation] / 2
+ unsigned short int mask = (1 << halfNbOfBits) - 1; // halfNbOfBits * '1'
+ for (int i=0; i<MAXIMUS_CHANNEL_VALUE_MAX_NB; i++)
+ {
+ if ((getCode() & mask) == mMappingArray[i][modulation])
+ {
+ setI(mMappingArray[i][MAXIMUS_CHANNEL_I_Q_VALUE]);
+ }
+ if (((getCode() >> halfNbOfBits) & mask) == mMappingArray[i][modulation])
+ {
+ setQ(mMappingArray[i][MAXIMUS_CHANNEL_I_Q_VALUE]);
+ }
+ }
+ }
+
+ getPoint().checkValidity();
+ return getPoint();
+}
+
+
+const ChannelPoint ChannelMapping::retrievePoint ( const Channel_Mod modulation )
+{
+ //logFunction();
+
+ float x = getI();
+ float y = getQ();
+ short int max = 0;
+
+ /* Depending on the modulation, find the maximum value of the I and Q coordinates. */
+
+ int i;
+ for (i=0; i<MAXIMUS_CHANNEL_VALUE_MAX_NB; i++)
+ {
+ if (NONE != (unsigned short int)mMappingArray[i][modulation])
+ {
+ max = mMappingArray[i][MAXIMUS_CHANNEL_I_Q_VALUE];
+ break;
+ }
+ }
+
+ /* If abscissa or ordinate exceeds this maximum value,
+ * set it to the maximum value. */
+
+ if (x > max)
+ {
+ x = max;
+ }
+ else if (x < -max)
+ {
+ x = -max;
+ }
+ if (y > max)
+ {
+ y = max;
+ }
+ else if (y < -max)
+ {
+ y = -max;
+ }
+
+ /* Retrieve the I and Q coordinates from abscissa and ordinate. */
+
+ for (int j=i; j<MAXIMUS_CHANNEL_VALUE_MAX_NB-i; j++)
+ {
+ if ( (x <= mMappingArray[j][MAXIMUS_CHANNEL_I_Q_VALUE] + 1)
+ && (x >= mMappingArray[j][MAXIMUS_CHANNEL_I_Q_VALUE] - 1) )
+ {
+ x = mMappingArray[j][MAXIMUS_CHANNEL_I_Q_VALUE];
+ break;
+ }
+ }
+
+ for (int j=i; j<MAXIMUS_CHANNEL_VALUE_MAX_NB-i; j++)
+ {
+ if ( (y <= mMappingArray[j][MAXIMUS_CHANNEL_I_Q_VALUE] + 1)
+ && (y >= mMappingArray[j][MAXIMUS_CHANNEL_I_Q_VALUE] - 1) )
+ {
+ y = mMappingArray[j][MAXIMUS_CHANNEL_I_Q_VALUE];
+ break;
+ }
+ }
+
+ // For BPSK, the Q value is not used
+ if (MAXIMUS_CHANNEL_MOD_BPSK == modulation)
+ {
+ y = 0;
+ }
+
+ // For QAM8, the Q value equals to 1.29 or -1.29
+ else if (MAXIMUS_CHANNEL_MOD_QAM8 == modulation)
+ {
+ (y >= 0) ? y = MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE : y = -MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE;
+ }
+
+ ChannelPoint(x, y).checkValidity();
+ return ChannelPoint(x, y);
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+bool ChannelMapping::setCode ( const Channel_Mod modulation,
+ const unsigned long mpdu_payload_length,
+ const unsigned char * p_mpdu_payload,
+ unsigned int & mpdu_index )
+{
+ //logFunction();
+ bool bSetCode = false;
+
+ if (NULL == p_mpdu_payload)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "MPDU payload pointer is NULL", errno);
+ }
+ else
+ {
+ unsigned short int nbOfBits = mNbOfBitsArray[modulation];
+ unsigned short int offset = 24 - (8 * (nbOfBits / 8)) + (mpdu_index /* index in bits */ % 8);
+ unsigned int mask = ((1 << nbOfBits) - 1) /* nbOfBits * '1' */ << offset;
+ unsigned int mpduPayload = 0;
+
+ // Zero padding if needed
+ if (mpdu_index + nbOfBits > 8 * mpdu_payload_length)
+ {
+ if (8 * mpdu_payload_length - 2 == mpdu_index)
+ {
+ mpduPayload = ((*(p_mpdu_payload + mpdu_index/8)) << 24)
+ | ((*(p_mpdu_payload + mpdu_index/8 + 1)) << 16);
+ }
+ else // mpdu_index = 8 * mpdu_payload_length - 1
+ {
+ mpduPayload = ((*(p_mpdu_payload + mpdu_index/8)) << 24);
+ }
+ }
+
+ else
+ {
+ mpduPayload = ((*(p_mpdu_payload + mpdu_index/8)) << 24)
+ | ((*(p_mpdu_payload + mpdu_index/8 + 1)) << 16)
+ | ((*(p_mpdu_payload + mpdu_index/8 + 2)) << 8)
+ | (*(p_mpdu_payload + mpdu_index/8 + 3));
+ }
+
+ mCode = (mpduPayload & mask) >> offset;
+
+ mpdu_index += nbOfBits;
+ bSetCode = true;
+ }
+
+ return bSetCode;
+}
+
+
+bool ChannelMapping::setCode ( const unsigned short int code )
+{
+ //logFunction();
+ bool bSetCode = false;
+
+ if (MAXIMUS_CHANNEL_CODE_MAX_VALUE < code)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "code value is out-of-range", errno);
+ }
+ else
+ {
+ mCode = code;
+ bSetCode = true;
+ }
+
+ return bSetCode;
+}
+
+
+unsigned short int ChannelMapping::getCode ( ) const
+{
+ if (MAXIMUS_CHANNEL_CODE_MAX_VALUE < mCode)
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "code value is out-of-range", errno);
+ }
+
+ return mCode;
+}
+
+
+bool ChannelMapping::setPoint ( const ChannelPoint & point )
+{
+ //logFunction();
+
+ mPoint = point;
+
+ return true;
+}
+
+
+ChannelPoint & ChannelMapping::getPoint ( )
+{
+ return mPoint;
+}
+
+
+bool ChannelMapping::setI ( const float i )
+{
+ getPoint().I = i;
+
+ return true;
+}
+
+
+const float ChannelMapping::getI ( )
+{
+ return getPoint().I;
+}
+
+
+bool ChannelMapping::setQ ( const float q )
+{
+ getPoint().Q = q;
+
+ return true;
+}
+
+
+const float ChannelMapping::getQ ( )
+{
+ return getPoint().Q;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/channel/src/ChannelMappingTest.cpp b/cesar/maximus/channel/src/ChannelMappingTest.cpp
new file mode 100644
index 0000000000..08e442ab0a
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelMappingTest.cpp
@@ -0,0 +1,430 @@
+
+#include "ChannelMappingTest.h"
+
+#include "ChannelMapping.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (ChannelMappingTest);
+
+
+void ChannelMappingTest::setUp (void)
+{
+ logTest();
+
+ mpChannelMapping = new ChannelMapping();
+ CPPUNIT_ASSERT_MESSAGE ( "Channel Mapping pointer is NULL", NULL != mpChannelMapping );
+}
+
+
+void ChannelMappingTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpChannelMapping)
+ {
+ delete (mpChannelMapping);
+ mpChannelMapping = NULL;
+ }
+}
+
+
+void ChannelMappingTest::setCodeTest (void)
+{
+ logTest();
+
+ unsigned short int c = 0xF;
+ CPPUNIT_ASSERT_MESSAGE ( "setCode failed",
+ (mpChannelMapping->setCode(c))
+ && (c == mpChannelMapping->getCode()) );
+
+ Channel_Mod mod = MAXIMUS_CHANNEL_MOD_QAM16; // 4 bits
+ unsigned char payload[512];
+ memset(payload, 0x1E, 512);
+ unsigned int index = 500 * 8;
+ c = 0xE;
+ CPPUNIT_ASSERT_MESSAGE ( "setCode failed",
+ (mpChannelMapping->setCode(mod, 512, payload, index))
+ && (c == mpChannelMapping->getCode())
+ && (500 * 8 + 4 == index) );
+ c = 0x1;
+ CPPUNIT_ASSERT_MESSAGE ( "setCode failed",
+ (mpChannelMapping->setCode(mod, 512, payload, index))
+ && (c == mpChannelMapping->getCode())
+ && (501 * 8 == index) );
+
+ mod = MAXIMUS_CHANNEL_MOD_QAM1024; // 10 bits
+ index += 4;
+ c = 0x1E1;
+ CPPUNIT_ASSERT_MESSAGE ( "setCode failed",
+ (mpChannelMapping->setCode(mod, 512, payload, index))
+ && (c == mpChannelMapping->getCode())
+ && (502 * 8 + 6 == index) );
+
+ mod = MAXIMUS_CHANNEL_MOD_QAM256; // 8 bits
+ c = 0x78;
+ CPPUNIT_ASSERT_MESSAGE ( "setCode failed",
+ (mpChannelMapping->setCode(mod, 512, payload, index))
+ && (c == mpChannelMapping->getCode())
+ && (503 * 8 + 6 == index) );
+
+ // Test zero padding
+ mod = MAXIMUS_CHANNEL_MOD_QAM64; // 6 bits
+ index = 511 * 8 + 6;
+ c = 0x0;
+ CPPUNIT_ASSERT_MESSAGE ( "setCode failed",
+ (mpChannelMapping->setCode(mod, 512, payload, index))
+ && (c == mpChannelMapping->getCode())
+ && (512 * 8 + 4 == index) );
+ index = 511 * 8 + 4;
+ c = 0x1;
+ CPPUNIT_ASSERT_MESSAGE ( "setCode failed",
+ (mpChannelMapping->setCode(mod, 512, payload, index))
+ //&& (c == mpChannelMapping->getCode())
+ && (512 * 8 + 2 == index) );
+}
+
+
+void ChannelMappingTest::computeCodeTest (void)
+{
+ logTest();
+
+ // Basic test
+ ChannelPoint p(1, 3);
+ mpChannelMapping->setPoint(p);
+ Channel_Mod mod = MAXIMUS_CHANNEL_MOD_QAM16;
+ unsigned short int c = 0xE;
+ CPPUNIT_ASSERT_MESSAGE ( "code failed",
+ c == mpChannelMapping->computeCode(mod) );
+
+ /* Test all possible coordinates for all modulations. */
+ short int coordinate[32] = { -1, 1, // BPSK and QPSK
+ -3, 3, // QAM8 and QAM16
+ -7, 7, -5, 5, // QAM64
+ -15, 15, -13, 13, -9, 9, -11, 11, // QAM256
+ -31, 31, -29, 29, -25, 25, -27, 27, -17, 17, -19, 19, -23, 23, -21, 21 }; // QAM1024
+ ChannelPoint point[1024];
+ int n, N;
+
+ // Test for BPSK
+ mod = MAXIMUS_CHANNEL_MOD_BPSK;
+ N = 2;
+ for (n=0; n<N; n++)
+ {
+ mpChannelMapping->setCode(n);
+ mpChannelMapping->computePoint(mod);
+ CPPUNIT_ASSERT_MESSAGE ( "computeCode BPSK failed",
+ n == mpChannelMapping->computeCode(mod) );
+ }
+ for (n=0; n<N; n++)
+ {
+ point[n].I = coordinate[n%N];
+ point[n].Q = 0;
+ mpChannelMapping->setCode(n);
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint BPSK failed",
+ point[n] == mpChannelMapping->computePoint(mod) );
+ CPPUNIT_ASSERT_MESSAGE ( "computeCode BPSK failed",
+ n == mpChannelMapping->computeCode(mod) );
+ }
+
+ // Test for QPSK
+ mod = MAXIMUS_CHANNEL_MOD_QPSK;
+ N = 4;
+ for (n=0; n<N; n++)
+ {
+ point[n].I = coordinate[n%(N/2)];
+ point[n].Q = coordinate[n/(N/2)];
+ mpChannelMapping->setCode(n);
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint QPSK failed",
+ point[n] == mpChannelMapping->computePoint(mod) );
+ CPPUNIT_ASSERT_MESSAGE ( "computeCode QPSK failed",
+ n == mpChannelMapping->computeCode(mod) );
+ }
+
+ // Test for QAM8
+ mod = MAXIMUS_CHANNEL_MOD_QAM8;
+ N = 8;
+ point[0].I = -1;
+ point[1].I = -3;
+ point[2].I = 1;
+ point[3].I = 3;
+ point[4].I = -1;
+ point[5].I = -3;
+ point[6].I = 1;
+ point[7].I = 3;
+ for (n=0; n<N; n++)
+ {
+ point[n].Q = (n > 3) ? 1.29f : -1.29f;
+ mpChannelMapping->setCode(n);
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint QAM8 failed",
+ point[n] == mpChannelMapping->computePoint(mod) );
+ CPPUNIT_ASSERT_MESSAGE ( "computeCode QAM8 failed",
+ n == mpChannelMapping->computeCode(mod) );
+ }
+
+ // Test for QAM16
+ mod = MAXIMUS_CHANNEL_MOD_QAM16;
+ N = 16;
+ for (n=0; n<N; n++)
+ {
+ mpChannelMapping->setCode(n);
+ mpChannelMapping->computePoint(mod);
+ CPPUNIT_ASSERT_MESSAGE ( "computeCode QAM16 failed",
+ n == mpChannelMapping->computeCode(mod) );
+ }
+
+ // Test for QAM64
+ mod = MAXIMUS_CHANNEL_MOD_QAM64;
+ N = 64;
+ for (n=0; n<N; n++)
+ {
+ mpChannelMapping->setCode(n);
+ mpChannelMapping->computePoint(mod);
+ CPPUNIT_ASSERT_MESSAGE ( "computeCode QPSK failed",
+ n == mpChannelMapping->computeCode(mod) );
+ }
+
+ // Test for QAM256
+ mod = MAXIMUS_CHANNEL_MOD_QAM256;
+ N = 256;
+ for (n=0; n<N; n++)
+ {
+ mpChannelMapping->setCode(n);
+ mpChannelMapping->computePoint(mod);
+ CPPUNIT_ASSERT_MESSAGE ( "computeCode QAM256 failed",
+ n == mpChannelMapping->computeCode(mod) );
+ }
+
+ // Test for QAM1024
+ mod = MAXIMUS_CHANNEL_MOD_QAM1024;
+ N = 1024;
+ for (n=0; n<N; n++)
+ {
+ mpChannelMapping->setCode(n);
+ mpChannelMapping->computePoint(mod);
+ CPPUNIT_ASSERT_MESSAGE ( "computeCode QAM1024 failed",
+ n == mpChannelMapping->computeCode(mod) );
+ }
+}
+
+
+void ChannelMappingTest::computePointTest (void)
+{
+ logTest();
+
+ // Basic test
+ mpChannelMapping->setCode(0xE);
+ Channel_Mod mod = MAXIMUS_CHANNEL_MOD_QAM16;
+ unsigned short int i = 1, q = 3;
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint failed",
+ (i == mpChannelMapping->computePoint(mod).I)
+ && (q == mpChannelMapping->computePoint(mod).Q) );
+
+ /* Test all possible code values for all modulations. */
+ ChannelMapping code[1024];
+ int n;
+ for (n=0; n<1024; n++)
+ {
+ code[n].setCode(n);
+ }
+
+ // Test for BPSK
+ mod = MAXIMUS_CHANNEL_MOD_BPSK;
+ for (n=0; n<2; n++)
+ {
+ code[n].computePoint(mod);
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint BPSK failed",
+ (-1 == code[0].getI()) && (0 == code[0].getQ())
+ && (1 == code[1].getI()) && (0 == code[1].getQ()) );
+
+ // Test for QPSK
+ mod = MAXIMUS_CHANNEL_MOD_QPSK;
+ for (n=0; n<4; n++)
+ {
+ code[n].computePoint(mod);
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint QPSK failed",
+ (-1 == code[0].getI()) && (-1 == code[0].getQ())
+ && (1 == code[1].getI()) && (-1 == code[1].getQ())
+ && (-1 == code[2].getI()) && (1 == code[2].getQ())
+ && (1 == code[3].getI()) && (1 == code[3].getQ()) );
+
+ // Test for QAM8
+ mod = MAXIMUS_CHANNEL_MOD_QAM8;
+ for (n=0; n<8; n++)
+ {
+ code[n].computePoint(mod);
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint QAM8 failed",
+ (-1 == code[0].getI()) && (-1.29f == code[0].getQ())
+ && (-3 == code[1].getI()) && (-1.29f == code[1].getQ())
+ && (1 == code[2].getI()) && (-1.29f == code[2].getQ())
+ && (3 == code[3].getI()) && (-1.29f == code[3].getQ())
+ && (-1 == code[4].getI()) && (1.29f == code[4].getQ())
+ && (-3 == code[5].getI()) && (1.29f == code[5].getQ())
+ && (1 == code[6].getI()) && (1.29f == code[6].getQ())
+ && (3 == code[7].getI()) && (1.29f == code[7].getQ()) );
+
+ // Test for QAM16
+ mod = MAXIMUS_CHANNEL_MOD_QAM16;
+ for (n=0; n<16; n++)
+ {
+ code[n].computePoint(mod);
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint QAM16 failed",
+ (-1 == code[0].getI()) && (-1 == code[0].getQ())
+ && (-3 == code[1].getI()) && (-1 == code[1].getQ())
+ && (1 == code[2].getI()) && (-1 == code[2].getQ())
+ && (3 == code[3].getI()) && (-1 == code[3].getQ())
+ && (-1 == code[4].getI()) && (-3 == code[4].getQ())
+ && (-3 == code[5].getI()) && (-3 == code[5].getQ())
+ && (1 == code[6].getI()) && (-3 == code[6].getQ())
+ && (3 == code[7].getI()) && (-3 == code[7].getQ())
+ && (-1 == code[8].getI()) && (1 == code[8].getQ())
+ && (-3 == code[9].getI()) && (1 == code[9].getQ())
+ && (1 == code[10].getI()) && (1 == code[10].getQ())
+ && (3 == code[11].getI()) && (1 == code[11].getQ())
+ && (-1 == code[12].getI()) && (3 == code[12].getQ())
+ && (-3 == code[13].getI()) && (3 == code[13].getQ())
+ && (1 == code[14].getI()) && (3 == code[14].getQ())
+ && (3 == code[15].getI()) && (3 == code[15].getQ()) );
+
+ // Test for QAM64
+ mod = MAXIMUS_CHANNEL_MOD_QAM64;
+ for (n=0; n<64; n++)
+ {
+ code[n].computePoint(mod);
+ }
+ short int coordinate64[8] = { -1, -3, -7, -5, 1, 3, 7, 5 };
+ for (n=0; n<64; n+=8)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint QAM64 failed",
+ (coordinate64[0] == code[n].getI()) && (coordinate64[n/8] == code[n].getQ())
+ && (coordinate64[1] == code[n+1].getI()) && (coordinate64[n/8] == code[n+1].getQ())
+ && (coordinate64[2] == code[n+2].getI()) && (coordinate64[n/8] == code[n+2].getQ())
+ && (coordinate64[3] == code[n+3].getI()) && (coordinate64[n/8] == code[n+3].getQ())
+ && (coordinate64[4] == code[n+4].getI()) && (coordinate64[n/8] == code[n+4].getQ())
+ && (coordinate64[5] == code[n+5].getI()) && (coordinate64[n/8] == code[n+5].getQ())
+ && (coordinate64[6] == code[n+6].getI()) && (coordinate64[n/8] == code[n+6].getQ())
+ && (coordinate64[7] == code[n+7].getI()) && (coordinate64[n/8] == code[n+7].getQ()) );
+ }
+
+ // Test for QAM256
+ mod = MAXIMUS_CHANNEL_MOD_QAM256;
+ for (n=0; n<256; n++)
+ {
+ code[n].computePoint(mod);
+ }
+ short int coordinate256[16] = { -1, -3, -7, -5, -15, -13, -9, -11, 1, 3, 7, 5, 15, 13, 9, 11 };
+ for (n=0; n<256; n+=16)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint QAM256 failed",
+ (coordinate256[0] == code[n].getI()) && (coordinate256[n/16] == code[n].getQ())
+ && (coordinate256[1] == code[n+1].getI()) && (coordinate256[n/16] == code[n+1].getQ())
+ && (coordinate256[2] == code[n+2].getI()) && (coordinate256[n/16] == code[n+2].getQ())
+ && (coordinate256[3] == code[n+3].getI()) && (coordinate256[n/16] == code[n+3].getQ())
+ && (coordinate256[4] == code[n+4].getI()) && (coordinate256[n/16] == code[n+4].getQ())
+ && (coordinate256[5] == code[n+5].getI()) && (coordinate256[n/16] == code[n+5].getQ())
+ && (coordinate256[6] == code[n+6].getI()) && (coordinate256[n/16] == code[n+6].getQ())
+ && (coordinate256[7] == code[n+7].getI()) && (coordinate256[n/16] == code[n+7].getQ())
+ && (coordinate256[8] == code[n+8].getI()) && (coordinate256[n/16] == code[n+8].getQ())
+ && (coordinate256[9] == code[n+9].getI()) && (coordinate256[n/16] == code[n+9].getQ())
+ && (coordinate256[10] == code[n+10].getI()) && (coordinate256[n/16] == code[n+10].getQ())
+ && (coordinate256[11] == code[n+11].getI()) && (coordinate256[n/16] == code[n+11].getQ())
+ && (coordinate256[12] == code[n+12].getI()) && (coordinate256[n/16] == code[n+12].getQ())
+ && (coordinate256[13] == code[n+13].getI()) && (coordinate256[n/16] == code[n+13].getQ())
+ && (coordinate256[14] == code[n+14].getI()) && (coordinate256[n/16] == code[n+14].getQ())
+ && (coordinate256[15] == code[n+15].getI()) && (coordinate256[n/16] == code[n+15].getQ()) );
+ }
+
+ // Test for QAM1024
+ mod = MAXIMUS_CHANNEL_MOD_QAM1024;
+ for (n=0; n<1024; n++)
+ {
+ code[n].computePoint(mod);
+ }
+ short int coordinate1024[32] = { -1, -3, -7, -5, -15, -13, -9, -11, -31, -29, -25, -27, -17, -19, -23, -21, \
+ 1, 3, 7, 5, 15, 13, 9, 11, 31, 29, 25, 27, 17, 19, 23, 21 };
+ for (n=0; n<1024; n+=32)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "computePoint QAM1024 failed",
+ (coordinate1024[0] == code[n].getI()) && (coordinate1024[n/32] == code[n].getQ())
+ && (coordinate1024[1] == code[n+1].getI()) && (coordinate1024[n/32] == code[n+1].getQ())
+ && (coordinate1024[2] == code[n+2].getI()) && (coordinate1024[n/32] == code[n+2].getQ())
+ && (coordinate1024[3] == code[n+3].getI()) && (coordinate1024[n/32] == code[n+3].getQ())
+ && (coordinate1024[4] == code[n+4].getI()) && (coordinate1024[n/32] == code[n+4].getQ())
+ && (coordinate1024[5] == code[n+5].getI()) && (coordinate1024[n/32] == code[n+5].getQ())
+ && (coordinate1024[6] == code[n+6].getI()) && (coordinate1024[n/32] == code[n+6].getQ())
+ && (coordinate1024[7] == code[n+7].getI()) && (coordinate1024[n/32] == code[n+7].getQ())
+ && (coordinate1024[8] == code[n+8].getI()) && (coordinate1024[n/32] == code[n+8].getQ())
+ && (coordinate1024[9] == code[n+9].getI()) && (coordinate1024[n/32] == code[n+9].getQ())
+ && (coordinate1024[10] == code[n+10].getI()) && (coordinate1024[n/32] == code[n+10].getQ())
+ && (coordinate1024[11] == code[n+11].getI()) && (coordinate1024[n/32] == code[n+11].getQ())
+ && (coordinate1024[12] == code[n+12].getI()) && (coordinate1024[n/32] == code[n+12].getQ())
+ && (coordinate1024[13] == code[n+13].getI()) && (coordinate1024[n/32] == code[n+13].getQ())
+ && (coordinate1024[14] == code[n+14].getI()) && (coordinate1024[n/32] == code[n+14].getQ())
+ && (coordinate1024[15] == code[n+15].getI()) && (coordinate1024[n/32] == code[n+15].getQ())
+ && (coordinate1024[16] == code[n+16].getI()) && (coordinate1024[n/32] == code[n+16].getQ())
+ && (coordinate1024[17] == code[n+17].getI()) && (coordinate1024[n/32] == code[n+17].getQ())
+ && (coordinate1024[18] == code[n+18].getI()) && (coordinate1024[n/32] == code[n+18].getQ())
+ && (coordinate1024[19] == code[n+19].getI()) && (coordinate1024[n/32] == code[n+19].getQ())
+ && (coordinate1024[20] == code[n+20].getI()) && (coordinate1024[n/32] == code[n+20].getQ())
+ && (coordinate1024[21] == code[n+21].getI()) && (coordinate1024[n/32] == code[n+21].getQ())
+ && (coordinate1024[22] == code[n+22].getI()) && (coordinate1024[n/32] == code[n+22].getQ())
+ && (coordinate1024[23] == code[n+23].getI()) && (coordinate1024[n/32] == code[n+23].getQ())
+ && (coordinate1024[24] == code[n+24].getI()) && (coordinate1024[n/32] == code[n+24].getQ())
+ && (coordinate1024[25] == code[n+25].getI()) && (coordinate1024[n/32] == code[n+25].getQ())
+ && (coordinate1024[26] == code[n+26].getI()) && (coordinate1024[n/32] == code[n+26].getQ())
+ && (coordinate1024[27] == code[n+27].getI()) && (coordinate1024[n/32] == code[n+27].getQ())
+ && (coordinate1024[28] == code[n+28].getI()) && (coordinate1024[n/32] == code[n+28].getQ())
+ && (coordinate1024[29] == code[n+29].getI()) && (coordinate1024[n/32] == code[n+29].getQ())
+ && (coordinate1024[30] == code[n+30].getI()) && (coordinate1024[n/32] == code[n+30].getQ())
+ && (coordinate1024[31] == code[n+31].getI()) && (coordinate1024[n/32] == code[n+31].getQ()) );
+ }
+}
+
+
+void ChannelMappingTest::retrievePointTest (void)
+{
+ logTest();
+
+ // Test for BPSK
+ Channel_Mod mod = MAXIMUS_CHANNEL_MOD_BPSK;
+ mpChannelMapping->setPoint(ChannelPoint(1.1, 0.1));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(1, 0) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(-2.3456789, 3));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(-1, 0) == mpChannelMapping->retrievePoint(mod) );
+
+ // Test for QPSK
+ mod = MAXIMUS_CHANNEL_MOD_QPSK;
+ mpChannelMapping->setPoint(ChannelPoint(0, 2));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(1, 1) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(2, -3));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(1, -1) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(-3, 0));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(-1, 1) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(-2.3456789, -0.00000000001));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(-1, -1) == mpChannelMapping->retrievePoint(mod) );
+
+ // Test for QAM8
+ mod = MAXIMUS_CHANNEL_MOD_QAM8;
+ mpChannelMapping->setPoint(ChannelPoint(-2, -0.1));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(-1, -1.29f) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(-2.1, -10));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(-3, -1.29f) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(1.9, -0.1));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(1, -1.29) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(2.3456789, -0.00000000001));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(3, -1.29f) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(-0.1, 0));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(-1, 1.29f) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(-4, 0));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(-3, 1.29f) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(0, 0));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(1, 1.29f) == mpChannelMapping->retrievePoint(mod) );
+ mpChannelMapping->setPoint(ChannelPoint(2.3456789, 0.00000000001));
+ CPPUNIT_ASSERT_MESSAGE ( "retrievePoint BPSK failed", ChannelPoint(3, 1.29f) == mpChannelMapping->retrievePoint(mod) );
+}
+
diff --git a/cesar/maximus/channel/src/ChannelPoint.cpp b/cesar/maximus/channel/src/ChannelPoint.cpp
new file mode 100644
index 0000000000..513c4fd0f6
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelPoint.cpp
@@ -0,0 +1,156 @@
+/************************************************************************
+ ChannelPoint.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/src/ChannelPoint.cpp
+**************************************************************************/
+
+#include "ChannelPoint.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include "channel_types.h"
+
+#include <math.h> // for 'fabs()'
+
+
+// Constructors/Destructors
+//
+
+
+ChannelPoint::ChannelPoint ( ):
+I(0),
+Q(0)
+{
+ //logFunction();
+}
+
+
+ChannelPoint::ChannelPoint ( const float i, const float q ):
+I(0),
+Q(0)
+{
+ //logFunction();
+
+ I = i;
+ Q = q;
+}
+
+
+ChannelPoint::~ChannelPoint ( )
+{
+ //logFunction();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+ChannelPoint & ChannelPoint::operator= ( const ChannelPoint & channel_point )
+{
+ //logFunction();
+
+ I = channel_point.I;
+ Q = channel_point.Q;
+
+ return *this;
+}
+
+
+bool ChannelPoint::operator== ( const ChannelPoint & channel_point ) const
+{
+ //logFunction();
+ bool bOperator = false;
+
+ if ( (I == channel_point.I)
+ && (Q == channel_point.Q))
+ {
+ bOperator = true;
+ }
+
+ return bOperator;
+}
+
+
+bool ChannelPoint::checkValidity ( )
+{
+ //logFunction();
+
+ bool bCheck = (MAXIMUS_CHANNEL_I_Q_MIN_VALUE <= I)
+ && (MAXIMUS_CHANNEL_I_Q_MAX_VALUE >= I)
+ && ((-1 == (short int)I % 2) || (1 == (short int)I % 2))
+ && (MAXIMUS_CHANNEL_I_Q_MIN_VALUE <= Q)
+ && (MAXIMUS_CHANNEL_I_Q_MAX_VALUE >= Q)
+ && ((-1 == (short int)Q % 2) || (1 == (short int)Q % 2)
+ || (0 == Q) /* BPSK */
+ || (MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE == fabs(Q))); /* QAM8 */
+
+ if (!bCheck)
+ {
+ I = 0;
+ Q = 0;
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "I or Q coordinates are out-of-range", errno);
+ }
+
+ return bCheck;
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/channel/src/ChannelPointTest.cpp b/cesar/maximus/channel/src/ChannelPointTest.cpp
new file mode 100644
index 0000000000..78fd1b07c7
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelPointTest.cpp
@@ -0,0 +1,41 @@
+
+#include "ChannelPointTest.h"
+
+#include "ChannelPoint.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+CPPUNIT_TEST_SUITE_REGISTRATION (ChannelPointTest);
+
+
+void ChannelPointTest::setUp (void)
+{
+ logTest();
+
+ mpChannelPoint = new ChannelPoint();
+ CPPUNIT_ASSERT_MESSAGE ( "Channel Point pointer is NULL", NULL != mpChannelPoint );
+}
+
+
+void ChannelPointTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpChannelPoint)
+ {
+ delete (mpChannelPoint);
+ mpChannelPoint = NULL;
+ }
+}
+
+
+void ChannelPointTest::checkValidityTest (void)
+{
+ logTest();
+
+ mpChannelPoint->I = 1;
+ mpChannelPoint->Q = -1.29f;
+ CPPUNIT_ASSERT_MESSAGE ( "checkValidity failed", mpChannelPoint->checkValidity() );
+}
+
diff --git a/cesar/maximus/channel/src/ChannelSettings.cpp b/cesar/maximus/channel/src/ChannelSettings.cpp
new file mode 100644
index 0000000000..1eab9c1798
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelSettings.cpp
@@ -0,0 +1,229 @@
+/************************************************************************
+ ChannelSettings.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/src/ChannelSettings.cpp
+**************************************************************************/
+
+#include "ChannelSettings.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include "hal/phy/maximus/inc/maximus_defs.h" // for 'MAXIMUS_PHY_FC_RECEPTION_DELAY_TCK'
+
+
+// Constructors/Destructors
+//
+
+
+ChannelSettings::ChannelSettings ( ):
+mIsConfigured(false),
+mPreDetectionDate(0),
+mFcReceptionDate(0)
+{
+ initAttributes();
+}
+
+
+void ChannelSettings::initAttributes ( )
+{
+ logFunction();
+
+ // Init SNR array
+ memset(mSnrArray, '\0', MAXIMUS_CHANNEL_INTERVAL_MAX_NB * (PHY_CARRIER_NB + 1) * sizeof(float));
+
+ // Init tonemap array
+ memset(mTonemapArray, '\0', PHY_CARRIER_NB * sizeof(Channel_Mod));
+}
+
+
+ChannelSettings::~ChannelSettings ( )
+{
+ logFunction();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+const Network_Clock_Tick ChannelSettings::getFirstSymbolStartDate ( ) const
+{
+ return getFcReceptionDate() - MAXIMUS_PHY_FC_RECEPTION_DELAY_TCK;
+}
+
+
+const Channel_Mod ChannelSettings::getModulation ( const unsigned int carrier ) const
+{
+ return mTonemapArray[carrier];
+}
+
+
+const float ChannelSettings::getSnr ( const Network_Clock_Tick beacon_period,
+ const Network_Clock_Tick symbol_start_date,
+ const unsigned int carrier ) const
+{
+ return mSnrArray[getInterval(beacon_period, symbol_start_date)][carrier + 1];
+}
+
+
+// private methods
+//
+
+
+bool ChannelSettings::setIsConfigured ( const bool is_configured )
+{
+ logFunction();
+
+ mIsConfigured = is_configured;
+
+ return true;
+}
+
+
+const Network_Clock_Tick ChannelSettings::getPreDetectionDate ( ) const
+{
+ return mPreDetectionDate;
+}
+
+
+const Network_Clock_Tick ChannelSettings::getFcReceptionDate ( ) const
+{
+ return mFcReceptionDate;
+}
+
+
+const unsigned int ChannelSettings::getInterval ( const Network_Clock_Tick beacon_period,
+ const Network_Clock_Tick symbol_start_date ) const
+{
+ unsigned int i;
+
+ for (i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ if ( (symbol_start_date % beacon_period) / 25 < mSnrArray[i][0] )
+ {
+ break;
+ }
+ }
+
+ return i;
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+const bool ChannelSettings::isConfigured ( ) const
+{
+ return mIsConfigured;
+}
+
+
+bool ChannelSettings::setSnr ( const float snr_value )
+{
+ logFunction();
+
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ for (int j=0; j<=PHY_CARRIER_NB; j++)
+ {
+ mSnrArray[i][j] = snr_value;
+ }
+ }
+
+ return setIsConfigured();
+}
+
+
+bool ChannelSettings::setSnr ( const float snr_values[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1] )
+{
+ logFunction();
+
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ for (int j=0; j<=PHY_CARRIER_NB; j++)
+ {
+ mSnrArray[i][j] = snr_values[i][j];
+ }
+ }
+
+ return setIsConfigured();
+}
+
+
+bool ChannelSettings::setTonemap ( const Channel_Mod tonemap_array[PHY_CARRIER_NB + 1] )
+{
+ for (int i=0; i<PHY_CARRIER_NB; i++)
+ {
+ mTonemapArray[i] = tonemap_array[i];
+ }
+
+ return true;
+}
+
+
+bool ChannelSettings::setPreDetectionDate ( const Network_Clock_Tick date )
+{
+ mPreDetectionDate = date;
+
+ return true;
+}
+
+
+bool ChannelSettings::setFcReceptionDate ( const Network_Clock_Tick date )
+{
+ mFcReceptionDate = date;
+
+ return true;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/channel/src/ChannelSettingsTest.cpp b/cesar/maximus/channel/src/ChannelSettingsTest.cpp
new file mode 100644
index 0000000000..1546c213f5
--- /dev/null
+++ b/cesar/maximus/channel/src/ChannelSettingsTest.cpp
@@ -0,0 +1,114 @@
+
+#include "ChannelSettingsTest.h"
+
+#include "ChannelSettings.h"
+#include "CoreEngine.h"
+#include "IChannel.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+#include "hal/phy/maximus/inc/maximus_defs.h" // for 'MAXIMUS_PHY_FC_RECEPTION_DELAY_TCK'
+
+CPPUNIT_TEST_SUITE_REGISTRATION (ChannelSettingsTest);
+
+
+void ChannelSettingsTest::setUp (void)
+{
+ logTest();
+
+ mpChannelSettings = new ChannelSettings();
+ CPPUNIT_ASSERT_MESSAGE ( "Channel Settings pointer is NULL", NULL != mpChannelSettings );
+}
+
+
+void ChannelSettingsTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpChannelSettings)
+ {
+ delete (mpChannelSettings);
+ mpChannelSettings = NULL;
+ }
+}
+
+
+void ChannelSettingsTest::getFirstSymbolStartDateTest (void)
+{
+ logTest();
+
+ try
+ {
+ mpChannelSettings->setFcReceptionDate(15*25);
+ CPPUNIT_ASSERT_MESSAGE ( "getFirstSymbolStartDate failed",
+ 10*25 == mpChannelSettings->getFirstSymbolStartDate() );
+ }
+ catch (Error & e)
+ {
+ e.display();
+ }
+}
+
+
+void ChannelSettingsTest::getModulationTest (void)
+{
+ logTest();
+
+ try
+ {
+ Channel_Mod tonemapArray[PHY_CARRIER_NB + 1];
+ for (int i=0; i<=PHY_CARRIER_NB; i++)
+ {
+ tonemapArray[i] = MAXIMUS_CHANNEL_MOD_NONE;
+ }
+ tonemapArray[50] = MAXIMUS_CHANNEL_MOD_QPSK;
+ mpChannelSettings->setTonemap(tonemapArray);
+ CPPUNIT_ASSERT_MESSAGE ( "getModulation failed",
+ MAXIMUS_CHANNEL_MOD_QPSK == mpChannelSettings->getModulation(50) );
+ }
+ catch (Error & e)
+ {
+ e.display();
+ }
+}
+
+
+void ChannelSettingsTest::getSnrTest (void)
+{
+ logTest();
+
+ try
+ {
+ float snrArray[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1];
+ memset(snrArray, '\0', MAXIMUS_CHANNEL_INTERVAL_MAX_NB * (PHY_CARRIER_NB + 1));
+ snrArray[0][0] = 10000; // in ticks 25 MHz
+ snrArray[1][0] = 20000;
+ snrArray[2][0] = 30000;
+ snrArray[3][0] = 40000;
+ snrArray[0][1] = 10; // in dB
+ snrArray[1][1] = 11;
+ snrArray[2][1] = 12;
+ snrArray[3][1] = 13;
+ snrArray[0][1155] = 14;
+ snrArray[1][1155] = 15;
+ snrArray[2][1155] = 16;
+ snrArray[3][1155] = 17;
+ mpChannelSettings->setSnr(snrArray);
+ Network_Clock_Tick beaconPeriod = 1000000; // in ticks 25 MHz
+
+ CPPUNIT_ASSERT_MESSAGE ( "getSnr failed", 10 == mpChannelSettings->getSnr(beaconPeriod, 5150000, 0) );
+ CPPUNIT_ASSERT_MESSAGE ( "getSnr failed", 11 == mpChannelSettings->getSnr(beaconPeriod, 5150000 + 260000, 0) );
+ CPPUNIT_ASSERT_MESSAGE ( "getSnr failed", 12 == mpChannelSettings->getSnr(beaconPeriod, 5150000 + 520000, 0) );
+ CPPUNIT_ASSERT_MESSAGE ( "getSnr failed", 13 == mpChannelSettings->getSnr(beaconPeriod, 5150000 + 780000, 0) );
+ CPPUNIT_ASSERT_MESSAGE ( "getSnr failed", 14 == mpChannelSettings->getSnr(beaconPeriod, 5150000, 1154) );
+ CPPUNIT_ASSERT_MESSAGE ( "getSnr failed", 15 == mpChannelSettings->getSnr(beaconPeriod, 5150000 + 260000, 1154) );
+ CPPUNIT_ASSERT_MESSAGE ( "getSnr failed", 16 == mpChannelSettings->getSnr(beaconPeriod, 5150000 + 520000, 1154) );
+ CPPUNIT_ASSERT_MESSAGE ( "getSnr failed", 17 == mpChannelSettings->getSnr(beaconPeriod, 5150000 + 780000, 1154) );
+ }
+ catch (Error & e)
+ {
+ e.display();
+ }
+}
+
diff --git a/cesar/maximus/common/interfaces/Maximus.h b/cesar/maximus/common/interfaces/Maximus.h
new file mode 100644
index 0000000000..92b146f2df
--- /dev/null
+++ b/cesar/maximus/common/interfaces/Maximus.h
@@ -0,0 +1,351 @@
+/************************************************************************
+ Maximus.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/interfaces/Maximus.h
+**************************************************************************/
+
+#ifndef MAXIMUS_H
+#define MAXIMUS_H
+
+#include "IPhy.h" // for 'PhyMpduCb'
+#include "IEthernet.h" // for 'EtherCb'
+
+#include "networkclock_types.h" // for 'tick_t'
+#include "channel_types.h" // for 'MAXIMUS_CHANNEL_INTERVAL_MAX_NB'
+#include "sci_types.h" // for 'Sci_Msg_Station_Id'
+#include "system_types.h" // for 'File_Descriptor'
+
+#include <fstream> // for 'std::ofstream'
+#include <string> // for 'std::string'
+#include <vector> // for 'std::vector'
+
+#define catchFunction(p_maximus) \
+catch ( Error & e ) \
+{ \
+ e.display(); \
+ p_maximus->stop(); \
+ throw; \
+}
+
+class CoreEngine;
+class ISystem;
+class IFunctionCall;
+class INetworkClock;
+class ISci;
+class IChannel;
+class Sta;
+class Msg;
+class PhySciMsgMpdu;
+
+class Error;
+
+typedef Network_Clock_Tick tick_t;
+
+typedef std::vector<Msg *> MsgsList;
+typedef std::vector<Sta *> StasList;
+
+
+/**
+ * class Maximus
+ */
+
+class Maximus
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ Maximus ( );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~Maximus ( );
+
+ // public methods
+ //
+
+ /**
+ * @param argc
+ * @param argv
+ * Initialize Maximus with main program arguments.
+ */
+ void init ( int argc, char * argv[] );
+
+ /**
+ * @param interface_cb
+ * Initialize PHY with an interface callback function for PHY SCI message MPDU reception.
+ */
+ void init_phy ( PhyMpduCb interface_cb );
+
+ /**
+ * Initializes Ethernet with an interface callback function for Ether SCI message reception,
+ * and creates a TAP.
+ * @param ether_cb the interface Ethernet reception callback function
+ * @return mEtherLogFileDescriptor
+ */
+ File_Descriptor init_ether ( EtherCb interface_cb );
+
+ /**
+ * This method handles messages reception and events processing.
+ * When called, Maximus processes:
+ * - received messages from all simulated stations at the current tick;
+ * - all Maximus simulator events of the current tick.
+ */
+ void process ( );
+
+ /**
+ * @return Sta &
+ * @param station_executable the station executable to run
+ * Create a new station.
+ * Return a reference on a station object.
+ */
+ Sta & create_sta ( const std::string & station_executable = std::string() );
+
+ /**
+ * @return Msg &
+ * @param name
+ * Create a function message, which name is set to name.
+ * Return a reference on a message object.
+ */
+ Msg & create_fc ( const std::string & name );
+
+ /**
+ * @return Msg &
+ * Create a probe message.
+ * Return a reference on a message object.
+ */
+ Msg & create_probe ( );
+
+ /**
+ * Creates a PHY SCI message MPDU.
+ * Returns a pointer to a PHY SCI message MPDU object.
+ * @return PhySciMsgMpdu *
+ */
+ PhySciMsgMpdu * create_mpdu ( );
+
+ /**
+ * Sends an already configured PHY SCI message MPDU.
+ * @param p_mpdu
+ * @return bool
+ */
+ void send_mpdu ( PhySciMsgMpdu * p_mpdu );
+
+ /**
+ * Creates an Ether SCI message.
+ * Returns a pointer to an Ether SCI message object.
+ * @return EtherSciMsg *
+ */
+ EtherSciMsg * create_ether ( );
+
+ /**
+ * Sends an already configured Ether SCI message.
+ * @param ether
+ * @return bool
+ */
+ void send_ether ( EtherSciMsg & ether );
+
+ /**
+ * @param value
+ * Wait until (Maximus current tick + value) is reached.
+ */
+ void wait ( const tick_t value );
+
+ /**
+ * Wait until all responses to sent function messages in asynchronous mode are received.
+ */
+ void wait ( );
+
+ /**
+ * Enable or disable the channel perturbation.
+ */
+ void disturb_channel ( const bool enable = true );
+
+ /**
+ * Get the Network Clock current tick.
+ */
+ const tick_t get_date ( );
+
+ /**
+ * Set the power line frequency.
+ */
+ void set_freq ( const float frequency );
+
+ /**
+ * Get the power line frequency.
+ */
+ const float get_freq ( );
+
+ /**
+ * Set the SNR.
+ */
+ void set_snr ( const float snr_value );
+ void set_snr ( const std::string & snr_file );
+ void set_snr_from_src ( const float snr_value, const Sta & src, const bool both_directions );
+ void set_snr_from_src ( const std::string & snr_file, const Sta & src, const bool both_directions );
+ void set_snr_to_dst ( const float snr_value, const Sta & dst, const bool both_directions );
+ void set_snr_to_dst ( const std::string & snr_file, const Sta & dst, const bool both_directions );
+ void set_snr_from_src_to_dst ( const float snr_value, const Sta & src, const Sta & dst, const bool both_directions );
+ void set_snr_from_src_to_dst ( const std::string & snr_file, const Sta & src, const Sta & dst, const bool both_directions );
+
+ /**
+ * Activate wrong preambles transmission.
+ * @param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+ * @param std_deviation the standard deviation
+ */
+ void activate_false_alarm ( const Network_Clock_Tick average_duration, const float std_deviation );
+
+ /**
+ * Deactivate wrong preambles transmission.
+ */
+ void deactivate_false_alarm ( );
+
+ /**
+ * Indicate if the station is IDLE or not.
+ * @param station_id the ID of the station
+ * @return 'true' if the station is IDLE, 'false' otherwise
+ */
+ const bool is_station_idle ( Sci_Msg_Station_Id station_id );
+
+private:
+
+ // private attributes
+ //
+
+ CoreEngine * mpCoreEngine;
+ std::ofstream mMaximusLogFile;
+ Network_Clock_Tick mMaxTickValue;
+ Network_Clock_Tick mWaitTickValue;
+ MsgsList mListOfMsgs;
+ StasList mListOfStas;
+
+ bool mIsWireshark;
+ File_Descriptor mEtherLogFileDescriptor;
+
+ // private methods
+ //
+
+ /**
+ * @return CoreEngine *
+ */
+ CoreEngine * getCoreEngine ( );
+
+ /**
+ * @return ISystem *
+ */
+ ISystem * getSystemManager ( );
+
+ /**
+ * @return IFunctionCall *
+ */
+ IFunctionCall * getFunctionCallManager ( );
+
+ /**
+ * @return INetworkClock *
+ */
+ INetworkClock * getNetworkClockProcessor ( );
+
+ /**
+ * @return IPhy *
+ */
+ IPhy * getPhyProcessor ( );
+
+ /**
+ * @return ISci *
+ */
+ ISci * getSciServer ( );
+
+ /**
+ * Gets a pointer to Channel.
+ * @return mpCoreEngine->mpChannel
+ */
+ IChannel * getChannel ( );
+
+ /**
+ * Gets a pointer to Ethernet.
+ * @return mpCoreEngine->mpEthernet
+ */
+ IEthernet * getEthernet ( );
+
+ /**
+ * @return Network_Clock_Tick
+ */
+ Network_Clock_Tick getMaxTickValue ( ) const;
+
+ /**
+ * @return bool
+ * @param max_tick_value
+ */
+ bool setMaxTickValue ( const Network_Clock_Tick max_tick_value );
+
+ /**
+ * @return Network_Clock_Tick
+ */
+ Network_Clock_Tick getWaitTickValue ( ) const;
+
+ /**
+ * @return bool
+ * @param wait_tick_value
+ */
+ bool setWaitTickValue ( const Network_Clock_Tick wait_tick_value );
+
+ /**
+ * @param snr_file the SNR file to read
+ * @param the SNR array read from the SNR file
+ * @return bool
+ */
+ bool readSnrFile ( const std::string & snr_file, float snr_array[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1] );
+
+ /**
+ * Indicates if Wireshark is enabled or not.
+ * @return 'true' if Wireshark is enabled, 'false' otherwise
+ */
+ const bool isWireshark ( ) const;
+
+public:
+
+ // public methods
+ //
+
+ /**
+ * Constructor (FOR UNITARY TESTS ONLY)
+ */
+ Maximus ( CoreEngine * p_core_engine );
+
+ static void wrapper ( int n );
+
+ void stop ( );
+
+};
+
+
+#endif // MAXIMUS_H
diff --git a/cesar/maximus/common/interfaces/Msg.h b/cesar/maximus/common/interfaces/Msg.h
new file mode 100644
index 0000000000..907703dcc6
--- /dev/null
+++ b/cesar/maximus/common/interfaces/Msg.h
@@ -0,0 +1,312 @@
+/************************************************************************
+ Msg.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/interfaces/Msg.h
+**************************************************************************/
+
+#ifndef MSG_H
+#define MSG_H
+
+#include "sci_types.h" // for 'Sci_Msg_Station_Id'
+#include "functioncall_types.h" // for 'PROBE_ID' and 'FUNCTION_CALL_PARAM_MAX_SIZE'
+#include "FunctionSciMsg.h" // for 'ParametersList'
+#include "FunctionCallParameter.h" // for 'ParametersList'
+
+#include <boost/function.hpp> // for 'cb_t'
+#include <string>
+
+class Sta;
+class IFunctionCall;
+class ISystem;
+class Maximus;
+class Msg;
+
+typedef boost::function <void (Msg &)> cb_t;
+
+
+/**
+ * class Msg
+ */
+
+class Msg
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ Msg ( Maximus * p_maximus,
+ IFunctionCall * p_function_call_manager,
+ ISystem * p_system_manager,
+ const std::string & name = PROBE_ID );
+
+ /**
+ * Copy constructor
+ */
+ Msg ( const Msg & msg );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~Msg ( );
+
+ // public methods
+ //
+
+ /**
+ * @return Msg &
+ * @param msg
+ */
+ Msg & operator= ( const Msg & msg );
+
+ /**
+ * @return Msg &
+ * @param name
+ * Add a void parameter named name to an existing message,
+ * i.e. its length is set to 0 and its value is set to NULL.
+ * Return the message.
+ */
+ Msg & add_param ( const std::string & name );
+
+ /**
+ * @return Msg &
+ * @param name
+ * @param length
+ * @param value
+ * Add a parameter named name to an existing message.
+ * Its length is set to length and its value is set to value.
+ * Return the message.
+ */
+ Msg & add_param ( const std::string & name, const unsigned long length, const unsigned char * p_value );
+
+ /**
+ * @return Msg &
+ * @param name
+ * @param value
+ * Add a parameter named name to an existing message.
+ * Its length is set to the size of value string and its value is set to value.
+ * Return the message.
+ */
+ Msg & add_param ( const std::string & name, const std::string & value );
+
+ /**
+ * @return Msg &
+ * @param name
+ * @param value
+ * Add a parameter named name to an existing message.
+ * Its length is set to the size of value type and its value is set to value.
+ * Return the message.
+ */
+ template <typename T> Msg & add_param ( const std::string & name, T const & value );
+
+ /**
+ * @return Msg &
+ * @param name
+ * Remove the parameter named name from an existing message.
+ * Return the message.
+ */
+ Msg & remove_param ( const std::string & name );
+
+ /**
+ * @return Msg &
+ * @param user_cb
+ * Register a callback function to an existing function message.
+ * This callback will be called when the function message response will be received.
+ * If a callback had already been set, it is replaced by the new one.
+ * Return the message.
+ */
+ Msg & set_cb ( const cb_t & user_cb );
+
+ /**
+ * @return Msg &
+ * Remove a registered callback from an existing function message.
+ * Return the message.
+ */
+ Msg & remove_cb ( );
+
+ /**
+ * @return Msg &
+ * @param sta
+ * Set destination station to sta for an existing message.
+ * If a destination station had already been set, it is replaced by the new one.
+ * Return the message.
+ */
+ Msg & set_sta ( Sta & sta );
+
+ /**
+ * Send an existing function message in the asynchronous mode,
+ * i.e. Maximus does not wait for function message response reception before continuing its execution.
+ * Note that before sending a function message via this method,
+ * user has to set its destination station.
+ */
+ void send_async ( );
+
+ /**
+ * @param sta
+ * Send an existing function message to the station sta,
+ * in the asynchronous mode.
+ */
+ void send_async ( Sta & sta );
+
+ /**
+ * Send an existing message in the synchronous mode,
+ * i.e. Maximus will wait for function message response reception before continuing its execution.
+ * Return the received message.
+ * Note that before sending a message via this method,
+ * user has to set its destination station.
+ */
+ Msg & send ( );
+
+ /**
+ * @param sta
+ * Send an existing message to the station sta,
+ * in the synchronous mode.
+ * Return the received message.
+ */
+ Msg & send ( Sta & sta );
+
+
+ /**
+ * @return bool
+ * @param name
+ * Return 'true' if the parameter named name exists in the message.
+ */
+ bool is_param ( const std::string & name ) const;
+
+ /**
+ * @return unsigned char *
+ * @param name
+ * @param length
+ * @param p_data
+ * Retrieve contents of the parameter named name.
+ * Return updated length of the received parameter via length and a pointer to its value via p_data.
+ * Return NULL if the parameter named name does not exist in the message, else return p_data.
+ * Note that user has to allocate enough memory for parameter value.
+ * If parameter value length is unknown, user has to allocate FUNCTION_CALL_PARAM_MAX_SIZE bytes.
+ */
+ unsigned char * bind_param ( const std::string & name, unsigned long & length, unsigned char * p_data ) const;
+
+ /**
+ * @param name
+ * Return the value of the parameter named name.
+ */
+ template <typename T> T & bind_param ( const std::string & name ) const;
+
+ /**
+ * @return Function_Call_Msg_Id
+ * Return mpFunctionSciMsg->mSpecializedSciMsgId.
+ */
+ Function_Call_Msg_Id get_tx_msg_id ( ) const;
+
+ /**
+ * @return Function_Call_Msg_Id
+ * Return mpFunctionSciMsg->mpSpecializedSciMsgHeader->msg_id.
+ */
+ Function_Call_Msg_Id get_rx_msg_id ( ) const;
+
+private:
+
+ // private attributes
+ //
+
+ Maximus * mpMaximus;
+ IFunctionCall * mpFunctionCallManager;
+ ISystem * mpSystemManager;
+ cb_t mCallback;
+ FunctionSciMsg * mpFunctionSciMsg;
+ bool mResponseReceived;
+
+ // private methods
+ //
+
+ // private attributes accessor methods
+ //
+
+ /**
+ * @return Maximus *
+ */
+ Maximus * getMaximus ( ) const;
+
+ /**
+ * @return IFunctionCall *
+ */
+ IFunctionCall * getFunctionCallManager ( ) const;
+
+ /**
+ * @return ISystem *
+ */
+ ISystem * getSystemManager ( ) const;
+
+ /**
+ * @return cb_t
+ */
+ cb_t getCallback ( ) const;
+
+ /**
+ * @return bool
+ * @param cb_t
+ */
+ bool setCallback ( const cb_t callback );
+
+ /**
+ * @return FunctionSciMsg *
+ */
+ FunctionSciMsg * getFunctionSciMsg ( ) const;
+
+ /**
+ * @return bool
+ * @param function_sci_msg
+ */
+ bool setFunctionSciMsg ( const FunctionSciMsg & function_sci_msg );
+
+ /**
+ * @return bool
+ */
+ bool isResponseReceived ( ) const;
+
+ /**
+ * @return bool
+ * @param bool
+ */
+ bool setResponseReceived ( const bool response_received );
+
+public:
+
+ void receiveResponse ( const FunctionSciMsg & function_sci_msg );
+
+ void receiveAsynchronousResponse ( const FunctionSciMsg & function_sci_msg );
+
+};
+
+
+#include "Msg.tpp"
+
+#endif // MSG_H
diff --git a/cesar/maximus/common/interfaces/Sta.h b/cesar/maximus/common/interfaces/Sta.h
new file mode 100644
index 0000000000..43c9379178
--- /dev/null
+++ b/cesar/maximus/common/interfaces/Sta.h
@@ -0,0 +1,169 @@
+/************************************************************************
+ Sta.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/interfaces/Sta.h
+**************************************************************************/
+
+#ifndef STA_H
+#define STA_H
+
+#include "sci_types.h" // for 'Sci_Msg_Station_Id'
+
+#include <map> // for 'map'
+#include <string>
+
+class Maximus;
+class ISystem;
+
+typedef std::map<const Sci_Msg_Station_Id, unsigned short int> StaCounter;
+
+
+
+/**
+ * class Sta
+ */
+
+class Sta
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ Sta ( Maximus * p_maximus, ISystem * p_system_manager, const std::string & station_executable );
+
+ /**
+ * Copy constructors
+ */
+ Sta ( const Sta & sta );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~Sta ( );
+
+ // public methods
+ //
+
+ /**
+ * @return Sta &
+ * @param sta
+ */
+ Sta & operator= ( const Sta & sta );
+
+ /**
+ * Remove an existing station.
+ */
+ void remove ( );
+
+ /**
+ * Deactivate an existing station,
+ * i.e. the station will not receive Maximus messages anymore, until it will be reactivated.
+ */
+ void deactivate ( );
+
+ /**
+ * Reactivate a deactivated station.
+ */
+ void activate ( );
+
+ /**
+ * Launch a debugger attached to the station executable,
+ * with arguments passed to main program.
+ */
+ void debug ( );
+
+ /**
+ * Indicate if the station is IDLE or not.
+ */
+ const bool is_idle ( ) const;
+
+ /**
+ * Set the station name.
+ */
+ void set_name ( const std::string & station_name );
+
+private:
+
+ // private attributes
+ //
+
+ Maximus * mpMaximus; // used for 'Maximus::process()' method only
+ ISystem * mpSystemManager;
+ Sci_Msg_Station_Id mStationId;
+
+ /* Each 'Sta' instance points to an eCos process (via 'mStationId').
+ * When a 'Sta' is created from a Python script,
+ * the 'Sta' copy constructor is called by the Boost.Python interface.
+ * Thus, several 'Sta' instances point to the same eCos process.
+ * The eCos process has to be stopped only when the last 'Sta' pointing to it is deleted,
+ * i.e. when the station counter defined below equals 1. */
+ static StaCounter mStaCounter;
+
+ // private methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Gets a pointer to Maximus.
+ * @return mpMaximus
+ */
+ Maximus * getMaximus ( ) const;
+
+ /**
+ * @return ISystem *
+ */
+ ISystem * getSystemManager ( ) const;
+
+ /**
+ * @return bool
+ */
+ bool resetStationId ( );
+
+public:
+
+ // public methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return Sci_Msg_Station_Id
+ */
+ Sci_Msg_Station_Id getStationId ( ) const;
+
+};
+
+
+#endif // STA_H
diff --git a/cesar/maximus/common/types/channel_types.h b/cesar/maximus/common/types/channel_types.h
new file mode 100644
index 0000000000..86552d77d8
--- /dev/null
+++ b/cesar/maximus/common/types/channel_types.h
@@ -0,0 +1,56 @@
+/************************************************************************
+ channel_types.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/channel_types.h
+**************************************************************************/
+
+#ifndef CHANNEL_TYPES_H
+#define CHANNEL_TYPES_H
+
+#define MAXIMUS_CHANNEL_VALUE_MAX_NB 32
+#define MAXIMUS_CHANNEL_I_Q_MAX_VALUE 31
+#define MAXIMUS_CHANNEL_I_Q_MIN_VALUE -31
+#define MAXIMUS_CHANNEL_CODE_MAX_VALUE 0x3FF // 0b1111111111 in QAM1024
+#define MAXIMUS_CHANNEL_Q_QAM8_ABSOLUTE_VALUE 1.29f
+
+#define MAXIMUS_CHANNEL_INTERVAL_MAX_NB 128
+
+enum Channel_Mod
+{
+ MAXIMUS_CHANNEL_MOD_NONE = 0x00,
+ MAXIMUS_CHANNEL_MOD_BPSK = 0x01,
+ MAXIMUS_CHANNEL_MOD_QPSK = 0x02,
+ MAXIMUS_CHANNEL_MOD_QAM8 = 0x03,
+ MAXIMUS_CHANNEL_MOD_QAM16 = 0x04,
+ MAXIMUS_CHANNEL_MOD_QAM64 = 0x05,
+ MAXIMUS_CHANNEL_MOD_QAM256 = 0x06,
+ MAXIMUS_CHANNEL_MOD_QAM1024 = 0x07,
+ MAXIMUS_CHANNEL_MOD_NB = 0x08,
+ MAXIMUS_CHANNEL_I_Q_VALUE = MAXIMUS_CHANNEL_MOD_NONE
+};
+
+#endif // CHANNEL_TYPES_H
diff --git a/cesar/maximus/common/types/ethernet_types.h b/cesar/maximus/common/types/ethernet_types.h
new file mode 100644
index 0000000000..752f6c185f
--- /dev/null
+++ b/cesar/maximus/common/types/ethernet_types.h
@@ -0,0 +1,87 @@
+/************************************************************************
+ ethernet_types.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/ethernet_types.h
+**************************************************************************/
+
+#ifndef ETHERNET_TYPES_H
+#define ETHERNET_TYPES_H
+
+#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+
+#define ETHERNET_VERSION 0x02
+
+// Ethernet_Header.flags
+//
+typedef uint8_t Ethernet_Flags; // used in case of ETHERNET_TYPE_SNIFFER only
+#define ETHERNET_FLAG_NONE 0x00
+#define ETHERNET_FLAG_WAY 0x01 // Rx if set, Tx if none
+#define ETHERNET_FLAG_ENCRYPTED 0x02 // If set, Ether SCI msg is encrypted
+#define ETHERNET_FLAG_MAX (ETHERNET_FLAG_ENCRYPTED + ETHERNET_FLAG_WAY)
+
+struct Ethernet_Header
+{
+ uint8_t version;
+ uint8_t type;
+ uint8_t sniffer_type; // used in case of ETHERNET_TYPE_SNIFFER only,
+ // defined in 'interface/sniffer/inc/context.h'
+ uint8_t flags; // used in case of ETHERNET_TYPE_SNIFFER only
+ uint32_t reserved;
+} __attribute__ ((__packed__));
+
+// Ethernet_Header.type
+//
+enum Ethernet_Type
+{
+ ETHERNET_TYPE_NONE = 0x00,
+
+ /* HLE_MSG_TYPE_DATA > Data or MME message type. */
+ ETHERNET_TYPE_DATA = 0x01, // Ether SCI msg data contain the MSDU (Ethernet Frame)
+ ETHERNET_TYPE_MME = 0x02, // Ether SCI msg data contain the MSDU (MME)
+
+ /* HLE_MSG_TYPE_BUFFER_ADD > Buffer alloc message type. */
+ ETHERNET_TYPE_DATA_BUFFER_ADD = 0x03, // Ether SCI msg data contain the number of buffers to allocate (uint32_t)
+ // and IDs of each buffer to allocate (uint32_t)
+ ETHERNET_TYPE_MME_BUFFER_ADD = 0x04, // Ether SCI msg data contain the number of buffers to allocate (uint32_t)
+ // and IDs of each buffer to allocate (uint32_t)
+ ETHERNET_TYPE_INTERFACE_BUFFER_ADD = 0x05, // Ether SCI msg data contain the number of buffers to allocate (uint32_t)
+ // and IDs of each buffer to allocate (uint32_t)
+
+ /* HLE_MSG_TYPE_SEND_DONE > Buffer dealloc message type. */
+ ETHERNET_TYPE_BUFFER_RELEASED = 0x06, // Ether SCI msg data contain the ID of released buffer (uint32_t)
+
+ /* HLE_MSG_TYPE_INTERFACE > Interface message type. */
+ ETHERNET_TYPE_SNIFFER = 0x07, // Ether SCI msg data contain a sniffed packet
+
+ ETHERNET_TYPE_NB
+};
+
+// Ethernet_Header.sniffer_type
+//
+typedef uint8_t Ethernet_Sniffer_Type;
+
+#endif // ETHERNET_TYPES_H
diff --git a/cesar/maximus/common/types/functioncall_types.h b/cesar/maximus/common/types/functioncall_types.h
new file mode 100644
index 0000000000..15396ac0de
--- /dev/null
+++ b/cesar/maximus/common/types/functioncall_types.h
@@ -0,0 +1,79 @@
+/************************************************************************
+ functioncall_types.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/functioncall_types.h
+**************************************************************************/
+
+#ifndef FUNCTIONCALL_TYPES_H
+#define FUNCTIONCALL_TYPES_H
+
+#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+
+#define FUNCTION_CALL_VERSION 0x02
+#define FUNCTION_CALL_ID_MAX_SIZE 64 /* max length of a function id */
+#define FUNCTION_CALL_PARAM_MAX_NB 16 /* max number of parameter in a function call */
+#define FUNCTION_CALL_FUNCTION_MAX_NB 64 /* max number of registred functions */
+#define FUNCTION_CALL_PARAM_MAX_SIZE 2048 /* max size of 1 parameter */
+
+// Function_Call_Header.flags
+//
+typedef uint8_t Function_Call_Flags;
+#define FUNCTION_CALL_FLAG_NONE 0x00
+#define FUNCTION_CALL_FLAG_FAILED 0x01 // If set, function call has failed
+#define FUNCTION_CALL_FLAG_MAX FUNCTION_CALL_FLAG_FAILED
+
+#define PROBE_ID "probe"
+
+struct Function_Call_Header
+{
+ uint8_t version;
+ uint8_t type;
+ uint16_t msg_id;
+ uint8_t param_nb;
+ uint8_t flags;
+ uint16_t reserved;
+} __attribute__ ((__packed__));
+
+// Function_Call_Header.type
+//
+enum Function_Call_Type
+{
+ FUNCTION_CALL_TYPE_NONE = 0x00,
+ FUNCTION_CALL_TYPE_REQ = 0x01,
+ FUNCTION_CALL_TYPE_RSP = 0x02,
+ FUNCTION_CALL_TYPE_NB
+};
+
+// Function_Call_Header.msg_id
+//
+typedef uint16_t Function_Call_Msg_Id;
+
+// Function_Call_Header.param_nb
+//
+typedef unsigned int Function_Call_Parameters_Number;
+
+#endif // FUNCTIONCALL_TYPES_H
diff --git a/cesar/maximus/common/types/hal_phy_types.h b/cesar/maximus/common/types/hal_phy_types.h
new file mode 100644
index 0000000000..030ed92e95
--- /dev/null
+++ b/cesar/maximus/common/types/hal_phy_types.h
@@ -0,0 +1,75 @@
+/************************************************************************
+ hal_phy_types.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/hal_phy_types.h
+**************************************************************************/
+
+#ifndef HAL_PHY_TYPES_H
+#define HAL_PHY_TYPES_H
+
+#include "common/std.h"
+#include "hal/phy/defs.h" // for 'phy_fc_mode_t', 'phy_mod_t', 'phy_fecrate_t', and 'phy_gil_t'
+
+#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+
+// Phy_Header.pb_nb
+//
+typedef uint8_t Phy_Nb_Of_Pbs;
+
+// Phy_Header.fc_mode
+//
+typedef phy_fc_mode_t Phy_Fc_Mode;
+
+// Phy_Header.short_ppdu
+//
+typedef bool Phy_Short_Ppdu;
+
+// Phy_Header.mod
+//
+typedef phy_mod_t Phy_Mod;
+
+// Phy_Header.fecrate
+//
+typedef phy_fecrate_t Phy_Fecrate;
+
+// Phy_Header.gil
+//
+typedef phy_gil_t Phy_Gil;
+
+// Phy_Header.tonemap_index
+//
+typedef uint8_t Phy_Tonemap_Index;
+
+// Phy_Header.tx_id
+//
+typedef uint16_t Phy_Tx_Id;
+
+// Phy_Header.symbol_nb
+//
+typedef uint32_t Phy_Nb_Of_Symbols;
+
+#endif // HAL_PHY_TYPES_H
diff --git a/cesar/maximus/common/types/networkclock_types.h b/cesar/maximus/common/types/networkclock_types.h
new file mode 100644
index 0000000000..bc276c6fdf
--- /dev/null
+++ b/cesar/maximus/common/types/networkclock_types.h
@@ -0,0 +1,73 @@
+/************************************************************************
+ networkclock_types.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/networkclock_types.h
+**************************************************************************/
+
+#ifndef NETWORKCLOCK_TYPES_H
+#define NETWORKCLOCK_TYPES_H
+
+#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+
+#define NETWORK_CLOCK_VERSION 0x02
+#define NETWORK_CLOCK_ID_MASK 0xffff
+
+struct Network_Clock_Header
+{
+ uint8_t version;
+ uint8_t type;
+ uint16_t id;
+ uint16_t flags;
+ uint16_t reserved;
+ uint32_t tick_high;
+ uint32_t tick_low;
+} __attribute__ ((__packed__));
+
+// Network_Clock_Header.type
+//
+enum Network_Clock_Type
+{
+ NETWORK_CLOCK_TYPE_NONE = 0x00,
+ NETWORK_CLOCK_TYPE_REMOVE = 0x01,
+ NETWORK_CLOCK_TYPE_STATION = 0x02,
+ NETWORK_CLOCK_TYPE_FUNCTION_CALL = 0x03,
+ NETWORK_CLOCK_TYPE_PHY = 0x04,
+ NETWORK_CLOCK_TYPE_SYSTEM = 0x05,
+ NETWORK_CLOCK_TYPE_ETHERNET = 0x06,
+ NETWORK_CLOCK_TYPE_NB
+};
+
+// Network_Clock_Header.id
+//
+typedef uint16_t Network_Clock_Id;
+
+// Network_Clock_Header.tick_high
+// Network_Clock_Header.tick_low
+//
+typedef unsigned long long Network_Clock_Tick;
+
+#endif // NETWORKCLOCK_TYPES_H
diff --git a/cesar/maximus/common/types/phy_types.h b/cesar/maximus/common/types/phy_types.h
new file mode 100644
index 0000000000..497d549c4e
--- /dev/null
+++ b/cesar/maximus/common/types/phy_types.h
@@ -0,0 +1,112 @@
+/************************************************************************
+ phy_types.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/phy_types.h
+**************************************************************************/
+
+#ifndef PHY_TYPES_H
+#define PHY_TYPES_H
+
+#include "sci_types.h"
+
+#include "mac/common/defs.h" // for 'MAC_PB520_BYTES'
+
+#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+
+#define PHY_VERSION 0x02
+#define PHY_PB_MAX_NB (SCI_MSG_MAX_SIZE/MAC_PB520_BYTES - 1) // = 31 per MPDU (-1 because of PHY header size)
+#define PHY_MSG_MAX_NB_PER_MPDU (MAC_MAX_PB_PER_MPDU/PHY_PB_MAX_NB + 1)
+
+// Phy_Header.flags
+//
+typedef uint16_t Phy_Flags;
+#define PHY_FLAG_NONE 0x0000
+#define PHY_FLAG_ENCRYPTED 0x0001 // If set, PHY SCI msg is encrypted
+#define PHY_FLAG_CRC_OK 0x0002 // If set, CRC is correct
+#define PHY_FLAG_PB512 0x0004 // PB512 if set, PB128 if none
+#define PHY_FLAG_WRONG_PREAMBLE 0x0008 // If set, PHY SCI msg is a wrong preamble
+#define PHY_FLAG_MAX (PHY_FLAG_ENCRYPTED + PHY_FLAG_CRC_OK + PHY_FLAG_PB512 + PHY_FLAG_WRONG_PREAMBLE)
+
+struct Phy_Header
+{
+ uint8_t version;
+ uint8_t type;
+ uint8_t mpdu_format; // delimiter type that indicates PHY SCI msg format in case of PHY_TYPE_MPDU_PAYLOAD
+ uint8_t pb_nb; // if PB size is set to 128 octets, there is only one PB
+ uint8_t msg_nb; // total number of messages needed to transmit the MPDU (in case of PHY_TYPE_MPDU_PAYLOAD)
+ uint8_t fc_mode; // phy_fc_mode_t
+ uint8_t short_ppdu; // bool
+ uint8_t mod; // phy_mod_t
+ uint8_t fecrate; // phy_fecrate_t
+ uint8_t gil; // phy_gil_t
+ uint8_t tonemap_index;
+ uint8_t reserved;
+ uint16_t tx_id; // unique ID incremented for each transmission
+ uint16_t flags;
+ uint32_t symbol_nb; // uint
+ uint32_t iv[3];
+ uint32_t nek[4];
+ uint32_t pb_measurement[PHY_PB_MAX_NB]; // 32 bits per PB for:
+ // ber (Bit Error Rate) -> 16 bits
+ // halfit -> 5 bits
+ // crc_error -> 1 bit
+ uint32_t pb_header[PHY_PB_MAX_NB]; // 4 octets per PB
+} __attribute__ ((__packed__));
+
+// Phy_Header.type
+//
+enum Phy_Type
+{
+ PHY_TYPE_NONE = 0x00,
+ PHY_TYPE_PREAMBLE = 0x01, // PHY SCI msg data are empty
+ PHY_TYPE_FC_HYBRID_MODE = 0x02, // PHY SCI msg data contain HP1.0.1 Frame Control (25 bits => on 4 octets) and AV Frame Control (128 bits)
+ PHY_TYPE_FC_AV_ONLY_MODE = 0x03, // PHY SCI msg data only contain AV Frame Control (128 bits)
+ PHY_TYPE_PRS = 0x04, // PHY SCI msg data contain PRS0 or PRS1 symbol (on 1 octet)
+ PHY_TYPE_MPDU_PAYLOAD = 0x05, // PHY SCI msg data only contain MPDU payload ('nb_of_pbs' PBs of 128 or 512 octets depending on PHY_FLAG_PB512)
+ PHY_TYPE_TONEMASK = 0x06, // PHY SCI msg data contain 'uint carrier_nb' and the tonemask (uses 1 block)
+ PHY_TYPE_TONEMAP = 0x07, // PHY SCI msg data contain tonemap (uses 2 blocks)
+ PHY_TYPE_NOISE = 0x08, // PHY SCI msg data contain 'uint16_t frequency_noise[PHY_CARRIER_NB]' and 'uint16_t time_noise[MAC_MAX_SYMB_PER_MPDU]'
+ PHY_TYPE_RX = 0x09, // PHY SCI msg data contain the source station ID of the expected transmission
+ PHY_TYPE_ZERO_CROSS = 0x0A, // PHY SCI msg data are empty
+ PHY_TYPE_NB
+};
+
+// Phy_Header.mpdu_format
+//
+enum Phy_Mpdu_Format
+{
+ PHY_MPDU_FORMAT_NONE = 0x00,
+ PHY_MPDU_FORMAT_BEACON = 0x01, // Beacon => Long MPDU
+ PHY_MPDU_FORMAT_SOF = 0x02, // Start Of Frame => Long MPDU
+ PHY_MPDU_FORMAT_SACK = 0x03, // Selective ACKnowledgement => Short MPDU (i.e. there is no payload)
+ PHY_MPDU_FORMAT_RTS_CTS = 0x04, // Request To Send / Clear To Send => Short MPDU (i.e. there is no payload)
+ PHY_MPDU_FORMAT_SOUND = 0x05, // Sound => Long MPDU
+ PHY_MPDU_FORMAT_RSOF = 0x06, // Reverse Start Of Frame => Long MPDU
+ PHY_MPDU_FORMAT_NB
+};
+
+#endif // PHY_TYPES_H
diff --git a/cesar/maximus/common/types/sci_types.h b/cesar/maximus/common/types/sci_types.h
new file mode 100644
index 0000000000..0554f3cf11
--- /dev/null
+++ b/cesar/maximus/common/types/sci_types.h
@@ -0,0 +1,117 @@
+/************************************************************************
+ sci_types.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/sci_types.h
+**************************************************************************/
+
+#ifndef SCI_TYPES_H
+#define SCI_TYPES_H
+
+#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+
+#define SCI_MSG_MAGIC "MAXI"
+#define SCI_MSG_VERSION 0x02
+#define SCI_MSG_ID_STATION 0x8000
+#define SCI_MSG_ID_MASK 0x7fff
+#define SCI_MSG_MAX_SIZE 16384
+
+// Used by SciServer
+//
+enum Sci_Server_Status
+{
+ MAXIMUS_SCI_SERVER_STATUS_NONE = 0,
+ MAXIMUS_SCI_SERVER_STATUS_RUNNING = 1,
+ MAXIMUS_SCI_SERVER_STATUS_STOP = 2,
+ MAXIMUS_SCI_SERVER_STATUS_STOPPED = 3,
+ MAXIMUS_SCI_SERVER_STATUS_NB
+};
+
+// Used by SciMsg
+//
+enum Sci_Msg_Status
+{
+ MAXIMUS_SCI_MSG_STATUS_NONE = 0,
+ MAXIMUS_SCI_MSG_STATUS_TO_SEND = 1,
+ MAXIMUS_SCI_MSG_STATUS_SENT = 2,
+ MAXIMUS_SCI_MSG_STATUS_RECEIVED = 3,
+ MAXIMUS_SCI_MSG_STATUS_PROCESSED = 4,
+ MAXIMUS_SCI_MSG_STATUS_NB
+};
+
+// Common SCI message structure between station and maximus
+//
+struct Sci_Msg_Header
+{
+ uint32_t magic_id; /* 1st field is magic id (32 bits): always “MAXI†*/
+ uint8_t version; /* 2nd field is version (8 bits): message protocol version; always 0x01 */
+ uint8_t type; /* 3rd field is type (8): message type; Sci_Msg_Type */
+ uint16_t length; /* 4th field is length (16 bits): message length without header */
+ uint16_t station_id; /* 5th field is station id (16 bits): source or destination station id; in general, the process id of the simulated station */
+ /* for PHY SCI messages, station id is the source station id or the Maximus pid,
+ for all other messages, station id is the destination station id */
+ uint16_t msg_id; /* 6th field is msg id (16 bits): unique message id for each station – simulator transaction
+ 0x0001-0x7fff: request created by simulator
+ 0x8000-0xffff: request created by a station */
+ uint32_t netclock_high; /* 7th field is netclock high: high part of 64 bits NetClock value */
+ uint32_t netclock_low; /* 8th field is netclock low: low part of 64 bits NetClock value */
+ uint16_t flags; /* 9th and last field is flags (16 bits): Sci_Msg_Flag */
+ uint16_t reserved; /* 10th field is reserved (16 bits) */
+} __attribute__ ((__packed__));
+
+// Sci_Msg_Header.type
+//
+enum Sci_Msg_Type
+{
+ SCI_MSG_TYPE_NONE = 0x00,
+ SCI_MSG_TYPE_NETWORK_CLOCK = 0x01,
+ SCI_MSG_TYPE_FUNCTION_CALL = 0x02,
+ SCI_MSG_TYPE_PHY = 0x03,
+ SCI_MSG_TYPE_SYSTEM = 0x04,
+ SCI_MSG_TYPE_ETHERNET = 0x05,
+ SCI_MSG_TYPE_NB
+};
+
+// Sci_Msg_Header.station_id
+//
+typedef uint16_t Sci_Msg_Station_Id;
+
+// Sci_Msg_Header.msg_id
+//
+typedef uint16_t Sci_Msg_Id;
+
+// Sci_Msg_Header.flags
+//
+enum Sci_Msg_Flag
+{
+ SCI_MSG_FLAG_NONE = 0x0000,
+ SCI_MSG_FLAG_RESP = 0x0001, // if set, message is a response to a request; else, it is a request
+ SCI_MSG_FLAG_ACK = 0x0002, // if set, message is an acknowledge to a request or a response
+ SCI_MSG_FLAG_NEEDACK = 0x0004, // set an ack is requested from remote receiver
+ SCI_MSG_FLAG_SYNC = 0x0008 // if set, a synchronous response is required
+};
+
+#endif // SCI_TYPES_H
diff --git a/cesar/maximus/common/types/system_types.h b/cesar/maximus/common/types/system_types.h
new file mode 100644
index 0000000000..d3877760d7
--- /dev/null
+++ b/cesar/maximus/common/types/system_types.h
@@ -0,0 +1,69 @@
+/************************************************************************
+ system_types.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/system_types.h
+**************************************************************************/
+
+#ifndef SYSTEM_TYPES_H
+#define SYSTEM_TYPES_H
+
+#include <stdint.h> // for 'uint8_t', 'uint16_t' and 'uint32_t' types
+
+#define SYSTEM_VERSION 0x02
+#define SYSTEM_STATION_NAME_MAX_SIZE 255
+
+enum Station_Status
+{
+ MAXIMUS_STATION_STATUS_NONE = 0,
+ MAXIMUS_STATION_STATUS_IDLE = 1,
+ MAXIMUS_STATION_STATUS_BUSY = 2,
+ MAXIMUS_STATION_STATUS_DEACTIVATED = 3,
+ MAXIMUS_STATION_STATUS_NB
+};
+
+typedef int File_Descriptor;
+
+typedef int Error_Id;
+
+struct System_Header
+{
+ uint8_t version;
+ uint8_t type;
+ uint16_t flags;
+} __attribute__ ((__packed__));
+
+// System_Header.type
+//
+enum System_Type
+{
+ SYSTEM_TYPE_NONE = 0x00,
+ SYSTEM_TYPE_IDLE = 0x01,
+ SYSTEM_TYPE_STATION_NAME = 0x02, // System SCI msg data contain 'char station_name[SYSTEM_STATION_NAME_MAX_SIZE]'
+ SYSTEM_TYPE_NB
+};
+
+#endif // SYSTEM_TYPES_H
diff --git a/cesar/maximus/coreengine/Module b/cesar/maximus/coreengine/Module
new file mode 100644
index 0000000000..6a5c0c304e
--- /dev/null
+++ b/cesar/maximus/coreengine/Module
@@ -0,0 +1,5 @@
+SOURCES := CoreEngine.cpp Maximus.cpp Sta.cpp Msg.cpp
+ifdef UNITTEST
+SOURCES += CoreEngineTest.cpp MaximusTest.cpp StaTest.cpp MsgTest.cpp
+endif
+HOST_INCLUDES += maximus/coreengine/inc
diff --git a/cesar/maximus/coreengine/inc/CoreEngine.h b/cesar/maximus/coreengine/inc/CoreEngine.h
new file mode 100644
index 0000000000..5d2440ddb4
--- /dev/null
+++ b/cesar/maximus/coreengine/inc/CoreEngine.h
@@ -0,0 +1,187 @@
+/************************************************************************
+ CoreEngine.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/coreengine/inc/CoreEngine.h
+**************************************************************************/
+
+#ifndef COREENGINE_H
+#define COREENGINE_H
+
+#include "networkclock_types.h" // for Network_Clock_Tick
+
+#include <string>
+
+class IPhy;
+class IFunctionCall;
+class INetworkClock;
+class ISystem;
+class ISci;
+class IChannel;
+class IEthernet;
+
+
+/**
+ * class CoreEngine
+ * Main simulator part which is managing the overall working of PHY interface,
+ * Network Clock and other AV stations.
+ */
+
+class CoreEngine
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ IFunctionCall * mpFunctionCall;
+ ISystem * mpSystem;
+ INetworkClock * mpNetworkClock;
+ IPhy * mpPhy;
+ ISci * mpSci;
+ IChannel * mpChannel;
+ IEthernet * mpEthernet;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ CoreEngine ( );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~CoreEngine ( );
+
+ // public methods
+ //
+
+ /**
+ * Initializes the Core Engine.
+ * @return bool
+ */
+ bool init ( const std::string station_executable,
+ const std::string station_log,
+ const std::string debugger,
+ const float frequency );
+
+ /**
+ * Processes the next event in the Network Clock event list.
+ * Then, processes messages coming from pipe.
+ * @return bool
+ */
+ bool process ( const Network_Clock_Tick max_tick_value = 0 );
+
+ /**
+ * Creates, enables or disables Channel.
+ */
+ bool disturbChannel ( const bool enable );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Gets Function Call.
+ * @return IFunctionCall *
+ */
+ IFunctionCall * getFunctionCall ( ) const;
+
+ /**
+ * Gets System.
+ * @return ISystem *
+ */
+ ISystem * getSystem ( ) const;
+
+ /**
+ * Gets Network Clock.
+ * @return INetworkClock *
+ */
+ INetworkClock * getNetworkClock ( ) const;
+
+ /**
+ * Gets PHY.
+ * @return IPhy *
+ */
+ IPhy * getPhy ( ) const;
+
+ /**
+ * Gets SCI.
+ * @return ISci *
+ */
+ ISci * getSci ( ) const;
+
+ /**
+ * Gets a pointer to Channel.
+ * @return mpChannel
+ */
+ IChannel * getChannel ( ) const;
+
+ /**
+ * Gets a pointer to Ethernet.
+ * @return mpEthernet
+ */
+ IEthernet * getEthernet ( ) const;
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the Core Engine class attributes.
+ */
+ void initAttributes ( );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // COREENGINE_H
diff --git a/cesar/maximus/coreengine/inc/CoreEngineTest.h b/cesar/maximus/coreengine/inc/CoreEngineTest.h
new file mode 100644
index 0000000000..35b8e8021a
--- /dev/null
+++ b/cesar/maximus/coreengine/inc/CoreEngineTest.h
@@ -0,0 +1,36 @@
+
+#ifndef COREENGINETEST_H
+#define COREENGINETEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class CoreEngine;
+
+
+class CoreEngineTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (CoreEngineTest);
+ CPPUNIT_TEST (initTest);
+ CPPUNIT_TEST (disturbChannelTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void initTest (void);
+ void disturbChannelTest (void);
+
+private:
+
+ CoreEngine * mpCoreEngine;
+
+};
+
+
+#endif // COREENGINETEST_H
diff --git a/cesar/maximus/coreengine/inc/MaximusTest.h b/cesar/maximus/coreengine/inc/MaximusTest.h
new file mode 100644
index 0000000000..726cbc24d8
--- /dev/null
+++ b/cesar/maximus/coreengine/inc/MaximusTest.h
@@ -0,0 +1,68 @@
+
+#ifndef MAXIMUSTEST_H
+#define MAXIMUSTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class Maximus;
+
+
+class MaximusTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (MaximusTest);
+ CPPUNIT_TEST (init_test);
+ CPPUNIT_TEST (init_phy_test);
+ CPPUNIT_TEST (init_ether_test);
+ CPPUNIT_TEST (process_test);
+ CPPUNIT_TEST (create_sta_test);
+ CPPUNIT_TEST (create_fc_test);
+ CPPUNIT_TEST (create_probe_test);
+ CPPUNIT_TEST (create_mpdu_test);
+ CPPUNIT_TEST (send_mpdu_test);
+ CPPUNIT_TEST (create_ether_test);
+ CPPUNIT_TEST (send_ether_test);
+ CPPUNIT_TEST (wait_test);
+ CPPUNIT_TEST (disturb_channel_test);
+ CPPUNIT_TEST (get_date_test);
+ CPPUNIT_TEST (set_freq_test);
+ CPPUNIT_TEST (activate_false_alarm_test);
+ CPPUNIT_TEST (deactivate_false_alarm_test);
+ CPPUNIT_TEST (is_station_idle_test);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void init_test (void);
+ void init_phy_test (void);
+ void init_ether_test (void);
+ void process_test (void);
+ void create_sta_test (void);
+ void create_fc_test (void);
+ void create_probe_test (void);
+ void create_mpdu_test (void);
+ void send_mpdu_test (void);
+ void create_ether_test (void);
+ void send_ether_test (void);
+ void wait_test (void);
+ void disturb_channel_test (void);
+ void get_date_test (void);
+ void set_freq_test (void);
+ void activate_false_alarm_test (void);
+ void deactivate_false_alarm_test (void);
+ void is_station_idle_test (void);
+
+private:
+
+ Maximus * mpMaximus;
+
+};
+
+
+#endif // MAXIMUSTEST_H
diff --git a/cesar/maximus/coreengine/inc/Msg.tpp b/cesar/maximus/coreengine/inc/Msg.tpp
new file mode 100644
index 0000000000..d1624ae8fe
--- /dev/null
+++ b/cesar/maximus/coreengine/inc/Msg.tpp
@@ -0,0 +1,117 @@
+/************************************************************************
+ Msg.tpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/coreengine/src/Msg.tpp
+**************************************************************************/
+
+#ifndef MSG_TPP
+#define MSG_TPP
+
+#include "Msg.h"
+#include "Maximus.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <netinet/in.h> // for 'htonl()', 'htons()', 'ntohl()' and 'ntohs()'
+using namespace std;
+
+
+template <typename T> Msg & Msg::add_param ( const string & name, T const & value )
+{
+ logFunction();
+
+ try
+ {
+ T param;
+ if ( FUNCTION_CALL_PARAM_MAX_SIZE >= sizeof(value))
+ {
+ if (sizeof(long) == sizeof(value))
+ {
+ clog << logger(LOG_DEBUG) << "htonl" << endl;
+ param = htonl(value);
+ }
+ else if (sizeof(short) == sizeof(value))
+ {
+ clog << logger(LOG_DEBUG) << "htons" << endl;
+ param = htons(value);
+ }
+ else
+ {
+ param = value;
+ }
+ add_param(name, sizeof(value), (unsigned char *)&param);
+ }
+ else
+ {
+ errno = EMSGSIZE;
+ throw Error(__PRETTY_FUNCTION__, "Length of parameter value exceeds max size", errno);
+ }
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+template <typename T> T & Msg::bind_param ( const string & name ) const
+{
+ logFunction();
+ static T param = 0; // parameter not found => return 0
+
+ try
+ {
+ unsigned long length = sizeof(T);
+ unsigned char * pData = new unsigned char [length];
+ if ( (NULL != bind_param(name, length, pData)) && (NULL != pData) )
+ {
+ param = *((T*)pData);
+ if (sizeof(long) == sizeof(param))
+ {
+ clog << logger(LOG_DEBUG) << "ntohl" << endl;
+ param = ntohl(param);
+ }
+ else if (sizeof(short) == sizeof(param))
+ {
+ clog << logger(LOG_DEBUG) << "ntohs" << endl;
+ param = ntohs(param);
+ }
+ clog << logger(LOG_INFO) << "bind param = " << param << endl;
+ }
+ if (NULL != pData)
+ {
+ delete [] pData;
+ pData = NULL;
+ }
+ }
+ catchFunction(getMaximus());
+
+ return param;
+}
+
+
+#endif // MSG_TPP
diff --git a/cesar/maximus/coreengine/inc/MsgTest.h b/cesar/maximus/coreengine/inc/MsgTest.h
new file mode 100644
index 0000000000..63091e16c9
--- /dev/null
+++ b/cesar/maximus/coreengine/inc/MsgTest.h
@@ -0,0 +1,58 @@
+
+#ifndef MSGTEST_H
+#define MSGTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class Msg;
+class Maximus;
+class CoreEngine;
+
+
+class MsgTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (MsgTest);
+ CPPUNIT_TEST (add_param_test);
+ CPPUNIT_TEST (remove_param_test);
+ CPPUNIT_TEST (set_cb_test);
+ CPPUNIT_TEST (remove_cb_test);
+ CPPUNIT_TEST (set_sta_test);
+ CPPUNIT_TEST (send_async_test);
+ CPPUNIT_TEST (send_test);
+ CPPUNIT_TEST (is_param_test);
+ CPPUNIT_TEST (bind_param_test);
+ CPPUNIT_TEST (receiveResponseTest);
+ CPPUNIT_TEST (receiveAsynchronousResponseTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void add_param_test (void);
+ void remove_param_test (void);
+ void set_cb_test (void);
+ void remove_cb_test (void);
+ void set_sta_test (void);
+ void send_async_test (void);
+ void send_test (void);
+ void is_param_test (void);
+ void bind_param_test (void);
+ void receiveResponseTest (void);
+ void receiveAsynchronousResponseTest (void);
+
+private:
+
+ Msg * mpMsg;
+ Maximus * mpMaximus;
+ CoreEngine * mpCoreEngine;
+
+};
+
+
+#endif // MSGTEST_H
diff --git a/cesar/maximus/coreengine/inc/StaTest.h b/cesar/maximus/coreengine/inc/StaTest.h
new file mode 100644
index 0000000000..10ac4e75a3
--- /dev/null
+++ b/cesar/maximus/coreengine/inc/StaTest.h
@@ -0,0 +1,54 @@
+
+#ifndef STATEST_H
+#define STATEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class Maximus;
+class ISci;
+class SystemManager;
+class INetworkClock;
+class Sta;
+
+
+class StaTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (StaTest);
+ CPPUNIT_TEST (remove_test);
+ CPPUNIT_TEST (deactivate_test);
+ CPPUNIT_TEST (activate_test);
+ CPPUNIT_TEST (debug_test);
+ CPPUNIT_TEST (is_idle_test);
+ CPPUNIT_TEST (getStationIdTest);
+ CPPUNIT_TEST (set_name_test);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void remove_test (void);
+ void deactivate_test (void);
+ void activate_test (void);
+ void debug_test (void);
+ void is_idle_test (void);
+ void getStationIdTest (void);
+ void set_name_test (void);
+
+private:
+
+ Maximus * mpMaximus;
+ ISci * mpSci;
+ SystemManager * mpSystemManager;
+ INetworkClock * mpNetworkClock;
+ Sta * mpSta;
+
+};
+
+
+#endif // STATEST_H
diff --git a/cesar/maximus/coreengine/src/CoreEngine.cpp b/cesar/maximus/coreengine/src/CoreEngine.cpp
new file mode 100644
index 0000000000..f5ec159595
--- /dev/null
+++ b/cesar/maximus/coreengine/src/CoreEngine.cpp
@@ -0,0 +1,293 @@
+/************************************************************************
+ CoreEngine.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/coreengine/src/CoreEngine.cpp
+**************************************************************************/
+
+#include "CoreEngine.h"
+
+#include "PhyProcessor.h"
+#include "FunctionCallManager.h"
+#include "NetworkClockProcessor.h"
+#include "SystemManager.h"
+#include "SciServer.h"
+#include "ChannelComputer.h"
+#include "EthernetProcessor.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+CoreEngine::CoreEngine ( ):
+mpFunctionCall(NULL),
+mpSystem(NULL),
+mpNetworkClock(NULL),
+mpPhy(NULL),
+mpSci(NULL),
+mpChannel(NULL),
+mpEthernet(NULL)
+{
+ logFunction();
+
+ initAttributes();
+}
+
+
+void CoreEngine::initAttributes ( )
+{
+ logFunction();
+
+ // Create all packages: at first Sci; then FunctionCall, Phy, and System; and lastly NetworkClock
+ //
+ mpSci = new SciServer();
+ mpFunctionCall = new FunctionCallManager(mpSci);
+ mpSystem = new SystemManager(mpSci);
+ mpPhy = new PhyProcessor(mpSci);
+ mpEthernet = new EthernetProcessor(mpSci);
+ mpNetworkClock = new NetworkClockProcessor(mpSci, mpSystem, mpFunctionCall, mpPhy, mpEthernet);
+}
+
+
+CoreEngine::~CoreEngine ( )
+{
+ logFunction();
+
+ if (NULL != mpNetworkClock)
+ {
+ delete (mpNetworkClock);
+ mpNetworkClock = NULL;
+ }
+ if (NULL != mpFunctionCall)
+ {
+ delete (mpFunctionCall);
+ mpFunctionCall = NULL;
+ }
+ if (NULL != mpSystem)
+ {
+ delete (mpSystem);
+ mpSystem = NULL;
+ }
+ if (NULL != mpPhy)
+ {
+ delete (mpPhy);
+ mpPhy = NULL;
+ }
+ if (NULL != mpSci)
+ {
+ delete (mpSci);
+ mpSci = NULL;
+ }
+ if (NULL != mpChannel)
+ {
+ delete (mpChannel);
+ mpChannel = NULL;
+ }
+ if (NULL != mpEthernet)
+ {
+ delete (mpEthernet);
+ mpEthernet = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool CoreEngine::init ( const std::string station_executable,
+ const std::string station_log,
+ const std::string debugger,
+ const float frequency )
+{
+ logFunction();
+ bool bInit = false;
+
+ // station executable and debugger
+ bInit = getSystem()->init(station_executable, debugger);
+
+ // station log file
+ bInit &= getSci()->init(station_log);
+
+ // frequency
+ bInit &= getPhy()->init(frequency);
+
+ return bInit;
+}
+
+
+bool CoreEngine::process ( const Network_Clock_Tick max_tick_value )
+{
+ logFunction();
+ bool bProcess = false;
+
+ if ( getNetworkClock()->processNextEvt(max_tick_value) )
+ {
+ bProcess = getSci()->process();
+ }
+
+ return bProcess;
+}
+
+
+bool CoreEngine::disturbChannel ( const bool enable )
+{
+ logFunction();
+
+ if (enable)
+ {
+ if (NULL == mpChannel)
+ {
+ mpChannel = new ChannelComputer(getPhy(), getSystem());
+ }
+
+ // Set beacon period to Channel
+ getChannel()->setBeaconPeriod(getPhy()->getFrequency());
+ }
+ if (NULL == mpChannel)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Channel pointer is NULL");
+ }
+
+ return getPhy()->setIsChannelEnabled(enable);
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+IFunctionCall * CoreEngine::getFunctionCall ( ) const
+{
+ if (NULL == mpFunctionCall)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Function Call pointer is NULL");
+ }
+
+ return mpFunctionCall;
+}
+
+
+ISystem * CoreEngine::getSystem ( ) const
+{
+ if (NULL == mpSystem)
+ {
+ throw Error(__PRETTY_FUNCTION__, "System pointer is NULL");
+ }
+
+ return mpSystem;
+}
+
+
+INetworkClock * CoreEngine::getNetworkClock ( ) const
+{
+ if (NULL == mpNetworkClock)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network Clock pointer is NULL");
+ }
+
+ return mpNetworkClock;
+}
+
+
+IPhy * CoreEngine::getPhy ( ) const
+{
+ if (NULL == mpPhy)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY pointer is NULL");
+ }
+
+ return mpPhy;
+}
+
+
+ISci * CoreEngine::getSci ( ) const
+{
+ if (NULL == mpSci)
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI pointer is NULL");
+ }
+
+ return mpSci;
+}
+
+
+IChannel * CoreEngine::getChannel ( ) const
+{
+ if (NULL == mpChannel)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Channel pointer is NULL");
+ }
+
+ return mpChannel;
+}
+
+
+IEthernet * CoreEngine::getEthernet ( ) const
+{
+ if (NULL == mpEthernet)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Ethernet pointer is NULL");
+ }
+
+ return mpEthernet;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/coreengine/src/CoreEngineTest.cpp b/cesar/maximus/coreengine/src/CoreEngineTest.cpp
new file mode 100644
index 0000000000..16193e8b6f
--- /dev/null
+++ b/cesar/maximus/coreengine/src/CoreEngineTest.cpp
@@ -0,0 +1,71 @@
+
+#include "CoreEngineTest.h"
+
+#include "CoreEngine.h"
+
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (CoreEngineTest);
+
+
+void CoreEngineTest::setUp (void)
+{
+ logTest();
+
+ mpCoreEngine = new CoreEngine ();
+}
+
+
+void CoreEngineTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpCoreEngine)
+ {
+ delete (mpCoreEngine);
+ mpCoreEngine = NULL;
+ }
+}
+
+
+void CoreEngineTest::initTest (void)
+{
+ logTest();
+
+ if (NULL != mpCoreEngine)
+ {
+ string stationExecutable("../stationtest/obj/stationtest.elf");
+ string stationLog("station_log");
+ string debugger("false");
+ unsigned short int frequency = 50;
+
+ CPPUNIT_ASSERT_MESSAGE("init failed",
+ (mpCoreEngine->init(stationExecutable, stationLog, debugger, frequency)));
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Core engine pointer is NULL");
+ }
+}
+
+
+void CoreEngineTest::disturbChannelTest (void)
+{
+ logTest();
+
+ if (NULL != mpCoreEngine)
+ {
+ mpCoreEngine->init("station_executable", "station_log", "debugger", 50);
+ CPPUNIT_ASSERT_MESSAGE("disturbChannel failed",
+ (mpCoreEngine->disturbChannel(true))
+ && (NULL != mpCoreEngine->getChannel()));
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Core engine pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/coreengine/src/Maximus.cpp b/cesar/maximus/coreengine/src/Maximus.cpp
new file mode 100644
index 0000000000..1686f3c811
--- /dev/null
+++ b/cesar/maximus/coreengine/src/Maximus.cpp
@@ -0,0 +1,1289 @@
+/************************************************************************
+ Maximus.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/coreengine/src/Maximus.cpp
+**************************************************************************/
+
+#include "Maximus.h"
+
+#include "Sta.h"
+#include "Msg.h"
+#include "CoreEngine.h"
+#include "ISystem.h"
+#include "IFunctionCall.h"
+#include "INetworkClock.h"
+#include "ISci.h"
+#include "IChannel.h"
+#include "PhySciMsgMpdu.h"
+#include "ChannelSettings.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <stdio.h> // for 'remove()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+#include <fstream> // for 'ifstream'
+#include <getopt.h> // for 'getopt_long()'
+#include <signal.h> // for 'signal()', 'SIGINT', 'raise()', 'SIGTERM'
+#include <algorithm> // for 'min()'
+using namespace std;
+
+// For unitary tests
+bool UNITTEST = false;
+string stationTest;
+
+// For Maximus log
+Logger logger(LOG_WARNING);
+
+// To catch signals
+Maximus * pMaximus;
+
+
+// Constructors/Destructors
+//
+
+
+Maximus::Maximus ( ):
+mpCoreEngine(NULL),
+mMaxTickValue(0),
+mWaitTickValue(0),
+mIsWireshark(false),
+mEtherLogFileDescriptor(-1)
+{
+ logFunction();
+
+ try
+ {
+ if (UNITTEST)
+ {
+ // For unitary tests log
+ logger.setLogLevel(LOG_DEBUG);
+ }
+
+ mpCoreEngine = new CoreEngine();
+ }
+ catchFunction(this);
+}
+
+
+Maximus::Maximus ( CoreEngine * p_core_engine ):
+mpCoreEngine(NULL),
+mMaxTickValue(0),
+mWaitTickValue(0)
+{
+ logFunction();
+
+ try
+ {
+ if (UNITTEST)
+ {
+ // For unitary tests log
+ logger.setLogLevel(LOG_DEBUG);
+
+ mpCoreEngine = p_core_engine;
+ }
+ else
+ {
+ errno = EBADRQC;
+ throw Error(__PRETTY_FUNCTION__, "FOR UNITARY TESTS ONLY", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+Maximus::~Maximus ( )
+{
+ logFunction();
+
+ stop();
+}
+
+
+//
+// Methods
+//
+
+
+// public methods
+
+
+void Maximus::init ( int argc, char * argv[] )
+{
+ logFunction();
+
+ try
+ {
+ // To catch signals
+ pMaximus = this;
+ signal(SIGINT, Maximus::wrapper);
+
+ struct option longOptions[] = {
+ {"station-executable", required_argument, 0, 'e'},
+ {"station-log", required_argument, 0, 's'},
+ {"maximus-log", required_argument, 0, 'm'},
+ {"log-level", required_argument, 0, 'l'},
+ {"max-tick-value", required_argument, 0, 't'},
+ {"debugger", required_argument, 0, 'd'},
+ {"frequency", required_argument, 0, 'f'},
+ {"wireshark", required_argument, 0, 'w'}
+ };
+ int optionIndex = 0;
+ int optionChar = 0;
+
+ // Station executable
+ string stationExecutable;
+ bool isStationExecutableSet = false;
+
+ // Station log
+ string stationLog("-");
+
+ // Maximus log
+ string maximusLog("maximus_log");
+
+ // Log level
+ int logLevel = LOG_WARNING;
+
+ // Debugger
+ string debugger("xterm -title '\"%n\" debug' -e gdb %e %p & sleep 1");
+
+ // Frequency
+ float frequency = 50; // in Hz
+
+ // Wireshark
+ string wireshark;
+
+ while (EOF != optionChar)
+ {
+ optionChar = getopt_long(argc, argv, "e:s:m:l:t:d:f:w:", longOptions, &optionIndex);
+
+ switch (optionChar)
+ {
+ case 'e':
+ clog << logger(LOG_INFO) << "station executable = " << optarg << endl;
+ stationExecutable = optarg;
+ isStationExecutableSet = true;
+ break;
+ case 's':
+ clog << logger(LOG_INFO) << "station log = " << optarg << endl;
+ stationLog = optarg;
+ break;
+ case 'm':
+ clog << logger(LOG_INFO) << "maximus log = " << optarg << endl;
+ maximusLog = optarg;
+ break;
+ case 'l':
+ clog << logger(LOG_INFO) << "log level = " << optarg << endl;
+ if ((LOG_DEBUG <= atoi(optarg)) && (LOG_NONE >= atoi(optarg)))
+ {
+ logLevel = atoi(optarg);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "usage: -l log_level with log_level in range from 0 to 6!" << endl;
+ clog << logger(LOG_ERROR) << "user value is not taken into account => apply default value!" << endl;
+ }
+ break;
+ case 't':
+ clog << logger(LOG_INFO) << "max tick value = " << optarg << endl;
+ setMaxTickValue(atoi(optarg));
+ break;
+ case 'd':
+ clog << logger(LOG_INFO) << "debugger = " << optarg << endl;
+ debugger = optarg;
+ break;
+ case 'f':
+ clog << logger(LOG_INFO) << "frequency = " << optarg << endl;
+ if ((50 == atof(optarg)) || (60 == atof(optarg)) || (0 == atof(optarg)))
+ {
+ frequency = atof(optarg);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "usage: -f frequency with frequency 50 or 60 Hz, or 0!" << endl;
+ clog << logger(LOG_ERROR) << "user value is not taken into account => apply default value (50 Hz)!" << endl;
+ }
+ break;
+ case 'w':
+ clog << logger(LOG_INFO) << "wireshark = " << optarg << endl;
+ wireshark = optarg;
+ if ( (0 == wireshark.compare("on"))
+ || (0 == wireshark.compare("On"))
+ || (0 == wireshark.compare("ON")) )
+ {
+ mIsWireshark = true;
+ }
+ else if ( (0 == wireshark.compare("off"))
+ || (0 == wireshark.compare("Off"))
+ || (0 == wireshark.compare("OFF")) )
+ {
+ mIsWireshark = false;
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "usage: -w wireshark with wireshark on or off!" << endl;
+ clog << logger(LOG_ERROR) << "user value is not taken into account => apply default value (off)!" << endl;
+ }
+ break;
+ case '?':
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Usage: -e station_executable [-s station_log -m maximus_log -l log_level -t max_tick_value -d debugger -f frequency -w wireshark]", errno);
+ break;
+ }
+ }
+
+ if (!isStationExecutableSet)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Usage: -e station_executable [-s station_log -m maximus_log -l log_level -t max_tick_value -d debugger -f frequency -w wireshark]", errno);
+ }
+
+ // Maximus log
+ if ( (!maximusLog.empty()) && (maximusLog.compare("-")) )
+ {
+ // In case of the file already exists, delete it
+ remove(maximusLog.c_str());
+
+ mMaximusLogFile.open(maximusLog.c_str(), ios_base::app | ios_base::out);
+ if (mMaximusLogFile.is_open())
+ {
+ clog << logger(LOG_INFO) << "Maximus logs will be output into " << maximusLog << endl;
+ logger.setLogFile(mMaximusLogFile);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "error while opening Maximus log file!" << endl;
+ clog << logger(LOG_ERROR) << "Maximus logs will be output on standard output!" << endl;
+ }
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "Maximus logs will be output on standard output!" << endl;
+ }
+
+ // Log level
+ logger.setLogLevel(logLevel);
+
+ mpCoreEngine->init(stationExecutable, stationLog, debugger, frequency);
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::init_phy ( PhyMpduCb interface_cb )
+{
+ logFunction();
+
+ try
+ {
+ if (!getPhyProcessor()->init(interface_cb))
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY initialization failed");
+ }
+ }
+ catchFunction(this);
+}
+
+
+File_Descriptor Maximus::init_ether ( EtherCb interface_cb )
+{
+ logFunction();
+
+ try
+ {
+ if (!getEthernet()->init(interface_cb))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Ethernet initialization failed");
+ }
+ if (isWireshark())
+ {
+ char dev[] = "tap10\0";
+ if (0 > (mEtherLogFileDescriptor = getEthernet()->allocTap(dev)))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Bad Ether log file descriptor", errno);
+ }
+ }
+ }
+ catchFunction(this);
+
+ return mEtherLogFileDescriptor;
+}
+
+
+void Maximus::process ( )
+{
+ logFunction();
+
+ try
+ {
+ Network_Clock_Tick tickValue = 0; // tick value until which to process
+
+ if (0 == getMaxTickValue())
+ {
+ tickValue = getWaitTickValue();
+ }
+ else if (0 != getWaitTickValue())
+ {
+ tickValue = min(getMaxTickValue(), getWaitTickValue());
+ }
+
+ getCoreEngine()->process(tickValue);
+
+ if (0 != getMaxTickValue())
+ {
+ if (getMaxTickValue() <= getNetworkClockProcessor()->getCurrentTickValue())
+ {
+ clog << logger(LOG_FATAL) << "Max tick value is reached!" << endl;
+ stop();
+ exit(1);
+ }
+ }
+ }
+ catchFunction(this);
+}
+
+
+Sta & Maximus::create_sta ( const string & station_executable )
+{
+ logFunction();
+ Sta * pSta = NULL;
+
+ try
+ {
+ if (!station_executable.empty())
+ {
+ pSta = new Sta(this, getSystemManager(), station_executable);
+ }
+ else
+ {
+ pSta = new Sta(this, getSystemManager(), getSystemManager()->getDefaultStationExecutable());
+ }
+ if (NULL == pSta)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Station pointer is NULL");
+ }
+ mListOfStas.push_back(pSta);
+
+ // If channel perturbation is enabled,
+ // inform the channel package that a new station has been created
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ getChannel()->addChannelSettings(pSta->getStationId());
+ }
+ }
+ catchFunction(this);
+
+ return *pSta;
+}
+
+
+Msg & Maximus::create_fc ( const string & name )
+{
+ logFunction();
+ Msg * pMsg = NULL;
+
+ try
+ {
+ pMsg = new Msg(this, getFunctionCallManager(), getSystemManager(), name);
+ if (NULL == pMsg)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Message pointer is NULL");
+ }
+ mListOfMsgs.push_back(pMsg);
+ }
+ catchFunction(this);
+
+ return *pMsg;
+}
+
+
+Msg & Maximus::create_probe ( )
+{
+ logFunction();
+ Msg * pMsg = NULL;
+
+ try
+ {
+ pMsg = new Msg(this, getFunctionCallManager(), getSystemManager());
+ if (NULL == pMsg)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Message pointer is NULL");
+ }
+ mListOfMsgs.push_back(pMsg);
+ }
+ catchFunction(this);
+
+ return *pMsg;
+}
+
+
+PhySciMsgMpdu * Maximus::create_mpdu ( )
+{
+ logFunction();
+
+ return getPhyProcessor()->createMpdu();
+}
+
+
+void Maximus::send_mpdu ( PhySciMsgMpdu * p_mpdu )
+{
+ logFunction();
+
+ try
+ {
+ if (NULL == p_mpdu)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message MPDU pointer is NULL", errno);
+ }
+ if (!getPhyProcessor()->sendMpdu(p_mpdu))
+ {
+ throw Error(__PRETTY_FUNCTION__, "MPDU has not been sent correctly", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+EtherSciMsg * Maximus::create_ether ( )
+{
+ logFunction();
+
+ return getEthernet()->createEther();
+}
+
+
+void Maximus::send_ether ( EtherSciMsg & ether )
+{
+ logFunction();
+
+ try
+ {
+ if (!getEthernet()->sendEther(ether))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Ethernet SCI message has not been sent correctly", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::wait ( const tick_t value )
+{
+ logFunction();
+
+ try
+ {
+ setWaitTickValue(getNetworkClockProcessor()->getCurrentTickValue() + value);
+ while (getWaitTickValue() > getNetworkClockProcessor()->getCurrentTickValue())
+ {
+ process();
+ }
+ setWaitTickValue(0);
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::wait ( )
+{
+ logFunction();
+
+ try
+ {
+ while ( (NULL != getFunctionCallManager()->getListOfCallbacks())
+ && (!getFunctionCallManager()->getListOfCallbacks()->empty()) )
+ {
+ process();
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::disturb_channel ( const bool enable )
+{
+ logFunction();
+
+ try
+ {
+ getCoreEngine()->disturbChannel(enable);
+ }
+ catchFunction(this);
+}
+
+
+const tick_t Maximus::get_date ( )
+{
+ logFunction();
+ tick_t date = 0;
+
+ try
+ {
+ date = getNetworkClockProcessor()->getCurrentTickValue();
+ }
+ catchFunction(this);
+
+ return date;
+}
+
+
+void Maximus::set_freq ( const float frequency )
+{
+ logFunction();
+
+ try
+ {
+ getPhyProcessor()->setFrequency(frequency);
+ }
+ catchFunction(this);
+}
+
+
+const float Maximus::get_freq ( )
+{
+ logFunction();
+ float frequency = 0;
+
+ try
+ {
+ frequency = getPhyProcessor()->getFrequency();
+ }
+ catchFunction(this);
+
+ return frequency;
+}
+
+
+void Maximus::set_snr ( const float snr_value )
+{
+ logFunction();
+
+ try
+ {
+ // If channel perturbation is enabled, set the SNR value
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ std::vector<ChannelSettings *> listOfChannelSettings = getChannel()->findChannelSettings(0 /* tx_station_id */, 0 /* rx_station_id */, false);
+ std::vector<ChannelSettings *>::size_type size = listOfChannelSettings.size();
+ for (std::vector<ChannelSettings *>::size_type s=0; s<size; s++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "A channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.back()->setSnr(snr_value);
+ }
+ listOfChannelSettings.pop_back();
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Channel perturbation is disabled", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::set_snr ( const string & snr_file )
+{
+ logFunction();
+
+ try
+ {
+ // Read the user SNR file
+ float snrArray[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1];
+ if (!readSnrFile(snr_file, snrArray))
+ {
+ for (int j=0; j<= PHY_CARRIER_NB; j++)
+ {
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ cerr << snrArray[i][j] << " ";
+ }
+ cerr << endl;
+ }
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Error while reading SNR file", errno);
+ }
+
+ // If channel perturbation is enabled, set the SNR values
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ std::vector<ChannelSettings *> listOfChannelSettings = getChannel()->findChannelSettings(0 /* tx_station_id */, 0 /* rx_station_id */, false);
+ std::vector<ChannelSettings *>::size_type size = listOfChannelSettings.size();
+ for (std::vector<ChannelSettings *>::size_type s=0; s<size; s++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "A channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.back()->setSnr(snrArray);
+ }
+ listOfChannelSettings.pop_back();
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Channel perturbation is disabled", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::set_snr_from_src ( const float snr_value, const Sta & src, const bool both_directions )
+{
+ logFunction();
+
+ try
+ {
+ // If channel perturbation is enabled, set the SNR value
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ std::vector<ChannelSettings *> listOfChannelSettings = getChannel()->findChannelSettings(src.getStationId() /* tx_station_id */, 0 /* rx_station_id */, both_directions);
+ std::vector<ChannelSettings *>::size_type size = listOfChannelSettings.size();
+ for (std::vector<ChannelSettings *>::size_type s=0; s<size; s++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "A channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.back()->setSnr(snr_value);
+ }
+ listOfChannelSettings.pop_back();
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Channel perturbation is disabled", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::set_snr_from_src ( const string & snr_file, const Sta & src, const bool both_directions )
+{
+ logFunction();
+
+ try
+ {
+ // Read the user SNR file
+ float snrArray[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1];
+ if (!readSnrFile(snr_file, snrArray))
+ {
+ for (int j=0; j<= PHY_CARRIER_NB; j++)
+ {
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ cerr << snrArray[i][j] << " ";
+ }
+ cerr << endl;
+ }
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Error while reading SNR file", errno);
+ }
+
+ // If channel perturbation is enabled, set the SNR values
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ std::vector<ChannelSettings *> listOfChannelSettings = getChannel()->findChannelSettings(src.getStationId() /* tx_station_id */, 0 /* rx_station_id */, both_directions);
+ std::vector<ChannelSettings *>::size_type size = listOfChannelSettings.size();
+ for (std::vector<ChannelSettings *>::size_type s=0; s<size; s++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "A channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.back()->setSnr(snrArray);
+ }
+ listOfChannelSettings.pop_back();
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Channel perturbation is disabled", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::set_snr_to_dst ( const float snr_value, const Sta & dst, const bool both_directions )
+{
+ logFunction();
+
+ try
+ {
+ // If channel perturbation is enabled, set the SNR value
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ std::vector<ChannelSettings *> listOfChannelSettings = getChannel()->findChannelSettings(0 /* tx_station_id */, dst.getStationId() /* rx_station_id */, both_directions);
+ std::vector<ChannelSettings *>::size_type size = listOfChannelSettings.size();
+ for (std::vector<ChannelSettings *>::size_type s=0; s<size; s++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "A channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.back()->setSnr(snr_value);
+ }
+ listOfChannelSettings.pop_back();
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Channel perturbation is disabled", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::set_snr_to_dst ( const string & snr_file, const Sta & dst, const bool both_directions )
+{
+ logFunction();
+
+ try
+ {
+ // Read the user SNR file
+ float snrArray[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1];
+ if (!readSnrFile(snr_file, snrArray))
+ {
+ for (int j=0; j<= PHY_CARRIER_NB; j++)
+ {
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ cerr << snrArray[i][j] << " ";
+ }
+ cerr << endl;
+ }
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Error while reading SNR file", errno);
+ }
+
+ // If channel perturbation is enabled, set the SNR values
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ std::vector<ChannelSettings *> listOfChannelSettings = getChannel()->findChannelSettings(0 /* tx_station_id */, dst.getStationId() /* rx_station_id */, both_directions);
+ std::vector<ChannelSettings *>::size_type size = listOfChannelSettings.size();
+ for (std::vector<ChannelSettings *>::size_type s=0; s<size; s++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "A channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.back()->setSnr(snrArray);
+ }
+ listOfChannelSettings.pop_back();
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Channel perturbation is disabled", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::set_snr_from_src_to_dst ( const float snr_value, const Sta & src, const Sta & dst, const bool both_directions )
+{
+ logFunction();
+
+ try
+ {
+ // If channel perturbation is enabled, set the SNR value
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ std::vector<ChannelSettings *> listOfChannelSettings = getChannel()->findChannelSettings(src.getStationId() /* tx_station_id */, dst.getStationId() /* rx_station_id */, both_directions);
+ std::vector<ChannelSettings *>::size_type size = listOfChannelSettings.size();
+ for (std::vector<ChannelSettings *>::size_type s=0; s<size; s++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "A channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.back()->setSnr(snr_value);
+ }
+ listOfChannelSettings.pop_back();
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Channel perturbation is disabled", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::set_snr_from_src_to_dst ( const string & snr_file, const Sta & src, const Sta & dst, const bool both_directions )
+{
+ logFunction();
+
+ try
+ {
+ float snrArray[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1];
+ if (!readSnrFile(snr_file, snrArray))
+ {
+ for (int j=0; j<= PHY_CARRIER_NB; j++)
+ {
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ cerr << snrArray[i][j] << " ";
+ }
+ cerr << endl;
+ }
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Error while reading SNR file", errno);
+ }
+
+ // If channel perturbation is enabled, set the SNR values
+ if (getPhyProcessor()->isChannelEnabled())
+ {
+ std::vector<ChannelSettings *> listOfChannelSettings = getChannel()->findChannelSettings(src.getStationId() /* tx_station_id */, dst.getStationId() /* rx_station_id */, both_directions);
+ std::vector<ChannelSettings *>::size_type size = listOfChannelSettings.size();
+ for (std::vector<ChannelSettings *>::size_type s=0; s<size; s++)
+ {
+ if (NULL == listOfChannelSettings.back())
+ {
+ throw Error(__PRETTY_FUNCTION__, "A channel settings pointer is NULL");
+ }
+ else
+ {
+ listOfChannelSettings.back()->setSnr(snrArray);
+ }
+ listOfChannelSettings.pop_back();
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Channel perturbation is disabled", errno);
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::activate_false_alarm ( const Network_Clock_Tick average_duration,
+ const float std_deviation )
+{
+ logFunction();
+
+ try
+ {
+ if (!getPhyProcessor()->activateFalseAlarm(average_duration, std_deviation))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Cannot activate false alarm");
+ }
+ }
+ catchFunction(this);
+}
+
+
+void Maximus::deactivate_false_alarm ( )
+{
+ logFunction();
+
+ try
+ {
+ if (!getPhyProcessor()->deactivateFalseAlarm())
+ {
+ throw Error(__PRETTY_FUNCTION__, "Cannot deactivate false alarm");
+ }
+ }
+ catchFunction(this);
+}
+
+
+const bool Maximus::is_station_idle ( Sci_Msg_Station_Id station_id )
+{
+ logFunction();
+ bool isIdle = false;
+
+ try
+ {
+ isIdle = getSystemManager()->isStationIdle(station_id);
+ }
+ catchFunction(this);
+
+ return isIdle;
+}
+
+
+// private methods
+//
+
+
+CoreEngine * Maximus::getCoreEngine ( )
+{
+ try
+ {
+ if (NULL == mpCoreEngine)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Core engine pointer is NULL");
+ }
+ }
+ catchFunction(this);
+
+ return mpCoreEngine;
+}
+
+
+ISystem * Maximus::getSystemManager ( )
+{
+ ISystem * pSystemManager = NULL;
+
+ try
+ {
+ if ( NULL == (pSystemManager = getCoreEngine()->getSystem()) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "System manager pointer is NULL");
+ }
+ }
+ catchFunction(this);
+
+ return pSystemManager;
+}
+
+
+IFunctionCall * Maximus::getFunctionCallManager ( )
+{
+ IFunctionCall * pFunctionCallManager = NULL;
+
+ try
+ {
+ if ( NULL == (pFunctionCallManager = getCoreEngine()->getFunctionCall()) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "Function call manager pointer is NULL");
+ }
+ }
+ catchFunction(this);
+
+ return pFunctionCallManager;
+}
+
+
+INetworkClock * Maximus::getNetworkClockProcessor ( )
+{
+ INetworkClock * pNetworkClockProcessor = NULL;
+
+ try
+ {
+ if ( NULL == (pNetworkClockProcessor = getCoreEngine()->getNetworkClock()) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network clock processor pointer is NULL");
+ }
+ }
+ catchFunction(this);
+
+ return pNetworkClockProcessor;
+}
+
+
+IPhy * Maximus::getPhyProcessor ( )
+{
+ IPhy * pPhyProcessor = NULL;
+
+ try
+ {
+ if ( NULL == (pPhyProcessor = getCoreEngine()->getPhy()) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "Phy processor pointer is NULL");
+ }
+ }
+ catchFunction(this);
+
+ return pPhyProcessor;
+}
+
+
+ISci * Maximus::getSciServer ( )
+{
+ ISci * pSciServer = NULL;
+
+ try
+ {
+ if ( NULL == (pSciServer = getCoreEngine()->getSci()) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+ }
+ catchFunction(this);
+
+ return pSciServer;
+}
+
+
+IChannel * Maximus::getChannel ( )
+{
+ IChannel * pChannel = NULL;
+
+ try
+ {
+ if ( NULL == (pChannel = getCoreEngine()->getChannel()) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "Channel pointer is NULL");
+ }
+ }
+ catchFunction(this);
+
+ return pChannel;
+}
+
+
+IEthernet * Maximus::getEthernet ( )
+{
+ IEthernet * pEthernet = NULL;
+
+ try
+ {
+ if ( NULL == (pEthernet = getCoreEngine()->getEthernet()) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "Ethernet pointer is NULL");
+ }
+ }
+ catchFunction(this);
+
+ return pEthernet;
+}
+
+
+Network_Clock_Tick Maximus::getMaxTickValue ( ) const
+{
+ return mMaxTickValue;
+}
+
+
+bool Maximus::setMaxTickValue ( const Network_Clock_Tick max_tick_value )
+{
+ mMaxTickValue = max_tick_value;
+
+ return true;
+}
+
+
+Network_Clock_Tick Maximus::getWaitTickValue ( ) const
+{
+ return mWaitTickValue;
+}
+
+
+bool Maximus::setWaitTickValue ( const Network_Clock_Tick wait_tick_value )
+{
+ mWaitTickValue = wait_tick_value;
+
+ return true;
+}
+
+
+bool Maximus::readSnrFile ( const string & snr_file, float snr_array[MAXIMUS_CHANNEL_INTERVAL_MAX_NB][PHY_CARRIER_NB + 1] )
+{
+ logFunction();
+ bool bRead = true;
+
+ try
+ {
+ // Read file
+ //
+ memset(snr_array, '\0', MAXIMUS_CHANNEL_INTERVAL_MAX_NB * (PHY_CARRIER_NB + 1) * sizeof(float));
+ ifstream snrFile(snr_file.c_str(), ifstream::in);
+ if (snrFile.is_open())
+ {
+ /* Read end times (in ticks) of each interval of the beacon period. */
+ char c;
+ float tempEndTimeOfLastInterval = (2 * 1000000) / (getPhyProcessor()->getFrequency());
+ unsigned short int endTimeOfLastInterval = (unsigned short int)tempEndTimeOfLastInterval;
+ unsigned short int numberOfIntervals = MAXIMUS_CHANNEL_INTERVAL_MAX_NB;
+ for (int i=0; i<MAXIMUS_CHANNEL_INTERVAL_MAX_NB; i++)
+ {
+ snrFile >> snr_array[i][0];
+ if (endTimeOfLastInterval <= snr_array[i][0])
+ {
+ snr_array[i][0] = endTimeOfLastInterval;
+ numberOfIntervals = i + 1;
+ break;
+ }
+ c = snrFile.peek();
+ while ( ('\t' == c) || (' ' == c) || (EOF == c) )
+ {
+ snrFile.ignore();
+ c = snrFile.peek();
+ }
+ if ('#' == c)
+ {
+ while ( ('\n' != c) && (EOF != c) )
+ {
+ snrFile.ignore();
+ c = snrFile.peek();
+ }
+ }
+ if ('\n' == c)
+ {
+ snrFile.ignore();
+ numberOfIntervals = i + 1;
+ if (endTimeOfLastInterval != snr_array[i][0])
+ {
+ if (MAXIMUS_CHANNEL_INTERVAL_MAX_NB > i+1)
+ {
+ snr_array[i+1][0] = endTimeOfLastInterval;
+ numberOfIntervals++;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Too many time intervals in SNR file", errno);
+ }
+ }
+ break;
+ }
+ }
+
+ /* Read SNR values (in dB) for each carrier. */
+ for (int j=1; j<=PHY_CARRIER_NB; j++)
+ {
+ for (int i=0; i<numberOfIntervals; i++)
+ {
+ snrFile >> snr_array[i][j];
+ }
+ c = snrFile.peek();
+ while ( ('\n' != c) && (EOF != c) )
+ {
+ snrFile.ignore();
+ c = snrFile.peek();
+ }
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Error while opening SNR file", errno);
+ }
+ snrFile.close();
+ }
+ catchFunction(this);
+
+ return bRead;
+}
+
+
+const bool Maximus::isWireshark ( ) const
+{
+ return mIsWireshark;
+}
+
+
+// public methods
+//
+
+
+void Maximus::wrapper ( int n )
+{
+ logFunction();
+
+ if (NULL != pMaximus)
+ {
+ clog << logger(LOG_FATAL) << "Catch CTRL+C!" << endl;
+ pMaximus->stop();
+ raise(SIGTERM);
+ }
+}
+
+
+void Maximus::stop ( )
+{
+ logFunction();
+ unsigned int counter = 0;
+
+ clog << logger(LOG_FATAL) << "*** Exit Fulminata Maximus simulator ***" << endl;
+
+ for (unsigned int i=0; i<mListOfMsgs.size(); i++)
+ {
+ if (NULL != mListOfMsgs[i])
+ {
+ delete (mListOfMsgs[i]);
+ counter ++;
+ }
+ }
+ mListOfMsgs.clear();
+ clog << logger(LOG_FATAL) << "delete " << counter << " messages" << endl;
+ counter = 0;
+
+ for (unsigned int i=0; i<mListOfStas.size(); i++)
+ {
+ if (NULL != mListOfStas[i])
+ {
+ delete (mListOfStas[i]);
+ counter++;
+ }
+ }
+ mListOfStas.clear();
+ clog << logger(LOG_FATAL) << "delete " << counter << " stations" << endl;
+
+ if (mMaximusLogFile.is_open())
+ {
+ mMaximusLogFile.flush();
+ mMaximusLogFile.close();
+ }
+
+ if (0 <= mEtherLogFileDescriptor)
+ {
+ close(mEtherLogFileDescriptor);
+ }
+
+ // Warning: delete the Core Engine is the last task to do!
+ if (NULL != mpCoreEngine)
+ {
+ delete mpCoreEngine;
+ mpCoreEngine = NULL;
+ }
+}
+
diff --git a/cesar/maximus/coreengine/src/MaximusTest.cpp b/cesar/maximus/coreengine/src/MaximusTest.cpp
new file mode 100644
index 0000000000..f308081266
--- /dev/null
+++ b/cesar/maximus/coreengine/src/MaximusTest.cpp
@@ -0,0 +1,445 @@
+
+#include "MaximusTest.h"
+
+#include "Maximus.h"
+#include "Msg.h"
+#include "Sta.h"
+#include "PhySciMsgPre.h"
+#include "PhySciMsgFc.h"
+#include "PhySciMsgMpdu.h"
+#include "EtherSciMsg.h"
+
+#include "Logger.h"
+
+#include "functioncall_types.h" // for 'PROBE_ID'
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (MaximusTest);
+
+void phyCb (PhySciMsg & phy_sci_msg)
+{
+
+}
+
+void etherCb (EtherSciMsg & ether_sci_msg)
+{
+
+}
+
+
+void MaximusTest::setUp (void)
+{
+ logTest();
+
+ mpMaximus = new Maximus ();
+}
+
+
+void MaximusTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ delete (mpMaximus);
+ mpMaximus = NULL;
+ }
+}
+
+
+void MaximusTest::init_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ //mpMaximus->init(argc, argv);
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::init_phy_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ mpMaximus->init_phy(&phyCb);
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::init_ether_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "init_ether failed",
+ -1 == mpMaximus->init_ether(&etherCb) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::process_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ mpMaximus->process();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::create_sta_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ Sta sta = mpMaximus->create_sta();
+
+ CPPUNIT_ASSERT_MESSAGE ( "create_sta failed",
+ 0 != sta.getStationId() );
+
+ sta.remove();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::create_fc_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ Msg msg = mpMaximus->create_fc("function");
+
+ CPPUNIT_ASSERT_MESSAGE ( "create_fc failed",
+ 0 != msg.get_tx_msg_id() );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::create_probe_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ Msg msg = mpMaximus->create_probe();
+
+ CPPUNIT_ASSERT_MESSAGE ( "create_probe failed",
+ 0 != msg.get_tx_msg_id() );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::create_mpdu_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ PhySciMsgMpdu * pMpdu = mpMaximus->create_mpdu();
+
+ CPPUNIT_ASSERT_MESSAGE ( "create_mpdu failed",
+ NULL != pMpdu );
+
+ delete (pMpdu);
+ pMpdu = NULL;
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::send_mpdu_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ // create MPDU
+ PhySciMsgMpdu * pMpdu = mpMaximus->create_mpdu();
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message MPDU pointer is NULL", NULL != pMpdu );
+
+ /* Configure MPDU. */
+ unsigned long length = 5;
+ unsigned char payload[length];
+ memset(payload, 'P', length);
+
+ pMpdu->setMpdu(length, payload);
+
+ // create the transmitting station
+ Sta staTx = mpMaximus->create_sta();
+
+ // create the destination station
+ Sta staRx = mpMaximus->create_sta();
+
+ // set the destination station
+ pMpdu->setSciMsgStationId(staRx.getStationId());
+
+ // set FC
+ uint32_t fc_av[4];
+ memset(fc_av, 'A', 4*sizeof(uint32_t));
+ uint32_t fc_10 = 10;
+ pMpdu->setFc10(fc_10);
+ pMpdu->setFcAv(fc_av);
+
+ // set FC mode
+ pMpdu->setFcMode(PHY_FC_MODE_HYBRID_1);
+
+ // set short PPDU
+ pMpdu->setShortPpdu(1);
+
+ mpMaximus->send_mpdu(pMpdu);
+
+ while (!pMpdu->isSent() && !pMpdu->getFc()->isSent())
+ {
+ mpMaximus->process();
+ }
+
+ if (NULL != pMpdu)
+ {
+ delete (pMpdu);
+ pMpdu = NULL;
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::create_ether_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ EtherSciMsg * pEther = mpMaximus->create_ether();
+
+ CPPUNIT_ASSERT_MESSAGE ( "create_ether failed", NULL != pEther );
+
+ delete (pEther);
+ pEther = NULL;
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::send_ether_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ // create Ether SCI message
+ EtherSciMsg * pEtherSciMsg = mpMaximus->create_ether();
+
+ // create the destination station
+ Sta staRx = mpMaximus->create_sta();
+ mpMaximus->wait(5);
+
+ /* Configure Ether SCI message. */
+ pEtherSciMsg->setSpecializedSciMsgType(ETHERNET_TYPE_DATA);
+ unsigned long length = 5;
+ unsigned char payload[length];
+ memset(payload, 'E', length);
+ pEtherSciMsg->setSpecializedSciMsgDataLength(length);
+ pEtherSciMsg->setSpecializedSciMsgData(payload);
+ pEtherSciMsg->setSciMsgStationId(staRx.getStationId());
+
+ // send Ether SCI message
+ mpMaximus->send_ether(*pEtherSciMsg);
+
+ // remove the destination station
+ staRx.remove();
+
+ if (NULL != pEtherSciMsg)
+ {
+ delete (pEtherSciMsg);
+ pEtherSciMsg = NULL;
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::wait_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ Sta sta = mpMaximus->create_sta();
+ mpMaximus->wait(10);
+ mpMaximus->wait();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::disturb_channel_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ //mpMaximus->disturb_channel();
+ //mpMaximus->disturb_channel(false);
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::get_date_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ tick_t date = mpMaximus->get_date();
+ tick_t offset = 100;
+ Sta sta = mpMaximus->create_sta();
+ mpMaximus->wait(offset);
+ CPPUNIT_ASSERT_MESSAGE ( "get_date failed", date + offset == mpMaximus->get_date() );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::set_freq_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ Sta sta = mpMaximus->create_sta();
+
+ float freq = 0;
+ mpMaximus->set_freq(freq);
+ CPPUNIT_ASSERT_MESSAGE ( "set_freq failed", freq == mpMaximus->get_freq() );
+ mpMaximus->wait(100000);
+
+ sta.remove();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::activate_false_alarm_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ Sta sta = mpMaximus->create_sta();
+
+ Network_Clock_Tick averageDuration = 10;
+ float stdDeviation = 0.1;
+ mpMaximus->activate_false_alarm(averageDuration, stdDeviation);
+ mpMaximus->wait(2*averageDuration);
+
+ sta.remove();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::deactivate_false_alarm_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ Sta sta = mpMaximus->create_sta();
+
+ mpMaximus->deactivate_false_alarm();
+ mpMaximus->wait(1000);
+
+ sta.remove();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
+
+void MaximusTest::is_station_idle_test (void)
+{
+ logTest();
+
+ if (NULL != mpMaximus)
+ {
+ Sta sta = mpMaximus->create_sta();
+
+ CPPUNIT_ASSERT_MESSAGE ( "is_station_idle failed", !mpMaximus->is_station_idle(sta.getStationId()) );
+ mpMaximus->wait(1);
+ CPPUNIT_ASSERT_MESSAGE ( "is_station_idle failed", mpMaximus->is_station_idle(sta.getStationId()) );
+
+ sta.remove();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Maximus pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/coreengine/src/Msg.cpp b/cesar/maximus/coreengine/src/Msg.cpp
new file mode 100644
index 0000000000..159f4f2f03
--- /dev/null
+++ b/cesar/maximus/coreengine/src/Msg.cpp
@@ -0,0 +1,545 @@
+/************************************************************************
+ Msg.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/coreengine/src/Msg.cpp
+**************************************************************************/
+
+#include "Msg.h"
+
+#include "Sta.h"
+#include "IFunctionCall.h"
+#include "Maximus.h"
+#include "ISystem.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <boost/bind.hpp> // for 'boost::bind()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+Msg::Msg ( Maximus * p_maximus,
+ IFunctionCall * p_function_call_manager,
+ ISystem * p_system_manager,
+ const string & name ):
+mpMaximus(NULL),
+mpFunctionCallManager(NULL),
+mpSystemManager(NULL),
+mCallback(NULL),
+mpFunctionSciMsg(NULL),
+mResponseReceived(false)
+{
+ logFunction();
+
+ if ( (NULL != p_maximus)
+ && (NULL != p_function_call_manager)
+ && (NULL != p_system_manager) )
+ {
+ mpMaximus = p_maximus;
+ mpFunctionCallManager = p_function_call_manager;
+ mpSystemManager = p_system_manager;
+ mpFunctionSciMsg = getFunctionCallManager()->createMsg();
+ getFunctionSciMsg()->incrementSpecializedSciMsgId(); // to have an updated msg id
+ getFunctionSciMsg()->setFunctionName(name);
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Maximus, function call manager and/or system manager pointer(s) is/are NULL", errno);
+ }
+}
+
+
+Msg::Msg ( const Msg & msg ):
+mpMaximus(NULL),
+mpFunctionCallManager(NULL),
+mpSystemManager(NULL),
+mCallback(NULL),
+mpFunctionSciMsg(NULL),
+mResponseReceived(false)
+{
+ logFunction();
+
+ mpMaximus = msg.getMaximus();
+ mpFunctionCallManager = msg.getFunctionCallManager();
+ mpSystemManager = msg.getSystemManager();
+ mpFunctionSciMsg = getFunctionCallManager()->createMsg();
+ getFunctionSciMsg()->setFunctionName(msg.getFunctionSciMsg()->getFunctionName());
+ getFunctionSciMsg()->setListOfParameters(msg.getFunctionSciMsg()->getListOfParameters());
+ getFunctionSciMsg()->setSciMsgStationId(msg.getFunctionSciMsg()->getSciMsgStationId());
+ setCallback(msg.getCallback());
+ setResponseReceived(msg.isResponseReceived());
+}
+
+
+Msg::~Msg ( )
+{
+ logFunction();
+
+ if (NULL != mpMaximus)
+ {
+ mpMaximus = NULL;
+ }
+ if (NULL != mpFunctionCallManager)
+ {
+ mpFunctionCallManager = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ mpSystemManager = NULL;
+ }
+ if (NULL != mpFunctionSciMsg)
+ {
+ delete(mpFunctionSciMsg);
+ mpFunctionSciMsg = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// public methods
+//
+
+
+Msg & Msg::operator= ( const Msg & msg )
+{
+ logFunction();
+
+ try
+ {
+ mpMaximus = msg.getMaximus();
+ mpFunctionCallManager = msg.getFunctionCallManager();
+ mpSystemManager = msg.getSystemManager();
+ mpFunctionSciMsg = getFunctionCallManager()->createMsg();
+ getFunctionSciMsg()->setFunctionName(msg.getFunctionSciMsg()->getFunctionName());
+ getFunctionSciMsg()->setListOfParameters(msg.getFunctionSciMsg()->getListOfParameters());
+ getFunctionSciMsg()->setSciMsgStationId(msg.getFunctionSciMsg()->getSciMsgStationId());
+ setCallback(msg.getCallback());
+ setResponseReceived(msg.isResponseReceived());
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+Msg & Msg::add_param ( const string & name )
+{
+ logFunction();
+
+ try
+ {
+ getFunctionSciMsg()->addParameter(FunctionCallParameter(name, 0, NULL));
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+Msg & Msg::add_param ( const string & name, const unsigned long length, const unsigned char * p_value )
+{
+ logFunction();
+
+ try
+ {
+ if ( FUNCTION_CALL_PARAM_MAX_SIZE >= length)
+ {
+ getFunctionSciMsg()->addParameter(FunctionCallParameter(name, length, const_cast<unsigned char *>(p_value)));
+ }
+ else
+ {
+ errno = EMSGSIZE;
+ throw Error(__PRETTY_FUNCTION__, "Length of parameter value exceeds max size", errno);
+ }
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+Msg & Msg::add_param ( const string & name, const string & value )
+{
+ logFunction();
+
+ try
+ {
+ if ( FUNCTION_CALL_PARAM_MAX_SIZE >= value.length()+1)
+ {
+ getFunctionSciMsg()->addParameter(FunctionCallParameter(name, value.length()+1, (unsigned char *)value.c_str()));
+ }
+ else
+ {
+ errno = EMSGSIZE;
+ throw Error(__PRETTY_FUNCTION__, "Length of parameter value exceeds max size", errno);
+ }
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+Msg & Msg::remove_param ( const string & name )
+{
+ logFunction();
+
+ try
+ {
+ getFunctionSciMsg()->removeParameter(name);
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+Msg & Msg::set_cb ( const cb_t & user_cb )
+{
+ logFunction();
+
+ try
+ {
+ mCallback = user_cb;
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+Msg & Msg::remove_cb ( )
+{
+ logFunction();
+
+ try
+ {
+ mCallback = NULL;
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+Msg & Msg::set_sta ( Sta & sta )
+{
+ logFunction();
+
+ try
+ {
+ getFunctionSciMsg()->setSciMsgStationId(sta.getStationId());
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+void Msg::send_async ( )
+{
+ logFunction();
+
+ try
+ {
+ // Register callback and send message
+ getFunctionCallManager()->registerCallback( getFunctionSciMsg()->getSpecializedSciMsgId(),
+ (boost::bind(&Msg::receiveAsynchronousResponse, this, _1)) );
+ while(!getSystemManager()->isStationIdle(getFunctionSciMsg()->getSciMsgStationId()))
+ {
+ getMaximus()->process();
+ }
+ getFunctionCallManager()->sendMsg(getFunctionSciMsg());
+ }
+ catchFunction(getMaximus());
+}
+
+
+void Msg::send_async ( Sta & sta )
+{
+ logFunction();
+
+ try
+ {
+ set_sta(sta);
+ send_async();
+ }
+ catchFunction(getMaximus());
+}
+
+
+Msg & Msg::send ( )
+{
+ logFunction();
+
+ try
+ {
+ // Register callback and send message
+ getFunctionCallManager()->registerCallback( getFunctionSciMsg()->getSpecializedSciMsgId(),
+ (boost::bind(&Msg::receiveResponse, this, _1)) );
+ while(!getSystemManager()->isStationIdle(getFunctionSciMsg()->getSciMsgStationId()))
+ {
+ getMaximus()->process();
+ }
+ getFunctionCallManager()->sendMsg(getFunctionSciMsg());
+
+ // Wait for response
+ while(!isResponseReceived())
+ {
+ getMaximus()->process();
+ }
+ setResponseReceived(false);
+ if (NULL != getCallback())
+ {
+ getCallback()(*this);
+ }
+ }
+ catchFunction(getMaximus());
+
+ return *this;
+}
+
+
+Msg & Msg::send ( Sta & sta )
+{
+ logFunction();
+
+ try
+ {
+ set_sta(sta);
+ }
+ catchFunction(getMaximus());
+
+ return send();
+}
+
+
+bool Msg::is_param ( const string & name ) const
+{
+ logFunction();
+ bool bIsParam;
+
+ try
+ {
+ unsigned long length = FUNCTION_CALL_PARAM_MAX_SIZE; /* max size of 1 parameter */
+ unsigned char * pParam = new unsigned char [length];
+ bIsParam = (NULL != bind_param(name, length, pParam));
+ if (NULL != pParam)
+ {
+ delete [] pParam;
+ pParam = NULL;
+ }
+ }
+ catchFunction(getMaximus());
+
+ return bIsParam;
+}
+
+
+unsigned char * Msg::bind_param ( const string & name, unsigned long & length, unsigned char * p_data ) const
+{
+ logFunction();
+ unsigned char * pData = NULL; // parameter not found => return NULL
+
+ try
+ {
+ if (getFunctionSciMsg()->bindParameter(name, length, p_data))
+ {
+ // Parameter found => return p_data
+ pData = p_data;
+ }
+ }
+ catchFunction(getMaximus());
+
+ return pData;
+}
+
+
+Function_Call_Msg_Id Msg::get_tx_msg_id ( ) const
+{
+ return getFunctionSciMsg()->getSpecializedSciMsgId();
+}
+
+
+Function_Call_Msg_Id Msg::get_rx_msg_id ( ) const
+{
+ return getFunctionSciMsg()->getSpecializedSciMsgHeader().msg_id;
+}
+
+
+// private methods
+//
+
+
+// private attributes accessor methods
+//
+
+
+Maximus * Msg::getMaximus ( ) const
+{
+ if (NULL == mpMaximus)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Maximus pointer is NULL");
+ }
+
+ return mpMaximus;
+}
+
+
+IFunctionCall * Msg::getFunctionCallManager ( ) const
+{
+ try
+ {
+ if (NULL == mpFunctionCallManager)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Function call manager pointer is NULL");
+ }
+ }
+ catchFunction(getMaximus());
+
+ return mpFunctionCallManager;
+}
+
+
+ISystem * Msg::getSystemManager ( ) const
+{
+ try
+ {
+ if (NULL == mpSystemManager)
+ {
+ throw Error(__PRETTY_FUNCTION__, "System manager pointer is NULL");
+ }
+ }
+ catchFunction(getMaximus());
+
+ return mpSystemManager;
+}
+
+
+cb_t Msg::getCallback ( ) const
+{
+ return mCallback;
+}
+
+
+bool Msg::setCallback ( const cb_t callback )
+{
+ mCallback = callback;
+
+ return true;
+}
+
+
+FunctionSciMsg * Msg::getFunctionSciMsg ( ) const
+{
+ try
+ {
+ if (NULL == mpFunctionSciMsg)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Function SCI message pointer is NULL");
+ }
+ }
+ catchFunction(getMaximus());
+
+ return mpFunctionSciMsg;
+}
+
+
+bool Msg::setFunctionSciMsg ( const FunctionSciMsg & function_sci_msg )
+{
+ try
+ {
+ // If a function message had already been created, delete it before setting the new one
+ if (NULL != mpFunctionSciMsg)
+ {
+ delete (mpFunctionSciMsg);
+ mpFunctionSciMsg = NULL;
+ }
+ mpFunctionSciMsg = new FunctionSciMsg(function_sci_msg);
+ }
+ catchFunction(getMaximus());
+
+ return true;
+}
+
+
+bool Msg::isResponseReceived ( ) const
+{
+ return mResponseReceived;
+}
+
+
+bool Msg::setResponseReceived ( const bool response_received )
+{
+ mResponseReceived = response_received;
+
+ return true;
+}
+
+
+// public methods
+//
+
+
+void Msg::receiveResponse ( const FunctionSciMsg & function_sci_msg )
+{
+ logFunction();
+
+ try
+ {
+ setFunctionSciMsg(function_sci_msg);
+ setResponseReceived(true);
+ }
+ catchFunction(getMaximus());
+}
+
+
+void Msg::receiveAsynchronousResponse ( const FunctionSciMsg & function_sci_msg )
+{
+ logFunction();
+
+ try
+ {
+ setFunctionSciMsg(function_sci_msg);
+ if (NULL != getCallback())
+ {
+ getCallback()(*this);
+ }
+ }
+ catchFunction(getMaximus());
+}
+
diff --git a/cesar/maximus/coreengine/src/MsgTest.cpp b/cesar/maximus/coreengine/src/MsgTest.cpp
new file mode 100644
index 0000000000..9b5cc048f6
--- /dev/null
+++ b/cesar/maximus/coreengine/src/MsgTest.cpp
@@ -0,0 +1,302 @@
+
+#include "MsgTest.h"
+
+#include "Msg.h"
+#include "Maximus.h"
+#include "FunctionSciMsg.h"
+#include "FunctionCallParameter.h"
+#include "Sta.h"
+#include "CoreEngine.h"
+
+#include "system_types.h" // for 'MAXIMUS_STATION_STATUS_IDLE'
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (MsgTest);
+
+void callback1 (Msg & msg)
+{
+ logTest();
+}
+
+void callback2 (Msg & msg)
+{
+ logTest();
+}
+
+
+void MsgTest::setUp (void)
+{
+ logTest();
+
+ mpCoreEngine = new CoreEngine();
+ mpMaximus = new Maximus(mpCoreEngine);
+ mpMsg = new Msg(mpMaximus, mpCoreEngine->getFunctionCall(), mpCoreEngine->getSystem());
+}
+
+
+void MsgTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ delete (mpMsg);
+ mpMsg = NULL;
+ }
+ if (NULL != mpMaximus)
+ {
+ delete (mpMaximus);
+ mpMaximus = NULL;
+ }
+ mpCoreEngine = NULL;
+}
+
+
+void MsgTest::add_param_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ mpMsg->add_param("name");
+ mpMsg->add_param("unsigned char *", 6, (unsigned char *)"hello\0");
+ string str("hello");
+ mpMsg->add_param("string", str);
+ mpMsg->add_param<int>("<int>", 123);
+ unsigned int i = 456;
+ mpMsg->add_param("<unsigned int>", i);
+ mpMsg->add_param<bool>("<bool>", true);
+
+ CPPUNIT_ASSERT_MESSAGE ( "add_param failed",
+ (mpMsg->is_param("name"))
+ && (mpMsg->is_param("unsigned char *"))
+ && (mpMsg->is_param("string"))
+ && (mpMsg->is_param("<int>"))
+ && (mpMsg->is_param("<unsigned int>"))
+ && (mpMsg->is_param("<bool>")) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::remove_param_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ mpMsg->add_param("name");
+ mpMsg->remove_param("name");
+
+ CPPUNIT_ASSERT_MESSAGE ( "remove_param failed",
+ !mpMsg->is_param("name") );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::set_cb_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ mpMsg->set_cb(&callback1);
+ mpMsg->set_cb(&callback2);
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::remove_cb_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ mpMsg->set_cb(&callback1);
+ mpMsg->remove_cb();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::set_sta_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ Sta sta1 = mpMaximus->create_sta();
+ Sta sta2 = mpMaximus->create_sta();
+ mpMsg->set_sta(sta1);
+ mpMsg->set_sta(sta2);
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::send_async_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ Sta sta = mpMaximus->create_sta();
+ mpMsg->send_async(sta);
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::send_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ Sta sta = mpMaximus->create_sta();
+ mpMsg->send(sta);
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::is_param_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ mpMsg->add_param("name");
+
+ CPPUNIT_ASSERT_MESSAGE ( "is_param failed",
+ mpMsg->is_param("name") );
+
+ mpMsg->remove_param("name");
+
+ CPPUNIT_ASSERT_MESSAGE ( "is_param failed",
+ !mpMsg->is_param("name") );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::bind_param_test (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ string str("hello");
+ mpMsg->add_param("string", str);
+ mpMsg->add_param<int>("int", 123);
+ mpMsg->add_param<bool>("false", false);
+ mpMsg->add_param<bool>("true", true);
+
+ unsigned long length = str.length();
+ unsigned char * pParam = new unsigned char [length];
+ int i = mpMsg->bind_param<int>("int");
+ bool bFalse = mpMsg->bind_param<bool>("false");
+ bool bTrue = mpMsg->bind_param<bool>("true");
+
+ CPPUNIT_ASSERT_MESSAGE ( "bind_param failed",
+ (NULL != mpMsg->bind_param("string", length, pParam))
+ && (0 == memcmp(pParam, str.c_str(), str.length()))
+ && (mpMsg->is_param("int"))
+ && (123 == i)
+ && (mpMsg->is_param("false"))
+ && !bFalse
+ && (mpMsg->is_param("true"))
+ && bTrue );
+
+ if (NULL != pParam)
+ {
+ delete [] pParam;
+ pParam = NULL;
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::receiveResponseTest (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ FunctionSciMsg * pFunctionSciMsg = new FunctionSciMsg(mpCoreEngine->getFunctionCall());
+ pFunctionSciMsg->addParameter(FunctionCallParameter("name", 6, (unsigned char *)"hello\0"));
+ mpMsg->receiveResponse(*pFunctionSciMsg);
+
+ CPPUNIT_ASSERT_MESSAGE ( "receiveResponse failed",
+ mpMsg->is_param("name") );
+
+ if (NULL != pFunctionSciMsg)
+ {
+ delete(pFunctionSciMsg);
+ pFunctionSciMsg = NULL;
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
+
+void MsgTest::receiveAsynchronousResponseTest (void)
+{
+ logTest();
+
+ if (NULL != mpMsg)
+ {
+ FunctionSciMsg * pFunctionSciMsg = new FunctionSciMsg(mpCoreEngine->getFunctionCall());
+ pFunctionSciMsg->addParameter(FunctionCallParameter("name", 6, (unsigned char *)"hello\0"));
+ mpMsg->receiveAsynchronousResponse(*pFunctionSciMsg);
+
+ CPPUNIT_ASSERT_MESSAGE ( "receiveAsynchronousResponse failed",
+ mpMsg->is_param("name") );
+
+ if (NULL != pFunctionSciMsg)
+ {
+ delete(pFunctionSciMsg);
+ pFunctionSciMsg = NULL;
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Msg pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/coreengine/src/Sta.cpp b/cesar/maximus/coreengine/src/Sta.cpp
new file mode 100644
index 0000000000..d90653b66f
--- /dev/null
+++ b/cesar/maximus/coreengine/src/Sta.cpp
@@ -0,0 +1,262 @@
+/************************************************************************
+ Sta.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/coreengine/src/Sta.cpp
+**************************************************************************/
+
+#include "Sta.h"
+
+#include "Maximus.h"
+#include "ISystem.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+StaCounter Sta::mStaCounter;
+
+
+Sta::Sta ( Maximus * p_maximus, ISystem * p_system_manager, const string & station_executable ):
+mpMaximus(NULL),
+mpSystemManager(NULL),
+mStationId(0)
+{
+ logFunction();
+
+ if ( (NULL != p_maximus) && (NULL != p_system_manager) )
+ {
+ mpMaximus = p_maximus;
+ mpSystemManager = p_system_manager;
+ mStationId = mpSystemManager->createStation(station_executable);
+ mStaCounter[getStationId()] = 1;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Maximus and/or System manager pointers are NULL", errno);
+ }
+}
+
+
+Sta::Sta ( const Sta & sta ):
+mpSystemManager(NULL),
+mStationId(0)
+{
+ logFunction();
+
+ mpMaximus = sta.getMaximus();
+ mpSystemManager = sta.getSystemManager();
+ mStationId = sta.getStationId();
+ mStaCounter[getStationId()] += 1;
+}
+
+
+Sta::~Sta ( )
+{
+ logFunction();
+
+ remove();
+ if (NULL != mpMaximus)
+ {
+ mpMaximus = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ mpSystemManager = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// public methods
+//
+
+
+void Sta::remove ( )
+{
+ logFunction();
+
+ try
+ {
+ if (0 == mStaCounter[getStationId()])
+ {
+ if (0 == getStationId())
+ {
+ clog << logger(LOG_INFO) << "station already removed" << endl;
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Problem while deleting station");
+ }
+ }
+ else if (1 == mStaCounter[getStationId()])
+ {
+ getSystemManager()->removeStation(getStationId());
+ resetStationId();
+ }
+ else
+ {
+ mStaCounter[getStationId()] -= 1;
+ }
+ }
+ catchFunction(getMaximus());
+}
+
+
+void Sta::deactivate ( )
+{
+ logFunction();
+
+ try
+ {
+ getSystemManager()->deactivateStation(getStationId());
+ }
+ catchFunction(getMaximus());
+}
+
+
+void Sta::activate ( )
+{
+ logFunction();
+
+ try
+ {
+ getSystemManager()->activateStation(getStationId());
+ }
+ catchFunction(getMaximus());
+}
+
+
+void Sta::debug ( )
+{
+ logFunction();
+
+ try
+ {
+ getSystemManager()->debugStation(getStationId());
+ }
+ catchFunction(getMaximus());
+}
+
+
+const bool Sta::is_idle ( ) const
+{
+ logFunction();
+ bool isIdle = false;
+
+ try
+ {
+ isIdle = getSystemManager()->isStationIdle(getStationId());
+ }
+ catchFunction(getMaximus());
+
+ return isIdle;
+}
+
+
+void Sta::set_name ( const std::string & station_name )
+{
+ logFunction();
+
+ try
+ {
+ while (!is_idle())
+ {
+ getMaximus()->process();
+ }
+ getSystemManager()->setStationName(getStationId(), station_name);
+ }
+ catchFunction(getMaximus());
+}
+
+
+// private methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+Maximus * Sta::getMaximus ( ) const
+{
+ if (NULL == mpMaximus)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Maximus pointer is NULL");
+ }
+
+ return mpMaximus;
+}
+
+
+ISystem * Sta::getSystemManager ( ) const
+{
+ try
+ {
+ if (NULL == mpSystemManager)
+ {
+ throw Error(__PRETTY_FUNCTION__, "System manager pointer is NULL");
+ }
+ }
+ catchFunction(getMaximus());
+
+ return mpSystemManager;
+}
+
+
+bool Sta::resetStationId ( )
+{
+ mStationId = 0;
+
+ return true;
+}
+
+
+// public methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+Sci_Msg_Station_Id Sta::getStationId ( ) const
+{
+ return mStationId;
+}
+
diff --git a/cesar/maximus/coreengine/src/StaTest.cpp b/cesar/maximus/coreengine/src/StaTest.cpp
new file mode 100644
index 0000000000..5294e0b292
--- /dev/null
+++ b/cesar/maximus/coreengine/src/StaTest.cpp
@@ -0,0 +1,185 @@
+
+#include "StaTest.h"
+
+#include "Sta.h"
+#include "Maximus.h"
+#include "SystemManager.h"
+#include "SciServer.h"
+#include "NetworkClockProcessor.h"
+
+#include "Logger.h"
+
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (StaTest);
+
+
+void StaTest::setUp (void)
+{
+ logTest();
+
+ mpMaximus = new Maximus();
+ mpSci = new SciServer();
+ mpSystemManager = new SystemManager(mpSci);
+ mpNetworkClock = new NetworkClockProcessor();
+ mpSystemManager->setNetworkClock(mpNetworkClock);
+ mpSta = new Sta (mpMaximus, mpSystemManager, mpSystemManager->getDefaultStationExecutable());
+}
+
+
+void StaTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpSta)
+ {
+ delete (mpSta);
+ mpSta = NULL;
+ }
+ if (NULL != mpMaximus)
+ {
+ delete (mpMaximus);
+ mpMaximus = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ delete (mpSystemManager);
+ mpSystemManager = NULL;
+ }
+ if (NULL != mpNetworkClock)
+ {
+ delete (mpNetworkClock);
+ mpNetworkClock = NULL;
+ }
+ if (NULL != mpSci)
+ {
+ delete (mpSci);
+ mpSci = NULL;
+ }
+}
+
+
+void StaTest::remove_test (void)
+{
+ logTest();
+
+ if (NULL != mpSta)
+ {
+ mpSta->remove();
+
+ CPPUNIT_ASSERT_MESSAGE ( "remove failed",
+ (mpSystemManager->getListOfStations()->empty())
+ && (0 == mpSta->getStationId()) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Sta pointer is NULL");
+ }
+}
+
+
+void StaTest::deactivate_test (void)
+{
+ logTest();
+
+ if (NULL != mpSta)
+ {
+ mpSta->deactivate();
+
+ CPPUNIT_ASSERT_MESSAGE ( "deactivate failed",
+ MAXIMUS_STATION_STATUS_DEACTIVATED == mpSystemManager->getStationStatus(mpSta->getStationId()) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Sta pointer is NULL");
+ }
+}
+
+
+void StaTest::activate_test (void)
+{
+ logTest();
+
+ if (NULL != mpSta)
+ {
+ mpSta->deactivate();
+ mpSta->activate();
+
+ CPPUNIT_ASSERT_MESSAGE ( "activate failed",
+ MAXIMUS_STATION_STATUS_DEACTIVATED != mpSystemManager->getStationStatus(mpSta->getStationId()) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Sta pointer is NULL");
+ }
+}
+
+
+void StaTest::debug_test (void)
+{
+ logTest();
+
+ if (NULL != mpSta)
+ {
+ mpSta->debug();
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Sta pointer is NULL");
+ }
+}
+
+
+void StaTest::is_idle_test (void)
+{
+ logTest();
+
+ if (NULL != mpSta)
+ {
+ // Set the station status and test the function
+ mpSystemManager->updateStationStatus(mpSta->getStationId(), MAXIMUS_STATION_STATUS_IDLE);
+ CPPUNIT_ASSERT_MESSAGE ( "is_idle failed", mpSta->is_idle() );
+
+ // Set the station status and test the function
+ mpSystemManager->updateStationStatus(mpSta->getStationId(), MAXIMUS_STATION_STATUS_BUSY);
+ CPPUNIT_ASSERT_MESSAGE ( "is_idle failed", !mpSta->is_idle() );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Sta pointer is NULL");
+ }
+}
+
+
+void StaTest::getStationIdTest (void)
+{
+ logTest();
+
+ if (NULL != mpSta)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "getStationId failed",
+ 0 != mpSta->getStationId() );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Sta pointer is NULL");
+ }
+}
+
+
+void StaTest::set_name_test (void)
+{
+ logTest();
+
+ if (NULL != mpSta)
+ {
+ mpSystemManager->updateStationStatus(mpSta->getStationId(), MAXIMUS_STATION_STATUS_IDLE);
+ mpSta->set_name("station name");
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Sta pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/doc/fulminata_ecos_specs.odt b/cesar/maximus/doc/fulminata_ecos_specs.odt
new file mode 100755
index 0000000000..7238bc284b
--- /dev/null
+++ b/cesar/maximus/doc/fulminata_ecos_specs.odt
Binary files differ
diff --git a/cesar/maximus/doc/fulminata_general_specs.odt b/cesar/maximus/doc/fulminata_general_specs.odt
new file mode 100755
index 0000000000..583cd15384
--- /dev/null
+++ b/cesar/maximus/doc/fulminata_general_specs.odt
Binary files differ
diff --git a/cesar/maximus/doc/fulminata_maximus_architecture.odt b/cesar/maximus/doc/fulminata_maximus_architecture.odt
new file mode 100755
index 0000000000..2b4e0d2df9
--- /dev/null
+++ b/cesar/maximus/doc/fulminata_maximus_architecture.odt
Binary files differ
diff --git a/cesar/maximus/doc/fulminata_maximus_architecture.xmi b/cesar/maximus/doc/fulminata_maximus_architecture.xmi
new file mode 100755
index 0000000000..02bca0c587
--- /dev/null
+++ b/cesar/maximus/doc/fulminata_maximus_architecture.xmi
@@ -0,0 +1,8039 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-03-18T12:25:31" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.6</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="interface" isRoot="false" isAbstract="false" name="interface" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="constructor" isRoot="false" isAbstract="false" name="constructor" />
+ <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="struct" isRoot="false" isAbstract="false" name="struct" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="typedef" isRoot="false" isAbstract="false" name="typedef" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="friend" isRoot="false" isAbstract="false" name="friend" />
+ <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="UOc7OI8LRuFv" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ctnUq2PsE48l" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="4Kduenu6BUBZ" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nJsED87p1vHp" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vfi9josl6Tfk" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="HXoQ2zynGq1U" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="w7Hw0ZjtEP2v" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DshIKK2Zspzs" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ovf5keXejoaj" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LIcXhcTtT8Bn" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QBMG0J8pDlsx" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="66nkQj7RUTGt" isRoot="false" isAbstract="false" name="char*" elementReference="ctnUq2PsE48l" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="trv86yL4jfeS" isRoot="false" isAbstract="false" name="const std::string&amp;" elementReference="QBMG0J8pDlsx" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Hfgxfxm85LAR" isRoot="false" isAbstract="false" name="const tick_t" elementReference="XlAIxWJ0t2q4" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nHLqdVHOsxNM" isRoot="false" isAbstract="false" name="CoreEngine*" elementReference="9uUW4XZ5t7nP" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8HFYeCh1V2Tr" isRoot="false" isAbstract="false" name="SystemManager*" elementReference="bBWfkvMSUBzc" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="FM9MFyrLE5ts" isRoot="false" isAbstract="false" name="FunctionCallManager*" elementReference="Szlq4RFfiqZ0" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="dxoHI48VOHpd" isRoot="false" isAbstract="false" name="NetworkClockProcessor*" elementReference="l6c6ZbY9k4oU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QR5iQfL4cAJs" isRoot="false" isAbstract="false" name="PhyProcessor*" elementReference="SU7oJl8r1vpC" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xXbKcOH2nKjB" isRoot="false" isAbstract="false" name="SciServer*" elementReference="ElUvZ3tKAVPh" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Fls26ZE3bRdo" isRoot="false" isAbstract="false" name="const Network_Clock_Tick" elementReference="PDzFlxMB73D7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="E5x9L9RNrd6t" isRoot="false" isAbstract="false" name="Maximus*" elementReference="IZRHkhpzqhMU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WKXaz2THzK1G" isRoot="false" isAbstract="false" name="const Msg&amp;" elementReference="3PksAGjP1DIY" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="g55iEgjQlzYA" isRoot="false" isAbstract="false" name="Msg&amp;" elementReference="3PksAGjP1DIY" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qtOabrV06r8H" isRoot="false" isAbstract="false" name="const unsigned long" elementReference="LIcXhcTtT8Bn" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Z3mduvueNb9d" isRoot="false" isAbstract="false" name="const unsigned char*" elementReference="Ny9n9LLzEhXo" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="44n6UGK0XgsS" isRoot="false" isAbstract="false" name="T const&amp;" elementReference="MuLM2exc7eeX" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eptOVybOJnpM" isRoot="false" isAbstract="false" name="const cb_t&amp;" elementReference="K1iCj3mMQwQL" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="lNFLPGC5GcjE" isRoot="false" isAbstract="false" name="Sta&amp;" elementReference="4xqo1eJwmBM3" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="iB4yZDFSik45" isRoot="false" isAbstract="false" name="unsigned long&amp;" elementReference="LIcXhcTtT8Bn" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ObMobD4JO6Fx" isRoot="false" isAbstract="false" name="unsigned char*" elementReference="Ny9n9LLzEhXo" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="bQxm3RYu0b9f" isRoot="false" isAbstract="false" name="T&amp;" elementReference="0xotfbj8uz9G" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="JCIhsw1mHbC2" isRoot="false" isAbstract="false" name="FunctionSciMsg*" elementReference="FBsPeH4gEvUD" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="9U1uI8HJT0Jf" isRoot="false" isAbstract="false" name="const std::string" elementReference="QBMG0J8pDlsx" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="2UqTU88CwGoW" isRoot="false" isAbstract="false" name="unsigned char*&amp;" elementReference="Ny9n9LLzEhXo" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Ks2QuFd1iYTQ" isRoot="false" isAbstract="false" name="const ParametersList&amp;" elementReference="CxVwuGjKYPlO" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="dsRw8nRMsxE8" isRoot="false" isAbstract="false" name="const Sci_Msg_Station_Id" elementReference="uNcSkNqyAxHb" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="58Cx3O5oNLy7" isRoot="false" isAbstract="false" name="const FunctionSciMsg*" elementReference="FBsPeH4gEvUD" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Q7aANH0SNANP" isRoot="false" isAbstract="false" name="const FunctionSciMsg&amp;" elementReference="FBsPeH4gEvUD" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3lgc1KcaMAny" isRoot="false" isAbstract="false" name="const bool" elementReference="4Kduenu6BUBZ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="GgjUKN39BDXg" isRoot="false" isAbstract="false" name="const Sta&amp;" elementReference="4xqo1eJwmBM3" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="O0Y4e7L2YuKE" isRoot="false" isAbstract="false" name="const CallbackFunction&amp;" elementReference="uvuzFPfmVe3t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="taPZHCs4KBPK" isRoot="false" isAbstract="false" name="FunctionSciMsg&amp;" elementReference="FBsPeH4gEvUD" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Dk5pczPnz6Yr" isRoot="false" isAbstract="false" name="CallbacksList*" elementReference="SRkFry3tOtYS" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qj7xSczKuwTq" isRoot="false" isAbstract="false" name="const FunctionCallParameter&amp;" elementReference="JEjtehSNwhqe" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="AtFJ5jDgvMWr" isRoot="false" isAbstract="false" name="FunctionCallParameter&amp;" elementReference="JEjtehSNwhqe" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xdn6dFqV85mT" isRoot="false" isAbstract="false" name="const char*" elementReference="ctnUq2PsE48l" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1PQGjZx0iexb" isRoot="false" isAbstract="false" name="Function_Call_Header*" elementReference="bEeZdY0xhVQw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="hHn4fFvgbLYX" isRoot="false" isAbstract="false" name="SciMsg*" elementReference="dBvvR3kpanaF" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="VwQtQ1TIoAvq" isRoot="false" isAbstract="false" name="const Function_Call_Type" elementReference="60clcAU0xnx5" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WqvJ0Bi64K7w" isRoot="false" isAbstract="false" name="const Function_Call_Parameters_Number" elementReference="iYfdxrJ7viR4" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TYfZTukOB7DK" isRoot="false" isAbstract="false" name="void*" elementReference="yfv0x3wqUorr" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="bHSmNf4TkzTc" isRoot="false" isAbstract="false" name="const Function_Call_Header*" elementReference="bEeZdY0xhVQw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="10N6r5hp62ve" isRoot="false" isAbstract="false" name="Network_Clock_Header*" elementReference="hCCozGYEQBhw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="G9Fc21bZFJYw" isRoot="false" isAbstract="false" name="const Network_Clock_Type" elementReference="acFbRvXTEMIs" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nNX5UmpiITKY" isRoot="false" isAbstract="false" name="const Network_Clock_Id" elementReference="2OUKpDmUU6Tg" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="cSRv6d9bhfgi" isRoot="false" isAbstract="false" name="const Network_Clock_Header*" elementReference="hCCozGYEQBhw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="VcPcOcsgjQbo" isRoot="false" isAbstract="false" name="const NetworkClockEvt&amp;" elementReference="HaP8ZCy8plaL" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="j0sNksMuhVaF" isRoot="false" isAbstract="false" name="NetworkClockEvt&amp;" elementReference="HaP8ZCy8plaL" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="u6I3QBCIKjNh" isRoot="false" isAbstract="false" name="Network_Clock_Tick&amp;" elementReference="PDzFlxMB73D7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="HrAPc4wZ9mox" isRoot="false" isAbstract="false" name="EvtsList&amp;" elementReference="bxyfX2FkfHc6" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="U4mQnNTnRzFr" isRoot="false" isAbstract="false" name="NetworkClockEvtList*" elementReference="khBqlcIjqaYa" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CVhnimyi5KYN" isRoot="false" isAbstract="false" name="ClockSciMsg&amp;" elementReference="nMqHFdX6fOJd" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="iP4BuKaU6MFG" isRoot="false" isAbstract="false" name="PhySciMsg*" elementReference="1Ey5TfpDf9m6" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="02OHgpv6iwv9" isRoot="false" isAbstract="false" name="const Phy_Type" elementReference="6EgMC1YWquF9" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QYpsIm6ImSYT" isRoot="false" isAbstract="false" name="const Phy_Mpdu_Format" elementReference="R7NTfdMjVLA2" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="U3HSI0riWfYo" isRoot="false" isAbstract="false" name="const Phy_Nb_Of_Pbs" elementReference="YkJeSfDyIVQI" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eOTt0WSUZhur" isRoot="false" isAbstract="false" name="const Phy_Tonemap_Index" elementReference="axOd2PMcsqyz" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ee5ipO9TkcLk" isRoot="false" isAbstract="false" name="const Phy_Flags" elementReference="E4ek4y1U3HLE" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ylvhNGRUzc7S" isRoot="false" isAbstract="false" name="const uint32_t" elementReference="4F2mG2WvecbT" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="w18nsvnfKlCn" isRoot="false" isAbstract="false" name="PhySciMsg&amp;" elementReference="1Ey5TfpDf9m6" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="i2UaJmLAA6SB" isRoot="false" isAbstract="false" name="Phy_Header*" elementReference="YFYivL7lKsyo" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="O12pIiPVGutd" isRoot="false" isAbstract="false" name="const Phy_Header*" elementReference="YFYivL7lKsyo" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="t2asNnHh8wsl" isRoot="false" isAbstract="false" name="const uint32_t*" elementReference="4F2mG2WvecbT" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qZLXuibBNXID" isRoot="false" isAbstract="false" name="const unsigned short int" elementReference="qzlFUs4gsJKl" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1p2XZLYDDR9J" isRoot="false" isAbstract="false" name="Sci_Msg_Header*" elementReference="FGkVafnZOxkd" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xSzXJBSHo8yn" isRoot="false" isAbstract="false" name="const SciMsg&amp;" elementReference="dBvvR3kpanaF" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="KLj6UftWOUuW" isRoot="false" isAbstract="false" name="const SciMsg*" elementReference="dBvvR3kpanaF" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="lvIXi2Pxh0fK" isRoot="false" isAbstract="false" name="const Sci_Msg_Status" elementReference="4ptGPmSL1mv9" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="EknMLJBAPpgo" isRoot="false" isAbstract="false" name="const Sci_Msg_Type" elementReference="B8d1TM24GHiB" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pX24l2l5CrBj" isRoot="false" isAbstract="false" name="const Sci_Msg_Flag" elementReference="bicD6yqnVUa7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="erAlIci9mSIq" isRoot="false" isAbstract="false" name="const Sci_Msg_Header*" elementReference="FGkVafnZOxkd" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LrX6DxQMEnp2" isRoot="false" isAbstract="false" name="unsigned char**" elementReference="Ny9n9LLzEhXo" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="s715so7RcDV9" isRoot="false" isAbstract="false" name="SciMsg**" elementReference="dBvvR3kpanaF" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="cKqCpL4vHbUA" isRoot="false" isAbstract="false" name="StationsList*" elementReference="0vcc95kxWWVn" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="KaWkbzz0V7eb" isRoot="false" isAbstract="false" name="const SciServer&amp;" elementReference="ElUvZ3tKAVPh" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3McdnqE6JCta" isRoot="false" isAbstract="false" name="SciMsg&amp;" elementReference="dBvvR3kpanaF" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Kevzvq2lEsL7" isRoot="false" isAbstract="false" name="std::list&lt; Station * >" elementReference="4LgRjEB5I6jc" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="w1WmyaR6BJwY" isRoot="false" isAbstract="false" name="const Cco_Capability" elementReference="tn89GJwm2DQU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="VewgxsCIjx8s" isRoot="false" isAbstract="false" name="const Bridge_Capability" elementReference="XmVg46uC4n8q" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="W4aE1i6TfajT" isRoot="false" isAbstract="false" name="const Homeplug_Version" elementReference="BEIun6kQm0UQ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0gZfFH6nfJoC" isRoot="false" isAbstract="false" name="const Device_Access_Key" elementReference="bJtzCEyKnKFK" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="jIKxm4xqfB4z" isRoot="false" isAbstract="false" name="StationConfiguration*" elementReference="OvNqoCObl8CH" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="7jGBwdRbnPDW" isRoot="false" isAbstract="false" name="const Station&amp;" elementReference="G1jpotlnS9ne" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nBSGMFfRdnbK" isRoot="false" isAbstract="false" name="Station&amp;" elementReference="G1jpotlnS9ne" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="wZnZ9lZYcork" isRoot="false" isAbstract="false" name="const pid_t" elementReference="TTjyPYhZVm6n" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TrV97VV12IZA" isRoot="false" isAbstract="false" name="const File_Descriptor" elementReference="WO0VJglkKJD1" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nMhUhBvBqw4A" isRoot="false" isAbstract="false" name="const Station_Status" elementReference="zczAjgq81yYh" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="VBixqziBqrhe" isRoot="false" isAbstract="false" name="const SystemSciMsg&amp;" elementReference="kNRjwgcIhcX0" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="INoSbjQmME1a" isRoot="false" isAbstract="false" name="Station*" elementReference="G1jpotlnS9ne" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="II4tXBwM3i4V" isRoot="false" isAbstract="false" name="System_Header*" elementReference="idECE5nt0Vr7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8Eb0NWUsBQSJ" isRoot="false" isAbstract="false" name="const System_Type" elementReference="yD8lVM51i3U1" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZZfK0mQuNQ1O" isRoot="false" isAbstract="false" name="const System_Header*" elementReference="idECE5nt0Vr7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vQ1S2XzSPBqN" isRoot="false" isAbstract="false" name="const string&amp;" elementReference="QBMG0J8pDlsx" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pJsfgcYj7OSg" isRoot="false" isAbstract="false" name="const error_t" elementReference="fuM43CRtzagH" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="C9cGTLSO5pln" isRoot="false" isAbstract="false" name="std::ofstream&amp;" elementReference="SAh1zCEmUab7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="r4r1RcqCQswh" isRoot="false" isAbstract="false" name="Logger&amp;" elementReference="kzdjBd3ATyt6" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ViIuaCbFO4Rh" isRoot="false" isAbstract="false" name="std::ostream&amp;" elementReference="BBlq3c2ugtt6" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vTwaNogqWwk6" isRoot="false" isAbstract="false" name="const Logger&amp;" elementReference="kzdjBd3ATyt6" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="T3wGzLaOdJRi" isRoot="false" isAbstract="false" name="ISci*" elementReference="PKaM1HoCDbbs" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DEOmV9sHIiVw" isRoot="false" isAbstract="false" name="IPhy*" elementReference="Ab0NMXybAfZU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8JusFMjAgM0v" isRoot="false" isAbstract="false" name="const Phy_Fc_Mode" elementReference="DhQX2rY6wPDZ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="nLEyCkrlHPQw" isRoot="false" isAbstract="false" name="const Phy_Short_Ppdu" elementReference="UgPIutO5ambc" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="UxIGEVkWi0NJ" isRoot="false" isAbstract="false" name="const Phy_Mod" elementReference="6Qx7AaWcHvu9" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pwe3pKqZPxkb" isRoot="false" isAbstract="false" name="const Phy_Fecrate" elementReference="TJe4s63xXy2f" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="0cEqYhKKEcTV" isRoot="false" isAbstract="false" name="const Phy_Gil" elementReference="tWAq6KHaeveU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ASmFlCHQXF31" isRoot="false" isAbstract="false" name="const Phy_Tx_Id" elementReference="2yOeu36ujWRN" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="s0nXwm2aK1kb" isRoot="false" isAbstract="false" name="const Phy_Nb_Of_Symbols" elementReference="eKZEv9oVXM34" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qcb8l3xv8TRt" isRoot="false" isAbstract="false" name="IFunctionCall*" elementReference="2j8N30UlnykR" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="TXhtlZjMAp7C" isRoot="false" isAbstract="false" name="ISystem*" elementReference="0dybVkdpO4Ya" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Dc4onmiEKP73" isRoot="false" isAbstract="false" name="INetworkClock*" elementReference="pdUJAVtJe39T" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="EQrcJtA2vC7c" isRoot="false" isAbstract="false" name="const float" elementReference="nJsED87p1vHp" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ihg5BF2ckirV" isRoot="false" isAbstract="false" name="PhySciMsgMpdu*" elementReference="gjYrACSC9BuB" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="h0fjFQ6XJMWi" isRoot="false" isAbstract="false" name="IChannel*" elementReference="mKTfuY7pgyOI" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="S02STVfDWPXk" isRoot="false" isAbstract="false" name="const uint8_t*" elementReference="8RfL5UmYopms" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vl7nx6lzHKbw" isRoot="false" isAbstract="false" name="const Expected_Tx" elementReference="c6nC8sEdaTgi" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="FYDrFS8mDoaL" isRoot="false" isAbstract="false" name="uint8_t*" elementReference="8RfL5UmYopms" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="O74yXfkidyrR" isRoot="false" isAbstract="false" name="const unsigned int" elementReference="DshIKK2Zspzs" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="XNEzxlV9pJ9M" isRoot="false" isAbstract="false" name="PhySciMsgMpdu&amp;" elementReference="gjYrACSC9BuB" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="iJSN8ewspTX1" isRoot="false" isAbstract="false" name="const Phy_Header&amp;" elementReference="YFYivL7lKsyo" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vFBbZkjwm4Vx" isRoot="false" isAbstract="false" name="PhySciMsgPre*" elementReference="emjq7Xks8DWW" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="4XSkb7G7HX8a" isRoot="false" isAbstract="false" name="PhySciMsgFc*" elementReference="uHdgUvjiSZG6" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xqe85s2v3X76" isRoot="false" isAbstract="false" name="IEthernet*" elementReference="vpDXE2tS2kJL" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="HYl1HlhGNnFB" isRoot="false" isAbstract="false" name="std::vector&lt; Msg * >" elementReference="Tf9yq5dCbZ1m" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="rRJOS4Ahavgr" isRoot="false" isAbstract="false" name="std::vector&lt; Sta * >" elementReference="Tf9yq5dCbZ1m" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="vteoFJru7xrN" isRoot="false" isAbstract="false" name="const cb_t" elementReference="K1iCj3mMQwQL" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8DcrWo7HU0iD" isRoot="false" isAbstract="false" name="const Ethernet_Header&amp;" elementReference="bErx1XNsRKIs" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pE9AJY0D36ZX" isRoot="false" isAbstract="false" name="const Ethernet_Type" elementReference="HTUXG3XFPxuK" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="bB3bDXILtLrz" isRoot="false" isAbstract="false" name="const Network_Clock_Header&amp;" elementReference="hCCozGYEQBhw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="rHbXHZa03W4n" isRoot="false" isAbstract="false" name="const void*" elementReference="yfv0x3wqUorr" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="gFFNUwPz4TDC" isRoot="false" isAbstract="false" name="const Function_Call_Msg_Id" elementReference="2JrrgMpWtl6M" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QXEg7cwSFt0l" isRoot="false" isAbstract="false" name="const uint16_t" elementReference="sWYhCThWlDFP" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="IdrZNJ0YPvUj" isRoot="false" isAbstract="false" name="const Function_Call_Header&amp;" elementReference="bEeZdY0xhVQw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="drESmKOpFHzv" isRoot="false" isAbstract="false" name="std::string&amp;" elementReference="QBMG0J8pDlsx" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="MvpHChZ2rJOW" isRoot="false" isAbstract="false" name="const System_Header&amp;" elementReference="idECE5nt0Vr7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eqNqcEputAw7" isRoot="false" isAbstract="false" name="DestStationsList&amp;" elementReference="CWGE8DVJYvei" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="fL9t737j70re" isRoot="false" isAbstract="false" name="uint32_t*" elementReference="4F2mG2WvecbT" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="j5EvHIixdpql" isRoot="false" isAbstract="false" name="PhySciMsgNoise&amp;" elementReference="vSu5lsg0a7WJ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="FVFtK4cB028u" isRoot="false" isAbstract="false" name="const PhySciMsgMpdu&amp;" elementReference="gjYrACSC9BuB" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="SuGBQogD9iYR" isRoot="false" isAbstract="false" name="std::vector&lt; ChannelSettings * >&amp;" elementReference="Tf9yq5dCbZ1m" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="2A0kHciAJN94" isRoot="false" isAbstract="false" name="const Channel_Settings_Key&amp;" elementReference="FNAWFo5m56XX" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="yHm6ssfdnOOK" isRoot="false" isAbstract="false" name="std::map&lt; const Channel_Settings_Key, ChannelSettings *, ltkey >" elementReference="F1TYNacxByRT" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="MbP7gzMpbiS8" isRoot="false" isAbstract="false" name="const Channel_Mod" elementReference="QfHGrZecvJNh" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="PFhzx975rDDm" isRoot="false" isAbstract="false" name="const double" elementReference="vfi9josl6Tfk" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="t8K2eKmlJWeX" isRoot="false" isAbstract="false" name="const ChannelPoint&amp;" elementReference="7WkpCVeuHxVw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="GvaXRE3v0jhy" isRoot="false" isAbstract="false" name="const ChannelPoint" elementReference="7WkpCVeuHxVw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Egoy0uRTnPKa" isRoot="false" isAbstract="false" name="ChannelPoint&amp;" elementReference="7WkpCVeuHxVw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BlnbH3oVPPjZ" isRoot="false" isAbstract="false" name="unsigned int&amp;" elementReference="DshIKK2Zspzs" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="7YtOMToL1Xs9" isRoot="false" isAbstract="false" name="const Sci_Msg_Header&amp;" elementReference="FGkVafnZOxkd" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="eFtlt57PInXt" isRoot="false" isAbstract="false" name="NetworkClockEvt*&amp;" elementReference="HaP8ZCy8plaL" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZcxOLFwJIm1Z" isRoot="false" isAbstract="false" name="const Ethernet_Sniffer_Type" elementReference="ZWryYSGDRuyu" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LmSODUAk50Mh" isRoot="false" isAbstract="false" name="const Ethernet_Flags" elementReference="cQhYUO60E2We" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Package isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="MCSt8TslaFsB" isRoot="false" isAbstract="false" name="std" >
+ <UML:Namespace.ownedElement>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="MCSt8TslaFsB" xmi.id="SAh1zCEmUab7" isRoot="false" isAbstract="false" name="ofstream" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="MCSt8TslaFsB" xmi.id="4LgRjEB5I6jc" isRoot="false" isAbstract="false" name="list" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="MCSt8TslaFsB" xmi.id="BBlq3c2ugtt6" isRoot="false" isAbstract="false" name="ostream" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="MCSt8TslaFsB" xmi.id="Tf9yq5dCbZ1m" isRoot="false" isAbstract="false" name="vector" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="MCSt8TslaFsB" xmi.id="F1TYNacxByRT" isRoot="false" isAbstract="false" name="map" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Ny9n9LLzEhXo" isRoot="false" isAbstract="false" name="unsigned char" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="MuLM2exc7eeX" isRoot="false" isAbstract="false" name="T const" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0xotfbj8uz9G" isRoot="false" isAbstract="false" name="T" />
+ <UML:Enumeration stereotype="enum" comment="// Function_Call_Header.type//" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="60clcAU0xnx5" isRoot="false" isAbstract="false" name="Function_Call_Type" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="60clcAU0xnx5" xmi.id="qw0upkshD7Ws" isRoot="false" isAbstract="false" name="FUNCTION_CALL_TYPE_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="60clcAU0xnx5" xmi.id="08eZuDdvpOX0" isRoot="false" isAbstract="false" name="FUNCTION_CALL_TYPE_REQ" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="60clcAU0xnx5" xmi.id="qXvcVzRJvRDi" isRoot="false" isAbstract="false" name="FUNCTION_CALL_TYPE_RSP" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="60clcAU0xnx5" xmi.id="94PMBtCB1riw" isRoot="false" isAbstract="false" name="FUNCTION_CALL_TYPE_NB" />
+ </UML:Enumeration>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2JrrgMpWtl6M" isRoot="false" isAbstract="false" name="Function_Call_Msg_Id" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="iYfdxrJ7viR4" isRoot="false" isAbstract="false" name="Function_Call_Parameters_Number" elementReference="DshIKK2Zspzs" />
+ <UML:Enumeration stereotype="enum" comment="// Network_Clock_Header.type//" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="acFbRvXTEMIs" isRoot="false" isAbstract="false" name="Network_Clock_Type" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="acFbRvXTEMIs" xmi.id="i8ParVwZ1aAz" isRoot="false" isAbstract="false" name="NETWORK_CLOCK_TYPE_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="acFbRvXTEMIs" xmi.id="RT4K9VOj5bLU" isRoot="false" isAbstract="false" name="NETWORK_CLOCK_TYPE_REMOVE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="acFbRvXTEMIs" xmi.id="UqxgBEZrKwRB" isRoot="false" isAbstract="false" name="NETWORK_CLOCK_TYPE_STATION" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="acFbRvXTEMIs" xmi.id="PMiRwsQLJUdS" isRoot="false" isAbstract="false" name="NETWORK_CLOCK_TYPE_FUNCTION_CALL" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="acFbRvXTEMIs" xmi.id="x1A1aTV4JTiS" isRoot="false" isAbstract="false" name="NETWORK_CLOCK_TYPE_PHY" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="acFbRvXTEMIs" xmi.id="hHK1DjAd5s2z" isRoot="false" isAbstract="false" name="NETWORK_CLOCK_TYPE_SYSTEM" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="acFbRvXTEMIs" xmi.id="iSIzuvPruZsS" isRoot="false" isAbstract="false" name="NETWORK_CLOCK_TYPE_NB" />
+ </UML:Enumeration>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2OUKpDmUU6Tg" isRoot="false" isAbstract="false" name="Network_Clock_Id" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="PDzFlxMB73D7" isRoot="false" isAbstract="false" name="Network_Clock_Tick" />
+ <UML:Enumeration stereotype="enum" comment="sci_types.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/sci_types.h
+" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="obHtTJr9l96f" isRoot="false" isAbstract="false" name="Sci_Server_Status" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="obHtTJr9l96f" xmi.id="3VUv5LO7hsRU" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_SERVER_STATUS_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="obHtTJr9l96f" xmi.id="5CyYIPE40VyR" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_SERVER_STATUS_RUNNING" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="obHtTJr9l96f" xmi.id="mnaVwg8xBctE" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_SERVER_STATUS_STOP" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="obHtTJr9l96f" xmi.id="vHMc9l6Dx2lE" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_SERVER_STATUS_STOPPED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="obHtTJr9l96f" xmi.id="RxIRQEsC1Qhw" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_SERVER_STATUS_NB" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" comment="// Used by SciMsg//" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="4ptGPmSL1mv9" isRoot="false" isAbstract="false" name="Sci_Msg_Status" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4ptGPmSL1mv9" xmi.id="Y0MT25hU2ytQ" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_MSG_STATUS_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4ptGPmSL1mv9" xmi.id="CmcECHAH43VT" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_MSG_STATUS_TO_SEND" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4ptGPmSL1mv9" xmi.id="oxmpiiwGiIji" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_MSG_STATUS_SENT" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4ptGPmSL1mv9" xmi.id="LPCLN6lZqLl2" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_MSG_STATUS_RECEIVED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4ptGPmSL1mv9" xmi.id="ctHevk8jgsWO" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_MSG_STATUS_PROCESSED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="4ptGPmSL1mv9" xmi.id="YTeEjLx3i7O5" isRoot="false" isAbstract="false" name="MAXIMUS_SCI_MSG_STATUS_NB" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" comment="// Sci_Msg_Header.type//" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="B8d1TM24GHiB" isRoot="false" isAbstract="false" name="Sci_Msg_Type" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="B8d1TM24GHiB" xmi.id="2qsihO6FpiUX" isRoot="false" isAbstract="false" name="SCI_MSG_TYPE_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="B8d1TM24GHiB" xmi.id="3RamYwpi4QjY" isRoot="false" isAbstract="false" name="SCI_MSG_TYPE_NETWORK_CLOCK" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="B8d1TM24GHiB" xmi.id="nja31IE374lo" isRoot="false" isAbstract="false" name="SCI_MSG_TYPE_FUNCTION_CALL" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="B8d1TM24GHiB" xmi.id="Sp3GXXlawJKT" isRoot="false" isAbstract="false" name="SCI_MSG_TYPE_PHY" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="B8d1TM24GHiB" xmi.id="F8BKYuqLcQMd" isRoot="false" isAbstract="false" name="SCI_MSG_TYPE_SYSTEM" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="B8d1TM24GHiB" xmi.id="iYgncPb3EfJl" isRoot="false" isAbstract="false" name="SCI_MSG_TYPE_NB" />
+ </UML:Enumeration>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="uNcSkNqyAxHb" isRoot="false" isAbstract="false" name="Sci_Msg_Station_Id" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="A2J7LcYakjsI" isRoot="false" isAbstract="false" name="Sci_Msg_Id" />
+ <UML:Enumeration stereotype="enum" comment="// Sci_Msg_Header.flags//" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bicD6yqnVUa7" isRoot="false" isAbstract="false" name="Sci_Msg_Flag" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="bicD6yqnVUa7" xmi.id="rCA5pRoxT62m" isRoot="false" isAbstract="false" name="SCI_MSG_FLAG_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="bicD6yqnVUa7" xmi.id="iaNQJFitwI60" isRoot="false" isAbstract="false" name="SCI_MSG_FLAG_RESP" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="bicD6yqnVUa7" xmi.id="FvnkPMrHW0KJ" isRoot="false" isAbstract="false" name="SCI_MSG_FLAG_ACK" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="bicD6yqnVUa7" xmi.id="P7GtDHftr0J9" isRoot="false" isAbstract="false" name="SCI_MSG_FLAG_NEEDACK" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="bicD6yqnVUa7" xmi.id="Ez28I68X1uFP" isRoot="false" isAbstract="false" name="SCI_MSG_FLAG_SYNC" />
+ </UML:Enumeration>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="E4ek4y1U3HLE" isRoot="false" isAbstract="false" name="Phy_Flags" />
+ <UML:Enumeration stereotype="enum" comment="// Phy_Header.type//" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="6EgMC1YWquF9" isRoot="false" isAbstract="false" name="Phy_Type" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="Yb1b7UtyzhI6" isRoot="false" isAbstract="false" name="PHY_TYPE_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="h7pvvBbzNHKX" isRoot="false" isAbstract="false" name="PHY_TYPE_PREAMBLE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="Is37kIGIsFrx" isRoot="false" isAbstract="false" name="PHY_TYPE_FC_HYBRID_MODE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="jlviQEm7JZ0D" isRoot="false" isAbstract="false" name="PHY_TYPE_FC_AV_ONLY_MODE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="kbC7rWe7MgE7" isRoot="false" isAbstract="false" name="PHY_TYPE_PRS" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="wSNohFlQ0h6O" isRoot="false" isAbstract="false" name="PHY_TYPE_MPDU_PAYLOAD" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="tsUCSUNA4aGt" isRoot="false" isAbstract="false" name="PHY_TYPE_TONEMAP" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="4s0RYFWVhtHP" isRoot="false" isAbstract="false" name="PHY_TYPE_NOISE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="6EgMC1YWquF9" xmi.id="63n4iuTZmxjC" isRoot="false" isAbstract="false" name="PHY_TYPE_NB" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" comment="// Phy_Header.mpdu_format//" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="R7NTfdMjVLA2" isRoot="false" isAbstract="false" name="Phy_Mpdu_Format" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="R7NTfdMjVLA2" xmi.id="aeXFWoccpQhV" isRoot="false" isAbstract="false" name="PHY_MPDU_FORMAT_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="R7NTfdMjVLA2" xmi.id="IA247mFWrcyW" isRoot="false" isAbstract="false" name="PHY_MPDU_FORMAT_BEACON" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="R7NTfdMjVLA2" xmi.id="DKFidOkD2FRW" isRoot="false" isAbstract="false" name="PHY_MPDU_FORMAT_SOF" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="R7NTfdMjVLA2" xmi.id="239pRqLjyLo3" isRoot="false" isAbstract="false" name="PHY_MPDU_FORMAT_SACK" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="R7NTfdMjVLA2" xmi.id="71ZwdVSqogWR" isRoot="false" isAbstract="false" name="PHY_MPDU_FORMAT_RTS_CTS" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="R7NTfdMjVLA2" xmi.id="2Hf2U6ZW7iMZ" isRoot="false" isAbstract="false" name="PHY_MPDU_FORMAT_SOUND" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="R7NTfdMjVLA2" xmi.id="WfIU04X6542i" isRoot="false" isAbstract="false" name="PHY_MPDU_FORMAT_RSOF" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="R7NTfdMjVLA2" xmi.id="aTWO73p9ISBm" isRoot="false" isAbstract="false" name="PHY_MPDU_FORMAT_NB" />
+ </UML:Enumeration>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="YkJeSfDyIVQI" isRoot="false" isAbstract="false" name="Phy_Nb_Of_Pbs" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="axOd2PMcsqyz" isRoot="false" isAbstract="false" name="Phy_Tonemap_Index" />
+ <UML:Enumeration stereotype="enum" comment="system_types.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/types/system_types.h" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tn89GJwm2DQU" isRoot="false" isAbstract="false" name="Cco_Capability" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="tn89GJwm2DQU" xmi.id="sdR87rQfnnIn" isRoot="false" isAbstract="false" name="MAXIMUS_NOT_CCO_CAPABLE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="tn89GJwm2DQU" xmi.id="CcN2TL1K87UM" isRoot="false" isAbstract="false" name="MAXIMUS_CCO_CAPABLE_WITHOUT_QOS_SUPPORT" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="tn89GJwm2DQU" xmi.id="OQ9QdXtT9KbG" isRoot="false" isAbstract="false" name="MAXIMUS_PREFERRED_CCO_CAPABILITY" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="tn89GJwm2DQU" xmi.id="9zvwmBjyo60H" isRoot="false" isAbstract="false" name="MAXIMUS_NEXT_GENERATION_CCO_CAPABILITY" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="tn89GJwm2DQU" xmi.id="PzbW43sTTzt4" isRoot="false" isAbstract="false" name="MAXIMUS_CCO_CAPABILITY_NB" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="XmVg46uC4n8q" isRoot="false" isAbstract="false" name="Bridge_Capability" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="XmVg46uC4n8q" xmi.id="yqnkun1Klbqp" isRoot="false" isAbstract="false" name="MAXIMUS_NOT_BRIDGE_CAPABLE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="XmVg46uC4n8q" xmi.id="cgI6gA8Duerx" isRoot="false" isAbstract="false" name="MAXIMUS_BRIDGE_CAPABLE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="XmVg46uC4n8q" xmi.id="il9mWHdU5OFy" isRoot="false" isAbstract="false" name="MAXIMUS_BRIDGE_CAPABILITY_NB" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="BEIun6kQm0UQ" isRoot="false" isAbstract="false" name="Homeplug_Version" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="BEIun6kQm0UQ" xmi.id="8cd3ES0xB9jh" isRoot="false" isAbstract="false" name="MAXIMUS_HOMEPLUG_AV" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="BEIun6kQm0UQ" xmi.id="OKASiNQsZgmN" isRoot="false" isAbstract="false" name="MAXIMUS_HOMEPLUG_101" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="BEIun6kQm0UQ" xmi.id="mUlWTFxbpYe4" isRoot="false" isAbstract="false" name="MAXIMUS_HOMEPLUG_VERSION_NB" />
+ </UML:Enumeration>
+ <UML:Enumeration stereotype="enum" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="zczAjgq81yYh" isRoot="false" isAbstract="false" name="Station_Status" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="zczAjgq81yYh" xmi.id="JyXscIDMmysF" isRoot="false" isAbstract="false" name="MAXIMUS_STATION_STATUS_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="zczAjgq81yYh" xmi.id="BnrzKT1J60Rn" isRoot="false" isAbstract="false" name="MAXIMUS_STATION_STATUS_IDLE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="zczAjgq81yYh" xmi.id="gFvfBRLUNsNz" isRoot="false" isAbstract="false" name="MAXIMUS_STATION_STATUS_BUSY" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="zczAjgq81yYh" xmi.id="AaLvXE8gzxfH" isRoot="false" isAbstract="false" name="MAXIMUS_STATION_STATUS_DEACTIVATED" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="zczAjgq81yYh" xmi.id="RgYVg0ILDC0P" isRoot="false" isAbstract="false" name="MAXIMUS_STATION_STATUS_NB" />
+ </UML:Enumeration>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bJtzCEyKnKFK" isRoot="false" isAbstract="false" name="Device_Access_Key" elementReference="LIcXhcTtT8Bn" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="WO0VJglkKJD1" isRoot="false" isAbstract="false" name="File_Descriptor" elementReference="UOc7OI8LRuFv" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="JUKVeIsFclEo" isRoot="false" isAbstract="false" name="Error_Id" elementReference="UOc7OI8LRuFv" />
+ <UML:Enumeration stereotype="enum" comment="// System_Header.type//" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="yD8lVM51i3U1" isRoot="false" isAbstract="false" name="System_Type" >
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="yD8lVM51i3U1" xmi.id="jFk2Zv1qPLL1" isRoot="false" isAbstract="false" name="SYSTEM_TYPE_NONE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="yD8lVM51i3U1" xmi.id="dDHFxT1vgAg9" isRoot="false" isAbstract="false" name="SYSTEM_TYPE_IDLE" />
+ <UML:EnumerationLiteral isSpecification="false" isLeaf="false" visibility="public" namespace="yD8lVM51i3U1" xmi.id="UjACmfDUsvWR" isRoot="false" isAbstract="false" name="SYSTEM_TYPE_NB" />
+ </UML:Enumeration>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="uvuzFPfmVe3t" isRoot="false" isAbstract="false" name="CallbackFunction" />
+ <UML:Generalization isSpecification="false" child="Szlq4RFfiqZ0" visibility="public" namespace="Logical View" xmi.id="FFjd7SEcLuGj" parent="2j8N30UlnykR" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="FBsPeH4gEvUD" visibility="public" namespace="Logical View" xmi.id="UmoLPXdZOnAp" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bEeZdY0xhVQw" isRoot="false" isAbstract="false" name="Function_Call_Header" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="yfv0x3wqUorr" isRoot="false" isAbstract="false" name="void" />
+ <UML:Generalization isSpecification="false" child="nMqHFdX6fOJd" visibility="public" namespace="Logical View" xmi.id="E1EkeKXGrlqW" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="hCCozGYEQBhw" isRoot="false" isAbstract="false" name="Network_Clock_Header" />
+ <UML:Generalization isSpecification="false" child="l6c6ZbY9k4oU" visibility="public" namespace="Logical View" xmi.id="isrV4NWwNe9f" parent="pdUJAVtJe39T" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="4F2mG2WvecbT" isRoot="false" isAbstract="false" name="uint32_t" />
+ <UML:Generalization isSpecification="false" child="SU7oJl8r1vpC" visibility="public" namespace="Logical View" xmi.id="cCYiC0P09ms7" parent="97JXVDPWi2XZ" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="1Ey5TfpDf9m6" visibility="public" namespace="Logical View" xmi.id="7PxcRil5PsG3" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="qzlFUs4gsJKl" isRoot="false" isAbstract="false" name="unsigned short int" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="YFYivL7lKsyo" isRoot="false" isAbstract="false" name="Phy_Header" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="FGkVafnZOxkd" isRoot="false" isAbstract="false" name="Sci_Msg_Header" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="8RfL5UmYopms" isRoot="false" isAbstract="false" name="uint8_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="TTjyPYhZVm6n" isRoot="false" isAbstract="false" name="pid_t" />
+ <UML:Generalization isSpecification="false" child="bBWfkvMSUBzc" visibility="public" namespace="Logical View" xmi.id="4QEmSahd4YcC" parent="0dybVkdpO4Ya" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="kNRjwgcIhcX0" visibility="public" namespace="Logical View" xmi.id="qpo9SZnjuaBV" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="idECE5nt0Vr7" isRoot="false" isAbstract="false" name="System_Header" />
+ <UML:Generalization isSpecification="false" child="Awyu6tX5fqlW" visibility="public" namespace="Logical View" xmi.id="oHaNwpXsoPxf" parent="pkwx1nQd15WY" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fuM43CRtzagH" isRoot="false" isAbstract="false" name="error_t" />
+ <UML:Generalization isSpecification="false" child="SU7oJl8r1vpC" visibility="public" namespace="Logical View" xmi.id="H8aJ4nCJ2vwd" parent="97JXVDPWi2XZ" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="1Ey5TfpDf9m6" isRoot="false" isAbstract="false" name="IoZujw7YP8ON" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="7PxcRil5PsG3" />
+ </UML:GeneralizableElement.generalization>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="97JXVDPWi2XZ" isRoot="false" isAbstract="false" name="NegQ4Jb1bsXM" />
+ <UML:Generalization isSpecification="false" child="3DGvGCGP6it9" visibility="public" namespace="Logical View" xmi.id="w3A8Aoem0rz9" parent="Ab0NMXybAfZU" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="CFHqNaZGkqY1" visibility="public" namespace="Logical View" xmi.id="vHrlTmC4TCgk" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="3DGvGCGP6it9" visibility="public" namespace="Logical View" xmi.id="PmhWbSfkhcsw" parent="Ab0NMXybAfZU" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="DQE4VzTfZR3v" visibility="public" namespace="Logical View" xmi.id="ZqxQgPtEQ5Pf" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="SU7oJl8r1vpC" isRoot="false" isAbstract="false" name="x8uSJr2jpnXr" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="cCYiC0P09ms7" />
+ <UML:Generalization xmi.idref="H8aJ4nCJ2vwd" />
+ </UML:GeneralizableElement.generalization>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="CFHqNaZGkqY1" isRoot="false" isAbstract="false" name="gSdgqQLeJTBZ" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="vHrlTmC4TCgk" />
+ </UML:GeneralizableElement.generalization>
+ </UML:Class>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="rNYhJGFqdJWf" isRoot="false" isAbstract="false" name="SciMsg *" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="812hl7Twm80d" isRoot="false" isAbstract="false" name="EtherSciMsg*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3Q4QiXaDv1Kh" isRoot="false" isAbstract="false" name="EtherSciMsg&amp;" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="PwWdyuRfg8qc" isRoot="false" isAbstract="false" name="Ethernet_Header*" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="6PMoYeoBvXGW" isRoot="false" isAbstract="false" name="EthernetProcessor*" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="TCtwHZhr7lwx" isRoot="false" isAbstract="false" name="Ether_Type" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="EXCTf5VmCpZP" isRoot="false" isAbstract="false" name="const Ethernet_Header*" />
+ <UML:Generalization isSpecification="false" child="CpGnr2lIA5kk" visibility="public" namespace="Logical View" xmi.id="knNFU41hWrYt" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="3DGvGCGP6it9" visibility="public" namespace="Logical View" xmi.id="1uNWjzNZmvRK" parent="Ab0NMXybAfZU" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="DQE4VzTfZR3v" visibility="public" namespace="Logical View" xmi.id="EyMIfoIzY4LJ" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="DhQX2rY6wPDZ" isRoot="false" isAbstract="false" name="Phy_Fc_Mode" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="UgPIutO5ambc" isRoot="false" isAbstract="false" name="Phy_Short_Ppdu" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="6Qx7AaWcHvu9" isRoot="false" isAbstract="false" name="Phy_Mod" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="TJe4s63xXy2f" isRoot="false" isAbstract="false" name="Phy_Fecrate" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tWAq6KHaeveU" isRoot="false" isAbstract="false" name="Phy_Gil" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2yOeu36ujWRN" isRoot="false" isAbstract="false" name="Phy_Tx_Id" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="eKZEv9oVXM34" isRoot="false" isAbstract="false" name="Phy_Nb_Of_Symbols" />
+ <UML:Generalization isSpecification="false" child="kooC0I8IkF1k" visibility="public" namespace="Logical View" xmi.id="wqho3l7CAaCs" parent="KqJ8bZTEut0O" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="Kd2vdgexbsmt" visibility="public" namespace="Logical View" xmi.id="kW8FuRBYKjoB" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="4mmdfk3zM4Cq" isRoot="false" isAbstract="false" name="maximus" />
+ <UML:Generalization isSpecification="false" child="l6c6ZbY9k4oU" visibility="public" namespace="Logical View" xmi.id="bF4M7ruT7PG9" parent="pdUJAVtJe39T" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="O8DTzb5kluKg" isRoot="false" isAbstract="false" name="Python script" />
+ <UML:Generalization isSpecification="false" child="Kd2vdgexbsmt" visibility="public" namespace="Logical View" xmi.id="2uCdtjrgLfpr" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="gjYrACSC9BuB" visibility="public" namespace="Logical View" xmi.id="D8KuNhepKAPe" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="uHdgUvjiSZG6" visibility="public" namespace="Logical View" xmi.id="XhEs3csvqUn6" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="emjq7Xks8DWW" visibility="public" namespace="Logical View" xmi.id="78n0YovcPcSY" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="C6sJEmNl1TfP" isRoot="false" isAbstract="false" name="interface" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="9uUW4XZ5t7nP" isRoot="false" isAbstract="false" name="RdHavJxZcLT1" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Ab0NMXybAfZU" isRoot="false" isAbstract="false" name="T6S74K0HDK2p" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3DGvGCGP6it9" isRoot="false" isAbstract="false" name="YElIyHEIHrrU" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="w3A8Aoem0rz9" />
+ <UML:Generalization xmi.idref="PmhWbSfkhcsw" />
+ <UML:Generalization xmi.idref="1uNWjzNZmvRK" />
+ </UML:GeneralizableElement.generalization>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="DQE4VzTfZR3v" isRoot="false" isAbstract="false" name="EoA21qthFyQa" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="ZqxQgPtEQ5Pf" />
+ <UML:Generalization xmi.idref="EyMIfoIzY4LJ" />
+ </UML:GeneralizableElement.generalization>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="kooC0I8IkF1k" visibility="public" namespace="Logical View" xmi.id="mPpaajecotJ6" parent="KqJ8bZTEut0O" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="Kd2vdgexbsmt" visibility="public" namespace="Logical View" xmi.id="bbEXkRwwAMUd" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="uHdgUvjiSZG6" visibility="public" namespace="Logical View" xmi.id="2HEQAGupXJCO" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="gjYrACSC9BuB" visibility="public" namespace="Logical View" xmi.id="mRseT4TBFAfy" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="vSu5lsg0a7WJ" visibility="public" namespace="Logical View" xmi.id="5oSJ5pfRXEKM" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="emjq7Xks8DWW" visibility="public" namespace="Logical View" xmi.id="osPEzRTtgtfK" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="K1iCj3mMQwQL" isRoot="false" isAbstract="false" name="cb_t" />
+ <UML:Generalization isSpecification="false" child="RYfxHmW7DMwU" visibility="public" namespace="Logical View" xmi.id="lfdP22D7S0Ta" parent="vpDXE2tS2kJL" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="CpGnr2lIA5kk" visibility="public" namespace="Logical View" xmi.id="OKhFhtT3InZ0" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="HTUXG3XFPxuK" isRoot="false" isAbstract="false" name="Ethernet_Type" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bErx1XNsRKIs" isRoot="false" isAbstract="false" name="Ethernet_Header" />
+ <UML:Generalization isSpecification="false" child="kooC0I8IkF1k" visibility="public" namespace="Logical View" xmi.id="qMFrrMkplbDq" parent="KqJ8bZTEut0O" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="Kd2vdgexbsmt" visibility="public" namespace="Logical View" xmi.id="Y9t3iv153eXZ" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="uHdgUvjiSZG6" visibility="public" namespace="Logical View" xmi.id="NkEF2MRQX3KN" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="gjYrACSC9BuB" visibility="public" namespace="Logical View" xmi.id="I5POjRXvITtd" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="vSu5lsg0a7WJ" visibility="public" namespace="Logical View" xmi.id="GpnnjAimICRg" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="emjq7Xks8DWW" visibility="public" namespace="Logical View" xmi.id="t2VHdgaE0EUP" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="nMqHFdX6fOJd" visibility="public" namespace="Logical View" xmi.id="tAhKmf7IFJ6T" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="l6c6ZbY9k4oU" visibility="public" namespace="Logical View" xmi.id="UjcieFEY4Y2B" parent="pdUJAVtJe39T" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="Szlq4RFfiqZ0" visibility="public" namespace="Logical View" xmi.id="kc9Nze8S0Bjw" parent="2j8N30UlnykR" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="FBsPeH4gEvUD" visibility="public" namespace="Logical View" xmi.id="w86S4WF4jxpo" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="sWYhCThWlDFP" isRoot="false" isAbstract="false" name="uint16_t" />
+ <UML:Generalization isSpecification="false" child="bBWfkvMSUBzc" visibility="public" namespace="Logical View" xmi.id="SqtM7IeD47EL" parent="0dybVkdpO4Ya" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="kNRjwgcIhcX0" visibility="public" namespace="Logical View" xmi.id="kZodzZdOFIKk" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="ElUvZ3tKAVPh" visibility="public" namespace="Logical View" xmi.id="XIEfe2iXktPm" parent="PKaM1HoCDbbs" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="FNAWFo5m56XX" isRoot="false" isAbstract="false" name="Channel_Settings_Key" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="ZlFJOJZWpHJ0" type="uNcSkNqyAxHb" name="tx_station_id" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="lvs2tNy8i7cx" type="uNcSkNqyAxHb" name="rx_station_id" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vhhynCUKwjdK" isRoot="false" isAbstract="false" name="ltkey" >
+ <UML:Classifier.feature>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="0BooQ7oB3gBu" isRoot="false" isAbstract="false" isQuery="false" name="operator ( )" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SL9hyA785w7e" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="adOWKzqKAd8Z" value="" type="2A0kHciAJN94" name="key1" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kuklZwfb4fLJ" value="" type="2A0kHciAJN94" name="key2" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="I2tMfCdvE4TZ" isRoot="false" isAbstract="false" name="ChannelSettingsList" elementReference="yHm6ssfdnOOK" />
+ <UML:Class comment="class ChannelComputer" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="f4Wo0xIyC255" isRoot="false" isAbstract="false" name="ChannelComputer" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="uigf62zM4sii" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes//// for random" isSpecification="false" visibility="private" xmi.id="2bn9FjKszVLx" type="bfhvSo8YsYdy" name="mEngine" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="PsDvdrWFWC8z" type="qzlFUs4gsJKl" name="mNumberOfCopiesArray" ownerScope="classifier" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="yHVop6npiayx" type="nJsED87p1vHp" name="mPowerScaleArray" ownerScope="classifier" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="HGnEk8A9yN4c" type="FYDrFS8mDoaL" name="mpTonemask" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="FZrjjxihEBW1" type="cKqCpL4vHbUA" name="mpListOfStations" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="IHpypnt72gLm" type="I2tMfCdvE4TZ" name="mListOfChannelSettings" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="oVvnrxP4WEnF" type="DshIKK2Zspzs" name="mBeaconPeriod" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BUvOfPNvgCtV" isRoot="false" isAbstract="false" isQuery="false" name="ChannelComputer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yma0SukFNf0E" value="" type="DEOmV9sHIiVw" name="p_phy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="cNI7b6KkYD6B" value="" type="TXhtlZjMAp7C" name="p_system" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cS7Ge0kalIaB" isRoot="false" isAbstract="false" isQuery="false" name="~ ChannelComputer" />
+ <UML:Operation comment="// public methods// /**
+Duplicate the MPDU payload.
+@param mpdu a PHY SCI message MPDU that contains the complete received MPDU payload
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CIQaxQoYn5dM" isRoot="false" isAbstract="false" isQuery="false" name="duplicateMpduPayload" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CdfOwVbouVjB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9v5h99sjbz0G" value="" type="XNEzxlV9pJ9M" name="mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute PB measurement and NOISE.
+@param pb_measurement_array the PB measurement to fill in (for all PBs composing the MPDU)
+@param noise the PHY SCI message NOISE to fill in
+@param pb_header_array the PB header of each PB composing the MPDU
+@param mpdu a PHY SCI message MPDU that contains the duplicated MPDU payload
+@param tx_station_id the ID of the transmitting station
+@param rx_station_id the ID of the destination station
+@param current_tick the current Network Clock tick
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="yioj0NsDfJnd" isRoot="false" isAbstract="false" isQuery="false" name="addPerturbation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XMKz3j6T4F93" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hZ9TeknnfsSo" value="" type="fL9t737j70re" name="pb_measurement_array" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2LYdIWrEEgvE" value="" type="j5EvHIixdpql" name="noise" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3oPg7AHmkQFM" value="" type="t2asNnHh8wsl" name="pb_header_array" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="A3AqtactvAVC" value="" type="FVFtK4cB028u" name="mpdu" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eKQsyM5zAUgF" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fx1NMFjUGrI7" value="" type="dsRw8nRMsxE8" name="rx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Sv1N3UXioyYn" value="" type="Fls26ZE3bRdo" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add Channel Settings to the list.
+Called when a station is created => create its associated Channel Settings.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KdmS6QflOg8i" isRoot="false" isAbstract="false" isQuery="false" name="addChannelSettings" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="NG9SCF4Mshlm" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="trC9hVH9QGUR" value="" type="dsRw8nRMsxE8" name="created_station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Find Channel Settings.
+@param tx_station_id the ID of the transmitting station
+@param rx_station_id the ID of the destination station
+@return a list of Channel Settings" isSpecification="false" isLeaf="false" visibility="public" xmi.id="k29W0gJIJ4iP" isRoot="false" isAbstract="false" isQuery="false" name="findChannelSettings" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CKb5nIELeWIf" type="SuGBQogD9iYR" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="UN8q1EYv4l2l" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GHueXO5FQDmO" value="" type="dsRw8nRMsxE8" name="rx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="t3eA7MYajgOl" value="" type="3lgc1KcaMAny" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when the PHY processor receives a preamble.
+@param current_tick the current Network Clock tick
+@param tx_station_id the ID of the transmitting station
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="vxezggkuycWT" isRoot="false" isAbstract="false" isQuery="false" name="receivePre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="FO9IbGJyWQPg" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0bhPmRndUSoa" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mM8W0WFvRts7" value="" type="Fls26ZE3bRdo" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when the PHY processor receives a frame control.
+@param current_tick the current Network Clock tick
+@param tx_station_id the ID of the transmitting station
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZazVCVxD5car" isRoot="false" isAbstract="false" isQuery="false" name="receiveFc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fT1WBkGL4pQs" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3LVVlH5YbD2b" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="iHV9ANFhyCB8" value="" type="Fls26ZE3bRdo" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Sets the tonemask.
+@param p_tonemask the new value of mpTonemask
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="i6JlitclF5Gy" isRoot="false" isAbstract="false" isQuery="false" name="setTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="7dBk9RPPqWfP" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KKWvVYVDn0Lx" value="" type="S02STVfDWPXk" name="p_tonemask" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemap of the current transmission.
+@return bool
+@param tx_station_id the ID of the transmitting station
+@param length the tonemap length in octets
+@param p_tonemap the tonemap" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LYdHkoQQujBa" isRoot="false" isAbstract="false" isQuery="false" name="setTonemap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="myOGMnx0EwWP" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bmJorXmArH3N" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nYYbWrWqP75A" value="" type="qtOabrV06r8H" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tVYlDkLmWeaL" value="" type="Z3mduvueNb9d" name="p_tonemap" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the beacon period in ticks 25 MHz.
+@return bool
+@param frequency the power-line frequency" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CKV1ZXML5tua" isRoot="false" isAbstract="false" isQuery="false" name="setBeaconPeriod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="gmlic9ahmjRw" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kQQAWVIPzqBA" value="" type="EQrcJtA2vC7c" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the Channel Computer class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="aUw49UQJmtIM" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="Gets a tonemask value.
+@param carrier_index
+@return a boolean value indicating if the requested carrier is enabled or not" isSpecification="false" isLeaf="false" visibility="private" xmi.id="QfhUYb4IzSQV" isRoot="false" isAbstract="false" isQuery="false" name="getTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BrJzNyO8umOG" type="3lgc1KcaMAny" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vgtuX225WwAd" value="" type="qZLXuibBNXID" name="carrier_index" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Update the list of Channel Settings.
+Called when channel perturbation has to be added.
+Check if stations have been removed => remove their associated Channel Settings." isSpecification="false" isLeaf="false" visibility="private" xmi.id="QYwDRDXqsCKO" isRoot="false" isAbstract="false" isQuery="false" name="updateListOfChannelSettings" />
+ <UML:Operation comment="Gets the beacon period in ticks 25 MHz.
+@return mBeaconPeriod" isSpecification="false" isLeaf="false" visibility="private" xmi.id="nMeko5Ejl7cG" isRoot="false" isAbstract="false" isQuery="false" name="getBeaconPeriod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XJGmFk9tVuc5" type="O74yXfkidyrR" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// protected methods// All following protected methods could be declared as private methods,// but they are declared as protected methods to be unitarly tested.///**
+Gets the sigma factor.
+@param modulation the tonemap modulation
+@param snr_in_db the SNR value in dB
+@return the sigma factor" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="9cMfZUJx2D8R" isRoot="false" isAbstract="false" isQuery="false" name="getSigma" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="2AmouEi5514Q" type="PFhzx975rDDm" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Aj6AvEZJspah" value="" type="MbP7gzMpbiS8" name="modulation" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OCKKTf1nEQvu" value="" type="EQrcJtA2vC7c" name="snr_in_db" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PowerScale.
+@param modulation the tonemap modulation
+@return 1 / (PowerScale^2)" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="Qm5Ibdz0oHIF" isRoot="false" isAbstract="false" isQuery="false" name="getPowerScale" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xSYrDv6kEKUS" type="EQrcJtA2vC7c" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wH3Aiw45Bj26" value="" type="MbP7gzMpbiS8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the linear SNR.
+@param snr_in_db the SNR value in dB
+@return the linear SNR value" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="tABiLOUlAX1k" isRoot="false" isAbstract="false" isQuery="false" name="getLinearSnr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3eLYWvdY6NN0" type="PFhzx975rDDm" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9zkvG2ABJBLz" value="" type="EQrcJtA2vC7c" name="snr_in_db" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add noise.
+@param point the original point coordinates
+@param sigma the sigma factor
+@return the noise point coordinates" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="7O3I75OyFXgZ" isRoot="false" isAbstract="false" isQuery="false" name="addNoise" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="b55e5732XZsk" type="GvaXRE3v0jhy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Wminy2l5OmMV" value="" type="t8K2eKmlJWeX" name="point" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="riS5G6e9DwBr" value="" type="PFhzx975rDDm" name="sigma" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the BER.
+@param codeA / codeB the 2 codes to compare
+@return the BER" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="jQ27COb3636K" isRoot="false" isAbstract="false" isQuery="false" name="computeBer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="UwThEx9HZSn6" type="qZLXuibBNXID" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9kSMfbBtXjPw" value="" type="qZLXuibBNXID" name="codeA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vSsu9Xqtxs09" value="" type="qZLXuibBNXID" name="codeB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the noise.
+@param pointA / pointB the 2 points coordinates
+@return the (distance)^2 between the 2 points" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="EbAJeHbmz36e" isRoot="false" isAbstract="false" isQuery="false" name="computeNoise" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OQcUmzUN3X06" type="O74yXfkidyrR" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fGWAzv6tLwnU" value="" type="t8K2eKmlJWeX" name="pointA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TdNQWMXixi1a" value="" type="t8K2eKmlJWeX" name="pointB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the FER.
+@param ber the BER of the current PB
+@param n the average number of bits coded per carrier on the current PB
+@param modulation the tonemap modulation
+@return the FER" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="xdKweQZHg5Re" isRoot="false" isAbstract="false" isQuery="false" name="computeFer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="c389cyu7uLo9" type="EQrcJtA2vC7c" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yYXJUIlwv9MP" value="" type="qZLXuibBNXID" name="ber" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Vs8QY7yViIRN" value="" type="O74yXfkidyrR" name="n" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jycN34zzcUI4" value="" type="MbP7gzMpbiS8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the CRC error.
+@param fer the FER of the current PB
+@return the CRC error" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="m40iBL7eDD2l" isRoot="false" isAbstract="false" isQuery="false" name="computeCrcError" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="GvQqNEulcWDM" type="3lgc1KcaMAny" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="L1E3JdO0c1Od" value="" type="EQrcJtA2vC7c" name="fer" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="f4Wo0xIyC255" visibility="public" namespace="Logical View" xmi.id="uigf62zM4sii" parent="mKTfuY7pgyOI" discriminator="" name="" />
+ <UML:Package isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="dIDTyvYIWngb" isRoot="false" isAbstract="false" name="boost" >
+ <UML:Namespace.ownedElement>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="dIDTyvYIWngb" xmi.id="bfhvSo8YsYdy" isRoot="false" isAbstract="false" name="mt19937" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="QfHGrZecvJNh" isRoot="false" isAbstract="false" name="Channel_Mod" />
+ <UML:Class comment="ChannelPoint.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelPoint.h
+//**
+class ChannelPoint" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="7WkpCVeuHxVw" isRoot="false" isAbstract="false" name="ChannelPoint" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// public attributes// // abscissa" isSpecification="false" visibility="public" xmi.id="5LdfotjaxiG6" type="nJsED87p1vHp" name="I" />
+ <UML:Attribute comment="// ordinate" isSpecification="false" visibility="public" xmi.id="3MiEZlxumBw5" type="nJsED87p1vHp" name="Q" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="oI6OJS2MlfzZ" isRoot="false" isAbstract="false" isQuery="false" name="ChannelPoint" />
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Wh8SPOYQkHeK" isRoot="false" isAbstract="false" isQuery="false" name="ChannelPoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0bCmk8pWRtvi" value="" type="nJsED87p1vHp" name="i" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Jx55a2c6jkY8" value="" type="EQrcJtA2vC7c" name="q" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="95YrMA9MlM6T" isRoot="false" isAbstract="false" isQuery="false" name="~ ChannelPoint" />
+ <UML:Operation comment="// public methods// /**
+Operator =
+@param channel_point
+@return ChannelPoint &amp;" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Sv0rpva8sdBQ" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WhkXCkdoljyN" type="Egoy0uRTnPKa" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="foWPY5VfA4XU" value="" type="t8K2eKmlJWeX" name="channel_point" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Operator ==
+@param channel_point
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KsjAVsa9g7WF" isRoot="false" isAbstract="false" isQuery="false" name="operator ==" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iqSc9GjP9AFX" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="A1sI3PmG4YC4" value="" type="t8K2eKmlJWeX" name="channel_point" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Checks Channel Point values ranges,
+i.e. checks I and Q coordinates validity.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="SbXD1qoLiVUC" isRoot="false" isAbstract="false" isQuery="false" name="checkValidity" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="M9GweUJ891fK" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="ChannelMapping.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelMapping.h
+//**
+class ChannelMapping" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="N4J4BnHJo9bq" isRoot="false" isAbstract="false" name="ChannelMapping" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes//" isSpecification="false" visibility="private" xmi.id="XL4btGdJr9Xs" type="7WkpCVeuHxVw" name="mPoint" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="zLCfqgpBk8Fu" type="qzlFUs4gsJKl" name="mCode" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="tUBicnW98ai2" type="qzlFUs4gsJKl" name="mNbOfBitsArray" ownerScope="classifier" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="MsB4zOwsr8YT" type="oJLfSqWPBi3z" name="mMappingArray" ownerScope="classifier" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="v2a1cG1OZN40" isRoot="false" isAbstract="false" isQuery="false" name="ChannelMapping" />
+ <UML:Operation stereotype="constructor" comment="Constructors" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BaNNGQKaHTeE" isRoot="false" isAbstract="false" isQuery="false" name="ChannelMapping" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qb6hhd8cfibG" value="" type="qZLXuibBNXID" name="code" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ydeVygT9GrUU" isRoot="false" isAbstract="false" isQuery="false" name="ChannelMapping" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Hp4WGjk6Ipnz" value="" type="t8K2eKmlJWeX" name="point" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="SvZ5b8LXly3h" isRoot="false" isAbstract="false" isQuery="false" name="~ ChannelMapping" />
+ <UML:Operation comment="// public methods// /**
+Computes the code from the already set I and Q coordinates.
+@param modulation the used modulation
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="eWptLJLb6Q7N" isRoot="false" isAbstract="false" isQuery="false" name="computeCode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="jG8Uz4rfsKI1" type="qZLXuibBNXID" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7sTNhFM9AtCk" value="" type="MbP7gzMpbiS8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Computes the I and Q coordinates from an already set code.
+@param modulation the used modulation
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="1WHlUKS6pHxA" isRoot="false" isAbstract="false" isQuery="false" name="computePoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YzPg7eBRmROQ" type="t8K2eKmlJWeX" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZJjdhr0ojS9O" value="" type="MbP7gzMpbiS8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Retrieve the integer (except for QAM8) I and Q coordinates from the already set I and Q coordinates.
+@param modulation the used modulation
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hTVpMhZNDp8f" isRoot="false" isAbstract="false" isQuery="false" name="retrievePoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tfY1gBLNPRrM" type="GvaXRE3v0jhy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9Zmwoj5L0ozh" value="" type="MbP7gzMpbiS8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Sets the code.
+@param modulation the used modulation
+@param mpdu_payload_length the length of the MPDU payload
+@param p_mpdu_payload pointer to the MPDU payload
+@param mpdu_index indicates the current index of the MPDU payload (in bits)
+@return bool (and update mpdu_index)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="fxTMPci45DsR" isRoot="false" isAbstract="false" isQuery="false" name="setCode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Ug2KyIKVHjBP" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tPn6EtmMSWIF" value="" type="MbP7gzMpbiS8" name="modulation" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DLaEAXvnVP8u" value="" type="qtOabrV06r8H" name="mpdu_payload_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1qx54pWxEH1R" value="" type="Z3mduvueNb9d" name="p_mpdu_payload" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wcKR1SK1JH6N" value="" type="BlnbH3oVPPjZ" name="mpdu_index" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the code.
+@param code the new value of mCode
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4aIGsJh15UcK" isRoot="false" isAbstract="false" isQuery="false" name="setCode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LMq7lCVdr1eV" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WRpvoWSi9m88" value="" type="qZLXuibBNXID" name="code" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the code.
+@return mCode" isSpecification="false" isLeaf="false" visibility="public" xmi.id="FS7YhDtlmB1e" isRoot="false" isAbstract="false" isQuery="false" name="getCode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AxqZOhwqMwBK" type="qzlFUs4gsJKl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the coordinates.
+@param point the new value of mPoint
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ShdX9FsfefaQ" isRoot="false" isAbstract="false" isQuery="false" name="setPoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EVnVEysZIhf4" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="C29JnHP2hXYO" value="" type="t8K2eKmlJWeX" name="point" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Channel Point.
+@return mPoint" isSpecification="false" isLeaf="false" visibility="public" xmi.id="iR7Ua662njYv" isRoot="false" isAbstract="false" isQuery="false" name="getPoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="t8hj8JEIG5qe" type="Egoy0uRTnPKa" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the I coordinate.
+@param i the new value of mPoint.I
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xOab392D99Uw" isRoot="false" isAbstract="false" isQuery="false" name="setI" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kkV6gePu9CNL" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Quw5PUT7tYcR" value="" type="EQrcJtA2vC7c" name="i" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the I coordinate.
+@return mPoint.I" isSpecification="false" isLeaf="false" visibility="public" xmi.id="egUQQ0JNOrwP" isRoot="false" isAbstract="false" isQuery="false" name="getI" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9EuRvXTogAXo" type="EQrcJtA2vC7c" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Q coordinate.
+@param q mPoint.Q
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="0yd8752VzzaO" isRoot="false" isAbstract="false" isQuery="false" name="setQ" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Rk4hnuKXencI" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="R1ULZ6mCmEaA" value="" type="EQrcJtA2vC7c" name="q" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Q coordinate.
+@return mPoint.Q" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CtXakU0jQbrW" isRoot="false" isAbstract="false" isQuery="false" name="getQ" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="RzAY9WtIklif" type="EQrcJtA2vC7c" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="oJLfSqWPBi3z" isRoot="false" isAbstract="false" name="short int" />
+ <UML:Class comment="ChannelSettings.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelSettings.h
+//**
+class ChannelSettings" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="PJbHtdSeqfcR" isRoot="false" isAbstract="false" name="ChannelSettings" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes//" isSpecification="false" visibility="private" xmi.id="gt1eqa0GbUZ9" type="4Kduenu6BUBZ" name="mIsConfigured" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="YJLJYvTkozJW" type="nJsED87p1vHp" name="mSnrArray" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="RHFrs6NWyNAm" type="QfHGrZecvJNh" name="mTonemapArray" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="x92YdbfAv0TR" type="PDzFlxMB73D7" name="mPreDetectionDate" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="tu9hrSEIhRAZ" type="PDzFlxMB73D7" name="mFcReceptionDate" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WV4SsCEpLFMx" isRoot="false" isAbstract="false" isQuery="false" name="ChannelSettings" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="q15j0WAtQIZI" isRoot="false" isAbstract="false" isQuery="false" name="~ ChannelSettings" />
+ <UML:Operation comment="// public methods// /**
+Gets the first symbol start date (in ticks).
+@return tick at which the first symbol has started" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ilYQCixiE1A6" isRoot="false" isAbstract="false" isQuery="false" name="getFirstSymbolStartDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JBRzKxllhpRU" type="Fls26ZE3bRdo" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the tonemap modulation.
+@param carrier the current carrier number
+@return the tonemap modulation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CNuVcESQDVAD" isRoot="false" isAbstract="false" isQuery="false" name="getModulation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="klzMYZfzYpVg" type="MbP7gzMpbiS8" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1I5QaegJPEjb" value="" type="O74yXfkidyrR" name="carrier" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the SNR in dB.
+@param interval the current interval number
+@param carrier the current carrier number
+@return the SNR in dB" isSpecification="false" isLeaf="false" visibility="public" xmi.id="vgI9gSDsn5NP" isRoot="false" isAbstract="false" isQuery="false" name="getSnr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LOw39eiSo8P6" type="EQrcJtA2vC7c" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="JoqVJ0gJIljr" value="" type="Fls26ZE3bRdo" name="beacon_period" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PNAobrQWVgdB" value="" type="Fls26ZE3bRdo" name="symbol_start_date" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6p1uuNJCB7hS" value="" type="O74yXfkidyrR" name="carrier" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Gets if the channel has been configured.
+@return mIsConfigured" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5NjM9QDWnLLN" isRoot="false" isAbstract="false" isQuery="false" name="isConfigured" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5Apm0GEi1B4X" type="3lgc1KcaMAny" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the SNR.
+@param snr_value SNR value in dB
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CjrhPVrVIqNC" isRoot="false" isAbstract="false" isQuery="false" name="setSnr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="jhUFVzvqNssV" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DfMMm3nsPWEW" value="" type="EQrcJtA2vC7c" name="snr_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemap of the current transmission.
+@return bool
+@param tonemap_array the new value of mTonemapArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="GYaf2m9zBAgt" isRoot="false" isAbstract="false" isQuery="false" name="setTonemap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="UYxIgLOlVEVT" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VlnYgMz4lsk0" value="" type="MbP7gzMpbiS8" name="tonemap_array[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PRE detection date.
+@param date tick at which the preamble has been received
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BdQ6sBo8jMmm" isRoot="false" isAbstract="false" isQuery="false" name="setPreDetectionDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ShBStEzcvUrO" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8tjH1PAX9v3n" value="" type="Fls26ZE3bRdo" name="date" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the FC reception date.
+@param date tick at which the frame control has been received
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="G0s1tcz4DN85" isRoot="false" isAbstract="false" isQuery="false" name="setFcReceptionDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TlFpd5K7dFOK" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZxCGJw0Qnihp" value="" type="Fls26ZE3bRdo" name="date" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the Channel Settings class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="5qKElN0zNq0G" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="Sets if the channel is configured.
+@param is_configured the new value of mIsConfigured
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="SxIeLPjsMt6d" isRoot="false" isAbstract="false" isQuery="false" name="setIsConfigured" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="am36yZXPEhr5" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="n73bnlOsZi5I" value="" type="3lgc1KcaMAny" name="is_configured" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PRE detection date.
+@return mPreDetectionDate tick at which the preamble has been received" isSpecification="false" isLeaf="false" visibility="private" xmi.id="55IQvGhLExzX" isRoot="false" isAbstract="false" isQuery="false" name="getPreDetectionDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vqfoIXDkGQZt" type="Fls26ZE3bRdo" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the FC reception date.
+@return mFcReceptionDate tick at which the frame control has been received" isSpecification="false" isLeaf="false" visibility="private" xmi.id="MhPgYTKMYNvL" isRoot="false" isAbstract="false" isQuery="false" name="getFcReceptionDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Vry86MQf7Uj3" type="Fls26ZE3bRdo" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the time interval.
+@param symbol_start_date the current symbol start date in ticks
+@return the interval number" isSpecification="false" isLeaf="false" visibility="private" xmi.id="6JEd1Jw4MEUF" isRoot="false" isAbstract="false" isQuery="false" name="getInterval" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3GSHxJNq82fQ" type="O74yXfkidyrR" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="S9ag7YDRDa8l" value="" type="Fls26ZE3bRdo" name="beacon_period" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2S5an0wsJAVI" value="" type="Fls26ZE3bRdo" name="symbol_start_date" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="RYfxHmW7DMwU" visibility="public" namespace="Logical View" xmi.id="P1Cz8K6JKeJ1" parent="vpDXE2tS2kJL" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="CpGnr2lIA5kk" visibility="public" namespace="Logical View" xmi.id="b5C38IYyUjh0" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="D3DUDdA4BXcR" isRoot="false" isAbstract="false" name="compareMsgId" >
+ <UML:Classifier.feature>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="jSV1dsLPmSGq" isRoot="false" isAbstract="false" isQuery="false" name="operator ( )" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XqAlEhcjYbpd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4Rpg6OhHQuld" value="" type="2JrrgMpWtl6M" name="msg_id1" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VtfgQH77ja6M" value="" type="2JrrgMpWtl6M" name="msg_id2" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="SRkFry3tOtYS" isRoot="false" isAbstract="false" name="CallbacksList" />
+ <UML:Class comment="class FunctionCallManager" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Szlq4RFfiqZ0" isRoot="false" isAbstract="false" name="FunctionCallManager" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="FFjd7SEcLuGj" />
+ <UML:Generalization xmi.idref="kc9Nze8S0Bjw" />
+ <UML:Generalization xmi.idref="uZl36d1qRclf" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="raWAUltd7jW1" type="SRkFry3tOtYS" name="mListOfCallbacks" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="dmOwhy7bcAr6" type="xXbKcOH2nKjB" name="mpSciServer" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="iZoWyAQnivxA" isRoot="false" isAbstract="false" isQuery="false" name="FunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="gqnlXKk8495l" value="" type="xXbKcOH2nKjB" name="sci_server" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7CLhKCo3kaZg" isRoot="false" isAbstract="false" isQuery="false" name="~ FunctionCallManager" />
+ <UML:Operation comment="// public methods// /**
+@return FunctionSciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kxUSsRaWGOFl" isRoot="false" isAbstract="false" isQuery="false" name="createMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vGI0k14lFU0D" type="JCIhsw1mHbC2" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param msg_id
+@param callback_address" isSpecification="false" isLeaf="false" visibility="public" xmi.id="g0uk7zTE9muS" isRoot="false" isAbstract="false" isQuery="false" name="registerCallback" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="mL1uMeIrURdi" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ziVhG2N1xrRq" value="" type="2JrrgMpWtl6M" name="msg_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="H2KVOaG4aAmh" value="" type="O0Y4e7L2YuKE" name="callback_address" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_function_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7FtH2ljzRCgi" isRoot="false" isAbstract="false" isQuery="false" name="sendMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8DPfoDIiRYgB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="C1j9t8x88IbW" value="" type="JCIhsw1mHbC2" name="p_function_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qraO0M37auMa" isRoot="false" isAbstract="false" isQuery="false" name="sendMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XiumDsxxEzpY" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="g5X7FDpPCWZ3" value="" type="taPZHCs4KBPK" name="function_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="fUBnkmKYcswc" isRoot="false" isAbstract="false" isQuery="false" name="receiveMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="d7P6Y0mfEAK0" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Dzhlu4La9shN" value="" type="Q7aANH0SNANP" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+@return pointer to mListOfCallbacks" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3VmF1JJgoSSW" isRoot="false" isAbstract="false" isQuery="false" name="getListOfCallbacks" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Nagm6Nvd3pNE" type="Dk5pczPnz6Yr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="AtPIj4fkZR0b" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="jHFVhh1uR4h2" isRoot="false" isAbstract="false" isQuery="false" name="registerFunctionSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="hJBtG0Pr8nve" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="44p1BOsJFHbz" isRoot="false" isAbstract="false" isQuery="false" name="displayListOfCallbacks" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZllXuTRZV4sC" isRoot="false" isAbstract="false" isQuery="false" name="FunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="J3yww40I35qa" value="" type="T3wGzLaOdJRi" name="p_sci_server" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="Szlq4RFfiqZ0" visibility="public" namespace="Logical View" xmi.id="uZl36d1qRclf" parent="2j8N30UlnykR" discriminator="" name="" />
+ <UML:Class comment="FunctionCallParameter.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/functioncall/inc/FunctionCallParameter.h
+//**
+class FunctionCallParameter" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="JEjtehSNwhqe" isRoot="false" isAbstract="false" name="FunctionCallParameter" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="NrWouCoyGezP" type="QBMG0J8pDlsx" name="mName" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="2phF4GENVwE7" type="LIcXhcTtT8Bn" name="mValueLength" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="dgUaMIEj9iV1" type="ObMobD4JO6Fx" name="mpValue" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uKz9wwYwlFBn" isRoot="false" isAbstract="false" isQuery="false" name="FunctionCallParameter" />
+ <UML:Operation stereotype="constructor" comment="Copy Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WQBzMP6x4YXQ" isRoot="false" isAbstract="false" isQuery="false" name="FunctionCallParameter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="t2mcFyQjMZig" value="" type="qj7xSczKuwTq" name="parameter" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wmd0KBO8sV6K" isRoot="false" isAbstract="false" isQuery="false" name="FunctionCallParameter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="63f0z6rq8bTM" value="" type="QBMG0J8pDlsx" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Xt5tQoXMYBNt" value="" type="LIcXhcTtT8Bn" name="value_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Kl1CF5VL88L8" value="" type="ObMobD4JO6Fx" name="p_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="EAyLkPhHGm9g" isRoot="false" isAbstract="false" isQuery="false" name="~ FunctionCallParameter" />
+ <UML:Operation comment="// public methods// " isSpecification="false" isLeaf="false" visibility="public" xmi.id="Yg37rQy99xMM" isRoot="false" isAbstract="false" isQuery="false" name="operator ==" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="niJzqbyBBcxH" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3ph9x1FBBCWt" value="" type="qj7xSczKuwTq" name="parameter" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="bBBsyKWU0ZZq" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xss1hEFMXREl" type="AtFJ5jDgvMWr" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xXz5TJRW89f5" value="" type="qj7xSczKuwTq" name="parameter" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="g3LectUYOSdr" isRoot="false" isAbstract="false" isQuery="false" name="displayParameter" />
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Get the value of mName
+@return the value of mName" isSpecification="false" isLeaf="false" visibility="public" xmi.id="l4LuDzzLsCdx" isRoot="false" isAbstract="false" isQuery="false" name="getName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PdcXQYACET94" type="QBMG0J8pDlsx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mName
+@return bool
+@param name the new value of mName" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wobrA8io91Sl" isRoot="false" isAbstract="false" isQuery="false" name="setName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="55FEiCUf4Kej" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="svHHNu86zS0A" value="" type="9U1uI8HJT0Jf" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mName
+@return bool
+@param name the new value of mName" isSpecification="false" isLeaf="false" visibility="public" xmi.id="RyUJA5E6tpx1" isRoot="false" isAbstract="false" isQuery="false" name="setName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Yu33JFmitPEH" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0taxLa7kWZ3h" value="" type="xdn6dFqV85mT" name="p_name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mValue Length
+@return the value of mValueLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="eHnV4jU2KH6x" isRoot="false" isAbstract="false" isQuery="false" name="getValueLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vOR7pZBseO7K" type="LIcXhcTtT8Bn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mValueLength
+@return bool
+@param value_length the new value of mValueLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VuTb0D5y4fvN" isRoot="false" isAbstract="false" isQuery="false" name="setValueLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YZyatcHQUKRn" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="D07ka8PCNAgS" value="" type="qtOabrV06r8H" name="value_length" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mpValue" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tASCSY9vRaWP" isRoot="false" isAbstract="false" isQuery="false" name="getValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="aEWRbkgU86bv" type="ObMobD4JO6Fx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_value the new value of mpValue" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mbNoEICQIH8q" isRoot="false" isAbstract="false" isQuery="false" name="setValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fkoH6vaeSWEL" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QX3lhjDZrdlH" value="" type="Z3mduvueNb9d" name="p_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="AsCbRh0BINzV" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="CxVwuGjKYPlO" isRoot="false" isAbstract="false" name="ParametersList" />
+ <UML:Class comment="class FunctionSciMsg" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="FBsPeH4gEvUD" isRoot="false" isAbstract="false" name="FunctionSciMsg" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="UmoLPXdZOnAp" />
+ <UML:Generalization xmi.idref="w86S4WF4jxpo" />
+ <UML:Generalization xmi.idref="bBGWS2FbowsE" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// // Get from specialized SCI message header//" isSpecification="false" visibility="private" xmi.id="HtgfhrS9xQuR" type="60clcAU0xnx5" name="mSpecializedSciMsgType" />
+ <UML:Attribute comment="// to send to station" isSpecification="false" visibility="private" xmi.id="M8XTHVzTFMBi" type="2JrrgMpWtl6M" name="mSpecializedSciMsgId" ownerScope="classifier" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="H9hzty6ArmoW" type="iYfdxrJ7viR4" name="mSpecializedSciMsgParametersNumber" />
+ <UML:Attribute comment="// Specialized SCI msg header//" isSpecification="false" visibility="private" xmi.id="a3kQqWuPiYyL" type="1PQGjZx0iexb" name="mpSpecializedSciMsgHeader" />
+ <UML:Attribute comment="// Unique string identifier for function call//" isSpecification="false" visibility="private" xmi.id="7yImSgiT36hm" type="QBMG0J8pDlsx" name="mFunctionName" />
+ <UML:Attribute comment="// Function parameters//" isSpecification="false" visibility="private" xmi.id="genMHiwrmeFa" type="CxVwuGjKYPlO" name="mListOfParameters" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="AAzsiwCnuSXK" type="FM9MFyrLE5ts" name="mpFunctionCallManager" />
+ <UML:Attribute comment="// Specialized SCI msg header//" isSpecification="false" visibility="private" xmi.id="Q9L84AutwWTs" type="bEeZdY0xhVQw" name="mSpecializedSciMsgHeader" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7GnAKVxy9iJO" isRoot="false" isAbstract="false" isQuery="false" name="FunctionSciMsg" />
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="QFGAtTk1dirM" isRoot="false" isAbstract="false" isQuery="false" name="FunctionSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="e17WUfrbtejB" value="" type="FM9MFyrLE5ts" name="p_function_call_manager" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Copy Constructors" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7gAFMRdlgrvX" isRoot="false" isAbstract="false" isQuery="false" name="FunctionSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LgWyMNI0POUr" value="" type="Q7aANH0SNANP" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="1LQuy933oBI8" isRoot="false" isAbstract="false" isQuery="false" name="~ FunctionSciMsg" />
+ <UML:Operation comment="// public methods// /**
+@return SciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cutGlpn4TJ1p" isRoot="false" isAbstract="false" isQuery="false" name="create" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8TjbnBOLPsk0" type="hHn4fFvgbLYX" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="SaaGlrPOlGeU" isRoot="false" isAbstract="false" isQuery="false" name="dispatchMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="cPSiV3e8nSNt" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5QZWjaJOr6QV" isRoot="false" isAbstract="false" isQuery="false" name="identifySpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LxVnTh6aAqBv" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ML9vegQ5G0J1" isRoot="false" isAbstract="false" isQuery="false" name="checkCompatibility" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1XHOQzM2Oojt" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_argument_to_add" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pgNax052QcX7" isRoot="false" isAbstract="false" isQuery="false" name="addParameter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rNzcnNT6Kytm" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="CqU1xuWHEeAq" value="" type="qj7xSczKuwTq" name="function_argument_to_add" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param name_of_parameter_to_get
+@param p_data" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KavaYFZOvxws" isRoot="false" isAbstract="false" isQuery="false" name="bindParameter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fxKnnVim2z8Q" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="x1tLbQQnGunB" value="" type="9U1uI8HJT0Jf" name="name_of_parameter_to_get" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nHQ1vapF8lph" value="" type="iB4yZDFSik45" name="data_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yP3tKzkFzbaa" value="" type="ObMobD4JO6Fx" name="p_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="1yMFt9PeQpdM" isRoot="false" isAbstract="false" isQuery="false" name="identifyFunctionName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xUTLGAD7VChI" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="OSZWBNB9mE14" isRoot="false" isAbstract="false" isQuery="false" name="identifyParameters" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Z8Os6FcjCwWy" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ClJBMrjLp5Yg" isRoot="false" isAbstract="false" isQuery="false" name="fillSpecializedSciMsgToSend" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PFkPCtq9LHTc" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="EvKdlxx7OWdZ" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgHeader" />
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Get the value of mSpecializedSciMsgType
+@return the value of mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tpjd1kfDTwMn" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="RghwsNCQVaIa" type="60clcAU0xnx5" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgType
+@return bool
+@param type the new value of mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="n66bBeFOYazJ" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nuJxoovD3ecD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sZ1LVO6HUCsd" value="" type="VwQtQ1TIoAvq" name="type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of msg_id
+@return the value of msg_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="o71Mf0dBu32L" isRoot="false" isAbstract="false" isQuery="false" name="getMsgId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XSLqjoS8U84M" type="2JrrgMpWtl6M" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mSpecializedSciMsgId
+@return the value of mSpecializedSciMsgId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3TdrdWfV3hoZ" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VGm0o2aZuuXi" type="2JrrgMpWtl6M" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Increment the value of mSpecializedSciMsgId
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5uqX6gAvnAFR" isRoot="false" isAbstract="false" isQuery="false" name="incrementSpecializedSciMsgId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="gSvh6WubwFSe" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mSpecializedSciMsgParametersNumber
+@return the value of mSpecializedSciMsgParametersNumber" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8tc3ucMx6xnj" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgParametersNumber" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3smX0psV3cWs" type="iYfdxrJ7viR4" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgParametersNumber
+@return bool
+@param number_of_parameters the new value of mSpecializedSciMsgParametersNumber" isSpecification="false" isLeaf="false" visibility="public" xmi.id="RSDV712Awqh2" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgParametersNumber" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="d4PXwwGcP9JT" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vRu1Ofio5vHD" value="" type="WqvJ0Bi64K7w" name="number_of_parameters" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpSpecializedSciMsgHeader
+@return the value of mpSpecializedSciMsgHeader into a void pointer" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xJNr93tftnwr" isRoot="false" isAbstract="false" isQuery="false" name="returnSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fC5aPVETNyyO" type="TYfZTukOB7DK" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mpSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="87xzsrqoUkoQ" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="norrPLh2Q6ZK" type="1PQGjZx0iexb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_specialized_sci_msg_header the new value of mpSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="niGFX66yejX5" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3pxQxEtaQwAq" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rHQJ1Chovw4Q" value="" type="bHSmNf4TkzTc" name="p_specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mFunctionName
+@return the value of mFunctionName" isSpecification="false" isLeaf="false" visibility="public" xmi.id="28MeqshR77EU" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="RMHpLDB820xR" type="QBMG0J8pDlsx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mFunctionName
+@return bool
+@param name the new value of mFunctionName" isSpecification="false" isLeaf="false" visibility="public" xmi.id="lIyVIR67iUQi" isRoot="false" isAbstract="false" isQuery="false" name="setFunctionName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="McTkj04koz8l" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="f6WY2Yy2fIeV" value="" type="9U1uI8HJT0Jf" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mListOfParameters
+@return the value of mListOfParameters" isSpecification="false" isLeaf="false" visibility="public" xmi.id="AJwIR8kARidh" isRoot="false" isAbstract="false" isQuery="false" name="getListOfParameters" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="E1LcyUSPqhCB" type="Ks2QuFd1iYTQ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mListOfParameters
+@return bool
+@param list_of_parameters the new value of mListOfParameters" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7jooCCWrI0NI" isRoot="false" isAbstract="false" isQuery="false" name="setListOfParameters" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vLIvMDKgqlQX" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XJKCbwfmGZ4f" value="" type="Ks2QuFd1iYTQ" name="list_of_parameters" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpFunctionCallManager
+@return mpFunctionCallManager" isSpecification="false" isLeaf="false" visibility="public" xmi.id="iop7VSoaAaMM" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lSFZSNIgOcIK" type="FM9MFyrLE5ts" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mpFunctionCallManager
+@return bool
+@param p_function_call_manager the new value of mpFunctionCallManager" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mqB3rYLMreYQ" isRoot="false" isAbstract="false" isQuery="false" name="setFunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6jiwOs6HEOCY" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="aBCokETS3IZW" value="" type="FM9MFyrLE5ts" name="p_function_call_manager" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="lL6vvTFgJOj8" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="w2Ule0BF9O1u" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgType" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="aVKdns7WDEP7" isRoot="false" isAbstract="false" isQuery="false" name="displayFunctionName" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="fenw2W3wWVfB" isRoot="false" isAbstract="false" isQuery="false" name="displayParameter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="UrOdDPXnusPg" value="" type="DshIKK2Zspzs" name="parameter_iterator" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="kWAvia2LCpGD" isRoot="false" isAbstract="false" isQuery="false" name="displayListOfParameters" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zNLW6edynEwJ" isRoot="false" isAbstract="false" isQuery="false" name="FunctionSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Nllcddv4kGAp" value="" type="qcb8l3xv8TRt" name="p_function_call_manager" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param name
+Remove the parameter named name from the function SCI message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="uaklPv8vKcqs" isRoot="false" isAbstract="false" isQuery="false" name="removeParameter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="bUEPDcwz4BWW" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="V7by3cpHX7dc" value="" type="trv86yL4jfeS" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Display the specialized SCI message type." isSpecification="false" isLeaf="false" visibility="public" xmi.id="dTcbIRfWRszE" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="b1E3Wr2Ck0jZ" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgHeader.msg_id
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DXZgqHeyznqh" isRoot="false" isAbstract="false" isQuery="false" name="setMsgId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YpAvRRFVAvRW" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Qlw9CrMhR0Vg" value="" type="gFFNUwPz4TDC" name="msg_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgHeader.reserved
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MexYW51gIxOy" isRoot="false" isAbstract="false" isQuery="false" name="setReserved" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="oVo0tyYTRmse" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xzPFwnDmHmTT" value="" type="QXEg7cwSFt0l" name="reserved" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3pTkKpWS9lpM" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OpdSy8xXv7QK" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vvV7QsAgT0Fq" value="" type="IdrZNJ0YPvUj" name="specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mpFunctionCallManager
+@return bool
+@param p_function_call_manager the new value of mpFunctionCallManager" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tttVk4P00qr6" isRoot="false" isAbstract="false" isQuery="false" name="setFunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YdpgZEDLkzLb" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YQ8uoljwth6v" value="" type="qcb8l3xv8TRt" name="p_function_call_manager" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="FBsPeH4gEvUD" visibility="public" namespace="Logical View" xmi.id="bBGWS2FbowsE" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="nMqHFdX6fOJd" visibility="public" namespace="Logical View" xmi.id="MJySUUa4fP54" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class comment="class ClockSciMsg" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="nMqHFdX6fOJd" isRoot="false" isAbstract="false" name="ClockSciMsg" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="E1EkeKXGrlqW" />
+ <UML:Generalization xmi.idref="tAhKmf7IFJ6T" />
+ <UML:Generalization xmi.idref="MJySUUa4fP54" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// // Get from specialized SCI msg header//" isSpecification="false" visibility="private" xmi.id="rz2gkqCi9n3k" type="acFbRvXTEMIs" name="mSpecializedSciMsgType" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="FCfTYqKT5rid" type="2OUKpDmUU6Tg" name="mSpecializedSciMsgId" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="01N7XprMor2W" type="PDzFlxMB73D7" name="mSpecializedSciMsgTick" />
+ <UML:Attribute comment="// Specialized SCI message header//" isSpecification="false" visibility="private" xmi.id="rkydbz8GBI4B" type="10N6r5hp62ve" name="mpSpecializedSciMsgHeader" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="YaNwl3ql1Drs" type="dxoHI48VOHpd" name="mpNetworkClockProcessor" />
+ <UML:Attribute comment="// Specialized SCI message header//" isSpecification="false" visibility="private" xmi.id="he6wwAPcfneH" type="hCCozGYEQBhw" name="mSpecializedSciMsgHeader" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="JXgPZZ1RHy2s" isRoot="false" isAbstract="false" isQuery="false" name="ClockSciMsg" />
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="x866R8HxgdsP" isRoot="false" isAbstract="false" isQuery="false" name="ClockSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eiAfw0VFX9c6" value="" type="dxoHI48VOHpd" name="p_network_clock_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ieVxaWnXetd3" isRoot="false" isAbstract="false" isQuery="false" name="~ ClockSciMsg" />
+ <UML:Operation comment="// public methods///**
+@return SciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zt1fUt58ZDlV" isRoot="false" isAbstract="false" isQuery="false" name="create" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vt2Mfv11icRe" type="hHn4fFvgbLYX" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DGiiOLp4xI2X" isRoot="false" isAbstract="false" isQuery="false" name="dispatchMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kOBdUbx0Dkhm" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="op2RhdUgUTKy" isRoot="false" isAbstract="false" isQuery="false" name="identifySpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xs7fpSGkJH7w" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MN4wapPm48SQ" isRoot="false" isAbstract="false" isQuery="false" name="checkCompatibility" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="A8xqkMUTjg6D" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="RHUOYWtMMvl1" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgHeader" />
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+@return mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WGh1jzz4M2yv" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="F2DQksChiHMX" type="acFbRvXTEMIs" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param type the new value of mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pNfrT7HuNmGv" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="hbI0sPw2VrsD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GX0dZwWNI9El" value="" type="G9Fc21bZFJYw" name="type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mSpecializedSciMsgId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="EWebIuUY2k92" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EMev0j8ElJeV" type="2OUKpDmUU6Tg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param id the new value of mSpecializedSciMsgId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jiZy17sIdrtA" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ApBs6XQm8gmy" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Lm4LWBODuvBt" value="" type="nNX5UmpiITKY" name="id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mSpecializedSciMsgTick" isSpecification="false" isLeaf="false" visibility="public" xmi.id="329et0ogLMkp" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgTick" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3h0YYqjkBOf9" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param tick the new value of mSpecializedSciMsgTick" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8XYOyquJcwd7" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgTick" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="7lNq30JDnU5r" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="81K0uUrvW1ZP" value="" type="Fls26ZE3bRdo" name="tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpSpecializedSciMsgHeader
+@return the value of mpSpecializedSciMsgHeader into a void pointer" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zO3LklAqIgCG" isRoot="false" isAbstract="false" isQuery="false" name="returnSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0Td89Q5C55id" type="TYfZTukOB7DK" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mpSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="U6Y72BC8AW64" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="wQM5ozEtlahm" type="10N6r5hp62ve" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_specialized_sci_msg_header" isSpecification="false" isLeaf="false" visibility="public" xmi.id="yy0UzZryvtHd" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="a0zLT2CTWqZd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="osoyOv1Lt1pq" value="" type="cSRv6d9bhfgi" name="p_specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods//" isSpecification="false" isLeaf="false" visibility="private" xmi.id="YfoSW458WX1a" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="ABBqopYdhMb4" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgType" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dUC2E0OFnGO9" isRoot="false" isAbstract="false" isQuery="false" name="ClockSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9iM9ktxRW1LS" value="" type="Dc4onmiEKP73" name="p_network_clock_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Display the specialized SCI message type." isSpecification="false" isLeaf="false" visibility="public" xmi.id="qbGpboWVV66k" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="g4KBqpdjbERj" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgHeader.id
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xMZbd0yv7NcB" isRoot="false" isAbstract="false" isQuery="false" name="setId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EeoJiUucuEhi" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jJshKLgEQ3MU" value="" type="nNX5UmpiITKY" name="id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgHeader.tick_high
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="nPMurd6mzdNd" isRoot="false" isAbstract="false" isQuery="false" name="setTickHigh" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EvZxTGj3FiOi" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dMWkh7tQQl5l" value="" type="ylvhNGRUzc7S" name="tick_high" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgHeader.tick_low
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5jxTmJyXgIRX" isRoot="false" isAbstract="false" isQuery="false" name="setTickLow" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kZ9EPgsdJeuz" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vXKv8fWlz2Vh" value="" type="ylvhNGRUzc7S" name="tick_low" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param specialized_sci_msg_header" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8APIp4mPGvIs" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8ob33GjH9JCd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="b60XlI8wJj7o" value="" type="bB3bDXILtLrz" name="specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class NetworkClockProcessor" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="l6c6ZbY9k4oU" isRoot="false" isAbstract="false" name="NetworkClockProcessor" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="isrV4NWwNe9f" />
+ <UML:Generalization xmi.idref="bF4M7ruT7PG9" />
+ <UML:Generalization xmi.idref="UjcieFEY4Y2B" />
+ <UML:Generalization xmi.idref="Bj3lrJ1e6Oct" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="b8rzl0c6gBqq" type="PDzFlxMB73D7" name="mCurrentTickValue" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="0cyrqanRieOR" type="U4mQnNTnRzFr" name="mpNetworkClockEvtList" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="dzYHAM8cQs2B" type="xXbKcOH2nKjB" name="mpSciServer" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="FTzfSCWSoSIc" type="8HFYeCh1V2Tr" name="mpSystemManager" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="252jhQAIPgaZ" type="FM9MFyrLE5ts" name="mpFunctionCallManager" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="2g9RY9cmdZP3" type="QR5iQfL4cAJs" name="mpPhyProcessor" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="NnWRJWdvFfV2" type="xqe85s2v3X76" name="mpEthernet" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mvUaOmBOpD7W" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockProcessor" />
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dIn1yNYz1iOX" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="r0HSagWMcyuy" value="" type="xXbKcOH2nKjB" name="p_sci_server" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="k5MXIU1ukotg" value="" type="8HFYeCh1V2Tr" name="p_system_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9RdA71gx2xPa" value="" type="FM9MFyrLE5ts" name="p_function_call_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="etuErmAZsW68" value="" type="QR5iQfL4cAJs" name="p_phy_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="y60gutN2JyCQ" isRoot="false" isAbstract="false" isQuery="false" name="~ NetworkClockProcessor" />
+ <UML:Operation comment="// public methods// /**
+@param evt_to_send
+@param tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="0sL0ojaScSgS" isRoot="false" isAbstract="false" isQuery="false" name="createEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Eqz6K4DHABv2" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5G4MFFkF56Ft" value="" type="VcPcOcsgjQbo" name="evt_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_insert
+@param tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pnLPFzpTppY8" isRoot="false" isAbstract="false" isQuery="false" name="insertEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Xvemb1SJaZYz" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tjN3uI5zZ8Jo" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="N41SAEMx1hME" value="" type="VcPcOcsgjQbo" name="evt_to_insert" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_remove
+@param tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hChUzDaswxtr" isRoot="false" isAbstract="false" isQuery="false" name="removeEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="GOaX2UWAI7DJ" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ewon48ZRCYuK" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mEFlvbzale3k" value="" type="VcPcOcsgjQbo" name="evt_to_remove" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="sbamXTblQQWS" isRoot="false" isAbstract="false" isQuery="false" name="processNextEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LvYUEk7jfmWE" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="W5ugdmyN0D8t" value="" type="Fls26ZE3bRdo" name="max_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_process" isSpecification="false" isLeaf="false" visibility="public" xmi.id="m5SYjTGZ4rMb" isRoot="false" isAbstract="false" isQuery="false" name="processEvtNone" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nyYNY4KmSsJS" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IxKgLq9rv1XW" value="" type="j0sNksMuhVaF" name="evt_to_process" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_process" isSpecification="false" isLeaf="false" visibility="public" xmi.id="lTrjgzaT40zm" isRoot="false" isAbstract="false" isQuery="false" name="processEvtRemove" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="MnccsowDjUhv" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TFLW4h5LdQ1y" value="" type="j0sNksMuhVaF" name="evt_to_process" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_process" isSpecification="false" isLeaf="false" visibility="public" xmi.id="G8oA9JesnUbT" isRoot="false" isAbstract="false" isQuery="false" name="processEvtStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="DnesZ85K7dfd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="RAwUAtGc9b8B" value="" type="j0sNksMuhVaF" name="evt_to_process" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_process" isSpecification="false" isLeaf="false" visibility="public" xmi.id="HBWsZYqoecwo" isRoot="false" isAbstract="false" isQuery="false" name="processEvtFunctionCall" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="hzN7rgZBRBnJ" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wYej2EAUO5yY" value="" type="j0sNksMuhVaF" name="evt_to_process" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_process" isSpecification="false" isLeaf="false" visibility="public" xmi.id="yE85nGH2Qnuz" isRoot="false" isAbstract="false" isQuery="false" name="processEvtPhy" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xhWeADXN0CDX" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="JjlyLhkFGMyI" value="" type="j0sNksMuhVaF" name="evt_to_process" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_process" isSpecification="false" isLeaf="false" visibility="public" xmi.id="a9myCiVAudGg" isRoot="false" isAbstract="false" isQuery="false" name="processEvtSystem" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KIrPvW0aTNhK" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sXiGIbDaIzWb" value="" type="j0sNksMuhVaF" name="evt_to_process" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+@return Network_Clock_Tick" isSpecification="false" isLeaf="false" visibility="public" xmi.id="gGrwanFBuz76" isRoot="false" isAbstract="false" isQuery="false" name="getCurrentTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1GTSQHlLwH06" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="iaHcEVG42zII" isRoot="false" isAbstract="false" isQuery="false" name="setCurrentTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TXTRhhz0zoNt" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YVsoUOPBcE7B" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return the value of mpNetworkClockEvtList" isSpecification="false" isLeaf="false" visibility="public" xmi.id="0KMsIRzy2EYE" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClockEvtList" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LOTmjB5jPYBn" type="U4mQnNTnRzFr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+@return bool
+@param clock_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="private" xmi.id="jpGjoYzK3q8Y" isRoot="false" isAbstract="false" isQuery="false" name="sendEvtMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pv9kA7qbeI3K" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jXLljtzQgD7U" value="" type="CVhnimyi5KYN" name="clock_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="l7mpxsL7M0u4" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="mskrAICuoXdX" isRoot="false" isAbstract="false" isQuery="false" name="registerClockSciMsg" />
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="k1SNpgCZzaNa" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IFkE9EFwcjoP" value="" type="T3wGzLaOdJRi" name="p_sci_server" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TpRpLfW3fyPU" value="" type="TXhtlZjMAp7C" name="p_system_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fb4c9PAPesen" value="" type="qcb8l3xv8TRt" name="p_function_call_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6rhibV64JVrc" value="" type="DEOmV9sHIiVw" name="p_phy_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4BuOJTKhEo6V" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LhRYMwY1QEPV" value="" type="T3wGzLaOdJRi" name="p_sci_server" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="gFMKi2OmBI8V" value="" type="TXhtlZjMAp7C" name="p_system_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mQAyFGUYwv6I" value="" type="qcb8l3xv8TRt" name="p_function_call_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="reHGrhjXu5rc" value="" type="DEOmV9sHIiVw" name="p_phy_processor" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7DNGWTjGurE9" value="" type="xqe85s2v3X76" name="p_ethernet" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ADkV7ZCp3CBi" isRoot="false" isAbstract="false" isQuery="false" name="removeEvts" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="x0Kwohn73Hun" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qbpjm36Rcm5I" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes an event of type ETHERNET.
+@param evt_to_process
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="nQj9T8nxc6e2" isRoot="false" isAbstract="false" isQuery="false" name="processEvtEthernet" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="QxUnVfbJYk3j" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GRO5b0lX0afE" value="" type="j0sNksMuhVaF" name="evt_to_process" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to the PHY processor.
+@return IPhy *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="zbFi79sfdIB2" isRoot="false" isAbstract="false" isQuery="false" name="getPhy" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="prKT9Ll6J516" type="DEOmV9sHIiVw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to Ethernet.
+@return mpEthernet" isSpecification="false" isLeaf="false" visibility="private" xmi.id="NdFZJkiRSf4s" isRoot="false" isAbstract="false" isQuery="false" name="getEthernet" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="loDm35XR21FW" type="xqe85s2v3X76" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="l6c6ZbY9k4oU" visibility="public" namespace="Logical View" xmi.id="Bj3lrJ1e6Oct" parent="pdUJAVtJe39T" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="kooC0I8IkF1k" visibility="public" namespace="Logical View" xmi.id="QIT8Cyxljy5W" parent="KqJ8bZTEut0O" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="Kd2vdgexbsmt" visibility="public" namespace="Logical View" xmi.id="f7qcLRlLp3d5" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="uHdgUvjiSZG6" visibility="public" namespace="Logical View" xmi.id="hv5BD8rH260N" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Class comment="PhySciMsgFc.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/inc/PhySciMsgFc.h
+//**
+class PhySciMsgFc" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="uHdgUvjiSZG6" isRoot="false" isAbstract="false" name="PhySciMsgFc" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="XhEs3csvqUn6" />
+ <UML:Generalization xmi.idref="2HEQAGupXJCO" />
+ <UML:Generalization xmi.idref="NkEF2MRQX3KN" />
+ <UML:Generalization xmi.idref="hv5BD8rH260N" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="Yyh5FtRuHHXU" type="4F2mG2WvecbT" name="mFc10" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="gMWpiyFzxNga" type="4F2mG2WvecbT" name="mFcAvArray" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor
+Creates a PHY message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+@param p_phy_processor a pointer to the PHY interface" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qlEY5IQdG7gV" isRoot="false" isAbstract="false" isQuery="false" name="PhySciMsgFc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="y6PENvi1HCqz" value="" type="DEOmV9sHIiVw" name="p_phy_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="83x5QdeEMsmS" isRoot="false" isAbstract="false" isQuery="false" name="~ PhySciMsgFc" />
+ <UML:Operation comment="// public methods// /**
+Sets the PHY SCI message class attributes before transmission,
+and fills specialized SCI msg data length and specialized SCI msg data
+for a PHY message of type FC_AV_ONLY_MODE or FC_HYBRID_MODE.
+@param clock_id ID of the Network Clock event received message
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="AA3OFitDoHPB" isRoot="false" isAbstract="false" isQuery="false" name="prepare" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fopDWsuLjDmr" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="C7CRJ0PQ3KVR" value="" type="2OUKpDmUU6Tg" name="clock_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Gets the Frame Control 1.0.
+@return mFc10" isSpecification="false" isLeaf="false" visibility="public" xmi.id="v7fHzPj7ZlVo" isRoot="false" isAbstract="false" isQuery="false" name="getFc10" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YYxqbwwMl77m" type="ylvhNGRUzc7S" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Frame Control 1.0.
+@param fc_10 the new value of mFc10
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TNzFePOoUYDm" isRoot="false" isAbstract="false" isQuery="false" name="setFc10" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BeCBeRhJDWWj" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YcCZwfyrnb9k" value="" type="ylvhNGRUzc7S" name="fc_10" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Frame Control AV.
+@return mFcAvArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="0qsXZLJ0gGFK" isRoot="false" isAbstract="false" isQuery="false" name="getFcAv" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OR46cqx8Msyy" type="t2asNnHh8wsl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Frame Control AV.
+@param fc_av the new value of mFcAvArray
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="fd68BKuhu4Er" isRoot="false" isAbstract="false" isQuery="false" name="setFcAv" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="puIY2PKD2WOg" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hAgUlnFjc5GB" value="" type="ylvhNGRUzc7S" name="fc_av[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the PHY SCI message class attributes.
+Fills PHY SCI message type." isSpecification="false" isLeaf="false" visibility="private" xmi.id="OXC5oPNR3SZC" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="gjYrACSC9BuB" visibility="public" namespace="Logical View" xmi.id="LDY16XoozXTL" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="vSu5lsg0a7WJ" visibility="public" namespace="Logical View" xmi.id="8YLQXRKCCIRS" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="emjq7Xks8DWW" visibility="public" namespace="Logical View" xmi.id="38CRTOHxlKYx" parent="Kd2vdgexbsmt" discriminator="" name="" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="CWGE8DVJYvei" isRoot="false" isAbstract="false" name="DestStationsList" />
+ <UML:Class comment="class SciServer" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ElUvZ3tKAVPh" isRoot="false" isAbstract="false" name="SciServer" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="XIEfe2iXktPm" />
+ <UML:Generalization xmi.idref="IAY38dzMqpYq" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="pVfTLcQeTxif" type="QBMG0J8pDlsx" name="mStationLog" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="qRmZG8r3bVXu" type="s715so7RcDV9" name="mpSpecializedSciMsgArray" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="7vWZtDEjIDoA" type="DshIKK2Zspzs" name="mArraySize" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="ogt6tgErZqSi" type="cKqCpL4vHbUA" name="mpListOfStations" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="vCeSg7DHR3TF" type="PDzFlxMB73D7" name="mNetworkClockTick" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="PXAg6cosGfw7" isRoot="false" isAbstract="false" isQuery="false" name="SciServer" />
+ <UML:Operation stereotype="constructor" comment="Copy Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="JBzt1RZxbDNH" isRoot="false" isAbstract="false" isQuery="false" name="SciServer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hQUx4Q2Nb1Gd" value="" type="KaWkbzz0V7eb" name="" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="QqY13tHMTn64" isRoot="false" isAbstract="false" isQuery="false" name="~ SciServer" />
+ <UML:Operation comment="// public methods// /**
+@return bool
+@param station_log_file " isSpecification="false" isLeaf="false" visibility="public" xmi.id="l33GAhrr6JmA" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="v6z8aTpxsr3U" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="koVJomuEcSEd" value="" type="9U1uI8HJT0Jf" name="station_log" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool " isSpecification="false" isLeaf="false" visibility="public" xmi.id="LVxmG1r14uHE" isRoot="false" isAbstract="false" isQuery="false" name="process" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iyd4qb0fUJBW" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Z73dQnn8aHSO" isRoot="false" isAbstract="false" isQuery="false" name="fillSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iUhky3Qu7N0i" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="BiZGapS7wUlK" value="" type="3McdnqE6JCta" name="sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="HWTpntDqDoR0" isRoot="false" isAbstract="false" isQuery="false" name="sendSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rofjfgELepOS" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="cg5wqwU1c3FC" value="" type="xSzXJBSHo8yn" name="sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="siJmA25RZYHK" isRoot="false" isAbstract="false" isQuery="false" name="sendSciMsgToAllActiveStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OO6shHMQl38k" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PS9cGabtEgn4" value="" type="3McdnqE6JCta" name="sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set a value into mpSpecializedSciMsgArray
+@return bool
+@param sci_msg_type the array position to set
+@param sci_msg the new value of mpSpecializedSciMsgArray[sci_msg_type]" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cH4EIJO9zft9" isRoot="false" isAbstract="false" isQuery="false" name="registerSpecializedSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5XcCucsjOVT4" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="iyZFUoZtGiWV" value="" type="EknMLJBAPpgo" name="sci_msg_type" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="J7OVl9aNOcZe" value="" type="hHn4fFvgbLYX" name="sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param header
+@param data_length
+@param received_data" isSpecification="false" isLeaf="false" visibility="public" xmi.id="vvnvaf4IdbV8" isRoot="false" isAbstract="false" isQuery="false" name="receiveMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BfPnSnGqCMjt" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="P51gnV94aXaL" value="" type="erAlIci9mSIq" name="header" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="e8g2kFgf8SYj" value="" type="qtOabrV06r8H" name="data_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7bziCVqcYqGL" value="" type="Z3mduvueNb9d" name="received_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="JPOuuyFW6wYo" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgArray" />
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+@return StationsList *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="9CRGc0zjZwQl" isRoot="false" isAbstract="false" isQuery="false" name="getStationsList" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="d5HN7O7CvjOn" type="cKqCpL4vHbUA" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_list_of_stations" isSpecification="false" isLeaf="false" visibility="public" xmi.id="PELx2ZHMwfGq" isRoot="false" isAbstract="false" isQuery="false" name="setStationsList" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JFXik0mudBh5" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bTKfNsTX3unf" value="" type="cKqCpL4vHbUA" name="p_list_of_stations" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mArraySize
+@return the value of mArraySize" isSpecification="false" isLeaf="false" visibility="public" xmi.id="skNRenB21Uz4" isRoot="false" isAbstract="false" isQuery="false" name="getArraySize" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xvv9Fe0riGEp" type="DshIKK2Zspzs" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpSpecializedSciMsgArray
+@return the value of mpSpecializedSciMsgArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4EOytcnS577T" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgArray" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="eL1Z2NMLcr1N" type="s715so7RcDV9" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param current_tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="0Yy1RjgJT1j5" isRoot="false" isAbstract="false" isQuery="false" name="updateTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rnFSxwXuqR15" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="os7oM7qOJENB" value="" type="Fls26ZE3bRdo" name="current_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Network_Clock_Tick" isSpecification="false" isLeaf="false" visibility="public" xmi.id="q8dtFjMDHKEi" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClockTick" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3zulF8atRZQT" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="3t0UujajbhVv" isRoot="false" isAbstract="false" isQuery="false" name="log" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vlnXcosSc7uX" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param type
+@param received_sci_msg" isSpecification="false" isLeaf="false" visibility="private" xmi.id="mLI6XdFNlsG0" isRoot="false" isAbstract="false" isQuery="false" name="createSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="2SPqtOvuNqgd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZbErtSZvJZPE" value="" type="EknMLJBAPpgo" name="type" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GxvpfQlPj1TG" value="" type="s715so7RcDV9" name="received_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param msg_header
+@param data_length
+@param remaining_data
+@param received_sci_msg" isSpecification="false" isLeaf="false" visibility="private" xmi.id="eibPZrP8QbxK" isRoot="false" isAbstract="false" isQuery="false" name="fillSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="wEUOovrjeeEG" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2XFL4cZJaU8D" value="" type="erAlIci9mSIq" name="msg_header" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="srcbs4rUkStH" value="" type="qtOabrV06r8H" name="data_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IHQgqN0ssDEv" value="" type="Z3mduvueNb9d" name="received_data" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qlEQEKb6ABi0" value="" type="s715so7RcDV9" name="created_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param received_sci_msg" isSpecification="false" isLeaf="false" visibility="private" xmi.id="FXVyyOFEdfuU" isRoot="false" isAbstract="false" isQuery="false" name="processSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="R5g3CbYC1x2s" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1vMr6YmwIyKW" value="" type="hHn4fFvgbLYX" name="received_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="HtaR5IRIowGm" isRoot="false" isAbstract="false" isQuery="false" name="displaySciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JwmgkSHghm4T" type="QBMG0J8pDlsx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="JW0wBuQAnl2u" value="" type="8RfL5UmYopms" name="sci_msg_type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="HmoZj7300eR5" isRoot="false" isAbstract="false" isQuery="false" name="displayStatus" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="uqOineU68U0I" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="// private attribute accessor methods// /**
+@return std::string" isSpecification="false" isLeaf="false" visibility="private" xmi.id="NPSAAS2PFpzy" isRoot="false" isAbstract="false" isQuery="false" name="getStationLog" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fuAJWOXxTEye" type="QBMG0J8pDlsx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_to_send
+@param " isSpecification="false" isLeaf="false" visibility="public" xmi.id="zHkGrUnn4Onb" isRoot="false" isAbstract="false" isQuery="false" name="sendSciMsgToDestStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pUqoPrginSPX" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vWLFcfRpmPBn" value="" type="3McdnqE6JCta" name="sci_msg_to_send" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="H2iKwatvpd9g" value="" type="eqNqcEputAw7" name="list_of_dest_stations" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="ElUvZ3tKAVPh" visibility="public" namespace="Logical View" xmi.id="IAY38dzMqpYq" parent="PKaM1HoCDbbs" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0vcc95kxWWVn" isRoot="false" isAbstract="false" name="StationsList" />
+ <UML:Class comment="StationConfiguration.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/inc/StationConfiguration.h
+//**
+class StationConfiguration" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="OvNqoCObl8CH" isRoot="false" isAbstract="false" name="StationConfiguration" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="wv2nq1dXlwOr" type="tn89GJwm2DQU" name="mCcoCapability" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="JZxkV8It3gis" type="XmVg46uC4n8q" name="mBridgeCapability" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="q4RZCeq8XqtN" type="BEIun6kQm0UQ" name="mHomeplugVersion" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="rWtaRFRioORJ" type="bJtzCEyKnKFK" name="mDeviceAccessKey" />
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="bai6gzkJrv6v" type="QBMG0J8pDlsx" name="mStationExecutable" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="3xtAgo722W76" type="QBMG0J8pDlsx" name="mStationName" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VhAYNsOBwok8" isRoot="false" isAbstract="false" isQuery="false" name="StationConfiguration" />
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="QaEvR8JGeAp3" isRoot="false" isAbstract="false" isQuery="false" name="StationConfiguration" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PGmBdBU8sceE" value="" type="bJtzCEyKnKFK" name="device_access_key" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="V3PPpAYFimA7" value="" type="tn89GJwm2DQU" name="cco_capability" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uRMXZBYyRK74" value="" type="XmVg46uC4n8q" name="bridge_capability" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TZAMCpafsz4f" value="" type="BEIun6kQm0UQ" name="homeplug_version" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="9cuqN4xFUJk3" isRoot="false" isAbstract="false" isQuery="false" name="~ StationConfiguration" />
+ <UML:Operation comment="// public methods// // public attribute accessor methods// // private attribute accessor methods// /**
+@return bool
+@param cco_capability" isSpecification="false" isLeaf="false" visibility="public" xmi.id="UJ0ub7w5f7Rr" isRoot="false" isAbstract="false" isQuery="false" name="setCcoCapability" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tgBYQG1589Mc" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LtlpBWtdprXQ" value="" type="w1WmyaR6BJwY" name="cco_capability" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param bridge_capability" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wSTbZuSTtwFq" isRoot="false" isAbstract="false" isQuery="false" name="setBridgeCapability" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Xuaz6Wbt1RhQ" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TzWGq1hkTAM0" value="" type="VewgxsCIjx8s" name="bridge_capability" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param homeplug_version" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3mTujgkCKgsH" isRoot="false" isAbstract="false" isQuery="false" name="setHomeplugVersion" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="GL93nWYeAkCb" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="aOD1XX0aKTU1" value="" type="W4aE1i6TfajT" name="homeplug_version" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param device_access_key" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ADDSt3kO7Kc6" isRoot="false" isAbstract="false" isQuery="false" name="setDeviceAccessKey" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yBe4K1gqtGnz" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rmk9EDAOQLoH" value="" type="0gZfFH6nfJoC" name="device_access_key" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="OYfTsHZqw9TB" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3jUGUiy3Ig9w" isRoot="false" isAbstract="false" isQuery="false" name="StationConfiguration" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6x8a4CdlguDO" value="" type="drESmKOpFHzv" name="station_executable" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sHeXOZ8Gnb25" value="" type="QBMG0J8pDlsx" name="station_name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// // public attribute accessor methods// // private attribute accessor methods// /**
+Set the station executable.
+@param station_executable the new value of mStationExecutable" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Z6vG07cqOFLm" isRoot="false" isAbstract="false" isQuery="false" name="setStationExecutable" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lOqmnXC4sJ5d" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="oS0Z33c0tuEi" value="" type="trv86yL4jfeS" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station executable.
+@return mStationExecutable" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7VcDt5NQBGg9" isRoot="false" isAbstract="false" isQuery="false" name="getStationExecutable" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pcI0MSZIeDMw" type="trv86yL4jfeS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station name.
+@param station_name the new vale of mStationName" isSpecification="false" isLeaf="false" visibility="public" xmi.id="NHzjWJUIlUrm" isRoot="false" isAbstract="false" isQuery="false" name="setStationName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="E2k5HX42vsoj" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VTmOLy7SRhdI" value="" type="trv86yL4jfeS" name="station_name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the station name.
+@return mStationName" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kyjvEN4ae2H8" isRoot="false" isAbstract="false" isQuery="false" name="getStationName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PynFGqr5S73m" type="trv86yL4jfeS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class Station" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="G1jpotlnS9ne" isRoot="false" isAbstract="false" name="Station" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="QZy3tkEiVyrj" type="WO0VJglkKJD1" name="mInputPipe" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="9z5XItpgSU9I" type="WO0VJglkKJD1" name="mOutputPipe" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="kg9gnapBAlF1" type="WO0VJglkKJD1" name="mLogPipe" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="gvR6OYO8EVm2" type="TTjyPYhZVm6n" name="mPid" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="6bDEKSFntwmJ" type="zczAjgq81yYh" name="mStationStatus" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="URqzCwkqqBwC" type="qzlFUs4gsJKl" name="mStationIdleCounter" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="bJkVFWmhwce8" type="jIKxm4xqfB4z" name="mpStationConfiguration" />
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="WBTxq6Gb2zWH" type="WO0VJglkKJD1" name="mInputFileDescriptor" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="MZpzb47soYu0" type="WO0VJglkKJD1" name="mOutputFileDescriptor" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor
+//**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WOyKZsWGAoBu" isRoot="false" isAbstract="false" isQuery="false" name="Station" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="s9kVKoSt5DOI" value="" type="QBMG0J8pDlsx" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hAxdkbjHzfbW" isRoot="false" isAbstract="false" isQuery="false" name="~ Station" />
+ <UML:Operation comment="// public methods// " isSpecification="false" isLeaf="false" visibility="public" xmi.id="X8kguwan5LGN" isRoot="false" isAbstract="false" isQuery="false" name="operator ==" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Zc4BqO62Rq8g" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0wnycOS7UDnP" value="" type="7jGBwdRbnPDW" name="station" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="7OAAjQXo9lz3" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OAiH1U0QQleg" type="nBSGMFfRdnbK" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ORdAoqgmkRiM" value="" type="7jGBwdRbnPDW" name="station" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return void" isSpecification="false" isLeaf="false" visibility="public" xmi.id="D69Lp6MCVzMJ" isRoot="false" isAbstract="false" isQuery="false" name="displayStation" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="n06YPmsCvKSH" isRoot="false" isAbstract="false" isQuery="false" name="launchDebugger" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="aTk2anp7OrJC" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="a5gBsFW4LfN9" value="" type="9U1uI8HJT0Jf" name="command_line" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lhLFffYSdcy2" value="" type="9U1uI8HJT0Jf" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+@return Sci_Station_Id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="PrEK9hahkEtd" isRoot="false" isAbstract="false" isQuery="false" name="getStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="GNCfDKJZT1pU" type="dsRw8nRMsxE8" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return pid_t" isSpecification="false" isLeaf="false" visibility="public" xmi.id="UPfn20wlhH0M" isRoot="false" isAbstract="false" isQuery="false" name="getPid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TnsrXUY7xI9X" type="wZnZ9lZYcork" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param input_file_descriptor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TPRDdKo7jTvj" isRoot="false" isAbstract="false" isQuery="false" name="setInputFileDescriptor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3wfRmwb0HodS" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="28gewXONuobY" value="" type="TrV97VV12IZA" name="input_file_descriptor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param output_file_descriptor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8PfqrYZIO4RV" isRoot="false" isAbstract="false" isQuery="false" name="setOutputFileDescriptor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6w0Xvp1OcsF9" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YvUYB3iDCNq6" value="" type="TrV97VV12IZA" name="output_file_descriptor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param log_file_descriptor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uCUp03L9S0zH" isRoot="false" isAbstract="false" isQuery="false" name="setLogFileDescriptor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KlGI1On5IQU4" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZYaxb1Q9wuf8" value="" type="TrV97VV12IZA" name="log_file_descriptor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return File_Descriptor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wML8jBCbMeOM" isRoot="false" isAbstract="false" isQuery="false" name="getInputFileDescriptor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="K62bsf4yb4WU" type="TrV97VV12IZA" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return File_Descriptor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hjV8iSPH1zCc" isRoot="false" isAbstract="false" isQuery="false" name="getOutputFileDescriptor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rVsTL6bgrpyr" type="TrV97VV12IZA" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return File_Descriptor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zajvUM1OiNWR" isRoot="false" isAbstract="false" isQuery="false" name="getLogFileDescriptor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BjwUAOWUSX4K" type="TrV97VV12IZA" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Station_Status" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Wh1sJPDz9i7r" isRoot="false" isAbstract="false" isQuery="false" name="getStationStatus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="C8JmApG1I7Se" type="zczAjgq81yYh" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param status" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BU6ASGkRqRKI" isRoot="false" isAbstract="false" isQuery="false" name="setStationStatus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="B3K0rGr2zlU7" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KH9TxEI6gOE8" value="" type="nMhUhBvBqw4A" name="status" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mStationIdleCounter" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cyXQNsgBCLft" isRoot="false" isAbstract="false" isQuery="false" name="getStationIdleCounter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AzacWexgkEQs" type="qZLXuibBNXID" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VY2LT6TnLaEH" isRoot="false" isAbstract="false" isQuery="false" name="incrementStationIdleCounter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1frJmJxvLFtA" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="oWNVsabSY9sw" isRoot="false" isAbstract="false" isQuery="false" name="decrementStationIdleCounter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VlCTUfYee8FA" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_configuration" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zY5Bsi2NG4gh" isRoot="false" isAbstract="false" isQuery="false" name="setStationConfiguration" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kAoSMFKNu9ge" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9AUSkgjXC522" value="" type="jIKxm4xqfB4z" name="configuration" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return StationConfiguration" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dbUBkK5jrAsj" isRoot="false" isAbstract="false" isQuery="false" name="getStationConfiguration" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TcZmpSwJB6mg" type="jIKxm4xqfB4z" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+@return void" isSpecification="false" isLeaf="false" visibility="private" xmi.id="su67xmo4uHWf" isRoot="false" isAbstract="false" isQuery="false" name="startProcess" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xEA8HAAuld3W" value="" type="9U1uI8HJT0Jf" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return void" isSpecification="false" isLeaf="false" visibility="private" xmi.id="x9DoH6XAybFv" isRoot="false" isAbstract="false" isQuery="false" name="stopProcess" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="M3zGIUtGi3Mx" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="DWrz7uT51grJ" isRoot="false" isAbstract="false" isQuery="false" name="displayStationStatus" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="nihWGnXmwzjn" isRoot="false" isAbstract="false" isQuery="false" name="Station" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3xO6wsNHPAG0" value="" type="trv86yL4jfeS" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="lYt1WmvcoWrL" isRoot="false" isAbstract="false" isQuery="false" name="launchDebugger" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lIIPPVX9fMaz" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wBCWlpMtCht9" value="" type="trv86yL4jfeS" name="command_line" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_name the new value of mpStationConfiguration->mStationName" isSpecification="false" isLeaf="false" visibility="public" xmi.id="J5fMAZjBuuSy" isRoot="false" isAbstract="false" isQuery="false" name="setStationName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="buMT417VbeHQ" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="czuXNqMBxXIM" value="" type="trv86yL4jfeS" name="station_name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+@return void" isSpecification="false" isLeaf="false" visibility="private" xmi.id="oRuH6AKNExiO" isRoot="false" isAbstract="false" isQuery="false" name="startProcess" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class SystemManager" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bBWfkvMSUBzc" isRoot="false" isAbstract="false" name="SystemManager" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="4QEmSahd4YcC" />
+ <UML:Generalization xmi.idref="SqtM7IeD47EL" />
+ <UML:Generalization xmi.idref="61wWSqWN4OPC" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="HtfMPGWnHlFz" type="0vcc95kxWWVn" name="mListOfStations" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="nwSF6dZuRDQn" type="xXbKcOH2nKjB" name="mpSciServer" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="NvFxdPxsIcEf" type="QBMG0J8pDlsx" name="mStationExecutable" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="qiT8Tg7FdZSj" type="QBMG0J8pDlsx" name="mDebugger" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="vfgxkuIaTgbH" type="QBMG0J8pDlsx" name="mDefaultStationExecutable" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="OoUldHki4oSH" type="Dc4onmiEKP73" name="mpNetworkClock" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="B1eaE4OZxbUY" isRoot="false" isAbstract="false" isQuery="false" name="SystemManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1RRJ2dxqMQyn" value="" type="xXbKcOH2nKjB" name="sci_server" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="642hbURmV3Ni" isRoot="false" isAbstract="false" isQuery="false" name="~ SystemManager" />
+ <UML:Operation comment="// public methods// /**
+@return Sci_Msg_Station_Id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5jF2KkZLB0dB" isRoot="false" isAbstract="false" isQuery="false" name="createStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6BjGHTw3kCQ9" type="uNcSkNqyAxHb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Indicate the station executable to run when creating a station
+@return bool
+@param station_executable the new value of mStationExecutable" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ba2x0yl42lme" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iyILIsLrlhKn" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="EBOjElPHUfJn" value="" type="9U1uI8HJT0Jf" name="station_executable" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Nq8WqliSJkNH" value="" type="9U1uI8HJT0Jf" name="debugger" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param system_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="i6Mjs6N6FjnR" isRoot="false" isAbstract="false" isQuery="false" name="receiveIdleMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="gRGH5Vg9gPPx" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="aP6u7UBoaVVQ" value="" type="VBixqziBqrhe" name="system_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="bqWoZIF4Tx0H" isRoot="false" isAbstract="false" isQuery="false" name="removeStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rJybWPkCN0Xd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xiSlX9P8XW2c" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="yBOWhtxIjR7J" isRoot="false" isAbstract="false" isQuery="false" name="removeAllStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rsUaaoLGDbWG" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jKLCIJRD0tyX" isRoot="false" isAbstract="false" isQuery="false" name="deactivateStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6CNkZlhQ4gzY" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1NdWrd8ppVKW" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="OFm6erNMCiWU" isRoot="false" isAbstract="false" isQuery="false" name="activateStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3hkOgI1X8T5g" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0yfyrdVsy7Oq" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kVdX0x3MAqSp" isRoot="false" isAbstract="false" isQuery="false" name="debugStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="FQvS1Rg5d3pC" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hpBrWhLUfySV" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="bvLa2iQlD1IB" isRoot="false" isAbstract="false" isQuery="false" name="isStationIdle" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="oUbrAYPDE8bu" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zMX9Aywpl7hH" value="" type="uNcSkNqyAxHb" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="n0jQzBvY7H67" isRoot="false" isAbstract="false" isQuery="false" name="areAllActiveStationsIdle" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OaPW3UDIu8iv" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Station_Status
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zWsAYBJVVqcd" isRoot="false" isAbstract="false" isQuery="false" name="getStationStatus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XOyASnKEHt5Q" type="zczAjgq81yYh" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mZSYe7nP8Xq5" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id
+@param new_status" isSpecification="false" isLeaf="false" visibility="public" xmi.id="gldn0ktxEl5k" isRoot="false" isAbstract="false" isQuery="false" name="updateStationStatus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="STbeZBYxlxRp" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uODNDo0zLRXz" value="" type="dsRw8nRMsxE8" name="station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YJNeqDjUwLIx" value="" type="nMhUhBvBqw4A" name="new_status" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Get the value of mListOfStations
+@return the value of mListOfStations" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3BuFu0ypMBCZ" isRoot="false" isAbstract="false" isQuery="false" name="getListOfStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Pe5JkoCHCAPc" type="cKqCpL4vHbUA" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mStationExecutable" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zBZIc4IANfpB" isRoot="false" isAbstract="false" isQuery="false" name="getStationExecutable" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vkrCbua1NCfw" type="9U1uI8HJT0Jf" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="qWgmpwjq5c4z" isRoot="false" isAbstract="false" isQuery="false" name="displayListOfStations" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="a2mwBxU983Rk" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="5hsTKfcACGxz" isRoot="false" isAbstract="false" isQuery="false" name="registerSystemSciMsg" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="AeoFEsDouzj3" isRoot="false" isAbstract="false" isQuery="false" name="findStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="NDr68JvVvzog" type="INoSbjQmME1a" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uDC2EekJJdke" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mDebugger" isSpecification="false" isLeaf="false" visibility="private" xmi.id="6CP0C634JE7V" isRoot="false" isAbstract="false" isQuery="false" name="getDebugger" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nyvx6La13PCc" type="9U1uI8HJT0Jf" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MAwjmvEfZsaJ" isRoot="false" isAbstract="false" isQuery="false" name="SystemManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ksuDWVUvJxgu" value="" type="T3wGzLaOdJRi" name="p_sci_server" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// /**
+Indicate the default station executable to run when creating a station
+@return bool
+@param default_station_executable the new value of mDefaultStationExecutable
+@param debugger the new value of mDebugger" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LVYuN9B8z5JW" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="HmefwJZJVPQb" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YoPpj3hxSHCf" value="" type="trv86yL4jfeS" name="default_station_executable" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IjCQ9ULUxuML" value="" type="trv86yL4jfeS" name="debugger" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Sci_Msg_Station_Id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="1XR0bkU9WtxF" isRoot="false" isAbstract="false" isQuery="false" name="createStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iJ7dGtH3sB1y" type="uNcSkNqyAxHb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="veBNuN0A4CaD" value="" type="trv86yL4jfeS" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_network_clock the new value of mpNetworkClock" isSpecification="false" isLeaf="false" visibility="public" xmi.id="prxjViUQjhSS" isRoot="false" isAbstract="false" isQuery="false" name="setNetworkClock" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="UZyXwA9Dulqr" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XLg15bvnbtDo" value="" type="Dc4onmiEKP73" name="p_network_clock" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mDefaultStationExecutable" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ym0h8ycxnZgI" isRoot="false" isAbstract="false" isQuery="false" name="getDefaultStationExecutable" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5O8YnW9VoE64" type="trv86yL4jfeS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id the station ID
+@param station_name the new value of the station name" isSpecification="false" isLeaf="false" visibility="public" xmi.id="F8izq8PLR5MW" isRoot="false" isAbstract="false" isQuery="false" name="setStationName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8M6yX5w1csWY" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="gGHH7T36F3lN" value="" type="dsRw8nRMsxE8" name="station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1LJmvz488l7w" value="" type="trv86yL4jfeS" name="station_name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return a pointer to Network Clock Processor" isSpecification="false" isLeaf="false" visibility="private" xmi.id="dPfz7KV2Nze1" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClock" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0djvPakSyq0l" type="Dc4onmiEKP73" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="bBWfkvMSUBzc" visibility="public" namespace="Logical View" xmi.id="61wWSqWN4OPC" parent="0dybVkdpO4Ya" discriminator="" name="" />
+ <UML:Class comment="class SystemSciMsg" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="kNRjwgcIhcX0" isRoot="false" isAbstract="false" name="SystemSciMsg" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="qpo9SZnjuaBV" />
+ <UML:Generalization xmi.idref="kZodzZdOFIKk" />
+ <UML:Generalization xmi.idref="F8kIYwpMZuWF" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// // For specialized SCI msg header//" isSpecification="false" visibility="private" xmi.id="oumiUxElXTPK" type="yD8lVM51i3U1" name="mSpecializedSciMsgType" />
+ <UML:Attribute comment="// Specialized SCI msg header//" isSpecification="false" visibility="private" xmi.id="fGGAifVQGjcS" type="II4tXBwM3i4V" name="mpSpecializedSciMsgHeader" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="mQLltAsASv30" type="8HFYeCh1V2Tr" name="mpSystemManager" />
+ <UML:Attribute comment="// Specialized SCI msg header//" isSpecification="false" visibility="private" xmi.id="5xgKFy2bIrWG" type="idECE5nt0Vr7" name="mSpecializedSciMsgHeader" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4zK7hMcKdqVL" isRoot="false" isAbstract="false" isQuery="false" name="SystemSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="UylkfMDRkWCb" value="" type="8HFYeCh1V2Tr" name="p_system_manager" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="h3l7wm70lP5Q" isRoot="false" isAbstract="false" isQuery="false" name="~ SystemSciMsg" />
+ <UML:Operation comment="// public methods// /**
+@return SciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mfjNVCizARin" isRoot="false" isAbstract="false" isQuery="false" name="create" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="N7E9MIBSeHQ9" type="hHn4fFvgbLYX" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ltCTNP54QqCM" isRoot="false" isAbstract="false" isQuery="false" name="dispatchMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KK8wDeSDIC6f" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dHKMfPlR2SoX" isRoot="false" isAbstract="false" isQuery="false" name="identifySpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="mq7kh5T2Ch9W" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="eUVmtBXf2j6P" isRoot="false" isAbstract="false" isQuery="false" name="checkCompatibility" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zKycaOlsjupw" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="6BSW0cqbrAxW" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgHeader" />
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+@return mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="XgxZ8j5kDYW5" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WH7mTERF4Wxj" type="yD8lVM51i3U1" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param type the new value of mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="h3ijno6r0YO0" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="bQjm5qI39Hfj" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9V2L1YQia6PL" value="" type="8Eb0NWUsBQSJ" name="type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpSpecializedSciMsgHeader
+@return the value of mpSpecializedSciMsgHeader into a void pointer" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uVCs2Ys8lR88" isRoot="false" isAbstract="false" isQuery="false" name="returnSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fObMGOIngQZ7" type="TYfZTukOB7DK" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mpSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wb071QOAvQTw" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ezLgVGO5h7rk" type="II4tXBwM3i4V" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_specialized_sci_msg_header the new value of mpSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xrcVx1qqV0iX" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="y7l7OOo2nNO3" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="pOWkm0fjpFEn" value="" type="ZZfK0mQuNQ1O" name="p_specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods//" isSpecification="false" isLeaf="false" visibility="private" xmi.id="H2dm1JHasusr" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="gIl1gnNV9uEv" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgType" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="RrpOsLQDNVtL" isRoot="false" isAbstract="false" isQuery="false" name="SystemSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Fb6V7QnCOSVb" value="" type="TXhtlZjMAp7C" name="p_system_manager" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Display the specialized SCI message type." isSpecification="false" isLeaf="false" visibility="public" xmi.id="82E8dP9eMOkB" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QyHvUzPptERC" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dv4eGrk78MU4" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kfoO3OVfLoLo" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Loi7utuFnjWz" value="" type="MvpHChZ2rJOW" name="specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="kNRjwgcIhcX0" visibility="public" namespace="Logical View" xmi.id="F8kIYwpMZuWF" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="pkwx1nQd15WY" isRoot="false" isAbstract="false" name="runtime_error" />
+ <UML:Generalization isSpecification="false" child="Awyu6tX5fqlW" visibility="public" namespace="Logical View" xmi.id="eRWRUKUohuHk" parent="pkwx1nQd15WY" discriminator="" name="" />
+ <UML:Class comment="// Constants defining the six different importance levels of the log messages" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="kzdjBd3ATyt6" isRoot="false" isAbstract="false" name="Logger" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// Current log level" isSpecification="false" visibility="private" xmi.id="nKss3o39Z3mH" type="UOc7OI8LRuFv" name="mLogLevel" />
+ <UML:Attribute comment="// Level of message (as set by operator)" isSpecification="false" visibility="private" xmi.id="hAaBJZSsONVc" type="UOc7OI8LRuFv" name="mMsgLevel" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="pkjdKJy5coyd" type="PDzFlxMB73D7" name="mCurrentTickValue" />
+ <UML:Operation stereotype="constructor" comment="// Constructors:/**
+Empty Constructor
+Logs to cout, log level LOG_DEBUG" isSpecification="false" isLeaf="false" visibility="public" xmi.id="im0mz7VTwqde" isRoot="false" isAbstract="false" isQuery="false" name="Logger" />
+ <UML:Operation stereotype="constructor" comment="Constructor
+Logs to cout, log level specified" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pKyAH6gz5KiE" isRoot="false" isAbstract="false" isQuery="false" name="Logger" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vmPOkGSQ2TCz" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Constructor
+Logs to a specified stream, log level specified" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ahQVV19KM6Sd" isRoot="false" isAbstract="false" isQuery="false" name="Logger" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6DD6gN6F2UkX" value="" type="C9cGTLSO5pln" name="log_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WrrqvJT6Q3Kr" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MmERazCgANkp" isRoot="false" isAbstract="false" isQuery="false" name="~ Logger" />
+ <UML:Operation comment="Operator to set the level of a message" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ko4mJmHnb6dV" isRoot="false" isAbstract="false" isQuery="false" name="operator ( )" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5htkpiUloGqA" type="r4r1RcqCQswh" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Q6bo7vgUfutD" value="" type="UOc7OI8LRuFv" name="msg_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="friend" comment="Operator to pass the message to the stream" isSpecification="false" isLeaf="false" visibility="public" xmi.id="eEUEK7jiBIVH" isRoot="false" isAbstract="false" isQuery="false" name="operator &lt;&lt;" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ecCPxZRhCF5F" type="ViIuaCbFO4Rh" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9ANLSsad1JR4" value="" type="ViIuaCbFO4Rh" name="os" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6KJVOkAXsXqK" value="" type="vTwaNogqWwk6" name="logger" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Function to set the stream" isSpecification="false" isLeaf="false" visibility="public" xmi.id="OQvPjNSdoMD9" isRoot="false" isAbstract="false" isQuery="false" name="setLogFile" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Atygnglt04OO" value="" type="C9cGTLSO5pln" name="log_file" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Functions to get and set the log level" isSpecification="false" isLeaf="false" visibility="public" xmi.id="nYuf4k0S9tps" isRoot="false" isAbstract="false" isQuery="false" name="getLogLevel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="dZswNDlSteCi" type="UOc7OI8LRuFv" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="EFV3cgAkX8PK" isRoot="false" isAbstract="false" isQuery="false" name="setLogLevel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="pAEnEaA174hB" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Functions to get and set the msg level" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mfbvYQongHoG" isRoot="false" isAbstract="false" isQuery="false" name="getMsgLevel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LhR9vFJXrUxm" type="UOc7OI8LRuFv" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="wy0T5PosZ0fm" isRoot="false" isAbstract="false" isQuery="false" name="setMsgLevel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="anlhrQqe5RZc" value="" type="UOc7OI8LRuFv" name="msg_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Network_Clock_Tick" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qLNWbBkV7iyA" isRoot="false" isAbstract="false" isQuery="false" name="getCurrentTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1OUDdZQF6I9U" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param current_tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8k2fkgPJT90J" isRoot="false" isAbstract="false" isQuery="false" name="updateTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TuwMX92qoRzh" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZrxfGUF6ocaN" value="" type="Fls26ZE3bRdo" name="current_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="kooC0I8IkF1k" visibility="public" namespace="Logical View" xmi.id="QZAIkvPSXwgX" parent="KqJ8bZTEut0O" discriminator="" name="" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="bxyfX2FkfHc6" isRoot="false" isAbstract="false" name="EvtsList" />
+ <UML:Class comment="class NetworkClockEvtList" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="khBqlcIjqaYa" isRoot="false" isAbstract="false" name="NetworkClockEvtList" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="FQVDxYEWTCA1" type="bxyfX2FkfHc6" name="mListOfEvts" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="FNlsdNwN57Bo" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockEvtList" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jTXY358GUbUP" isRoot="false" isAbstract="false" isQuery="false" name="~ NetworkClockEvtList" />
+ <UML:Operation comment="// public methods// /**
+@return bool
+@param tick_value
+@param evt_to_insert" isSpecification="false" isLeaf="false" visibility="public" xmi.id="9ivbs5c5RLy4" isRoot="false" isAbstract="false" isQuery="false" name="insertElement" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="gGEVi9IjVku7" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="juPm0aaj15H2" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8NIcyk16QvhJ" value="" type="VcPcOcsgjQbo" name="evt_to_insert" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_remove" isSpecification="false" isLeaf="false" visibility="public" xmi.id="yHOPcKTLFq7F" isRoot="false" isAbstract="false" isQuery="false" name="removeElement" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="HKKOaTs4OmOt" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QfwRkCRrZiTW" value="" type="VcPcOcsgjQbo" name="evt_to_remove" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param tick_value
+@param evt_to_remove" isSpecification="false" isLeaf="false" visibility="public" xmi.id="STarMHAKWYi8" isRoot="false" isAbstract="false" isQuery="false" name="removeElement" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vRjhqiOXwb0f" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="t9S60XJQDFqv" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PFmxxETQf1H1" value="" type="VcPcOcsgjQbo" name="evt_to_remove" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_add" isSpecification="false" isLeaf="false" visibility="public" xmi.id="GPJmv1uoBMsB" isRoot="false" isAbstract="false" isQuery="false" name="addElement" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iGMEyHJGZdeA" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="u9Z5NNymdlja" value="" type="VcPcOcsgjQbo" name="evt_to_add" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="w6pFoDutXMZa" isRoot="false" isAbstract="false" isQuery="false" name="displayListOfEvts" />
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Set the value of mListOfEvts
+@param list_of_evts the new value of mListOfEvts" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Wpaq08JPHCMI" isRoot="false" isAbstract="false" isQuery="false" name="setListOfEvts" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6UCSGaLAz4pq" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xioU3N2ZAaNB" value="" type="HrAPc4wZ9mox" name="list_of_evts" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mListOfEvts
+@return the value of mListOfEvts" isSpecification="false" isLeaf="false" visibility="public" xmi.id="igYzrsF8jPVL" isRoot="false" isAbstract="false" isQuery="false" name="getListOfEvts" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kELfnJIVYejW" type="HrAPc4wZ9mox" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="SSsbEeW9LIdO" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="fdvnDIwvwUsn" isRoot="false" isAbstract="false" isQuery="false" name="displayListOfEvts" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="M7t3VNNxpDW1" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove elements whose key equals the input tick value
+@return bool
+@param tick_value" isSpecification="false" isLeaf="false" visibility="private" xmi.id="s0ADIlbxMUiZ" isRoot="false" isAbstract="false" isQuery="false" name="removePreviousElements" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="v2mTdObiqnA5" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mfSi9KUURLVw" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qa8yLazS9pRI" isRoot="false" isAbstract="false" isQuery="false" name="removeElement" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LUFJW47FGSu3" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qYkPuskggpuw" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param next_evt_to_process" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WFgAavh42rB6" isRoot="false" isAbstract="false" isQuery="false" name="getNextElement" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="jCXHoEokFYBs" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="BI6hmaso5PUg" value="" type="u6I3QBCIKjNh" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Exi59oEPtvBT" value="" type="eFtlt57PInXt" name="p_next_evt_to_process" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class PhySciMsg" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Kd2vdgexbsmt" isRoot="false" isAbstract="false" name="PhySciMsg" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="kW8FuRBYKjoB" />
+ <UML:Generalization xmi.idref="2uCdtjrgLfpr" />
+ <UML:Generalization xmi.idref="bbEXkRwwAMUd" />
+ <UML:Generalization xmi.idref="Y9t3iv153eXZ" />
+ <UML:Generalization xmi.idref="f7qcLRlLp3d5" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="AG2SxqbqTRBU" type="4F2mG2WvecbT" name="mFc10" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="UZ6on8MB4gMB" type="4F2mG2WvecbT" name="mFcAvArray" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="mx3Mg8qoMtGJ" type="LIcXhcTtT8Bn" name="mMpduPayloadLength" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="hr98IJcksgZd" type="ObMobD4JO6Fx" name="mpMpduPayload" />
+ <UML:Attribute comment="// Get from specialized SCI msg header// " isSpecification="false" visibility="private" xmi.id="pvmrc72M25ji" type="6EgMC1YWquF9" name="mSpecializedSciMsgType" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="BZUXQio6ZwEp" type="R7NTfdMjVLA2" name="mMpduFormat" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="Fra5X9gK2TBe" type="YkJeSfDyIVQI" name="mNbOfPbs" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="YEzaHiGRFiwg" type="DhQX2rY6wPDZ" name="mFcMode" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="QlkxfymspMxL" type="UgPIutO5ambc" name="mShortPpdu" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="TdfU4p6a158I" type="6Qx7AaWcHvu9" name="mMod" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="nMh14efSNPP0" type="TJe4s63xXy2f" name="mFecrate" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="NCsBWpWyQ9ST" type="tWAq6KHaeveU" name="mGil" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="wY1xeAEPUvOX" type="axOd2PMcsqyz" name="mTonemapIndex" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="X3zsSNsoZkz3" type="2yOeu36ujWRN" name="mTxId" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="ZT1yaRPX0QUc" type="E4ek4y1U3HLE" name="mFlags" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="Ygz3cOa7RX0s" type="4Kduenu6BUBZ" name="mIsEncrypted" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="useRdbTA2S6c" type="4Kduenu6BUBZ" name="mIsCrcOk" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="uV7suaSSGRVq" type="qzlFUs4gsJKl" name="mPbSize" />
+ <UML:Attribute comment="// NOT USED YET" isSpecification="false" visibility="private" xmi.id="p3yFZy5RohrR" type="qzlFUs4gsJKl" name="mReserved" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="IKaKkgueA0U4" type="eKZEv9oVXM34" name="mNbOfSymbols" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="awWoM0fB1dOY" type="4F2mG2WvecbT" name="mIvArray" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="ZR0N8pnQ7Nir" type="4F2mG2WvecbT" name="mNekArray" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="1dWBdyFBtkzF" type="4F2mG2WvecbT" name="mPbMeasurementArray" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="ieOhFnGoCECL" type="4F2mG2WvecbT" name="mPbHeaderArray" />
+ <UML:Attribute comment="// Specialized SCI msg header//" isSpecification="false" visibility="private" xmi.id="3zjAKS1L3VXe" type="i2UaJmLAA6SB" name="mpSpecializedSciMsgHeader" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="SkpLSmaARyse" type="DEOmV9sHIiVw" name="mpPhyProcessor" />
+ <UML:Attribute isSpecification="false" visibility="protected" xmi.id="KjgU387lTfM4" type="qzlFUs4gsJKl" name="mNbOfMsgs" />
+ <UML:Attribute comment="// Specialized SCI msg header//" isSpecification="false" visibility="protected" xmi.id="SXVBdch4R92A" type="YFYivL7lKsyo" name="mSpecializedSciMsgHeader" />
+ <UML:Attribute isSpecification="false" visibility="protected" xmi.id="ahSdaFNuw4Mz" type="4Kduenu6BUBZ" name="mIsSent" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="j6TwKdFLayVu" isRoot="false" isAbstract="false" isQuery="false" name="PhySciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OUFPyk3QTqlv" value="" type="DEOmV9sHIiVw" name="p_phy_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dL42Hug1y7vI" isRoot="false" isAbstract="false" isQuery="false" name="~ PhySciMsg" />
+ <UML:Operation comment="// public methods///**
+Creates a PHY SCI message.
+@return SciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kAbK66CTYSsW" isRoot="false" isAbstract="false" isQuery="false" name="create" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xmalZjqsD3Bh" type="hHn4fFvgbLYX" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Handles a received PHY SCI message.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="AuwdkfXL0ZNG" isRoot="false" isAbstract="false" isQuery="false" name="dispatchMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6GwMioOQythn" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="When receiving a PHY SCI message,
+extracts the PHY SCI message header from the received SCI message data.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="R2HP9AhuKGCO" isRoot="false" isAbstract="false" isQuery="false" name="identifySpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="7TVM2gFxSngz" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Checks that software versions are compatible,
+i.e. checks specialized SCI msg compatibility (check specialized SCI msg version).
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MPrspkPzeJbM" isRoot="false" isAbstract="false" isQuery="false" name="checkCompatibility" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WXphazPgFJ1w" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Checks PHY SCI message header values ranges,
+i.e. checks specialized SCI msg validity (check specialized SCI msg header coherence).
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="z8ixf5D67SVF" isRoot="false" isAbstract="false" isQuery="false" name="checkValidity" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6NM4G1rNTKkT" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Prepares the MPDU, i.e. segment MPDU payload into PBs.
+Fills PBs headers.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cA9uQJJkiAcV" isRoot="false" isAbstract="false" isQuery="false" name="prepareMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0xQQk4NHbDwA" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Fills specialized SCI msg data length and specialized SCI msg data
+for a PHY message of type PREAMBLE.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="szVWJ4rGCZBp" isRoot="false" isAbstract="false" isQuery="false" name="fillPreMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CLqRdpLjChlS" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Fills specialized SCI msg data length and specialized SCI msg data
+for a PHY message of type FC_HYBRID_MODE.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cNvkpQxQY4Ky" isRoot="false" isAbstract="false" isQuery="false" name="fillFc10Msg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="hbqAvYdwV1KF" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Fills specialized SCI msg data length and specialized SCI msg data
+for a PHY message of type FC_AV_ONLY_MODE.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Nbg4kIZcI27Z" isRoot="false" isAbstract="false" isQuery="false" name="fillFcAvMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5iUhvRr5kfUN" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Fills specialized SCI msg data length and specialized SCI msg data
+for a PHY message of type MPDU_PAYLOAD.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="6ypGXy59LyrB" isRoot="false" isAbstract="false" isQuery="false" name="fillMpduMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Vq4hVoACPyMK" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Displays the PHY SCI message header contents." isSpecification="false" isLeaf="false" visibility="public" xmi.id="MoZusrqETWID" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgHeader" />
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Gets a pointer to the PHY SCI message header.
+@return mpSpecializedSciMsgHeader into a void pointer" isSpecification="false" isLeaf="false" visibility="public" xmi.id="npn3sucwsPDN" isRoot="false" isAbstract="false" isQuery="false" name="returnSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WxE1yZE4HjjA" type="TYfZTukOB7DK" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to the PHY SCI message header.
+@return mpSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="NGVjFMsZ9PU1" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AYFsBjEgXIM3" type="i2UaJmLAA6SB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the value of the PHY SCI message header.
+@return bool
+@param p_specialized_sci_msg_header the new value of mpSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="GIFhpVsaLgdB" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4UFTScoyX2xW" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YD7RcImxZHem" value="" type="O12pIiPVGutd" name="p_specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to the PHY processor.
+@return mpPhyProcessor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cULltnk86ynt" isRoot="false" isAbstract="false" isQuery="false" name="getPhyProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="bBYqsF00nDtw" type="DEOmV9sHIiVw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message type.
+@return mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TgToM4zuH7Jr" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="v7dSNxVSRlvt" type="6EgMC1YWquF9" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message type.
+@return bool
+@param type the new value of mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="N4mwJPgvt0el" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LhpsikMHtu8m" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nPrtNekqIBde" value="" type="02OHgpv6iwv9" name="type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message MPDU format.
+@return mMpduFormat" isSpecification="false" isLeaf="false" visibility="public" xmi.id="FaXUhoJ5q6zA" isRoot="false" isAbstract="false" isQuery="false" name="getMpduFormat" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="96kuKdrFiSh4" type="R7NTfdMjVLA2" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message MPDU format.
+@return bool
+@param mpdu_format the new value of mMpduFormat" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ve3Mei5R7wJS" isRoot="false" isAbstract="false" isQuery="false" name="setMpduFormat" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PBWowPfF5S7n" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Z3GrFtUSUzx9" value="" type="QYpsIm6ImSYT" name="mpdu_format" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message PB number.
+@return mNbOfPbs" isSpecification="false" isLeaf="false" visibility="public" xmi.id="nGCcKAmnopAS" isRoot="false" isAbstract="false" isQuery="false" name="getNbOfPbs" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CS43MAnUHYMZ" type="YkJeSfDyIVQI" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message PB number.
+@return bool
+@param nb_of_pbs the new value of mNbOfPbs" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VFrcA82jAJaP" isRoot="false" isAbstract="false" isQuery="false" name="setNbOfPbs" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9BmsdRu0cQoY" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="A2pc1kmpzwPJ" value="" type="U3HSI0riWfYo" name="nb_of_pbs" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message Frame Control mode.
+@return mFcMode" isSpecification="false" isLeaf="false" visibility="public" xmi.id="6B5syFIUS84a" isRoot="false" isAbstract="false" isQuery="false" name="getFcMode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nRlqttd5Lg7f" type="DhQX2rY6wPDZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message Frame Control mode.
+@return bool
+@param fc_mode the new value of mFcMode" isSpecification="false" isLeaf="false" visibility="public" xmi.id="G7JQOsnYud9u" isRoot="false" isAbstract="false" isQuery="false" name="setFcMode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qu75SUccfOSH" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LvhKp6cuHhmD" value="" type="8JusFMjAgM0v" name="fc_mode" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message short PPDU.
+@return mShortPpdu" isSpecification="false" isLeaf="false" visibility="public" xmi.id="u3hMBmxRrEsF" isRoot="false" isAbstract="false" isQuery="false" name="getShortPpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qMHSk4zVVkMP" type="UgPIutO5ambc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message short PPDU.
+@return bool
+@param short_ppdu the new value of mShortPpdu" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4dlxGurcnYud" isRoot="false" isAbstract="false" isQuery="false" name="setShortPpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="bzSudZYSUfVu" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eWVtDF67IoSR" value="" type="nLEyCkrlHPQw" name="short_ppdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message modulation.
+@return mMod" isSpecification="false" isLeaf="false" visibility="public" xmi.id="YNtPbjeeMNbb" isRoot="false" isAbstract="false" isQuery="false" name="getMod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="78WnUw4KIJl2" type="6Qx7AaWcHvu9" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message modulation.
+@return bool
+@param mod the new value of mMod" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ISB5y5gcc9Tn" isRoot="false" isAbstract="false" isQuery="false" name="setMod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LiWpQsE0pesT" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PZvfLL7ti0IJ" value="" type="UxIGEVkWi0NJ" name="mod" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message FEC rate.
+@return mFecrate" isSpecification="false" isLeaf="false" visibility="public" xmi.id="huv1IWcawldu" isRoot="false" isAbstract="false" isQuery="false" name="getFecrate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CQvg4QYBW5w1" type="TJe4s63xXy2f" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message FEC rate.
+@return bool
+@param fecrate the new value of mFecrate" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pIURRxCqX5Us" isRoot="false" isAbstract="false" isQuery="false" name="setFecrate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="z0LII4IdkoSB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Qbm8Z2QGxLFF" value="" type="pwe3pKqZPxkb" name="fecrate" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message Guard Interval.
+@return mGil" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qqnmbQhQg9p8" isRoot="false" isAbstract="false" isQuery="false" name="getGil" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ee9UH1xTQq7U" type="tWAq6KHaeveU" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message Guard Interval.
+@return bool
+@param gil the new value of mGil" isSpecification="false" isLeaf="false" visibility="public" xmi.id="70we5QUW1EcY" isRoot="false" isAbstract="false" isQuery="false" name="setGil" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EfdliamiY5yq" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="H2oEM2RCsEwR" value="" type="0cEqYhKKEcTV" name="gil" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message tonemap index.
+@return mTonemapIndex" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cbsJlfPsfLUl" isRoot="false" isAbstract="false" isQuery="false" name="getTonemapIndex" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AESu1s3fXC9m" type="axOd2PMcsqyz" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message tonemap index.
+@return bool
+@param tonemap_index the new value of mTonemapIndex" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kyFjDrIUs4gC" isRoot="false" isAbstract="false" isQuery="false" name="setTonemapIndex" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="E4FeuM69zjui" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="67MwJIOvuECf" value="" type="eOTt0WSUZhur" name="tonemap_index" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message transmission ID.
+@return mTxId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tbVXvzGfvVM8" isRoot="false" isAbstract="false" isQuery="false" name="getTxId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JeOqjMgtY8mZ" type="2yOeu36ujWRN" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message transmission ID.
+@return bool
+@param tx_id the new value of mTxId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KeaAhEKnJgkc" isRoot="false" isAbstract="false" isQuery="false" name="setTxId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zpDU2MGEPVqH" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="z6WrKiUDIziD" value="" type="ASmFlCHQXF31" name="tx_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message flags.
+@return mFlags" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wyqrRC0mpYuW" isRoot="false" isAbstract="false" isQuery="false" name="getFlags" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pwQodIUvwqlg" type="E4ek4y1U3HLE" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message flags.
+@return bool
+@param flags the new value of mFlags" isSpecification="false" isLeaf="false" visibility="public" xmi.id="nFJ4v1hs7BhP" isRoot="false" isAbstract="false" isQuery="false" name="setFlags" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CRXjYJIV7Vz7" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tBbB8JM4ICwj" value="" type="ee5ipO9TkcLk" name="flags" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets if the PHY SCI message is encrypted or not.
+@return mIsEncrypted" isSpecification="false" isLeaf="false" visibility="public" xmi.id="NuTCSOgDbxIW" isRoot="false" isAbstract="false" isQuery="false" name="isEncrypted" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qFLDiBUX5vJg" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets if the PHY SCI message is encrypted or not.
+@return bool
+@param is_encrypted the new value of mIsEncrypted" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zxN484U1E5BM" isRoot="false" isAbstract="false" isQuery="false" name="setIsEncrypted" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Bmb6cMknmHWI" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OVRegLM3FpDf" value="" type="3lgc1KcaMAny" name="is_encrypted" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets if the PHY SCI message CRC is OK or not.
+@return mIsCrcOk" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Bttmq9Hn6cqE" isRoot="false" isAbstract="false" isQuery="false" name="isCrcOk" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZmngGml416Hj" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets if the PHY SCI message CRC is OK or not.
+@return bool
+@param is_crc_ok the new value of mIsCrcOk" isSpecification="false" isLeaf="false" visibility="public" xmi.id="gIDuNMFjseMW" isRoot="false" isAbstract="false" isQuery="false" name="setIsCrcOk" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="FlEIeVyqHauu" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ziZEVktfbkPP" value="" type="3lgc1KcaMAny" name="is_crc_ok" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message PB size.
+@return mPbSize" isSpecification="false" isLeaf="false" visibility="public" xmi.id="teBzG1BxJNpe" isRoot="false" isAbstract="false" isQuery="false" name="getPbSize" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uehetBwSxj6B" type="qzlFUs4gsJKl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message PB size.
+@return bool
+@param pb_size the new value of mPbSize" isSpecification="false" isLeaf="false" visibility="public" xmi.id="h2NXgh3fPatt" isRoot="false" isAbstract="false" isQuery="false" name="setPbSize" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TpFSvW98GLOu" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KlWtVvJPaUMq" value="" type="qZLXuibBNXID" name="pb_size" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="VWlmtZQabl8G" isRoot="false" isAbstract="false" isQuery="false" name="getReserved" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rNi8vc0pGfS8" type="qzlFUs4gsJKl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="T9vqknh4YDy3" isRoot="false" isAbstract="false" isQuery="false" name="setReserved" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qOYm6dvZSB0M" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9FQhjnVCJFyA" value="" type="qZLXuibBNXID" name="reserved" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message symbols number.
+@return mNbOfSymbols" isSpecification="false" isLeaf="false" visibility="public" xmi.id="oOiN7qda0XRi" isRoot="false" isAbstract="false" isQuery="false" name="getNbOfSymbols" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="f9UvVtqKEYS9" type="eKZEv9oVXM34" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message symbols number.
+@return bool
+@param nb_of_symbols the new value of mNbOfSymbols" isSpecification="false" isLeaf="false" visibility="public" xmi.id="K8kqKgrRvI8e" isRoot="false" isAbstract="false" isQuery="false" name="setNbOfSymbols" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9RwN6OVvl2fr" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3doKqmUc8CyG" value="" type="s0nXwm2aK1kb" name="nb_of_symbols" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message IV array.
+@return mIvArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="1bqz6FhOMREe" isRoot="false" isAbstract="false" isQuery="false" name="getIv" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="faO7jMTPWwKz" type="t2asNnHh8wsl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message IV array.
+@return bool
+@param iv the new value of mIvArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8651ODePoSjf" isRoot="false" isAbstract="false" isQuery="false" name="setIv" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="n8Jzfj6m829D" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="FBFLLDbKnQJt" value="" type="ylvhNGRUzc7S" name="iv[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message NEK array.
+@return mNekArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dyIxOWbUagVy" isRoot="false" isAbstract="false" isQuery="false" name="getNek" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Pd88flxKLJR5" type="t2asNnHh8wsl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message NEK array.
+@return bool
+@param nek the new value of mNekArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="t9Lga4LpDYAZ" isRoot="false" isAbstract="false" isQuery="false" name="setNek" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="gtSAnk9arQZW" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mktZABSn7ilT" value="" type="ylvhNGRUzc7S" name="nek[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message PB measurement array.
+@return mPbMeasurementArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="FMxp3RmuY7a8" isRoot="false" isAbstract="false" isQuery="false" name="getPbMeasurement" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9fGIfPV22bAh" type="t2asNnHh8wsl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message PB measurement array.
+@return bool
+@param pb_measurement the new value of mPbMeasurementArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="AtvLS4uEomnw" isRoot="false" isAbstract="false" isQuery="false" name="setPbMeasurement" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="K5zfPPi5I8F3" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vDj0wSU9nPwo" value="" type="ylvhNGRUzc7S" name="pb_measurement[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message PB header array.
+@return mPbHeaderArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qigPoHVw8RHY" isRoot="false" isAbstract="false" isQuery="false" name="getPbHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tOdkmAEvnUBS" type="t2asNnHh8wsl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param pb_header the new value of mPbHeaderArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VAmHuXDpjund" isRoot="false" isAbstract="false" isQuery="false" name="setPbHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="reTsDbXXhXB6" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LHm8hiuXPauB" value="" type="ylvhNGRUzc7S" name="pb_header[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Frame Control 1.0.
+@return mFc10" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pO7wpMUIUFZO" isRoot="false" isAbstract="false" isQuery="false" name="getFc10" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="wrBC0OFrmqZW" type="ylvhNGRUzc7S" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param fc_10 the new value of mFc10" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kkBTez6zEq5v" isRoot="false" isAbstract="false" isQuery="false" name="setFc10" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0lPlDbB4DewP" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZxRwYJ7LhCHU" value="" type="ylvhNGRUzc7S" name="fc_10" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Frame Control AV.
+@return mFcAvArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Wmk1zHPj1ZDg" isRoot="false" isAbstract="false" isQuery="false" name="getFcAv" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ESwvz51txA5v" type="t2asNnHh8wsl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param fc_av the new value of mFcAvArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="YHdm8hgfe7bA" isRoot="false" isAbstract="false" isQuery="false" name="setFcAv" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YIkI8Ho62DrD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QgW6slYOVJNU" value="" type="ylvhNGRUzc7S" name="fc_av[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the MPDU payload length.
+@return mMpduPayloadLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="anCcMNGsetck" isRoot="false" isAbstract="false" isQuery="false" name="getMpduPayloadLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="m2HyfCNteHob" type="qtOabrV06r8H" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param length the new value of mMpduPayloadLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="aINDNyNmctsS" isRoot="false" isAbstract="false" isQuery="false" name="setMpduPayloadLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="NnUIvXBRpvhv" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dQp8jCbIxnuH" value="" type="qtOabrV06r8H" name="length" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the MPDU payload.
+@return mpMpduPayload" isSpecification="false" isLeaf="false" visibility="public" xmi.id="AA7o1kXa0unO" isRoot="false" isAbstract="false" isQuery="false" name="getMpduPayload" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CV1CgqPRsePV" type="Z3mduvueNb9d" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_mpdu_payload the new value of mpMpduPayload" isSpecification="false" isLeaf="false" visibility="public" xmi.id="rAAT20ufQjl8" isRoot="false" isAbstract="false" isQuery="false" name="setMpduPayload" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="okOQ1AzOxTeq" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tMQr9I6HSE4R" value="" type="Z3mduvueNb9d" name="p_mpdu_payload" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the PHY SCI message class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="yb1yToMKzUmz" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="Displays the PHY SCI message header IV." isSpecification="false" isLeaf="false" visibility="private" xmi.id="UeevNN1EkP5r" isRoot="false" isAbstract="false" isQuery="false" name="displayIv" />
+ <UML:Operation comment="Displays the PHY SCI message header NEK." isSpecification="false" isLeaf="false" visibility="private" xmi.id="hC99QDYMmaKF" isRoot="false" isAbstract="false" isQuery="false" name="displayNek" />
+ <UML:Operation comment="Displays the PHY SCI message header PBs measurements." isSpecification="false" isLeaf="false" visibility="private" xmi.id="OfYL9KIewwXJ" isRoot="false" isAbstract="false" isQuery="false" name="displayPbMeasurement" />
+ <UML:Operation comment="Displays the PHY SCI message header PBs headers." isSpecification="false" isLeaf="false" visibility="private" xmi.id="KYX2xbrcl0j9" isRoot="false" isAbstract="false" isQuery="false" name="displayPbHeader" />
+ <UML:Operation comment="Fills specialized SCI msg data length and specialized SCI msg data
+for a PHY message of type FC_HYBRID_MODE.
+@param fc_10 the Frame Control 1.0
+@param fc_av the AV Frame Control
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mGwfH4GlRyrH" isRoot="false" isAbstract="false" isQuery="false" name="fillFcHybridMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0pHniyiuRh46" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1e7JcDdFWqOO" value="" type="4F2mG2WvecbT" name="fc_10" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LWo2zxflBcQS" value="" type="4F2mG2WvecbT" name="fc_av[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Fills specialized SCI msg data length and specialized SCI msg data
+for a PHY message of type FC_AV_ONLY_MODE.
+@param fc_av the AV Frame Control
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="eeB3a1KcfRtF" isRoot="false" isAbstract="false" isQuery="false" name="fillFcAvMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XRXO6utseIHd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dUU9KqYgNKgM" value="" type="4F2mG2WvecbT" name="fc_av[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Display the specialized SCI message type." isSpecification="false" isLeaf="false" visibility="public" xmi.id="70J7yst8fTa3" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="oSlmwzzyw35S" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message attributes before transmission.
+@param clock_id ID of the Network Clock event received message
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Cx1k7cEEcXJY" isRoot="false" isAbstract="false" isQuery="false" name="prepare" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SG2OkeEiUWWC" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ODe1eE4SepEb" value="" type="2OUKpDmUU6Tg" name="clock_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the value of the PHY SCI message header.
+@return bool
+@param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3eQakWDTr7mj" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="UC5uu90RZXpf" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ibze5EeoX49f" value="" type="iJSN8ewspTX1" name="specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the number of PHY SCI messages (composing the MPDU).
+@return mNbOfMsgs" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WRvK8CSUMkAa" isRoot="false" isAbstract="false" isQuery="false" name="getNbOfMsgs" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PjV3zmeR3gnl" type="qZLXuibBNXID" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the number of PHY SCI messages (composing the MPDU).
+@param nb_of_msgs the new value of mNbOfMsgs
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mkESDsbuUd5h" isRoot="false" isAbstract="false" isQuery="false" name="setNbOfMsgs" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="J2TnWxzyA2s4" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="52WoBjef8YzG" value="" type="qZLXuibBNXID" name="nb_of_msgs" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Checks if the PHY SCI message has been sent.
+@return mIsSent" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VUHK1ajgE3p9" isRoot="false" isAbstract="false" isQuery="false" name="isSent" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AsVjPLMo2rp1" type="3lgc1KcaMAny" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets if the PHY SCI message has been sent.
+@param is_sent the new value of mIsSent
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="t0J373cnViQ8" isRoot="false" isAbstract="false" isQuery="false" name="setIsSent" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="cUQf8CQRErCi" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yeMCUq7zIPKJ" value="" type="3lgc1KcaMAny" name="is_sent" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="NetworkClockEvt.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/inc/NetworkClockEvt.h
+//**
+class NetworkClockEvt" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="HaP8ZCy8plaL" isRoot="false" isAbstract="false" name="NetworkClockEvt" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes//" isSpecification="false" visibility="private" xmi.id="Wyku01OWbn80" type="uNcSkNqyAxHb" name="mStationId" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="Qye7PFvVCgxa" type="acFbRvXTEMIs" name="mNetworkClockType" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="wo5LHtolrYgq" type="2OUKpDmUU6Tg" name="mNetworkClockId" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="e6geZ8aObm6V" type="TYfZTukOB7DK" name="mpData" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Y4M9pS7FRmMo" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockEvt" />
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zGJ9uEjq2mBI" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="f03VWhL4jhEZ" value="" type="dsRw8nRMsxE8" name="station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7LmY57K3NdCH" value="" type="G9Fc21bZFJYw" name="type" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qw7qiH8MFArl" value="" type="nNX5UmpiITKY" name="id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Copy Constructors" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pCqXr26yLqVP" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xpSIReXHYd7F" value="" type="VcPcOcsgjQbo" name="evt" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uEZ9MQsBagiP" isRoot="false" isAbstract="false" isQuery="false" name="~ NetworkClockEvt" />
+ <UML:Operation comment="// public methods// " isSpecification="false" isLeaf="false" visibility="public" xmi.id="gmL0dqPYepr5" isRoot="false" isAbstract="false" isQuery="false" name="operator ==" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pAgzCZ3MRW3p" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ROK01RDtdm0z" value="" type="VcPcOcsgjQbo" name="evt" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="ArBiXr7CeSCF" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pPbpFPortFWz" type="j0sNksMuhVaF" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="HbnvQcyr1Ip0" value="" type="VcPcOcsgjQbo" name="evt" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="LfRx6bCNCxGa" isRoot="false" isAbstract="false" isQuery="false" name="displayEvt" />
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Set the value of mStationId
+@return bool
+@param station_id the new value of mStationId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="aEPZWFXDDNYy" isRoot="false" isAbstract="false" isQuery="false" name="setStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PuPbjbJYlzVw" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="EtqvOR8j6ZeC" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mStationId
+@return the value of mStationId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8qXKmnsK1ItV" isRoot="false" isAbstract="false" isQuery="false" name="getStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YWGy3KnshOgw" type="uNcSkNqyAxHb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mNetworkClockType
+@return bool
+@param type the new value of mNetworkClockType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VOjimHg0AVvX" isRoot="false" isAbstract="false" isQuery="false" name="setNetworkClockType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nUnejHc691ht" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="w4E0btDkhk2R" value="" type="G9Fc21bZFJYw" name="type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mNetworkClockType
+@return the value of mNetworkClockType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WvlVBc1g1iOl" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClockType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="a0RK0vEWRUUU" type="acFbRvXTEMIs" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mNetworkClockId
+@return bool
+@param id the new value of mNetworkClockId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="x3j6YcbSepSG" isRoot="false" isAbstract="false" isQuery="false" name="setNetworkClockId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="mFLUe1OPTC2D" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="gdyMMynsrZN2" value="" type="nNX5UmpiITKY" name="id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mNetworkClockId
+@return the value of mNetworkClockId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BMgA23ty6c4c" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClockId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ReHbdzUDztVx" type="2OUKpDmUU6Tg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="Ff2tSU7783RU" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="0EKrlfsv0Y30" isRoot="false" isAbstract="false" isQuery="false" name="getType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ojUEEwgyCzQo" type="QBMG0J8pDlsx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="StUj99llDRPn" isRoot="false" isAbstract="false" isQuery="false" name="NetworkClockEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XzB9jIcjg202" value="" type="dsRw8nRMsxE8" name="station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="iTy4m5nCwHt3" value="" type="G9Fc21bZFJYw" name="network_clock_type" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Peoc3DPYBbhs" value="" type="nNX5UmpiITKY" name="id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZpzV7sWWUK8V" value="" type="rHbXHZa03W4n" name="p_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mpData
+@return bool
+@param p_data the new value of mpData" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cFsPi6AvfZ2W" isRoot="false" isAbstract="false" isQuery="false" name="setData" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ypBS1DdQpu1S" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1FeJmIkuNxFh" value="" type="rHbXHZa03W4n" name="p_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpData
+@return the value of mpData" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wa9sY7FBM5Y2" isRoot="false" isAbstract="false" isQuery="false" name="getData" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tTerL7o7rIL3" type="TYfZTukOB7DK" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="GIrdG4ICfR4B" isRoot="false" isAbstract="false" isQuery="false" name="displayNetworkClockType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="D21PzSByHMQG" type="QBMG0J8pDlsx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="lmHNZqFB8Nj8" isRoot="false" isAbstract="false" name="PhyMpduCb" />
+ <UML:Class comment="class PhySciMsgNoise" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vSu5lsg0a7WJ" isRoot="false" isAbstract="false" name="PhySciMsgNoise" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="5oSJ5pfRXEKM" />
+ <UML:Generalization xmi.idref="GpnnjAimICRg" />
+ <UML:Generalization xmi.idref="8YLQXRKCCIRS" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor
+Creates a PHY message of type NOISE.
+@param p_phy a pointer to the PHY interface" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LbXsqqCDrQXh" isRoot="false" isAbstract="false" isQuery="false" name="PhySciMsgNoise" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wzStLEaXhIIG" value="" type="DEOmV9sHIiVw" name="p_phy" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ULvVrrbCQ62E" isRoot="false" isAbstract="false" isQuery="false" name="~ PhySciMsgNoise" />
+ <UML:Operation comment="// public methods// /**
+Sets the PHY SCI message class attributes before transmission
+for a PHY message of type NOISE.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wFSmfxTawuTH" isRoot="false" isAbstract="false" isQuery="false" name="prepare" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Y3gNvgop9QeS" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the PHY SCI message class attributes:
+fills PHY SCI message type,
+and specialized SCI msg data length.
+" isSpecification="false" isLeaf="false" visibility="private" xmi.id="83mpM46qOzJF" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="PhySciMsgPre.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/inc/PhySciMsgPre.h
+//**
+class PhySciMsgPre" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="emjq7Xks8DWW" isRoot="false" isAbstract="false" name="PhySciMsgPre" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="78n0YovcPcSY" />
+ <UML:Generalization xmi.idref="osPEzRTtgtfK" />
+ <UML:Generalization xmi.idref="t2VHdgaE0EUP" />
+ <UML:Generalization xmi.idref="38CRTOHxlKYx" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor
+Creates a PHY message of type PREAMBLE.
+@param p_phy_processor a pointer to the PHY interface" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DNXsEDC2K4mJ" isRoot="false" isAbstract="false" isQuery="false" name="PhySciMsgPre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NjQjTLOFItPE" value="" type="DEOmV9sHIiVw" name="p_phy_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="fmyMYtyjGWbT" isRoot="false" isAbstract="false" isQuery="false" name="~ PhySciMsgPre" />
+ <UML:Operation comment="// public methods// /**
+Sets the PHY SCI message class attributes before transmission,
+and fills specialized SCI msg data length and specialized SCI msg data
+for a PHY SCI message of type PREAMBLE.
+@param clock_id ID of the Network Clock event received message
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jlV1nGKAzisQ" isRoot="false" isAbstract="false" isQuery="false" name="prepare" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XSaOjvRwvRLv" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2GdK70ZmmV7I" value="" type="2OUKpDmUU6Tg" name="clock_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the PHY SCI message class attributes.
+Fills PHY SCI message type." isSpecification="false" isLeaf="false" visibility="private" xmi.id="M52bZb4GNXHA" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="c6nC8sEdaTgi" isRoot="false" isAbstract="false" name="Expected_Tx" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// expected transmission ID" isSpecification="false" visibility="public" xmi.id="GQCuSON9dVcx" type="2yOeu36ujWRN" name="src_tx_id" />
+ <UML:Attribute comment="// expected transmitting station ID" isSpecification="false" visibility="public" xmi.id="OFjIEoRosCzy" type="uNcSkNqyAxHb" name="src_station_id" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="4DbehFMvfWp7" isRoot="false" isAbstract="false" name="lttx" >
+ <UML:Classifier.feature>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="tAHWfrR369KI" isRoot="false" isAbstract="false" isQuery="false" name="operator ( )" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tWr8qHMOI0kB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZwpFSdMLndpR" value="" type="vl7nx6lzHKbw" name="tx1" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="SFSYMmrHXw2S" value="" type="vl7nx6lzHKbw" name="tx2" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0lRF51Cex1tP" isRoot="false" isAbstract="false" name="RxStationsList" />
+ <UML:Class comment="// list of destination stations" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="cEjQpWrIlHo7" isRoot="false" isAbstract="false" name="Frame_Control" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="4fMbZO2Z9RpE" type="4F2mG2WvecbT" name="fc_10" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="SzrPyinbwUzm" type="4F2mG2WvecbT" name="fc_av" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0o4m5sr9WEj3" isRoot="false" isAbstract="false" name="RxFcList" />
+ <UML:Class comment="// list of received Frame Control" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ajbkAQwdNn0L" isRoot="false" isAbstract="false" name="Mpdu_Payload" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// number of PHY SCI messages MPDU that have been received" isSpecification="false" visibility="public" xmi.id="UluQFtCGhE0l" type="qzlFUs4gsJKl" name="msg_nb" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="5psZ1bacKBMT" type="LIcXhcTtT8Bn" name="data_length" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="ZG4w24GWoAw3" type="ObMobD4JO6Fx" name="p_data" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="47HjJFSM5Lt6" type="4F2mG2WvecbT" name="pb_header" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="uUiFf2iFHkBJ" isRoot="false" isAbstract="false" name="RxMpduList" />
+ <UML:Class comment="// list of received MPDU/**
+class PhyProcessor
+Simulates the real HomePlugAV physical interface and data bus." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="kooC0I8IkF1k" isRoot="false" isAbstract="false" name="PhyProcessor" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="wqho3l7CAaCs" />
+ <UML:Generalization xmi.idref="mPpaajecotJ6" />
+ <UML:Generalization xmi.idref="qMFrrMkplbDq" />
+ <UML:Generalization xmi.idref="QIT8Cyxljy5W" />
+ <UML:Generalization xmi.idref="QZAIkvPSXwgX" />
+ <UML:Generalization xmi.idref="r3SvcBVOH0oL" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes//" isSpecification="false" visibility="private" xmi.id="MSPW0bORYUMs" type="T3wGzLaOdJRi" name="mpSciServer" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="4bRqVlwcVPoa" type="Dc4onmiEKP73" name="mpNetworkClock" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="j4ZX3m01ehFH" type="h0fjFQ6XJMWi" name="mpChannel" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="Zngo7fg9F50k" type="4Kduenu6BUBZ" name="mIsChannelEnabled" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="qwKJJ8t2CTZE" type="DshIKK2Zspzs" name="mNbOfCarriers" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="SEUhKSP8PjSi" type="FYDrFS8mDoaL" name="mpTonemask" />
+ <UML:Attribute comment="// unique ID incremented for each transmission" isSpecification="false" visibility="private" xmi.id="pLlzmIBzqOr3" type="2yOeu36ujWRN" name="mTxId" />
+ <UML:Attribute comment="// (PREAMBLE, FC, MPDU, and NOISE if enabled)." isSpecification="false" visibility="private" xmi.id="pzp2mQLEcovw" type="0lRF51Cex1tP" name="mListOfRxStations" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="GI5f1VMoo7nb" type="lmHNZqFB8Nj8" name="mInterfaceCb" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="NzaCLPFAN3B9" type="0o4m5sr9WEj3" name="mListOfRxFc" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="RWN3IGyZW1CV" type="uUiFf2iFHkBJ" name="mListOfRxMpdu" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="WYJKf6t13UDP" type="nJsED87p1vHp" name="mFrequency" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="rQXERiNsDiuV" type="PDzFlxMB73D7" name="mZeroCrossDelay" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="wq4SrHxLpGfT" type="iP4BuKaU6MFG" name="mpZeroCross" />
+ <UML:Attribute comment="// for the wrong preambles transmission feature" isSpecification="false" visibility="private" xmi.id="JxYpsEM9xWub" type="iP4BuKaU6MFG" name="mpPre" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="JXPFIAgz5MJu" type="PDzFlxMB73D7" name="mAverageDuration" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="AXAYvicEdA1T" type="nJsED87p1vHp" name="mStdDeviation" />
+ <UML:Attribute comment="// For the wrong preambles transmission feature" isSpecification="false" visibility="private" xmi.id="HMoWMarc8Qsx" type="4Kduenu6BUBZ" name="mIsFalseAlarmActivated" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="fIZddmejZuth" type="vFBbZkjwm4Vx" name="mpWrongPre" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kjwpsBsKYDVA" isRoot="false" isAbstract="false" isQuery="false" name="PhyProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZPgj0ywKOLqN" value="" type="T3wGzLaOdJRi" name="p_sci_server" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uCoTe8JPrGEk" isRoot="false" isAbstract="false" isQuery="false" name="~ PhyProcessor" />
+ <UML:Operation comment="// public methods// /**
+@return PhySciMsg &amp;" isSpecification="false" isLeaf="false" visibility="public" xmi.id="R72zIX7svlbt" isRoot="false" isAbstract="false" isQuery="false" name="createMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="gY0oyeGT5qso" type="w18nsvnfKlCn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jYE8r2VkFHBr" isRoot="false" isAbstract="false" isQuery="false" name="receiveMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kHkdg3WXXNfN" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QUGFkTx9Yz6q" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VBgQwIJgoVmd" isRoot="false" isAbstract="false" isQuery="false" name="sendMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="czku0U4g22Sy" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YFNlUYcs3t8l" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="K3ts3zgWBNu5" isRoot="false" isAbstract="false" isQuery="false" name="sendMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fhRkXHYFXGtD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dDlPhV2FiQ0D" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param received_evt
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="yc5zTBjlFcbI" isRoot="false" isAbstract="false" isQuery="false" name="receiveEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="HPlonO9NOrGO" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZIoidioGtXfa" value="" type="j0sNksMuhVaF" name="received_evt" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3hnl5nw2O21p" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the PHY processor class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="DkbSKCiuSUc5" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="Registers the PHY SCI message creation function to the SCI server." isSpecification="false" isLeaf="false" visibility="private" xmi.id="AQJ4wwczcOih" isRoot="false" isAbstract="false" isQuery="false" name="registerPhySciMsg" />
+ <UML:Operation comment="@return preamble duration in ticks" isSpecification="false" isLeaf="false" visibility="private" xmi.id="BdjXdjNqRyHm" isRoot="false" isAbstract="false" isQuery="false" name="calculatePreDuration" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LK2LMTH1Ajlf" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Frame Control duration in ticks" isSpecification="false" isLeaf="false" visibility="private" xmi.id="8xeZSGecfweb" isRoot="false" isAbstract="false" isQuery="false" name="calculateFcDuration" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yHvVXmhm9Sau" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return MPDU payload duration in ticks" isSpecification="false" isLeaf="false" visibility="private" xmi.id="sFYUdEAortKU" isRoot="false" isAbstract="false" isQuery="false" name="calculateMpduDuration" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qiICZYavsbEE" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends a PHY SCI message of type NOISE.
+@return bool
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="private" xmi.id="ahJ0dYmjVOIx" isRoot="false" isAbstract="false" isQuery="false" name="sendNoise" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4WEEDztBFmfm" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="evYHrCqhROC4" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return a pointer to SCI server" isSpecification="false" isLeaf="false" visibility="private" xmi.id="bMrSDBvmqCmR" isRoot="false" isAbstract="false" isQuery="false" name="getSciServer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YKXim7cansnN" type="T3wGzLaOdJRi" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// /**
+@param interface_cb
+Initialize PHY with an interface callback function for PHY SCI message MPDU reception." isSpecification="false" isLeaf="false" visibility="public" xmi.id="NFHOWKrVnBiw" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="QLGIwUV00jCD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MQ1QAZGC3U1p" value="" type="lmHNZqFB8Nj8" name="interface_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initialize PHY with the PLC frequency for PHY SCI message of type ZERO_CROSS.
+@param frequency
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LJul1NAOaPk4" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="g6Nvq0gPKD54" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="icaVnIP9gOXq" value="" type="EQrcJtA2vC7c" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates a PHY SCI message MPDU.
+@return PhySciMsgMpdu *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3UdcrOgZ0E2l" isRoot="false" isAbstract="false" isQuery="false" name="createMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Ife6YPTylhFh" type="ihg5BF2ckirV" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends a PHY SCI message MPDU.
+This message has to be configured before transmission.
+@param p_mpdu
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="URuAoQzkExjU" isRoot="false" isAbstract="false" isQuery="false" name="sendMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BigARsL7wg1n" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xX5DDPVEr6og" value="" type="ihg5BF2ckirV" name="p_mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends the PHY SCI message associated to the received Network Clock event.
+@return bool
+@param received_evt" isSpecification="false" isLeaf="false" visibility="public" xmi.id="UTGShGDCg6KU" isRoot="false" isAbstract="false" isQuery="false" name="receiveEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ghC0uF4AuhGS" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WHEiFvACSFPd" value="" type="j0sNksMuhVaF" name="received_evt" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type NONE or NOISE.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cspTzc7T5Lum" isRoot="false" isAbstract="false" isQuery="false" name="receiveInvalid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6hPrOeXYKDgl" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="c7wIBHkhYwNn" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type PREAMBLE.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="rXxHkNsMDhnC" isRoot="false" isAbstract="false" isQuery="false" name="receivePre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="51q2irpOWzNO" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="HveMGY7qd38p" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KqWrmuedPauA" isRoot="false" isAbstract="false" isQuery="false" name="receiveFc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EPZ66pZDXw2t" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xmW8SILjDx6R" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type PRS.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VDI8EOxZFSO1" isRoot="false" isAbstract="false" isQuery="false" name="receivePrs" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YZPsm5dq7Rsp" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="K2fjcZtXKOem" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type MPDU_PAYLOAD.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="gzVrwZIPkYVz" isRoot="false" isAbstract="false" isQuery="false" name="receiveMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="HfBneYCqwlw2" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xRWCtuBBuqsV" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type TONEMASK.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Om2g8eSodxdX" isRoot="false" isAbstract="false" isQuery="false" name="receiveTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="aTD5PGxxpMnc" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VtuFSQEPrkZi" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type TONEMAP.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cktXZl2vV2bd" isRoot="false" isAbstract="false" isQuery="false" name="receiveTonemap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SOQZqIM7vVuZ" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="h3PIy0qTukhM" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type RX.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8vjzeIhE0YlZ" isRoot="false" isAbstract="false" isQuery="false" name="receiveRx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="26NypJ0OnCTA" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KlUno5RT6ol5" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pZWhID3Q7mQj" isRoot="false" isAbstract="false" isQuery="false" name="sendMsgToAllStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SO8FlvrDKFk8" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="25x2ejcwS4jG" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+@return bool
+@param p_network_clock the new value of mpNetworkClock" isSpecification="false" isLeaf="false" visibility="public" xmi.id="88jEvVHk2oPK" isRoot="false" isAbstract="false" isQuery="false" name="setNetworkClock" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="X4FSZ7zbCMZ1" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1Sl6C9pECnEq" value="" type="Dc4onmiEKP73" name="p_network_clock" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_channel the new value of mpChannel" isSpecification="false" isLeaf="false" visibility="public" xmi.id="UomwtUB1cuDX" isRoot="false" isAbstract="false" isQuery="false" name="setChannel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="gYPRkrbAFhPy" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NVFQJekI4TNG" value="" type="h0fjFQ6XJMWi" name="p_channel" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the channel perturbation.
+@param is_channel_enabled the new value of mIsChannelEnabled" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cCSpxfdPTOMK" isRoot="false" isAbstract="false" isQuery="false" name="setIsChannelEnabled" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="bF9tUt12xESV" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sVLSNXyl2D9J" value="" type="3lgc1KcaMAny" name="is_channel_enabled" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the TX ID.
+@return mTxId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qrbuJy9t9Zg6" isRoot="false" isAbstract="false" isQuery="false" name="getTxId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LQ6VmeXQCwru" type="ASmFlCHQXF31" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the tonemask.
+@return mpTonemask" isSpecification="false" isLeaf="false" visibility="public" xmi.id="EKUigo2WJMyg" isRoot="false" isAbstract="false" isQuery="false" name="getTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lR4z8Txhi7aD" type="S02STVfDWPXk" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Check if the channel perturbation is enabled.
+@return mIsChannelEnabled" isSpecification="false" isLeaf="false" visibility="public" xmi.id="twPt8WCyMlqf" isRoot="false" isAbstract="false" isQuery="false" name="isChannelEnabled" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0bDwndR73Vco" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the power line frequency.
+@param frequency the new value of mFrequency
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ixYrXFvjXPRD" isRoot="false" isAbstract="false" isQuery="false" name="setFrequency" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="99EJ44DnTFmb" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DSjUmf9dcYWi" value="" type="EQrcJtA2vC7c" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the power line frequency.
+@return mFrequency" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3iePRU49Sa0x" isRoot="false" isAbstract="false" isQuery="false" name="getFrequency" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="hkJNrrYpRllE" type="EQrcJtA2vC7c" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Computes PREAMBLE transmission duration.
+@return preamble delay in ticks" isSpecification="false" isLeaf="false" visibility="private" xmi.id="I7gihefVYKpq" isRoot="false" isAbstract="false" isQuery="false" name="calculatePreDelay" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="NALQewEl5R57" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Computes Frame Control transmission duration.
+@return Frame Control delay in ticks" isSpecification="false" isLeaf="false" visibility="private" xmi.id="ONJubGCVL5xw" isRoot="false" isAbstract="false" isQuery="false" name="calculateFcDelay" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VGvyWhXBRoYG" type="PDzFlxMB73D7" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="S9cXzd3GkhyP" value="" type="DhQX2rY6wPDZ" name="fc_mode" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Computes MPDU payload transission duration.
+@return MPDU payload delay in ticks" isSpecification="false" isLeaf="false" visibility="private" xmi.id="MesuwiiK31Ec" isRoot="false" isAbstract="false" isQuery="false" name="calculateMpduDelay" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="g765qpJDydec" type="PDzFlxMB73D7" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GO6ZR3VtD5OA" value="" type="6Qx7AaWcHvu9" name="mod" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="iPQQ7PnR1eJx" value="" type="TJe4s63xXy2f" name="fecrate" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="M2HN1TzFr5mG" value="" type="qzlFUs4gsJKl" name="pb_size" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7H7IKVS2urQz" value="" type="YkJeSfDyIVQI" name="pb_nb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="EEQFskACkPXl" value="" type="tWAq6KHaeveU" name="gil" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="private" xmi.id="sWzhalxf12xL" isRoot="false" isAbstract="false" isQuery="false" name="fillMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZqNcHQikhdgB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XPMPEmPSypfo" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return a pointer to Network Clock Processor" isSpecification="false" isLeaf="false" visibility="private" xmi.id="jeFkgC6BZQbo" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClock" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="IEMi0syez2jq" type="Dc4onmiEKP73" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to Channel.
+@return mpChannel" isSpecification="false" isLeaf="false" visibility="private" xmi.id="C0EBnuxLhyas" isRoot="false" isAbstract="false" isQuery="false" name="getChannel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="s33oefQBWlll" type="h0fjFQ6XJMWi" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the number of carriers.
+@return mNbOfCarriers" isSpecification="false" isLeaf="false" visibility="private" xmi.id="RbuTZc1JEE3v" isRoot="false" isAbstract="false" isQuery="false" name="getNbOfCarriers" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CTWr4C0LOM3P" type="O74yXfkidyrR" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the number of carriers.
+@return bool
+@param nb_of_carriers the new value of mNbOfCarriers" isSpecification="false" isLeaf="false" visibility="private" xmi.id="qokWkKOCwIdV" isRoot="false" isAbstract="false" isQuery="false" name="setNbOfCarriers" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Cz3C2n2so3gS" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ufm9ro2Gt6EP" value="" type="O74yXfkidyrR" name="nb_of_carriers" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemask.
+@return bool
+@param length the tonemask length in octets
+@param p_tonemask the new value of mpTonemask" isSpecification="false" isLeaf="false" visibility="private" xmi.id="kw7NswohkYDV" isRoot="false" isAbstract="false" isQuery="false" name="setTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="j4bDpMwzqSqs" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rbfnrIGkv1rn" value="" type="O74yXfkidyrR" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="pr1gxD5f9A3z" value="" type="S02STVfDWPXk" name="p_tonemask" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Increments the TX ID.
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="6pgrMtKDSxyI" isRoot="false" isAbstract="false" isQuery="false" name="incrementTxId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="dqDzAGMNEQZG" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the interface callback function for PHY SCI message MPDU reception.
+@return mInterfaceCb" isSpecification="false" isLeaf="false" visibility="private" xmi.id="FE29Dtu2kvhf" isRoot="false" isAbstract="false" isQuery="false" name="getInterfaceCb" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BZ8xamNHqyUf" type="lmHNZqFB8Nj8" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the zero-cross delay for PHY SCI message of type ZERO_CROSS transmission.
+@return mZeroCrossDelay" isSpecification="false" isLeaf="false" visibility="private" xmi.id="6mJFxKE19tqT" isRoot="false" isAbstract="false" isQuery="false" name="getZeroCrossDelay" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KPf8pV1SKEQU" type="Fls26ZE3bRdo" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the zero-cross delay for PHY SCI message of type ZERO_CROSS transmission.
+@param zero_cross_delay the new value of mZeroCrossDelay
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="mAgD5cVJrVS2" isRoot="false" isAbstract="false" isQuery="false" name="setZeroCrossDelay" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TmrhAOvJv1GW" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MK36DkjJW0WR" value="" type="Fls26ZE3bRdo" name="zero_cross_delay" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to the PHY SCI message of type ZERO_CROSS.
+@return mpZeroCross" isSpecification="false" isLeaf="false" visibility="private" xmi.id="KiTSbJvOSaZX" isRoot="false" isAbstract="false" isQuery="false" name="getZeroCross" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ndndZGGsfv0U" type="iP4BuKaU6MFG" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates a PHY SCI message of type ZERO_CROSS,
+and schedules an event for next PHY SCI message of type ZERO_CROSS transmission.
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="C4q1ZG4vY7zl" isRoot="false" isAbstract="false" isQuery="false" name="scheduleZeroCross" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PzvjCJBd51IG" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends a PHY SCI message of type MPDU to destination stations.
+@param mpdu the PHY SCI message MPDU to send
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="rg2LhYn1HGTq" isRoot="false" isAbstract="false" isQuery="false" name="sendMpduToDestStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PDXJEopzPacx" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YDH6KEs9vuUa" value="" type="XNEzxlV9pJ9M" name="mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends an empty PHY SCI message of type NOISE to destination stations.
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="RHZgV1W1Oj0L" isRoot="false" isAbstract="false" isQuery="false" name="sendEmptyNoiseToDestStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qspTmnwBlrsx" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends PHY SCI message(s) of type MPDU
+and a PHY SCI message of type NOISE
+to destination stations.
+@param mpdu the PHY SCI message of type MPDU
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="UTSKnbgJmwP4" isRoot="false" isAbstract="false" isQuery="false" name="sendMpduAndNoiseToDestStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="A1aD2sRQ3zjH" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8FD38gbZvBFR" value="" type="XNEzxlV9pJ9M" name="mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Update the list of destination stations.
+Once a PHY SCI message MPDU has been sent to the destination stations,
+remove the destination stations from the reception list." isSpecification="false" isLeaf="false" visibility="private" xmi.id="CjQYSQrxsJFd" isRoot="false" isAbstract="false" isQuery="false" name="updateListOfRxStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tvwfpLiyZvzh" value="" type="XNEzxlV9pJ9M" name="mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends an empty PHY SCI message of type NOISE to destination stations.
+@param noise the empty PHY SCI message NOISE to send
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="miLUqmIF4Mp6" isRoot="false" isAbstract="false" isQuery="false" name="sendEmptyNoiseToDestStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lWGA6q7xguQS" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uWFgFmnAKuo7" value="" type="j5EvHIixdpql" name="noise" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Activate the wrong preambles transmission feature.
+@param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+@param std_deviation the standard deviation
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="m041la1QGicY" isRoot="false" isAbstract="false" isQuery="false" name="activateFalseAlarm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iMbTBROJTwXT" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VJAWSVeG0Fwz" value="" type="Fls26ZE3bRdo" name="average_duration" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fCcoKQy6R15A" value="" type="EQrcJtA2vC7c" name="std_deviation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Calculate date of next wrong preamble transmission.
+@return the calculated date in ticks 25 MHz" isSpecification="false" isLeaf="false" visibility="private" xmi.id="WOLI6fzsId4V" isRoot="false" isAbstract="false" isQuery="false" name="calculateNextPreDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="mwtpva4g6IpD" type="Fls26ZE3bRdo" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Schedules an event for next wrong preamble transmission.
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="ubxT7hdob1It" isRoot="false" isAbstract="false" isQuery="false" name="scheduleNextPre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8u8opWFVrqw2" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Deactivate the wrong preambles transmission feature.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZCvoicom5P8Q" isRoot="false" isAbstract="false" isQuery="false" name="deactivateFalseAlarm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="IKKjGpC2l4pf" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Check if the wrong preambles transmission is enabled or not.
+@return mIsFalseAlarmActivated" isSpecification="false" isLeaf="false" visibility="private" xmi.id="PCJLv0HglTc0" isRoot="false" isAbstract="false" isQuery="false" name="isFalseAlarmActivated" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="etLjB8uJ325q" type="3lgc1KcaMAny" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to the PHY SCI message of type PREAMBLE with the flag PHY_FLAG_WRONG_PREAMBLE set.
+@return mpWrongPre" isSpecification="false" isLeaf="false" visibility="private" xmi.id="41vxmbYlMoBI" isRoot="false" isAbstract="false" isQuery="false" name="getWrongPre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YKJN9FOPXi8l" type="vFBbZkjwm4Vx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the average number of ticks 25 MHz between 2 consecutive wrong preambles transmissions.
+@return mAverageDuration" isSpecification="false" isLeaf="false" visibility="private" xmi.id="YH3eH1QfEhy7" isRoot="false" isAbstract="false" isQuery="false" name="getAverageDuration" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VIlGMavzTFgc" type="Fls26ZE3bRdo" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the standard deviation (used to calculate date of the next wrong preamble transmission).
+@return mStdDeviation" isSpecification="false" isLeaf="false" visibility="private" xmi.id="iFnTjOTnPNiB" isRoot="false" isAbstract="false" isQuery="false" name="getStdDeviation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LatOayC8HVUQ" type="EQrcJtA2vC7c" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Calculate date of next wrong preamble transmission.
+@return the calculated date in ticks 25 MHz" isSpecification="false" isLeaf="false" visibility="private" xmi.id="yHuK34acLdGa" isRoot="false" isAbstract="false" isQuery="false" name="calculateNextWrongPreDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="isnFav03BjJW" type="Fls26ZE3bRdo" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Schedules an event for next wrong preamble transmission.
+@param tick_wrong_pre the next wrong preamble should be transmitted at current date + tick_wrong_pre (in 25 MHz)
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="dgFpMDw4ThVA" isRoot="false" isAbstract="false" isQuery="false" name="scheduleNextWrongPre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JDVkQ9MljF8J" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5wxTJgcHvXZy" value="" type="Fls26ZE3bRdo" name="tick_wrong_pre" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class IPhy" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="KqJ8bZTEut0O" isRoot="false" isAbstract="true" name="IPhy" >
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="yaLsEUCpV6SB" isRoot="false" isAbstract="false" isQuery="false" name="IPhy" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="kPkaAdqUS7a3" isRoot="false" isAbstract="false" isQuery="false" name="~ IPhy" />
+ <UML:Operation comment="// public methods// /**
+@return PhySciMsg &amp;" isSpecification="false" isLeaf="false" visibility="public" xmi.id="h1GZuEvrpEj3" isRoot="false" isAbstract="true" isQuery="false" name="createMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CKPRorrWjemH" type="w18nsvnfKlCn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jusE0INkg7Lq" isRoot="false" isAbstract="true" isQuery="false" name="receiveMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XkKiUcElphWD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="j9IBHtCwuSVn" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hOeUdLXMFNYD" isRoot="false" isAbstract="true" isQuery="false" name="sendMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="osyV66mGPAhD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fvyL0H9jQSsf" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="J5bBV6yATae6" isRoot="false" isAbstract="true" isQuery="false" name="sendMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1Whl8R2fCNLe" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="w9Q9UyN8rJRp" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param received_evt
+@param phy_sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="YbZw1PcKSDVy" isRoot="false" isAbstract="true" isQuery="false" name="receiveEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xYPmDvx2mvVq" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IS6l2jpwsF6L" value="" type="j0sNksMuhVaF" name="received_evt" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="BRT0iupGTMCU" value="" type="w18nsvnfKlCn" name="phy_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// /**
+@param interface_cb
+Initialize PHY with an interface callback function for PHY SCI message MPDU reception." isSpecification="false" isLeaf="false" visibility="public" xmi.id="AtHIE0QoOt3a" isRoot="false" isAbstract="true" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0I6NSnYTJFER" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="l214gNwRYSA4" value="" type="lmHNZqFB8Nj8" name="interface_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Initialize PHY with the PLC frequency for PHY SCI message of type ZERO_CROSS.
+@param frequency
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="HFKsayykpF23" isRoot="false" isAbstract="true" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="hF4taPVXvuH9" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Z116SAAjPUZx" value="" type="EQrcJtA2vC7c" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates a PHY SCI message MPDU.
+@return PhySciMsgMpdu *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3jRwvWWTVYZx" isRoot="false" isAbstract="true" isQuery="false" name="createMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="oE9a7eQ7wUSM" type="ihg5BF2ckirV" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends a PHY SCI message MPDU.
+This message has to be configured before transmission.
+@param p_mpdu
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="NCRUK0sLkHHd" isRoot="false" isAbstract="true" isQuery="false" name="sendMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="H0qaG2zvH3mp" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nm4HIdEyKv3U" value="" type="ihg5BF2ckirV" name="p_mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends the PHY SCI message associated to the received Network Clock event.
+@param received_evt
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="836rmxK77lbR" isRoot="false" isAbstract="true" isQuery="false" name="receiveEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="QHMMBbTxpcVx" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kRkSh25SmAj4" value="" type="j0sNksMuhVaF" name="received_evt" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type NONE or NOISE.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ly04r3Yz6coq" isRoot="false" isAbstract="true" isQuery="false" name="receiveInvalid" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Ev29NVVeVJCj" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="X8xfsW4ayp2f" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type PREAMBLE.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="p57ZDpbznb1e" isRoot="false" isAbstract="true" isQuery="false" name="receivePre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="MBebEORffl1p" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eZbi9QXgWUJM" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zMwv9wYy2dXF" isRoot="false" isAbstract="true" isQuery="false" name="receiveFc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LSmA4I5GB8PZ" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="S6CFhDtJkTzr" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type PRS.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tWYNzpkyBerK" isRoot="false" isAbstract="true" isQuery="false" name="receivePrs" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="btB4COoYZQ8m" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bPGb2loVr1iY" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type MPDU_PAYLOAD.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Capv3pmwLIHI" isRoot="false" isAbstract="true" isQuery="false" name="receiveMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pXRSGQHbs2mu" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="81GHg7aFUqqX" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type TONEMASK.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cc0RbiyoInhJ" isRoot="false" isAbstract="true" isQuery="false" name="receiveTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Ip8RxYyYPAbb" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="aTDukVCsWR7A" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type TONEMAP.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="YhN1WBY6oWXP" isRoot="false" isAbstract="true" isQuery="false" name="receiveTonemap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YN85nGranG13" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="CTDTHsmpM0j6" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the received PHY SCI message of type RX.
+@return bool
+@param received_phy_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="VwwzN38tjVuF" isRoot="false" isAbstract="true" isQuery="false" name="receiveRx" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="eGdUIPMYCV0A" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hQLTwqs7K4aZ" value="" type="w18nsvnfKlCn" name="received_phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_network_clock the new value of mpNetworkClock" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wMOGK8Mp2GnP" isRoot="false" isAbstract="true" isQuery="false" name="setNetworkClock" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1ygQ6H1ce9iQ" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IvIzOBE3ZXWW" value="" type="Dc4onmiEKP73" name="p_network_clock" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_channel the new value of mpChannel" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LPbfTBCPXbgq" isRoot="false" isAbstract="true" isQuery="false" name="setChannel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PXyAmzCOEptW" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Xij7DGbYdCE4" value="" type="h0fjFQ6XJMWi" name="p_channel" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the channel perturbation.
+@param is_channel_enabled the new value of mIsChannelEnabled" isSpecification="false" isLeaf="false" visibility="public" xmi.id="NQTsz7ig6MNL" isRoot="false" isAbstract="true" isQuery="false" name="setIsChannelEnabled" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="CF3Ok3WlzDB6" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mTq4qKmN0VSD" value="" type="3lgc1KcaMAny" name="is_channel_enabled" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the TX ID.
+@return Phy_Tx_Id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="j3lMDxQYOsPL" isRoot="false" isAbstract="true" isQuery="false" name="getTxId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SBg5KMTisRqe" type="ASmFlCHQXF31" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the tonemask.
+@return mpTonemask" isSpecification="false" isLeaf="false" visibility="public" xmi.id="x721RPKCrAGh" isRoot="false" isAbstract="true" isQuery="false" name="getTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="P20drt717AQp" type="S02STVfDWPXk" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Check if the channel perturbation is enabled.
+@return mIsChannelEnabled" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MwIimf4jl6jC" isRoot="false" isAbstract="true" isQuery="false" name="isChannelEnabled" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BwZB7iFYttdC" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the power line frequency.
+@param frequency the new value of mFrequency
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="T3MKEc1ea274" isRoot="false" isAbstract="true" isQuery="false" name="setFrequency" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="G6u8VkkulkVc" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XkF39mlUg2CS" value="" type="EQrcJtA2vC7c" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the power line frequency.
+@return mFrequency" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hGASKtfmwz68" isRoot="false" isAbstract="true" isQuery="false" name="getFrequency" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="edcjn2Yzw782" type="EQrcJtA2vC7c" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Activate the wrong preambles transmission feature.
+@param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+@param std_deviation the standard deviation
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tbpXPLzYIUlS" isRoot="false" isAbstract="true" isQuery="false" name="activateFalseAlarm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qLajEBvUFnak" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4PmVEZrSWSor" value="" type="Fls26ZE3bRdo" name="average_duration" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="cAp0OFZIqMnE" value="" type="EQrcJtA2vC7c" name="std_deviation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Deactivate the wrong preambles transmission feature.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CTuiKWIdpi2x" isRoot="false" isAbstract="true" isQuery="false" name="deactivateFalseAlarm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WKdH58rhlTQX" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="kooC0I8IkF1k" visibility="public" namespace="Logical View" xmi.id="r3SvcBVOH0oL" parent="KqJ8bZTEut0O" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="RYfxHmW7DMwU" visibility="public" namespace="Logical View" xmi.id="ZMYd8VSqVZW8" parent="vpDXE2tS2kJL" discriminator="" name="" />
+ <UML:Generalization isSpecification="false" child="CpGnr2lIA5kk" visibility="public" namespace="Logical View" xmi.id="gipeZdVAO1cK" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ZWryYSGDRuyu" isRoot="false" isAbstract="false" name="Ethernet_Sniffer_Type" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="cQhYUO60E2We" isRoot="false" isAbstract="false" name="Ethernet_Flags" />
+ <UML:Generalization isSpecification="false" child="RYfxHmW7DMwU" visibility="public" namespace="Logical View" xmi.id="9YrE9VtnAraO" parent="vpDXE2tS2kJL" discriminator="" name="" />
+ <UML:Class comment="SciMsg.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/sci/inc/SciMsg.h
+//**
+class SciMsg" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="dBvvR3kpanaF" isRoot="false" isAbstract="false" name="SciMsg" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// // NOT USED YET" isSpecification="false" visibility="private" xmi.id="DNaf2fosEYp6" type="4ptGPmSL1mv9" name="mSciMsgStatus" />
+ <UML:Attribute comment="// Values of SCI message header//" isSpecification="false" visibility="private" xmi.id="yCEYCVwasJEM" type="B8d1TM24GHiB" name="mSciMsgType" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="lK5p4wmHHMxI" type="uNcSkNqyAxHb" name="mSciMsgStationId" />
+ <UML:Attribute comment="// to send to station" isSpecification="false" visibility="private" xmi.id="zjADHzJD9XkJ" type="A2J7LcYakjsI" name="mSciMsgId" ownerScope="classifier" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="3gtty6EhQJUU" type="bicD6yqnVUa7" name="mSciMsgFlag" />
+ <UML:Attribute comment="// SCI message header, SCI message data length, and SCI message data//" isSpecification="false" visibility="private" xmi.id="frhxJACauh8Z" type="1p2XZLYDDR9J" name="mpSciMsgHeader" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="SgvPQYIQNKxu" type="LIcXhcTtT8Bn" name="mSciMsgDataLength" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="fV8suH9Y6rVO" type="ObMobD4JO6Fx" name="mpSciMsgData" />
+ <UML:Attribute comment="// protected attributes// // Specialized SCI message header size, specialized SCI message data length, and specialized SCI message data//" isSpecification="false" visibility="protected" xmi.id="1fyvN4SpkND9" type="LIcXhcTtT8Bn" name="mSpecializedSciMsgHeaderSize" />
+ <UML:Attribute isSpecification="false" visibility="protected" xmi.id="tVZFpU9SzFLr" type="LIcXhcTtT8Bn" name="mSpecializedSciMsgDataLength" />
+ <UML:Attribute isSpecification="false" visibility="protected" xmi.id="VSPZJuxIatDv" type="ObMobD4JO6Fx" name="mpSpecializedSciMsgData" />
+ <UML:Attribute comment="// SCI message header, SCI message data length, and SCI message data//" isSpecification="false" visibility="private" xmi.id="91lljHb4Hsc9" type="FGkVafnZOxkd" name="mSciMsgHeader" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ydigyvpsOM5B" isRoot="false" isAbstract="false" isQuery="false" name="SciMsg" />
+ <UML:Operation stereotype="constructor" comment="Copy Constructors" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qCenSxfvP4Uh" isRoot="false" isAbstract="false" isQuery="false" name="SciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2ldQ8iayuCmK" value="" type="xSzXJBSHo8yn" name="sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7RFUTkBQABvR" isRoot="false" isAbstract="false" isQuery="false" name="SciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="AUT5eDNlcdG5" value="" type="KLj6UftWOUuW" name="p_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LRUTaPuslbzF" isRoot="false" isAbstract="false" isQuery="false" name="~ SciMsg" />
+ <UML:Operation comment="// public methods// /**
+@return SciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="EqjdLb7V6YYi" isRoot="false" isAbstract="true" isQuery="false" name="create" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TwUQ4cQsvyZ7" type="hHn4fFvgbLYX" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jwULXkPs9tJi" isRoot="false" isAbstract="true" isQuery="false" name="dispatchMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9TcOGC6kVj1a" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="GDaznZC1Qvcj" isRoot="false" isAbstract="true" isQuery="false" name="identifySpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="stHbKf8obaCd" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="XiEbElJyhlJC" isRoot="false" isAbstract="false" isQuery="false" name="checkCompatibility" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AaV5Y3DhWn3k" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Tg2dXLJoWrnJ" isRoot="false" isAbstract="false" isQuery="false" name="checkValidity" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="x9VSrU0hLHIe" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="R0JpttWOZkzo" isRoot="false" isAbstract="false" isQuery="false" name="identifySpecializedSciMsgData" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uPSUxc78CbDk" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="THk801KUiM5F" isRoot="false" isAbstract="false" isQuery="false" name="displaySciMsgHeader" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="hO1EFpVenmRg" isRoot="false" isAbstract="false" isQuery="false" name="displaySciMsgData" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="gx5Dg2z9HjII" isRoot="false" isAbstract="true" isQuery="false" name="displaySpecializedSciMsgHeader" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="jcmRxreeDgqQ" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgData" />
+ <UML:Operation comment="@return SCI_MSG_MAGIC converted to uint32_t" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TK3G6UukSxy6" isRoot="false" isAbstract="false" isQuery="false" name="getDefinedSciMsgMagicId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="cOP6BSq7ZJZQ" type="4F2mG2WvecbT" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return SCI_MSG_VERSION" isSpecification="false" isLeaf="false" visibility="public" xmi.id="0vFHfVZO6Jn3" isRoot="false" isAbstract="false" isQuery="false" name="getDefinedSciMsgVersion" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ma57pMlijBCg" type="8RfL5UmYopms" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+@return mSciMsgStatus" isSpecification="false" isLeaf="false" visibility="public" xmi.id="HhdhcZncU1s7" isRoot="false" isAbstract="false" isQuery="false" name="getSciMsgStatus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lHoxq0fSO4YY" type="4ptGPmSL1mv9" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param status the new value of mSciMsgStatus" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WPTahGdpgHBl" isRoot="false" isAbstract="false" isQuery="false" name="setSciMsgStatus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="UNf2gCQQmWWa" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZQu2Rm9wAdWr" value="" type="lvIXi2Pxh0fK" name="status" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return the value of mSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="r8eVPpF8iXfO" isRoot="false" isAbstract="false" isQuery="false" name="getSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sHGbRSFCh48Y" type="B8d1TM24GHiB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param type the new value of mSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Z2MF31ZaRTar" isRoot="false" isAbstract="false" isQuery="false" name="setSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4l0SqXyIudKY" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dvwJQZixa4Cd" value="" type="EknMLJBAPpgo" name="type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mSciMsgStationId
+@return the value of mSciMsgStationId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="3lBSDmJRU4ln" isRoot="false" isAbstract="false" isQuery="false" name="getSciMsgStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qjzaFV85kOe9" type="uNcSkNqyAxHb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSciMsgStationId
+@return bool
+@param station_id the new value of mSciMsgStationId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MwxlldaMWUgw" isRoot="false" isAbstract="false" isQuery="false" name="setSciMsgStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="otMWxS41D2S1" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2OucQ4DTqMt3" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mSciMsgId
+@return the value of mSciMsgId" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8DSaFDNb7JNs" isRoot="false" isAbstract="false" isQuery="false" name="getSciMsgId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZQKR2c0qLxOY" type="A2J7LcYakjsI" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Increment the value of mSciMsgId
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uvFRNvNPHFzh" isRoot="false" isAbstract="false" isQuery="false" name="incrementSciMsgId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="QVdAtHIg9eC6" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return the value of mSciMsgFlag" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KA88X19dCZES" isRoot="false" isAbstract="false" isQuery="false" name="getSciMsgFlag" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4E6HEWJmubDw" type="bicD6yqnVUa7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param flag the new value of mSciMsgFlag" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mZ3tsOjnJwCf" isRoot="false" isAbstract="false" isQuery="false" name="setSciMsgFlag" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BBkV693WeffV" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rKN1rZRb8TSz" value="" type="pX24l2l5CrBj" name="flag" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mpSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="rBk96wovRq0C" isRoot="false" isAbstract="false" isQuery="false" name="getSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ux93ZLAdXEum" type="1p2XZLYDDR9J" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_sci_msg_header the new value of mpSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qjF3ZQkOi5PZ" isRoot="false" isAbstract="false" isQuery="false" name="setSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kBYemlZyvJR1" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="M4llvjylRDmy" value="" type="erAlIci9mSIq" name="p_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mSciMsgDataLength
+@return the value of mSciMsgDataLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cXMIalqDa0ys" isRoot="false" isAbstract="false" isQuery="false" name="getSciMsgDataLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="QUY29BY48h7h" type="LIcXhcTtT8Bn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSciMsgDataLength
+@return bool
+@param data_length the new value of mSciMsgDataLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="be0L4GBQLu9E" isRoot="false" isAbstract="false" isQuery="false" name="setSciMsgDataLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1FIWRCIBMqo8" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="c7x1JizvDLBn" value="" type="qtOabrV06r8H" name="data_length" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpSciMsgData
+@return the value of mpSciMsgData" isSpecification="false" isLeaf="false" visibility="public" xmi.id="410d0wVZaTue" isRoot="false" isAbstract="false" isQuery="false" name="getSciMsgData" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="aN4TgVU5y077" type="ObMobD4JO6Fx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mpSciMsgData
+@return bool
+@param p_data the new value of mpSciMsgData" isSpecification="false" isLeaf="false" visibility="public" xmi.id="k323xCFXJCYa" isRoot="false" isAbstract="false" isQuery="false" name="setSciMsgData" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9d9HJFwKSCqu" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uXT5sftvgtYg" value="" type="Z3mduvueNb9d" name="p_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// protected attribute accessor methods// /**
+Get the value of mSpecializedSciMsgHeaderSize
+@return the value of mSpecializedSciMsgHeaderSize" isSpecification="false" isLeaf="false" visibility="public" xmi.id="o1FOV73DA5G6" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgHeaderSize" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="P75lvrrTEuwt" type="LIcXhcTtT8Bn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgHeaderSize
+@return bool
+@param header_size the new value of mSpecializedSciMsgHeaderSize" isSpecification="false" isLeaf="false" visibility="public" xmi.id="HTdZfC9Yjdda" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeaderSize" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="NPyLN5RXjYm2" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GUTwM1bA2oYV" value="" type="qtOabrV06r8H" name="header_size" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpSpecializedSciMsgHeader
+@return the value of mpSpecializedSciMsgHeader into a void pointer" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wZg4fwAuPmT3" isRoot="false" isAbstract="true" isQuery="false" name="returnSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lhKEt86IF919" type="TYfZTukOB7DK" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mSpecializedSciMsgDataLength
+@return the value of mSpecializedSciMsgDataLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ybZfCADSfgM1" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgDataLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1rcFlX86w6SJ" type="LIcXhcTtT8Bn" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mSpecializedSciMsgDataLength
+@return bool
+@param data_length the new value of mSpecializedSciMsgDataLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hv9ikhBeHsgu" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgDataLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ArotPbtBIBPB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mpoAbGDXpkA1" value="" type="qtOabrV06r8H" name="data_length" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mpSpecializedSciMsgData
+@return the value of mpSpecializedSciMsgData" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uORX2lYkhfQP" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgData" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JVSXeRgdIGt1" type="ObMobD4JO6Fx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the value of mpSpecializedSciMsgData
+@return bool
+@param p_data the new value of mpSpecializedSciMsgData" isSpecification="false" isLeaf="false" visibility="public" xmi.id="NZ3cRhUCWIM7" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgData" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nz6j6Y1EPp5m" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WXcLHnK99lhB" value="" type="Z3mduvueNb9d" name="p_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="VDtCtJbErcoI" isRoot="false" isAbstract="false" isQuery="false" name="displaySciMsgType" />
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="JISqYov5LWOa" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="JjiQSPbxaV7T" isRoot="false" isAbstract="false" isQuery="false" name="displaySciMsgFlag" />
+ <UML:Operation comment="// protected methods///**
+@return bool
+@param data_length_to_remove
+@param data_length
+@param pp_data" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="mihdIVuanMQK" isRoot="false" isAbstract="false" isQuery="false" name="removeData" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Qyxg7KsQnIvQ" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9JPSpn36UjWx" value="" type="qtOabrV06r8H" name="data_length_to_remove" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="88sib0ANgpzx" value="" type="iB4yZDFSik45" name="data_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Zq83ZdyfjpLK" value="" type="LrX6DxQMEnp2" name="pp_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Display the specialized SCI message type." isSpecification="false" isLeaf="false" visibility="public" xmi.id="cSKBEqveaO2g" isRoot="false" isAbstract="true" isQuery="false" name="displaySpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="EplKIu64kqHZ" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_header the new value of mSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="klmZIFWoPiEg" isRoot="false" isAbstract="false" isQuery="false" name="setSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="jZ30qwzdw5L0" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="D5Bc34Mmou43" value="" type="7YtOMToL1Xs9" name="sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="CpGnr2lIA5kk" visibility="public" namespace="Logical View" xmi.id="lUOyLKnJycgv" parent="dBvvR3kpanaF" discriminator="" name="" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Afzv7B0Suvrw" isRoot="false" isAbstract="false" name="StaCounter" />
+ <UML:Class comment="class CoreEngine
+Main simulator part which is managing the overall working of PHY interface,
+Network Clock and other AV stations." isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="C32l1W8XzZV4" isRoot="false" isAbstract="false" name="CoreEngine" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="NaCjKA3ztF1f" type="qcb8l3xv8TRt" name="mpFunctionCall" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="tIqrt93wBnvf" type="TXhtlZjMAp7C" name="mpSystem" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="vReSwjgJHq1c" type="Dc4onmiEKP73" name="mpNetworkClock" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="14ZsHYW9oM0f" type="DEOmV9sHIiVw" name="mpPhy" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="T1ceoVKhww8r" type="T3wGzLaOdJRi" name="mpSci" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="Qvzi8cZHoFW0" type="h0fjFQ6XJMWi" name="mpChannel" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="OZ68tPxHLwzT" type="xqe85s2v3X76" name="mpEthernet" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dm8vd9VcC2UT" isRoot="false" isAbstract="false" isQuery="false" name="CoreEngine" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="b0cNLa3madPO" isRoot="false" isAbstract="false" isQuery="false" name="~ CoreEngine" />
+ <UML:Operation comment="// public methods// /**
+Initializes the Core Engine.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8h43dAsHw0CZ" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="dMC09HnYDkEK" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ah9KjcnIaOgv" value="" type="9U1uI8HJT0Jf" name="station_executable" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wjgWK5tQmvTP" value="" type="9U1uI8HJT0Jf" name="station_log" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5Lg1MqZUVioF" value="" type="9U1uI8HJT0Jf" name="debugger" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Processes the next event in the Network Clock event list.
+Then, processes messages coming from pipe.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KZVvvBoqsUMC" isRoot="false" isAbstract="false" isQuery="false" name="process" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="34iqMeG4DK41" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZDdJ84jBONDi" value="" type="Fls26ZE3bRdo" name="max_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Gets Function Call.
+@return IFunctionCall *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CmAhUywpVQiP" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionCall" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="E3f8706kKIjR" type="qcb8l3xv8TRt" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets System.
+@return ISystem *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZWFS1ZcYnDst" isRoot="false" isAbstract="false" isQuery="false" name="getSystem" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZUzmCC4FGn6b" type="TXhtlZjMAp7C" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets Network Clock.
+@return INetworkClock *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Gb5ewIM82WqU" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClock" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PKfaehcrkFzr" type="Dc4onmiEKP73" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets PHY.
+@return IPhy *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="SkHv8zKiWZAV" isRoot="false" isAbstract="false" isQuery="false" name="getPhy" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="D6aXOHwwlwgx" type="DEOmV9sHIiVw" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets SCI.
+@return ISci *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="9k3uwvlCUqoP" isRoot="false" isAbstract="false" isQuery="false" name="getSci" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6lDKWHvvbaTE" type="T3wGzLaOdJRi" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the Core Engine class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="68V8cJd42uxA" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="// public methods// /**
+Initializes the Core Engine.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="PmskjqBDNtW9" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="H550K2pX8N2V" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5qq6mdFYTGLp" value="" type="9U1uI8HJT0Jf" name="station_executable" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="RFY8ENjb9aJq" value="" type="9U1uI8HJT0Jf" name="station_log" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OU4lLasPOiV8" value="" type="9U1uI8HJT0Jf" name="debugger" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Lkgm10aQF8YR" value="" type="EQrcJtA2vC7c" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates, enables or disables Channel." isSpecification="false" isLeaf="false" visibility="public" xmi.id="F99UFftitsKh" isRoot="false" isAbstract="false" isQuery="false" name="disturbChannel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ezRNt7LzsWJM" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DnryIm4MXao0" value="" type="3lgc1KcaMAny" name="enable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to Channel.
+@return mpChannel" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WCIhU3W1sD2s" isRoot="false" isAbstract="false" isQuery="false" name="getChannel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nDHMljY1od17" type="h0fjFQ6XJMWi" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to Ethernet.
+@return mpEthernet" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CcgOZDeA999G" isRoot="false" isAbstract="false" isQuery="false" name="getEthernet" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="goemCfHocgCV" type="xqe85s2v3X76" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class ISystem" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0dybVkdpO4Ya" isRoot="false" isAbstract="false" name="ISystem" >
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DcrHJRGd69d1" isRoot="false" isAbstract="false" isQuery="false" name="ISystem" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="zdmBV5JTgF4A" isRoot="false" isAbstract="false" isQuery="false" name="~ ISystem" />
+ <UML:Operation comment="// public methods// /**
+@return Sci_Msg_Station_Id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xfzMjXwu7lBR" isRoot="false" isAbstract="true" isQuery="false" name="createStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="oXSe1j1mwG8g" type="uNcSkNqyAxHb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DP4JYfKYI6jn" isRoot="false" isAbstract="true" isQuery="false" name="removeStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zhhmIgtwUVhe" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="90EpEIzBxyVe" value="" type="uNcSkNqyAxHb" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="UQWbBi2O55he" isRoot="false" isAbstract="true" isQuery="false" name="deactivateStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AyTmffFRAf5B" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="i1Cz5tkEsz46" value="" type="uNcSkNqyAxHb" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="H3FD0lpUBM5M" isRoot="false" isAbstract="true" isQuery="false" name="activateStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="P4xJL3xIie41" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="26l79SjpStoX" value="" type="uNcSkNqyAxHb" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the value of mListOfStations
+@return the value of mListOfStations" isSpecification="false" isLeaf="false" visibility="public" xmi.id="nZmdYqjnrwyr" isRoot="false" isAbstract="true" isQuery="false" name="getListOfStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KvvnRcRZZuMC" type="cKqCpL4vHbUA" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hmJq6ND6RyBa" isRoot="false" isAbstract="true" isQuery="false" name="areAllActiveStationsIdle" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XZdhFgqclnt4" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// /**
+Indicate the default station executable to run when creating a station
+@return bool
+@param default_station_executable the new value of mDefaultStationExecutable
+@param debugger the new value of mDebugger" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8P8dmSdYZ6WN" isRoot="false" isAbstract="true" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="prMXTPWoKSZj" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MRiHZqb8I49K" value="" type="trv86yL4jfeS" name="default_station_executable" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9glyxiT37agr" value="" type="trv86yL4jfeS" name="debugger" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Sci_Msg_Station_Id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="2JQaOuviJdxq" isRoot="false" isAbstract="true" isQuery="false" name="createStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="20JbtdnQCO6P" type="uNcSkNqyAxHb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="UYzka84impgj" value="" type="trv86yL4jfeS" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param system_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="W8mdiQTkhtI5" isRoot="false" isAbstract="true" isQuery="false" name="receiveIdleMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5w1oktsZiC4B" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lDl4pivJHs1r" value="" type="VBixqziBqrhe" name="system_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="yB425IP1woFk" isRoot="false" isAbstract="true" isQuery="false" name="debugStation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Zbxu1Wb3VufO" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LWNvAAJCvZaA" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="QH7JbAUZLWaO" isRoot="false" isAbstract="true" isQuery="false" name="isStationIdle" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="XQokps7sp7gX" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="pxPjlcR79n0J" value="" type="uNcSkNqyAxHb" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id
+@param new_status" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xJTqs3yHK5au" isRoot="false" isAbstract="true" isQuery="false" name="updateStationStatus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0W4ii8rGjpAi" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="D2TYY1uLwI3i" value="" type="dsRw8nRMsxE8" name="station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sSn1FnJC4k0w" value="" type="nMhUhBvBqw4A" name="new_status" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param p_network_clock the new value of mpNetworkClock" isSpecification="false" isLeaf="false" visibility="public" xmi.id="c6XgqXacWmjX" isRoot="false" isAbstract="true" isQuery="false" name="setNetworkClock" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JlmoePCBpztc" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XhmJ7WbZBEx6" value="" type="Dc4onmiEKP73" name="p_network_clock" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return mDefaultStationExecutable" isSpecification="false" isLeaf="false" visibility="public" xmi.id="t1s0sfKSjp8X" isRoot="false" isAbstract="true" isQuery="false" name="getDefaultStationExecutable" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="p1Se86B8cFoJ" type="trv86yL4jfeS" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id the station ID
+@param station_name the new value of the station name" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LiArUrM0W8Je" isRoot="false" isAbstract="true" isQuery="false" name="setStationName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="MdZ3QhmkQYW4" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dsDo68tx9jvz" value="" type="dsRw8nRMsxE8" name="station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OGR53XcOFkDi" value="" type="trv86yL4jfeS" name="station_name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class IFunctionCall" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="2j8N30UlnykR" isRoot="false" isAbstract="false" name="IFunctionCall" >
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="J2aNcDdLjIki" isRoot="false" isAbstract="false" isQuery="false" name="IFunctionCall" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="HyhtbluIuHLs" isRoot="false" isAbstract="false" isQuery="false" name="~ IFunctionCall" />
+ <UML:Operation comment="// public methods// /**
+@return FunctionSciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="l7eip5m97MWi" isRoot="false" isAbstract="true" isQuery="false" name="createMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vhEie7LT8l8E" type="JCIhsw1mHbC2" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_sci_msg
+@param callback_address" isSpecification="false" isLeaf="false" visibility="public" xmi.id="X81GQjzfieZJ" isRoot="false" isAbstract="true" isQuery="false" name="registerCallback" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sHKSV8lrkIuA" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QRZIitARyo9n" value="" type="2JrrgMpWtl6M" name="msg_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lTejHlV9fP7u" value="" type="O0Y4e7L2YuKE" name="callback_address" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mkhHNiAlgjpI" isRoot="false" isAbstract="true" isQuery="false" name="sendMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zeuOCRS58eom" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="o8LL2dXo6BXM" value="" type="JCIhsw1mHbC2" name="p_function_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="v2TaQYUAJBSg" isRoot="false" isAbstract="true" isQuery="false" name="sendMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="m7FssL7kdRD8" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mu6r4eDzeeZ2" value="" type="taPZHCs4KBPK" name="function_sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_sci_msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ynfe0DywdNUn" isRoot="false" isAbstract="true" isQuery="false" name="receiveMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YwzIFrSCWLag" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TO4JwUKjgffu" value="" type="Q7aANH0SNANP" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return pointer to mListOfCallbacks" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4MiOTTt1EXfF" isRoot="false" isAbstract="true" isQuery="false" name="getListOfCallbacks" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="k3mshacRhpKX" type="Dk5pczPnz6Yr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class INetworkClock" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="pdUJAVtJe39T" isRoot="false" isAbstract="false" name="INetworkClock" >
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="sh6Y1fcHG1Pp" isRoot="false" isAbstract="false" isQuery="false" name="INetworkClock" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="BOv17TKw7oDH" isRoot="false" isAbstract="false" isQuery="false" name="~ INetworkClock" />
+ <UML:Operation comment="// public methods///**
+@param evt_to_send
+@param tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="I6aw7hNyMRWO" isRoot="false" isAbstract="true" isQuery="false" name="createEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="78fL728GO4HV" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8ymUQIqVOTqV" value="" type="VcPcOcsgjQbo" name="evt_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="M8En1Kv1mtoY" isRoot="false" isAbstract="true" isQuery="false" name="processNextEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BPGmqRuMNrea" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OGXn2qPMzklY" value="" type="Fls26ZE3bRdo" name="max_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Network_Clock_Tick" isSpecification="false" isLeaf="false" visibility="public" xmi.id="QO5UDy5Z4JK5" isRoot="false" isAbstract="true" isQuery="false" name="getCurrentTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="g5nAONr8Oby6" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_insert
+@param tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="iRbOoMx0JUVV" isRoot="false" isAbstract="true" isQuery="false" name="insertEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9aVoNnLWCbI3" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jPVy38VHo2wj" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8ma3mYiSzJql" value="" type="VcPcOcsgjQbo" name="evt_to_insert" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param evt_to_remove
+@param tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="flkwFFSwfxui" isRoot="false" isAbstract="true" isQuery="false" name="removeEvt" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="2ANOz0ye3loR" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5OxuOtbUd9VP" value="" type="Fls26ZE3bRdo" name="tick_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hEpeVdQ9P85c" value="" type="VcPcOcsgjQbo" name="evt_to_remove" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param station_id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="te4ovL4IvO5c" isRoot="false" isAbstract="true" isQuery="false" name="removeEvts" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9dZXEXbN55BS" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="52fJxeRcefMY" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class IChannel" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="mKTfuY7pgyOI" isRoot="false" isAbstract="false" name="IChannel" >
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="mnXY2pAfXV4I" isRoot="false" isAbstract="false" isQuery="false" name="IChannel" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="1LylB28ScNMD" isRoot="false" isAbstract="false" isQuery="false" name="~ IChannel" />
+ <UML:Operation comment="// public methods// /**
+Duplicate the MPDU payload.
+@param mpdu a PHY SCI message MPDU that contains the complete received MPDU payload
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="p03UaTHNEmvE" isRoot="false" isAbstract="true" isQuery="false" name="duplicateMpduPayload" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sVz56F67OTVN" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="c4t9XxPYINIR" value="" type="XNEzxlV9pJ9M" name="mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute PB measurement and NOISE.
+@param pb_measurement_array the PB measurement to fill in
+@param noise the PHY SCI message NOISE to fill in
+@param pb_header_array the PB header of each PB composing the MPDU
+@param mpdu a PHY SCI message MPDU that contains the duplicated MPDU payload
+@param tx_station_id the ID of the transmitting station
+@param rx_station_id the ID of the destination station
+@param current_tick the current Network Clock tick
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="OQtyoDBbEC4m" isRoot="false" isAbstract="true" isQuery="false" name="addPerturbation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TR1WBqvKRUpg" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vECDaScytWwf" value="" type="fL9t737j70re" name="pb_measurement_array" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="swSzwHbsWm36" value="" type="j5EvHIixdpql" name="noise" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ee25Aykt1znI" value="" type="t2asNnHh8wsl" name="pb_header_array" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KkkqUmwiQymY" value="" type="FVFtK4cB028u" name="mpdu" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uWPvTCDhfRa0" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TA9RCHJWz2KT" value="" type="dsRw8nRMsxE8" name="rx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="oGACCwi6Q7zs" value="" type="Fls26ZE3bRdo" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add Channel Settings to the list.
+Called when a station is created => create its associated Channel Settings.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KBZza9x3H6ST" isRoot="false" isAbstract="true" isQuery="false" name="addChannelSettings" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zP14UDVMgSPm" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MlyLnIpZXxjj" value="" type="dsRw8nRMsxE8" name="created_station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Find Channel Settings.
+@param tx_station_id the ID of the transmitting station
+@param rx_station_id the ID of the destination station
+@return a list of Channel Settings" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tRoJZlBrwkqU" isRoot="false" isAbstract="true" isQuery="false" name="findChannelSettings" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fVr3xKRQmQvx" type="SuGBQogD9iYR" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rmX8szaEjYYW" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="oN4LKn3BDpUk" value="" type="dsRw8nRMsxE8" name="rx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="aebVMPzEBVK4" value="" type="3lgc1KcaMAny" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when the PHY processor receives a preamble.
+@param tx_station_id the ID of the transmitting station
+@param current_tick the current Network Clock tick
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TZagO5Qxh1S3" isRoot="false" isAbstract="true" isQuery="false" name="receivePre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EqFgJ2KIRLLt" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="RRHauaeNStYt" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fC6nucEOAn2Y" value="" type="Fls26ZE3bRdo" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when the PHY processor receives a frame control.
+@param tx_station_id the ID of the transmitting station
+@param current_tick the current Network Clock tick
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="sTVXSvarLqSF" isRoot="false" isAbstract="true" isQuery="false" name="receiveFc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WoECGdxv9oz6" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Q4csx9jbJnOE" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OaaYNc4D3YkW" value="" type="Fls26ZE3bRdo" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemask.
+@param p_tonemask the new value of mpTonemask
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TLNmBp2ZucPp" isRoot="false" isAbstract="true" isQuery="false" name="setTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9OUtmNo1C3fT" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="l7O5umHGLpmi" value="" type="S02STVfDWPXk" name="p_tonemask" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemap of the current transmission.
+@return bool
+@param tx_station_id the ID of the transmitting station
+@param length the tonemap length in octets
+@param p_tonemap the tonemap" isSpecification="false" isLeaf="false" visibility="public" xmi.id="RruVNezoxMb6" isRoot="false" isAbstract="true" isQuery="false" name="setTonemap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="3zjTK4Mpsa16" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Adf2F3pzAE22" value="" type="dsRw8nRMsxE8" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0HHJ630Xsu0F" value="" type="qtOabrV06r8H" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Yz4UKfaSGEUT" value="" type="Z3mduvueNb9d" name="p_tonemap" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the beacon period in ticks 25 MHz.
+@return bool
+@param frequency the power-line frequency" isSpecification="false" isLeaf="false" visibility="public" xmi.id="HHSPVSPUjgnp" isRoot="false" isAbstract="true" isQuery="false" name="setBeaconPeriod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Cy0LlxPuLrl7" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="knLchJsEHugb" value="" type="EQrcJtA2vC7c" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the beacon period in ticks 25 MHz.
+@return mBeaconPeriod" isSpecification="false" isLeaf="false" visibility="public" xmi.id="XG1nSTEjkf6G" isRoot="false" isAbstract="true" isQuery="false" name="getBeaconPeriod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="DZ6Palsdib43" type="O74yXfkidyrR" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class Sta" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="4xqo1eJwmBM3" isRoot="false" isAbstract="false" name="Sta" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="zRkSwGNALXUk" type="8HFYeCh1V2Tr" name="mpSystemManager" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="7ZaQNgZJ8zsD" type="uNcSkNqyAxHb" name="mStationId" />
+ <UML:Attribute comment="Each 'Sta' instance points to an eCos process (via 'mStationId').
+When a 'Sta' is created from a Python script,
+the 'Sta' copy constructor is called by the Boost.Python interface.
+Thus, several 'Sta' instances point to the same eCos process.
+The eCos process has to be stopped only when the last 'Sta' pointing to it is deleted,
+i.e. when the station counter defined below equals 1." isSpecification="false" visibility="private" xmi.id="fHVjp6noe6bA" type="Afzv7B0Suvrw" name="mStaCounter" ownerScope="classifier" />
+ <UML:Attribute comment="// private attributes// // used for 'Maximus::process()' method only" isSpecification="false" visibility="private" xmi.id="lyCfKZjGyLKp" type="E5x9L9RNrd6t" name="mpMaximus" />
+ <UML:Operation stereotype="constructor" comment="Copy constructors" isSpecification="false" isLeaf="false" visibility="public" xmi.id="vDy8rHM8FLMJ" isRoot="false" isAbstract="false" isQuery="false" name="Sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dz8u1efxrd3g" value="" type="GgjUKN39BDXg" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="sNo5i8Pxn6R7" isRoot="false" isAbstract="false" isQuery="false" name="~ Sta" />
+ <UML:Operation comment="// public methods// /**
+@return Sta &amp;
+@param sta" isSpecification="false" isLeaf="false" visibility="public" xmi.id="RUGdflJGlQBk" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="eRqUzrb9obUZ" type="lNFLPGC5GcjE" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4qftRiZI6LNm" value="" type="GgjUKN39BDXg" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Remove an existing station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="UmjHrAMIcdtF" isRoot="false" isAbstract="false" isQuery="false" name="remove" />
+ <UML:Operation comment="Deactivate an existing station,
+i.e. the station will not receive Maximus messages anymore, until it will be reactivated." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ODW7bhsfVXYu" isRoot="false" isAbstract="false" isQuery="false" name="deactivate" />
+ <UML:Operation comment="Reactivate a deactivated station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="G5CKQa6sKq79" isRoot="false" isAbstract="false" isQuery="false" name="activate" />
+ <UML:Operation comment="Launch a debugger attached to the station executable,
+with arguments passed to main program." isSpecification="false" isLeaf="false" visibility="public" xmi.id="yUSZ5LoTWKb7" isRoot="false" isAbstract="false" isQuery="false" name="debug" />
+ <UML:Operation comment="// private methods// // private attribute accessor methods// /**
+@return SystemManagaer *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="LhgpzFvzefRZ" isRoot="false" isAbstract="false" isQuery="false" name="getSystemManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YrRrjCwwj1JJ" type="8HFYeCh1V2Tr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="umjFKCxPlYn8" isRoot="false" isAbstract="false" isQuery="false" name="resetStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="k9uTixUMMKrL" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods//// private attribute accessor methods// /**
+@return Sci_Msg_Station_Id" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CNRKKIXdzBTw" isRoot="false" isAbstract="false" isQuery="false" name="getStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9QVxzxWVnvMU" type="uNcSkNqyAxHb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Indicate if the station is IDLE or not." isSpecification="false" isLeaf="false" visibility="public" xmi.id="kNlTyXsQ4Zd6" isRoot="false" isAbstract="false" isQuery="false" name="is_idle" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="7GOoHh52o0VW" type="3lgc1KcaMAny" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station name." isSpecification="false" isLeaf="false" visibility="public" xmi.id="zYKpWQFd8x41" isRoot="false" isAbstract="false" isQuery="false" name="set_name" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Ges7FlOx68R4" value="" type="trv86yL4jfeS" name="station_name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="1fMphZ3m8uJa" isRoot="false" isAbstract="false" isQuery="false" name="Sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YswGI6MdbpQd" value="" type="E5x9L9RNrd6t" name="p_maximus" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OAI3M6TLlpBR" value="" type="TXhtlZjMAp7C" name="p_system_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NEBT8V1fLvtc" value="" type="trv86yL4jfeS" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// // private attribute accessor methods// /**
+Gets a pointer to Maximus.
+@return mpMaximus" isSpecification="false" isLeaf="false" visibility="private" xmi.id="bb88X3GmDev9" isRoot="false" isAbstract="false" isQuery="false" name="getMaximus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vxrHHgcQ65O5" type="E5x9L9RNrd6t" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class Msg" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3PksAGjP1DIY" isRoot="false" isAbstract="false" name="Msg" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="tJbdsVYsSKl5" type="E5x9L9RNrd6t" name="mpMaximus" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="vTEpSL31kzln" type="FM9MFyrLE5ts" name="mpFunctionCallManager" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="QJhQsq5k8fNy" type="8HFYeCh1V2Tr" name="mpSystemManager" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="8tqZDae63qtT" type="QBMG0J8pDlsx" name="mName" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="Do8JRTHaK87V" type="CxVwuGjKYPlO" name="mListOfParameters" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="glbjaTCkQfeK" type="K1iCj3mMQwQL" name="mCallback" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="QZ9lfEGLyq2Y" type="uNcSkNqyAxHb" name="mStationId" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="z0y7xDgOmo7P" type="JCIhsw1mHbC2" name="mpFunctionSciMsg" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="2Ni0DkWUvoBn" type="4Kduenu6BUBZ" name="mResponseReceived" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="AsynVX0oIj6T" isRoot="false" isAbstract="false" isQuery="false" name="Msg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ORHKrcSzSOky" value="" type="E5x9L9RNrd6t" name="p_maximus" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ulkCSqeguboD" value="" type="FM9MFyrLE5ts" name="p_function_call_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jFYYrdRD4hXv" value="" type="8HFYeCh1V2Tr" name="p_system_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="HxtkJdgDMQOp" value="" type="trv86yL4jfeS" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Copy constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="F2T7dHKMVtvK" isRoot="false" isAbstract="false" isQuery="false" name="Msg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yhUI5s5KuZPV" value="" type="WKXaz2THzK1G" name="msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qkqLblf53Ad1" isRoot="false" isAbstract="false" isQuery="false" name="~ Msg" />
+ <UML:Operation comment="// public methods// /**
+@return Msg &amp;
+@param msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="C4I9PHQNysd1" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1samouGtAeiQ" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kjKcIj78RxS0" value="" type="WKXaz2THzK1G" name="msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg &amp;
+@param name
+Add a void parameter named name to an existing message,
+i.e. its length is set to 0 and its value is set to NULL.
+Return the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="GwXCo8DWrX89" isRoot="false" isAbstract="false" isQuery="false" name="add_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JnS5lvbgsSv7" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="FDGeBgfpjiVx" value="" type="trv86yL4jfeS" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg &amp;
+@param name
+@param length
+@param value
+Add a parameter named name to an existing message.
+Its length is set to length and its value is set to value.
+Return the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="PEMADuKTopfa" isRoot="false" isAbstract="false" isQuery="false" name="add_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8YXCbtFaknMW" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xr6pMCwbPCEY" value="" type="trv86yL4jfeS" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jSjXHM7FDB2Y" value="" type="qtOabrV06r8H" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yFq9Qshoopbx" value="" type="Z3mduvueNb9d" name="value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg &amp;
+@param name
+@param value
+Add a parameter named name to an existing message.
+Its length is set to the size of value string and its value is set to value.
+Return the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="AuvPaSB7VxkO" isRoot="false" isAbstract="false" isQuery="false" name="add_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="haPqC5GVrgaa" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sc0EE7pAMfHn" value="" type="trv86yL4jfeS" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VzZJo8Fw2AJa" value="" type="trv86yL4jfeS" name="value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="aUh4QRSG2QUE" isRoot="false" isAbstract="false" isQuery="false" name="add_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZAFPaAWhg1tG" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XHOsuffPcEhO" value="" type="trv86yL4jfeS" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LXpyjWK3OfNQ" value="" type="44n6UGK0XgsS" name="value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg &amp;
+@param name
+Remove the parameter named name from an existing message.
+Return the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="IK1Pxfuzkf5E" isRoot="false" isAbstract="false" isQuery="false" name="remove_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="t7oduB9ajWQw" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vNER34rMZgII" value="" type="trv86yL4jfeS" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg &amp;
+@param user_cb
+Register a callback function to an existing function message.
+This callback will be called when the function message response will be received.
+If a callback had already been set, it is replaced by the new one.
+Return the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="BdJZIhyYzzvu" isRoot="false" isAbstract="false" isQuery="false" name="set_cb" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="aeRRI0zp8EEi" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sejRLziUc11t" value="" type="eptOVybOJnpM" name="user_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg &amp;
+Remove a registered callback from an existing function message.
+Return the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="gzPgyLadAUzd" isRoot="false" isAbstract="false" isQuery="false" name="remove_cb" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="NiP3jHHcO6DG" type="g55iEgjQlzYA" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg &amp;
+@param sta
+Set destination station to sta for an existing message.
+If a destination station had already been set, it is replaced by the new one.
+Return the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Qa0kOp6GSnhn" isRoot="false" isAbstract="false" isQuery="false" name="set_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="FMqyrGuRsKq8" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xIp5mpjAPhun" value="" type="lNFLPGC5GcjE" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Send an existing function message in the asynchronous mode,
+i.e. Maximus does not wait for function message response reception before continuing its execution.
+Note that before sending a function message via this method,
+user has to set its destination station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Wz1wkhjV4ypT" isRoot="false" isAbstract="false" isQuery="false" name="send_async" />
+ <UML:Operation comment="@param sta
+Send an existing function message to the station sta,
+in the asynchronous mode." isSpecification="false" isLeaf="false" visibility="public" xmi.id="F1XTdEhaWXeI" isRoot="false" isAbstract="false" isQuery="false" name="send_async" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KLTj2LVWKWT3" value="" type="lNFLPGC5GcjE" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Send an existing message in the synchronous mode,
+i.e. Maximus will wait for function message response reception before continuing its execution.
+Return the received message.
+Note that before sending a message via this method,
+user has to set its destination station." isSpecification="false" isLeaf="false" visibility="public" xmi.id="DCWI9LjMNEp0" isRoot="false" isAbstract="false" isQuery="false" name="send" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="InxQ2B8NrWOb" type="g55iEgjQlzYA" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param sta
+Send an existing message to the station sta,
+in the synchronous mode.
+Return the received message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="TUZzzDGJWh3Y" isRoot="false" isAbstract="false" isQuery="false" name="send" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lgB7mNN1jEzY" type="g55iEgjQlzYA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2Y4L2XOGisWp" value="" type="lNFLPGC5GcjE" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param name
+Return 'true' if the parameter named name exists in the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ED9bSyZtQ6sQ" isRoot="false" isAbstract="false" isQuery="false" name="is_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SsxJCnRUbPub" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="H6hnnkLqGO9H" value="" type="trv86yL4jfeS" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return unsigned char *
+@param name
+@param length
+@param p_data
+Retrieve contents of the parameter named name.
+Return updated length of the received parameter via length and a pointer to its value via p_data.
+Return NULL if the parameter named name does not exist in the message, else return p_data.
+Note that user has to allocate enough memory for parameter value.
+If parameter value length is unknown, user has to allocate FUNCTION_CALL_PARAM_MAX_SIZE bytes." isSpecification="false" isLeaf="false" visibility="public" xmi.id="vVXbN1ObCXAc" isRoot="false" isAbstract="false" isQuery="false" name="bind_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Y0yOUMzD08Km" type="ObMobD4JO6Fx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TiVuoMI4SzrG" value="" type="trv86yL4jfeS" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jSfwypYRV2LK" value="" type="iB4yZDFSik45" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="JTQzBS3tsipq" value="" type="ObMobD4JO6Fx" name="p_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="VLI1LbJhDfWm" isRoot="false" isAbstract="false" isQuery="false" name="bind_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VglDujjKbhdn" type="bQxm3RYu0b9f" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qY5FfIAwlawv" value="" type="trv86yL4jfeS" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// " isSpecification="false" isLeaf="false" visibility="private" xmi.id="iAX0mh0jhwqf" isRoot="false" isAbstract="false" isQuery="false" name="bindParameter" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="U5F3S9ey7aMa" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="io9dcJOJTvHF" value="" type="9U1uI8HJT0Jf" name="name_of_parameter_to_get" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="cHyIBmxKHwCX" value="" type="iB4yZDFSik45" name="data_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZCp266GiLEyW" value="" type="2UqTU88CwGoW" name="p_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private attributes accessor methods///**
+@return Maximus *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="ztpGp1nrVcLx" isRoot="false" isAbstract="false" isQuery="false" name="getMaximus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vJntQ6gtmP6g" type="E5x9L9RNrd6t" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return FunctionCallManager *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="kR8gfwCE82FE" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8o0jVcUzfj15" type="FM9MFyrLE5ts" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return SystemManager *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="8VvUhtygnnua" isRoot="false" isAbstract="false" isQuery="false" name="getSystemManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="qd3wEOW7fH05" type="8HFYeCh1V2Tr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return const ParametersList &amp;" isSpecification="false" isLeaf="false" visibility="private" xmi.id="pgQIIjG2AOio" isRoot="false" isAbstract="false" isQuery="false" name="getListOfParameters" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Nex921nAposK" type="Ks2QuFd1iYTQ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param ParametersList &amp;" isSpecification="false" isLeaf="false" visibility="private" xmi.id="PR4ADzl2fBKx" isRoot="false" isAbstract="false" isQuery="false" name="setListOfParameters" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OKI32J6sw9m8" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uYz2wfqEXrfQ" value="" type="Ks2QuFd1iYTQ" name="list_of_parameters" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return cb_t" isSpecification="false" isLeaf="false" visibility="private" xmi.id="6IRnouDDJFMW" isRoot="false" isAbstract="false" isQuery="false" name="getCallback" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VID9aEEvq95s" type="K1iCj3mMQwQL" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Sci_Msg_Station_Id" isSpecification="false" isLeaf="false" visibility="private" xmi.id="E7WrGroAPlAK" isRoot="false" isAbstract="false" isQuery="false" name="getStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Bs10erL29d3B" type="uNcSkNqyAxHb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param Sci_Msg_Station_Id" isSpecification="false" isLeaf="false" visibility="private" xmi.id="Q1YwqBMuTlhF" isRoot="false" isAbstract="false" isQuery="false" name="setStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="w92qHozk5Ctd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="m0IAkQU8R04H" value="" type="dsRw8nRMsxE8" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return FunctionSciMsg *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="COAd9rtmkIhs" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="O6YFFd5QU4R8" type="58Cx3O5oNLy7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_sci_msg " isSpecification="false" isLeaf="false" visibility="private" xmi.id="lQFBQKQagaEq" isRoot="false" isAbstract="false" isQuery="false" name="setFunctionSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tm93NAEHIG7X" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZQDulB1UbGfz" value="" type="Q7aANH0SNANP" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="Y4aFco52tfAG" isRoot="false" isAbstract="false" isQuery="false" name="isResponseReceived" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="36H8HBlfFJsU" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="vAgGJ3fqTskC" isRoot="false" isAbstract="false" isQuery="false" name="setResponseReceived" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vwtPyIVs2cvP" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ws1pVB3OKjfd" value="" type="3lgc1KcaMAny" name="response_received" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return std::string" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kKTDDDNEw1px" isRoot="false" isAbstract="false" isQuery="false" name="getName" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="n7g3MnaPsrX9" type="QBMG0J8pDlsx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="JPVfZIcV8bIc" isRoot="false" isAbstract="false" isQuery="false" name="receiveResponse" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mL042dhmy8x9" value="" type="Q7aANH0SNANP" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="JKLFJADdZgG6" isRoot="false" isAbstract="false" isQuery="false" name="receiveAsynchronousResponse" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xsb5TthECgIE" value="" type="Q7aANH0SNANP" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="d8gn0UhKQQiL" isRoot="false" isAbstract="false" isQuery="false" name="Msg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zuK9lGFs5Ase" value="" type="E5x9L9RNrd6t" name="p_maximus" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="H4tPlkPNq48p" value="" type="qcb8l3xv8TRt" name="p_function_call_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Wp9xGpGDkaMT" value="" type="TXhtlZjMAp7C" name="p_system_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qZLtkDY1FPOy" value="" type="trv86yL4jfeS" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Function_Call_Msg_Id
+Return mpFunctionSciMsg->mSpecializedSciMsgId." isSpecification="false" isLeaf="false" visibility="public" xmi.id="xzO34XLCmvyg" isRoot="false" isAbstract="false" isQuery="false" name="get_tx_msg_id" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0GmFZfiSZZrX" type="2JrrgMpWtl6M" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Function_Call_Msg_Id
+Return mpFunctionSciMsg->mpSpecializedSciMsgHeader->msg_id." isSpecification="false" isLeaf="false" visibility="public" xmi.id="kpNH1ycS3hdJ" isRoot="false" isAbstract="false" isQuery="false" name="get_rx_msg_id" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rLPtxIIiQwlm" type="2JrrgMpWtl6M" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param cb_t" isSpecification="false" isLeaf="false" visibility="private" xmi.id="JTIcHfu1hcoN" isRoot="false" isAbstract="false" isQuery="false" name="setCallback" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="hJ9ZBeg9uTNR" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="FCdx2d7L5NvK" value="" type="vteoFJru7xrN" name="callback" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class PhySciMsgMpdu" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="gjYrACSC9BuB" isRoot="false" isAbstract="false" name="PhySciMsgMpdu" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="D8KuNhepKAPe" />
+ <UML:Generalization xmi.idref="mRseT4TBFAfy" />
+ <UML:Generalization xmi.idref="I5POjRXvITtd" />
+ <UML:Generalization xmi.idref="LDY16XoozXTL" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="M2LZCyY6pGdk" type="LIcXhcTtT8Bn" name="mPayloadLength" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="CK2gDNwU6enG" type="ObMobD4JO6Fx" name="mpPayload" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="131qHeYSxZ6A" type="vFBbZkjwm4Vx" name="mpPre" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="aFQc6PzmnrBh" type="4XSkb7G7HX8a" name="mpFc" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="d4vdm39XH5iE" type="qzlFUs4gsJKl" name="mNbOfPbsInLastMsg" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="mBRb0wQvPAtZ" type="Ny9n9LLzEhXo" name="mPbsArray" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="0X10zUZAnpwn" isRoot="false" isAbstract="false" isQuery="false" name="segment" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="KsBy2uT9wopo" isRoot="false" isAbstract="false" isQuery="false" name="reassemble" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor
+Creates a PHY SCI message of type MPDU_PAYLOAD.
+@param p_phy_processor a pointer to the PHY interface" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7TE2jX8Ma10K" isRoot="false" isAbstract="false" isQuery="false" name="PhySciMsgMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="57rMCXYwiyXg" value="" type="DEOmV9sHIiVw" name="p_phy_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Copy Constructor
+Creates a PHY SCI message of type MPDU_PAYLOAD.
+@param phy_sci_msg a PHY SCI message" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uvcJ4TrBw5Bf" isRoot="false" isAbstract="false" isQuery="false" name="PhySciMsgMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bI2BJ0VM5KgH" value="" type="w18nsvnfKlCn" name="phy_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="rFBZBjF5cpNg" isRoot="false" isAbstract="false" isQuery="false" name="~ PhySciMsgMpdu" />
+ <UML:Operation comment="Sets the PHY SCI message class attributes before transmission,
+and fills specialized SCI msg data length and specialized SCI msg data
+for a PHY message of type MPDU_PAYLOAD.
+@param clock_id ID of the Network Clock event received message
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tUvwobDdoOAz" isRoot="false" isAbstract="false" isQuery="false" name="prepare" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="63ufcjCT4cK0" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5O3gBQMUcAgr" value="" type="2OUKpDmUU6Tg" name="clock_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Gets the MPDU payload length.
+@return mPayloadLength" isSpecification="false" isLeaf="false" visibility="public" xmi.id="9ZiQQhyHAtDw" isRoot="false" isAbstract="false" isQuery="false" name="getPayloadLength" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uaiIWS4BlBlu" type="qtOabrV06r8H" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the MPDU payload.
+@return mpPayload" isSpecification="false" isLeaf="false" visibility="public" xmi.id="TQaHmiFq6IUI" isRoot="false" isAbstract="false" isQuery="false" name="getPayload" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="pR4jsP9yS3d2" type="Z3mduvueNb9d" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param length the new value of mPayloadLength
+@param p_payload the new value of mpPayload
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="gqkGyQ57xlXN" isRoot="false" isAbstract="false" isQuery="false" name="setMpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="mqTpQnpILXbr" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="RUebNpVoD540" value="" type="qtOabrV06r8H" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mJosZIAD6tR5" value="" type="Z3mduvueNb9d" name="p_payload" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message PREAMBLE.
+@return mpPre" isSpecification="false" isLeaf="false" visibility="public" xmi.id="JWCFIicjCFIX" isRoot="false" isAbstract="false" isQuery="false" name="getPre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xf0jplbeBdM3" type="vFBbZkjwm4Vx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PHY SCI message FC.
+@return mpFc" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4nMIrOGdf2TE" isRoot="false" isAbstract="false" isQuery="false" name="getFc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="2V0SYdUIRx7r" type="4XSkb7G7HX8a" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the number of PBs into the last PHY SCI message composing the MPDU.
+@return mNbOfPbsInLastMsg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KcPOVqRmKc1a" isRoot="false" isAbstract="false" isQuery="false" name="getNbOfPbsInLastMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iwA3SlsPOt6D" type="qZLXuibBNXID" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the number of PBs into the last PHY SCI message composing the MPDU.
+@param nb_of_pbs_in_last_msg the new value of mNbOfPbsInLastMsg
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KeHWrZ1vLLBC" isRoot="false" isAbstract="false" isQuery="false" name="setNbOfPbsInLastMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ciqnLCpMfpoB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jRnOTGalsz8L" value="" type="qZLXuibBNXID" name="nb_of_pbs_in_last_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to the PBs of the nth PHY SCI message composing the MPDU.
+@return &amp;mPbsArray[n*PHY_PB_MAX_NB*MAC_PB520_BYTES]" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pZ8899iTn0xc" isRoot="false" isAbstract="false" isQuery="false" name="getPbs" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="QHTsEZhvTpyv" type="Z3mduvueNb9d" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZxYuIj429rOa" value="" type="qZLXuibBNXID" name="n" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Checks if the PHY SCI message has been sent (MPDU, or FC in case of a short PPDU).
+@return (mIsSent || mpFc->mIsSent)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="6zKyySKmzQu9" isRoot="false" isAbstract="false" isQuery="false" name="isSent" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="apJxiN8K5w6P" type="3lgc1KcaMAny" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Checks if the MPDU has been completely received
+(i.e. all PHY SCI messages MPDU composing the MPDU have been received).
+@param nb_of_received_msgs number of PHY SCI messages MPDU that have been received
+@return nb_of_received_msgs == mNbOfMsgs " isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZcaLcWxATT2j" isRoot="false" isAbstract="false" isQuery="false" name="isReceived" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6tjliXw6oOy1" type="3lgc1KcaMAny" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="D5lKwAu07Ex5" value="" type="qZLXuibBNXID" name="nb_of_received_msgs" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message Frame Control mode for PREAMBLE, FC and MPDU.
+@return bool
+@param fc_mode the new value of mFcMode, mpPre->mFcMode and mpFc->mFcMode" isSpecification="false" isLeaf="false" visibility="public" xmi.id="eFrcfjjEKJZu" isRoot="false" isAbstract="false" isQuery="false" name="setFcMode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xeuOTsI2fbzN" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nV4Ey5yBAhT4" value="" type="8JusFMjAgM0v" name="fc_mode" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message short PPDU for PREAMBLE, FC and MPDU.
+@return bool
+@param short_ppdu the new value of mShortPpdu, mpPre->mShortPpdu and mpFc->mShortPpdu" isSpecification="false" isLeaf="false" visibility="public" xmi.id="pM5wa20DHppw" isRoot="false" isAbstract="false" isQuery="false" name="setShortPpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="w5i02mP8f6sL" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZY8tpinbDqpB" value="" type="nLEyCkrlHPQw" name="short_ppdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message modulation for PREAMBLE, FC and MPDU.
+@return bool
+@param mod the new value of mMod, mpPre->mMod and mpFc->mMod" isSpecification="false" isLeaf="false" visibility="public" xmi.id="vlL3Rm7G8CDj" isRoot="false" isAbstract="false" isQuery="false" name="setMod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="doRQAOP72JUT" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="CBuT0jNZFWQ2" value="" type="UxIGEVkWi0NJ" name="mod" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message FEC rate for PREAMBLE, FC and MPDU.
+@return bool
+@param fecrate the new value of mFecrate, mpPre->mFecrate and mpFc->mFecrate" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CEdN2RWxCr0d" isRoot="false" isAbstract="false" isQuery="false" name="setFecrate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9mVpLSAHWqHW" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="c5skG5RSELwE" value="" type="pwe3pKqZPxkb" name="fecrate" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message Guard Interval for PREAMBLE, FC and MPDU.
+@return bool
+@param gil the new value of mGil, mpPre->mGil and mpFc->mGil" isSpecification="false" isLeaf="false" visibility="public" xmi.id="2HoHnEKxQvKS" isRoot="false" isAbstract="false" isQuery="false" name="setGil" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="cecHkUcMH4mR" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MrNZgLAIR23h" value="" type="0cEqYhKKEcTV" name="gil" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the PHY SCI message flags for PREAMBLE, FC and MPDU.
+@return bool
+@param flags the new value of mFlags, mpPre->mFlags and mpFc->mFlags" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5U9Jo3YqLK66" isRoot="false" isAbstract="false" isQuery="false" name="setFlags" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Q9XQQ1tXnPM8" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YQ2xJMPgDnDu" value="" type="ee5ipO9TkcLk" name="flags" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Frame Control 1.0 of the PHY SCI message FC.
+@return mpFc->mFc10" isSpecification="false" isLeaf="false" visibility="public" xmi.id="8NAXODETgMlU" isRoot="false" isAbstract="false" isQuery="false" name="getFc10" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rVNNLfryJUD2" type="ylvhNGRUzc7S" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Frame Control 1.0 of the PHY SCI message FC.
+@param fc_10 the new value of mpFc->mFc10
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="PJKidQn9op68" isRoot="false" isAbstract="false" isQuery="false" name="setFc10" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yqOFs8hGHCgh" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9WmNHzFNMNvk" value="" type="ylvhNGRUzc7S" name="fc_10" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Frame Control AV of the PHY SCI message FC.
+@return mpFc->mFcAvArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="b7CFTxjrG3Xr" isRoot="false" isAbstract="false" isQuery="false" name="getFcAv" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="DZEyyZ4o4R9N" type="t2asNnHh8wsl" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Frame Control AV of the PHY SCI message FC.
+@param fc_av the new value of mpFc->mFcAvArray
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="SIyE55KFZ6co" isRoot="false" isAbstract="false" isQuery="false" name="setFcAv" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="41LMVXORNmhD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5pBQC48lAK0d" value="" type="ylvhNGRUzc7S" name="fc_av[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the PHY SCI message class attributes.
+Fills PHY SCI message type.
+@param p_phy_processor a pointer to the PHY interface" isSpecification="false" isLeaf="false" visibility="private" xmi.id="HjSVlyKBGJNM" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MibvoBhuyqK8" value="" type="DEOmV9sHIiVw" name="p_phy_processor" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Awyu6tX5fqlW" isRoot="false" isAbstract="false" name="Error" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="oHaNwpXsoPxf" />
+ <UML:Generalization xmi.idref="eRWRUKUohuHk" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="1rwjdmsw4F7l" type="fuM43CRtzagH" name="mErrorId" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="UpNCk1jKLyAY" type="QBMG0J8pDlsx" name="mFunction" />
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Mdk82fnxh6hS" isRoot="false" isAbstract="false" isQuery="false" name="Error" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rn8nJHfdsNjt" value="" type="vQ1S2XzSPBqN" name="function" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3VqkbXBVvAvw" value="" type="vQ1S2XzSPBqN" name="msg" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ub9nl5jQx5S1" value="" type="pJsfgcYj7OSg" name="error" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="IuuFSaUFrNuX" isRoot="false" isAbstract="false" isQuery="false" name="~ Error" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="xTF4pfijGsXz" isRoot="false" isAbstract="false" isQuery="false" name="getFunction" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uMT9W7ohg2fd" type="QBMG0J8pDlsx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="vGPsKptcjnp9" isRoot="false" isAbstract="false" isQuery="false" name="getErrno" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZhPb8WzDVIZy" type="fuM43CRtzagH" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="LKMChHicixgX" isRoot="false" isAbstract="false" isQuery="false" name="getMessage" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nvQAh5LZPmiv" type="QBMG0J8pDlsx" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="cMHqCmp70C0K" isRoot="false" isAbstract="false" isQuery="false" name="display" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="XlAIxWJ0t2q4" isRoot="false" isAbstract="false" name="tick_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="WHPnnVHQeFGi" isRoot="false" isAbstract="false" name="MsgsList" elementReference="HYl1HlhGNnFB" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="eL818LAcaZPN" isRoot="false" isAbstract="false" name="StasList" elementReference="rRJOS4Ahavgr" />
+ <UML:Class comment="class Maximus" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="IZRHkhpzqhMU" isRoot="false" isAbstract="false" name="Maximus" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="zitjPGm6qY09" type="nHLqdVHOsxNM" name="mpCoreEngine" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="5qTvnqHkXBRu" type="SAh1zCEmUab7" name="mMaximusLogFile" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="DPrhzQm3HEy2" type="PDzFlxMB73D7" name="mMaxTickValue" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="2EnZNESmSPzB" type="PDzFlxMB73D7" name="mWaitTickValue" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="xiKXdCEggIcz" type="WHPnnVHQeFGi" name="mListOfMsgs" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="EOZVZ8expr8W" type="eL818LAcaZPN" name="mListOfStas" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="KqCUniraUydb" type="4Kduenu6BUBZ" name="mIsWireshark" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="jSxqHDZ353l5" type="WO0VJglkKJD1" name="mEtherLogFileDescriptor" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xRABKcNpOV5J" isRoot="false" isAbstract="false" isQuery="false" name="Maximus" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zPHtP7vheMwO" isRoot="false" isAbstract="false" isQuery="false" name="~ Maximus" />
+ <UML:Operation comment="// public methods// /**
+@param argc
+@param argv
+Initialize Maximus with main program arguments." isSpecification="false" isLeaf="false" visibility="public" xmi.id="1lMrQiLN9TXR" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3sHRNMkKjzB8" value="" type="UOc7OI8LRuFv" name="argc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="BZGJ2lk4dzVy" value="" type="66nkQj7RUTGt" name="argv[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="This method handles messages reception and events processing.
+When called, Maximus processes:
+- received messages from all simulated stations at the current tick;
+- all Maximus simulator events of the current tick." isSpecification="false" isLeaf="false" visibility="public" xmi.id="KEJ1DUAIZv2z" isRoot="false" isAbstract="false" isQuery="false" name="process" />
+ <UML:Operation comment="@return Sta
+Create a new station.
+Return a station object." isSpecification="false" isLeaf="false" visibility="public" xmi.id="f9P7af0mFF3F" isRoot="false" isAbstract="false" isQuery="false" name="create_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tUcaWFB4wad2" type="4xqo1eJwmBM3" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg
+@param name
+Create a function message, which name is set to name.
+Return a message object." isSpecification="false" isLeaf="false" visibility="public" xmi.id="0lJclna3zr4A" isRoot="false" isAbstract="false" isQuery="false" name="create_fc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="4aFarmYehynM" type="3PksAGjP1DIY" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="QDVP4YZOi0Ho" value="" type="trv86yL4jfeS" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg
+Create a probe message.
+Return a message object." isSpecification="false" isLeaf="false" visibility="public" xmi.id="T8Z3NQEGH7ML" isRoot="false" isAbstract="false" isQuery="false" name="create_probe" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="18vQtbJm5vKa" type="3PksAGjP1DIY" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param value
+Wait until (Maximus current tick + value) is reached." isSpecification="false" isLeaf="false" visibility="public" xmi.id="5iNpL2FlFj8H" isRoot="false" isAbstract="false" isQuery="false" name="wait" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lMh0U4LZkhM5" value="" type="Hfgxfxm85LAR" name="value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Wait until all responses to sent function messages in asynchronous mode are received." isSpecification="false" isLeaf="false" visibility="public" xmi.id="jcowJuBaZrXF" isRoot="false" isAbstract="false" isQuery="false" name="wait" />
+ <UML:Operation comment="// private methods// /**
+@return CoreEngine *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="MJLSMWZZvOFv" isRoot="false" isAbstract="false" isQuery="false" name="getCoreEngine" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8Tc43F76oKgf" type="nHLqdVHOsxNM" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return SystemManager *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="p1y6Fu8I8tpV" isRoot="false" isAbstract="false" isQuery="false" name="getSystemManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5EHmB47AB0b4" type="8HFYeCh1V2Tr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return FunctionCallManager *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="Y0PUMeNBdLFt" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="cuofo7Duanzc" type="FM9MFyrLE5ts" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return NetworkClockProcessor *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="HZrnbKc8I1af" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClockProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="14ipMOSRajCj" type="dxoHI48VOHpd" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return PhyProcessor *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="DhxPkoG1N7ox" isRoot="false" isAbstract="false" isQuery="false" name="getPhyProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="oJuzJV1tNpX9" type="QR5iQfL4cAJs" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return SciServer *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="CRLagBBtq8Ha" isRoot="false" isAbstract="false" isQuery="false" name="getSciServer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="wi4XW17X5pMP" type="xXbKcOH2nKjB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Network_Clock_Tick" isSpecification="false" isLeaf="false" visibility="private" xmi.id="z4DZCWPOvlyb" isRoot="false" isAbstract="false" isQuery="false" name="getMaxTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="BorlV1VJIPGb" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param max_tick_value" isSpecification="false" isLeaf="false" visibility="private" xmi.id="wATkGiKDFtWr" isRoot="false" isAbstract="false" isQuery="false" name="setMaxTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sHTF7yN1gRWC" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="w2Crl9RfHsPX" value="" type="Fls26ZE3bRdo" name="max_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Network_Clock_Tick" isSpecification="false" isLeaf="false" visibility="private" xmi.id="ahjnbDcoyUr4" isRoot="false" isAbstract="false" isQuery="false" name="getWaitTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SdhVQ3sbphNL" type="PDzFlxMB73D7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param wait_tick_value" isSpecification="false" isLeaf="false" visibility="private" xmi.id="136dSjRMjbCV" isRoot="false" isAbstract="false" isQuery="false" name="setWaitTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="isc0Fta781KD" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kdAzTaV1HCoq" value="" type="Fls26ZE3bRdo" name="wait_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// public methods///**
+Constructor (FOR UNITARY TESTS ONLY)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="PQfLtUOuVUXx" isRoot="false" isAbstract="false" isQuery="false" name="Maximus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DwIwYURG5cEY" value="" type="nHLqdVHOsxNM" name="p_core_engine" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="AjZRvLGIjvda" isRoot="false" isAbstract="false" isQuery="false" name="wrapper" ownerScope="classifier" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="N1TsVyngv5dR" value="" type="UOc7OI8LRuFv" name="n" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="X2hccv8mcfCV" isRoot="false" isAbstract="false" isQuery="false" name="stop" />
+ <UML:Operation comment="@param interface_cb
+Initialize PHY with an interface callback function for PHY SCI message MPDU reception." isSpecification="false" isLeaf="false" visibility="public" xmi.id="myq7G2MbZKOn" isRoot="false" isAbstract="false" isQuery="false" name="init_phy" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="N3jiJxCoOQt2" value="" type="lmHNZqFB8Nj8" name="interface_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param ether_cb
+Initialize Ethernet with an interface callback function for Ether SCI message reception." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ReIMjhiTdYYt" isRoot="false" isAbstract="false" isQuery="false" name="init_ether" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YQxuqpwGTEaA" value="" type="ZsS6AptYsaG9" name="interface_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Sta &amp;
+@param station_executable the station executable to run
+Create a new station.
+Return a reference on a station object." isSpecification="false" isLeaf="false" visibility="public" xmi.id="fKjXuyfQOaKD" isRoot="false" isAbstract="false" isQuery="false" name="create_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zfFd6jqWNXzl" type="lNFLPGC5GcjE" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PHTqT31NKbt9" value="" type="trv86yL4jfeS" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates a PHY SCI message MPDU.
+Returns a pointer to a PHY SCI message MPDU object.
+@return PhySciMsgMpdu *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Zk3mOOuxMTvs" isRoot="false" isAbstract="false" isQuery="false" name="create_mpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZsNMXkfGaGEn" type="ihg5BF2ckirV" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends an already configured PHY SCI message MPDU.
+@param p_mpdu
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="K6oQkbzQMuPj" isRoot="false" isAbstract="false" isQuery="false" name="send_mpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kWnp7b5gK8Tg" value="" type="ihg5BF2ckirV" name="p_mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates an Ether SCI message.
+Returns a pointer to an Ether SCI message object.
+@return EtherSciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ULdooZg6fVWO" isRoot="false" isAbstract="false" isQuery="false" name="create_ether" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9osHnCVmsiOw" type="812hl7Twm80d" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends an already configured Ether SCI message.
+@param ether
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="6UmQO996fuvn" isRoot="false" isAbstract="false" isQuery="false" name="send_ether" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="U0Ro8sUcE7Q0" value="" type="3Q4QiXaDv1Kh" name="ether" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Enable or disable the channel perturbation." isSpecification="false" isLeaf="false" visibility="public" xmi.id="BWqEwugW6DjD" isRoot="false" isAbstract="false" isQuery="false" name="disturb_channel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ejl688eOwosq" value="" type="3lgc1KcaMAny" name="enable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the Network Clock current tick." isSpecification="false" isLeaf="false" visibility="public" xmi.id="LLPxuF93mzIi" isRoot="false" isAbstract="false" isQuery="false" name="get_date" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="RERmjOYGEvbm" type="Hfgxfxm85LAR" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the power line frequency." isSpecification="false" isLeaf="false" visibility="public" xmi.id="uwC09tBoaxsj" isRoot="false" isAbstract="false" isQuery="false" name="set_freq" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3W5xIwmcHBZB" value="" type="EQrcJtA2vC7c" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the power line frequency." isSpecification="false" isLeaf="false" visibility="public" xmi.id="QjDAgVtaR3ZY" isRoot="false" isAbstract="false" isQuery="false" name="get_freq" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="dE0BUEyb1qro" type="EQrcJtA2vC7c" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to Channel
+@return mpCoreEngine->mpChannel" isSpecification="false" isLeaf="false" visibility="private" xmi.id="CmISlngwj5jf" isRoot="false" isAbstract="false" isQuery="false" name="getChannel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="0MZq2xlR9ACs" type="h0fjFQ6XJMWi" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to Ethernet
+@return mpCoreEngine->mpEthernet" isSpecification="false" isLeaf="false" visibility="private" xmi.id="CfgdedIp2S9u" isRoot="false" isAbstract="false" isQuery="false" name="getEthernet" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Yk7ldgXEuXPP" type="xqe85s2v3X76" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the SNR." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZRWilA5HYL4X" isRoot="false" isAbstract="false" isQuery="false" name="set_snr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9OGozBkjrFAQ" value="" type="EQrcJtA2vC7c" name="snr_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="GGK4gGiFhFyR" isRoot="false" isAbstract="false" isQuery="false" name="set_snr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="N1iwKkTT8kH7" value="" type="trv86yL4jfeS" name="snr_file" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="t0olDy9TFRVv" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_from_src" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fE9LT7mq6UmR" value="" type="EQrcJtA2vC7c" name="snr_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="EEsKw8Pp8EYL" value="" type="GgjUKN39BDXg" name="src" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="CimR7ILnUU8v" value="" type="3lgc1KcaMAny" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZujdMU2Yivse" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_from_src" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1HT9V0SiiC7p" value="" type="trv86yL4jfeS" name="snr_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="SQawuirRaZ5w" value="" type="GgjUKN39BDXg" name="src" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="37Ul0MN1coA7" value="" type="3lgc1KcaMAny" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="oanUnvIFLsAE" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_to_dst" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Zzf9Yi4bqYKo" value="" type="EQrcJtA2vC7c" name="snr_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="thqVUyaIZOnM" value="" type="GgjUKN39BDXg" name="dst" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="J5ZcvhqUhUcF" value="" type="3lgc1KcaMAny" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Cgp0C9p3rfYJ" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_to_dst" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="d9bAVMUmP2OL" value="" type="trv86yL4jfeS" name="snr_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jDnQhPer3TqG" value="" type="GgjUKN39BDXg" name="dst" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="cfJRIqktxK4S" value="" type="3lgc1KcaMAny" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="gYC6aaPInAiS" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_from_src_to_dst" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YMIbn8pQl7p3" value="" type="EQrcJtA2vC7c" name="snr_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vYuqsyGYVSc3" value="" type="GgjUKN39BDXg" name="src" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2zLo82EgMWFA" value="" type="GgjUKN39BDXg" name="dst" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="c3YNALQ3tLtl" value="" type="3lgc1KcaMAny" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="H9Ikbsmbq7Py" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_from_src_to_dst" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7ceU6tcju864" value="" type="trv86yL4jfeS" name="snr_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TV5Loy657Mog" value="" type="GgjUKN39BDXg" name="src" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DaI3ff1nHfFO" value="" type="GgjUKN39BDXg" name="dst" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Wp7RxBTOgZjU" value="" type="3lgc1KcaMAny" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Activate wrong preambles transmission.
+@param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+@param std_deviation the standard deviation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="XoYdAMJNuZQZ" isRoot="false" isAbstract="false" isQuery="false" name="activate_false_alarm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="FPKU2XsZMxyH" value="" type="Fls26ZE3bRdo" name="average_duration" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7PenwNISBo5K" value="" type="EQrcJtA2vC7c" name="std_deviation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param snr_file the SNR file to read
+@param the SNR array read from the SNR file
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="MUgWMFI5Q9BP" isRoot="false" isAbstract="false" isQuery="false" name="readSnrFile" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lLym9pb998yB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bafle9ZNgYEz" value="" type="trv86yL4jfeS" name="snr_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="gZUbPQzkugGE" value="" type="nJsED87p1vHp" name="snr_array[][]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Deactivate wrong preambles transmission." isSpecification="false" isLeaf="false" visibility="public" xmi.id="VP73tU02COsN" isRoot="false" isAbstract="false" isQuery="false" name="deactivate_false_alarm" />
+ <UML:Operation comment="Indicate if the station is IDLE or not.
+@param station_id the ID of the station
+@return 'true' if the station is IDLE, 'false' otherwise" isSpecification="false" isLeaf="false" visibility="public" xmi.id="EaaxRVWq8622" isRoot="false" isAbstract="false" isQuery="false" name="is_station_idle" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5jdEtn4PXBA8" type="3lgc1KcaMAny" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="enYNTWBP9rZM" value="" type="uNcSkNqyAxHb" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Indicates if Wireshark is enabled or not.
+@return 'true' if Wireshark is enabled, 'false' otherwise" isSpecification="false" isLeaf="false" visibility="private" xmi.id="VQBIn8O3Ni0O" isRoot="false" isAbstract="false" isQuery="false" name="isWireshark" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rhKkCh7y25iB" type="3lgc1KcaMAny" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class EtherSciMsg" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="CpGnr2lIA5kk" isRoot="false" isAbstract="false" name="EtherSciMsg" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="knNFU41hWrYt" />
+ <UML:Generalization xmi.idref="OKhFhtT3InZ0" />
+ <UML:Generalization xmi.idref="b5C38IYyUjh0" />
+ <UML:Generalization xmi.idref="gipeZdVAO1cK" />
+ <UML:Generalization xmi.idref="lUOyLKnJycgv" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="protected" xmi.id="GdKdWdg4NGY7" type="TCtwHZhr7lwx" name="mSpecializedSciMsgType" />
+ <UML:Attribute comment="// Specialized SCI msg header//" isSpecification="false" visibility="protected" xmi.id="23cO33fVVAlY" type="bErx1XNsRKIs" name="mSpecializedSciMsgHeader" />
+ <UML:Attribute isSpecification="false" visibility="protected" xmi.id="hyvcrFKQTBNS" type="xqe85s2v3X76" name="mpEthernet" />
+ <UML:Attribute isSpecification="false" visibility="protected" xmi.id="SbeM9S2GCU1b" type="ZWryYSGDRuyu" name="mSnifferType" />
+ <UML:Attribute isSpecification="false" visibility="protected" xmi.id="Ih3AfxA6ZmSg" type="cQhYUO60E2We" name="mFlags" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZVEqr9b3kvEo" isRoot="false" isAbstract="false" isQuery="false" name="dispatchMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vHI4PGEUzrgq" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="xmrmTGUZsjm6" isRoot="false" isAbstract="false" isQuery="false" name="create" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="clG9wQFm8ZWI" type="hHn4fFvgbLYX" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="5PTEweBcay3f" isRoot="false" isAbstract="false" isQuery="false" name="identifySpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="GbGGgxRbCjga" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="4HFCv7KG4okb" isRoot="false" isAbstract="false" isQuery="false" name="checkCompatibility" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yu2xjjoLU4SQ" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="t5ZfMqGz8SO4" isRoot="false" isAbstract="false" isQuery="false" name="checkValidity" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="SfAaCetQF7gw" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="hTJ4qGQnRKKO" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgHeader" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="jdje2NSCHn0X" isRoot="false" isAbstract="false" isQuery="false" name="returnSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="25VDmBnk3pgk" type="TYfZTukOB7DK" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="fu3Bt2ilRO8b" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YU32WTRy6bXI" type="PwWdyuRfg8qc" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jiK82b13cdRe" isRoot="false" isAbstract="false" isQuery="false" name="EtherSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="e499EsftpbWg" value="" type="xqe85s2v3X76" name="p_ethernet" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="oq6G1Sii81r9" isRoot="false" isAbstract="false" isQuery="false" name="~ EtherSciMsg" />
+ <UML:Operation comment="Display the specialized SCI message type." isSpecification="false" isLeaf="false" visibility="public" xmi.id="OhUFXSXch1iI" isRoot="false" isAbstract="false" isQuery="false" name="displaySpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zpc6foN11LmP" value="" type="UOc7OI8LRuFv" name="log_level" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Gets a pointer to the Ethernet processor.
+@return mpEthernet" isSpecification="false" isLeaf="false" visibility="private" xmi.id="CFZjc4qzlJCI" isRoot="false" isAbstract="false" isQuery="false" name="getEthernet" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EOgTTMNUPthA" type="xqe85s2v3X76" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the value of the Ethernet SCI message header.
+@return bool
+@param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZRrykd0pi3v9" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgHeader" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="2Uu4JYoq2qqW" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qQpsUBXaM7Pq" value="" type="8DcrWo7HU0iD" name="specialized_sci_msg_header" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Ether SCI message type.
+@return mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uX8OVoZ3EQ1w" isRoot="false" isAbstract="false" isQuery="false" name="getSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="HHTMrye5MLWn" type="HTUXG3XFPxuK" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Ether SCI message type.
+@return bool
+@param type the new value of mSpecializedSciMsgType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="1zmj0htq6giY" isRoot="false" isAbstract="false" isQuery="false" name="setSpecializedSciMsgType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fuH3nyDpQ7ti" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="v8a9YZ5XWpFW" value="" type="pE9AJY0D36ZX" name="type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the Ether SCI message class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="V6Mbm29ZEGjY" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="Gets the Ether SCI message SNIFFER type.
+@return mSnifferType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="1BJ3iBb540Tu" isRoot="false" isAbstract="false" isQuery="false" name="getSnifferType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ggYgUOBjec5T" type="ZcxOLFwJIm1Z" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Ether SCI message SNIFFER type.
+@return bool
+@param sniffer_type the new value of mSnifferType" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dtwr1t715Q4l" isRoot="false" isAbstract="false" isQuery="false" name="setSnifferType" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="akWu32hguxjf" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZdqbcKW9uTXG" value="" type="ZcxOLFwJIm1Z" name="sniffer_type" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Ether SCI message flags.
+@return mFlags" isSpecification="false" isLeaf="false" visibility="public" xmi.id="gRXwDYVqPShR" isRoot="false" isAbstract="false" isQuery="false" name="getFlags" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vwVK2M2g2aKU" type="LmSODUAk50Mh" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Ether SCI message flags.
+@return bool
+@param flags the new value of mFlags" isSpecification="false" isLeaf="false" visibility="public" xmi.id="IqrDHMTxo0t1" isRoot="false" isAbstract="false" isQuery="false" name="setFlags" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="wTEY5Jzd1VX2" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WOqwoVLAIlWT" value="" type="LmSODUAk50Mh" name="flags" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ZsS6AptYsaG9" isRoot="false" isAbstract="false" name="EtherCb" />
+ <UML:Class comment="class ISci" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="PKaM1HoCDbbs" isRoot="false" isAbstract="false" name="ISci" >
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="9XqhABel8vQp" isRoot="false" isAbstract="false" isQuery="false" name="ISci" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="NEwBjALDOYLZ" isRoot="false" isAbstract="false" isQuery="false" name="~ ISci" />
+ <UML:Operation comment="// public methods// /**
+@return bool
+@param station_log_file " isSpecification="false" isLeaf="false" visibility="public" xmi.id="1d6wHoJQJ85R" isRoot="false" isAbstract="true" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WDhOAQ43LZNL" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="JkAPdbFyn97X" value="" type="9U1uI8HJT0Jf" name="station_log" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool " isSpecification="false" isLeaf="false" visibility="public" xmi.id="HTkd14D2hHxy" isRoot="false" isAbstract="true" isQuery="false" name="process" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tP1wxJOsncOq" type="4Kduenu6BUBZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5GNMOQlf8w5j" isRoot="false" isAbstract="true" isQuery="false" name="fillSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uOUtrzwNCbkK" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XIhIRnpgEaJF" value="" type="3McdnqE6JCta" name="sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="eUFJlAFoRa8n" isRoot="false" isAbstract="true" isQuery="false" name="sendSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1oMKLjfE7e82" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1uT9qWtLmYdB" value="" type="xSzXJBSHo8yn" name="sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_to_send" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LRrZ1Amdd0uO" isRoot="false" isAbstract="true" isQuery="false" name="sendSciMsgToAllActiveStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yXsj7FX1dztU" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="A9BZiJLjDoq1" value="" type="3McdnqE6JCta" name="sci_msg_to_send" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param sci_msg_to_send
+@param list_of_dest_stations" isSpecification="false" isLeaf="false" visibility="public" xmi.id="IhK4EwFZN47M" isRoot="false" isAbstract="true" isQuery="false" name="sendSciMsgToDestStations" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="znq9OaSNMoih" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="CrxpprCyyLVg" value="" type="3McdnqE6JCta" name="sci_msg_to_send" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="69fRDmnObkBP" value="" type="eqNqcEputAw7" name="list_of_dest_stations" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set a value into mpSpecializedSciMsgArray
+@return bool
+@param sci_msg_type the array position to set
+@param sci_msg the new value of mpSpecializedSciMsgArray[sci_msg_type]" isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZNNXgsCLjZ9L" isRoot="false" isAbstract="true" isQuery="false" name="registerSpecializedSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VNva24bybRfi" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lyEf68mAIRbT" value="" type="EknMLJBAPpgo" name="sci_msg_type" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="BOrl63AfOVB5" value="" type="hHn4fFvgbLYX" name="sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param header
+@param data_length
+@param received_data" isSpecification="false" isLeaf="false" visibility="public" xmi.id="NNO4wVOiTcLY" isRoot="false" isAbstract="true" isQuery="false" name="receiveMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="gAiJAZm9MaGk" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="k7i0XISgeHPl" value="" type="erAlIci9mSIq" name="header" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="IZOh4ZkQu6Up" value="" type="qtOabrV06r8H" name="data_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bsX2SqaBvH9S" value="" type="Z3mduvueNb9d" name="received_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Zb7DtWwB4Jq6" isRoot="false" isAbstract="true" isQuery="false" name="displaySpecializedSciMsgArray" />
+ <UML:Operation comment="@return bool
+@param p_list_of_stations" isSpecification="false" isLeaf="false" visibility="public" xmi.id="saWlezaFp5GI" isRoot="false" isAbstract="true" isQuery="false" name="setStationsList" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="8i7UUp90B4YB" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="voRq5aHcAOo3" value="" type="cKqCpL4vHbUA" name="p_list_of_stations" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param current_tick_value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="skCu331ubVfG" isRoot="false" isAbstract="true" isQuery="false" name="updateTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="897hbmOFw4X4" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="SDTIIjYDYx1b" value="" type="Fls26ZE3bRdo" name="current_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class EthernetProcessor" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="RYfxHmW7DMwU" isRoot="false" isAbstract="false" name="EthernetProcessor" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="lfdP22D7S0Ta" />
+ <UML:Generalization xmi.idref="P1Cz8K6JKeJ1" />
+ <UML:Generalization xmi.idref="ZMYd8VSqVZW8" />
+ <UML:Generalization xmi.idref="9YrE9VtnAraO" />
+ <UML:Generalization xmi.idref="f87MTBfY1bqe" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="h1VbdRCaUhXy" type="xXbKcOH2nKjB" name="mpSciServer" />
+ <UML:Attribute comment="// private attributes//" isSpecification="false" visibility="private" xmi.id="5jpVjJ5eUWHB" type="T3wGzLaOdJRi" name="mpSci" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="anXgN3gO83dY" type="ZsS6AptYsaG9" name="mInterfaceCb" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="private" xmi.id="dl2c23XnlfHK" isRoot="false" isAbstract="false" isQuery="false" name="registerEtherSciMsg" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="51fn4DV8wLde" isRoot="false" isAbstract="false" isQuery="false" name="EthernetProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ejI6DaHlLnRh" value="" type="T3wGzLaOdJRi" name="p_sci" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="q75x8gTDh81k" isRoot="false" isAbstract="false" isQuery="false" name="~ EthernetProcessor" />
+ <UML:Operation comment="// public methods// /**
+Initializes Ethernet with an interface callback function for Ether SCI message reception.
+@param interface_cb
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LWsFrVtTCAaN" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="dJBzrShx8oPd" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ip83cZkReoOm" value="" type="ZsS6AptYsaG9" name="interface_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates an Ether SCI message.
+@return EtherSciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Sr08zzsITkVJ" isRoot="false" isAbstract="false" isQuery="false" name="createEther" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="cYblc7wjH3Qq" type="812hl7Twm80d" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends an Ether SCI message.
+This message has to be configured before transmission.
+@param ether_sci_msg
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DNmOVMlDAuEm" isRoot="false" isAbstract="false" isQuery="false" name="sendEther" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="no5hqcmTtxSi" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TxD8lZsBOqJL" value="" type="3Q4QiXaDv1Kh" name="ether_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when an Ether SCI message is received.
+@param ether_sci_msg
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="p9bJt7c5UMTx" isRoot="false" isAbstract="false" isQuery="false" name="receiveEther" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="N9dUw25WYgH9" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="hCAr4MdYJpe2" value="" type="3Q4QiXaDv1Kh" name="ether_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the Ethernet processor class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="MWClNV6AfiRW" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="Fills the Ether SCI message to send.
+@return bool
+@param ether_sci_msg" isSpecification="false" isLeaf="false" visibility="private" xmi.id="gXn0KP0fuCQH" isRoot="false" isAbstract="false" isQuery="false" name="fillEther" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="lDs2EGq13wgt" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="gUPJCrpzsNEG" value="" type="3Q4QiXaDv1Kh" name="ether_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to SCI.
+@return mpSci" isSpecification="false" isLeaf="false" visibility="private" xmi.id="NOJYkDoPjZP1" isRoot="false" isAbstract="false" isQuery="false" name="getSci" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WQNQOn6jxkBr" type="T3wGzLaOdJRi" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the interface callback function for Ether SCI message reception.
+@return mInterfaceCb" isSpecification="false" isLeaf="false" visibility="private" xmi.id="zNgtY48EZXXj" isRoot="false" isAbstract="false" isQuery="false" name="getInterfaceCb" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="mGNLueUgpKi3" type="ZsS6AptYsaG9" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates a TAP.
+@param dev name of the TAP file
+@return the created TAP file descriptor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WznSGvYzd4Vc" isRoot="false" isAbstract="false" isQuery="false" name="allocTap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="aX2dTgVx7sLT" type="WO0VJglkKJD1" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="jrKaqdDrAOlo" value="" type="66nkQj7RUTGt" name="dev" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class IEthernet" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vpDXE2tS2kJL" isRoot="false" isAbstract="false" name="IEthernet" >
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="P4tpXY4qIbJ5" isRoot="false" isAbstract="false" isQuery="false" name="IEthernet" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="O0uR0GThUwM5" isRoot="false" isAbstract="false" isQuery="false" name="~ IEthernet" />
+ <UML:Operation comment="// public methods// /**
+Initializes Ethernet with an interface callback function for Ether SCI message reception.
+@param interface_cb
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tXgA72aV4SKb" isRoot="false" isAbstract="true" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fSCaCORwcmFX" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0MRGwlLKjFlj" value="" type="ZsS6AptYsaG9" name="interface_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates an Ether SCI message.
+@return EtherSciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="UCOy9l10GiAM" isRoot="false" isAbstract="true" isQuery="false" name="createEther" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OhDD1tEaQEBr" type="812hl7Twm80d" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends an Ether SCI message.
+This message has to be configured before transmission.
+@param ether_sci_msg
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="klrpD9OBVqRR" isRoot="false" isAbstract="true" isQuery="false" name="sendEther" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="vgn2W8TAafkk" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ZmjG0T0SfOQo" value="" type="3Q4QiXaDv1Kh" name="ether_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when an Ether SCI message is received.
+@param ether_sci_msg
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="7SoM8zisiXft" isRoot="false" isAbstract="true" isQuery="false" name="receiveEther" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1Ahcwu9JcMUb" type="4Kduenu6BUBZ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="g44BsTbRDIhD" value="" type="3Q4QiXaDv1Kh" name="ether_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates a TAP.
+@param dev name of the TAP file
+@return the created TAP file descriptor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="zFfoHbK8z1CV" isRoot="false" isAbstract="true" isQuery="false" name="allocTap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="DjBcvNTo1EqY" type="WO0VJglkKJD1" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="gxJgsrdat2K2" value="" type="66nkQj7RUTGt" name="dev" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="RYfxHmW7DMwU" visibility="public" namespace="Logical View" xmi.id="f87MTBfY1bqe" parent="vpDXE2tS2kJL" discriminator="" name="" />
+ </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="944" snapy="10" showatts="1" xmi.id="4EhFX1CtqLC0" documentation="" type="1" showops="1" showpackage="1" name="SciMsg" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="860" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="333" showattsigs="601" x="252" fillcolor="#ffffc0" y="29" showopsigs="600" linewidth="none" height="243" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="dBvvR3kpanaF" showoperations="0" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="328" showattsigs="601" x="0" fillcolor="#ffffc0" y="293" showopsigs="600" linewidth="none" height="99" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="kNRjwgcIhcX0" showoperations="0" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="372" showattsigs="601" x="0" fillcolor="#ffffc0" y="406" showopsigs="600" linewidth="none" height="135" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="nMqHFdX6fOJd" showoperations="0" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="515" showattsigs="601" x="0" fillcolor="#ffffc0" y="563" showopsigs="600" linewidth="none" height="171" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="FBsPeH4gEvUD" showoperations="0" showpackage="1" showscope="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="325" showattsigs="601" x="615" fillcolor="#ffffc0" y="120" showopsigs="601" linewidth="none" height="117" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="CpGnr2lIA5kk" showoperations="0" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="302" showattsigs="601" x="553" fillcolor="#ffffc0" y="307" showopsigs="600" linewidth="none" height="549" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Kd2vdgexbsmt" showoperations="0" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="1" linewidth="none" widgetbid="dBvvR3kpanaF" widgetaid="kNRjwgcIhcX0" xmi.id="qpo9SZnjuaBV" linecolor="none" >
+ <linepath>
+ <startpoint startx="288" starty="293" />
+ <endpoint endx="288" endy="272" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="2" linewidth="none" widgetbid="dBvvR3kpanaF" widgetaid="nMqHFdX6fOJd" xmi.id="E1EkeKXGrlqW" linecolor="none" >
+ <linepath>
+ <startpoint startx="372" starty="406" />
+ <endpoint endx="372" endy="272" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="3" linewidth="none" widgetbid="dBvvR3kpanaF" widgetaid="FBsPeH4gEvUD" xmi.id="UmoLPXdZOnAp" linecolor="none" >
+ <linepath>
+ <startpoint startx="515" starty="563" />
+ <endpoint endx="515" endy="272" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="dBvvR3kpanaF" widgetaid="CpGnr2lIA5kk" xmi.id="knNFU41hWrYt" linecolor="none" >
+ <linepath>
+ <startpoint startx="615" starty="157" />
+ <endpoint endx="585" endy="157" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="4" linewidth="none" widgetbid="dBvvR3kpanaF" widgetaid="Kd2vdgexbsmt" xmi.id="kW8FuRBYKjoB" linecolor="none" >
+ <linepath>
+ <startpoint startx="580" starty="307" />
+ <endpoint endx="580" endy="272" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1111" snapy="10" showatts="1" xmi.id="Atny37F0n6QB" documentation="" type="1" showops="1" showpackage="1" name="SciServer" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="808" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="1" width="1029" showattsigs="601" x="78" fillcolor="none" y="90" showopsigs="601" linewidth="none" height="576" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="ElUvZ3tKAVPh" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1371" snapy="10" showatts="1" xmi.id="atEHLyXN24GN" documentation="" type="1" showops="1" showpackage="1" name="System" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1496" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="1" width="669" showattsigs="601" x="34" fillcolor="none" y="21" showopsigs="601" linewidth="none" height="333" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="0dybVkdpO4Ya" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,1,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="671" showattsigs="601" x="35" fillcolor="none" y="406" showopsigs="601" linewidth="none" height="630" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="bBWfkvMSUBzc" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="617" showattsigs="601" x="34" fillcolor="none" y="1096" showopsigs="601" linewidth="none" height="396" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="kNRjwgcIhcX0" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="634" showattsigs="601" x="733" fillcolor="none" y="364" showopsigs="601" linewidth="none" height="702" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="G1jpotlnS9ne" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="0" width="282" showattsigs="601" x="768" fillcolor="#ffffc0" y="1117" showopsigs="600" linewidth="none" height="360" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="OvNqoCObl8CH" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-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="0dybVkdpO4Ya" widgetaid="bBWfkvMSUBzc" xmi.id="4QEmSahd4YcC" linecolor="none" >
+ <linepath>
+ <startpoint startx="308" starty="406" />
+ <endpoint endx="308" endy="354" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="bBWfkvMSUBzc" widgetaid="kNRjwgcIhcX0" xmi.id="mQLltAsASv30" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="296" starty="1096" />
+ <endpoint endx="296" endy="1036" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="298" fillcolor="none" y="1038" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="YfeA70WQHOLq" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="145" x="155" fillcolor="none" y="1038" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="3o8hnDFUtwf9" showstereotype="1" text="mpSystemManager" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="OvNqoCObl8CH" widgetaid="G1jpotlnS9ne" xmi.id="bJkVFWmhwce8" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="858" starty="1066" />
+ <endpoint endx="858" endy="1117" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="860" fillcolor="none" y="1083" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="M7jD3MMZ11h8" showstereotype="1" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="171" x="691" fillcolor="none" y="1093" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="vGUN9f0AT8rE" text="mpStationConfiguration" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1372" snapy="10" showatts="1" xmi.id="GLYii7S9yH7g" documentation="" type="1" showops="1" showpackage="1" name="Function Call" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1469" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="661" showattsigs="601" x="59" fillcolor="#ffffc0" y="16" showopsigs="601" linewidth="none" height="171" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="2j8N30UlnykR" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,1,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="1" width="657" showattsigs="601" x="52" fillcolor="none" y="220" showopsigs="601" linewidth="none" height="270" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Szlq4RFfiqZ0" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="822" showattsigs="601" x="48" fillcolor="none" y="547" showopsigs="601" linewidth="none" height="918" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="FBsPeH4gEvUD" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="623" showattsigs="601" x="745" fillcolor="none" y="191" showopsigs="601" linewidth="none" height="342" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="JEjtehSNwhqe" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="2j8N30UlnykR" widgetaid="Szlq4RFfiqZ0" xmi.id="FFjd7SEcLuGj" linecolor="none" >
+ <linepath>
+ <startpoint startx="255" starty="220" />
+ <endpoint endx="255" endy="187" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="Szlq4RFfiqZ0" widgetaid="FBsPeH4gEvUD" xmi.id="AAzsiwCnuSXK" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="310" starty="547" />
+ <endpoint endx="310" endy="490" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="312" fillcolor="none" y="492" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="DqPhxGvJLcWM" showstereotype="1" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="173" x="141" fillcolor="none" y="492" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="zEYGcr6V7aqE" text="mpFunctionCallManager" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1406" snapy="10" showatts="1" xmi.id="1jSBKaHUXqWo" documentation="" type="1" showops="1" showpackage="1" name="Network Clock" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1574" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="1" width="668" showattsigs="601" x="27" fillcolor="none" y="21" showopsigs="601" linewidth="none" height="171" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="pdUJAVtJe39T" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,1,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="0" width="327" showattsigs="601" x="38" fillcolor="#ffffc0" y="233" showopsigs="600" linewidth="none" height="594" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="l6c6ZbY9k4oU" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="1" width="661" showattsigs="601" x="110" fillcolor="none" y="994" showopsigs="601" linewidth="none" height="576" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="nMqHFdX6fOJd" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="0" width="688" showattsigs="601" x="526" fillcolor="#ffffc0" y="215" showopsigs="601" linewidth="none" height="288" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="khBqlcIjqaYa" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="1" width="1009" showattsigs="601" x="393" fillcolor="none" y="526" showopsigs="601" linewidth="none" height="432" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="HaP8ZCy8plaL" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="pdUJAVtJe39T" widgetaid="l6c6ZbY9k4oU" xmi.id="isrV4NWwNe9f" linecolor="none" >
+ <linepath>
+ <startpoint startx="324" starty="233" />
+ <endpoint endx="324" endy="192" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="l6c6ZbY9k4oU" widgetaid="nMqHFdX6fOJd" xmi.id="YaNwl3ql1Drs" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="238" starty="994" />
+ <endpoint endx="238" endy="827" />
+ <point x="238" y="915" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="247" fillcolor="none" y="834" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="VAtcihrwYGdV" showstereotype="1" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="189" x="47" fillcolor="none" y="837" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="zsu0rb7qnd4N" showstereotype="1" text="mpNetworkClockProcessor" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="khBqlcIjqaYa" widgetaid="l6c6ZbY9k4oU" xmi.id="0cyrqanRieOR" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="365" starty="286" />
+ <endpoint endx="526" endy="286" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="492" fillcolor="none" y="252" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="cBmPprnI1gsk" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="168" x="362" fillcolor="none" y="288" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="UWmo9IA8826y" showstereotype="1" text="mpNetworkClockEvtList" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="985" snapy="10" showatts="1" xmi.id="GstO8HJ4IcQz" documentation="" type="1" showops="1" showpackage="1" name="Phy" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="2172" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="665" showattsigs="601" x="28" fillcolor="#ffffc0" y="20" drawascircle="0" showopsigs="601" linewidth="none" height="567" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="KqJ8bZTEut0O" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,1,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="957" showattsigs="601" x="24" fillcolor="#ffffc0" y="620" showopsigs="601" linewidth="none" height="1548" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="kooC0I8IkF1k" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-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="KqJ8bZTEut0O" widgetaid="kooC0I8IkF1k" xmi.id="wqho3l7CAaCs" linecolor="none" >
+ <linepath>
+ <startpoint startx="301" starty="620" />
+ <endpoint endx="301" endy="587" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="894" snapy="10" showatts="1" xmi.id="HTgS1vGBsXKx" documentation="" type="1" showops="1" showpackage="1" name="Ethernet" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1025" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="351" showattsigs="601" x="400" fillcolor="#ffffc0" y="205" showopsigs="601" linewidth="none" height="288" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="RYfxHmW7DMwU" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="1" width="351" showattsigs="601" x="260" fillcolor="none" y="23" showopsigs="601" linewidth="none" height="153" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="vpDXE2tS2kJL" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,1,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="0" width="612" showattsigs="601" x="79" fillcolor="#ffffc0" y="553" showopsigs="601" linewidth="none" height="468" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="CpGnr2lIA5kk" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="3" indexb="2" linewidth="none" widgetbid="vpDXE2tS2kJL" widgetaid="RYfxHmW7DMwU" xmi.id="lfdP22D7S0Ta" linecolor="none" >
+ <linepath>
+ <startpoint startx="512" starty="205" />
+ <endpoint endx="512" endy="158" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="3" indexb="1" linewidth="none" widgetbid="vpDXE2tS2kJL" widgetaid="CpGnr2lIA5kk" xmi.id="hyvcrFKQTBNS" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="303" starty="553" />
+ <endpoint endx="303" endy="158" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="308" fillcolor="none" y="178" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="OMyVN5TzEFO1" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="95" x="204" fillcolor="none" y="182" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="NhetxFMQl8Es" showstereotype="1" text="mpEthernet" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1894" snapy="10" showatts="1" xmi.id="j0Q5l6mvJKrs" documentation="" type="1" showops="1" showpackage="1" name="User Interface" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1262" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="1" width="772" showattsigs="601" x="38" fillcolor="none" y="112" showopsigs="601" linewidth="none" height="1026" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="IZRHkhpzqhMU" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="962" showattsigs="601" x="928" fillcolor="none" y="15" showopsigs="601" linewidth="none" height="882" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="3PksAGjP1DIY" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="0" width="670" showattsigs="601" x="931" fillcolor="#ffffc0" y="916" showopsigs="601" linewidth="none" height="342" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="4xqo1eJwmBM3" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="3" indexb="1" linewidth="none" widgetbid="IZRHkhpzqhMU" widgetaid="3PksAGjP1DIY" xmi.id="tJbdsVYsSKl5" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="928" starty="202" />
+ <endpoint endx="810" endy="202" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="812" fillcolor="none" y="168" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="hPDQVPJujHN6" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="97" x="812" fillcolor="none" y="204" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="6BJ6pCoBtS2p" text="mpMaximus" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="3" indexb="2" linewidth="none" widgetbid="IZRHkhpzqhMU" widgetaid="4xqo1eJwmBM3" xmi.id="lyCfKZjGyLKp" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="931" starty="929" />
+ <endpoint endx="810" endy="929" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="812" fillcolor="none" y="895" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="20atQai5ztTT" showstereotype="1" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="97" x="812" fillcolor="none" y="931" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="Kq5Z3Sa8dsCR" showstereotype="1" text="mpMaximus" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="910" snapy="10" showatts="1" xmi.id="hOBLZCjRwfIJ" documentation="" type="1" showops="1" showpackage="1" name="CoreEngine" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="824" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="1" width="858" showattsigs="601" x="39" fillcolor="none" y="43" showopsigs="601" linewidth="none" height="396" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="C32l1W8XzZV4" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="1442" snapy="10" showatts="1" xmi.id="cIRnlzb1kmMh" documentation="" type="3" showops="1" showpackage="1" name="MPDU" localid="JENORZT9F2n6" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1265" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="81" x="207" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="4mmdfk3zM4Cq" decon="0" localid="aqfH5SItxCyL" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="108" x="482" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="kooC0I8IkF1k" decon="0" localid="xginuQVObWXl" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="111" x="1327" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="pdUJAVtJe39T" decon="0" localid="zXibvu4raAyj" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="105" x="25" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="O8DTzb5kluKg" decon="0" localid="zNTpfqN0MmXP" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="125" x="668" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="gjYrACSC9BuB" decon="0" localid="WvYCF4tkz63o" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="111" x="890" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="emjq7Xks8DWW" decon="0" localid="25xomsl1Nhqd" 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="1095" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="uHdgUvjiSZG6" decon="0" localid="kkjT6JLHnp7M" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="78" x="355" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="C6sJEmNl1TfP" decon="0" localid="JENORZT9F2n6" 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="48" x="537" fillcolor="none" y="743" operation="sFYUdEAortKU" linewidth="none" widgetbid="xginuQVObWXl" height="32" usefillcolor="1" seqnum="" textid="GKLTU8NvQqBw" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="S8RGWl6kUas6" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="309" x="542" fillcolor="none" y="721" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="GKLTU8NvQqBw" showstereotype="1" text=": calculateMpduDuration() : Network_Clock_Tick" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="537" fillcolor="none" y="577" operation="8xeZSGecfweb" linewidth="none" widgetbid="xginuQVObWXl" height="32" usefillcolor="1" seqnum="" textid="apLpyTLhZs6H" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="7sKSuur0BtK7" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="288" x="542" fillcolor="none" y="555" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="apLpyTLhZs6H" showstereotype="1" text=": calculateFcDuration() : Network_Clock_Tick" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="844" x="537" fillcolor="none" y="414" operation="iRbOoMx0JUVV" linewidth="none" widgetbid="zXibvu4raAyj" height="8" usefillcolor="1" seqnum="" textid="X2jgBaYxExEf" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="qk33ZGhGWdBv" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="618" x="542" fillcolor="none" y="392" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="X2jgBaYxExEf" showstereotype="1" text=": insertEvt(tick_value : const Network_Clock_Tick, evt_to_insert : const NetworkClockEvt&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="844" x="537" fillcolor="none" y="823" operation="iRbOoMx0JUVV" linewidth="none" widgetbid="zXibvu4raAyj" height="8" usefillcolor="1" seqnum="" textid="h9Sgu2LAGvTz" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="hxGf94vRzQkV" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="618" x="542" fillcolor="none" y="801" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="h9Sgu2LAGvTz" text=": insertEvt(tick_value : const Network_Clock_Tick, evt_to_insert : const NetworkClockEvt&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="844" x="537" fillcolor="none" y="638" operation="iRbOoMx0JUVV" linewidth="none" widgetbid="zXibvu4raAyj" height="8" usefillcolor="1" seqnum="" textid="bc7mOoBXCPsT" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="EbZaiJG36ZHD" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="618" x="542" fillcolor="none" y="616" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="bc7mOoBXCPsT" text=": insertEvt(tick_value : const Network_Clock_Tick, evt_to_insert : const NetworkClockEvt&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="537" fillcolor="none" y="348" operation="BdjXdjNqRyHm" linewidth="none" widgetbid="xginuQVObWXl" height="32" usefillcolor="1" seqnum="" textid="QTRbrnuf1UXd" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="Ce03K664qI7K" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="295" x="542" fillcolor="none" y="326" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="QTRbrnuf1UXd" showstereotype="1" text=": calculatePreDuration() : Network_Clock_Tick" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="287" x="248" fillcolor="none" y="825" operation="" linewidth="none" widgetbid="aqfH5SItxCyL" height="8" usefillcolor="1" seqnum="" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="3RxRTMyIdWXx" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <messagewidget usesdiagramfillcolor="1" width="844" x="537" fillcolor="none" y="883" operation="yc5zTBjlFcbI" linewidth="none" widgetbid="xginuQVObWXl" height="8" usefillcolor="1" seqnum="" textid="Wnf8x0vHkZrq" widgetaid="zXibvu4raAyj" isinstance="0" xmi.id="SxQkmzmfjHsT" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="580" x="542" fillcolor="none" y="861" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Wnf8x0vHkZrq" text=": receiveEvt(received_evt : NetworkClockEvt&amp;, phy_sci_msg_to_send : PhySciMsg&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="168" x="78" fillcolor="none" y="194" operation="mpdu.send()" linewidth="none" widgetbid="aqfH5SItxCyL" height="8" usefillcolor="1" seqnum="" textid="EcYsfMA250rg" widgetaid="zNTpfqN0MmXP" isinstance="0" xmi.id="OrWvrbotJSO0" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="98" x="83" fillcolor="none" y="172" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="EcYsfMA250rg" showstereotype="1" text=": mpdu.send()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="168" x="78" fillcolor="none" y="827" operation="" linewidth="none" widgetbid="zNTpfqN0MmXP" height="8" usefillcolor="1" seqnum="" widgetaid="aqfH5SItxCyL" isinstance="0" xmi.id="2EhX9Ife397w" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <messagewidget usesdiagramfillcolor="1" width="48" x="537" fillcolor="none" y="918" operation="VBgQwIJgoVmd" linewidth="none" widgetbid="xginuQVObWXl" height="32" usefillcolor="1" seqnum="" textid="D5PLq8bto9y1" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="K5vHDenG284P" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="353" x="542" fillcolor="none" y="896" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="D5PLq8bto9y1" showstereotype="1" text=": sendMsg(phy_sci_msg_to_send : PhySciMsg&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="844" x="537" fillcolor="none" y="1006" operation="yc5zTBjlFcbI" linewidth="none" widgetbid="xginuQVObWXl" height="8" usefillcolor="1" seqnum="" textid="E31QNqGuTLMD" widgetaid="zXibvu4raAyj" isinstance="0" xmi.id="oNDHeZgFxcfh" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="580" x="542" fillcolor="none" y="984" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="E31QNqGuTLMD" showstereotype="1" text=": receiveEvt(received_evt : NetworkClockEvt&amp;, phy_sci_msg_to_send : PhySciMsg&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="537" fillcolor="none" y="1048" operation="VBgQwIJgoVmd" linewidth="none" widgetbid="xginuQVObWXl" height="32" usefillcolor="1" seqnum="" textid="gQ4zi6FFhoGI" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="JxK6P7ztqHkJ" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="353" x="542" fillcolor="none" y="1026" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="gQ4zi6FFhoGI" text=": sendMsg(phy_sci_msg_to_send : PhySciMsg&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="844" x="537" fillcolor="none" y="1127" operation="yc5zTBjlFcbI" linewidth="none" widgetbid="xginuQVObWXl" height="8" usefillcolor="1" seqnum="" textid="nBywSIugMtbj" widgetaid="zXibvu4raAyj" isinstance="0" xmi.id="ShHBEKb48jcq" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="580" x="542" fillcolor="none" y="1105" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nBywSIugMtbj" text=": receiveEvt(received_evt : NetworkClockEvt&amp;, phy_sci_msg_to_send : PhySciMsg&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="537" fillcolor="none" y="1174" operation="VBgQwIJgoVmd" linewidth="none" widgetbid="xginuQVObWXl" height="32" usefillcolor="1" seqnum="" textid="Bk5U80bNVSab" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="XfIVi1QBbtVs" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="353" x="542" fillcolor="none" y="1152" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Bk5U80bNVSab" showstereotype="1" text=": sendMsg(phy_sci_msg_to_send : PhySciMsg&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="192" x="537" fillcolor="none" y="700" operation="0X10zUZAnpwn" linewidth="none" widgetbid="WvYCF4tkz63o" height="8" usefillcolor="1" seqnum="" textid="RQhcfQoOCKMD" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="xzCnAqDL6hcE" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="83" x="542" fillcolor="none" y="678" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="RQhcfQoOCKMD" showstereotype="1" text=": segment()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="168" x="78" fillcolor="none" y="114" operation="mpdu = MPDU()" linewidth="none" widgetbid="aqfH5SItxCyL" height="8" usefillcolor="1" seqnum="" textid="lckZNvygFtqE" widgetaid="zNTpfqN0MmXP" isinstance="0" xmi.id="NRDciZGg8XRO" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="121" x="83" fillcolor="none" y="92" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="lckZNvygFtqE" showstereotype="1" text=": mpdu = MPDU()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="145" x="248" fillcolor="none" y="138" operation="create_phy()" linewidth="none" widgetbid="JENORZT9F2n6" height="8" usefillcolor="1" seqnum="" textid="hFwuHPLOkCKk" widgetaid="aqfH5SItxCyL" isinstance="0" xmi.id="hlTmkFXlV1m8" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="97" x="263" fillcolor="none" y="116" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="hFwuHPLOkCKk" showstereotype="1" text=": create_phy()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="417" x="536" fillcolor="none" y="264" operation="DNXsEDC2K4mJ" linewidth="none" widgetbid="25xomsl1Nhqd" height="32" usefillcolor="1" seqnum="" textid="ZqFYAe4ORR1c" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="H8AFHZ2mtT4d" sequencemessagetype="1000" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="268" x="541" fillcolor="none" y="242" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="ZqFYAe4ORR1c" showstereotype="1" text=": PhySciMsgPre(p_phy_processor : IPhy*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="619" x="536" fillcolor="none" y="475" operation="qlEY5IQdG7gV" linewidth="none" widgetbid="kkjT6JLHnp7M" height="32" usefillcolor="1" seqnum="" textid="h6BWgUJAD0Rw" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="fzNdrfMnhjP6" sequencemessagetype="1000" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="261" x="541" fillcolor="none" y="453" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="h6BWgUJAD0Rw" text=": PhySciMsgFc(p_phy_processor : IPhy*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="407" x="537" fillcolor="none" y="975" operation="fmyMYtyjGWbT" linewidth="none" widgetbid="25xomsl1Nhqd" height="8" usefillcolor="1" seqnum="" textid="KJBUEPHW3AEo" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="x1NxUxDM8OyG" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="288" x="542" fillcolor="none" y="953" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="KJBUEPHW3AEo" showstereotype="1" text=": ~ PhySciMsgPre()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="609" x="537" fillcolor="none" y="1096" operation="83x5QdeEMsmS" linewidth="none" widgetbid="kkjT6JLHnp7M" height="8" usefillcolor="1" seqnum="" textid="4Dc5JxUjNlfe" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="JRatU3w8xx5n" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="288" x="542" fillcolor="none" y="1074" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="4Dc5JxUjNlfe" showstereotype="1" text=": ~ PhySciMsgFc()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="192" x="537" fillcolor="none" y="1233" operation="rFBZBjF5cpNg" linewidth="none" widgetbid="WvYCF4tkz63o" height="8" usefillcolor="1" seqnum="" textid="fH35jWGhDXzt" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="jBIG0jKEJLxx" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="144" x="542" fillcolor="none" y="1211" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="fH35jWGhDXzt" showstereotype="1" text=": ~ PhySciMsgMpdu()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="140" x="395" fillcolor="none" y="150" operation="R72zIX7svlbt" linewidth="none" widgetbid="xginuQVObWXl" height="8" usefillcolor="1" seqnum="" textid="9VT5Ut4WBJOF" widgetaid="JENORZT9F2n6" isinstance="0" xmi.id="sSRiW0VkM4gS" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="184" x="400" fillcolor="none" y="128" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="9VT5Ut4WBJOF" text=": createMsg() : PhySciMsg&amp;" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="192" x="537" fillcolor="none" y="175" operation="7TE2jX8Ma10K" linewidth="none" widgetbid="WvYCF4tkz63o" height="8" usefillcolor="1" seqnum="" textid="J0nIsYmew458" widgetaid="xginuQVObWXl" isinstance="0" xmi.id="sklQg9ujs5Q9" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="282" x="542" fillcolor="none" y="153" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="J0nIsYmew458" showstereotype="1" text=": PhySciMsgMpdu(p_phy_processor : IPhy*)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="145" x="248" fillcolor="none" y="226" operation="send_phy()" linewidth="none" widgetbid="JENORZT9F2n6" height="8" usefillcolor="1" seqnum="" textid="1TisJQiD4S1L" widgetaid="aqfH5SItxCyL" isinstance="0" xmi.id="MLjPYQJKrnOp" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="87" x="253" fillcolor="none" y="204" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="1TisJQiD4S1L" showstereotype="1" text=": send_phy()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="140" x="395" fillcolor="none" y="241" operation="K3ts3zgWBNu5" linewidth="none" widgetbid="xginuQVObWXl" height="8" usefillcolor="1" seqnum="" textid="pX1eUtfKgm1G" widgetaid="JENORZT9F2n6" isinstance="0" xmi.id="kGIrPwvsJ07X" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="362" x="400" fillcolor="none" y="219" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="pX1eUtfKgm1G" text=": sendMpdu(phy_sci_msg_to_send : PhySciMsg&amp;) : 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="1318" snapy="10" showatts="1" xmi.id="vbn8kuzg0Pc6" documentation="" type="1" showops="1" showpackage="1" name="Phy 2" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1990" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="1" width="591" showattsigs="601" x="30" fillcolor="none" y="24" showopsigs="601" linewidth="none" height="1962" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="Kd2vdgexbsmt" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="532" showattsigs="601" x="677" fillcolor="none" y="22" showopsigs="601" linewidth="none" height="612" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="gjYrACSC9BuB" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="299" showattsigs="601" x="703" fillcolor="none" y="687" showopsigs="601" linewidth="none" height="99" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="emjq7Xks8DWW" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="299" showattsigs="601" x="1015" fillcolor="none" y="685" showopsigs="601" linewidth="none" height="198" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="uHdgUvjiSZG6" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ <classwidget usesdiagramfillcolor="1" width="224" showattsigs="601" x="727" fillcolor="none" y="901" showopsigs="601" linewidth="none" height="99" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="vSu5lsg0a7WJ" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="Kd2vdgexbsmt" widgetaid="gjYrACSC9BuB" xmi.id="D8KuNhepKAPe" linecolor="none" >
+ <linepath>
+ <startpoint startx="677" starty="152" />
+ <endpoint endx="621" endy="152" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="1" linewidth="none" widgetbid="Kd2vdgexbsmt" widgetaid="emjq7Xks8DWW" xmi.id="78n0YovcPcSY" linecolor="none" >
+ <linepath>
+ <startpoint startx="703" starty="687" />
+ <endpoint endx="621" endy="687" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="emjq7Xks8DWW" widgetaid="gjYrACSC9BuB" xmi.id="131qHeYSxZ6A" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="703" starty="634" />
+ <endpoint endx="703" endy="687" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="705" fillcolor="none" y="653" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="GArmMiKy8xEQ" showstereotype="1" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="61" x="646" fillcolor="none" y="663" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="nuGmlkD4UY4W" text="mpPre" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="2" linewidth="none" widgetbid="Kd2vdgexbsmt" widgetaid="uHdgUvjiSZG6" xmi.id="XhEs3csvqUn6" linecolor="none" >
+ <linepath>
+ <startpoint startx="1015" starty="857" />
+ <endpoint endx="621" endy="857" />
+ </linepath>
+ </assocwidget>
+ <assocwidget totalcounta="3" indexa="2" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="uHdgUvjiSZG6" widgetaid="gjYrACSC9BuB" xmi.id="aFQc6PzmnrBh" type="501" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="1022" starty="634" />
+ <endpoint endx="1022" endy="685" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="32" x="1024" fillcolor="none" y="651" linewidth="none" posttext="" role="702" height="32" usefillcolor="1" pretext="" isinstance="0" xmi.id="mqbHMflbqcNA" showstereotype="1" text="0..1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <floatingtext usesdiagramfillcolor="1" width="54" x="972" fillcolor="none" y="661" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="nsia5woso4cZ" text="mpFc" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </assocwidget>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="5" indexb="3" linewidth="none" widgetbid="Kd2vdgexbsmt" widgetaid="vSu5lsg0a7WJ" xmi.id="5oSJ5pfRXEKM" linecolor="none" >
+ <linepath>
+ <startpoint startx="727" starty="1000" />
+ <endpoint endx="621" endy="1000" />
+ </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: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="4EhFX1CtqLC0" documentation="" uniqueid="DjBcvNTo1EqY" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="813" id="uvuzFPfmVe3t" />
+ <listitem open="0" type="813" id="SRkFry3tOtYS" />
+ <listitem open="0" type="813" id="f4Wo0xIyC255" >
+ <listitem open="0" type="814" id="2bn9FjKszVLx" />
+ <listitem open="0" type="814" id="PsDvdrWFWC8z" />
+ <listitem open="0" type="814" id="yHVop6npiayx" />
+ <listitem open="0" type="814" id="HGnEk8A9yN4c" />
+ <listitem open="0" type="814" id="FZrjjxihEBW1" />
+ <listitem open="0" type="814" id="IHpypnt72gLm" />
+ <listitem open="0" type="814" id="oVvnrxP4WEnF" />
+ <listitem open="0" type="815" id="BUvOfPNvgCtV" />
+ <listitem open="0" type="815" id="cS7Ge0kalIaB" />
+ <listitem open="0" type="815" id="CIQaxQoYn5dM" />
+ <listitem open="0" type="815" id="yioj0NsDfJnd" />
+ <listitem open="0" type="815" id="KdmS6QflOg8i" />
+ <listitem open="0" type="815" id="k29W0gJIJ4iP" />
+ <listitem open="0" type="815" id="vxezggkuycWT" />
+ <listitem open="0" type="815" id="ZazVCVxD5car" />
+ <listitem open="0" type="815" id="i6JlitclF5Gy" />
+ <listitem open="0" type="815" id="LYdHkoQQujBa" />
+ <listitem open="0" type="815" id="CKV1ZXML5tua" />
+ <listitem open="0" type="815" id="aUw49UQJmtIM" />
+ <listitem open="0" type="815" id="QfhUYb4IzSQV" />
+ <listitem open="0" type="815" id="QYwDRDXqsCKO" />
+ <listitem open="0" type="815" id="nMeko5Ejl7cG" />
+ <listitem open="0" type="815" id="9cMfZUJx2D8R" />
+ <listitem open="0" type="815" id="Qm5Ibdz0oHIF" />
+ <listitem open="0" type="815" id="tABiLOUlAX1k" />
+ <listitem open="0" type="815" id="7O3I75OyFXgZ" />
+ <listitem open="0" type="815" id="jQ27COb3636K" />
+ <listitem open="0" type="815" id="EbAJeHbmz36e" />
+ <listitem open="0" type="815" id="xdKweQZHg5Re" />
+ <listitem open="0" type="815" id="m40iBL7eDD2l" />
+ </listitem>
+ <listitem open="0" type="813" id="N4J4BnHJo9bq" >
+ <listitem open="0" type="814" id="XL4btGdJr9Xs" />
+ <listitem open="0" type="814" id="zLCfqgpBk8Fu" />
+ <listitem open="0" type="814" id="tUBicnW98ai2" />
+ <listitem open="0" type="814" id="MsB4zOwsr8YT" />
+ <listitem open="0" type="815" id="v2a1cG1OZN40" />
+ <listitem open="0" type="815" id="BaNNGQKaHTeE" />
+ <listitem open="0" type="815" id="ydeVygT9GrUU" />
+ <listitem open="0" type="815" id="SvZ5b8LXly3h" />
+ <listitem open="0" type="815" id="eWptLJLb6Q7N" />
+ <listitem open="0" type="815" id="1WHlUKS6pHxA" />
+ <listitem open="0" type="815" id="hTVpMhZNDp8f" />
+ <listitem open="0" type="815" id="fxTMPci45DsR" />
+ <listitem open="0" type="815" id="4aIGsJh15UcK" />
+ <listitem open="0" type="815" id="FS7YhDtlmB1e" />
+ <listitem open="0" type="815" id="ShdX9FsfefaQ" />
+ <listitem open="0" type="815" id="iR7Ua662njYv" />
+ <listitem open="0" type="815" id="xOab392D99Uw" />
+ <listitem open="0" type="815" id="egUQQ0JNOrwP" />
+ <listitem open="0" type="815" id="0yd8752VzzaO" />
+ <listitem open="0" type="815" id="CtXakU0jQbrW" />
+ </listitem>
+ <listitem open="0" type="813" id="7WkpCVeuHxVw" >
+ <listitem open="0" type="814" id="5LdfotjaxiG6" />
+ <listitem open="0" type="814" id="3MiEZlxumBw5" />
+ <listitem open="0" type="815" id="oI6OJS2MlfzZ" />
+ <listitem open="0" type="815" id="Wh8SPOYQkHeK" />
+ <listitem open="0" type="815" id="95YrMA9MlM6T" />
+ <listitem open="0" type="815" id="Sv0rpva8sdBQ" />
+ <listitem open="0" type="815" id="KsjAVsa9g7WF" />
+ <listitem open="0" type="815" id="SbXD1qoLiVUC" />
+ </listitem>
+ <listitem open="0" type="813" id="PJbHtdSeqfcR" >
+ <listitem open="0" type="814" id="gt1eqa0GbUZ9" />
+ <listitem open="0" type="814" id="YJLJYvTkozJW" />
+ <listitem open="0" type="814" id="RHFrs6NWyNAm" />
+ <listitem open="0" type="814" id="x92YdbfAv0TR" />
+ <listitem open="0" type="814" id="tu9hrSEIhRAZ" />
+ <listitem open="0" type="815" id="WV4SsCEpLFMx" />
+ <listitem open="0" type="815" id="q15j0WAtQIZI" />
+ <listitem open="0" type="815" id="ilYQCixiE1A6" />
+ <listitem open="0" type="815" id="CNuVcESQDVAD" />
+ <listitem open="0" type="815" id="vgI9gSDsn5NP" />
+ <listitem open="0" type="815" id="5NjM9QDWnLLN" />
+ <listitem open="0" type="815" id="CjrhPVrVIqNC" />
+ <listitem open="0" type="815" id="GYaf2m9zBAgt" />
+ <listitem open="0" type="815" id="BdQ6sBo8jMmm" />
+ <listitem open="0" type="815" id="G0s1tcz4DN85" />
+ <listitem open="0" type="815" id="5qKElN0zNq0G" />
+ <listitem open="0" type="815" id="SxIeLPjsMt6d" />
+ <listitem open="0" type="815" id="55IQvGhLExzX" />
+ <listitem open="0" type="815" id="MhPgYTKMYNvL" />
+ <listitem open="0" type="815" id="6JEd1Jw4MEUF" />
+ </listitem>
+ <listitem open="0" type="813" id="QfHGrZecvJNh" />
+ <listitem open="0" type="813" id="FNAWFo5m56XX" >
+ <listitem open="0" type="814" id="ZlFJOJZWpHJ0" />
+ <listitem open="0" type="814" id="lvs2tNy8i7cx" />
+ </listitem>
+ <listitem open="0" type="813" id="nMqHFdX6fOJd" >
+ <listitem open="0" type="814" id="rz2gkqCi9n3k" />
+ <listitem open="0" type="814" id="FCfTYqKT5rid" />
+ <listitem open="0" type="814" id="01N7XprMor2W" />
+ <listitem open="0" type="814" id="rkydbz8GBI4B" />
+ <listitem open="0" type="814" id="YaNwl3ql1Drs" />
+ <listitem open="0" type="814" id="he6wwAPcfneH" />
+ <listitem open="0" type="815" id="JXgPZZ1RHy2s" />
+ <listitem open="0" type="815" id="x866R8HxgdsP" />
+ <listitem open="0" type="815" id="ieVxaWnXetd3" />
+ <listitem open="0" type="815" id="zt1fUt58ZDlV" />
+ <listitem open="0" type="815" id="DGiiOLp4xI2X" />
+ <listitem open="0" type="815" id="op2RhdUgUTKy" />
+ <listitem open="0" type="815" id="MN4wapPm48SQ" />
+ <listitem open="0" type="815" id="RHUOYWtMMvl1" />
+ <listitem open="0" type="815" id="WGh1jzz4M2yv" />
+ <listitem open="0" type="815" id="pNfrT7HuNmGv" />
+ <listitem open="0" type="815" id="EWebIuUY2k92" />
+ <listitem open="0" type="815" id="jiZy17sIdrtA" />
+ <listitem open="0" type="815" id="329et0ogLMkp" />
+ <listitem open="0" type="815" id="8XYOyquJcwd7" />
+ <listitem open="0" type="815" id="zO3LklAqIgCG" />
+ <listitem open="0" type="815" id="U6Y72BC8AW64" />
+ <listitem open="0" type="815" id="yy0UzZryvtHd" />
+ <listitem open="0" type="815" id="YfoSW458WX1a" />
+ <listitem open="0" type="815" id="ABBqopYdhMb4" />
+ <listitem open="0" type="815" id="dUC2E0OFnGO9" />
+ <listitem open="0" type="815" id="qbGpboWVV66k" />
+ <listitem open="0" type="815" id="xMZbd0yv7NcB" />
+ <listitem open="0" type="815" id="nPMurd6mzdNd" />
+ <listitem open="0" type="815" id="5jxTmJyXgIRX" />
+ <listitem open="0" type="815" id="8APIp4mPGvIs" />
+ </listitem>
+ <listitem open="0" type="813" id="C32l1W8XzZV4" >
+ <listitem open="0" type="814" id="NaCjKA3ztF1f" />
+ <listitem open="0" type="814" id="tIqrt93wBnvf" />
+ <listitem open="0" type="814" id="vReSwjgJHq1c" />
+ <listitem open="0" type="814" id="14ZsHYW9oM0f" />
+ <listitem open="0" type="814" id="T1ceoVKhww8r" />
+ <listitem open="0" type="814" id="Qvzi8cZHoFW0" />
+ <listitem open="0" type="814" id="OZ68tPxHLwzT" />
+ <listitem open="0" type="815" id="dm8vd9VcC2UT" />
+ <listitem open="0" type="815" id="b0cNLa3madPO" />
+ <listitem open="0" type="815" id="8h43dAsHw0CZ" />
+ <listitem open="0" type="815" id="KZVvvBoqsUMC" />
+ <listitem open="0" type="815" id="CmAhUywpVQiP" />
+ <listitem open="0" type="815" id="ZWFS1ZcYnDst" />
+ <listitem open="0" type="815" id="Gb5ewIM82WqU" />
+ <listitem open="0" type="815" id="SkHv8zKiWZAV" />
+ <listitem open="0" type="815" id="9k3uwvlCUqoP" />
+ <listitem open="0" type="815" id="68V8cJd42uxA" />
+ <listitem open="0" type="815" id="PmskjqBDNtW9" />
+ <listitem open="0" type="815" id="F99UFftitsKh" />
+ <listitem open="0" type="815" id="WCIhU3W1sD2s" />
+ <listitem open="0" type="815" id="CcgOZDeA999G" />
+ </listitem>
+ <listitem open="0" type="813" id="CWGE8DVJYvei" />
+ <listitem open="0" type="813" id="DQE4VzTfZR3v" />
+ <listitem open="0" type="813" id="Awyu6tX5fqlW" >
+ <listitem open="0" type="814" id="1rwjdmsw4F7l" />
+ <listitem open="0" type="814" id="UpNCk1jKLyAY" />
+ <listitem open="0" type="815" id="Mdk82fnxh6hS" />
+ <listitem open="0" type="815" id="IuuFSaUFrNuX" />
+ <listitem open="0" type="815" id="xTF4pfijGsXz" />
+ <listitem open="0" type="815" id="vGPsKptcjnp9" />
+ <listitem open="0" type="815" id="LKMChHicixgX" />
+ <listitem open="0" type="815" id="cMHqCmp70C0K" />
+ </listitem>
+ <listitem open="0" type="813" id="ZsS6AptYsaG9" />
+ <listitem open="0" type="813" id="CpGnr2lIA5kk" >
+ <listitem open="0" type="814" id="GdKdWdg4NGY7" />
+ <listitem open="0" type="814" id="23cO33fVVAlY" />
+ <listitem open="0" type="814" id="hyvcrFKQTBNS" />
+ <listitem open="0" type="814" id="SbeM9S2GCU1b" />
+ <listitem open="0" type="814" id="Ih3AfxA6ZmSg" />
+ <listitem open="0" type="815" id="ZVEqr9b3kvEo" />
+ <listitem open="0" type="815" id="xmrmTGUZsjm6" />
+ <listitem open="0" type="815" id="5PTEweBcay3f" />
+ <listitem open="0" type="815" id="4HFCv7KG4okb" />
+ <listitem open="0" type="815" id="t5ZfMqGz8SO4" />
+ <listitem open="0" type="815" id="hTJ4qGQnRKKO" />
+ <listitem open="0" type="815" id="jdje2NSCHn0X" />
+ <listitem open="0" type="815" id="fu3Bt2ilRO8b" />
+ <listitem open="0" type="815" id="jiK82b13cdRe" />
+ <listitem open="0" type="815" id="oq6G1Sii81r9" />
+ <listitem open="0" type="815" id="OhUFXSXch1iI" />
+ <listitem open="0" type="815" id="CFZjc4qzlJCI" />
+ <listitem open="0" type="815" id="ZRrykd0pi3v9" />
+ <listitem open="0" type="815" id="uX8OVoZ3EQ1w" />
+ <listitem open="0" type="815" id="1zmj0htq6giY" />
+ <listitem open="0" type="815" id="V6Mbm29ZEGjY" />
+ <listitem open="0" type="815" id="1BJ3iBb540Tu" />
+ <listitem open="0" type="815" id="dtwr1t715Q4l" />
+ <listitem open="0" type="815" id="gRXwDYVqPShR" />
+ <listitem open="0" type="815" id="IqrDHMTxo0t1" />
+ </listitem>
+ <listitem open="1" type="813" id="3Q4QiXaDv1Kh" />
+ <listitem open="1" type="813" id="TCtwHZhr7lwx" />
+ <listitem open="0" type="813" id="RYfxHmW7DMwU" >
+ <listitem open="0" type="814" id="h1VbdRCaUhXy" />
+ <listitem open="0" type="814" id="5jpVjJ5eUWHB" />
+ <listitem open="0" type="814" id="anXgN3gO83dY" />
+ <listitem open="0" type="815" id="dl2c23XnlfHK" />
+ <listitem open="0" type="815" id="51fn4DV8wLde" />
+ <listitem open="0" type="815" id="q75x8gTDh81k" />
+ <listitem open="0" type="815" id="LWsFrVtTCAaN" />
+ <listitem open="0" type="815" id="Sr08zzsITkVJ" />
+ <listitem open="0" type="815" id="DNmOVMlDAuEm" />
+ <listitem open="0" type="815" id="p9bJt7c5UMTx" />
+ <listitem open="0" type="815" id="MWClNV6AfiRW" />
+ <listitem open="0" type="815" id="gXn0KP0fuCQH" />
+ <listitem open="0" type="815" id="NOJYkDoPjZP1" />
+ <listitem open="0" type="815" id="zNgtY48EZXXj" />
+ <listitem open="0" type="815" id="WznSGvYzd4Vc" />
+ </listitem>
+ <listitem open="0" type="813" id="cQhYUO60E2We" />
+ <listitem open="0" type="813" id="bErx1XNsRKIs" />
+ <listitem open="0" type="813" id="ZWryYSGDRuyu" />
+ <listitem open="0" type="813" id="HTUXG3XFPxuK" />
+ <listitem open="0" type="813" id="bxyfX2FkfHc6" />
+ <listitem open="0" type="813" id="c6nC8sEdaTgi" >
+ <listitem open="0" type="814" id="GQCuSON9dVcx" />
+ <listitem open="0" type="814" id="OFjIEoRosCzy" />
+ </listitem>
+ <listitem open="0" type="813" id="cEjQpWrIlHo7" >
+ <listitem open="0" type="814" id="4fMbZO2Z9RpE" />
+ <listitem open="0" type="814" id="SzrPyinbwUzm" />
+ </listitem>
+ <listitem open="0" type="813" id="Szlq4RFfiqZ0" >
+ <listitem open="0" type="814" id="raWAUltd7jW1" />
+ <listitem open="0" type="814" id="dmOwhy7bcAr6" />
+ <listitem open="0" type="815" id="iZoWyAQnivxA" />
+ <listitem open="0" type="815" id="7CLhKCo3kaZg" />
+ <listitem open="0" type="815" id="kxUSsRaWGOFl" />
+ <listitem open="0" type="815" id="g0uk7zTE9muS" />
+ <listitem open="0" type="815" id="7FtH2ljzRCgi" />
+ <listitem open="0" type="815" id="qraO0M37auMa" />
+ <listitem open="0" type="815" id="fUBnkmKYcswc" />
+ <listitem open="0" type="815" id="3VmF1JJgoSSW" />
+ <listitem open="0" type="815" id="AtPIj4fkZR0b" />
+ <listitem open="0" type="815" id="jHFVhh1uR4h2" />
+ <listitem open="0" type="815" id="44p1BOsJFHbz" />
+ <listitem open="0" type="815" id="ZllXuTRZV4sC" />
+ </listitem>
+ <listitem open="0" type="813" id="JEjtehSNwhqe" >
+ <listitem open="0" type="814" id="NrWouCoyGezP" />
+ <listitem open="0" type="814" id="2phF4GENVwE7" />
+ <listitem open="0" type="814" id="dgUaMIEj9iV1" />
+ <listitem open="0" type="815" id="uKz9wwYwlFBn" />
+ <listitem open="0" type="815" id="WQBzMP6x4YXQ" />
+ <listitem open="0" type="815" id="wmd0KBO8sV6K" />
+ <listitem open="0" type="815" id="EAyLkPhHGm9g" />
+ <listitem open="0" type="815" id="Yg37rQy99xMM" />
+ <listitem open="0" type="815" id="bBBsyKWU0ZZq" />
+ <listitem open="0" type="815" id="g3LectUYOSdr" />
+ <listitem open="0" type="815" id="l4LuDzzLsCdx" />
+ <listitem open="0" type="815" id="wobrA8io91Sl" />
+ <listitem open="0" type="815" id="RyUJA5E6tpx1" />
+ <listitem open="0" type="815" id="eHnV4jU2KH6x" />
+ <listitem open="0" type="815" id="VuTb0D5y4fvN" />
+ <listitem open="0" type="815" id="tASCSY9vRaWP" />
+ <listitem open="0" type="815" id="mbNoEICQIH8q" />
+ <listitem open="0" type="815" id="AsCbRh0BINzV" />
+ </listitem>
+ <listitem open="0" type="813" id="FBsPeH4gEvUD" >
+ <listitem open="0" type="814" id="HtgfhrS9xQuR" />
+ <listitem open="0" type="814" id="M8XTHVzTFMBi" />
+ <listitem open="0" type="814" id="H9hzty6ArmoW" />
+ <listitem open="0" type="814" id="a3kQqWuPiYyL" />
+ <listitem open="0" type="814" id="7yImSgiT36hm" />
+ <listitem open="0" type="814" id="genMHiwrmeFa" />
+ <listitem open="0" type="814" id="AAzsiwCnuSXK" />
+ <listitem open="0" type="814" id="Q9L84AutwWTs" />
+ <listitem open="0" type="815" id="7GnAKVxy9iJO" />
+ <listitem open="0" type="815" id="QFGAtTk1dirM" />
+ <listitem open="0" type="815" id="7gAFMRdlgrvX" />
+ <listitem open="0" type="815" id="1LQuy933oBI8" />
+ <listitem open="0" type="815" id="cutGlpn4TJ1p" />
+ <listitem open="0" type="815" id="SaaGlrPOlGeU" />
+ <listitem open="0" type="815" id="5QZWjaJOr6QV" />
+ <listitem open="0" type="815" id="ML9vegQ5G0J1" />
+ <listitem open="0" type="815" id="pgNax052QcX7" />
+ <listitem open="0" type="815" id="KavaYFZOvxws" />
+ <listitem open="0" type="815" id="1yMFt9PeQpdM" />
+ <listitem open="0" type="815" id="OSZWBNB9mE14" />
+ <listitem open="0" type="815" id="ClJBMrjLp5Yg" />
+ <listitem open="0" type="815" id="EvKdlxx7OWdZ" />
+ <listitem open="0" type="815" id="tpjd1kfDTwMn" />
+ <listitem open="0" type="815" id="n66bBeFOYazJ" />
+ <listitem open="0" type="815" id="o71Mf0dBu32L" />
+ <listitem open="0" type="815" id="3TdrdWfV3hoZ" />
+ <listitem open="0" type="815" id="5uqX6gAvnAFR" />
+ <listitem open="0" type="815" id="8tc3ucMx6xnj" />
+ <listitem open="0" type="815" id="RSDV712Awqh2" />
+ <listitem open="0" type="815" id="xJNr93tftnwr" />
+ <listitem open="0" type="815" id="87xzsrqoUkoQ" />
+ <listitem open="0" type="815" id="niGFX66yejX5" />
+ <listitem open="0" type="815" id="28MeqshR77EU" />
+ <listitem open="0" type="815" id="lIyVIR67iUQi" />
+ <listitem open="0" type="815" id="AJwIR8kARidh" />
+ <listitem open="0" type="815" id="7jooCCWrI0NI" />
+ <listitem open="0" type="815" id="iop7VSoaAaMM" />
+ <listitem open="0" type="815" id="mqB3rYLMreYQ" />
+ <listitem open="0" type="815" id="lL6vvTFgJOj8" />
+ <listitem open="0" type="815" id="w2Ule0BF9O1u" />
+ <listitem open="0" type="815" id="aVKdns7WDEP7" />
+ <listitem open="0" type="815" id="fenw2W3wWVfB" />
+ <listitem open="0" type="815" id="kWAvia2LCpGD" />
+ <listitem open="0" type="815" id="zNLW6edynEwJ" />
+ <listitem open="0" type="815" id="uaklPv8vKcqs" />
+ <listitem open="0" type="815" id="dTcbIRfWRszE" />
+ <listitem open="0" type="815" id="DXZgqHeyznqh" />
+ <listitem open="0" type="815" id="MexYW51gIxOy" />
+ <listitem open="0" type="815" id="3pTkKpWS9lpM" />
+ <listitem open="0" type="815" id="tttVk4P00qr6" />
+ </listitem>
+ <listitem open="0" type="813" id="bEeZdY0xhVQw" />
+ <listitem open="0" type="813" id="2JrrgMpWtl6M" />
+ <listitem open="0" type="813" id="mKTfuY7pgyOI" >
+ <listitem open="0" type="815" id="mnXY2pAfXV4I" />
+ <listitem open="0" type="815" id="1LylB28ScNMD" />
+ <listitem open="0" type="815" id="p03UaTHNEmvE" />
+ <listitem open="0" type="815" id="OQtyoDBbEC4m" />
+ <listitem open="0" type="815" id="KBZza9x3H6ST" />
+ <listitem open="0" type="815" id="tRoJZlBrwkqU" />
+ <listitem open="0" type="815" id="TZagO5Qxh1S3" />
+ <listitem open="0" type="815" id="sTVXSvarLqSF" />
+ <listitem open="0" type="815" id="TLNmBp2ZucPp" />
+ <listitem open="0" type="815" id="RruVNezoxMb6" />
+ <listitem open="0" type="815" id="HHSPVSPUjgnp" />
+ <listitem open="0" type="815" id="XG1nSTEjkf6G" />
+ </listitem>
+ <listitem open="0" type="813" id="vpDXE2tS2kJL" >
+ <listitem open="0" type="815" id="P4tpXY4qIbJ5" />
+ <listitem open="0" type="815" id="O0uR0GThUwM5" />
+ <listitem open="0" type="815" id="tXgA72aV4SKb" />
+ <listitem open="0" type="815" id="UCOy9l10GiAM" />
+ <listitem open="0" type="815" id="klrpD9OBVqRR" />
+ <listitem open="0" type="815" id="7SoM8zisiXft" />
+ <listitem open="0" type="815" id="zFfoHbK8z1CV" />
+ </listitem>
+ <listitem open="0" type="813" id="2j8N30UlnykR" >
+ <listitem open="0" type="815" id="J2aNcDdLjIki" />
+ <listitem open="0" type="815" id="HyhtbluIuHLs" />
+ <listitem open="0" type="815" id="l7eip5m97MWi" />
+ <listitem open="0" type="815" id="X81GQjzfieZJ" />
+ <listitem open="0" type="815" id="mkhHNiAlgjpI" />
+ <listitem open="0" type="815" id="v2TaQYUAJBSg" />
+ <listitem open="0" type="815" id="Ynfe0DywdNUn" />
+ <listitem open="0" type="815" id="4MiOTTt1EXfF" />
+ </listitem>
+ <listitem open="0" type="813" id="pdUJAVtJe39T" >
+ <listitem open="0" type="815" id="sh6Y1fcHG1Pp" />
+ <listitem open="0" type="815" id="BOv17TKw7oDH" />
+ <listitem open="0" type="815" id="I6aw7hNyMRWO" />
+ <listitem open="0" type="815" id="M8En1Kv1mtoY" />
+ <listitem open="0" type="815" id="QO5UDy5Z4JK5" />
+ <listitem open="0" type="815" id="iRbOoMx0JUVV" />
+ <listitem open="0" type="815" id="flkwFFSwfxui" />
+ <listitem open="0" type="815" id="te4ovL4IvO5c" />
+ </listitem>
+ <listitem open="0" type="813" id="KqJ8bZTEut0O" >
+ <listitem open="0" type="815" id="yaLsEUCpV6SB" />
+ <listitem open="0" type="815" id="kPkaAdqUS7a3" />
+ <listitem open="0" type="815" id="h1GZuEvrpEj3" />
+ <listitem open="0" type="815" id="jusE0INkg7Lq" />
+ <listitem open="0" type="815" id="hOeUdLXMFNYD" />
+ <listitem open="0" type="815" id="J5bBV6yATae6" />
+ <listitem open="0" type="815" id="YbZw1PcKSDVy" />
+ <listitem open="0" type="815" id="AtHIE0QoOt3a" />
+ <listitem open="0" type="815" id="HFKsayykpF23" />
+ <listitem open="0" type="815" id="3jRwvWWTVYZx" />
+ <listitem open="0" type="815" id="NCRUK0sLkHHd" />
+ <listitem open="0" type="815" id="836rmxK77lbR" />
+ <listitem open="0" type="815" id="ly04r3Yz6coq" />
+ <listitem open="0" type="815" id="p57ZDpbznb1e" />
+ <listitem open="0" type="815" id="zMwv9wYy2dXF" />
+ <listitem open="0" type="815" id="tWYNzpkyBerK" />
+ <listitem open="0" type="815" id="Capv3pmwLIHI" />
+ <listitem open="0" type="815" id="cc0RbiyoInhJ" />
+ <listitem open="0" type="815" id="YhN1WBY6oWXP" />
+ <listitem open="0" type="815" id="VwwzN38tjVuF" />
+ <listitem open="0" type="815" id="wMOGK8Mp2GnP" />
+ <listitem open="0" type="815" id="LPbfTBCPXbgq" />
+ <listitem open="0" type="815" id="NQTsz7ig6MNL" />
+ <listitem open="0" type="815" id="j3lMDxQYOsPL" />
+ <listitem open="0" type="815" id="x721RPKCrAGh" />
+ <listitem open="0" type="815" id="MwIimf4jl6jC" />
+ <listitem open="0" type="815" id="T3MKEc1ea274" />
+ <listitem open="0" type="815" id="hGASKtfmwz68" />
+ <listitem open="0" type="815" id="tbpXPLzYIUlS" />
+ <listitem open="0" type="815" id="CTuiKWIdpi2x" />
+ </listitem>
+ <listitem open="0" type="813" id="PKaM1HoCDbbs" >
+ <listitem open="0" type="815" id="9XqhABel8vQp" />
+ <listitem open="0" type="815" id="NEwBjALDOYLZ" />
+ <listitem open="0" type="815" id="1d6wHoJQJ85R" />
+ <listitem open="0" type="815" id="HTkd14D2hHxy" />
+ <listitem open="0" type="815" id="5GNMOQlf8w5j" />
+ <listitem open="0" type="815" id="eUFJlAFoRa8n" />
+ <listitem open="0" type="815" id="LRrZ1Amdd0uO" />
+ <listitem open="0" type="815" id="IhK4EwFZN47M" />
+ <listitem open="0" type="815" id="ZNNXgsCLjZ9L" />
+ <listitem open="0" type="815" id="NNO4wVOiTcLY" />
+ <listitem open="0" type="815" id="Zb7DtWwB4Jq6" />
+ <listitem open="0" type="815" id="saWlezaFp5GI" />
+ <listitem open="0" type="815" id="skCu331ubVfG" />
+ </listitem>
+ <listitem open="0" type="813" id="0dybVkdpO4Ya" >
+ <listitem open="0" type="815" id="DcrHJRGd69d1" />
+ <listitem open="0" type="815" id="zdmBV5JTgF4A" />
+ <listitem open="0" type="815" id="xfzMjXwu7lBR" />
+ <listitem open="0" type="815" id="DP4JYfKYI6jn" />
+ <listitem open="0" type="815" id="UQWbBi2O55he" />
+ <listitem open="0" type="815" id="H3FD0lpUBM5M" />
+ <listitem open="0" type="815" id="nZmdYqjnrwyr" />
+ <listitem open="0" type="815" id="hmJq6ND6RyBa" />
+ <listitem open="0" type="815" id="8P8dmSdYZ6WN" />
+ <listitem open="0" type="815" id="2JQaOuviJdxq" />
+ <listitem open="0" type="815" id="W8mdiQTkhtI5" />
+ <listitem open="0" type="815" id="yB425IP1woFk" />
+ <listitem open="0" type="815" id="QH7JbAUZLWaO" />
+ <listitem open="0" type="815" id="xJTqs3yHK5au" />
+ <listitem open="0" type="815" id="c6XgqXacWmjX" />
+ <listitem open="0" type="815" id="t1s0sfKSjp8X" />
+ <listitem open="0" type="815" id="LiArUrM0W8Je" />
+ </listitem>
+ <listitem open="0" type="813" id="1Ey5TfpDf9m6" />
+ <listitem open="0" type="813" id="kzdjBd3ATyt6" >
+ <listitem open="0" type="814" id="nKss3o39Z3mH" />
+ <listitem open="0" type="814" id="hAaBJZSsONVc" />
+ <listitem open="0" type="814" id="pkjdKJy5coyd" />
+ <listitem open="0" type="815" id="im0mz7VTwqde" />
+ <listitem open="0" type="815" id="pKyAH6gz5KiE" />
+ <listitem open="0" type="815" id="ahQVV19KM6Sd" />
+ <listitem open="0" type="815" id="MmERazCgANkp" />
+ <listitem open="0" type="815" id="ko4mJmHnb6dV" />
+ <listitem open="0" type="815" id="eEUEK7jiBIVH" />
+ <listitem open="0" type="815" id="OQvPjNSdoMD9" />
+ <listitem open="0" type="815" id="nYuf4k0S9tps" />
+ <listitem open="0" type="815" id="EFV3cgAkX8PK" />
+ <listitem open="0" type="815" id="mfbvYQongHoG" />
+ <listitem open="0" type="815" id="wy0T5PosZ0fm" />
+ <listitem open="0" type="815" id="qLNWbBkV7iyA" />
+ <listitem open="0" type="815" id="8k2fkgPJT90J" />
+ </listitem>
+ <listitem open="0" type="813" id="IZRHkhpzqhMU" >
+ <listitem open="0" type="814" id="zitjPGm6qY09" />
+ <listitem open="0" type="814" id="5qTvnqHkXBRu" />
+ <listitem open="0" type="814" id="DPrhzQm3HEy2" />
+ <listitem open="0" type="814" id="2EnZNESmSPzB" />
+ <listitem open="0" type="814" id="xiKXdCEggIcz" />
+ <listitem open="0" type="814" id="EOZVZ8expr8W" />
+ <listitem open="0" type="814" id="KqCUniraUydb" />
+ <listitem open="0" type="814" id="jSxqHDZ353l5" />
+ <listitem open="0" type="815" id="xRABKcNpOV5J" />
+ <listitem open="0" type="815" id="zPHtP7vheMwO" />
+ <listitem open="0" type="815" id="1lMrQiLN9TXR" />
+ <listitem open="0" type="815" id="KEJ1DUAIZv2z" />
+ <listitem open="0" type="815" id="f9P7af0mFF3F" />
+ <listitem open="0" type="815" id="0lJclna3zr4A" />
+ <listitem open="0" type="815" id="T8Z3NQEGH7ML" />
+ <listitem open="0" type="815" id="5iNpL2FlFj8H" />
+ <listitem open="0" type="815" id="jcowJuBaZrXF" />
+ <listitem open="0" type="815" id="MJLSMWZZvOFv" />
+ <listitem open="0" type="815" id="p1y6Fu8I8tpV" />
+ <listitem open="0" type="815" id="Y0PUMeNBdLFt" />
+ <listitem open="0" type="815" id="HZrnbKc8I1af" />
+ <listitem open="0" type="815" id="DhxPkoG1N7ox" />
+ <listitem open="0" type="815" id="CRLagBBtq8Ha" />
+ <listitem open="0" type="815" id="z4DZCWPOvlyb" />
+ <listitem open="0" type="815" id="wATkGiKDFtWr" />
+ <listitem open="0" type="815" id="ahjnbDcoyUr4" />
+ <listitem open="0" type="815" id="136dSjRMjbCV" />
+ <listitem open="0" type="815" id="PQfLtUOuVUXx" />
+ <listitem open="0" type="815" id="AjZRvLGIjvda" />
+ <listitem open="0" type="815" id="X2hccv8mcfCV" />
+ <listitem open="0" type="815" id="myq7G2MbZKOn" />
+ <listitem open="0" type="815" id="ReIMjhiTdYYt" />
+ <listitem open="0" type="815" id="fKjXuyfQOaKD" />
+ <listitem open="0" type="815" id="Zk3mOOuxMTvs" />
+ <listitem open="0" type="815" id="K6oQkbzQMuPj" />
+ <listitem open="0" type="815" id="ULdooZg6fVWO" />
+ <listitem open="0" type="815" id="6UmQO996fuvn" />
+ <listitem open="0" type="815" id="BWqEwugW6DjD" />
+ <listitem open="0" type="815" id="LLPxuF93mzIi" />
+ <listitem open="0" type="815" id="uwC09tBoaxsj" />
+ <listitem open="0" type="815" id="QjDAgVtaR3ZY" />
+ <listitem open="0" type="815" id="CmISlngwj5jf" />
+ <listitem open="0" type="815" id="CfgdedIp2S9u" />
+ <listitem open="0" type="815" id="ZRWilA5HYL4X" />
+ <listitem open="0" type="815" id="GGK4gGiFhFyR" />
+ <listitem open="0" type="815" id="t0olDy9TFRVv" />
+ <listitem open="0" type="815" id="ZujdMU2Yivse" />
+ <listitem open="0" type="815" id="oanUnvIFLsAE" />
+ <listitem open="0" type="815" id="Cgp0C9p3rfYJ" />
+ <listitem open="0" type="815" id="gYC6aaPInAiS" />
+ <listitem open="0" type="815" id="H9Ikbsmbq7Py" />
+ <listitem open="0" type="815" id="XoYdAMJNuZQZ" />
+ <listitem open="0" type="815" id="MUgWMFI5Q9BP" />
+ <listitem open="0" type="815" id="VP73tU02COsN" />
+ <listitem open="0" type="815" id="EaaxRVWq8622" />
+ <listitem open="0" type="815" id="VQBIn8O3Ni0O" />
+ </listitem>
+ <listitem open="0" type="813" id="ajbkAQwdNn0L" >
+ <listitem open="0" type="814" id="UluQFtCGhE0l" />
+ <listitem open="0" type="814" id="5psZ1bacKBMT" />
+ <listitem open="0" type="814" id="ZG4w24GWoAw3" />
+ <listitem open="0" type="814" id="47HjJFSM5Lt6" />
+ </listitem>
+ <listitem open="0" type="813" id="3PksAGjP1DIY" >
+ <listitem open="0" type="814" id="tJbdsVYsSKl5" />
+ <listitem open="0" type="814" id="vTEpSL31kzln" />
+ <listitem open="0" type="814" id="QJhQsq5k8fNy" />
+ <listitem open="0" type="814" id="8tqZDae63qtT" />
+ <listitem open="0" type="814" id="Do8JRTHaK87V" />
+ <listitem open="0" type="814" id="glbjaTCkQfeK" />
+ <listitem open="0" type="814" id="QZ9lfEGLyq2Y" />
+ <listitem open="0" type="814" id="z0y7xDgOmo7P" />
+ <listitem open="0" type="814" id="2Ni0DkWUvoBn" />
+ <listitem open="0" type="815" id="AsynVX0oIj6T" />
+ <listitem open="0" type="815" id="F2T7dHKMVtvK" />
+ <listitem open="0" type="815" id="qkqLblf53Ad1" />
+ <listitem open="0" type="815" id="C4I9PHQNysd1" />
+ <listitem open="0" type="815" id="GwXCo8DWrX89" />
+ <listitem open="0" type="815" id="PEMADuKTopfa" />
+ <listitem open="0" type="815" id="AuvPaSB7VxkO" />
+ <listitem open="0" type="815" id="aUh4QRSG2QUE" />
+ <listitem open="0" type="815" id="IK1Pxfuzkf5E" />
+ <listitem open="0" type="815" id="BdJZIhyYzzvu" />
+ <listitem open="0" type="815" id="gzPgyLadAUzd" />
+ <listitem open="0" type="815" id="Qa0kOp6GSnhn" />
+ <listitem open="0" type="815" id="Wz1wkhjV4ypT" />
+ <listitem open="0" type="815" id="F1XTdEhaWXeI" />
+ <listitem open="0" type="815" id="DCWI9LjMNEp0" />
+ <listitem open="0" type="815" id="TUZzzDGJWh3Y" />
+ <listitem open="0" type="815" id="ED9bSyZtQ6sQ" />
+ <listitem open="0" type="815" id="vVXbN1ObCXAc" />
+ <listitem open="0" type="815" id="VLI1LbJhDfWm" />
+ <listitem open="0" type="815" id="iAX0mh0jhwqf" />
+ <listitem open="0" type="815" id="ztpGp1nrVcLx" />
+ <listitem open="0" type="815" id="kR8gfwCE82FE" />
+ <listitem open="0" type="815" id="8VvUhtygnnua" />
+ <listitem open="0" type="815" id="pgQIIjG2AOio" />
+ <listitem open="0" type="815" id="PR4ADzl2fBKx" />
+ <listitem open="0" type="815" id="6IRnouDDJFMW" />
+ <listitem open="0" type="815" id="E7WrGroAPlAK" />
+ <listitem open="0" type="815" id="Q1YwqBMuTlhF" />
+ <listitem open="0" type="815" id="COAd9rtmkIhs" />
+ <listitem open="0" type="815" id="lQFBQKQagaEq" />
+ <listitem open="0" type="815" id="Y4aFco52tfAG" />
+ <listitem open="0" type="815" id="vAgGJ3fqTskC" />
+ <listitem open="0" type="815" id="kKTDDDNEw1px" />
+ <listitem open="0" type="815" id="JPVfZIcV8bIc" />
+ <listitem open="0" type="815" id="JKLFJADdZgG6" />
+ <listitem open="0" type="815" id="d8gn0UhKQQiL" />
+ <listitem open="0" type="815" id="xzO34XLCmvyg" />
+ <listitem open="0" type="815" id="kpNH1ycS3hdJ" />
+ <listitem open="0" type="815" id="JTIcHfu1hcoN" />
+ </listitem>
+ <listitem open="0" type="813" id="97JXVDPWi2XZ" />
+ <listitem open="0" type="813" id="HaP8ZCy8plaL" >
+ <listitem open="0" type="814" id="Wyku01OWbn80" />
+ <listitem open="0" type="814" id="Qye7PFvVCgxa" />
+ <listitem open="0" type="814" id="wo5LHtolrYgq" />
+ <listitem open="0" type="814" id="e6geZ8aObm6V" />
+ <listitem open="0" type="815" id="Y4M9pS7FRmMo" />
+ <listitem open="0" type="815" id="zGJ9uEjq2mBI" />
+ <listitem open="0" type="815" id="pCqXr26yLqVP" />
+ <listitem open="0" type="815" id="uEZ9MQsBagiP" />
+ <listitem open="0" type="815" id="gmL0dqPYepr5" />
+ <listitem open="0" type="815" id="ArBiXr7CeSCF" />
+ <listitem open="0" type="815" id="LfRx6bCNCxGa" />
+ <listitem open="0" type="815" id="aEPZWFXDDNYy" />
+ <listitem open="0" type="815" id="8qXKmnsK1ItV" />
+ <listitem open="0" type="815" id="VOjimHg0AVvX" />
+ <listitem open="0" type="815" id="WvlVBc1g1iOl" />
+ <listitem open="0" type="815" id="x3j6YcbSepSG" />
+ <listitem open="0" type="815" id="BMgA23ty6c4c" />
+ <listitem open="0" type="815" id="Ff2tSU7783RU" />
+ <listitem open="0" type="815" id="0EKrlfsv0Y30" />
+ <listitem open="0" type="815" id="StUj99llDRPn" />
+ <listitem open="0" type="815" id="cFsPi6AvfZ2W" />
+ <listitem open="0" type="815" id="wa9sY7FBM5Y2" />
+ <listitem open="0" type="815" id="GIrdG4ICfR4B" />
+ </listitem>
+ <listitem open="0" type="813" id="khBqlcIjqaYa" >
+ <listitem open="0" type="814" id="FQVDxYEWTCA1" />
+ <listitem open="0" type="815" id="FNlsdNwN57Bo" />
+ <listitem open="0" type="815" id="jTXY358GUbUP" />
+ <listitem open="0" type="815" id="9ivbs5c5RLy4" />
+ <listitem open="0" type="815" id="yHOPcKTLFq7F" />
+ <listitem open="0" type="815" id="STarMHAKWYi8" />
+ <listitem open="0" type="815" id="GPJmv1uoBMsB" />
+ <listitem open="0" type="815" id="w6pFoDutXMZa" />
+ <listitem open="0" type="815" id="Wpaq08JPHCMI" />
+ <listitem open="0" type="815" id="igYzrsF8jPVL" />
+ <listitem open="0" type="815" id="SSsbEeW9LIdO" />
+ <listitem open="0" type="815" id="fdvnDIwvwUsn" />
+ <listitem open="0" type="815" id="s0ADIlbxMUiZ" />
+ <listitem open="0" type="815" id="qa8yLazS9pRI" />
+ <listitem open="0" type="815" id="WFgAavh42rB6" />
+ </listitem>
+ <listitem open="0" type="813" id="l6c6ZbY9k4oU" >
+ <listitem open="0" type="814" id="b8rzl0c6gBqq" />
+ <listitem open="0" type="814" id="0cyrqanRieOR" />
+ <listitem open="0" type="814" id="dzYHAM8cQs2B" />
+ <listitem open="0" type="814" id="FTzfSCWSoSIc" />
+ <listitem open="0" type="814" id="252jhQAIPgaZ" />
+ <listitem open="0" type="814" id="2g9RY9cmdZP3" />
+ <listitem open="0" type="814" id="NnWRJWdvFfV2" />
+ <listitem open="0" type="815" id="mvUaOmBOpD7W" />
+ <listitem open="0" type="815" id="dIn1yNYz1iOX" />
+ <listitem open="0" type="815" id="y60gutN2JyCQ" />
+ <listitem open="0" type="815" id="0sL0ojaScSgS" />
+ <listitem open="0" type="815" id="pnLPFzpTppY8" />
+ <listitem open="0" type="815" id="hChUzDaswxtr" />
+ <listitem open="0" type="815" id="sbamXTblQQWS" />
+ <listitem open="0" type="815" id="m5SYjTGZ4rMb" />
+ <listitem open="0" type="815" id="lTrjgzaT40zm" />
+ <listitem open="0" type="815" id="G8oA9JesnUbT" />
+ <listitem open="0" type="815" id="HBWsZYqoecwo" />
+ <listitem open="0" type="815" id="yE85nGH2Qnuz" />
+ <listitem open="0" type="815" id="a9myCiVAudGg" />
+ <listitem open="0" type="815" id="gGrwanFBuz76" />
+ <listitem open="0" type="815" id="iaHcEVG42zII" />
+ <listitem open="0" type="815" id="0KMsIRzy2EYE" />
+ <listitem open="0" type="815" id="jpGjoYzK3q8Y" />
+ <listitem open="0" type="815" id="l7mpxsL7M0u4" />
+ <listitem open="0" type="815" id="mskrAICuoXdX" />
+ <listitem open="0" type="815" id="k1SNpgCZzaNa" />
+ <listitem open="0" type="815" id="4BuOJTKhEo6V" />
+ <listitem open="0" type="815" id="ADkV7ZCp3CBi" />
+ <listitem open="0" type="815" id="nQj9T8nxc6e2" />
+ <listitem open="0" type="815" id="zbFi79sfdIB2" />
+ <listitem open="0" type="815" id="NdFZJkiRSf4s" />
+ </listitem>
+ <listitem open="0" type="813" id="hCCozGYEQBhw" />
+ <listitem open="0" type="813" id="2OUKpDmUU6Tg" />
+ <listitem open="0" type="813" id="PDzFlxMB73D7" />
+ <listitem open="0" type="813" id="CxVwuGjKYPlO" />
+ <listitem open="0" type="813" id="lmHNZqFB8Nj8" />
+ <listitem open="0" type="813" id="kooC0I8IkF1k" >
+ <listitem open="0" type="814" id="MSPW0bORYUMs" />
+ <listitem open="0" type="814" id="4bRqVlwcVPoa" />
+ <listitem open="0" type="814" id="j4ZX3m01ehFH" />
+ <listitem open="0" type="814" id="Zngo7fg9F50k" />
+ <listitem open="0" type="814" id="qwKJJ8t2CTZE" />
+ <listitem open="0" type="814" id="SEUhKSP8PjSi" />
+ <listitem open="0" type="814" id="pLlzmIBzqOr3" />
+ <listitem open="0" type="814" id="pzp2mQLEcovw" />
+ <listitem open="0" type="814" id="GI5f1VMoo7nb" />
+ <listitem open="0" type="814" id="NzaCLPFAN3B9" />
+ <listitem open="0" type="814" id="RWN3IGyZW1CV" />
+ <listitem open="0" type="814" id="WYJKf6t13UDP" />
+ <listitem open="0" type="814" id="rQXERiNsDiuV" />
+ <listitem open="0" type="814" id="wq4SrHxLpGfT" />
+ <listitem open="0" type="814" id="JxYpsEM9xWub" />
+ <listitem open="0" type="814" id="JXPFIAgz5MJu" />
+ <listitem open="0" type="814" id="AXAYvicEdA1T" />
+ <listitem open="0" type="814" id="HMoWMarc8Qsx" />
+ <listitem open="0" type="814" id="fIZddmejZuth" />
+ <listitem open="0" type="815" id="kjwpsBsKYDVA" />
+ <listitem open="0" type="815" id="uCoTe8JPrGEk" />
+ <listitem open="0" type="815" id="R72zIX7svlbt" />
+ <listitem open="0" type="815" id="jYE8r2VkFHBr" />
+ <listitem open="0" type="815" id="VBgQwIJgoVmd" />
+ <listitem open="0" type="815" id="K3ts3zgWBNu5" />
+ <listitem open="0" type="815" id="yc5zTBjlFcbI" />
+ <listitem open="0" type="815" id="DkbSKCiuSUc5" />
+ <listitem open="0" type="815" id="AQJ4wwczcOih" />
+ <listitem open="0" type="815" id="BdjXdjNqRyHm" />
+ <listitem open="0" type="815" id="8xeZSGecfweb" />
+ <listitem open="0" type="815" id="sFYUdEAortKU" />
+ <listitem open="0" type="815" id="ahJ0dYmjVOIx" />
+ <listitem open="0" type="815" id="bMrSDBvmqCmR" />
+ <listitem open="0" type="815" id="NFHOWKrVnBiw" />
+ <listitem open="0" type="815" id="LJul1NAOaPk4" />
+ <listitem open="0" type="815" id="3UdcrOgZ0E2l" />
+ <listitem open="0" type="815" id="URuAoQzkExjU" />
+ <listitem open="0" type="815" id="UTGShGDCg6KU" />
+ <listitem open="0" type="815" id="cspTzc7T5Lum" />
+ <listitem open="0" type="815" id="rXxHkNsMDhnC" />
+ <listitem open="0" type="815" id="KqWrmuedPauA" />
+ <listitem open="0" type="815" id="VDI8EOxZFSO1" />
+ <listitem open="0" type="815" id="gzVrwZIPkYVz" />
+ <listitem open="0" type="815" id="Om2g8eSodxdX" />
+ <listitem open="0" type="815" id="cktXZl2vV2bd" />
+ <listitem open="0" type="815" id="8vjzeIhE0YlZ" />
+ <listitem open="0" type="815" id="pZWhID3Q7mQj" />
+ <listitem open="0" type="815" id="88jEvVHk2oPK" />
+ <listitem open="0" type="815" id="UomwtUB1cuDX" />
+ <listitem open="0" type="815" id="cCSpxfdPTOMK" />
+ <listitem open="0" type="815" id="qrbuJy9t9Zg6" />
+ <listitem open="0" type="815" id="EKUigo2WJMyg" />
+ <listitem open="0" type="815" id="twPt8WCyMlqf" />
+ <listitem open="0" type="815" id="ixYrXFvjXPRD" />
+ <listitem open="0" type="815" id="3iePRU49Sa0x" />
+ <listitem open="0" type="815" id="I7gihefVYKpq" />
+ <listitem open="0" type="815" id="ONJubGCVL5xw" />
+ <listitem open="0" type="815" id="MesuwiiK31Ec" />
+ <listitem open="0" type="815" id="sWzhalxf12xL" />
+ <listitem open="0" type="815" id="jeFkgC6BZQbo" />
+ <listitem open="0" type="815" id="C0EBnuxLhyas" />
+ <listitem open="0" type="815" id="RbuTZc1JEE3v" />
+ <listitem open="0" type="815" id="qokWkKOCwIdV" />
+ <listitem open="0" type="815" id="kw7NswohkYDV" />
+ <listitem open="0" type="815" id="6pgrMtKDSxyI" />
+ <listitem open="0" type="815" id="FE29Dtu2kvhf" />
+ <listitem open="0" type="815" id="6mJFxKE19tqT" />
+ <listitem open="0" type="815" id="mAgD5cVJrVS2" />
+ <listitem open="0" type="815" id="KiTSbJvOSaZX" />
+ <listitem open="0" type="815" id="C4q1ZG4vY7zl" />
+ <listitem open="0" type="815" id="rg2LhYn1HGTq" />
+ <listitem open="0" type="815" id="RHZgV1W1Oj0L" />
+ <listitem open="0" type="815" id="UTSKnbgJmwP4" />
+ <listitem open="0" type="815" id="CjQYSQrxsJFd" />
+ <listitem open="0" type="815" id="miLUqmIF4Mp6" />
+ <listitem open="0" type="815" id="m041la1QGicY" />
+ <listitem open="0" type="815" id="WOLI6fzsId4V" />
+ <listitem open="0" type="815" id="ubxT7hdob1It" />
+ <listitem open="0" type="815" id="ZCvoicom5P8Q" />
+ <listitem open="0" type="815" id="PCJLv0HglTc0" />
+ <listitem open="0" type="815" id="41vxmbYlMoBI" />
+ <listitem open="0" type="815" id="YH3eH1QfEhy7" />
+ <listitem open="0" type="815" id="iFnTjOTnPNiB" />
+ <listitem open="0" type="815" id="yHuK34acLdGa" />
+ <listitem open="0" type="815" id="dgFpMDw4ThVA" />
+ </listitem>
+ <listitem open="0" type="813" id="Kd2vdgexbsmt" >
+ <listitem open="0" type="814" id="AG2SxqbqTRBU" />
+ <listitem open="0" type="814" id="UZ6on8MB4gMB" />
+ <listitem open="0" type="814" id="mx3Mg8qoMtGJ" />
+ <listitem open="0" type="814" id="hr98IJcksgZd" />
+ <listitem open="0" type="814" id="pvmrc72M25ji" />
+ <listitem open="0" type="814" id="BZUXQio6ZwEp" />
+ <listitem open="0" type="814" id="Fra5X9gK2TBe" />
+ <listitem open="0" type="814" id="YEzaHiGRFiwg" />
+ <listitem open="0" type="814" id="QlkxfymspMxL" />
+ <listitem open="0" type="814" id="TdfU4p6a158I" />
+ <listitem open="0" type="814" id="nMh14efSNPP0" />
+ <listitem open="0" type="814" id="NCsBWpWyQ9ST" />
+ <listitem open="0" type="814" id="wY1xeAEPUvOX" />
+ <listitem open="0" type="814" id="X3zsSNsoZkz3" />
+ <listitem open="0" type="814" id="ZT1yaRPX0QUc" />
+ <listitem open="0" type="814" id="Ygz3cOa7RX0s" />
+ <listitem open="0" type="814" id="useRdbTA2S6c" />
+ <listitem open="0" type="814" id="uV7suaSSGRVq" />
+ <listitem open="0" type="814" id="p3yFZy5RohrR" />
+ <listitem open="0" type="814" id="IKaKkgueA0U4" />
+ <listitem open="0" type="814" id="awWoM0fB1dOY" />
+ <listitem open="0" type="814" id="ZR0N8pnQ7Nir" />
+ <listitem open="0" type="814" id="1dWBdyFBtkzF" />
+ <listitem open="0" type="814" id="ieOhFnGoCECL" />
+ <listitem open="0" type="814" id="3zjAKS1L3VXe" />
+ <listitem open="0" type="814" id="SkpLSmaARyse" />
+ <listitem open="0" type="814" id="KjgU387lTfM4" />
+ <listitem open="0" type="814" id="SXVBdch4R92A" />
+ <listitem open="0" type="814" id="ahSdaFNuw4Mz" />
+ <listitem open="0" type="815" id="j6TwKdFLayVu" />
+ <listitem open="0" type="815" id="dL42Hug1y7vI" />
+ <listitem open="0" type="815" id="kAbK66CTYSsW" />
+ <listitem open="0" type="815" id="AuwdkfXL0ZNG" />
+ <listitem open="0" type="815" id="R2HP9AhuKGCO" />
+ <listitem open="0" type="815" id="MPrspkPzeJbM" />
+ <listitem open="0" type="815" id="z8ixf5D67SVF" />
+ <listitem open="0" type="815" id="cA9uQJJkiAcV" />
+ <listitem open="0" type="815" id="szVWJ4rGCZBp" />
+ <listitem open="0" type="815" id="cNvkpQxQY4Ky" />
+ <listitem open="0" type="815" id="Nbg4kIZcI27Z" />
+ <listitem open="0" type="815" id="6ypGXy59LyrB" />
+ <listitem open="0" type="815" id="MoZusrqETWID" />
+ <listitem open="0" type="815" id="npn3sucwsPDN" />
+ <listitem open="0" type="815" id="NGVjFMsZ9PU1" />
+ <listitem open="0" type="815" id="GIFhpVsaLgdB" />
+ <listitem open="0" type="815" id="cULltnk86ynt" />
+ <listitem open="0" type="815" id="TgToM4zuH7Jr" />
+ <listitem open="0" type="815" id="N4mwJPgvt0el" />
+ <listitem open="0" type="815" id="FaXUhoJ5q6zA" />
+ <listitem open="0" type="815" id="Ve3Mei5R7wJS" />
+ <listitem open="0" type="815" id="nGCcKAmnopAS" />
+ <listitem open="0" type="815" id="VFrcA82jAJaP" />
+ <listitem open="0" type="815" id="6B5syFIUS84a" />
+ <listitem open="0" type="815" id="G7JQOsnYud9u" />
+ <listitem open="0" type="815" id="u3hMBmxRrEsF" />
+ <listitem open="0" type="815" id="4dlxGurcnYud" />
+ <listitem open="0" type="815" id="YNtPbjeeMNbb" />
+ <listitem open="0" type="815" id="ISB5y5gcc9Tn" />
+ <listitem open="0" type="815" id="huv1IWcawldu" />
+ <listitem open="0" type="815" id="pIURRxCqX5Us" />
+ <listitem open="0" type="815" id="qqnmbQhQg9p8" />
+ <listitem open="0" type="815" id="70we5QUW1EcY" />
+ <listitem open="0" type="815" id="cbsJlfPsfLUl" />
+ <listitem open="0" type="815" id="kyFjDrIUs4gC" />
+ <listitem open="0" type="815" id="tbVXvzGfvVM8" />
+ <listitem open="0" type="815" id="KeaAhEKnJgkc" />
+ <listitem open="0" type="815" id="wyqrRC0mpYuW" />
+ <listitem open="0" type="815" id="nFJ4v1hs7BhP" />
+ <listitem open="0" type="815" id="NuTCSOgDbxIW" />
+ <listitem open="0" type="815" id="zxN484U1E5BM" />
+ <listitem open="0" type="815" id="Bttmq9Hn6cqE" />
+ <listitem open="0" type="815" id="gIDuNMFjseMW" />
+ <listitem open="0" type="815" id="teBzG1BxJNpe" />
+ <listitem open="0" type="815" id="h2NXgh3fPatt" />
+ <listitem open="0" type="815" id="VWlmtZQabl8G" />
+ <listitem open="0" type="815" id="T9vqknh4YDy3" />
+ <listitem open="0" type="815" id="oOiN7qda0XRi" />
+ <listitem open="0" type="815" id="K8kqKgrRvI8e" />
+ <listitem open="0" type="815" id="1bqz6FhOMREe" />
+ <listitem open="0" type="815" id="8651ODePoSjf" />
+ <listitem open="0" type="815" id="dyIxOWbUagVy" />
+ <listitem open="0" type="815" id="t9Lga4LpDYAZ" />
+ <listitem open="0" type="815" id="FMxp3RmuY7a8" />
+ <listitem open="0" type="815" id="AtvLS4uEomnw" />
+ <listitem open="0" type="815" id="qigPoHVw8RHY" />
+ <listitem open="0" type="815" id="VAmHuXDpjund" />
+ <listitem open="0" type="815" id="pO7wpMUIUFZO" />
+ <listitem open="0" type="815" id="kkBTez6zEq5v" />
+ <listitem open="0" type="815" id="Wmk1zHPj1ZDg" />
+ <listitem open="0" type="815" id="YHdm8hgfe7bA" />
+ <listitem open="0" type="815" id="anCcMNGsetck" />
+ <listitem open="0" type="815" id="aINDNyNmctsS" />
+ <listitem open="0" type="815" id="AA7o1kXa0unO" />
+ <listitem open="0" type="815" id="rAAT20ufQjl8" />
+ <listitem open="0" type="815" id="yb1yToMKzUmz" />
+ <listitem open="0" type="815" id="UeevNN1EkP5r" />
+ <listitem open="0" type="815" id="hC99QDYMmaKF" />
+ <listitem open="0" type="815" id="OfYL9KIewwXJ" />
+ <listitem open="0" type="815" id="KYX2xbrcl0j9" />
+ <listitem open="0" type="815" id="mGwfH4GlRyrH" />
+ <listitem open="0" type="815" id="eeB3a1KcfRtF" />
+ <listitem open="0" type="815" id="70J7yst8fTa3" />
+ <listitem open="0" type="815" id="Cx1k7cEEcXJY" />
+ <listitem open="0" type="815" id="3eQakWDTr7mj" />
+ <listitem open="0" type="815" id="WRvK8CSUMkAa" />
+ <listitem open="0" type="815" id="mkESDsbuUd5h" />
+ <listitem open="0" type="815" id="VUHK1ajgE3p9" />
+ <listitem open="0" type="815" id="t0J373cnViQ8" />
+ </listitem>
+ <listitem open="0" type="813" id="uHdgUvjiSZG6" >
+ <listitem open="0" type="814" id="Yyh5FtRuHHXU" />
+ <listitem open="0" type="814" id="gMWpiyFzxNga" />
+ <listitem open="0" type="815" id="qlEY5IQdG7gV" />
+ <listitem open="0" type="815" id="83x5QdeEMsmS" />
+ <listitem open="0" type="815" id="AA3OFitDoHPB" />
+ <listitem open="0" type="815" id="v7fHzPj7ZlVo" />
+ <listitem open="0" type="815" id="TNzFePOoUYDm" />
+ <listitem open="0" type="815" id="0qsXZLJ0gGFK" />
+ <listitem open="0" type="815" id="fd68BKuhu4Er" />
+ <listitem open="0" type="815" id="OXC5oPNR3SZC" />
+ </listitem>
+ <listitem open="0" type="813" id="gjYrACSC9BuB" >
+ <listitem open="0" type="814" id="M2LZCyY6pGdk" />
+ <listitem open="0" type="814" id="CK2gDNwU6enG" />
+ <listitem open="0" type="814" id="131qHeYSxZ6A" />
+ <listitem open="0" type="814" id="aFQc6PzmnrBh" />
+ <listitem open="0" type="814" id="d4vdm39XH5iE" />
+ <listitem open="0" type="814" id="mBRb0wQvPAtZ" />
+ <listitem open="0" type="815" id="0X10zUZAnpwn" />
+ <listitem open="0" type="815" id="KsBy2uT9wopo" />
+ <listitem open="0" type="815" id="7TE2jX8Ma10K" />
+ <listitem open="0" type="815" id="uvcJ4TrBw5Bf" />
+ <listitem open="0" type="815" id="rFBZBjF5cpNg" />
+ <listitem open="0" type="815" id="tUvwobDdoOAz" />
+ <listitem open="0" type="815" id="9ZiQQhyHAtDw" />
+ <listitem open="0" type="815" id="TQaHmiFq6IUI" />
+ <listitem open="0" type="815" id="gqkGyQ57xlXN" />
+ <listitem open="0" type="815" id="JWCFIicjCFIX" />
+ <listitem open="0" type="815" id="4nMIrOGdf2TE" />
+ <listitem open="0" type="815" id="KcPOVqRmKc1a" />
+ <listitem open="0" type="815" id="KeHWrZ1vLLBC" />
+ <listitem open="0" type="815" id="pZ8899iTn0xc" />
+ <listitem open="0" type="815" id="6zKyySKmzQu9" />
+ <listitem open="0" type="815" id="ZcaLcWxATT2j" />
+ <listitem open="0" type="815" id="eFrcfjjEKJZu" />
+ <listitem open="0" type="815" id="pM5wa20DHppw" />
+ <listitem open="0" type="815" id="vlL3Rm7G8CDj" />
+ <listitem open="0" type="815" id="CEdN2RWxCr0d" />
+ <listitem open="0" type="815" id="2HoHnEKxQvKS" />
+ <listitem open="0" type="815" id="5U9Jo3YqLK66" />
+ <listitem open="0" type="815" id="8NAXODETgMlU" />
+ <listitem open="0" type="815" id="PJKidQn9op68" />
+ <listitem open="0" type="815" id="b7CFTxjrG3Xr" />
+ <listitem open="0" type="815" id="SIyE55KFZ6co" />
+ <listitem open="0" type="815" id="HjSVlyKBGJNM" />
+ </listitem>
+ <listitem open="0" type="813" id="vSu5lsg0a7WJ" >
+ <listitem open="0" type="815" id="LbXsqqCDrQXh" />
+ <listitem open="0" type="815" id="ULvVrrbCQ62E" />
+ <listitem open="0" type="815" id="wFSmfxTawuTH" />
+ <listitem open="0" type="815" id="83mpM46qOzJF" />
+ </listitem>
+ <listitem open="0" type="813" id="emjq7Xks8DWW" >
+ <listitem open="0" type="815" id="DNXsEDC2K4mJ" />
+ <listitem open="0" type="815" id="fmyMYtyjGWbT" />
+ <listitem open="0" type="815" id="jlV1nGKAzisQ" />
+ <listitem open="0" type="815" id="M52bZb4GNXHA" />
+ </listitem>
+ <listitem open="0" type="813" id="DhQX2rY6wPDZ" />
+ <listitem open="0" type="813" id="TJe4s63xXy2f" />
+ <listitem open="0" type="813" id="E4ek4y1U3HLE" />
+ <listitem open="0" type="813" id="tWAq6KHaeveU" />
+ <listitem open="0" type="813" id="YFYivL7lKsyo" />
+ <listitem open="0" type="813" id="6Qx7AaWcHvu9" />
+ <listitem open="0" type="813" id="YkJeSfDyIVQI" />
+ <listitem open="0" type="813" id="eKZEv9oVXM34" />
+ <listitem open="0" type="813" id="UgPIutO5ambc" />
+ <listitem open="0" type="813" id="axOd2PMcsqyz" />
+ <listitem open="0" type="813" id="2yOeu36ujWRN" />
+ <listitem open="1" type="813" id="O8DTzb5kluKg" />
+ <listitem open="0" type="813" id="9uUW4XZ5t7nP" />
+ <listitem open="0" type="813" id="0o4m5sr9WEj3" />
+ <listitem open="0" type="813" id="uUiFf2iFHkBJ" />
+ <listitem open="0" type="813" id="0lRF51Cex1tP" />
+ <listitem open="0" type="813" id="dBvvR3kpanaF" >
+ <listitem open="0" type="814" id="DNaf2fosEYp6" />
+ <listitem open="0" type="814" id="yCEYCVwasJEM" />
+ <listitem open="0" type="814" id="lK5p4wmHHMxI" />
+ <listitem open="0" type="814" id="zjADHzJD9XkJ" />
+ <listitem open="0" type="814" id="3gtty6EhQJUU" />
+ <listitem open="0" type="814" id="frhxJACauh8Z" />
+ <listitem open="0" type="814" id="SgvPQYIQNKxu" />
+ <listitem open="0" type="814" id="fV8suH9Y6rVO" />
+ <listitem open="0" type="814" id="1fyvN4SpkND9" />
+ <listitem open="0" type="814" id="tVZFpU9SzFLr" />
+ <listitem open="0" type="814" id="VSPZJuxIatDv" />
+ <listitem open="0" type="814" id="91lljHb4Hsc9" />
+ <listitem open="0" type="815" id="ydigyvpsOM5B" />
+ <listitem open="0" type="815" id="qCenSxfvP4Uh" />
+ <listitem open="0" type="815" id="7RFUTkBQABvR" />
+ <listitem open="0" type="815" id="LRUTaPuslbzF" />
+ <listitem open="0" type="815" id="EqjdLb7V6YYi" />
+ <listitem open="0" type="815" id="jwULXkPs9tJi" />
+ <listitem open="0" type="815" id="GDaznZC1Qvcj" />
+ <listitem open="0" type="815" id="XiEbElJyhlJC" />
+ <listitem open="0" type="815" id="Tg2dXLJoWrnJ" />
+ <listitem open="0" type="815" id="R0JpttWOZkzo" />
+ <listitem open="0" type="815" id="THk801KUiM5F" />
+ <listitem open="0" type="815" id="hO1EFpVenmRg" />
+ <listitem open="0" type="815" id="gx5Dg2z9HjII" />
+ <listitem open="0" type="815" id="jcmRxreeDgqQ" />
+ <listitem open="0" type="815" id="TK3G6UukSxy6" />
+ <listitem open="0" type="815" id="0vFHfVZO6Jn3" />
+ <listitem open="0" type="815" id="HhdhcZncU1s7" />
+ <listitem open="0" type="815" id="WPTahGdpgHBl" />
+ <listitem open="0" type="815" id="r8eVPpF8iXfO" />
+ <listitem open="0" type="815" id="Z2MF31ZaRTar" />
+ <listitem open="0" type="815" id="3lBSDmJRU4ln" />
+ <listitem open="0" type="815" id="MwxlldaMWUgw" />
+ <listitem open="0" type="815" id="8DSaFDNb7JNs" />
+ <listitem open="0" type="815" id="uvFRNvNPHFzh" />
+ <listitem open="0" type="815" id="KA88X19dCZES" />
+ <listitem open="0" type="815" id="mZ3tsOjnJwCf" />
+ <listitem open="0" type="815" id="rBk96wovRq0C" />
+ <listitem open="0" type="815" id="qjF3ZQkOi5PZ" />
+ <listitem open="0" type="815" id="cXMIalqDa0ys" />
+ <listitem open="0" type="815" id="be0L4GBQLu9E" />
+ <listitem open="0" type="815" id="410d0wVZaTue" />
+ <listitem open="0" type="815" id="k323xCFXJCYa" />
+ <listitem open="0" type="815" id="o1FOV73DA5G6" />
+ <listitem open="0" type="815" id="HTdZfC9Yjdda" />
+ <listitem open="0" type="815" id="wZg4fwAuPmT3" />
+ <listitem open="0" type="815" id="ybZfCADSfgM1" />
+ <listitem open="0" type="815" id="hv9ikhBeHsgu" />
+ <listitem open="0" type="815" id="uORX2lYkhfQP" />
+ <listitem open="0" type="815" id="NZ3cRhUCWIM7" />
+ <listitem open="0" type="815" id="VDtCtJbErcoI" />
+ <listitem open="0" type="815" id="JISqYov5LWOa" />
+ <listitem open="0" type="815" id="JjiQSPbxaV7T" />
+ <listitem open="0" type="815" id="mihdIVuanMQK" />
+ <listitem open="0" type="815" id="cSKBEqveaO2g" />
+ <listitem open="0" type="815" id="klmZIFWoPiEg" />
+ </listitem>
+ <listitem open="0" type="813" id="ElUvZ3tKAVPh" >
+ <listitem open="0" type="814" id="pVfTLcQeTxif" />
+ <listitem open="0" type="814" id="qRmZG8r3bVXu" />
+ <listitem open="0" type="814" id="7vWZtDEjIDoA" />
+ <listitem open="0" type="814" id="ogt6tgErZqSi" />
+ <listitem open="0" type="814" id="vCeSg7DHR3TF" />
+ <listitem open="0" type="815" id="PXAg6cosGfw7" />
+ <listitem open="0" type="815" id="JBzt1RZxbDNH" />
+ <listitem open="0" type="815" id="QqY13tHMTn64" />
+ <listitem open="0" type="815" id="l33GAhrr6JmA" />
+ <listitem open="0" type="815" id="LVxmG1r14uHE" />
+ <listitem open="0" type="815" id="Z73dQnn8aHSO" />
+ <listitem open="0" type="815" id="HWTpntDqDoR0" />
+ <listitem open="0" type="815" id="siJmA25RZYHK" />
+ <listitem open="0" type="815" id="cH4EIJO9zft9" />
+ <listitem open="0" type="815" id="vvnvaf4IdbV8" />
+ <listitem open="0" type="815" id="JPOuuyFW6wYo" />
+ <listitem open="0" type="815" id="9CRGc0zjZwQl" />
+ <listitem open="0" type="815" id="PELx2ZHMwfGq" />
+ <listitem open="0" type="815" id="skNRenB21Uz4" />
+ <listitem open="0" type="815" id="4EOytcnS577T" />
+ <listitem open="0" type="815" id="0Yy1RjgJT1j5" />
+ <listitem open="0" type="815" id="q8dtFjMDHKEi" />
+ <listitem open="0" type="815" id="3t0UujajbhVv" />
+ <listitem open="0" type="815" id="mLI6XdFNlsG0" />
+ <listitem open="0" type="815" id="eibPZrP8QbxK" />
+ <listitem open="0" type="815" id="FXVyyOFEdfuU" />
+ <listitem open="0" type="815" id="HtaR5IRIowGm" />
+ <listitem open="0" type="815" id="HmoZj7300eR5" />
+ <listitem open="0" type="815" id="uqOineU68U0I" />
+ <listitem open="0" type="815" id="NPSAAS2PFpzy" />
+ <listitem open="0" type="815" id="zHkGrUnn4Onb" />
+ </listitem>
+ <listitem open="0" type="813" id="FGkVafnZOxkd" />
+ <listitem open="0" type="813" id="A2J7LcYakjsI" />
+ <listitem open="0" type="813" id="uNcSkNqyAxHb" />
+ <listitem open="0" type="813" id="4xqo1eJwmBM3" >
+ <listitem open="0" type="814" id="zRkSwGNALXUk" />
+ <listitem open="0" type="814" id="7ZaQNgZJ8zsD" />
+ <listitem open="0" type="814" id="fHVjp6noe6bA" />
+ <listitem open="0" type="814" id="lyCfKZjGyLKp" />
+ <listitem open="0" type="815" id="vDy8rHM8FLMJ" />
+ <listitem open="0" type="815" id="sNo5i8Pxn6R7" />
+ <listitem open="0" type="815" id="RUGdflJGlQBk" />
+ <listitem open="0" type="815" id="UmjHrAMIcdtF" />
+ <listitem open="0" type="815" id="ODW7bhsfVXYu" />
+ <listitem open="0" type="815" id="G5CKQa6sKq79" />
+ <listitem open="0" type="815" id="yUSZ5LoTWKb7" />
+ <listitem open="0" type="815" id="LhgpzFvzefRZ" />
+ <listitem open="0" type="815" id="umjFKCxPlYn8" />
+ <listitem open="0" type="815" id="CNRKKIXdzBTw" />
+ <listitem open="0" type="815" id="kNlTyXsQ4Zd6" />
+ <listitem open="0" type="815" id="zYKpWQFd8x41" />
+ <listitem open="0" type="815" id="1fMphZ3m8uJa" />
+ <listitem open="0" type="815" id="bb88X3GmDev9" />
+ </listitem>
+ <listitem open="0" type="813" id="Afzv7B0Suvrw" />
+ <listitem open="0" type="813" id="G1jpotlnS9ne" >
+ <listitem open="0" type="814" id="QZy3tkEiVyrj" />
+ <listitem open="0" type="814" id="9z5XItpgSU9I" />
+ <listitem open="0" type="814" id="kg9gnapBAlF1" />
+ <listitem open="0" type="814" id="gvR6OYO8EVm2" />
+ <listitem open="0" type="814" id="6bDEKSFntwmJ" />
+ <listitem open="0" type="814" id="URqzCwkqqBwC" />
+ <listitem open="0" type="814" id="bJkVFWmhwce8" />
+ <listitem open="0" type="814" id="WBTxq6Gb2zWH" />
+ <listitem open="0" type="814" id="MZpzb47soYu0" />
+ <listitem open="0" type="815" id="WOyKZsWGAoBu" />
+ <listitem open="0" type="815" id="hAxdkbjHzfbW" />
+ <listitem open="0" type="815" id="X8kguwan5LGN" />
+ <listitem open="0" type="815" id="7OAAjQXo9lz3" />
+ <listitem open="0" type="815" id="D69Lp6MCVzMJ" />
+ <listitem open="0" type="815" id="n06YPmsCvKSH" />
+ <listitem open="0" type="815" id="PrEK9hahkEtd" />
+ <listitem open="0" type="815" id="UPfn20wlhH0M" />
+ <listitem open="0" type="815" id="TPRDdKo7jTvj" />
+ <listitem open="0" type="815" id="8PfqrYZIO4RV" />
+ <listitem open="0" type="815" id="uCUp03L9S0zH" />
+ <listitem open="0" type="815" id="wML8jBCbMeOM" />
+ <listitem open="0" type="815" id="hjV8iSPH1zCc" />
+ <listitem open="0" type="815" id="zajvUM1OiNWR" />
+ <listitem open="0" type="815" id="Wh1sJPDz9i7r" />
+ <listitem open="0" type="815" id="BU6ASGkRqRKI" />
+ <listitem open="0" type="815" id="cyXQNsgBCLft" />
+ <listitem open="0" type="815" id="VY2LT6TnLaEH" />
+ <listitem open="0" type="815" id="oWNVsabSY9sw" />
+ <listitem open="0" type="815" id="zY5Bsi2NG4gh" />
+ <listitem open="0" type="815" id="dbUBkK5jrAsj" />
+ <listitem open="0" type="815" id="su67xmo4uHWf" />
+ <listitem open="0" type="815" id="x9DoH6XAybFv" />
+ <listitem open="0" type="815" id="M3zGIUtGi3Mx" />
+ <listitem open="0" type="815" id="DWrz7uT51grJ" />
+ <listitem open="0" type="815" id="nihWGnXmwzjn" />
+ <listitem open="0" type="815" id="lYt1WmvcoWrL" />
+ <listitem open="0" type="815" id="J5fMAZjBuuSy" />
+ <listitem open="0" type="815" id="oRuH6AKNExiO" />
+ </listitem>
+ <listitem open="0" type="813" id="OvNqoCObl8CH" >
+ <listitem open="0" type="814" id="wv2nq1dXlwOr" />
+ <listitem open="0" type="814" id="JZxkV8It3gis" />
+ <listitem open="0" type="814" id="q4RZCeq8XqtN" />
+ <listitem open="0" type="814" id="rWtaRFRioORJ" />
+ <listitem open="0" type="814" id="bai6gzkJrv6v" />
+ <listitem open="0" type="814" id="3xtAgo722W76" />
+ <listitem open="0" type="815" id="VhAYNsOBwok8" />
+ <listitem open="0" type="815" id="QaEvR8JGeAp3" />
+ <listitem open="0" type="815" id="9cuqN4xFUJk3" />
+ <listitem open="0" type="815" id="UJ0ub7w5f7Rr" />
+ <listitem open="0" type="815" id="wSTbZuSTtwFq" />
+ <listitem open="0" type="815" id="3mTujgkCKgsH" />
+ <listitem open="0" type="815" id="ADDSt3kO7Kc6" />
+ <listitem open="0" type="815" id="OYfTsHZqw9TB" />
+ <listitem open="0" type="815" id="3jUGUiy3Ig9w" />
+ <listitem open="0" type="815" id="Z6vG07cqOFLm" />
+ <listitem open="0" type="815" id="7VcDt5NQBGg9" />
+ <listitem open="0" type="815" id="NHzjWJUIlUrm" />
+ <listitem open="0" type="815" id="kyjvEN4ae2H8" />
+ </listitem>
+ <listitem open="0" type="813" id="0vcc95kxWWVn" />
+ <listitem open="0" type="813" id="bBWfkvMSUBzc" >
+ <listitem open="0" type="814" id="HtfMPGWnHlFz" />
+ <listitem open="0" type="814" id="nwSF6dZuRDQn" />
+ <listitem open="0" type="814" id="NvFxdPxsIcEf" />
+ <listitem open="0" type="814" id="qiT8Tg7FdZSj" />
+ <listitem open="0" type="814" id="vfgxkuIaTgbH" />
+ <listitem open="0" type="814" id="OoUldHki4oSH" />
+ <listitem open="0" type="815" id="B1eaE4OZxbUY" />
+ <listitem open="0" type="815" id="642hbURmV3Ni" />
+ <listitem open="0" type="815" id="5jF2KkZLB0dB" />
+ <listitem open="0" type="815" id="ba2x0yl42lme" />
+ <listitem open="0" type="815" id="i6Mjs6N6FjnR" />
+ <listitem open="0" type="815" id="bqWoZIF4Tx0H" />
+ <listitem open="0" type="815" id="yBOWhtxIjR7J" />
+ <listitem open="0" type="815" id="jKLCIJRD0tyX" />
+ <listitem open="0" type="815" id="OFm6erNMCiWU" />
+ <listitem open="0" type="815" id="kVdX0x3MAqSp" />
+ <listitem open="0" type="815" id="bvLa2iQlD1IB" />
+ <listitem open="0" type="815" id="n0jQzBvY7H67" />
+ <listitem open="0" type="815" id="zWsAYBJVVqcd" />
+ <listitem open="0" type="815" id="gldn0ktxEl5k" />
+ <listitem open="0" type="815" id="3BuFu0ypMBCZ" />
+ <listitem open="0" type="815" id="zBZIc4IANfpB" />
+ <listitem open="0" type="815" id="qWgmpwjq5c4z" />
+ <listitem open="0" type="815" id="a2mwBxU983Rk" />
+ <listitem open="0" type="815" id="5hsTKfcACGxz" />
+ <listitem open="0" type="815" id="AeoFEsDouzj3" />
+ <listitem open="0" type="815" id="6CP0C634JE7V" />
+ <listitem open="0" type="815" id="MAwjmvEfZsaJ" />
+ <listitem open="0" type="815" id="LVYuN9B8z5JW" />
+ <listitem open="0" type="815" id="1XR0bkU9WtxF" />
+ <listitem open="0" type="815" id="prxjViUQjhSS" />
+ <listitem open="0" type="815" id="ym0h8ycxnZgI" />
+ <listitem open="0" type="815" id="F8izq8PLR5MW" />
+ <listitem open="0" type="815" id="dPfz7KV2Nze1" />
+ </listitem>
+ <listitem open="0" type="813" id="kNRjwgcIhcX0" >
+ <listitem open="0" type="814" id="oumiUxElXTPK" />
+ <listitem open="0" type="814" id="fGGAifVQGjcS" />
+ <listitem open="0" type="814" id="mQLltAsASv30" />
+ <listitem open="0" type="814" id="5xgKFy2bIrWG" />
+ <listitem open="0" type="815" id="4zK7hMcKdqVL" />
+ <listitem open="0" type="815" id="h3l7wm70lP5Q" />
+ <listitem open="0" type="815" id="mfjNVCizARin" />
+ <listitem open="0" type="815" id="ltCTNP54QqCM" />
+ <listitem open="0" type="815" id="dHKMfPlR2SoX" />
+ <listitem open="0" type="815" id="eUVmtBXf2j6P" />
+ <listitem open="0" type="815" id="6BSW0cqbrAxW" />
+ <listitem open="0" type="815" id="XgxZ8j5kDYW5" />
+ <listitem open="0" type="815" id="h3ijno6r0YO0" />
+ <listitem open="0" type="815" id="uVCs2Ys8lR88" />
+ <listitem open="0" type="815" id="wb071QOAvQTw" />
+ <listitem open="0" type="815" id="xrcVx1qqV0iX" />
+ <listitem open="0" type="815" id="H2dm1JHasusr" />
+ <listitem open="0" type="815" id="gIl1gnNV9uEv" />
+ <listitem open="0" type="815" id="RrpOsLQDNVtL" />
+ <listitem open="0" type="815" id="82E8dP9eMOkB" />
+ <listitem open="0" type="815" id="dv4eGrk78MU4" />
+ </listitem>
+ <listitem open="0" type="813" id="idECE5nt0Vr7" />
+ <listitem open="0" type="813" id="0xotfbj8uz9G" />
+ <listitem open="0" type="813" id="MuLM2exc7eeX" />
+ <listitem open="0" type="813" id="Ab0NMXybAfZU" />
+ <listitem open="0" type="813" id="3DGvGCGP6it9" />
+ <listitem open="0" type="813" id="K1iCj3mMQwQL" />
+ <listitem open="0" type="813" id="D3DUDdA4BXcR" >
+ <listitem open="0" type="815" id="jSV1dsLPmSGq" />
+ </listitem>
+ <listitem open="1" type="813" id="EXCTf5VmCpZP" />
+ <listitem open="0" type="813" id="fuM43CRtzagH" />
+ <listitem open="0" type="813" id="CFHqNaZGkqY1" />
+ <listitem open="1" type="813" id="C6sJEmNl1TfP" />
+ <listitem open="0" type="813" id="vhhynCUKwjdK" >
+ <listitem open="0" type="815" id="0BooQ7oB3gBu" />
+ </listitem>
+ <listitem open="0" type="813" id="4DbehFMvfWp7" >
+ <listitem open="0" type="815" id="tAHWfrR369KI" />
+ </listitem>
+ <listitem open="1" type="813" id="4mmdfk3zM4Cq" />
+ <listitem open="0" type="813" id="TTjyPYhZVm6n" />
+ <listitem open="0" type="813" id="pkwx1nQd15WY" />
+ <listitem open="0" type="813" id="oJLfSqWPBi3z" />
+ <listitem open="0" type="813" id="XlAIxWJ0t2q4" />
+ <listitem open="0" type="813" id="sWYhCThWlDFP" />
+ <listitem open="0" type="813" id="4F2mG2WvecbT" />
+ <listitem open="0" type="813" id="8RfL5UmYopms" />
+ <listitem open="0" type="813" id="Ny9n9LLzEhXo" />
+ <listitem open="0" type="813" id="qzlFUs4gsJKl" />
+ <listitem open="0" type="813" id="yfv0x3wqUorr" />
+ <listitem open="0" type="813" id="SU7oJl8r1vpC" />
+ <listitem open="0" type="818" id="dIDTyvYIWngb" >
+ <listitem open="0" type="813" id="bfhvSo8YsYdy" />
+ </listitem>
+ <listitem open="0" type="818" id="MCSt8TslaFsB" >
+ <listitem open="0" type="813" id="4LgRjEB5I6jc" />
+ <listitem open="0" type="813" id="F1TYNacxByRT" />
+ <listitem open="0" type="813" id="SAh1zCEmUab7" />
+ <listitem open="0" type="813" id="BBlq3c2ugtt6" />
+ <listitem open="0" type="813" id="Tf9yq5dCbZ1m" />
+ </listitem>
+ <listitem open="0" type="829" id="I2tMfCdvE4TZ" />
+ <listitem open="0" type="829" id="bJtzCEyKnKFK" />
+ <listitem open="0" type="829" id="JUKVeIsFclEo" />
+ <listitem open="1" type="829" id="812hl7Twm80d" />
+ <listitem open="1" type="829" id="6PMoYeoBvXGW" />
+ <listitem open="1" type="829" id="PwWdyuRfg8qc" />
+ <listitem open="0" type="829" id="WO0VJglkKJD1" />
+ <listitem open="0" type="829" id="iYfdxrJ7viR4" />
+ <listitem open="0" type="829" id="WHPnnVHQeFGi" />
+ <listitem open="1" type="829" id="rNYhJGFqdJWf" />
+ <listitem open="0" type="829" id="eL818LAcaZPN" />
+ <listitem open="0" type="830" id="Datatypes" >
+ <listitem open="0" type="829" id="Dk5pczPnz6Yr" />
+ <listitem open="0" type="829" id="Egoy0uRTnPKa" />
+ <listitem open="0" type="829" id="CVhnimyi5KYN" />
+ <listitem open="0" type="829" id="nHLqdVHOsxNM" />
+ <listitem open="0" type="829" id="eqNqcEputAw7" />
+ <listitem open="0" type="829" id="HrAPc4wZ9mox" />
+ <listitem open="0" type="829" id="FM9MFyrLE5ts" />
+ <listitem open="0" type="829" id="AtFJ5jDgvMWr" />
+ <listitem open="0" type="829" id="taPZHCs4KBPK" />
+ <listitem open="0" type="829" id="JCIhsw1mHbC2" />
+ <listitem open="0" type="829" id="1PQGjZx0iexb" />
+ <listitem open="0" type="829" id="h0fjFQ6XJMWi" />
+ <listitem open="0" type="829" id="xqe85s2v3X76" />
+ <listitem open="0" type="829" id="qcb8l3xv8TRt" />
+ <listitem open="0" type="829" id="Dc4onmiEKP73" />
+ <listitem open="0" type="829" id="DEOmV9sHIiVw" />
+ <listitem open="0" type="829" id="T3wGzLaOdJRi" />
+ <listitem open="0" type="829" id="TXhtlZjMAp7C" />
+ <listitem open="0" type="829" id="r4r1RcqCQswh" />
+ <listitem open="0" type="829" id="E5x9L9RNrd6t" />
+ <listitem open="0" type="829" id="g55iEgjQlzYA" />
+ <listitem open="0" type="829" id="j0sNksMuhVaF" />
+ <listitem open="0" type="829" id="eFtlt57PInXt" />
+ <listitem open="0" type="829" id="U4mQnNTnRzFr" />
+ <listitem open="0" type="829" id="dxoHI48VOHpd" />
+ <listitem open="0" type="829" id="10N6r5hp62ve" />
+ <listitem open="0" type="829" id="u6I3QBCIKjNh" />
+ <listitem open="0" type="829" id="QR5iQfL4cAJs" />
+ <listitem open="0" type="829" id="w18nsvnfKlCn" />
+ <listitem open="0" type="829" id="iP4BuKaU6MFG" />
+ <listitem open="0" type="829" id="4XSkb7G7HX8a" />
+ <listitem open="0" type="829" id="XNEzxlV9pJ9M" />
+ <listitem open="0" type="829" id="ihg5BF2ckirV" />
+ <listitem open="0" type="829" id="j5EvHIixdpql" />
+ <listitem open="0" type="829" id="vFBbZkjwm4Vx" />
+ <listitem open="0" type="829" id="i2UaJmLAA6SB" />
+ <listitem open="0" type="829" id="3McdnqE6JCta" />
+ <listitem open="0" type="829" id="hHn4fFvgbLYX" />
+ <listitem open="0" type="829" id="s715so7RcDV9" />
+ <listitem open="0" type="829" id="xXbKcOH2nKjB" />
+ <listitem open="0" type="829" id="1p2XZLYDDR9J" />
+ <listitem open="0" type="829" id="lNFLPGC5GcjE" />
+ <listitem open="0" type="829" id="nBSGMFfRdnbK" />
+ <listitem open="0" type="829" id="INoSbjQmME1a" />
+ <listitem open="0" type="829" id="jIKxm4xqfB4z" />
+ <listitem open="0" type="829" id="cKqCpL4vHbUA" />
+ <listitem open="0" type="829" id="8HFYeCh1V2Tr" />
+ <listitem open="0" type="829" id="II4tXBwM3i4V" />
+ <listitem open="0" type="829" id="44n6UGK0XgsS" />
+ <listitem open="0" type="829" id="bQxm3RYu0b9f" />
+ <listitem open="1" type="829" id="4Kduenu6BUBZ" />
+ <listitem open="1" type="829" id="ctnUq2PsE48l" />
+ <listitem open="0" type="829" id="66nkQj7RUTGt" />
+ <listitem open="0" type="829" id="VewgxsCIjx8s" />
+ <listitem open="0" type="829" id="O0Y4e7L2YuKE" />
+ <listitem open="0" type="829" id="w1WmyaR6BJwY" />
+ <listitem open="0" type="829" id="GvaXRE3v0jhy" />
+ <listitem open="0" type="829" id="t8K2eKmlJWeX" />
+ <listitem open="0" type="829" id="MbP7gzMpbiS8" />
+ <listitem open="0" type="829" id="2A0kHciAJN94" />
+ <listitem open="0" type="829" id="0gZfFH6nfJoC" />
+ <listitem open="0" type="829" id="LmSODUAk50Mh" />
+ <listitem open="0" type="829" id="8DcrWo7HU0iD" />
+ <listitem open="0" type="829" id="ZcxOLFwJIm1Z" />
+ <listitem open="0" type="829" id="pE9AJY0D36ZX" />
+ <listitem open="0" type="829" id="vl7nx6lzHKbw" />
+ <listitem open="0" type="829" id="TrV97VV12IZA" />
+ <listitem open="0" type="829" id="qj7xSczKuwTq" />
+ <listitem open="0" type="829" id="Q7aANH0SNANP" />
+ <listitem open="0" type="829" id="58Cx3O5oNLy7" />
+ <listitem open="0" type="829" id="IdrZNJ0YPvUj" />
+ <listitem open="0" type="829" id="bHSmNf4TkzTc" />
+ <listitem open="0" type="829" id="gFFNUwPz4TDC" />
+ <listitem open="0" type="829" id="WqvJ0Bi64K7w" />
+ <listitem open="0" type="829" id="VwQtQ1TIoAvq" />
+ <listitem open="0" type="829" id="W4aE1i6TfajT" />
+ <listitem open="0" type="829" id="vTwaNogqWwk6" />
+ <listitem open="0" type="829" id="WKXaz2THzK1G" />
+ <listitem open="0" type="829" id="VcPcOcsgjQbo" />
+ <listitem open="0" type="829" id="bB3bDXILtLrz" />
+ <listitem open="0" type="829" id="cSRv6d9bhfgi" />
+ <listitem open="0" type="829" id="nNX5UmpiITKY" />
+ <listitem open="0" type="829" id="Fls26ZE3bRdo" />
+ <listitem open="0" type="829" id="G9Fc21bZFJYw" />
+ <listitem open="0" type="829" id="Ks2QuFd1iYTQ" />
+ <listitem open="0" type="829" id="FVFtK4cB028u" />
+ <listitem open="0" type="829" id="8JusFMjAgM0v" />
+ <listitem open="0" type="829" id="pwe3pKqZPxkb" />
+ <listitem open="0" type="829" id="ee5ipO9TkcLk" />
+ <listitem open="0" type="829" id="0cEqYhKKEcTV" />
+ <listitem open="0" type="829" id="iJSN8ewspTX1" />
+ <listitem open="0" type="829" id="O12pIiPVGutd" />
+ <listitem open="0" type="829" id="UxIGEVkWi0NJ" />
+ <listitem open="0" type="829" id="QYpsIm6ImSYT" />
+ <listitem open="0" type="829" id="U3HSI0riWfYo" />
+ <listitem open="0" type="829" id="s0nXwm2aK1kb" />
+ <listitem open="0" type="829" id="nLEyCkrlHPQw" />
+ <listitem open="0" type="829" id="eOTt0WSUZhur" />
+ <listitem open="0" type="829" id="ASmFlCHQXF31" />
+ <listitem open="0" type="829" id="02OHgpv6iwv9" />
+ <listitem open="0" type="829" id="xSzXJBSHo8yn" />
+ <listitem open="0" type="829" id="KLj6UftWOUuW" />
+ <listitem open="0" type="829" id="KaWkbzz0V7eb" />
+ <listitem open="0" type="829" id="pX24l2l5CrBj" />
+ <listitem open="0" type="829" id="7YtOMToL1Xs9" />
+ <listitem open="0" type="829" id="erAlIci9mSIq" />
+ <listitem open="0" type="829" id="dsRw8nRMsxE8" />
+ <listitem open="0" type="829" id="lvIXi2Pxh0fK" />
+ <listitem open="0" type="829" id="EknMLJBAPpgo" />
+ <listitem open="0" type="829" id="GgjUKN39BDXg" />
+ <listitem open="0" type="829" id="7jGBwdRbnPDW" />
+ <listitem open="0" type="829" id="nMhUhBvBqw4A" />
+ <listitem open="0" type="829" id="VBixqziBqrhe" />
+ <listitem open="0" type="829" id="MvpHChZ2rJOW" />
+ <listitem open="0" type="829" id="ZZfK0mQuNQ1O" />
+ <listitem open="0" type="829" id="8Eb0NWUsBQSJ" />
+ <listitem open="0" type="829" id="3lgc1KcaMAny" />
+ <listitem open="0" type="829" id="vteoFJru7xrN" />
+ <listitem open="0" type="829" id="eptOVybOJnpM" />
+ <listitem open="0" type="829" id="xdn6dFqV85mT" />
+ <listitem open="0" type="829" id="PFhzx975rDDm" />
+ <listitem open="0" type="829" id="pJsfgcYj7OSg" />
+ <listitem open="0" type="829" id="EQrcJtA2vC7c" />
+ <listitem open="0" type="829" id="wZnZ9lZYcork" />
+ <listitem open="0" type="829" id="9U1uI8HJT0Jf" />
+ <listitem open="0" type="829" id="trv86yL4jfeS" />
+ <listitem open="0" type="829" id="vQ1S2XzSPBqN" />
+ <listitem open="0" type="829" id="Hfgxfxm85LAR" />
+ <listitem open="0" type="829" id="QXEg7cwSFt0l" />
+ <listitem open="0" type="829" id="ylvhNGRUzc7S" />
+ <listitem open="0" type="829" id="t2asNnHh8wsl" />
+ <listitem open="0" type="829" id="S02STVfDWPXk" />
+ <listitem open="0" type="829" id="Z3mduvueNb9d" />
+ <listitem open="0" type="829" id="O74yXfkidyrR" />
+ <listitem open="0" type="829" id="qtOabrV06r8H" />
+ <listitem open="0" type="829" id="qZLXuibBNXID" />
+ <listitem open="0" type="829" id="rHbXHZa03W4n" />
+ <listitem open="1" type="829" id="vfi9josl6Tfk" />
+ <listitem open="1" type="829" id="nJsED87p1vHp" />
+ <listitem open="1" type="829" id="UOc7OI8LRuFv" />
+ <listitem open="1" type="829" id="w7Hw0ZjtEP2v" />
+ <listitem open="1" type="829" id="HXoQ2zynGq1U" />
+ <listitem open="0" type="829" id="Kevzvq2lEsL7" />
+ <listitem open="0" type="829" id="yHm6ssfdnOOK" />
+ <listitem open="0" type="829" id="C9cGTLSO5pln" />
+ <listitem open="0" type="829" id="ViIuaCbFO4Rh" />
+ <listitem open="0" type="829" id="drESmKOpFHzv" />
+ <listitem open="0" type="829" id="SuGBQogD9iYR" />
+ <listitem open="0" type="829" id="HYl1HlhGNnFB" />
+ <listitem open="0" type="829" id="rRJOS4Ahavgr" />
+ <listitem open="1" type="829" id="QBMG0J8pDlsx" />
+ <listitem open="0" type="829" id="fL9t737j70re" />
+ <listitem open="0" type="829" id="FYDrFS8mDoaL" />
+ <listitem open="0" type="829" id="ObMobD4JO6Fx" />
+ <listitem open="0" type="829" id="2UqTU88CwGoW" />
+ <listitem open="0" type="829" id="LrX6DxQMEnp2" />
+ <listitem open="1" type="829" id="DshIKK2Zspzs" />
+ <listitem open="0" type="829" id="BlnbH3oVPPjZ" />
+ <listitem open="1" type="829" id="LIcXhcTtT8Bn" />
+ <listitem open="0" type="829" id="iB4yZDFSik45" />
+ <listitem open="1" type="829" id="ovf5keXejoaj" />
+ <listitem open="0" type="829" id="TYfZTukOB7DK" />
+ </listitem>
+ <listitem open="0" type="831" id="XmVg46uC4n8q" >
+ <listitem open="0" type="839" id="yqnkun1Klbqp" />
+ <listitem open="0" type="839" id="cgI6gA8Duerx" />
+ <listitem open="0" type="839" id="il9mWHdU5OFy" />
+ </listitem>
+ <listitem open="0" type="831" id="tn89GJwm2DQU" >
+ <listitem open="0" type="839" id="sdR87rQfnnIn" />
+ <listitem open="0" type="839" id="CcN2TL1K87UM" />
+ <listitem open="0" type="839" id="OQ9QdXtT9KbG" />
+ <listitem open="0" type="839" id="9zvwmBjyo60H" />
+ <listitem open="0" type="839" id="PzbW43sTTzt4" />
+ </listitem>
+ <listitem open="0" type="831" id="60clcAU0xnx5" >
+ <listitem open="0" type="839" id="qw0upkshD7Ws" />
+ <listitem open="0" type="839" id="08eZuDdvpOX0" />
+ <listitem open="0" type="839" id="qXvcVzRJvRDi" />
+ <listitem open="0" type="839" id="94PMBtCB1riw" />
+ </listitem>
+ <listitem open="0" type="831" id="BEIun6kQm0UQ" >
+ <listitem open="0" type="839" id="8cd3ES0xB9jh" />
+ <listitem open="0" type="839" id="OKASiNQsZgmN" />
+ <listitem open="0" type="839" id="mUlWTFxbpYe4" />
+ </listitem>
+ <listitem open="0" type="831" id="acFbRvXTEMIs" >
+ <listitem open="0" type="839" id="i8ParVwZ1aAz" />
+ <listitem open="0" type="839" id="RT4K9VOj5bLU" />
+ <listitem open="0" type="839" id="UqxgBEZrKwRB" />
+ <listitem open="0" type="839" id="PMiRwsQLJUdS" />
+ <listitem open="0" type="839" id="x1A1aTV4JTiS" />
+ <listitem open="0" type="839" id="hHK1DjAd5s2z" />
+ <listitem open="0" type="839" id="iSIzuvPruZsS" />
+ </listitem>
+ <listitem open="0" type="831" id="R7NTfdMjVLA2" >
+ <listitem open="0" type="839" id="aeXFWoccpQhV" />
+ <listitem open="0" type="839" id="IA247mFWrcyW" />
+ <listitem open="0" type="839" id="DKFidOkD2FRW" />
+ <listitem open="0" type="839" id="239pRqLjyLo3" />
+ <listitem open="0" type="839" id="71ZwdVSqogWR" />
+ <listitem open="0" type="839" id="2Hf2U6ZW7iMZ" />
+ <listitem open="0" type="839" id="WfIU04X6542i" />
+ <listitem open="0" type="839" id="aTWO73p9ISBm" />
+ </listitem>
+ <listitem open="0" type="831" id="6EgMC1YWquF9" >
+ <listitem open="0" type="839" id="Yb1b7UtyzhI6" />
+ <listitem open="0" type="839" id="h7pvvBbzNHKX" />
+ <listitem open="0" type="839" id="Is37kIGIsFrx" />
+ <listitem open="0" type="839" id="jlviQEm7JZ0D" />
+ <listitem open="0" type="839" id="kbC7rWe7MgE7" />
+ <listitem open="0" type="839" id="wSNohFlQ0h6O" />
+ <listitem open="0" type="839" id="tsUCSUNA4aGt" />
+ <listitem open="0" type="839" id="4s0RYFWVhtHP" />
+ <listitem open="0" type="839" id="63n4iuTZmxjC" />
+ </listitem>
+ <listitem open="0" type="831" id="bicD6yqnVUa7" >
+ <listitem open="0" type="839" id="rCA5pRoxT62m" />
+ <listitem open="0" type="839" id="iaNQJFitwI60" />
+ <listitem open="0" type="839" id="FvnkPMrHW0KJ" />
+ <listitem open="0" type="839" id="P7GtDHftr0J9" />
+ <listitem open="0" type="839" id="Ez28I68X1uFP" />
+ </listitem>
+ <listitem open="0" type="831" id="4ptGPmSL1mv9" >
+ <listitem open="0" type="839" id="Y0MT25hU2ytQ" />
+ <listitem open="0" type="839" id="CmcECHAH43VT" />
+ <listitem open="0" type="839" id="oxmpiiwGiIji" />
+ <listitem open="0" type="839" id="LPCLN6lZqLl2" />
+ <listitem open="0" type="839" id="ctHevk8jgsWO" />
+ <listitem open="0" type="839" id="YTeEjLx3i7O5" />
+ </listitem>
+ <listitem open="0" type="831" id="B8d1TM24GHiB" >
+ <listitem open="0" type="839" id="2qsihO6FpiUX" />
+ <listitem open="0" type="839" id="3RamYwpi4QjY" />
+ <listitem open="0" type="839" id="nja31IE374lo" />
+ <listitem open="0" type="839" id="Sp3GXXlawJKT" />
+ <listitem open="0" type="839" id="F8BKYuqLcQMd" />
+ <listitem open="0" type="839" id="iYgncPb3EfJl" />
+ </listitem>
+ <listitem open="0" type="831" id="obHtTJr9l96f" >
+ <listitem open="0" type="839" id="3VUv5LO7hsRU" />
+ <listitem open="0" type="839" id="5CyYIPE40VyR" />
+ <listitem open="0" type="839" id="mnaVwg8xBctE" />
+ <listitem open="0" type="839" id="vHMc9l6Dx2lE" />
+ <listitem open="0" type="839" id="RxIRQEsC1Qhw" />
+ </listitem>
+ <listitem open="0" type="831" id="zczAjgq81yYh" >
+ <listitem open="0" type="839" id="JyXscIDMmysF" />
+ <listitem open="0" type="839" id="BnrzKT1J60Rn" />
+ <listitem open="0" type="839" id="gFvfBRLUNsNz" />
+ <listitem open="0" type="839" id="AaLvXE8gzxfH" />
+ <listitem open="0" type="839" id="RgYVg0ILDC0P" />
+ </listitem>
+ <listitem open="0" type="831" id="yD8lVM51i3U1" >
+ <listitem open="0" type="839" id="jFk2Zv1qPLL1" />
+ <listitem open="0" type="839" id="dDHFxT1vgAg9" />
+ <listitem open="0" type="839" id="UjACmfDUsvWR" />
+ </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="C++" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/maximus/doc/fulminata_maximus_user_guide.odt b/cesar/maximus/doc/fulminata_maximus_user_guide.odt
new file mode 100755
index 0000000000..ca1786e581
--- /dev/null
+++ b/cesar/maximus/doc/fulminata_maximus_user_guide.odt
Binary files differ
diff --git a/cesar/maximus/doc/fulminata_maximus_user_guide.xmi b/cesar/maximus/doc/fulminata_maximus_user_guide.xmi
new file mode 100755
index 0000000000..cac8fe3e1b
--- /dev/null
+++ b/cesar/maximus/doc/fulminata_maximus_user_guide.xmi
@@ -0,0 +1,950 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-03-18T12:22:05" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.6</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="interface" isRoot="false" isAbstract="false" name="interface" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="constructor" isRoot="false" isAbstract="false" name="constructor" />
+ <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="struct" isRoot="false" isAbstract="false" name="struct" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="typedef" isRoot="false" isAbstract="false" name="typedef" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="friend" isRoot="false" isAbstract="false" name="friend" />
+ <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="4Y3pj29RWeiE" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="r7DWE0eHIdyU" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="jEmP36b8eexL" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="e4mAiTMYaY2m" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Wh4oK0G1C0OG" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="60MkeH6JLqR1" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="JmXtIagoHiaZ" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="gobqox6sxQcc" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="hgt0XK0q4XiM" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="7MAM2iuiWTYI" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="QdAO1lyjPrjw" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="fuB56JYI4iD9" isRoot="false" isAbstract="false" name="CoreEngine*" elementReference="3cZNPG4Cidhc" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="sdbAE2jFpDFi" isRoot="false" isAbstract="false" name="const char*" elementReference="r7DWE0eHIdyU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="dlNG20SXVnem" isRoot="false" isAbstract="false" name="Sta&amp;" elementReference="ep8pvWB0srsZ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="g6pCtTynyrSu" isRoot="false" isAbstract="false" name="const std::string&amp;" elementReference="QdAO1lyjPrjw" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xodDUGXAMLKD" isRoot="false" isAbstract="false" name="Msg&amp;" elementReference="QDgInxgZQCAU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="N5IkQdvEtuz1" isRoot="false" isAbstract="false" name="const tick_t" elementReference="DlAv42zir8Xn" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="fDwAiS87UREb" isRoot="false" isAbstract="false" name="SystemManager*" elementReference="iqALD0zLpMtS" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="iCrqJxTw8N6o" isRoot="false" isAbstract="false" name="FunctionCallManager*" elementReference="QLFCWED8oZX2" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="FmijvtGb37QM" isRoot="false" isAbstract="false" name="NetworkClockProcessor*" elementReference="dhiFOKw4B6PM" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="y48XzI6F2mwy" isRoot="false" isAbstract="false" name="PhyProcessor*" elementReference="5MiuiZM7uaJQ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="cMzADDNCFTjF" isRoot="false" isAbstract="false" name="SciServer*" elementReference="oVWa43dfiLu6" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="heG5Hkz2HbX4" isRoot="false" isAbstract="false" name="FunctionSciMsg*" elementReference="OSpq2dnTY35U" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Q0UsbF8ykFHb" isRoot="false" isAbstract="false" name="const unsigned long" elementReference="7MAM2iuiWTYI" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="x1PhEfJEggJw" isRoot="false" isAbstract="false" name="const unsigned char*" elementReference="b7QGcuF2sksT" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="p0IbDUZ3xnb6" isRoot="false" isAbstract="false" name="T const&amp;" elementReference="vmoDNQ6rF2Dm" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="DxG6tZBJQHh4" isRoot="false" isAbstract="false" name="const cb_t&amp;" elementReference="wnXcVmSSha0e" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="JnsSgq9sjXim" isRoot="false" isAbstract="false" name="unsigned long&amp;" elementReference="7MAM2iuiWTYI" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="pcXZS4JlpBBT" isRoot="false" isAbstract="false" name="unsigned char*" elementReference="b7QGcuF2sksT" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="VPg2hVetD85b" isRoot="false" isAbstract="false" name="T&amp;" elementReference="s5UhEg9EzVwp" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="2CPeV2SQpVK6" isRoot="false" isAbstract="false" name="Station*" elementReference="vRs8ZxhLHVQP" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8tZZKzS1K06t" isRoot="false" isAbstract="false" name="std::vector&lt; Msg * >" elementReference="hNV9xKhyiJ0h" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="bRgJkgzqXYQq" isRoot="false" isAbstract="false" name="std::vector&lt; Sta * >" elementReference="hNV9xKhyiJ0h" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="m2WuMpndsVSl" isRoot="false" isAbstract="false" name="char*" elementReference="r7DWE0eHIdyU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="7Px2h6lKHGvZ" isRoot="false" isAbstract="false" name="PhySciMsgMpdu*" elementReference="iNY7Y0bMhGEA" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="6ZCYZGid4Ay7" isRoot="false" isAbstract="false" name="EtherSciMsg*" elementReference="RYa1BtTCB0W9" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5AQH9uODRbl0" isRoot="false" isAbstract="false" name="EtherSciMsg&amp;" elementReference="RYa1BtTCB0W9" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="THhIOpi4zEEB" isRoot="false" isAbstract="false" name="const bool" elementReference="jEmP36b8eexL" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1nRAhhrW78Cm" isRoot="false" isAbstract="false" name="ISystem*" elementReference="RCBIr5aEF5nl" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="v6Ix8Dv7zKFg" isRoot="false" isAbstract="false" name="IFunctionCall*" elementReference="t3SV6Sb72ZAp" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="xnFXxdAshQqp" isRoot="false" isAbstract="false" name="INetworkClock*" elementReference="wfaWTHxdQDUU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="qASXaGKCzFk2" isRoot="false" isAbstract="false" name="IPhy*" elementReference="j4JNar0VcD2Z" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3OLgcMDSWdy5" isRoot="false" isAbstract="false" name="ISci*" elementReference="nhhsSQ8LUaqY" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="7JKPViEW7ZAh" isRoot="false" isAbstract="false" name="IChannel*" elementReference="3Qe3zotuRRQu" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="v9K0jVhcro2q" isRoot="false" isAbstract="false" name="IEthernet*" elementReference="haieT6uYNCxq" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="uBMjyNZssFA6" isRoot="false" isAbstract="false" name="const Network_Clock_Tick" elementReference="yw5ob124gIWX" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="T5xCWzXyj7oa" isRoot="false" isAbstract="false" name="const Sta&amp;" elementReference="ep8pvWB0srsZ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="U0nk5GKAeh4g" isRoot="false" isAbstract="false" name="Maximus*" elementReference="ehlWWc3xpjDc" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="waDrHSxs6vlj" isRoot="false" isAbstract="false" name="const Msg&amp;" elementReference="QDgInxgZQCAU" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="Qkc9xke12bLH" isRoot="false" isAbstract="false" name="const cb_t" elementReference="wnXcVmSSha0e" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="bwt1amS1hrT1" isRoot="false" isAbstract="false" name="const FunctionSciMsg&amp;" elementReference="OSpq2dnTY35U" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="gfEyyxURjjPy" isRoot="false" isAbstract="false" name="const float" elementReference="e4mAiTMYaY2m" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="iqALD0zLpMtS" isRoot="false" isAbstract="false" name="SystemManager" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="QLFCWED8oZX2" isRoot="false" isAbstract="false" name="FunctionCallManager" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="dhiFOKw4B6PM" isRoot="false" isAbstract="false" name="NetworkClockProcessor" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="5MiuiZM7uaJQ" isRoot="false" isAbstract="false" name="PhyProcessor" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="oVWa43dfiLu6" isRoot="false" isAbstract="false" name="SciServer" />
+ <UML:Package isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="FalPmYKPIgfK" isRoot="false" isAbstract="false" name="std" >
+ <UML:Namespace.ownedElement>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="FalPmYKPIgfK" xmi.id="hNV9xKhyiJ0h" isRoot="false" isAbstract="false" name="vector" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="FalPmYKPIgfK" xmi.id="UfIUtWfrdaT6" isRoot="false" isAbstract="false" name="ofstream" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="OSpq2dnTY35U" isRoot="false" isAbstract="false" name="FunctionSciMsg" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="HwHnzLGezUjF" isRoot="false" isAbstract="false" name="ParametersList" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="mYkl2R0EAIiQ" isRoot="false" isAbstract="false" name="Sci_Msg_Station_Id" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="b7QGcuF2sksT" isRoot="false" isAbstract="false" name="unsigned char" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vmoDNQ6rF2Dm" isRoot="false" isAbstract="false" name="T const" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="s5UhEg9EzVwp" isRoot="false" isAbstract="false" name="T" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="vRs8ZxhLHVQP" isRoot="false" isAbstract="false" name="Station" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="7idxC3iqoit2" isRoot="false" isAbstract="false" name="PhyMpduCb" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0OMn4FpAAKoD" isRoot="false" isAbstract="false" name="EtherCb" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="RYa1BtTCB0W9" isRoot="false" isAbstract="false" name="EtherSciMsg" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="yw5ob124gIWX" isRoot="false" isAbstract="false" name="Network_Clock_Tick" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="j4JNar0VcD2Z" isRoot="false" isAbstract="false" name="IPhy" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="haieT6uYNCxq" isRoot="false" isAbstract="false" name="IEthernet" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="g4QJcYzcXCwe" isRoot="false" isAbstract="false" name="Function_Call_Msg_Id" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Z7QPu1pTKEg0" isRoot="false" isAbstract="false" name="cb_t" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="fvd3d4zkVezE" isRoot="false" isAbstract="false" name="StaCounter" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3cZNPG4Cidhc" isRoot="false" isAbstract="false" name="CoreEngine" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="RCBIr5aEF5nl" isRoot="false" isAbstract="false" name="ISystem" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="t3SV6Sb72ZAp" isRoot="false" isAbstract="false" name="IFunctionCall" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="wfaWTHxdQDUU" isRoot="false" isAbstract="false" name="INetworkClock" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="nhhsSQ8LUaqY" isRoot="false" isAbstract="false" name="ISci" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="3Qe3zotuRRQu" isRoot="false" isAbstract="false" name="IChannel" />
+ <UML:Class comment="class Sta" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ep8pvWB0srsZ" isRoot="false" isAbstract="false" name="Sta" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="oVFnCUboi4pC" type="1nRAhhrW78Cm" name="mpSystemManager" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="go2VOfxnTEbJ" type="mYkl2R0EAIiQ" name="mStationId" />
+ <UML:Attribute comment="Each 'Sta' instance points to an eCos process (via 'mStationId').
+When a 'Sta' is created from a Python script,
+the 'Sta' copy constructor is called by the Boost.Python interface.
+Thus, several 'Sta' instances point to the same eCos process.
+The eCos process has to be stopped only when the last 'Sta' pointing to it is deleted,
+i.e. when the station counter defined below equals 1." isSpecification="false" visibility="private" xmi.id="KbeAQSpFv205" type="fvd3d4zkVezE" name="mStaCounter" ownerScope="classifier" />
+ <UML:Attribute comment="// private attributes// // used for 'Maximus::process()' method only" isSpecification="false" visibility="private" xmi.id="k7cXtMnjJfrh" type="U0nk5GKAeh4g" name="mpMaximus" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="djSSCnZepQOH" isRoot="false" isAbstract="false" isQuery="false" name="~ Sta" />
+ <UML:Operation comment="// public methods// /**" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4Ba9o2mMAkDn" isRoot="false" isAbstract="false" isQuery="false" name="remove" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="8RQh2fjgMB8Z" isRoot="false" isAbstract="false" isQuery="false" name="deactivate" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="yfBn3a25jdFW" isRoot="false" isAbstract="false" isQuery="false" name="activate" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="d1snm4YsTwXW" isRoot="false" isAbstract="false" isQuery="false" name="debug" />
+ <UML:Operation comment="@return Sci_Msg_Station_Id" isSpecification="false" isLeaf="false" visibility="private" xmi.id="bGAySGXOugAx" isRoot="false" isAbstract="false" isQuery="false" name="getStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Fl3PdQWisfyG" type="mYkl2R0EAIiQ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Copy constructors" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Y88A5MrArpjK" isRoot="false" isAbstract="false" isQuery="false" name="Sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5MNdxlGUtOew" value="" type="T5xCWzXyj7oa" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// /**
+@return Sta &amp;
+@param sta" isSpecification="false" isLeaf="false" visibility="public" xmi.id="oUJVb76eSRGN" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="V9OTd5FmFvKi" type="dlNG20SXVnem" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="AWr3tUxby39F" value="" type="T5xCWzXyj7oa" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Indicate if the station is IDLE or not." isSpecification="false" isLeaf="false" visibility="public" xmi.id="RqGnq62Lsrne" isRoot="false" isAbstract="false" isQuery="false" name="is_idle" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1XAJHUqWFttr" type="THhIOpi4zEEB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// // private attribute accessor methods// /**
+@return ISystem *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="XbtDfhQJTQpp" isRoot="false" isAbstract="false" isQuery="false" name="getSystemManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KQZA3WQYfp1G" type="1nRAhhrW78Cm" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="3kcWyBnGnSPD" isRoot="false" isAbstract="false" isQuery="false" name="resetStationId" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sE069Ko8rwR6" type="jEmP36b8eexL" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the station name." isSpecification="false" isLeaf="false" visibility="public" xmi.id="7b2NjvRqt15k" isRoot="false" isAbstract="false" isQuery="false" name="set_name" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dD3nVU3pN8oE" value="" type="g6pCtTynyrSu" name="station_name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5sTnbHce4Hug" isRoot="false" isAbstract="false" isQuery="false" name="Sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XfPuec2kCPSA" value="" type="U0nk5GKAeh4g" name="p_maximus" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5EYVNjmScFGB" value="" type="1nRAhhrW78Cm" name="p_system_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="UqoX8iBfNbXz" value="" type="g6pCtTynyrSu" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// // private attribute accessor methods// /**
+Gets a pointer to Maximus.
+@return mpMaximus" isSpecification="false" isLeaf="false" visibility="private" xmi.id="UWbeAOaxrZQu" isRoot="false" isAbstract="false" isQuery="false" name="getMaximus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="RIdg9UVRu5bx" type="U0nk5GKAeh4g" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class Msg" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="QDgInxgZQCAU" isRoot="false" isAbstract="false" name="Msg" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="10jayNoLndBo" type="heG5Hkz2HbX4" name="mpFunctionSciMsg" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="cg4PHDBY9TK6" type="wnXcVmSSha0e" name="mCallback" />
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="L2vHZ83DCTWo" type="U0nk5GKAeh4g" name="mpMaximus" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="zTPVfL9qQ1Ol" type="v6Ix8Dv7zKFg" name="mpFunctionCallManager" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="iOtU5IDPI9gr" type="1nRAhhrW78Cm" name="mpSystemManager" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="Hj5RBZF83edg" type="jEmP36b8eexL" name="mResponseReceived" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BX5JpmjsyPiS" isRoot="false" isAbstract="false" isQuery="false" name="~ Msg" />
+ <UML:Operation comment="// public methods// /**
+@param name" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wGT7suZfVYaY" isRoot="false" isAbstract="false" isQuery="false" name="add_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="raMgKvXVSbnG" value="" type="g6pCtTynyrSu" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param name
+@param length
+@param value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="NU8Ltpln5Fsv" isRoot="false" isAbstract="false" isQuery="false" name="add_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7SYcy7BohXU1" value="" type="g6pCtTynyrSu" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="23P5GFyLfUye" value="" type="Q0UsbF8ykFHb" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="vHHZlDBLKbbu" value="" type="x1PhEfJEggJw" name="value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="VrwMZppWoDE0" isRoot="false" isAbstract="false" isQuery="false" name="add_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="sVEY9VS2khbV" value="" type="g6pCtTynyrSu" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="G190jiUcVInq" value="" type="p0IbDUZ3xnb6" name="value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param name" isSpecification="false" isLeaf="false" visibility="public" xmi.id="gthvuuhhtyJ6" isRoot="false" isAbstract="false" isQuery="false" name="remove_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Qs8OehUujbvQ" value="" type="g6pCtTynyrSu" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param user_cb" isSpecification="false" isLeaf="false" visibility="public" xmi.id="KP2nfndMhLFZ" isRoot="false" isAbstract="false" isQuery="false" name="set_cb" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yAwhlp73E7qs" value="" type="DxG6tZBJQHh4" name="user_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="vUEanT9yOP3H" isRoot="false" isAbstract="false" isQuery="false" name="remove_cb" />
+ <UML:Operation comment="@param sta" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xCZNTGPROL7A" isRoot="false" isAbstract="false" isQuery="false" name="set_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="BCBNK0FDUTnF" value="" type="dlNG20SXVnem" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="vwBJJCZGO8dr" isRoot="false" isAbstract="false" isQuery="false" name="send_async" />
+ <UML:Operation comment="@param sta" isSpecification="false" isLeaf="false" visibility="public" xmi.id="M0HlMMtVY4sq" isRoot="false" isAbstract="false" isQuery="false" name="send_async" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="463WXojSivk2" value="" type="dlNG20SXVnem" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="5HIUPuJluYUE" isRoot="false" isAbstract="false" isQuery="false" name="send" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Z2TCpSQhgRnp" type="xodDUGXAMLKD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param sta" isSpecification="false" isLeaf="false" visibility="public" xmi.id="uNjTQaJUgNzB" isRoot="false" isAbstract="false" isQuery="false" name="send" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="laybWNhxdIcn" type="xodDUGXAMLKD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9iesbMuhdA90" value="" type="dlNG20SXVnem" name="sta" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param name" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4SlxzE9tbtM1" isRoot="false" isAbstract="false" isQuery="false" name="is_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="n7EhAqdjq6tf" type="jEmP36b8eexL" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ReU5zTG89s0j" value="" type="g6pCtTynyrSu" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return unsigned char *
+@param name
+@param length" isSpecification="false" isLeaf="false" visibility="public" xmi.id="EsOp3Xp5xZ2w" isRoot="false" isAbstract="false" isQuery="false" name="bind_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZKKDj81Uix3C" type="pcXZS4JlpBBT" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nCoO38OUmsXj" value="" type="g6pCtTynyrSu" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2Xry4ssr4gE5" value="" type="JnsSgq9sjXim" name="length" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="zLMiq2UtXKrc" isRoot="false" isAbstract="false" isQuery="false" name="bind_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KlAy3kjqrxW0" type="VPg2hVetD85b" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="CjTEOhJDJomj" value="" type="g6pCtTynyrSu" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="gPchRmqJUY7B" isRoot="false" isAbstract="false" isQuery="false" name="Msg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="WXyjBwQsK2Xl" value="" type="U0nk5GKAeh4g" name="p_maximus" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="oO5HuAQMAD7D" value="" type="v6Ix8Dv7zKFg" name="p_function_call_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="RPN64PkYwgF8" value="" type="1nRAhhrW78Cm" name="p_system_manager" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dfyvfVgStjjm" value="" type="g6pCtTynyrSu" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Copy constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="r98zLDCmcXqe" isRoot="false" isAbstract="false" isQuery="false" name="Msg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OPBG9s200A0L" value="" type="waDrHSxs6vlj" name="msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// /**
+@return Msg &amp;
+@param msg" isSpecification="false" isLeaf="false" visibility="public" xmi.id="EObIHK2ekDut" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="l7hbBbEktZwc" type="xodDUGXAMLKD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4ur42rNO0SLg" value="" type="waDrHSxs6vlj" name="msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Msg &amp;
+@param name
+@param value
+Add a parameter named name to an existing message.
+Its length is set to the size of value string and its value is set to value.
+Return the message." isSpecification="false" isLeaf="false" visibility="public" xmi.id="7GMVrNKHVaOb" isRoot="false" isAbstract="false" isQuery="false" name="add_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="fx4Lu8XErhAs" type="xodDUGXAMLKD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KGTxD7teCVT0" value="" type="g6pCtTynyrSu" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="cM9uIgRNulsl" value="" type="g6pCtTynyrSu" name="value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return unsigned char *
+@param name
+@param length
+@param p_data
+Retrieve contents of the parameter named name.
+Return updated length of the received parameter via length and a pointer to its value via p_data.
+Return NULL if the parameter named name does not exist in the message, else return p_data.
+Note that user has to allocate enough memory for parameter value.
+If parameter value length is unknown, user has to allocate FUNCTION_CALL_PARAM_MAX_SIZE bytes." isSpecification="false" isLeaf="false" visibility="public" xmi.id="ZuHAW1eJWiPc" isRoot="false" isAbstract="false" isQuery="false" name="bind_param" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PrhFpDFYIw8T" type="pcXZS4JlpBBT" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="AzhmtMHXmeFr" value="" type="g6pCtTynyrSu" name="name" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mXjW1RrbL9lq" value="" type="JnsSgq9sjXim" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8P7e5WEFWv1N" value="" type="pcXZS4JlpBBT" name="p_data" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Function_Call_Msg_Id
+Return mpFunctionSciMsg->mSpecializedSciMsgId." isSpecification="false" isLeaf="false" visibility="public" xmi.id="n4hHygeCvXCo" isRoot="false" isAbstract="false" isQuery="false" name="get_tx_msg_id" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VMCMv8yY51tz" type="g4QJcYzcXCwe" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Function_Call_Msg_Id
+Return mpFunctionSciMsg->mpSpecializedSciMsgHeader->msg_id." isSpecification="false" isLeaf="false" visibility="public" xmi.id="C5saMj28nhPj" isRoot="false" isAbstract="false" isQuery="false" name="get_rx_msg_id" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9RBy6KqWBXl0" type="g4QJcYzcXCwe" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// // private attributes accessor methods///**
+@return Maximus *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="xmUOmt9SH2wL" isRoot="false" isAbstract="false" isQuery="false" name="getMaximus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="iyX0sfUO1gkv" type="U0nk5GKAeh4g" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return IFunctionCall *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="IAkZHOQY5TzE" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="mhTriLopmzlq" type="v6Ix8Dv7zKFg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return ISystem *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="3CN4p0imlDAX" isRoot="false" isAbstract="false" isQuery="false" name="getSystemManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JbKV93Tr1yqu" type="1nRAhhrW78Cm" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return cb_t" isSpecification="false" isLeaf="false" visibility="private" xmi.id="6HxLHueY2M7J" isRoot="false" isAbstract="false" isQuery="false" name="getCallback" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="dKGdyyWidxXJ" type="wnXcVmSSha0e" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param cb_t" isSpecification="false" isLeaf="false" visibility="private" xmi.id="kXrqzo220P4p" isRoot="false" isAbstract="false" isQuery="false" name="setCallback" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="IL62IrtaTD5a" type="jEmP36b8eexL" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VzpXMwq4SfuR" value="" type="Qkc9xke12bLH" name="callback" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return FunctionSciMsg *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="TvRSKTFiDpr9" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="HWPGVF86XOjT" type="heG5Hkz2HbX4" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param function_sci_msg " isSpecification="false" isLeaf="false" visibility="private" xmi.id="aVAa7VraTf8p" isRoot="false" isAbstract="false" isQuery="false" name="setFunctionSciMsg" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LFByBiIT3MWM" type="jEmP36b8eexL" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KhiYWZh65peA" value="" type="bwt1amS1hrT1" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="JUkm9qbklSmL" isRoot="false" isAbstract="false" isQuery="false" name="isResponseReceived" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ENwfYzFnTe4w" type="jEmP36b8eexL" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="ECKt4mtMTbuz" isRoot="false" isAbstract="false" isQuery="false" name="setResponseReceived" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sC1PZktuy4q9" type="jEmP36b8eexL" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8Z4BNgLgA4SJ" value="" type="THhIOpi4zEEB" name="response_received" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="u32fTmygyJZ0" isRoot="false" isAbstract="false" isQuery="false" name="receiveResponse" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5SNY1FVAnXJA" value="" type="bwt1amS1hrT1" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="EfqOjIibJiHm" isRoot="false" isAbstract="false" isQuery="false" name="receiveAsynchronousResponse" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="UFSSW0RbQo7S" value="" type="bwt1amS1hrT1" name="function_sci_msg" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ <UML:Namespace.ownedElement>
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="QDgInxgZQCAU" xmi.id="wnXcVmSSha0e" isRoot="false" isAbstract="false" name="cb_t" />
+ </UML:Namespace.ownedElement>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="iNY7Y0bMhGEA" isRoot="false" isAbstract="false" name="PhySciMsgMpdu" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="tbNdw9toAjKQ" isRoot="false" isAbstract="false" name="Error" />
+ <UML:Class stereotype="typedef" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="DlAv42zir8Xn" isRoot="false" isAbstract="false" name="tick_t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0hFgvRqcmJlk" isRoot="false" isAbstract="false" name="MsgsList" elementReference="8tZZKzS1K06t" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="WqrqqvhoauSV" isRoot="false" isAbstract="false" name="StasList" elementReference="bRgJkgzqXYQq" />
+ <UML:Class comment="class Maximus" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ehlWWc3xpjDc" isRoot="false" isAbstract="false" name="Maximus" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes// " isSpecification="false" visibility="private" xmi.id="kBrcJNNv26PY" type="fuB56JYI4iD9" name="mpCoreEngine" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="oo85zzbRDPyQ" type="UfIUtWfrdaT6" name="mMaximusLogFile" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="n9PQjqWWedbc" type="yw5ob124gIWX" name="mMaxTickValue" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="cD1naxBYtEMT" type="yw5ob124gIWX" name="mWaitTickValue" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="GMVud1SQApos" type="0hFgvRqcmJlk" name="mListOfMsgs" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="fIOIvxsVAtGj" type="WqrqqvhoauSV" name="mListOfStas" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="JoCPn2GpDqfJ" type="jEmP36b8eexL" name="mIsWireshark" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="nI1ZbW1iujDH" type="xNg2o0bO89EZ" name="mEtherLogFileDescriptor" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="iTTXAh9pZJtd" isRoot="false" isAbstract="false" isQuery="false" name="Maximus" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cRvh97orIdRb" isRoot="false" isAbstract="false" isQuery="false" name="~ Maximus" />
+ <UML:Operation comment="// public methods// /**
+@param argc
+@param argv
+Initialize Maximus with main program arguments." isSpecification="false" isLeaf="false" visibility="public" xmi.id="H2irvAKHRSNz" isRoot="false" isAbstract="false" isQuery="false" name="init" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KE8chbfq3XX2" value="" type="4Y3pj29RWeiE" name="argc" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="en25DN2XZA8G" value="" type="m2WuMpndsVSl" name="argv[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param interface_cb
+Initialize PHY with an interface callback function for PHY SCI message MPDU reception." isSpecification="false" isLeaf="false" visibility="public" xmi.id="kl7lIen3fIx1" isRoot="false" isAbstract="false" isQuery="false" name="init_phy" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="6vXf5dwpP3Zf" value="" type="7idxC3iqoit2" name="interface_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param ether_cb
+Initialize Ethernet with an interface callback function for Ether SCI message reception." isSpecification="false" isLeaf="false" visibility="public" xmi.id="fMiKcdKkMxfY" isRoot="false" isAbstract="false" isQuery="false" name="init_ether" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yk1Lla0OuhjX" value="" type="0OMn4FpAAKoD" name="interface_cb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="UVM9G9s9kRJz" isRoot="false" isAbstract="false" isQuery="false" name="process" />
+ <UML:Operation comment="@return Sta &amp;
+@param station_executable the station executable to run
+Create a new station.
+Return a reference on a station object." isSpecification="false" isLeaf="false" visibility="public" xmi.id="UAPjRB4a3YSy" isRoot="false" isAbstract="false" isQuery="false" name="create_sta" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="n8aoV68hR2M0" type="dlNG20SXVnem" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="y0UiLgJWH0BO" value="" type="g6pCtTynyrSu" name="station_executable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param name" isSpecification="false" isLeaf="false" visibility="public" xmi.id="wUvfwCeODqfS" isRoot="false" isAbstract="false" isQuery="false" name="create_fc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zZnTBrN32OTb" type="xodDUGXAMLKD" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="34IFsvf6TQVF" value="" type="g6pCtTynyrSu" name="name" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="oGzm7Pe9UuOM" isRoot="false" isAbstract="false" isQuery="false" name="create_probe" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="7MV3OLA9Skyv" type="xodDUGXAMLKD" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates a PHY SCI message MPDU.
+Returns a pointer to a PHY SCI message MPDU object.
+@return PhySciMsgMpdu *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MZbBuOy5Jiak" isRoot="false" isAbstract="false" isQuery="false" name="create_mpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="p6aG9wG8T2Ze" type="7Px2h6lKHGvZ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends an already configured PHY SCI message MPDU.
+@param p_mpdu
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="sJWan23AafJS" isRoot="false" isAbstract="false" isQuery="false" name="send_mpdu" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1IXKy545U25B" value="" type="7Px2h6lKHGvZ" name="p_mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Creates an Ether SCI message.
+Returns a pointer to an Ether SCI message object.
+@return EtherSciMsg *" isSpecification="false" isLeaf="false" visibility="public" xmi.id="6oUL5NuvgRVS" isRoot="false" isAbstract="false" isQuery="false" name="create_ether" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tvivH9UOVzPr" type="6ZCYZGid4Ay7" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sends an already configured Ether SCI message.
+@param ether
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Xt2CIVej2CjD" isRoot="false" isAbstract="false" isQuery="false" name="send_ether" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rRdvZc37T3Hl" value="" type="5AQH9uODRbl0" name="ether" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param value" isSpecification="false" isLeaf="false" visibility="public" xmi.id="n3QGRuWMi7ZA" isRoot="false" isAbstract="false" isQuery="false" name="wait" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Kb8mWW6JXXYy" value="" type="N5IkQdvEtuz1" name="value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="R2L79sHWxZEN" isRoot="false" isAbstract="false" isQuery="false" name="wait" />
+ <UML:Operation comment="Enable or disable the channel perturbation." isSpecification="false" isLeaf="false" visibility="public" xmi.id="Y4tsFILI41mT" isRoot="false" isAbstract="false" isQuery="false" name="disturb_channel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="y8weVEK2JBsY" value="" type="THhIOpi4zEEB" name="enable" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the Network Clock current tick." isSpecification="false" isLeaf="false" visibility="public" xmi.id="SEoWFa0gqfyE" isRoot="false" isAbstract="false" isQuery="false" name="get_date" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JX1jIzc53CJA" type="N5IkQdvEtuz1" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the power line frequency." isSpecification="false" isLeaf="false" visibility="public" xmi.id="U53t9vRGg4Q9" isRoot="false" isAbstract="false" isQuery="false" name="set_freq" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="niATBGvGImNB" value="" type="gfEyyxURjjPy" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Get the power line frequency." isSpecification="false" isLeaf="false" visibility="public" xmi.id="BepE4zsiBre8" isRoot="false" isAbstract="false" isQuery="false" name="get_freq" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6YHZaqDTjtN1" type="gfEyyxURjjPy" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Set the SNR." isSpecification="false" isLeaf="false" visibility="public" xmi.id="MwtCRX39AKA7" isRoot="false" isAbstract="false" isQuery="false" name="set_snr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="By6Ly5oqxsUF" value="" type="gfEyyxURjjPy" name="snr_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="jXpA2MwMGpXh" isRoot="false" isAbstract="false" isQuery="false" name="set_snr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LapVszb1vhMt" value="" type="g6pCtTynyrSu" name="snr_file" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="k9hi1Avihkrh" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_from_src" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4n3Kca0v8nPy" value="" type="gfEyyxURjjPy" name="snr_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="k0zffMWPVD5U" value="" type="T5xCWzXyj7oa" name="src" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="N0C2i3jmol5R" value="" type="THhIOpi4zEEB" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="IyZz6U3gTDAX" isRoot="false" isAbstract="false" isQuery="false" name="stop" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="b1BU44BeVaul" isRoot="false" isAbstract="false" isQuery="false" name="wrapper" ownerScope="classifier" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PkDB6kB4O1z9" value="" type="4Y3pj29RWeiE" name="n" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// public methods///**
+Constructor (FOR UNITARY TESTS ONLY)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="aQPFGpsToNX0" isRoot="false" isAbstract="false" isQuery="false" name="Maximus" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0gsvnJ0Pj8x4" value="" type="fuB56JYI4iD9" name="p_core_engine" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param wait_tick_value" isSpecification="false" isLeaf="false" visibility="private" xmi.id="DzV5Ef9sw8T5" isRoot="false" isAbstract="false" isQuery="false" name="setWaitTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="2rNVplN6IOpY" type="jEmP36b8eexL" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eSAXLV47u5vj" value="" type="uBMjyNZssFA6" name="wait_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Network_Clock_Tick" isSpecification="false" isLeaf="false" visibility="private" xmi.id="mP3noVXifsRd" isRoot="false" isAbstract="false" isQuery="false" name="getWaitTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="NPdObxZfVqE5" type="yw5ob124gIWX" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+@return CoreEngine *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="rSHiec9syenZ" isRoot="false" isAbstract="false" isQuery="false" name="getCoreEngine" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ePWOJtNJjipY" type="fuB56JYI4iD9" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+@return SystemManager *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="AAa24X1M896e" isRoot="false" isAbstract="false" isQuery="false" name="getSystemManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="TCekYRItqwHP" type="fDwAiS87UREb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return FunctionCallManager *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="KT7F0Mb9UBBW" isRoot="false" isAbstract="false" isQuery="false" name="getFunctionCallManager" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rq4KgGNJftfw" type="iCrqJxTw8N6o" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return NetworkClockProcessor *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="nEvFe7qwavBZ" isRoot="false" isAbstract="false" isQuery="false" name="getNetworkClockProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="l2GUi30CFcwn" type="FmijvtGb37QM" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return PhyProcessor *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="2rI9EMxzarEC" isRoot="false" isAbstract="false" isQuery="false" name="getPhyProcessor" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1Cep6vExkGFQ" type="y48XzI6F2mwy" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return SciServer *" isSpecification="false" isLeaf="false" visibility="private" xmi.id="dAZgHz0IqGR2" isRoot="false" isAbstract="false" isQuery="false" name="getSciServer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Wch9UM4FOKh5" type="cMzADDNCFTjF" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to Channel
+@return mpCoreEngine->mpChannel" isSpecification="false" isLeaf="false" visibility="private" xmi.id="tIFqVzqqwvOI" isRoot="false" isAbstract="false" isQuery="false" name="getChannel" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LhHaHBLINz5S" type="7JKPViEW7ZAh" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="qppge6EX6XFp" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_to_dst" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tJrGkITt9ElM" value="" type="gfEyyxURjjPy" name="snr_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="CxHryPPmCESq" value="" type="T5xCWzXyj7oa" name="dst" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KgOOCbD5s3Md" value="" type="THhIOpi4zEEB" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return Network_Clock_Tick" isSpecification="false" isLeaf="false" visibility="private" xmi.id="uVhIFP9vxrXQ" isRoot="false" isAbstract="false" isQuery="false" name="getMaxTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="sJPcXf11Fi8j" type="yw5ob124gIWX" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@param snr_file the SNR file to read
+@param the SNR array read from the SNR file
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="DlLanVCUPxtb" isRoot="false" isAbstract="false" isQuery="false" name="readSnrFile" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="5CyRUdWpIlNZ" type="jEmP36b8eexL" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OLAYvCo3K1i3" value="" type="g6pCtTynyrSu" name="snr_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="CU0rFb5SKO06" value="" type="e4mAiTMYaY2m" name="snr_array[][]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a pointer to Ethernet
+@return mpCoreEngine->mpEthernet" isSpecification="false" isLeaf="false" visibility="private" xmi.id="vO9Qz7VtOkjt" isRoot="false" isAbstract="false" isQuery="false" name="getEthernet" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uipGfuiYB7Ai" type="v9K0jVhcro2q" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="@return bool
+@param max_tick_value" isSpecification="false" isLeaf="false" visibility="private" xmi.id="vRwGbr6W1PUk" isRoot="false" isAbstract="false" isQuery="false" name="setMaxTickValue" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="k9hysqhx0eMV" type="jEmP36b8eexL" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eJzbBWz4vvLW" value="" type="uBMjyNZssFA6" name="max_tick_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="Ek7RSV2xuIlc" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_from_src_to_dst" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YM7bapjg2SgL" value="" type="g6pCtTynyrSu" name="snr_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="SkFQJn1XW7wy" value="" type="T5xCWzXyj7oa" name="src" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="awvUEe7nzCMZ" value="" type="T5xCWzXyj7oa" name="dst" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="03D2VtLvcbMt" value="" type="THhIOpi4zEEB" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="J3KSqjOajODO" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_from_src" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="kjmDurhGsrIY" value="" type="g6pCtTynyrSu" name="snr_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="t0JhlM62PRSD" value="" type="T5xCWzXyj7oa" name="src" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ArlsDyExh08Z" value="" type="THhIOpi4zEEB" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="LnUS2DoCA326" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_to_dst" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="SRscdKSwzoIB" value="" type="g6pCtTynyrSu" name="snr_file" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="NUEGXYrqMJIO" value="" type="T5xCWzXyj7oa" name="dst" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="W4Yg7alXzb9b" value="" type="THhIOpi4zEEB" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="wZXtOp4jJIxo" isRoot="false" isAbstract="false" isQuery="false" name="set_snr_from_src_to_dst" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rocB7uXbw5G1" value="" type="gfEyyxURjjPy" name="snr_value" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="e1YdcfCWFjPb" value="" type="T5xCWzXyj7oa" name="src" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XRIoiGbX2DiA" value="" type="T5xCWzXyj7oa" name="dst" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8Fj2Iz4w0aYb" value="" type="THhIOpi4zEEB" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Activate wrong preambles transmission.
+@param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+@param std_deviation the standard deviation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="aHkiu4bSKQ6I" isRoot="false" isAbstract="false" isQuery="false" name="activate_false_alarm" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="cduGtfrk8f0K" value="" type="uBMjyNZssFA6" name="average_duration" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xRGV97PjN7PH" value="" type="gfEyyxURjjPy" name="std_deviation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Deactivate wrong preambles transmission." isSpecification="false" isLeaf="false" visibility="public" xmi.id="lIKxxxsc6w87" isRoot="false" isAbstract="false" isQuery="false" name="deactivate_false_alarm" />
+ <UML:Operation comment="Indicate if the station is IDLE or not.
+@param station_id the ID of the station
+@return 'true' if the station is IDLE, 'false' otherwise" isSpecification="false" isLeaf="false" visibility="public" xmi.id="XJG9MFuSSUG1" isRoot="false" isAbstract="false" isQuery="false" name="is_station_idle" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="HrIacg7XMxl2" type="THhIOpi4zEEB" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OTVrceMEaVGG" value="" type="mYkl2R0EAIiQ" name="station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Indicates if Wireshark is enabled or not.
+@return 'true' if Wireshark is enabled, 'false' otherwise" isSpecification="false" isLeaf="false" visibility="private" xmi.id="CCl2O58fBXuU" isRoot="false" isAbstract="false" isQuery="false" name="isWireshark" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="rTY3YgjJqRFg" type="THhIOpi4zEEB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="xNg2o0bO89EZ" isRoot="false" isAbstract="false" name="File_Descriptor" />
+ </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="894" snapy="10" showatts="1" xmi.id="3KzgC5IKgrME" documentation="" type="1" showops="1" showpackage="1" name="Maximus" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1040" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="1" width="772" showattsigs="601" x="67" fillcolor="none" y="28" showopsigs="601" linewidth="none" height="1008" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="ehlWWc3xpjDc" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="910" snapy="10" showatts="1" xmi.id="EA3ynGSPFKAz" documentation="" type="1" showops="1" showpackage="1" name="Sta" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="824" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="670" showattsigs="601" x="40" fillcolor="#ffffc0" y="27" showopsigs="601" linewidth="none" height="342" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="ep8pvWB0srsZ" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations/>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="910" snapy="10" showatts="1" xmi.id="4Bvhu10J0ZVK" documentation="" type="1" showops="1" showpackage="1" name="Msg" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="824" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="1" width="856" showattsigs="601" x="26" fillcolor="none" y="26" showopsigs="601" linewidth="none" height="720" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="QDgInxgZQCAU" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,75,0,0,0,0,0" linecolor="none" />
+ </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="3KzgC5IKgrME" documentation="" uniqueid="rTY3YgjJqRFg" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="813" id="3cZNPG4Cidhc" />
+ <listitem open="0" type="813" id="tbNdw9toAjKQ" />
+ <listitem open="0" type="813" id="0OMn4FpAAKoD" />
+ <listitem open="0" type="813" id="RYa1BtTCB0W9" />
+ <listitem open="0" type="813" id="xNg2o0bO89EZ" />
+ <listitem open="0" type="813" id="QLFCWED8oZX2" />
+ <listitem open="0" type="813" id="OSpq2dnTY35U" />
+ <listitem open="0" type="813" id="g4QJcYzcXCwe" />
+ <listitem open="0" type="813" id="3Qe3zotuRRQu" />
+ <listitem open="0" type="813" id="haieT6uYNCxq" />
+ <listitem open="0" type="813" id="t3SV6Sb72ZAp" />
+ <listitem open="0" type="813" id="wfaWTHxdQDUU" />
+ <listitem open="0" type="813" id="j4JNar0VcD2Z" />
+ <listitem open="0" type="813" id="nhhsSQ8LUaqY" />
+ <listitem open="0" type="813" id="RCBIr5aEF5nl" />
+ <listitem open="0" type="813" id="ehlWWc3xpjDc" >
+ <listitem open="0" type="814" id="kBrcJNNv26PY" />
+ <listitem open="0" type="814" id="oo85zzbRDPyQ" />
+ <listitem open="0" type="814" id="n9PQjqWWedbc" />
+ <listitem open="0" type="814" id="cD1naxBYtEMT" />
+ <listitem open="0" type="814" id="GMVud1SQApos" />
+ <listitem open="0" type="814" id="fIOIvxsVAtGj" />
+ <listitem open="0" type="814" id="JoCPn2GpDqfJ" />
+ <listitem open="0" type="814" id="nI1ZbW1iujDH" />
+ <listitem open="0" type="815" id="iTTXAh9pZJtd" />
+ <listitem open="0" type="815" id="cRvh97orIdRb" />
+ <listitem open="0" type="815" id="H2irvAKHRSNz" />
+ <listitem open="0" type="815" id="kl7lIen3fIx1" />
+ <listitem open="0" type="815" id="fMiKcdKkMxfY" />
+ <listitem open="0" type="815" id="UVM9G9s9kRJz" />
+ <listitem open="0" type="815" id="UAPjRB4a3YSy" />
+ <listitem open="0" type="815" id="wUvfwCeODqfS" />
+ <listitem open="0" type="815" id="oGzm7Pe9UuOM" />
+ <listitem open="0" type="815" id="MZbBuOy5Jiak" />
+ <listitem open="0" type="815" id="sJWan23AafJS" />
+ <listitem open="0" type="815" id="6oUL5NuvgRVS" />
+ <listitem open="0" type="815" id="Xt2CIVej2CjD" />
+ <listitem open="0" type="815" id="n3QGRuWMi7ZA" />
+ <listitem open="0" type="815" id="R2L79sHWxZEN" />
+ <listitem open="0" type="815" id="Y4tsFILI41mT" />
+ <listitem open="0" type="815" id="SEoWFa0gqfyE" />
+ <listitem open="0" type="815" id="U53t9vRGg4Q9" />
+ <listitem open="0" type="815" id="BepE4zsiBre8" />
+ <listitem open="0" type="815" id="MwtCRX39AKA7" />
+ <listitem open="0" type="815" id="jXpA2MwMGpXh" />
+ <listitem open="0" type="815" id="k9hi1Avihkrh" />
+ <listitem open="0" type="815" id="IyZz6U3gTDAX" />
+ <listitem open="0" type="815" id="b1BU44BeVaul" />
+ <listitem open="0" type="815" id="aQPFGpsToNX0" />
+ <listitem open="0" type="815" id="DzV5Ef9sw8T5" />
+ <listitem open="0" type="815" id="mP3noVXifsRd" />
+ <listitem open="0" type="815" id="rSHiec9syenZ" />
+ <listitem open="0" type="815" id="AAa24X1M896e" />
+ <listitem open="0" type="815" id="KT7F0Mb9UBBW" />
+ <listitem open="0" type="815" id="nEvFe7qwavBZ" />
+ <listitem open="0" type="815" id="2rI9EMxzarEC" />
+ <listitem open="0" type="815" id="dAZgHz0IqGR2" />
+ <listitem open="0" type="815" id="tIFqVzqqwvOI" />
+ <listitem open="0" type="815" id="qppge6EX6XFp" />
+ <listitem open="0" type="815" id="uVhIFP9vxrXQ" />
+ <listitem open="0" type="815" id="DlLanVCUPxtb" />
+ <listitem open="0" type="815" id="vO9Qz7VtOkjt" />
+ <listitem open="0" type="815" id="vRwGbr6W1PUk" />
+ <listitem open="0" type="815" id="Ek7RSV2xuIlc" />
+ <listitem open="0" type="815" id="J3KSqjOajODO" />
+ <listitem open="0" type="815" id="LnUS2DoCA326" />
+ <listitem open="0" type="815" id="wZXtOp4jJIxo" />
+ <listitem open="0" type="815" id="aHkiu4bSKQ6I" />
+ <listitem open="0" type="815" id="lIKxxxsc6w87" />
+ <listitem open="0" type="815" id="XJG9MFuSSUG1" />
+ <listitem open="0" type="815" id="CCl2O58fBXuU" />
+ </listitem>
+ <listitem open="0" type="813" id="QDgInxgZQCAU" >
+ <listitem open="0" type="813" id="wnXcVmSSha0e" />
+ <listitem open="0" type="814" id="10jayNoLndBo" />
+ <listitem open="0" type="814" id="cg4PHDBY9TK6" />
+ <listitem open="0" type="814" id="L2vHZ83DCTWo" />
+ <listitem open="0" type="814" id="zTPVfL9qQ1Ol" />
+ <listitem open="0" type="814" id="iOtU5IDPI9gr" />
+ <listitem open="0" type="814" id="Hj5RBZF83edg" />
+ <listitem open="0" type="815" id="BX5JpmjsyPiS" />
+ <listitem open="0" type="815" id="wGT7suZfVYaY" />
+ <listitem open="0" type="815" id="NU8Ltpln5Fsv" />
+ <listitem open="0" type="815" id="VrwMZppWoDE0" />
+ <listitem open="0" type="815" id="gthvuuhhtyJ6" />
+ <listitem open="0" type="815" id="KP2nfndMhLFZ" />
+ <listitem open="0" type="815" id="vUEanT9yOP3H" />
+ <listitem open="0" type="815" id="xCZNTGPROL7A" />
+ <listitem open="0" type="815" id="vwBJJCZGO8dr" />
+ <listitem open="0" type="815" id="M0HlMMtVY4sq" />
+ <listitem open="0" type="815" id="5HIUPuJluYUE" />
+ <listitem open="0" type="815" id="uNjTQaJUgNzB" />
+ <listitem open="0" type="815" id="4SlxzE9tbtM1" />
+ <listitem open="0" type="815" id="EsOp3Xp5xZ2w" />
+ <listitem open="0" type="815" id="zLMiq2UtXKrc" />
+ <listitem open="0" type="815" id="gPchRmqJUY7B" />
+ <listitem open="0" type="815" id="r98zLDCmcXqe" />
+ <listitem open="0" type="815" id="EObIHK2ekDut" />
+ <listitem open="0" type="815" id="7GMVrNKHVaOb" />
+ <listitem open="0" type="815" id="ZuHAW1eJWiPc" />
+ <listitem open="0" type="815" id="n4hHygeCvXCo" />
+ <listitem open="0" type="815" id="C5saMj28nhPj" />
+ <listitem open="0" type="815" id="xmUOmt9SH2wL" />
+ <listitem open="0" type="815" id="IAkZHOQY5TzE" />
+ <listitem open="0" type="815" id="3CN4p0imlDAX" />
+ <listitem open="0" type="815" id="6HxLHueY2M7J" />
+ <listitem open="0" type="815" id="kXrqzo220P4p" />
+ <listitem open="0" type="815" id="TvRSKTFiDpr9" />
+ <listitem open="0" type="815" id="aVAa7VraTf8p" />
+ <listitem open="0" type="815" id="JUkm9qbklSmL" />
+ <listitem open="0" type="815" id="ECKt4mtMTbuz" />
+ <listitem open="0" type="815" id="u32fTmygyJZ0" />
+ <listitem open="0" type="815" id="EfqOjIibJiHm" />
+ </listitem>
+ <listitem open="0" type="813" id="dhiFOKw4B6PM" />
+ <listitem open="0" type="813" id="yw5ob124gIWX" />
+ <listitem open="0" type="813" id="HwHnzLGezUjF" />
+ <listitem open="0" type="813" id="7idxC3iqoit2" />
+ <listitem open="0" type="813" id="5MiuiZM7uaJQ" />
+ <listitem open="0" type="813" id="iNY7Y0bMhGEA" />
+ <listitem open="0" type="813" id="oVWa43dfiLu6" />
+ <listitem open="0" type="813" id="mYkl2R0EAIiQ" />
+ <listitem open="0" type="813" id="ep8pvWB0srsZ" >
+ <listitem open="0" type="814" id="oVFnCUboi4pC" />
+ <listitem open="0" type="814" id="go2VOfxnTEbJ" />
+ <listitem open="0" type="814" id="KbeAQSpFv205" />
+ <listitem open="0" type="814" id="k7cXtMnjJfrh" />
+ <listitem open="0" type="815" id="djSSCnZepQOH" />
+ <listitem open="0" type="815" id="4Ba9o2mMAkDn" />
+ <listitem open="0" type="815" id="8RQh2fjgMB8Z" />
+ <listitem open="0" type="815" id="yfBn3a25jdFW" />
+ <listitem open="0" type="815" id="d1snm4YsTwXW" />
+ <listitem open="0" type="815" id="bGAySGXOugAx" />
+ <listitem open="0" type="815" id="Y88A5MrArpjK" />
+ <listitem open="0" type="815" id="oUJVb76eSRGN" />
+ <listitem open="0" type="815" id="RqGnq62Lsrne" />
+ <listitem open="0" type="815" id="XbtDfhQJTQpp" />
+ <listitem open="0" type="815" id="3kcWyBnGnSPD" />
+ <listitem open="0" type="815" id="7b2NjvRqt15k" />
+ <listitem open="0" type="815" id="5sTnbHce4Hug" />
+ <listitem open="0" type="815" id="UWbeAOaxrZQu" />
+ </listitem>
+ <listitem open="0" type="813" id="fvd3d4zkVezE" />
+ <listitem open="0" type="813" id="vRs8ZxhLHVQP" />
+ <listitem open="0" type="813" id="iqALD0zLpMtS" />
+ <listitem open="0" type="813" id="s5UhEg9EzVwp" />
+ <listitem open="0" type="813" id="vmoDNQ6rF2Dm" />
+ <listitem open="0" type="813" id="Z7QPu1pTKEg0" />
+ <listitem open="0" type="813" id="DlAv42zir8Xn" />
+ <listitem open="0" type="813" id="b7QGcuF2sksT" />
+ <listitem open="0" type="818" id="FalPmYKPIgfK" >
+ <listitem open="0" type="813" id="UfIUtWfrdaT6" />
+ <listitem open="0" type="813" id="hNV9xKhyiJ0h" />
+ </listitem>
+ <listitem open="0" type="829" id="0hFgvRqcmJlk" />
+ <listitem open="0" type="829" id="WqrqqvhoauSV" />
+ <listitem open="0" type="830" id="Datatypes" >
+ <listitem open="0" type="829" id="fuB56JYI4iD9" />
+ <listitem open="0" type="829" id="5AQH9uODRbl0" />
+ <listitem open="0" type="829" id="6ZCYZGid4Ay7" />
+ <listitem open="0" type="829" id="iCrqJxTw8N6o" />
+ <listitem open="0" type="829" id="heG5Hkz2HbX4" />
+ <listitem open="0" type="829" id="7JKPViEW7ZAh" />
+ <listitem open="0" type="829" id="v9K0jVhcro2q" />
+ <listitem open="0" type="829" id="v6Ix8Dv7zKFg" />
+ <listitem open="0" type="829" id="xnFXxdAshQqp" />
+ <listitem open="0" type="829" id="qASXaGKCzFk2" />
+ <listitem open="0" type="829" id="3OLgcMDSWdy5" />
+ <listitem open="0" type="829" id="1nRAhhrW78Cm" />
+ <listitem open="0" type="829" id="U0nk5GKAeh4g" />
+ <listitem open="0" type="829" id="xodDUGXAMLKD" />
+ <listitem open="0" type="829" id="FmijvtGb37QM" />
+ <listitem open="0" type="829" id="y48XzI6F2mwy" />
+ <listitem open="0" type="829" id="7Px2h6lKHGvZ" />
+ <listitem open="0" type="829" id="cMzADDNCFTjF" />
+ <listitem open="0" type="829" id="dlNG20SXVnem" />
+ <listitem open="0" type="829" id="2CPeV2SQpVK6" />
+ <listitem open="0" type="829" id="fDwAiS87UREb" />
+ <listitem open="0" type="829" id="p0IbDUZ3xnb6" />
+ <listitem open="0" type="829" id="VPg2hVetD85b" />
+ <listitem open="1" type="829" id="jEmP36b8eexL" />
+ <listitem open="1" type="829" id="r7DWE0eHIdyU" />
+ <listitem open="0" type="829" id="m2WuMpndsVSl" />
+ <listitem open="0" type="829" id="bwt1amS1hrT1" />
+ <listitem open="0" type="829" id="waDrHSxs6vlj" />
+ <listitem open="0" type="829" id="uBMjyNZssFA6" />
+ <listitem open="0" type="829" id="T5xCWzXyj7oa" />
+ <listitem open="0" type="829" id="THhIOpi4zEEB" />
+ <listitem open="0" type="829" id="Qkc9xke12bLH" />
+ <listitem open="0" type="829" id="DxG6tZBJQHh4" />
+ <listitem open="0" type="829" id="sdbAE2jFpDFi" />
+ <listitem open="0" type="829" id="gfEyyxURjjPy" />
+ <listitem open="0" type="829" id="g6pCtTynyrSu" />
+ <listitem open="0" type="829" id="N5IkQdvEtuz1" />
+ <listitem open="0" type="829" id="x1PhEfJEggJw" />
+ <listitem open="0" type="829" id="Q0UsbF8ykFHb" />
+ <listitem open="1" type="829" id="Wh4oK0G1C0OG" />
+ <listitem open="1" type="829" id="e4mAiTMYaY2m" />
+ <listitem open="1" type="829" id="4Y3pj29RWeiE" />
+ <listitem open="1" type="829" id="JmXtIagoHiaZ" />
+ <listitem open="1" type="829" id="60MkeH6JLqR1" />
+ <listitem open="0" type="829" id="8tZZKzS1K06t" />
+ <listitem open="0" type="829" id="bRgJkgzqXYQq" />
+ <listitem open="1" type="829" id="QdAO1lyjPrjw" />
+ <listitem open="0" type="829" id="pcXZS4JlpBBT" />
+ <listitem open="1" type="829" id="gobqox6sxQcc" />
+ <listitem open="1" type="829" id="7MAM2iuiWTYI" />
+ <listitem open="0" type="829" id="JnsSgq9sjXim" />
+ <listitem open="1" type="829" id="hgt0XK0q4XiM" />
+ </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="C++" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/maximus/ethernet/Module b/cesar/maximus/ethernet/Module
new file mode 100644
index 0000000000..e23e01431c
--- /dev/null
+++ b/cesar/maximus/ethernet/Module
@@ -0,0 +1,5 @@
+SOURCES := EthernetProcessor.cpp EtherSciMsg.cpp
+ifdef UNITTEST
+SOURCES += EthernetProcessorTest.cpp EtherSciMsgTest.cpp
+endif
+HOST_INCLUDES += maximus/ethernet/inc
diff --git a/cesar/maximus/ethernet/inc/EtherSciMsg.h b/cesar/maximus/ethernet/inc/EtherSciMsg.h
new file mode 100644
index 0000000000..da47dced79
--- /dev/null
+++ b/cesar/maximus/ethernet/inc/EtherSciMsg.h
@@ -0,0 +1,227 @@
+/************************************************************************
+ EtherSciMsg.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/ethernet/inc/EtherSciMsg.h
+**************************************************************************/
+
+#ifndef ETHERSCIMSG_H
+#define ETHERSCIMSG_H
+
+#include "SciMsg.h"
+
+#include "ethernet_types.h"
+
+class IEthernet;
+
+
+/**
+ * class EtherSciMsg
+ */
+
+class EtherSciMsg : public SciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+protected:
+
+ // protected attributes
+ //
+
+ // Get from specialized SCI msg header
+ //
+ Ethernet_Type mSpecializedSciMsgType;
+ Ethernet_Sniffer_Type mSnifferType;
+ Ethernet_Flags mFlags;
+
+ // Specialized SCI msg header
+ //
+ Ethernet_Header mSpecializedSciMsgHeader;
+
+ IEthernet * mpEthernet;
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ EtherSciMsg ( IEthernet * p_ethernet );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~EtherSciMsg ( );
+
+ // public methods
+ //
+
+ /**
+ * Creates an Ether SCI message.
+ * @return SciMsg *
+ */
+ SciMsg * create ( ) const;
+
+ /**
+ * Handles a received Ether SCI message.
+ * @return bool
+ */
+ bool dispatchMsg ( );
+
+ /**
+ * When receiving an Ether SCI message,
+ * extracts the Ether SCI message header from the received SCI message data.
+ * @return bool
+ */
+ bool identifySpecializedSciMsgHeader ( );
+
+ /**
+ * Checks that software versions are compatible,
+ * i.e. checks specialized SCI msg compatibility (check specialized SCI msg version).
+ * @return bool
+ */
+ bool checkCompatibility ( ) const;
+
+ /**
+ * Checks Ether SCI message header values ranges,
+ * i.e. checks specialized SCI msg validity (check specialized SCI msg header coherence).
+ * @return bool
+ */
+ bool checkValidity ( ) const;
+
+ /**
+ * Displays the Ether SCI message header contents.
+ */
+ void displaySpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Display the specialized SCI message type.
+ */
+ void displaySpecializedSciMsgType ( int log_level ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+ /**
+ * Gets a pointer to the Ether SCI message header.
+ * @return mSpecializedSciMsgHeader into a void pointer
+ */
+ void * returnSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Gets the Ether SCI message header.
+ * @return mSpecializedSciMsgHeader
+ */
+ const Ethernet_Header & getSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Sets the value of the Ethernet SCI message header.
+ * @return bool
+ * @param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader
+ */
+ bool setSpecializedSciMsgHeader ( const Ethernet_Header & specialized_sci_msg_header );
+
+ /**
+ * Gets the Ether SCI message type.
+ * @return mSpecializedSciMsgType
+ */
+ Ethernet_Type getSpecializedSciMsgType ( ) const;
+
+ /**
+ * Sets the Ether SCI message type.
+ * @return bool
+ * @param type the new value of mSpecializedSciMsgType
+ */
+ bool setSpecializedSciMsgType ( const Ethernet_Type type );
+
+ /**
+ * Gets the Ether SCI message SNIFFER type.
+ * @return mSnifferType
+ */
+ const Ethernet_Sniffer_Type getSnifferType ( ) const;
+
+ /**
+ * Sets the Ether SCI message SNIFFER type.
+ * @return bool
+ * @param sniffer_type the new value of mSnifferType
+ */
+ bool setSnifferType ( const Ethernet_Sniffer_Type sniffer_type );
+
+ /**
+ * Gets the Ether SCI message flags.
+ * @return mFlags
+ */
+ const Ethernet_Flags getFlags ( ) const;
+
+ /**
+ * Sets the Ether SCI message flags.
+ * @return bool
+ * @param flags the new value of mFlags
+ */
+ bool setFlags ( const Ethernet_Flags flags );
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the Ether SCI message class attributes.
+ */
+ void initAttributes ( );
+
+ /**
+ * Gets a pointer to the Ethernet processor.
+ * @return mpEthernet
+ */
+ IEthernet * getEthernet ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // ETHERSCIMSG_H
diff --git a/cesar/maximus/ethernet/inc/EtherSciMsgTest.h b/cesar/maximus/ethernet/inc/EtherSciMsgTest.h
new file mode 100644
index 0000000000..174142701c
--- /dev/null
+++ b/cesar/maximus/ethernet/inc/EtherSciMsgTest.h
@@ -0,0 +1,60 @@
+
+#ifndef ETHERSCIMSGTEST_H
+#define ETHERSCIMSGTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class EtherSciMsg;
+class IEthernet;
+class ISci;
+
+
+class EtherSciMsgTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (EtherSciMsgTest);
+ CPPUNIT_TEST (createTest);
+ CPPUNIT_TEST (dispatchMsgTest);
+ CPPUNIT_TEST (identifySpecializedSciMsgHeaderTest);
+ CPPUNIT_TEST (checkCompatibilityTest);
+ CPPUNIT_TEST (checkValidityTest);
+ CPPUNIT_TEST (displaySpecializedSciMsgHeaderTest);
+ CPPUNIT_TEST (displaySpecializedSciMsgTypeTest);
+ CPPUNIT_TEST (returnSpecializedSciMsgHeaderTest);
+ CPPUNIT_TEST (setSpecializedSciMsgHeaderTest);
+ CPPUNIT_TEST (setSpecializedSciMsgTypeTest);
+ CPPUNIT_TEST (setSnifferTypeTest);
+ CPPUNIT_TEST (setFlagsTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void createTest (void);
+ void dispatchMsgTest (void);
+ void identifySpecializedSciMsgHeaderTest (void);
+ void checkCompatibilityTest (void);
+ void checkValidityTest (void);
+ void displaySpecializedSciMsgHeaderTest (void);
+ void displaySpecializedSciMsgTypeTest(void);
+ void returnSpecializedSciMsgHeaderTest (void);
+ void setSpecializedSciMsgHeaderTest (void);
+ void setSpecializedSciMsgTypeTest (void);
+ void setSnifferTypeTest (void);
+ void setFlagsTest (void);
+
+private:
+
+ EtherSciMsg * mpEtherSciMsg;
+ IEthernet * mpEthernet;
+ ISci * mpSci;
+
+};
+
+
+#endif // ETHERSCIMSGTEST_H
diff --git a/cesar/maximus/ethernet/inc/EthernetProcessor.h b/cesar/maximus/ethernet/inc/EthernetProcessor.h
new file mode 100644
index 0000000000..9d389aa247
--- /dev/null
+++ b/cesar/maximus/ethernet/inc/EthernetProcessor.h
@@ -0,0 +1,169 @@
+/************************************************************************
+ EthernetProcessor.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/ethernet/inc/EthernetProcessor.h
+**************************************************************************/
+
+#ifndef ETHERNETPROCESSOR_H
+#define ETHERNETPROCESSOR_H
+
+#include "IEthernet.h"
+
+#include "ethernet_types.h"
+
+class ISci;
+
+
+/**
+ * class EthernetProcessor
+ */
+
+class EthernetProcessor : public IEthernet
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+ ISci * mpSci;
+ EtherCb mInterfaceCb;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ EthernetProcessor ( ISci * p_sci );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~EthernetProcessor ( );
+
+ // public methods
+ //
+
+ /**
+ * Initializes Ethernet with an interface callback function for Ether SCI message reception.
+ * @param interface_cb
+ * @return bool
+ */
+ bool init ( EtherCb interface_cb );
+
+ /**
+ * Creates an Ether SCI message.
+ * @return EtherSciMsg *
+ */
+ EtherSciMsg * createEther ( );
+
+ /**
+ * Sends an Ether SCI message.
+ * This message has to be configured before transmission.
+ * @param ether_sci_msg
+ * @return bool
+ */
+ bool sendEther ( EtherSciMsg & ether_sci_msg );
+
+ /**
+ * Called when an Ether SCI message is received.
+ * @param ether_sci_msg
+ * @return bool
+ */
+ bool receiveEther ( EtherSciMsg & ether_sci_msg );
+
+ /**
+ * Creates a TAP.
+ * @param dev name of the TAP file
+ * @return the created TAP file descriptor
+ */
+ File_Descriptor allocTap ( char * dev ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the Ethernet processor class attributes.
+ */
+ void initAttributes ( );
+
+ /**
+ * Registers the Ether SCI message creation function to the SCI server.
+ */
+ void registerEtherSciMsg ( );
+
+ /**
+ * Fills the Ether SCI message to send.
+ * @return bool
+ * @param ether_sci_msg
+ */
+ bool fillEther ( EtherSciMsg & ether_sci_msg ) const;
+
+ /**
+ * Gets a pointer to SCI.
+ * @return mpSci
+ */
+ ISci * getSci ( ) const;
+
+ /**
+ * Gets the interface callback function for Ether SCI message reception.
+ * @return mInterfaceCb
+ */
+ EtherCb getInterfaceCb ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // ETHERNETPROCESSOR_H
diff --git a/cesar/maximus/ethernet/inc/EthernetProcessorTest.h b/cesar/maximus/ethernet/inc/EthernetProcessorTest.h
new file mode 100644
index 0000000000..138c7f4f18
--- /dev/null
+++ b/cesar/maximus/ethernet/inc/EthernetProcessorTest.h
@@ -0,0 +1,44 @@
+
+#ifndef ETHERNETPROCESSORTEST_H
+#define ETHERNETPROCESSORTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class EthernetProcessor;
+class CoreEngine;
+
+
+class EthernetProcessorTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (EthernetProcessorTest);
+ CPPUNIT_TEST (initTest);
+ CPPUNIT_TEST (createEtherTest);
+ CPPUNIT_TEST (sendEtherTest);
+ CPPUNIT_TEST (receiveEtherTest);
+ CPPUNIT_TEST (allocTapTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void initTest (void);
+ void createEtherTest (void);
+ void sendEtherTest (void);
+ void receiveEtherTest (void);
+ void allocTapTest (void);
+
+private:
+
+ EthernetProcessor * mpEthernetProcessor;
+ CoreEngine * mpCoreEngine;
+
+};
+
+
+#endif // ETHERNETPROCESSORTEST_H
diff --git a/cesar/maximus/ethernet/inc/IEthernet.h b/cesar/maximus/ethernet/inc/IEthernet.h
new file mode 100644
index 0000000000..b5b6a44b19
--- /dev/null
+++ b/cesar/maximus/ethernet/inc/IEthernet.h
@@ -0,0 +1,105 @@
+/************************************************************************
+ IEthernet.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/interfaces/IEthernet.h
+**************************************************************************/
+
+#ifndef IETHERNET_H
+#define IETHERNET_H
+
+#include "system_types.h" // for 'File_Descriptor'
+
+#include <boost/function.hpp> // for 'EtherCb'
+
+class EtherSciMsg;
+
+typedef boost::function <void (EtherSciMsg &)> EtherCb;
+
+
+/**
+ * class IEthernet
+ */
+
+class IEthernet
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ IEthernet ( ) { }
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~IEthernet ( ) { }
+
+ // public methods
+ //
+
+ /**
+ * Initializes Ethernet with an interface callback function for Ether SCI message reception.
+ * @param interface_cb
+ * @return bool
+ */
+ virtual bool init ( EtherCb interface_cb ) = 0;
+
+ /**
+ * Creates an Ether SCI message.
+ * @return EtherSciMsg *
+ */
+ virtual EtherSciMsg * createEther ( ) = 0;
+
+ /**
+ * Sends an Ether SCI message.
+ * This message has to be configured before transmission.
+ * @param ether_sci_msg
+ * @return bool
+ */
+ virtual bool sendEther ( EtherSciMsg & ether_sci_msg ) = 0;
+
+ /**
+ * Called when an Ether SCI message is received.
+ * @param ether_sci_msg
+ * @return bool
+ */
+ virtual bool receiveEther ( EtherSciMsg & ether_sci_msg ) = 0;
+
+ /**
+ * Creates a TAP.
+ * @param dev name of the TAP file
+ * @return the created TAP file descriptor
+ */
+ virtual File_Descriptor allocTap ( char * dev ) const = 0;
+};
+
+
+#endif // IETHERNET_H
diff --git a/cesar/maximus/ethernet/src/EtherSciMsg.cpp b/cesar/maximus/ethernet/src/EtherSciMsg.cpp
new file mode 100644
index 0000000000..7869fb9cd3
--- /dev/null
+++ b/cesar/maximus/ethernet/src/EtherSciMsg.cpp
@@ -0,0 +1,372 @@
+/************************************************************************
+ EtherSciMsg.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/src/EtherSciMsg.cpp
+**************************************************************************/
+
+#include "EtherSciMsg.h"
+#include "IEthernet.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include "interface/sniffer/defs.h" // for 'SNIFFER_BEACON' and 'SNIFFER_MME'
+
+#include <iomanip> // for 'setfill()' and 'setw()'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+EtherSciMsg::EtherSciMsg ( IEthernet * p_ethernet ):
+mSpecializedSciMsgType(ETHERNET_TYPE_NONE),
+mSnifferType(0),
+mFlags(ETHERNET_FLAG_NONE),
+mpEthernet(NULL)
+{
+ logFunction();
+
+ if (NULL == p_ethernet)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Ethernet processor pointer is NULL");
+ }
+
+ mpEthernet = p_ethernet;
+ initAttributes ();
+}
+
+
+void EtherSciMsg::initAttributes ( )
+{
+ logFunction();
+
+ mSpecializedSciMsgHeader.version = ETHERNET_VERSION;
+ mSpecializedSciMsgHeader.type = ETHERNET_TYPE_NONE;
+ mSpecializedSciMsgHeader.sniffer_type = 0x00;
+ mSpecializedSciMsgHeader.flags = ETHERNET_FLAG_NONE;
+ mSpecializedSciMsgHeader.reserved = 0x00000000;
+}
+
+
+EtherSciMsg::~EtherSciMsg ( )
+{
+ logFunction();
+
+ if (NULL != mpEthernet)
+ {
+ mpEthernet = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+SciMsg * EtherSciMsg::create ( ) const
+{
+ logFunction();
+
+ return new EtherSciMsg (getEthernet());
+}
+
+
+bool EtherSciMsg::dispatchMsg ( )
+{
+ logFunction();
+
+ bool bDispatch = getEthernet()->receiveEther(*this);
+
+ if (!bDispatch)
+ {
+ throw Error(__PRETTY_FUNCTION__, "error while receiving Ether SCI message");
+ }
+
+ return bDispatch;
+}
+
+
+bool EtherSciMsg::identifySpecializedSciMsgHeader ( )
+{
+ logFunction();
+ bool bIdentifyHeader = false;
+
+ if (NULL != SciMsg::getSciMsgData())
+ {
+ // Set specialized SCI msg header size
+ //
+ SciMsg::setSpecializedSciMsgHeaderSize((unsigned long)sizeof(struct Ethernet_Header));
+
+ // Get specialized SCI message header contents
+ //
+ if (SciMsg::getSciMsgDataLength() >= SciMsg::getSpecializedSciMsgHeaderSize()) // check that there are enough data to get the specialized SCI message header
+ {
+ setSpecializedSciMsgHeader(*((Ethernet_Header*)SciMsg::getSciMsgData()));
+
+ // Set specialized SCI msg attributes from specialized SCI msg header
+ //
+ setSpecializedSciMsgType (static_cast<Ethernet_Type>(getSpecializedSciMsgHeader().type));
+ setSnifferType (static_cast<Ethernet_Sniffer_Type>(getSpecializedSciMsgHeader().sniffer_type));
+ setFlags (static_cast<Ethernet_Flags>(getSpecializedSciMsgHeader().flags));
+ displaySpecializedSciMsgHeader();
+ bIdentifyHeader = true;
+ }
+ else
+ {
+ errno = ENODATA;
+ throw Error(__PRETTY_FUNCTION__, "Not enough data to get the specialized SCI message header", errno);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI message data pointer is NULL");
+ }
+
+ return bIdentifyHeader;
+}
+
+
+bool EtherSciMsg::checkCompatibility ( ) const
+{
+ logFunction();
+ bool bCheck = false;
+
+ if (ETHERNET_VERSION == getSpecializedSciMsgHeader().version)
+ {
+ bCheck = SciMsg::checkCompatibility();
+ }
+
+ return bCheck;
+}
+
+
+bool EtherSciMsg::checkValidity ( ) const
+{
+ logFunction();
+ bool bCheck = false;
+
+ // Check header values ranges
+ //
+ if ((ETHERNET_TYPE_NB > getSpecializedSciMsgHeader().type)
+ && (ETHERNET_TYPE_NONE < getSpecializedSciMsgHeader().type)
+ && (SNIFFER_MME >= getSpecializedSciMsgHeader().sniffer_type)
+ && (ETHERNET_FLAG_MAX >= getSpecializedSciMsgHeader().flags))
+ {
+ bCheck = SciMsg::checkValidity();
+ }
+
+ return bCheck;
+}
+
+
+void EtherSciMsg::displaySpecializedSciMsgHeader ( ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "Ether SCI message header = " << endl;
+ clog << logger(LOG_INFO) << "\tversion = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().version) << endl;
+ displaySpecializedSciMsgType(LOG_INFO);
+ clog << logger(LOG_INFO) << "\tsniffer type = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().sniffer_type) << endl;
+ clog << logger(LOG_INFO) << "\tflags = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().flags) << endl;
+ clog << logger(LOG_INFO) << "\treserved = 0x" << setfill('0') << setw(8) << uppercase << hex << getSpecializedSciMsgHeader().reserved << endl;
+}
+
+
+void EtherSciMsg::displaySpecializedSciMsgType ( int log_level ) const
+{
+ logFunction();
+
+ switch (getSpecializedSciMsgHeader().type)
+ {
+ case 0:
+ clog << logger(log_level) << "\ttype = ETHERNET_TYPE_NONE" << endl;
+ break;
+ case 1:
+ clog << logger(log_level) << "\ttype = ETHERNET_TYPE_DATA" << endl;
+ break;
+ case 2:
+ clog << logger(log_level) << "\ttype = ETHERNET_TYPE_MME" << endl;
+ break;
+ case 3:
+ clog << logger(log_level) << "\ttype = ETHERNET_TYPE_DATA_BUFFER_ADD" << endl;
+ break;
+ case 4:
+ clog << logger(log_level) << "\ttype = ETHERNET_TYPE_MME_BUFFER_ADD" << endl;
+ break;
+ case 5:
+ clog << logger(log_level) << "\ttype = ETHERNET_TYPE_INTERFACE_BUFFER_ADD" << endl;
+ break;
+ case 6:
+ clog << logger(log_level) << "\ttype = ETHERNET_TYPE_BUFFER_RELEASED" << endl;
+ break;
+ case 7:
+ clog << logger(log_level) << "\ttype = ETHERNET_TYPE_SNIFFER" << endl;
+ break;
+ default:
+ clog << logger(log_level) << "\ttype = unknown!" << endl;
+ break;
+ }
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+// protected attribute accessor methods
+//
+
+
+void * EtherSciMsg::returnSpecializedSciMsgHeader ( ) const
+{
+ return (void*)&mSpecializedSciMsgHeader;
+}
+
+
+const Ethernet_Header & EtherSciMsg::getSpecializedSciMsgHeader ( ) const
+{
+ return mSpecializedSciMsgHeader;
+}
+
+
+bool EtherSciMsg::setSpecializedSciMsgHeader ( const Ethernet_Header & specialized_sci_msg_header )
+{
+ logFunction();
+
+ mSpecializedSciMsgHeader = specialized_sci_msg_header;
+ displaySpecializedSciMsgHeader();
+
+ return true;
+}
+
+
+IEthernet * EtherSciMsg::getEthernet ( ) const
+{
+ if (NULL == mpEthernet)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Ethernet processor pointer is NULL");
+ }
+
+ return mpEthernet;
+}
+
+
+Ethernet_Type EtherSciMsg::getSpecializedSciMsgType ( ) const
+{
+ return mSpecializedSciMsgType;
+}
+
+
+bool EtherSciMsg::setSpecializedSciMsgType ( const Ethernet_Type type )
+{
+ if ((ETHERNET_TYPE_NB <= type) || (ETHERNET_TYPE_NONE >= type))
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Ether SCI message header type is out-of-range", errno);
+ }
+ mSpecializedSciMsgType = type;
+
+ return true;
+}
+
+
+const Ethernet_Sniffer_Type EtherSciMsg::getSnifferType ( ) const
+{
+ if (SNIFFER_MME < mSnifferType)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Ether SCI message header sniffer type is out-of-range", errno);
+ }
+
+ return mSnifferType;
+}
+
+
+bool EtherSciMsg::setSnifferType ( const Ethernet_Sniffer_Type sniffer_type )
+{
+ if (SNIFFER_MME < sniffer_type)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Sniffer type is out-of-range", errno);
+ }
+ mSnifferType = sniffer_type;
+
+ return true;
+}
+
+
+const Ethernet_Flags EtherSciMsg::getFlags ( ) const
+{
+ if (ETHERNET_FLAG_MAX < mFlags)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Ether SCI message header flags are out-of-range", errno);
+ }
+
+ return mFlags;
+}
+
+
+bool EtherSciMsg::setFlags ( const Ethernet_Flags flags )
+{
+ if (ETHERNET_FLAG_MAX < flags)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Ether SCI message header flags are out-of-range", errno);
+ }
+ mFlags = flags;
+
+ return true;
+}
+
diff --git a/cesar/maximus/ethernet/src/EtherSciMsgTest.cpp b/cesar/maximus/ethernet/src/EtherSciMsgTest.cpp
new file mode 100644
index 0000000000..59a84a98ba
--- /dev/null
+++ b/cesar/maximus/ethernet/src/EtherSciMsgTest.cpp
@@ -0,0 +1,225 @@
+
+#include "EtherSciMsgTest.h"
+
+#include "EtherSciMsg.h"
+#include "EthernetProcessor.h"
+#include "SciServer.h"
+#include "SystemManager.h"
+#include "PhyProcessor.h"
+#include "NetworkClockProcessor.h"
+#include "FunctionCallManager.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (EtherSciMsgTest);
+
+
+void EtherSciMsgTest::setUp (void)
+{
+ logTest();
+
+ mpSci = new SciServer();
+ mpEthernet = new EthernetProcessor (mpSci);
+ mpEtherSciMsg = new EtherSciMsg (mpEthernet);
+ CPPUNIT_ASSERT_MESSAGE("EtherSciMsg pointer is NULL", NULL != mpEtherSciMsg);
+
+ unsigned long frameLength = 1500;
+ unsigned char frame[frameLength];
+ memset(frame, 'F', frameLength);
+ mpEtherSciMsg->setSpecializedSciMsgDataLength(frameLength);
+ mpEtherSciMsg->setSpecializedSciMsgData(frame);
+
+ Ethernet_Header header;
+ header.version = ETHERNET_VERSION;
+ header.type = ETHERNET_TYPE_SNIFFER;
+ header.sniffer_type = 0;
+ header.flags = ETHERNET_FLAG_ENCRYPTED;
+ header.reserved = 0x12345678;
+ mpEtherSciMsg->setSpecializedSciMsgHeader(header);
+}
+
+
+void EtherSciMsgTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpEtherSciMsg)
+ {
+ delete (mpEtherSciMsg);
+ mpEtherSciMsg = NULL;
+ }
+ if (NULL != mpEthernet)
+ {
+ delete (mpEthernet);
+ mpEthernet = NULL;
+ }
+ if (NULL != mpSci)
+ {
+ delete (mpSci);
+ mpSci = NULL;
+ }
+}
+
+
+void EtherSciMsgTest::createTest (void)
+{
+ logTest();
+
+ SciMsg * pSciMsg = NULL;
+ pSciMsg = mpEtherSciMsg->create();
+ CPPUNIT_ASSERT_MESSAGE("createTest failed", NULL != pSciMsg);
+
+ delete (pSciMsg);
+ pSciMsg = NULL;
+}
+
+
+void EtherSciMsgTest::dispatchMsgTest (void)
+{
+ logTest();
+
+ ISystem * pSystem = new SystemManager(mpSci);
+ CPPUNIT_ASSERT_MESSAGE("ISystem pointer is NULL", NULL != pSystem);
+
+ IFunctionCall * pFunctionCall = new FunctionCallManager (mpSci);
+ IPhy * pPhy = new PhyProcessor (mpSci);
+ INetworkClock * pNetworkClock = new NetworkClockProcessor (mpSci, pSystem, pFunctionCall, pPhy, mpEthernet);
+ pSystem->setNetworkClock(pNetworkClock);
+
+ pSystem->createStation(pSystem->getDefaultStationExecutable());
+ CPPUNIT_ASSERT_MESSAGE("dispatchMsg failed", mpEtherSciMsg->dispatchMsg());
+
+ delete (pSystem);
+ pSystem = NULL;
+
+ if (NULL != pFunctionCall)
+ {
+ delete (pFunctionCall);
+ pFunctionCall = NULL;
+ }
+ if (NULL != pPhy)
+ {
+ delete (pPhy);
+ pPhy = NULL;
+ }
+ if (NULL != pNetworkClock)
+ {
+ delete (pNetworkClock);
+ pNetworkClock = NULL;
+ }
+}
+
+
+void EtherSciMsgTest::identifySpecializedSciMsgHeaderTest (void)
+{
+ logTest();
+
+ unsigned long frameLength = 1500;
+ unsigned char frame[frameLength];
+ memset(frame, 0x01, frameLength);
+ mpEtherSciMsg->setSciMsgDataLength(frameLength);
+ mpEtherSciMsg->setSciMsgData(frame);
+ CPPUNIT_ASSERT_MESSAGE("identifySpecializedSciMsgHeader failed",
+ mpEtherSciMsg->identifySpecializedSciMsgHeader());
+}
+
+
+void EtherSciMsgTest::checkCompatibilityTest (void)
+{
+ logTest();
+
+ Sci_Msg_Header header;
+ header.version = SCI_MSG_VERSION;
+ mpEtherSciMsg->setSciMsgHeader(header);
+ CPPUNIT_ASSERT_MESSAGE("checkCompatibility failed",
+ mpEtherSciMsg->checkCompatibility());
+}
+
+
+void EtherSciMsgTest::checkValidityTest (void)
+{
+ logTest();
+
+ Sci_Msg_Header header;
+ header.magic_id = mpEtherSciMsg->getDefinedSciMsgMagicId();
+ header.msg_id = 0x8000;
+ mpEtherSciMsg->setSciMsgHeader(header);
+ CPPUNIT_ASSERT_MESSAGE("checkValidity failed",
+ mpEtherSciMsg->checkValidity());
+}
+
+
+void EtherSciMsgTest::displaySpecializedSciMsgHeaderTest (void)
+{
+ logTest();
+
+ mpEtherSciMsg->displaySpecializedSciMsgHeader();
+}
+
+
+void EtherSciMsgTest::displaySpecializedSciMsgTypeTest (void)
+{
+ logTest();
+
+ mpEtherSciMsg->displaySpecializedSciMsgType(LOG_INFO);
+}
+
+
+void EtherSciMsgTest::returnSpecializedSciMsgHeaderTest (void)
+{
+ logTest();
+
+ void * vpHeader = NULL;
+ vpHeader = mpEtherSciMsg->returnSpecializedSciMsgHeader();
+ CPPUNIT_ASSERT_MESSAGE("void pointer is NULL", NULL != vpHeader);
+ Ethernet_Header * pHeader = (Ethernet_Header *)vpHeader;
+ CPPUNIT_ASSERT_MESSAGE("returnSpecializedSciMsgHeader failed",
+ (mpEtherSciMsg->getSpecializedSciMsgHeader().version == pHeader->version)
+ && (mpEtherSciMsg->getSpecializedSciMsgHeader().type == pHeader->type)
+ && (mpEtherSciMsg->getSpecializedSciMsgHeader().sniffer_type == pHeader->sniffer_type)
+ && (mpEtherSciMsg->getSpecializedSciMsgHeader().flags == pHeader->flags)
+ && (mpEtherSciMsg->getSpecializedSciMsgHeader().reserved == pHeader->reserved));
+}
+
+
+void EtherSciMsgTest::setSpecializedSciMsgHeaderTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE("setSpecializedSciMsgHeader failed",
+ ETHERNET_TYPE_SNIFFER == mpEtherSciMsg->getSpecializedSciMsgHeader().type);
+}
+
+
+void EtherSciMsgTest::setSpecializedSciMsgTypeTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE("setSpecializedSciMsgType failed",
+ mpEtherSciMsg->setSpecializedSciMsgType(ETHERNET_TYPE_DATA)
+ && (ETHERNET_TYPE_DATA == mpEtherSciMsg->getSpecializedSciMsgType()));
+}
+
+
+void EtherSciMsgTest::setSnifferTypeTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE("setSnifferType failed",
+ mpEtherSciMsg->setSnifferType(1)
+ && (1 == mpEtherSciMsg->getSnifferType()));
+}
+
+
+void EtherSciMsgTest::setFlagsTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE("setFlags failed",
+ mpEtherSciMsg->setFlags(ETHERNET_FLAG_MAX)
+ && (ETHERNET_FLAG_MAX == mpEtherSciMsg->getFlags()));
+}
+
diff --git a/cesar/maximus/ethernet/src/EthernetProcessor.cpp b/cesar/maximus/ethernet/src/EthernetProcessor.cpp
new file mode 100644
index 0000000000..406748dd8d
--- /dev/null
+++ b/cesar/maximus/ethernet/src/EthernetProcessor.cpp
@@ -0,0 +1,292 @@
+/************************************************************************
+ EthernetProcessor.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/ethernet/src/EthernetProcessor.cpp
+**************************************************************************/
+
+#include "EthernetProcessor.h"
+
+#include "EtherSciMsg.h"
+#include "ISci.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <sys/socket.h> // for 'struct sockaddr'
+#include <linux/if.h>
+#include <linux/if_tun.h>
+#include <sys/ioctl.h>
+#include <fcntl.h> // for 'O_RDWR'
+#include <unistd.h> // for 'system()'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+EthernetProcessor::EthernetProcessor ( ISci * p_sci ):
+mpSci(NULL),
+mInterfaceCb(NULL)
+{
+ logFunction();
+
+ if (NULL == p_sci)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI pointer is NULL", errno);
+ }
+ mpSci = p_sci;
+ initAttributes();
+}
+
+
+void EthernetProcessor::initAttributes ( )
+{
+ logFunction();
+
+ registerEtherSciMsg();
+}
+
+
+EthernetProcessor::~EthernetProcessor ( )
+{
+ logFunction();
+
+ if (NULL != mpSci)
+ {
+ mpSci = NULL;
+ }
+ if (NULL != mInterfaceCb)
+ {
+ mInterfaceCb = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool EthernetProcessor::init ( EtherCb interface_cb )
+{
+ logFunction();
+
+ if (NULL == interface_cb)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Callback function address is NULL", errno);
+ }
+ mInterfaceCb = interface_cb;
+
+ return true;
+}
+
+
+EtherSciMsg * EthernetProcessor::createEther ( )
+{
+ logFunction();
+
+ return new EtherSciMsg(this);
+}
+
+
+bool EthernetProcessor::sendEther ( EtherSciMsg & ether_sci_msg )
+{
+ logFunction();
+ bool bSend = false;
+
+ if ( fillEther(ether_sci_msg) && (0 != ether_sci_msg.getSciMsgStationId()) )
+ {
+ bSend = getSci()->sendSciMsg(ether_sci_msg);
+ }
+ if (!bSend)
+ {
+ throw Error(__PRETTY_FUNCTION__, "cannot send Ether SCI message", errno);
+ }
+
+ return bSend;
+}
+
+
+bool EthernetProcessor::receiveEther ( EtherSciMsg & ether_sci_msg )
+{
+ logFunction();
+
+ // Check Ether SCI message data length and data
+ if ( (0 == ether_sci_msg.getSpecializedSciMsgDataLength())
+ || (NULL == ether_sci_msg.getSpecializedSciMsgData()) )
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "received Ether SCI message is incorrect", errno);
+ }
+
+ // Go back up to user
+ if (NULL != getInterfaceCb())
+ {
+ getInterfaceCb()(ether_sci_msg);
+ }
+
+ return true;
+}
+
+
+File_Descriptor EthernetProcessor::allocTap ( char * dev ) const
+{
+ logFunction();
+ int etherLogFileDescriptor = -1;
+
+ if (0 > (etherLogFileDescriptor = open("/dev/net/tun", O_RDWR)))
+ {
+ throw Error(__PRETTY_FUNCTION__, "open /dev/net/tun failed", errno);
+ }
+ else
+ {
+ struct ifreq ifr;
+ memset(&ifr, 0, sizeof(ifr));
+ ifr.ifr_flags = IFF_TAP; // TAP device
+ if (* dev)
+ {
+ strncpy(ifr.ifr_name, dev, IFNAMSIZ);
+ }
+ if (0 > ioctl(etherLogFileDescriptor, TUNSETIFF, (void *)&ifr))
+ {
+ close(etherLogFileDescriptor);
+ etherLogFileDescriptor = -1;
+ if (EPERM == errno)
+ {
+ throw Error(__PRETTY_FUNCTION__, "please launch the program with root rights", errno);
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "ioctl failed", errno);
+ }
+ }
+ else
+ {
+ //system("wireshark");
+ strcpy(dev, ifr.ifr_name);
+ }
+ }
+
+ return etherLogFileDescriptor;
+}
+
+
+// private methods
+//
+
+
+void EthernetProcessor::registerEtherSciMsg ( )
+{
+ logFunction();
+
+ if (!getSci()->registerSpecializedSciMsg(SCI_MSG_TYPE_ETHERNET, new EtherSciMsg((IEthernet *)this)))
+ {
+ throw Error(__PRETTY_FUNCTION__, "cannot register Ether SCI message to SCI");
+ }
+}
+
+
+bool EthernetProcessor::fillEther ( EtherSciMsg & ether_sci_msg ) const
+{
+ logFunction();
+ bool bFill = false;
+
+ // Fill specialized SCI msg header
+ //
+ struct Ethernet_Header ethernetHeader;
+ ethernetHeader.version = ether_sci_msg.getSpecializedSciMsgHeader().version;
+ ethernetHeader.type = ether_sci_msg.getSpecializedSciMsgType();
+ ethernetHeader.sniffer_type = ether_sci_msg.getSnifferType();
+ ethernetHeader.flags = ether_sci_msg.getFlags();
+ ethernetHeader.reserved = ether_sci_msg.getSpecializedSciMsgHeader().reserved;
+
+ // Set specialized SCI msg header
+ //
+ bFill = ether_sci_msg.setSpecializedSciMsgHeader(ethernetHeader);
+
+ // Fill specialized SCI msg attributes:
+ // - header size
+ //
+ bFill &= ether_sci_msg.setSpecializedSciMsgHeaderSize(sizeof(struct Ethernet_Header));
+
+ // Fill SCI msg attributes:
+ // - type
+ //
+ bFill &= ether_sci_msg.setSciMsgType(SCI_MSG_TYPE_ETHERNET);
+ bFill &= getSci()->fillSciMsg(ether_sci_msg);
+
+ return bFill;
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+ISci * EthernetProcessor::getSci ( ) const
+{
+ if (NULL == mpSci)
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI pointer is NULL");
+ }
+
+ return mpSci;
+}
+
+
+EtherCb EthernetProcessor::getInterfaceCb ( ) const
+{
+ return mInterfaceCb;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/ethernet/src/EthernetProcessorTest.cpp b/cesar/maximus/ethernet/src/EthernetProcessorTest.cpp
new file mode 100644
index 0000000000..8fee360a58
--- /dev/null
+++ b/cesar/maximus/ethernet/src/EthernetProcessorTest.cpp
@@ -0,0 +1,139 @@
+
+#include "EthernetProcessorTest.h"
+
+#include "EthernetProcessor.h"
+#include "CoreEngine.h"
+#include "ISystem.h"
+#include "EtherSciMsg.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (EthernetProcessorTest);
+
+bool bTest = false;
+
+void interfaceCbTest ( EtherSciMsg & ether )
+{
+ logTest();
+
+ bTest = true;
+}
+
+
+void EthernetProcessorTest::setUp (void)
+{
+ logTest();
+
+ mpCoreEngine = new CoreEngine();
+ mpEthernetProcessor = (EthernetProcessor *)mpCoreEngine->getEthernet();
+ CPPUNIT_ASSERT_MESSAGE ( "Ethernet processor pointer is NULL", NULL != mpEthernetProcessor );
+}
+
+
+void EthernetProcessorTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpEthernetProcessor)
+ {
+ mpEthernetProcessor = NULL;
+ }
+ if (NULL != mpCoreEngine)
+ {
+ delete (mpCoreEngine);
+ mpCoreEngine = NULL;
+ }
+}
+
+
+void EthernetProcessorTest::initTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE ( "init failed", mpEthernetProcessor->init(&interfaceCbTest) );
+}
+
+
+void EthernetProcessorTest::createEtherTest (void)
+{
+ logTest();
+
+ EtherSciMsg * pEtherSciMsg = mpEthernetProcessor->createEther();
+ CPPUNIT_ASSERT_MESSAGE ( "createEther failed", NULL != pEtherSciMsg );
+
+ delete (pEtherSciMsg);
+ pEtherSciMsg = NULL;
+}
+
+
+void EthernetProcessorTest::sendEtherTest (void)
+{
+ logTest();
+
+ EtherSciMsg * pEtherSciMsg = mpEthernetProcessor->createEther();
+ CPPUNIT_ASSERT_MESSAGE ( "Ether SCI message pointer is NULL", NULL != pEtherSciMsg );
+
+ // create the destination station
+ Sci_Msg_Station_Id stationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+ mpCoreEngine->getSystem()->updateStationStatus(stationId, MAXIMUS_STATION_STATUS_IDLE);
+ pEtherSciMsg->setSciMsgStationId(stationId);
+
+ CPPUNIT_ASSERT_MESSAGE ( "Ether SCI message has not been sent", mpEthernetProcessor->sendEther(*pEtherSciMsg) );
+
+ mpCoreEngine->getSystem()->removeStation(stationId);
+
+ if (NULL != pEtherSciMsg)
+ {
+ delete (pEtherSciMsg);
+ pEtherSciMsg = NULL;
+ }
+}
+
+
+void EthernetProcessorTest::receiveEtherTest (void)
+{
+ logTest();
+
+ EtherSciMsg * pEtherSciMsg = mpEthernetProcessor->createEther();
+
+ unsigned long length = 100;
+ unsigned char payload[length];
+ memset(payload, 'M', length);
+ pEtherSciMsg->setSpecializedSciMsgDataLength(length);
+ pEtherSciMsg->setSpecializedSciMsgData(payload);
+
+ // create the destination station
+ Sci_Msg_Station_Id stationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ CPPUNIT_ASSERT_MESSAGE ( "receiveEther failed",
+ mpEthernetProcessor->receiveEther(*pEtherSciMsg) );
+
+ mpCoreEngine->getSystem()->removeStation(stationId);
+
+ if (NULL != pEtherSciMsg)
+ {
+ delete (pEtherSciMsg);
+ pEtherSciMsg = NULL;
+ }
+}
+
+
+void EthernetProcessorTest::allocTapTest (void)
+{
+ logTest();
+
+ try
+ {
+ char dev[] = "tap0\0";
+ CPPUNIT_ASSERT_MESSAGE ( "allocTap failed",
+ 0 <= mpEthernetProcessor->allocTap(dev) );
+ }
+ catch (...)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "allocTap failed", (EPERM == errno) || (EACCES == errno) );
+ }
+}
+
diff --git a/cesar/maximus/functioncall/Module b/cesar/maximus/functioncall/Module
new file mode 100644
index 0000000000..061de8e25d
--- /dev/null
+++ b/cesar/maximus/functioncall/Module
@@ -0,0 +1,5 @@
+SOURCES := FunctionCallManager.cpp FunctionSciMsg.cpp FunctionCallParameter.cpp
+ifdef UNITTEST
+SOURCES += FunctionCallManagerTest.cpp FunctionSciMsgTest.cpp IFunctionCallTest.cpp FunctionCallParameterTest.cpp
+endif
+HOST_INCLUDES += maximus/functioncall/inc
diff --git a/cesar/maximus/functioncall/inc/FunctionCallManager.h b/cesar/maximus/functioncall/inc/FunctionCallManager.h
new file mode 100644
index 0000000000..b7027285b6
--- /dev/null
+++ b/cesar/maximus/functioncall/inc/FunctionCallManager.h
@@ -0,0 +1,147 @@
+/************************************************************************
+ FunctionCallManager.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/functioncall/inc/FunctionCallManager.h
+**************************************************************************/
+
+#ifndef FUNCTIONCALLMANAGER_H
+#define FUNCTIONCALLMANAGER_H
+
+#include "IFunctionCall.h"
+
+#include "networkclock_types.h"
+
+class FunctionSciMsg;
+class ISci;
+
+
+/**
+ * class FunctionCallManager
+ */
+
+class FunctionCallManager : public IFunctionCall
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+ CallbacksList mListOfCallbacks;
+ ISci * mpSciServer;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ FunctionCallManager ( ISci * p_sci_server );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~FunctionCallManager ( );
+
+ // public methods
+ //
+
+ /**
+ * @return FunctionSciMsg *
+ */
+ FunctionSciMsg * createMsg ( );
+
+ /**
+ * @return bool
+ * @param msg_id
+ * @param callback_address
+ */
+ bool registerCallback ( Function_Call_Msg_Id msg_id, const CallbackFunction & callback_address );
+
+ /**
+ * @return bool
+ * @param p_function_sci_msg
+ */
+ bool sendMsg ( FunctionSciMsg * p_function_sci_msg_to_send );
+
+ /**
+ * @return bool
+ * @param function_sci_msg
+ */
+ bool sendMsg ( FunctionSciMsg & function_sci_msg_to_send );
+
+ /**
+ * @return bool
+ * @param function_sci_msg
+ */
+ bool receiveMsg ( const FunctionSciMsg & function_sci_msg );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return pointer to mListOfCallbacks
+ */
+ CallbacksList * getListOfCallbacks ( );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( );
+
+ bool registerFunctionSciMsg ( );
+
+ void displayListOfCallbacks ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // FUNCTIONCALLMANAGER_H
diff --git a/cesar/maximus/functioncall/inc/FunctionCallManagerTest.h b/cesar/maximus/functioncall/inc/FunctionCallManagerTest.h
new file mode 100644
index 0000000000..944b32d857
--- /dev/null
+++ b/cesar/maximus/functioncall/inc/FunctionCallManagerTest.h
@@ -0,0 +1,43 @@
+
+#ifndef FUNCTIONCALLMANAGERTEST_H
+#define FUNCTIONCALLMANAGERTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class FunctionCallManager;
+class SciServer;
+class FunctionSciMsg;
+
+void userFunction1 ( const FunctionSciMsg & function_sci_msg );
+void userFunction2 ( const FunctionSciMsg & function_sci_msg );
+void userFunction3 ( const FunctionSciMsg & function_sci_msg );
+
+
+class FunctionCallManagerTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (FunctionCallManagerTest);
+ CPPUNIT_TEST (registerCallbackTest);
+ CPPUNIT_TEST (receiveMsgTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void registerCallbackTest (void);
+ void receiveMsgTest (void);
+
+private:
+
+ FunctionCallManager * mpFunctionCallManager;
+ SciServer * mpSciServer;
+
+};
+
+
+#endif // FUNCTIONCALLMANAGERTEST_H
diff --git a/cesar/maximus/functioncall/inc/FunctionCallParameter.h b/cesar/maximus/functioncall/inc/FunctionCallParameter.h
new file mode 100644
index 0000000000..f96b5c75b0
--- /dev/null
+++ b/cesar/maximus/functioncall/inc/FunctionCallParameter.h
@@ -0,0 +1,167 @@
+/************************************************************************
+ FunctionCallParameter.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/functioncall/inc/FunctionCallParameter.h
+**************************************************************************/
+
+#ifndef FUNCTIONCALLPARAMETER_H
+#define FUNCTIONCALLPARAMETER_H
+
+#include <string>
+
+
+/**
+ * class FunctionCallParameter
+ */
+
+class FunctionCallParameter
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ std::string mName;
+ unsigned long mValueLength;
+ unsigned char * mpValue;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ FunctionCallParameter ( );
+
+ /**
+ * Copy Constructor
+ */
+ FunctionCallParameter ( const FunctionCallParameter & parameter );
+
+ /**
+ * Constructor
+ */
+ FunctionCallParameter ( std::string name,
+ unsigned long value_length,
+ unsigned char * p_value );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~FunctionCallParameter ( );
+
+ // public methods
+ //
+
+ bool operator== ( const FunctionCallParameter & parameter ) const;
+
+ FunctionCallParameter & operator= ( const FunctionCallParameter & parameter );
+
+ void displayParameter ( ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Get the value of mName
+ * @return the value of mName
+ */
+ std::string getName ( ) const;
+
+ /**
+ * Set the value of mName
+ * @return bool
+ * @param name the new value of mName
+ */
+ bool setName ( const std::string name );
+
+ /**
+ * Set the value of mName
+ * @return bool
+ * @param name the new value of mName
+ */
+ bool setName ( const char * p_name );
+
+ /**
+ * Get the value of mValue Length
+ * @return the value of mValueLength
+ */
+ unsigned long getValueLength ( ) const;
+
+ /**
+ * Set the value of mValueLength
+ * @return bool
+ * @param value_length the new value of mValueLength
+ */
+ bool setValueLength ( const unsigned long value_length );
+
+ /**
+ * @return mpValue
+ */
+ unsigned char * getValue ( ) const;
+
+ /**
+ * @return bool
+ * @param p_value the new value of mpValue
+ */
+ bool setValue ( const unsigned char * p_value );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // FUNCTIONCALLPARAMETER_H
diff --git a/cesar/maximus/functioncall/inc/FunctionCallParameterTest.h b/cesar/maximus/functioncall/inc/FunctionCallParameterTest.h
new file mode 100644
index 0000000000..147d6e8fb3
--- /dev/null
+++ b/cesar/maximus/functioncall/inc/FunctionCallParameterTest.h
@@ -0,0 +1,40 @@
+
+#ifndef FUNCTIONCALLPARAMETERTEST_H
+#define FUNCTIONCALLPARAMETERTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class FunctionCallParameter;
+
+
+class FunctionCallParameterTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (FunctionCallParameterTest);
+ CPPUNIT_TEST (setNameTest);
+ CPPUNIT_TEST (setValueTest);
+ CPPUNIT_TEST (setValueLengthTest);
+ CPPUNIT_TEST (constructorsTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void setNameTest (void);
+ void setValueTest (void);
+ void setValueLengthTest (void);
+ void constructorsTest (void);
+
+private:
+
+ FunctionCallParameter * mpFunctionCallParameter;
+
+};
+
+
+#endif // FUNCTIONCALLPARAMETERTEST_H
diff --git a/cesar/maximus/functioncall/inc/FunctionSciMsg.h b/cesar/maximus/functioncall/inc/FunctionSciMsg.h
new file mode 100644
index 0000000000..85c900945b
--- /dev/null
+++ b/cesar/maximus/functioncall/inc/FunctionSciMsg.h
@@ -0,0 +1,332 @@
+/************************************************************************
+ FunctionSciMsg.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/functioncall/inc/FunctionSciMsg.h
+**************************************************************************/
+
+#ifndef FUNCTIONSCIMSG_H
+#define FUNCTIONSCIMSG_H
+
+#include "SciMsg.h"
+
+#include "functioncall_types.h"
+#include "sci_types.h"
+
+#include <vector>
+#include <string>
+#include <ostream>
+
+class IFunctionCall;
+class FunctionCallParameter;
+
+typedef std::vector<FunctionCallParameter> ParametersList;
+
+
+/**
+ * class FunctionSciMsg
+ */
+
+class FunctionSciMsg : public SciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ // Get from specialized SCI message header
+ //
+ Function_Call_Type mSpecializedSciMsgType;
+ static Function_Call_Msg_Id mSpecializedSciMsgId; // to send to station
+ Function_Call_Parameters_Number mSpecializedSciMsgParametersNumber;
+ Function_Call_Flags mSpecializedSciMsgFlags;
+
+ // Specialized SCI msg header
+ //
+ Function_Call_Header mSpecializedSciMsgHeader;
+
+ // Unique string identifier for function call
+ //
+ std::string mFunctionName;
+
+ // Function parameters
+ //
+ ParametersList mListOfParameters;
+
+ IFunctionCall * mpFunctionCallManager;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ FunctionSciMsg ( IFunctionCall * p_function_call_manager );
+
+ /**
+ * Copy Constructors
+ */
+ FunctionSciMsg ( const FunctionSciMsg & function_sci_msg );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~FunctionSciMsg ( );
+
+ // public methods
+ //
+
+ /**
+ * @return SciMsg *
+ */
+ SciMsg * create ( ) const;
+
+ /**
+ * return bool
+ */
+ bool dispatchMsg ( );
+
+ /**
+ * @return bool
+ */
+ bool identifySpecializedSciMsgHeader ( );
+
+ /**
+ * @return bool
+ */
+ bool checkCompatibility ( ) const;
+
+ /**
+ * @return bool
+ * @param function_argument_to_add
+ */
+ bool addParameter ( const FunctionCallParameter & function_argument_to_add );
+
+ /**
+ * @return bool
+ * @param name
+ * Remove the parameter named name from the function SCI message.
+ */
+ bool removeParameter ( const std::string & name );
+
+ /**
+ * @return bool
+ * @param name_of_parameter_to_get
+ * @param p_data
+ */
+ bool bindParameter ( const std::string name_of_parameter_to_get, unsigned long & data_length, unsigned char * p_data ) const;
+
+ /**
+ * @return bool
+ */
+ bool identifyFunctionName ( );
+
+ /**
+ * @return bool
+ */
+ bool identifyParameters ( );
+
+ /**
+ * @return bool
+ */
+ bool fillSpecializedSciMsgToSend ( );
+
+ void displaySpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Display the specialized SCI message type.
+ */
+ void displaySpecializedSciMsgType ( int log_level ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Get the value of mSpecializedSciMsgType
+ * @return the value of mSpecializedSciMsgType
+ */
+ Function_Call_Type getSpecializedSciMsgType ( ) const;
+
+ /**
+ * Set the value of mSpecializedSciMsgType
+ * @return bool
+ * @param type the new value of mSpecializedSciMsgType
+ */
+ bool setSpecializedSciMsgType ( const Function_Call_Type type );
+
+ /**
+ * Get the value of mSpecializedSciMsgHeader.msg_id
+ * @return the value of mSpecializedSciMsgHeader.msg_id
+ */
+ Function_Call_Msg_Id getMsgId ( ) const;
+
+ /**
+ * Set the value of mSpecializedSciMsgHeader.msg_id
+ * @return bool
+ */
+ bool setMsgId ( const Function_Call_Msg_Id msg_id );
+
+ /**
+ * Get the value of mSpecializedSciMsgId
+ * @return the value of mSpecializedSciMsgId
+ */
+ Function_Call_Msg_Id getSpecializedSciMsgId ( ) const;
+
+ /**
+ * Increment the value of mSpecializedSciMsgId
+ * @return bool
+ */
+ bool incrementSpecializedSciMsgId ( );
+
+ /**
+ * Get the value of mSpecializedSciMsgParametersNumber
+ * @return the value of mSpecializedSciMsgParametersNumber
+ */
+ Function_Call_Parameters_Number getSpecializedSciMsgParametersNumber ( ) const;
+
+ /**
+ * Set the value of mSpecializedSciMsgParametersNumber
+ * @return bool
+ * @param number_of_parameters the new value of mSpecializedSciMsgParametersNumber
+ */
+ bool setSpecializedSciMsgParametersNumber ( const Function_Call_Parameters_Number number_of_parameters );
+
+ /**
+ * Get the value of mSpecializedSciMsgFlags
+ * @return the value of mSpecializedSciMsgFlags
+ */
+ Function_Call_Flags getSpecializedSciMsgFlags ( ) const;
+
+ /**
+ * Set the value of mSpecializedSciMsgFlags
+ * @return bool
+ * @param flags the new value of mSpecializedSciMsgFlags
+ */
+ bool setSpecializedSciMsgFlags ( const Function_Call_Flags flags );
+
+ /**
+ * Set the value of mSpecializedSciMsgHeader.reserved
+ * @return bool
+ */
+ bool setReserved ( const uint16_t reserved );
+
+ /**
+ * Get the value of mSpecializedSciMsgHeader
+ * @return the value of mSpecializedSciMsgHeader into a void pointer
+ */
+ void * returnSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * @return mSpecializedSciMsgHeader
+ */
+ const Function_Call_Header & getSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * @return bool
+ * @param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader
+ */
+ bool setSpecializedSciMsgHeader ( const Function_Call_Header & specialized_sci_msg_header );
+
+ /**
+ * Get the value of mFunctionName
+ * @return the value of mFunctionName
+ */
+ std::string getFunctionName ( ) const;
+
+ /**
+ * Set the value of mFunctionName
+ * @return bool
+ * @param name the new value of mFunctionName
+ */
+ bool setFunctionName ( const std::string name );
+
+ /**
+ * Get the value of mListOfParameters
+ * @return the value of mListOfParameters
+ */
+ const ParametersList & getListOfParameters ( ) const;
+
+ /**
+ * Set the value of mListOfParameters
+ * @return bool
+ * @param list_of_parameters the new value of mListOfParameters
+ */
+ bool setListOfParameters ( const ParametersList & list_of_parameters );
+
+ /**
+ * Get the value of mpFunctionCallManager
+ * @return mpFunctionCallManager
+ */
+ IFunctionCall * getFunctionCallManager () const;
+
+ /**
+ * Set the value of mpFunctionCallManager
+ * @return bool
+ * @param p_function_call_manager the new value of mpFunctionCallManager
+ */
+ bool setFunctionCallManager ( IFunctionCall * p_function_call_manager );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( );
+
+ void displayFunctionName ( ) const;
+
+ void displayParameter ( unsigned int parameter_iterator ) const;
+
+ void displayListOfParameters ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // FUNCTIONSCIMSG_H
diff --git a/cesar/maximus/functioncall/inc/FunctionSciMsgTest.h b/cesar/maximus/functioncall/inc/FunctionSciMsgTest.h
new file mode 100644
index 0000000000..98fb97e785
--- /dev/null
+++ b/cesar/maximus/functioncall/inc/FunctionSciMsgTest.h
@@ -0,0 +1,44 @@
+
+#ifndef FUNCTIONSCIMSGTEST_H
+#define FUNCTIONSCIMSGTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class FunctionSciMsg;
+class FunctionCallManager;
+class SciServer;
+
+
+class FunctionSciMsgTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (FunctionSciMsgTest);
+ CPPUNIT_TEST (addParameterTest);
+ CPPUNIT_TEST (bindParameterTest);
+ CPPUNIT_TEST (fillSpecializedSciMsgToSendTest);
+ CPPUNIT_TEST (setSpecializedSciMsgFlagsTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void addParameterTest (void);
+ void bindParameterTest (void);
+ void fillSpecializedSciMsgToSendTest (void);
+ void setSpecializedSciMsgFlagsTest (void);
+
+private:
+
+ FunctionSciMsg * mpFunctionSciMsg;
+ FunctionCallManager * mpFunctionCallManager;
+ SciServer * mpSciServer;
+
+};
+
+
+#endif // FUNCTIONSCIMSGTEST_H
diff --git a/cesar/maximus/functioncall/inc/IFunctionCall.h b/cesar/maximus/functioncall/inc/IFunctionCall.h
new file mode 100644
index 0000000000..091c8391a1
--- /dev/null
+++ b/cesar/maximus/functioncall/inc/IFunctionCall.h
@@ -0,0 +1,116 @@
+/************************************************************************
+ IFunctionCall.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/interfaces/IFunctionCall.h
+**************************************************************************/
+
+#ifndef IFUNCTIONCALL_H
+#define IFUNCTIONCALL_H
+
+#include "functioncall_types.h"
+
+#include <boost/function.hpp> // for 'CallbackFunction'
+#include <map>
+
+class FunctionSciMsg;
+
+typedef boost::function <void (const FunctionSciMsg &)> CallbackFunction;
+
+struct compareMsgId
+{
+ bool operator( ) ( Function_Call_Msg_Id msg_id1, Function_Call_Msg_Id msg_id2 ) const
+ {
+ return msg_id1 < msg_id2;
+ }
+};
+typedef std::multimap<Function_Call_Msg_Id, CallbackFunction, compareMsgId> CallbacksList;
+
+
+/**
+ * class IFunctionCall
+ */
+
+class IFunctionCall
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ IFunctionCall ( ) { }
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~IFunctionCall ( ) { }
+
+ // public methods
+ //
+
+ /**
+ * @return FunctionSciMsg *
+ */
+ virtual FunctionSciMsg * createMsg ( ) = 0;
+
+ /**
+ * @return bool
+ * @param function_sci_msg
+ * @param callback_address
+ */
+ virtual bool registerCallback ( Function_Call_Msg_Id msg_id, const CallbackFunction & callback_address ) = 0;
+
+ /**
+ * @return bool
+ * @param function_sci_msg
+ */
+ virtual bool sendMsg ( FunctionSciMsg * p_function_sci_msg_to_send ) = 0;
+
+ /**
+ * @return bool
+ * @param function_sci_msg
+ */
+ virtual bool sendMsg ( FunctionSciMsg & function_sci_msg_to_send ) = 0;
+
+ /**
+ * @return bool
+ * @param function_sci_msg
+ */
+ virtual bool receiveMsg ( const FunctionSciMsg & function_sci_msg ) = 0;
+
+ /**
+ * @return pointer to mListOfCallbacks
+ */
+ virtual CallbacksList * getListOfCallbacks ( ) = 0;
+
+};
+
+
+#endif // IFUNCTIONCALL_H
diff --git a/cesar/maximus/functioncall/inc/IFunctionCallTest.h b/cesar/maximus/functioncall/inc/IFunctionCallTest.h
new file mode 100644
index 0000000000..68fd2edca9
--- /dev/null
+++ b/cesar/maximus/functioncall/inc/IFunctionCallTest.h
@@ -0,0 +1,34 @@
+
+#ifndef IFUNCTIONCALLTEST_H
+#define IFUNCTIONCALLTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class FunctionSciMsg;
+
+void userFunction ( const FunctionSciMsg & function_sci_msg );
+
+
+class IFunctionCallTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (IFunctionCallTest);
+ CPPUNIT_TEST (userTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void userTest (void);
+
+private:
+
+};
+
+
+#endif // IFUNCTIONCALLTEST_H
diff --git a/cesar/maximus/functioncall/src/FunctionCallManager.cpp b/cesar/maximus/functioncall/src/FunctionCallManager.cpp
new file mode 100644
index 0000000000..15c74da849
--- /dev/null
+++ b/cesar/maximus/functioncall/src/FunctionCallManager.cpp
@@ -0,0 +1,316 @@
+/************************************************************************
+ FunctionCallManager.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/functioncall/src/FunctionCallManager.cpp
+**************************************************************************/
+
+#include "FunctionCallManager.h"
+
+#include "FunctionSciMsg.h"
+#include "ISci.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <netinet/in.h> // for 'htonl()' and 'htons()'
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+FunctionCallManager::FunctionCallManager ( ISci * p_sci_server ):
+mpSciServer(NULL)
+{
+ logFunction();
+
+ initAttributes();
+ if (NULL != p_sci_server)
+ {
+ mpSciServer = p_sci_server;
+ registerFunctionSciMsg();
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL", errno);
+ }
+}
+
+
+void FunctionCallManager::initAttributes ( )
+{
+ logFunction();
+}
+
+
+FunctionCallManager::~FunctionCallManager ( )
+{
+ logFunction();
+
+ if (!mListOfCallbacks.empty())
+ {
+ mListOfCallbacks.clear();
+ }
+ if (NULL != mpSciServer)
+ {
+ mpSciServer = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+// Called by user to create a message to send
+//
+FunctionSciMsg * FunctionCallManager::createMsg ( )
+{
+ logFunction();
+
+ return new FunctionSciMsg(this);
+}
+
+
+// Called by user before a message is sent
+//
+bool FunctionCallManager::registerCallback ( Function_Call_Msg_Id msg_id, const CallbackFunction & callback_address )
+{
+ logFunction();
+ bool bRegister = false;
+
+ if (NULL != callback_address)
+ {
+ mListOfCallbacks.insert(CallbacksList::value_type(msg_id, callback_address));
+ bRegister = true;
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "callback address is NULL!" << endl;
+ }
+
+ return bRegister;
+}
+
+
+// Called by user to send a configured message
+//
+bool FunctionCallManager::sendMsg ( FunctionSciMsg * p_function_sci_msg_to_send )
+{
+ logFunction();
+ bool bSend = false;
+
+ if (NULL != p_function_sci_msg_to_send)
+ {
+ bSend = sendMsg(*p_function_sci_msg_to_send);
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Function SCI message pointer is NULL", errno);
+ }
+
+ return bSend;
+}
+
+
+// Called by user to send a configured message
+//
+bool FunctionCallManager::sendMsg ( FunctionSciMsg & function_sci_msg_to_send )
+{
+ logFunction();
+ bool bSend = false;
+
+ clog << logger(LOG_COM) << "sending function call SCI message..." << endl;
+ displayListOfCallbacks();
+
+ // Fill specialized SCI msg attributes
+ // Fill specialized SCI msg data length and specialized SCI msg data
+ //
+ bSend = function_sci_msg_to_send.fillSpecializedSciMsgToSend();
+
+ // Fill specialized SCI msg header
+ //
+ struct Function_Call_Header functionSciMsgHeader = { FUNCTION_CALL_VERSION,
+ static_cast<uint8_t>(function_sci_msg_to_send.getSpecializedSciMsgType()),
+ function_sci_msg_to_send.getSpecializedSciMsgId(),
+ static_cast<uint8_t>(function_sci_msg_to_send.getSpecializedSciMsgParametersNumber()),
+ 0x00, // flags
+ 0x0000 }; // reserved
+
+ // Set specialized SCI msg header
+ //
+ bSend &= function_sci_msg_to_send.setSpecializedSciMsgHeader(functionSciMsgHeader);
+
+ // As specialized SCI msg header will be sent on an output pipe, 'hton' functions have to be called
+ //
+ function_sci_msg_to_send.setMsgId(htons(function_sci_msg_to_send.getSpecializedSciMsgHeader().msg_id));
+ function_sci_msg_to_send.setReserved(htons(function_sci_msg_to_send.getSpecializedSciMsgHeader().reserved));
+
+ // Fill specialized SCI msg attributes:
+ // - header size
+ //
+ bSend &= function_sci_msg_to_send.setSpecializedSciMsgHeaderSize(sizeof(struct Function_Call_Header));
+
+ // Fill SCI msg attributes:
+ // - type
+ //
+ bSend &= function_sci_msg_to_send.setSciMsgType(SCI_MSG_TYPE_FUNCTION_CALL);
+
+ if (bSend)
+ {
+ if (NULL != mpSciServer)
+ {
+ bSend = mpSciServer->fillSciMsg(function_sci_msg_to_send);
+ bSend &= mpSciServer->sendSciMsg(function_sci_msg_to_send);
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "function SCI message cannot be sent because it is not correctly filled in!" << endl;
+ }
+
+ return bSend;
+}
+
+
+// Called by FunctionSciMsg when receiving a message
+//
+bool FunctionCallManager::receiveMsg ( const FunctionSciMsg & function_sci_msg )
+{
+ logFunction();
+ bool bReceive = false;
+
+ displayListOfCallbacks();
+ if (!mListOfCallbacks.empty())
+ {
+ for (CallbacksList::const_iterator it = mListOfCallbacks.begin(); it != mListOfCallbacks.end(); ++it)
+ {
+ if (function_sci_msg.getSpecializedSciMsgHeader().msg_id == it->first)
+ {
+ clog << logger(LOG_INFO) << "=> callback" << endl;
+ (it->second) (function_sci_msg);
+ bReceive = true;
+ }
+ }
+ }
+ if (bReceive)
+ {
+ mListOfCallbacks.erase(function_sci_msg.getSpecializedSciMsgHeader().msg_id);
+ }
+ else
+ {
+ clog << logger(LOG_INFO) << "=> no callback!" << endl;
+ }
+
+ return bReceive;
+}
+
+
+CallbacksList * FunctionCallManager::getListOfCallbacks ( )
+{
+ return &mListOfCallbacks;
+}
+
+
+// private methods
+//
+
+
+bool FunctionCallManager::registerFunctionSciMsg ( )
+{
+ logFunction();
+ bool bRegister = false;
+
+ if (NULL != mpSciServer)
+ {
+ bRegister = mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_FUNCTION_CALL, new FunctionSciMsg(this));
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+
+ return bRegister;
+}
+
+
+void FunctionCallManager::displayListOfCallbacks ( ) const
+{
+ logFunction();
+ clog << logger(LOG_INFO) << "list of callbacks = " << endl;
+
+ if (!mListOfCallbacks.empty())
+ {
+ for (CallbacksList::const_iterator it = mListOfCallbacks.begin(); it != mListOfCallbacks.end(); ++it)
+ {
+ clog << logger(LOG_INFO) << "\t[msg id = 0x" << setfill('0') << setw(4) << uppercase << hex << it->first << ", callback address = " << &(it->second) << "]" << dec << endl;
+ }
+ }
+ else
+ {
+ clog << logger(LOG_INFO) << "\tempty!" << endl;
+ }
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/functioncall/src/FunctionCallManagerTest.cpp b/cesar/maximus/functioncall/src/FunctionCallManagerTest.cpp
new file mode 100644
index 0000000000..e37d0f209d
--- /dev/null
+++ b/cesar/maximus/functioncall/src/FunctionCallManagerTest.cpp
@@ -0,0 +1,128 @@
+
+#include "FunctionCallManagerTest.h"
+
+#include "FunctionCallManager.h"
+#include "SciServer.h"
+#include "FunctionSciMsg.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (FunctionCallManagerTest);
+
+
+void FunctionCallManagerTest::setUp (void)
+{
+ logTest();
+
+ try
+ {
+ mpSciServer = new SciServer();
+ mpFunctionCallManager = new FunctionCallManager(mpSciServer);
+ }
+ catch (Error &e)
+ {
+ e.display();
+ }
+}
+
+
+void FunctionCallManagerTest::tearDown (void)
+{
+ logTest();
+
+ try
+ {
+ if (NULL != mpFunctionCallManager)
+ {
+ delete (mpFunctionCallManager);
+ mpFunctionCallManager = NULL;
+ }
+ if (NULL != mpSciServer)
+ {
+ delete (mpSciServer);
+ mpSciServer = NULL;
+ }
+ }
+ catch (Error &e)
+ {
+ e.display();
+ }
+}
+
+
+void FunctionCallManagerTest::registerCallbackTest (void)
+{
+ logTest();
+
+ try
+ {
+ if (NULL != mpFunctionCallManager)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "registerCallback failed",
+ mpFunctionCallManager->registerCallback(1, &userFunction1) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "registerCallback failed",
+ mpFunctionCallManager->registerCallback(2, &userFunction2) );
+ }
+ }
+ catch (Error &e)
+ {
+ e.display();
+ }
+}
+
+
+void FunctionCallManagerTest::receiveMsgTest (void)
+{
+ logTest();
+
+ try
+ {
+ if (NULL != mpFunctionCallManager)
+ {
+ FunctionSciMsg functionSciMsg(mpFunctionCallManager);
+
+ CPPUNIT_ASSERT_MESSAGE ( "registerCallback failed",
+ mpFunctionCallManager->registerCallback(functionSciMsg.getSpecializedSciMsgHeader().msg_id, &userFunction1) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "registerCallback failed",
+ mpFunctionCallManager->registerCallback(2, &userFunction2) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "registerCallback failed",
+ mpFunctionCallManager->registerCallback(3, &userFunction3) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "setFunctionName failed",
+ functionSciMsg.setFunctionName ("userFunction1") );
+
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMsg failed",
+ mpFunctionCallManager->receiveMsg (functionSciMsg) );
+ }
+ }
+ catch (Error &e)
+ {
+ e.display();
+ }
+}
+
+
+void userFunction1 ( const FunctionSciMsg & function_sci_msg )
+{
+ logTest();
+}
+
+
+void userFunction2 ( const FunctionSciMsg & function_sci_msg )
+{
+ logTest();
+}
+
+
+void userFunction3 ( const FunctionSciMsg & function_sci_msg )
+{
+ logTest();
+}
+
diff --git a/cesar/maximus/functioncall/src/FunctionCallParameter.cpp b/cesar/maximus/functioncall/src/FunctionCallParameter.cpp
new file mode 100644
index 0000000000..640c6fd19b
--- /dev/null
+++ b/cesar/maximus/functioncall/src/FunctionCallParameter.cpp
@@ -0,0 +1,277 @@
+/************************************************************************
+ FunctionCallParameter.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/functioncall/src/FunctionCallParameter.cpp
+**************************************************************************/
+
+#include "FunctionCallParameter.h"
+
+#include "Logger.h"
+
+#include <sstream> // for 'ostringstream'
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+FunctionCallParameter::FunctionCallParameter ( ):
+mName("none"),
+mValueLength(0),
+mpValue(NULL)
+{
+ logFunction();
+
+ initAttributes ();
+}
+
+
+FunctionCallParameter::FunctionCallParameter ( const FunctionCallParameter & parameter ):
+mName("none"),
+mValueLength(0),
+mpValue(NULL)
+{
+ logFunction();
+
+ setName (parameter.getName());
+ setValueLength (parameter.getValueLength());
+ setValue (parameter.getValue());
+
+ initAttributes ();
+}
+
+
+FunctionCallParameter::FunctionCallParameter ( string name,
+ unsigned long value_length,
+ unsigned char * p_value ):
+mName("none"),
+mValueLength(0),
+mpValue(NULL)
+{
+ logFunction();
+
+ setName (name);
+ setValueLength (value_length);
+ setValue (p_value);
+
+ initAttributes ();
+}
+
+
+void FunctionCallParameter::initAttributes ( )
+{
+ logFunction();
+}
+
+FunctionCallParameter::~FunctionCallParameter ( )
+{
+ logFunction();
+
+ mName.clear();
+ if (NULL != mpValue)
+ {
+ delete [] mpValue;
+ mpValue = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool FunctionCallParameter::operator== ( const FunctionCallParameter & parameter ) const
+{
+ logFunction();
+ bool bOperator = false;
+
+ if ( (0 == getName().compare(parameter.getName()))
+ && (getValueLength() == parameter.getValueLength())
+ && (0 == memcmp(getValue(), parameter.getValue(), parameter.getValueLength())) )
+ {
+ bOperator = true;
+ }
+
+ return bOperator;
+}
+
+
+FunctionCallParameter & FunctionCallParameter::operator= ( const FunctionCallParameter & parameter )
+{
+ logFunction();
+
+ setName (parameter.getName());
+ setValueLength (parameter.getValueLength());
+ setValue (parameter.getValue());
+
+ return *this;
+}
+
+
+void FunctionCallParameter::displayParameter ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "\t[name = " << getName() << ", value length = " << dec << getValueLength() << ", value = ";
+ if (NULL != getValue())
+ {
+ oss << "0x";
+ for (unsigned int i=0; i<static_cast<unsigned int>(getValueLength()); i++)
+ {
+ if ('\0' != *(getValue()+i))
+ {
+ oss << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(*(getValue()+i));
+ }
+ else
+ {
+ oss << "00";
+ }
+ }
+ }
+ else
+ {
+ oss << "NULL!";
+ }
+ oss << "]" << dec << endl;
+ oss.flush();
+ clog << logger(LOG_COM) << oss.str();
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+string FunctionCallParameter::getName ( ) const
+{
+ return mName;
+}
+
+
+bool FunctionCallParameter::setName ( const string name )
+{
+ logFunction();
+
+ mName.clear();
+ mName.assign(name);
+
+ return true;
+}
+
+
+bool FunctionCallParameter::setName ( const char * p_name )
+{
+ logFunction();
+
+ if (NULL != p_name)
+ {
+ mName.clear();
+ mName.assign(p_name);
+ }
+
+ return true;
+}
+
+
+unsigned long FunctionCallParameter::getValueLength ( ) const
+{
+ return mValueLength;
+}
+
+
+bool FunctionCallParameter::setValueLength ( const unsigned long value_length )
+{
+ mValueLength = value_length;
+
+ return true;
+}
+
+
+unsigned char * FunctionCallParameter::getValue ( ) const
+{
+ return mpValue;
+}
+
+
+bool FunctionCallParameter::setValue ( const unsigned char * p_value )
+{
+ logFunction();
+ bool bSetValue = false;
+
+ // Free memory
+ //
+ if (NULL != mpValue)
+ {
+ delete [] mpValue;
+ mpValue = NULL;
+ }
+
+ if (NULL != p_value)
+ {
+ // Allocate memory
+ //
+ mpValue = new unsigned char [getValueLength()];
+
+ // Copy value
+ //
+ memcpy(mpValue, p_value, getValueLength());
+
+ bSetValue = true;
+ }
+
+ return bSetValue;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/functioncall/src/FunctionCallParameterTest.cpp b/cesar/maximus/functioncall/src/FunctionCallParameterTest.cpp
new file mode 100644
index 0000000000..6d139b73e9
--- /dev/null
+++ b/cesar/maximus/functioncall/src/FunctionCallParameterTest.cpp
@@ -0,0 +1,162 @@
+
+#include "FunctionCallParameterTest.h"
+
+#include "FunctionCallParameter.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (FunctionCallParameterTest);
+
+
+void FunctionCallParameterTest::setUp (void)
+{
+ logTest();
+
+ mpFunctionCallParameter = new FunctionCallParameter();
+}
+
+
+void FunctionCallParameterTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionCallParameter)
+ {
+ delete (mpFunctionCallParameter);
+ mpFunctionCallParameter = NULL;
+ }
+}
+
+
+void FunctionCallParameterTest::setNameTest (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionCallParameter)
+ {
+ try
+ {
+ string name1("name1");
+ mpFunctionCallParameter->setName(name1);
+
+ mpFunctionCallParameter->displayParameter();
+ CPPUNIT_ASSERT_MESSAGE ( "setName failed",
+ 0 == name1.compare(mpFunctionCallParameter->getName()) );
+
+ char name2 [] = "name2";
+ mpFunctionCallParameter->setName(name2);
+
+ mpFunctionCallParameter->displayParameter();
+ CPPUNIT_ASSERT_MESSAGE ( "setName failed",
+ (mpFunctionCallParameter->getName().length() == strlen(name2))
+ && (0 == memcmp(name2, mpFunctionCallParameter->getName().c_str(), strlen(name2)+1)) );
+ }
+ catch (Error &e)
+ {
+ e.display();
+ CPPUNIT_FAIL ( "Catch exception" );
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Function call parameter pointer is NULL" );
+ }
+}
+
+
+void FunctionCallParameterTest::setValueTest (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionCallParameter)
+ {
+ try
+ {
+ const unsigned long length = 10;
+ unsigned char value [length+1] = "1234567890";
+ mpFunctionCallParameter->setValueLength(length);
+ mpFunctionCallParameter->setValue(value);
+
+ mpFunctionCallParameter->displayParameter();
+ CPPUNIT_ASSERT_MESSAGE ( "setValue failed",
+ 0 == memcmp(value, mpFunctionCallParameter->getValue(), length) );
+ }
+ catch (Error &e)
+ {
+ e.display();
+ CPPUNIT_FAIL ( "Catch exception" );
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Function call parameter pointer is NULL" );
+ }
+}
+
+
+void FunctionCallParameterTest::setValueLengthTest (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionCallParameter)
+ {
+ try
+ {
+ const unsigned long length = 10;
+ mpFunctionCallParameter->setValueLength(length);
+
+ mpFunctionCallParameter->displayParameter();
+ CPPUNIT_ASSERT_MESSAGE ( "setValueLength failed",
+ length == mpFunctionCallParameter->getValueLength() );
+ }
+ catch (Error &e)
+ {
+ e.display();
+ CPPUNIT_FAIL ( "Catch exception" );
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Function call parameter pointer is NULL" );
+ }
+}
+
+
+void FunctionCallParameterTest::constructorsTest (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionCallParameter)
+ {
+ try
+ {
+ FunctionCallParameter parameter1 ("parameter1", 3, (unsigned char *)"abc");
+ FunctionCallParameter parameter2(parameter1);
+ FunctionCallParameter parameter3 = parameter2;
+
+ parameter1.displayParameter();
+ parameter2.displayParameter();
+ parameter3.displayParameter();
+ CPPUNIT_ASSERT_MESSAGE ( "constructors failed",
+ (0 == parameter1.getName().compare("parameter1"))
+ && (3 == parameter1.getValueLength())
+ && (0 == memcmp(parameter1.getValue(), "abc", 3))
+ && (parameter1 == parameter2)
+ && (parameter2 == parameter3) );
+ }
+ catch (Error &e)
+ {
+ e.display();
+ CPPUNIT_FAIL ( "Catch exception" );
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Function call parameter pointer is NULL" );
+ }
+}
+
diff --git a/cesar/maximus/functioncall/src/FunctionSciMsg.cpp b/cesar/maximus/functioncall/src/FunctionSciMsg.cpp
new file mode 100644
index 0000000000..7e1c63dbd7
--- /dev/null
+++ b/cesar/maximus/functioncall/src/FunctionSciMsg.cpp
@@ -0,0 +1,865 @@
+/************************************************************************
+ FunctionSciMsg.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/functioncall/src/FunctionSciMsg.cpp
+**************************************************************************/
+
+#include "FunctionSciMsg.h"
+
+#include "IFunctionCall.h"
+#include "FunctionCallParameter.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <netinet/in.h> // for 'htonl()' and 'htons()'
+#include <cstring> // for 'strcpy()' and 'strcmp()'
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+Function_Call_Msg_Id FunctionSciMsg::mSpecializedSciMsgId = 0;
+
+
+FunctionSciMsg::FunctionSciMsg ( IFunctionCall * p_function_call_manager ):
+mSpecializedSciMsgType(FUNCTION_CALL_TYPE_NONE),
+mSpecializedSciMsgParametersNumber(0),
+mSpecializedSciMsgFlags(FUNCTION_CALL_FLAG_NONE),
+mpFunctionCallManager(NULL)
+{
+ logFunction();
+
+ if (NULL != p_function_call_manager)
+ {
+ mpFunctionCallManager = p_function_call_manager;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Function call manager pointer is NULL", errno);
+ }
+
+ initAttributes ();
+}
+
+
+void FunctionSciMsg::initAttributes ( )
+{
+ logFunction();
+
+ mSpecializedSciMsgHeader.version = 0x00;
+ mSpecializedSciMsgHeader.type = 0x00;
+ mSpecializedSciMsgHeader.msg_id = 0x0000;
+ mSpecializedSciMsgHeader.param_nb = 0x00;
+ mSpecializedSciMsgHeader.flags = 0x00;
+ mSpecializedSciMsgHeader.reserved = 0x0000;
+}
+
+
+FunctionSciMsg::FunctionSciMsg ( const FunctionSciMsg & function_sci_msg ) : SciMsg ( )
+{
+ logFunction();
+
+ setSpecializedSciMsgType (function_sci_msg.getSpecializedSciMsgType());
+ setSpecializedSciMsgParametersNumber (function_sci_msg.getSpecializedSciMsgParametersNumber());
+ setSpecializedSciMsgHeader (function_sci_msg.getSpecializedSciMsgHeader());
+ setFunctionName (function_sci_msg.getFunctionName());
+ setListOfParameters (function_sci_msg.getListOfParameters());
+ setFunctionCallManager (function_sci_msg.getFunctionCallManager());
+}
+
+
+FunctionSciMsg::~FunctionSciMsg ( )
+{
+ logFunction();
+
+ if (!mListOfParameters.empty())
+ {
+ mListOfParameters.clear();
+ }
+ if (NULL != mpFunctionCallManager)
+ {
+ mpFunctionCallManager = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+SciMsg * FunctionSciMsg::create ( ) const
+{
+ logFunction();
+
+ return new FunctionSciMsg(getFunctionCallManager());
+}
+
+
+bool FunctionSciMsg::dispatchMsg ( )
+{
+ logFunction();
+ bool bDispatch = false;
+
+ if (NULL != getFunctionCallManager())
+ {
+ bDispatch = identifyFunctionName();
+ bDispatch &= identifyParameters();
+
+ if ( FUNCTION_CALL_TYPE_RSP == getSpecializedSciMsgType() )
+ {
+ bDispatch &= getFunctionCallManager()->receiveMsg(*this);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Function call manager pointer is NULL");
+ }
+
+ return bDispatch;
+}
+
+
+// When receiving a SCI msg, specialized SCI msg header has to be extracted from received SCI msg data
+//
+bool FunctionSciMsg::identifySpecializedSciMsgHeader ( )
+{
+ logFunction();
+ bool bIdentifyHeader = false;
+
+ if (NULL != SciMsg::getSciMsgData())
+ {
+ // Set specialized SCI msg header size
+ //
+ SciMsg::setSpecializedSciMsgHeaderSize((unsigned long)sizeof(struct Function_Call_Header));
+
+ // Get specialized SCI message header contents
+ //
+ if (SciMsg::getSciMsgDataLength() >= SciMsg::getSpecializedSciMsgHeaderSize()) // check that there are enough data to get the specialized SCI message header
+ {
+ mSpecializedSciMsgHeader = *((Function_Call_Header*)SciMsg::getSciMsgData());
+ mSpecializedSciMsgHeader.msg_id = ntohs(getSpecializedSciMsgHeader().msg_id);
+ mSpecializedSciMsgHeader.reserved = ntohs(getSpecializedSciMsgHeader().reserved);
+
+ // Set specialized SCI msg attributes from specialized SCI msg header
+ //
+ setSpecializedSciMsgType (static_cast<Function_Call_Type>(getSpecializedSciMsgHeader().type));
+ setSpecializedSciMsgParametersNumber (static_cast<Function_Call_Parameters_Number>(getSpecializedSciMsgHeader().param_nb));
+ setSpecializedSciMsgFlags (static_cast<Function_Call_Flags>(getSpecializedSciMsgHeader().flags));
+ displaySpecializedSciMsgHeader();
+ bIdentifyHeader = true;
+ }
+ else
+ {
+ errno = ENODATA;
+ throw Error(__PRETTY_FUNCTION__, "Not enough data to get the specialized SCI message header", errno);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI message data pointer is NULL");
+ }
+
+ return bIdentifyHeader;
+}
+
+
+// Check specialized SCI msg compatibility (check specialized SCI msg version)
+//
+bool FunctionSciMsg::checkCompatibility ( ) const
+{
+ logFunction();
+ bool bCheck = false;
+
+ if (FUNCTION_CALL_VERSION == getSpecializedSciMsgHeader().version)
+ {
+ bCheck = SciMsg::checkCompatibility();
+ }
+
+ return bCheck;
+}
+
+
+// Called by user to configure a message to send
+//
+bool FunctionSciMsg::addParameter ( const FunctionCallParameter & function_argument_to_add )
+{
+ logFunction();
+ bool bAddParameter = false;
+
+ if ( FUNCTION_CALL_PARAM_MAX_SIZE >= function_argument_to_add.getValueLength())
+ {
+ mListOfParameters.push_back(function_argument_to_add);
+ bAddParameter = true;
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "add_param: length of parameter value exceeds max size!" << endl;
+ }
+
+ return bAddParameter;
+}
+
+
+// Called by user to configure a message to send
+//
+bool FunctionSciMsg::removeParameter ( const std::string & name )
+{
+ logFunction();
+ bool bRemoveParameter = false;
+
+ for (ParametersList::iterator it = mListOfParameters.begin(); it < mListOfParameters.end(); ++it)
+ {
+ if ( !it->getName().compare(name) )
+ {
+ mListOfParameters.erase(it);
+ bRemoveParameter = true;
+ break;
+ }
+ }
+
+ return bRemoveParameter;
+}
+
+
+// Called by user when a message is received to retrieve function parameters
+//
+bool FunctionSciMsg::bindParameter ( const string name_of_parameter_to_get, unsigned long & data_length, unsigned char * p_data ) const
+{
+ logFunction();
+ bool bBindParameter = false;
+
+ FunctionCallParameter tempParameter;
+ for (unsigned int i=0; i<mListOfParameters.size(); ++i)
+ {
+ tempParameter = mListOfParameters[i];
+ if ( !tempParameter.getName().compare(name_of_parameter_to_get) )
+ {
+ bBindParameter = true;
+ if (data_length < tempParameter.getValueLength())
+ {
+ clog << logger(LOG_WARNING) << "bind_param: parameter value length too small to get the parameter value" << endl;
+ clog << logger(LOG_WARNING) << "\t(given data length = " << data_length << " and needed data length = " << tempParameter.getValueLength() << ")" << endl;
+ clog << logger(LOG_WARNING) << "\t=> parameter value will be cut" << endl;
+ }
+ else if (data_length > tempParameter.getValueLength())
+ {
+ clog << logger(LOG_WARNING) << "bind_param: parameter value length too large to get the parameter value" << endl;
+ clog << logger(LOG_WARNING) << "\t=> update length from " << data_length << " to " << tempParameter.getValueLength() << endl;
+ data_length = tempParameter.getValueLength();
+ }
+ if ( (NULL != tempParameter.getValue()) && (NULL != p_data) )
+ {
+ memcpy(p_data, tempParameter.getValue(), data_length);
+ clog << logger(LOG_COM) << "bind parameter = " << endl;
+ tempParameter.displayParameter();
+ i = mListOfParameters.size()-1;
+ }
+ }
+ }
+
+ return bBindParameter;
+}
+
+
+// Called when a function SCI msg is received
+//
+bool FunctionSciMsg::identifyFunctionName ( )
+{
+ logFunction();
+ bool bName = false;
+
+ if (NULL != getSpecializedSciMsgData())
+ {
+ // Find function name length
+ //
+ unsigned long functionNameLength = 0;
+ while ( (getSpecializedSciMsgDataLength() >= functionNameLength)
+ && ('\0' != *(getSpecializedSciMsgData()+functionNameLength)) )
+ {
+ if (FUNCTION_CALL_ID_MAX_SIZE > functionNameLength) /* max length of a function id */
+ {
+ functionNameLength++;
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "length of function call name exceeds max size!" << endl;
+ }
+ }
+
+ // Copy function name from specialized SCI msg data to function name attribute
+ //
+ mFunctionName.assign((char*)getSpecializedSciMsgData(), functionNameLength);
+
+ // Remove function name from specialized SCI msg data
+ //
+ unsigned long tempDataLength = getSpecializedSciMsgDataLength();
+ unsigned char * pTempData = new unsigned char [tempDataLength];
+ memcpy(pTempData, getSpecializedSciMsgData(), tempDataLength);
+ bName = SciMsg::removeData (functionNameLength+1, tempDataLength, &pTempData);
+ if (0 != bName)
+ {
+ bName &= setSpecializedSciMsgDataLength(tempDataLength);
+ bName &= setSpecializedSciMsgData(pTempData);
+ }
+
+ // Free pointer
+ //
+ if (NULL != pTempData)
+ {
+ delete [] pTempData;
+ pTempData = NULL;
+ }
+ }
+ else
+ {
+ if (!getFunctionName().empty()) // function name has already been set
+ {
+ bName = true;
+ }
+ }
+ displayFunctionName();
+
+ return bName;
+}
+
+
+// Called when a function SCI msg is received
+//
+bool FunctionSciMsg::identifyParameters ( )
+{
+ logFunction();
+ bool bParam = false;
+
+ if ( NULL != getSpecializedSciMsgData() )
+ {
+ // For each parameter
+ //
+ for (unsigned int n=0; n<getSpecializedSciMsgParametersNumber(); n++)
+ {
+ // Find parameter name length
+ //
+ unsigned long parameterNameLength = 0;
+ while ( (getSpecializedSciMsgDataLength() >= parameterNameLength)
+ && ('\0' != *(getSpecializedSciMsgData()+parameterNameLength)) )
+ {
+ parameterNameLength++;
+ }
+
+ // Copy parameter name from specialized SCI msg data to parameter name attribute
+ //
+ string tempParameterName;
+ tempParameterName.assign((char*)getSpecializedSciMsgData(), parameterNameLength);
+ FunctionCallParameter parameterToFill;
+ parameterToFill.setName(tempParameterName);
+
+ // Remove parameter name from specialized SCI msg data
+ //
+ unsigned long tempDataLength = getSpecializedSciMsgDataLength();
+ unsigned char * pTempData = new unsigned char [tempDataLength];
+ memcpy(pTempData, getSpecializedSciMsgData(), tempDataLength);
+ bParam = SciMsg::removeData (parameterNameLength+1, tempDataLength, &pTempData);
+ if (0 != bParam)
+ {
+ bParam &= setSpecializedSciMsgDataLength(tempDataLength);
+ bParam &= setSpecializedSciMsgData(pTempData);
+ }
+ if (NULL != pTempData)
+ {
+ delete [] pTempData;
+ pTempData = NULL;
+ }
+
+ // Find parameter value length (coded on 2 bytes)
+ //
+ uint16_t tempLength = (static_cast<uint8_t>(*(getSpecializedSciMsgData()))<<8) + static_cast<uint8_t>(*(getSpecializedSciMsgData()+1));
+ if ( FUNCTION_CALL_PARAM_MAX_SIZE >= tempLength )
+ {
+ parameterToFill.setValueLength (static_cast<unsigned long>(tempLength));
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "length of parameter value exceeds max size!" << endl;
+ }
+
+ // Find parameter value
+ //
+ unsigned char * pTempParameterValue = new unsigned char [parameterToFill.getValueLength()];
+ memcpy(pTempParameterValue, getSpecializedSciMsgData()+2, parameterToFill.getValueLength()); // +2 because parameter value length is coded on 2 bytes
+ parameterToFill.setValue(pTempParameterValue);
+
+ // Remove parameter value length and parameter value from specialized SCI msg data
+ //
+ tempDataLength = getSpecializedSciMsgDataLength();
+ pTempData = new unsigned char [tempDataLength];
+ memcpy(pTempData, getSpecializedSciMsgData(), tempDataLength);
+ bParam &= SciMsg::removeData (2+parameterToFill.getValueLength(), tempDataLength, &pTempData); // +2 because parameter value length is coded on 2 bytes
+ if (0 != bParam)
+ {
+ bParam &= setSpecializedSciMsgDataLength(tempDataLength);
+ bParam &= setSpecializedSciMsgData(pTempData);
+ }
+ if (NULL != pTempData)
+ {
+ delete [] pTempData;
+ pTempData = NULL;
+ }
+ if (NULL != pTempParameterValue)
+ {
+ delete [] pTempParameterValue;
+ pTempParameterValue = NULL;
+ }
+
+ // Add parameter to the parameters list of the received function SCI msg
+ //
+ bParam &= addParameter(parameterToFill);
+ }
+ }
+ displayListOfParameters();
+
+ return bParam;
+}
+
+
+// Called when a function SCI msg is sent
+// Fill specialized SCI msg attributes
+// Fill specialized SCI msg data length and specialized SCI msg data
+//
+bool FunctionSciMsg::fillSpecializedSciMsgToSend ( )
+{
+ logFunction();
+ bool bFill = false;
+
+ Function_Call_Parameters_Number numberOfParameters = 0;
+ unsigned long dataLength = 0;
+ unsigned char * pData = NULL;
+
+ displayFunctionName();
+ displayListOfParameters();
+
+ // Function name is sent into the SCI msg data, before parameters
+ //
+ if (!getFunctionName().empty())
+ {
+ pData = (unsigned char *)(malloc(getFunctionName().size()+1)); // memory allocation for function name
+ getFunctionName().copy ((char*)(pData), getFunctionName().size()); // copy function name into data
+ pData[getFunctionName().size()] = '\0';
+ dataLength += static_cast<unsigned long>(getFunctionName().size()+1); // update data length
+
+ // Parameters are defined as 'FunctionCallParameter'
+ // They will be sent into the function SCI msg into specialized SCI msg data
+ // 'FunctionCallParameter' fields are sent according to the following format:
+ // name\0lengthp_value etc. with length coded on 2 bytes
+ // Number of parameters is sent into the 'Function_Call_Header.param_nb' field
+ //
+ for (unsigned int i=0; i<mListOfParameters.size(); ++i)
+ {
+ // Dynamic memory allocation for parameter
+ //
+ pData = (unsigned char *)(realloc(pData, dataLength+((mListOfParameters)[i].getName().length())+1+2+(mListOfParameters)[i].getValueLength()));
+
+ // Parameter name
+ //
+ mListOfParameters[i].getName().copy ((char*)(pData+dataLength), mListOfParameters[i].getName().size()); // copy parameter name into data
+ *(pData+dataLength+mListOfParameters[i].getName().size()) = '\0';
+ dataLength += static_cast<unsigned long>(mListOfParameters[i].getName().size()+1); // update data length
+
+ // Parameter value length
+ //
+ uint16_t tempLength = static_cast<uint16_t>(mListOfParameters[i].getValueLength());
+ uint8_t tempLengthHigh=0, tempLengthLow=0;
+ tempLengthHigh = static_cast<uint8_t>(tempLength >> 8);
+ tempLengthLow = static_cast<uint8_t>(tempLength);
+ *(pData+dataLength) = static_cast<unsigned char>(tempLengthHigh);
+ *(pData+dataLength+1) = static_cast<unsigned char>(tempLengthLow);
+ dataLength += 2; // update data length
+
+ // Parameter value
+ //
+ if (0 != (mListOfParameters[i].getValueLength()))
+ {
+ for (unsigned int j=0; j<mListOfParameters[i].getValueLength(); j++)
+ {
+ *(pData+dataLength+j) = *(mListOfParameters[i].getValue()+j);
+ }
+ }
+ dataLength += mListOfParameters[i].getValueLength(); // update data length
+
+ // Increment number of parameters that have been copied into data
+ //
+ numberOfParameters++;
+ }
+ }
+
+ // Fill specialized SCI msg type,
+ // specialized SCI msg number of parameters,
+ // specialized SCI msg data length,
+ // and specialized SCI msg data
+ //
+ if (NULL != pData)
+ {
+ bFill = setSpecializedSciMsgType(FUNCTION_CALL_TYPE_REQ);
+ bFill &= setSpecializedSciMsgParametersNumber(numberOfParameters);
+ bFill &= setSpecializedSciMsgDataLength(dataLength);
+ bFill &= setSpecializedSciMsgData(pData);
+
+ // Free temporary allocated memory
+ //
+ free(pData);
+ pData = NULL;
+ }
+
+ return bFill;
+}
+
+
+void FunctionSciMsg::displaySpecializedSciMsgHeader ( ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "function SCI msg header = " << endl;
+ clog << logger(LOG_INFO) << "\tversion = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(mSpecializedSciMsgHeader.version) << endl;
+ displaySpecializedSciMsgType(LOG_INFO);
+ clog << logger(LOG_INFO) << "\tmsg id = 0x" << setfill('0') << setw(4) << uppercase << hex << mSpecializedSciMsgHeader.msg_id << endl;
+ clog << logger(LOG_INFO) << "\tparam nb = " << dec << static_cast<unsigned short int>(mSpecializedSciMsgHeader.param_nb) \
+ << " (0x" << setw(2) << uppercase << hex << static_cast<unsigned short int>(mSpecializedSciMsgHeader.param_nb) << ")" << endl;
+ clog << logger(LOG_INFO) << "\tflags = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(mSpecializedSciMsgHeader.flags) << endl;
+ clog << logger(LOG_INFO) << "\treserved = 0x" << setfill('0') << setw(4) << uppercase << hex << mSpecializedSciMsgHeader.reserved << dec << endl;
+}
+
+
+void FunctionSciMsg::displaySpecializedSciMsgType ( int log_level ) const
+{
+ switch (getSpecializedSciMsgType())
+ {
+ case 0:
+ clog << logger(log_level) << "\ttype = FUNCTION_CALL_TYPE_NONE" << endl;
+ break;
+ case 1:
+ clog << logger(log_level) << "\ttype = FUNCTION_CALL_TYPE_REQ" << endl;
+ break;
+ case 2:
+ clog << logger(log_level) << "\ttype = FUNCTION_CALL_TYPE_RSP" << endl;
+ break;
+ default:
+ clog << logger(log_level) << "\ttype = unknown!" << endl;
+ break;
+ }
+}
+
+
+// private methods
+//
+
+
+void FunctionSciMsg::displayFunctionName ( ) const
+{
+ logFunction();
+
+ if (!getFunctionName().empty())
+ {
+ clog << logger(LOG_COM) << "function name = " << getFunctionName() << endl;
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "function name = empty!" << endl;
+ }
+}
+
+
+void FunctionSciMsg::displayParameter ( unsigned int parameter_iterator ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "parameter " << dec << parameter_iterator+1 << " = " << endl;
+ if (parameter_iterator < mListOfParameters.size())
+ {
+ mListOfParameters[parameter_iterator].displayParameter();
+ }
+ else
+ {
+ clog << logger(LOG_INFO) << "\tdoes not exist!" << endl;
+ }
+}
+
+
+void FunctionSciMsg::displayListOfParameters ( ) const
+{
+ logFunction();
+ clog << logger(LOG_COM) << "list of parameters = " << endl;
+
+ if (!mListOfParameters.empty())
+ {
+ for (unsigned int i=0; i<mListOfParameters.size(); i++)
+ {
+ mListOfParameters[i].displayParameter();
+ }
+ }
+ else
+ {
+ clog << logger(LOG_COM) << "\tempty!" << endl;
+ }
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+Function_Call_Type FunctionSciMsg::getSpecializedSciMsgType ( ) const
+{
+ return mSpecializedSciMsgType;
+}
+
+
+bool FunctionSciMsg::setSpecializedSciMsgType ( const Function_Call_Type type )
+{
+ mSpecializedSciMsgType = type;
+
+ return true;
+}
+
+
+Function_Call_Msg_Id FunctionSciMsg::getMsgId ( ) const
+{
+ return getSpecializedSciMsgHeader().msg_id;
+}
+
+
+bool FunctionSciMsg::setMsgId ( const Function_Call_Msg_Id msg_id )
+{
+ mSpecializedSciMsgHeader.msg_id = msg_id;
+
+ return true;
+}
+
+
+Function_Call_Msg_Id FunctionSciMsg::getSpecializedSciMsgId ( ) const
+{
+ return mSpecializedSciMsgId;
+}
+
+
+bool FunctionSciMsg::incrementSpecializedSciMsgId ( )
+{
+ mSpecializedSciMsgId++;
+
+ return true;
+}
+
+
+Function_Call_Parameters_Number FunctionSciMsg::getSpecializedSciMsgParametersNumber ( ) const
+{
+ return mSpecializedSciMsgParametersNumber;
+}
+
+
+bool FunctionSciMsg::setSpecializedSciMsgParametersNumber ( const Function_Call_Parameters_Number number_of_parameters )
+{
+ logFunction();
+ bool bNb = false;
+
+ if ( FUNCTION_CALL_PARAM_MAX_NB >= number_of_parameters ) /* max number of parameter in a function call */
+ {
+ mSpecializedSciMsgParametersNumber = number_of_parameters;
+ bNb = true;
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "number of parameters exceeds max number!" << endl;
+ }
+
+ return bNb;
+}
+
+
+Function_Call_Flags FunctionSciMsg::getSpecializedSciMsgFlags ( ) const
+{
+ return mSpecializedSciMsgFlags;
+}
+
+
+bool FunctionSciMsg::setSpecializedSciMsgFlags ( const Function_Call_Flags flags )
+{
+ logFunction();
+ bool bFlags = false;
+
+ if ( FUNCTION_CALL_FLAG_MAX < flags )
+ {
+ clog << logger(LOG_ERROR) << "function SCI message header flags is out-of-range!" << endl;
+ }
+ else if (FUNCTION_CALL_FLAG_FAILED == flags & FUNCTION_CALL_FLAG_FAILED)
+ {
+ clog << logger(LOG_ERROR) << "function SCI message header flags is set to FAILED!" << endl;
+ mSpecializedSciMsgFlags = flags;
+ }
+ else
+ {
+ mSpecializedSciMsgFlags = flags;
+ bFlags = true;
+ }
+
+ return bFlags;
+}
+
+
+bool FunctionSciMsg::setReserved ( const uint16_t reserved )
+{
+ mSpecializedSciMsgHeader.reserved = reserved;
+
+ return true;
+}
+
+
+void * FunctionSciMsg::returnSpecializedSciMsgHeader ( ) const
+{
+ return (void*)&mSpecializedSciMsgHeader;
+}
+
+
+const Function_Call_Header & FunctionSciMsg::getSpecializedSciMsgHeader ( ) const
+{
+ return mSpecializedSciMsgHeader;
+}
+
+
+bool FunctionSciMsg::setSpecializedSciMsgHeader ( const Function_Call_Header & specialized_sci_msg_header )
+{
+ logFunction();
+ bool bSetHeader = false;
+
+ mSpecializedSciMsgHeader = specialized_sci_msg_header;
+
+ // Set specialized SCI msg attributes from specialized SCI msg header
+ //
+ bSetHeader = setSpecializedSciMsgType (static_cast<Function_Call_Type>(getSpecializedSciMsgHeader().type));
+ bSetHeader &= setSpecializedSciMsgParametersNumber (static_cast<Function_Call_Parameters_Number>(getSpecializedSciMsgHeader().param_nb));
+
+ displaySpecializedSciMsgHeader();
+
+ return bSetHeader;
+}
+
+
+string FunctionSciMsg::getFunctionName ( ) const
+{
+ return mFunctionName;
+}
+
+
+// Called by user to configure a SCI message to send
+//
+bool FunctionSciMsg::setFunctionName ( const string name )
+{
+ logFunction();
+ bool bName = false;
+
+ if ( FUNCTION_CALL_ID_MAX_SIZE > name.size() ) /* max length of a function id */
+ {
+ mFunctionName = name;
+ bName = true;
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "function name exceeds max length!" << endl;
+ }
+
+ return bName;
+}
+
+
+const ParametersList & FunctionSciMsg::getListOfParameters ( ) const
+{
+ return mListOfParameters;
+}
+
+
+bool FunctionSciMsg::setListOfParameters ( const ParametersList & list_of_parameters )
+{
+ if (!mListOfParameters.empty())
+ {
+ mListOfParameters.clear();
+ }
+ mListOfParameters = ParametersList(list_of_parameters);
+
+ return true;
+}
+
+
+IFunctionCall * FunctionSciMsg::getFunctionCallManager ( ) const
+{
+ return mpFunctionCallManager;
+}
+
+
+bool FunctionSciMsg::setFunctionCallManager ( IFunctionCall * p_function_call_manager )
+{
+ logFunction();
+
+ if (NULL != p_function_call_manager)
+ {
+ mpFunctionCallManager = p_function_call_manager;
+ }
+ else
+ {
+ clog << logger(LOG_WARNING) << "function call manager pointer is NULL!" << endl;
+ mpFunctionCallManager = NULL;
+ }
+
+ return true;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/functioncall/src/FunctionSciMsgTest.cpp b/cesar/maximus/functioncall/src/FunctionSciMsgTest.cpp
new file mode 100644
index 0000000000..440a271c67
--- /dev/null
+++ b/cesar/maximus/functioncall/src/FunctionSciMsgTest.cpp
@@ -0,0 +1,206 @@
+
+#include "FunctionSciMsgTest.h"
+
+#include "FunctionSciMsg.h"
+#include "SciServer.h"
+#include "FunctionCallManager.h"
+#include "FunctionCallParameter.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (FunctionSciMsgTest);
+
+
+void FunctionSciMsgTest::setUp (void)
+{
+ logTest();
+
+ mpSciServer = new SciServer();
+ mpFunctionCallManager = new FunctionCallManager (mpSciServer);
+ mpFunctionSciMsg = new FunctionSciMsg (mpFunctionCallManager);
+}
+
+
+void FunctionSciMsgTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpSciServer)
+ {
+ delete (mpSciServer);
+ mpSciServer = NULL;
+ }
+ if (NULL != mpFunctionCallManager)
+ {
+ delete (mpFunctionCallManager);
+ mpFunctionCallManager = NULL;
+ }
+ if (NULL != mpFunctionSciMsg)
+ {
+ delete mpFunctionSciMsg;
+ mpFunctionSciMsg = NULL;
+ }
+}
+
+
+void FunctionSciMsgTest::addParameterTest (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionSciMsg)
+ {
+ // Add parameter 1
+ //
+ FunctionCallParameter parameter1 ("parameter1", 3, (unsigned char *)"123");
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter1) );
+
+ // Add parameter 2
+ //
+ FunctionCallParameter parameter2 ("parameter2", 10, (unsigned char *)"0123456789");
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter2) );
+
+ // Add parameter 3
+ //
+ FunctionCallParameter parameter3 = parameter2;
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter3) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized FunctionSciMsg pointer is NULL" );
+ }
+}
+
+
+void FunctionSciMsgTest::bindParameterTest (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionSciMsg)
+ {
+ // Add parameter 1
+ //
+ FunctionCallParameter parameter1 ("parameter1", 3, (unsigned char *)"123");
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter1) );
+
+ // Add parameter 2
+ //
+ FunctionCallParameter parameter2 ("parameter2", 10, (unsigned char *)"0123456789");
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter2) );
+
+ // Add parameter 3
+ //
+ FunctionCallParameter parameter3 = parameter2;
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter3) );
+
+ const string name = "parameter1";
+ unsigned long dataLength = FUNCTION_CALL_PARAM_MAX_SIZE;
+ unsigned char * pData = new unsigned char [FUNCTION_CALL_PARAM_MAX_SIZE];
+
+ CPPUNIT_ASSERT_MESSAGE ( "bindParameter failed",
+ mpFunctionSciMsg->bindParameter(name, dataLength, pData) );
+
+ // Check results
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "bindParameterTest failed: wrong data length", 3 == dataLength) ;
+
+ CPPUNIT_ASSERT_MESSAGE ( "bindParameterTest failed: data pointer is NULL", NULL != pData) ;
+
+ pData[dataLength] = '\0';
+
+ CPPUNIT_ASSERT_MESSAGE ( "bindParameterTest failed: wrong data", !strcmp("123", (char*)pData)) ;
+
+ // Free memory allocated for 'FunctionSciMsg::bindParameter'
+ //
+ if (NULL != pData)
+ {
+ delete [] pData;
+ pData = NULL;
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized FunctionSciMsg pointer is NULL" );
+ }
+}
+
+
+void FunctionSciMsgTest::fillSpecializedSciMsgToSendTest (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionSciMsg)
+ {
+ // Add parameter 1
+ //
+ FunctionCallParameter parameter1 ("parameter1", 3, (unsigned char *)"123");
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter1) );
+
+ // Add parameter 2
+ //
+ FunctionCallParameter parameter2 ("parameter2", 10, (unsigned char *)"0123456789");
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter2) );
+
+ // Add parameter 3
+ //
+ FunctionCallParameter parameter3 = parameter2;
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ mpFunctionSciMsg->addParameter(parameter3) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "setFunctionName failed",
+ mpFunctionSciMsg->setFunctionName ("function_to_call") );
+
+ CPPUNIT_ASSERT_MESSAGE ( "fillSpecializedSciMsgToSend failed",
+ mpFunctionSciMsg->fillSpecializedSciMsgToSend() );
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized FunctionSciMsg pointer is NULL" );
+ }
+}
+
+
+void FunctionSciMsgTest::setSpecializedSciMsgFlagsTest (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionSciMsg)
+ {
+ mpFunctionSciMsg->setSpecializedSciMsgFlags(FUNCTION_CALL_FLAG_MAX + 1);
+ CPPUNIT_ASSERT_MESSAGE ( "setSpecializedSciMsgFlags failed",
+ FUNCTION_CALL_FLAG_NONE == mpFunctionSciMsg->getSpecializedSciMsgFlags() );
+
+ mpFunctionSciMsg->setSpecializedSciMsgFlags(FUNCTION_CALL_FLAG_FAILED);
+ CPPUNIT_ASSERT_MESSAGE ( "setSpecializedSciMsgFlags failed",
+ FUNCTION_CALL_FLAG_FAILED == mpFunctionSciMsg->getSpecializedSciMsgFlags() );
+
+ mpFunctionSciMsg->setSpecializedSciMsgFlags(FUNCTION_CALL_FLAG_NONE);
+ CPPUNIT_ASSERT_MESSAGE ( "setSpecializedSciMsgFlags failed",
+ FUNCTION_CALL_FLAG_NONE == mpFunctionSciMsg->getSpecializedSciMsgFlags() );
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized FunctionSciMsg pointer is NULL" );
+ }
+}
+
diff --git a/cesar/maximus/functioncall/src/IFunctionCallTest.cpp b/cesar/maximus/functioncall/src/IFunctionCallTest.cpp
new file mode 100644
index 0000000000..5f60e7b435
--- /dev/null
+++ b/cesar/maximus/functioncall/src/IFunctionCallTest.cpp
@@ -0,0 +1,89 @@
+
+#include "IFunctionCallTest.h"
+
+#include "IFunctionCall.h"
+#include "FunctionCallManager.h"
+#include "SciServer.h"
+#include "FunctionSciMsg.h"
+#include "FunctionCallParameter.h"
+#include "SystemManager.h"
+#include "PhyProcessor.h"
+#include "NetworkClockProcessor.h"
+#include "EthernetProcessor.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (IFunctionCallTest);
+
+
+void IFunctionCallTest::setUp (void)
+{
+ logTest();
+}
+
+
+void IFunctionCallTest::tearDown (void)
+{
+ logTest();
+}
+
+
+void IFunctionCallTest::userTest (void)
+{
+ logTest();
+
+ try
+ {
+ SciServer sciServer;
+ FunctionCallManager functionCallManager(&sciServer);
+ FunctionSciMsg * pFunctionSciMsg = functionCallManager.createMsg();
+
+ CPPUNIT_ASSERT_MESSAGE ( "createMsg failed", (NULL != pFunctionSciMsg) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "registerCallback failed",
+ functionCallManager.registerCallback(pFunctionSciMsg->getSpecializedSciMsgId(), &userFunction) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "setFunctionName failed",
+ pFunctionSciMsg->setFunctionName("function_to_call") );
+
+ FunctionCallParameter parameter ("parameter", 25, (unsigned char *)"1234567890123456789012345");
+
+ CPPUNIT_ASSERT_MESSAGE ( "addParameter failed",
+ pFunctionSciMsg->addParameter (parameter) );
+
+ SystemManager systemManager(&sciServer);
+ FunctionCallManager functionCall(&sciServer);
+ PhyProcessor phy(&sciServer);
+ EthernetProcessor ethernet(&sciServer);
+ NetworkClockProcessor networkClock(&sciServer, &systemManager, &functionCall, &phy, &ethernet);
+ systemManager.setNetworkClock(&networkClock);
+ Sci_Msg_Station_Id stationId = 0;
+ stationId = systemManager.createStation(systemManager.getDefaultStationExecutable());
+ pFunctionSciMsg->setSciMsgStationId(stationId);
+ systemManager.updateStationStatus ( stationId, MAXIMUS_STATION_STATUS_IDLE );
+
+ CPPUNIT_ASSERT_MESSAGE ( "sendMsg failed",
+ functionCallManager.sendMsg(pFunctionSciMsg) );
+
+ if (NULL != pFunctionSciMsg)
+ {
+ delete pFunctionSciMsg;
+ pFunctionSciMsg = NULL;
+ }
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+}
+
+
+void userFunction ( const FunctionSciMsg & function_sci_msg )
+{
+ logTest();
+}
+
diff --git a/cesar/maximus/networkclock/Module b/cesar/maximus/networkclock/Module
new file mode 100644
index 0000000000..b164897ea3
--- /dev/null
+++ b/cesar/maximus/networkclock/Module
@@ -0,0 +1,5 @@
+SOURCES := ClockSciMsg.cpp NetworkClockEvt.cpp NetworkClockEvtList.cpp NetworkClockProcessor.cpp
+ifdef UNITTEST
+SOURCES += NetworkClockProcessorTest.cpp NetworkClockEvtListTest.cpp NetworkClockEvtTest.cpp
+endif
+HOST_INCLUDES += maximus/networkclock/inc
diff --git a/cesar/maximus/networkclock/inc/ClockSciMsg.h b/cesar/maximus/networkclock/inc/ClockSciMsg.h
new file mode 100644
index 0000000000..a404430591
--- /dev/null
+++ b/cesar/maximus/networkclock/inc/ClockSciMsg.h
@@ -0,0 +1,212 @@
+/************************************************************************
+ ClockSciMsg.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/inc/ClockSciMsg.h
+**************************************************************************/
+
+#ifndef CLOCKSCIMSG_H
+#define CLOCKSCIMSG_H
+
+#include "SciMsg.h"
+
+#include "networkclock_types.h"
+
+class INetworkClock;
+
+
+/**
+ * class ClockSciMsg
+ */
+
+class ClockSciMsg : public SciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ // Get from specialized SCI msg header
+ //
+ Network_Clock_Type mSpecializedSciMsgType;
+ Network_Clock_Id mSpecializedSciMsgId;
+ Network_Clock_Tick mSpecializedSciMsgTick;
+
+ // Specialized SCI message header
+ //
+ Network_Clock_Header mSpecializedSciMsgHeader;
+
+ INetworkClock * mpNetworkClockProcessor;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ ClockSciMsg ( INetworkClock * p_network_clock_processor );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~ClockSciMsg ( );
+
+ // public methods
+ //
+
+ /**
+ * @return SciMsg *
+ */
+ SciMsg * create ( ) const;
+
+ /**
+ * @return bool
+ */
+ bool dispatchMsg ( );
+
+ /**
+ * @return bool
+ */
+ bool identifySpecializedSciMsgHeader ( );
+
+ /**
+ * @return bool
+ */
+ bool checkCompatibility ( ) const;
+
+ void displaySpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Display the specialized SCI message type.
+ */
+ void displaySpecializedSciMsgType ( int log_level ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return mSpecializedSciMsgType
+ */
+ Network_Clock_Type getSpecializedSciMsgType ( ) const;
+
+ /**
+ * @return bool
+ * @param type the new value of mSpecializedSciMsgType
+ */
+ bool setSpecializedSciMsgType ( const Network_Clock_Type type );
+
+ /**
+ * @return mSpecializedSciMsgId
+ */
+ Network_Clock_Id getSpecializedSciMsgId ( ) const;
+
+ /**
+ * @return bool
+ * @param id the new value of mSpecializedSciMsgId
+ */
+ bool setSpecializedSciMsgId ( const Network_Clock_Id id );
+
+ /**
+ * @return mSpecializedSciMsgTick
+ */
+ Network_Clock_Tick getSpecializedSciMsgTick ( ) const;
+
+ /**
+ * @return bool
+ * @param tick the new value of mSpecializedSciMsgTick
+ */
+ bool setSpecializedSciMsgTick ( const Network_Clock_Tick tick );
+
+ /**
+ * Set the value of mSpecializedSciMsgHeader.id
+ * @return bool
+ */
+ bool setId ( const Network_Clock_Id id );
+
+ /**
+ * Set the value of mSpecializedSciMsgHeader.tick_high
+ * @return bool
+ */
+ bool setTickHigh ( const uint32_t tick_high );
+
+ /**
+ * Set the value of mSpecializedSciMsgHeader.tick_low
+ * @return bool
+ */
+ bool setTickLow ( const uint32_t tick_low );
+
+ /**
+ * Get the value of mSpecializedSciMsgHeader
+ * @return the value of mSpecializedSciMsgHeader into a void pointer
+ */
+ void * returnSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * @return mSpecializedSciMsgHeader
+ */
+ const Network_Clock_Header & getSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * @return bool
+ * @param specialized_sci_msg_header
+ */
+ bool setSpecializedSciMsgHeader ( const Network_Clock_Header & specialized_sci_msg_header );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( ) ;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // CLOCKSCIMSG_H
diff --git a/cesar/maximus/networkclock/inc/INetworkClock.h b/cesar/maximus/networkclock/inc/INetworkClock.h
new file mode 100644
index 0000000000..9ec495a081
--- /dev/null
+++ b/cesar/maximus/networkclock/inc/INetworkClock.h
@@ -0,0 +1,104 @@
+/************************************************************************
+ INetworkClock.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/interfaces/INetworkClock.h
+**************************************************************************/
+
+#ifndef INETWORKCLOCK_H
+#define INETWORKCLOCK_H
+
+#include "networkclock_types.h"
+#include "sci_types.h"
+
+class NetworkClockEvt;
+
+
+/**
+ * class INetworkClock
+ */
+
+class INetworkClock
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ INetworkClock ( ) { }
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~INetworkClock ( ) { }
+
+ // public methods
+ //
+
+ /**
+ * @param evt_to_send
+ * @param tick_value
+ */
+ virtual void createEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_send ) = 0;
+
+ /**
+ * @return bool
+ * @param evt_to_insert
+ * @param tick_value
+ */
+ virtual bool insertEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_insert ) = 0;
+
+ /**
+ * @return bool
+ * @param evt_to_remove
+ * @param tick_value
+ */
+ virtual bool removeEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_remove ) = 0;
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ virtual bool removeEvts ( const Sci_Msg_Station_Id station_id ) = 0;
+
+ /**
+ * @return bool
+ */
+ virtual bool processNextEvt ( const Network_Clock_Tick max_tick_value = 0 ) = 0;
+
+ /**
+ * @return Network_Clock_Tick
+ */
+ virtual Network_Clock_Tick getCurrentTickValue ( ) const = 0;
+
+};
+
+
+#endif // INETWORKCLOCK_H
diff --git a/cesar/maximus/networkclock/inc/NetworkClockEvt.h b/cesar/maximus/networkclock/inc/NetworkClockEvt.h
new file mode 100644
index 0000000000..125e9333d5
--- /dev/null
+++ b/cesar/maximus/networkclock/inc/NetworkClockEvt.h
@@ -0,0 +1,184 @@
+/************************************************************************
+ NetworkClockEvt.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/inc/NetworkClockEvt.h
+**************************************************************************/
+
+#ifndef NETWORKCLOCKEVT_H
+#define NETWORKCLOCKEVT_H
+
+#include "networkclock_types.h"
+#include "phy_types.h"
+#include "sci_types.h"
+
+#include <iostream>
+#include <string>
+
+
+/**
+ * class NetworkClockEvt
+ */
+
+class NetworkClockEvt
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ Sci_Msg_Station_Id mStationId;
+ Network_Clock_Type mNetworkClockType;
+ Network_Clock_Id mNetworkClockId;
+ void * mpData;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ NetworkClockEvt ( );
+
+ /**
+ * Constructor
+ */
+ NetworkClockEvt ( const Sci_Msg_Station_Id station_id,
+ const Network_Clock_Type network_clock_type,
+ const Network_Clock_Id id,
+ const void * p_data = NULL );
+
+ /**
+ * Copy Constructors
+ */
+ NetworkClockEvt ( const NetworkClockEvt & evt );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~NetworkClockEvt ( );
+
+ // public methods
+ //
+
+ bool operator== ( const NetworkClockEvt & evt ) const;
+
+ NetworkClockEvt & operator= ( const NetworkClockEvt & evt );
+
+ void displayEvt ( ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Set the value of mStationId
+ * @return bool
+ * @param station_id the new value of mStationId
+ */
+ bool setStationId ( const Sci_Msg_Station_Id station_id );
+
+ /**
+ * Get the value of mStationId
+ * @return the value of mStationId
+ */
+ Sci_Msg_Station_Id getStationId ( ) const;
+
+ /**
+ * Set the value of mNetworkClockType
+ * @return bool
+ * @param type the new value of mNetworkClockType
+ */
+ bool setNetworkClockType ( const Network_Clock_Type type );
+
+ /**
+ * Get the value of mNetworkClockType
+ * @return the value of mNetworkClockType
+ */
+ Network_Clock_Type getNetworkClockType ( ) const;
+
+ /**
+ * Set the value of mNetworkClockId
+ * @return bool
+ * @param id the new value of mNetworkClockId
+ */
+ bool setNetworkClockId ( const Network_Clock_Id id );
+
+ /**
+ * Get the value of mNetworkClockId
+ * @return the value of mNetworkClockId
+ */
+ Network_Clock_Id getNetworkClockId ( ) const;
+
+ /**
+ * Set the value of mpData
+ * @return bool
+ * @param p_data the new value of mpData
+ */
+ bool setData ( const void * p_data );
+
+ /**
+ * Get the value of mpData
+ * @return the value of mpData
+ */
+ void * getData ( ) const;
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( ) ;
+
+ std::string displayNetworkClockType ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // NETWORKCLOCKEVT_H
diff --git a/cesar/maximus/networkclock/inc/NetworkClockEvtList.h b/cesar/maximus/networkclock/inc/NetworkClockEvtList.h
new file mode 100644
index 0000000000..24c324e442
--- /dev/null
+++ b/cesar/maximus/networkclock/inc/NetworkClockEvtList.h
@@ -0,0 +1,171 @@
+/************************************************************************
+ NetworkClockEvtList.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/inc/NetworkClockEvtList.h
+**************************************************************************/
+
+#ifndef NETWORKCLOCKEVTLIST_H
+#define NETWORKCLOCKEVTLIST_H
+
+#include "networkclock_types.h"
+#include "sci_types.h"
+
+#include <map> // for 'multimap'
+
+class NetworkClockEvt;
+
+typedef std::multimap<const Network_Clock_Tick, const NetworkClockEvt> EvtsList;
+
+
+/**
+ * class NetworkClockEvtList
+ */
+
+class NetworkClockEvtList
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ EvtsList mListOfEvts;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ NetworkClockEvtList ( );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~NetworkClockEvtList ( );
+
+ // public methods
+ //
+
+ /**
+ * @return bool
+ * @param tick_value
+ * @param evt_to_insert
+ */
+ bool insertElement ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_insert );
+
+ /**
+ * @return bool
+ * @param evt_to_remove
+ */
+ bool removeElement ( const NetworkClockEvt & evt_to_remove );
+
+ /**
+ * @return bool
+ * @param tick_value
+ * @param evt_to_remove
+ */
+ bool removeElement ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_remove );
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ bool removeElement ( const Sci_Msg_Station_Id station_id );
+
+ /**
+ * @return bool
+ * @param evt_to_add
+ */
+ bool addElement ( const NetworkClockEvt & evt_to_add );
+
+ /**
+ * @return bool
+ * @param next_evt_to_process
+ */
+ bool getNextElement ( Network_Clock_Tick & tick_value, NetworkClockEvt * & p_next_evt_to_process );
+
+ void displayListOfEvts ( ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Set the value of mListOfEvts
+ * @param list_of_evts the new value of mListOfEvts
+ */
+ bool setListOfEvts ( EvtsList & list_of_evts );
+
+ /**
+ * Get the value of mListOfEvts
+ * @return the value of mListOfEvts
+ */
+ EvtsList & getListOfEvts ( );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( ) ;
+
+ void displayListOfEvts ( const Network_Clock_Tick tick_value ) const;
+
+ /**
+ * Remove elements whose key equals the input tick value
+ * @return bool
+ * @param tick_value
+ */
+ bool removePreviousElements ( const Network_Clock_Tick tick_value );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // NETWORKCLOCKEVTLIST_H
diff --git a/cesar/maximus/networkclock/inc/NetworkClockEvtListTest.h b/cesar/maximus/networkclock/inc/NetworkClockEvtListTest.h
new file mode 100644
index 0000000000..e8bea172e2
--- /dev/null
+++ b/cesar/maximus/networkclock/inc/NetworkClockEvtListTest.h
@@ -0,0 +1,40 @@
+
+#ifndef NETWORKCLOCKEVTLISTTEST_H
+#define NETWORKCLOCKEVTLISTTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class NetworkClockEvtList;
+class NetworkClockEvt;
+
+
+class NetworkClockEvtListTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (NetworkClockEvtListTest);
+ CPPUNIT_TEST (insertElementTest);
+ CPPUNIT_TEST (removeElementTest);
+ CPPUNIT_TEST (getNextElementTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void insertElementTest (void);
+ void removeElementTest (void);
+ void getNextElementTest (void);
+
+private:
+
+ NetworkClockEvtList * mpNetworkClockEvtList;
+ NetworkClockEvt * mpNetworkClockEvt;
+
+};
+
+
+#endif // NETWORKCLOCKEVTLISTTEST_H
diff --git a/cesar/maximus/networkclock/inc/NetworkClockEvtTest.h b/cesar/maximus/networkclock/inc/NetworkClockEvtTest.h
new file mode 100644
index 0000000000..f56ab62781
--- /dev/null
+++ b/cesar/maximus/networkclock/inc/NetworkClockEvtTest.h
@@ -0,0 +1,34 @@
+
+#ifndef NETWORKCLOCKEVTTEST_H
+#define NETWORKCLOCKEVTTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class NetworkClockEvt;
+
+
+class NetworkClockEvtTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (NetworkClockEvtTest);
+ CPPUNIT_TEST (simpleTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void simpleTest (void);
+
+private:
+
+ NetworkClockEvt * mpNetworkClockEvt;
+
+};
+
+
+#endif // NETWORKCLOCKEVTTEST_H
diff --git a/cesar/maximus/networkclock/inc/NetworkClockProcessor.h b/cesar/maximus/networkclock/inc/NetworkClockProcessor.h
new file mode 100644
index 0000000000..d242105190
--- /dev/null
+++ b/cesar/maximus/networkclock/inc/NetworkClockProcessor.h
@@ -0,0 +1,238 @@
+/************************************************************************
+ NetworkClockProcessor.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/inc/NetworkClockProcessor.h
+**************************************************************************/
+
+#ifndef NETWORKCLOCKPROCESSOR_H
+#define NETWORKCLOCKPROCESSOR_H
+
+#include "INetworkClock.h"
+
+#include "networkclock_types.h"
+
+class NetworkClockEvtList;
+class NetworkClockEvt;
+class ClockSciMsg;
+class ISci;
+class ISystem;
+class IFunctionCall;
+class IPhy;
+class IEthernet;
+
+
+/**
+ * class NetworkClockProcessor
+ */
+
+class NetworkClockProcessor : public INetworkClock
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ Network_Clock_Tick mCurrentTickValue;
+ NetworkClockEvtList * mpNetworkClockEvtList;
+ ISci * mpSciServer;
+ ISystem * mpSystemManager;
+ IFunctionCall * mpFunctionCallManager;
+ IPhy * mpPhyProcessor;
+ IEthernet * mpEthernet;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ NetworkClockProcessor ( );
+
+ /**
+ * Constructor
+ */
+ NetworkClockProcessor ( ISci * p_sci_server,
+ ISystem * p_system_manager,
+ IFunctionCall * p_function_call_manager,
+ IPhy * p_phy_processor,
+ IEthernet * p_ethernet );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~NetworkClockProcessor ( );
+
+ // public methods
+ //
+
+ /**
+ * @param evt_to_send
+ * @param tick_value
+ */
+ void createEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_send );
+
+ /**
+ * @return bool
+ * @param evt_to_insert
+ * @param tick_value
+ */
+ bool insertEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_insert );
+
+ /**
+ * @return bool
+ * @param evt_to_remove
+ * @param tick_value
+ */
+ bool removeEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_remove );
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ bool removeEvts ( const Sci_Msg_Station_Id station_id );
+
+ /**
+ * @return bool
+ */
+ bool processNextEvt ( const Network_Clock_Tick max_tick_value = 0 );
+
+ /**
+ * @return bool
+ * @param evt_to_process
+ */
+ bool processEvtNone ( NetworkClockEvt & evt_to_process );
+
+ /**
+ * @return bool
+ * @param evt_to_process
+ */
+ bool processEvtRemove ( NetworkClockEvt & evt_to_process );
+
+ /**
+ * @return bool
+ * @param evt_to_process
+ */
+ bool processEvtStation ( NetworkClockEvt & evt_to_process );
+
+ /**
+ * @return bool
+ * @param evt_to_process
+ */
+ bool processEvtFunctionCall ( NetworkClockEvt & evt_to_process );
+
+ /**
+ * @return bool
+ * @param evt_to_process
+ */
+ bool processEvtPhy ( NetworkClockEvt & evt_to_process );
+
+ /**
+ * @return bool
+ * @param evt_to_process
+ */
+ bool processEvtSystem ( NetworkClockEvt & evt_to_process );
+
+ /**
+ * Processes an event of type ETHERNET.
+ * @param evt_to_process
+ * @return bool
+ */
+ bool processEvtEthernet ( NetworkClockEvt & evt_to_process );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return Network_Clock_Tick
+ */
+ Network_Clock_Tick getCurrentTickValue ( ) const;
+
+ /**
+ * @return bool
+ */
+ bool setCurrentTickValue ( const Network_Clock_Tick tick_value );
+
+ /**
+ * @return the value of mpNetworkClockEvtList
+ */
+ NetworkClockEvtList * getNetworkClockEvtList ( );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * @return bool
+ * @param clock_sci_msg_to_send
+ */
+ bool sendEvtMsg ( ClockSciMsg & clock_sci_msg_to_send );
+
+ void initAttributes ( ) ;
+
+ void registerClockSciMsg ( );
+
+ /**
+ * Gets a pointer to the PHY processor.
+ * @return IPhy *
+ */
+ IPhy * getPhy ( ) const;
+
+ /**
+ * Gets a pointer to Ethernet.
+ * @return mpEthernet
+ */
+ IEthernet * getEthernet ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // NETWORKCLOCKPROCESSOR_H
diff --git a/cesar/maximus/networkclock/inc/NetworkClockProcessorTest.h b/cesar/maximus/networkclock/inc/NetworkClockProcessorTest.h
new file mode 100644
index 0000000000..1b9cb8227e
--- /dev/null
+++ b/cesar/maximus/networkclock/inc/NetworkClockProcessorTest.h
@@ -0,0 +1,64 @@
+
+#ifndef NETWORKCLOCKPROCESSORTEST_H
+#define NETWORKCLOCKPROCESSORTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class NetworkClockProcessor;
+class SciServer;
+class SystemManager;
+class FunctionCallManager;
+class PhyProcessor;
+class IEthernet;
+
+
+class NetworkClockProcessorTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (NetworkClockProcessorTest);
+ CPPUNIT_TEST (createEvtTest);
+ CPPUNIT_TEST (removeEvtTest);
+ CPPUNIT_TEST (removeEvtsTest);
+ CPPUNIT_TEST (processNextEvtTest);
+ CPPUNIT_TEST (processEvtNoneTest);
+ CPPUNIT_TEST (processEvtRemoveTest);
+ CPPUNIT_TEST (processEvtStationTest);
+ CPPUNIT_TEST (processEvtFunctionCallTest);
+ CPPUNIT_TEST (processEvtPhyTest);
+ CPPUNIT_TEST (processEvtSystemTest);
+ CPPUNIT_TEST (processEvtEthernetTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void createEvtTest (void);
+ void removeEvtTest (void);
+ void removeEvtsTest (void);
+ void processNextEvtTest (void);
+ void processEvtNoneTest (void);
+ void processEvtRemoveTest (void);
+ void processEvtStationTest (void);
+ void processEvtFunctionCallTest (void);
+ void processEvtPhyTest (void);
+ void processEvtSystemTest (void);
+ void processEvtEthernetTest (void);
+
+private:
+
+ NetworkClockProcessor * mpNetworkClockProcessor;
+ SciServer * mpSciServer;
+ SystemManager * mpSystemManager;
+ FunctionCallManager * mpFunctionCallManager;
+ PhyProcessor * mpPhyProcessor;
+ IEthernet * mpEthernet;
+
+};
+
+
+#endif // NETWORKCLOCKPROCESSORTEST_H
diff --git a/cesar/maximus/networkclock/src/ClockSciMsg.cpp b/cesar/maximus/networkclock/src/ClockSciMsg.cpp
new file mode 100644
index 0000000000..192784937b
--- /dev/null
+++ b/cesar/maximus/networkclock/src/ClockSciMsg.cpp
@@ -0,0 +1,399 @@
+/************************************************************************
+ ClockSciMsg.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/src/ClockSciMsg.cpp
+**************************************************************************/
+
+#include "ClockSciMsg.h"
+
+#include "INetworkClock.h"
+#include "NetworkClockEvt.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'clog' and 'cerr'
+#include <netinet/in.h> // for 'ntohl()' and 'ntohs()'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+ClockSciMsg::ClockSciMsg ( INetworkClock * p_network_clock_processor ):
+mSpecializedSciMsgType(NETWORK_CLOCK_TYPE_NONE),
+mSpecializedSciMsgId(0),
+mSpecializedSciMsgTick(0),
+mpNetworkClockProcessor(NULL)
+{
+ logFunction();
+
+ initAttributes();
+ if (NULL != p_network_clock_processor)
+ {
+ mpNetworkClockProcessor = p_network_clock_processor;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Network clock processor pointer is NULL", errno);
+ }
+}
+
+
+void ClockSciMsg::initAttributes ( )
+{
+ logFunction();
+
+ mSpecializedSciMsgHeader.version = 0x00;
+ mSpecializedSciMsgHeader.type = 0x00;
+ mSpecializedSciMsgHeader.id = 0x0000;
+ mSpecializedSciMsgHeader.flags = 0x0000;
+ mSpecializedSciMsgHeader.reserved = 0x0000;
+ mSpecializedSciMsgHeader.tick_high = 0x00000000;
+ mSpecializedSciMsgHeader.tick_low = 0x00000000;
+}
+
+
+ClockSciMsg::~ClockSciMsg ( )
+{
+ logFunction();
+
+ if (NULL != mpNetworkClockProcessor)
+ {
+ mpNetworkClockProcessor = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+SciMsg * ClockSciMsg::create ( ) const
+{
+ logFunction();
+
+ return new ClockSciMsg (mpNetworkClockProcessor);
+}
+
+
+bool ClockSciMsg::dispatchMsg ( )
+{
+ logFunction();
+ bool bDispatch = false;
+
+ if (NULL != mpNetworkClockProcessor)
+ {
+ // Create event to insert or remove
+ //
+ NetworkClockEvt evtToDispatch ( SciMsg::getSciMsgStationId(),
+ getSpecializedSciMsgType(),
+ getSpecializedSciMsgId() );
+
+ // According to the clock SCI msg type, dispatch clock SCI msg
+ //
+ if ( NETWORK_CLOCK_TYPE_REMOVE == getSpecializedSciMsgType() )
+ {
+ bDispatch = mpNetworkClockProcessor->removeEvt (getSpecializedSciMsgTick(), evtToDispatch);
+ }
+ else
+ {
+ if ( (NETWORK_CLOCK_TYPE_NONE < getSpecializedSciMsgType())
+ && (NETWORK_CLOCK_TYPE_NB > getSpecializedSciMsgType()) )
+ {
+ if (getSpecializedSciMsgTick() < mpNetworkClockProcessor->getCurrentTickValue())
+ {
+ clog << logger(LOG_WARNING) << "cannot insert event in the past => do nothing" << endl;
+ }
+ else
+ {
+ bDispatch = mpNetworkClockProcessor->insertEvt (getSpecializedSciMsgTick(), evtToDispatch);
+ }
+ }
+ else
+ {
+ clog << logger(LOG_WARNING) << "bad event type => do nothing" << endl;
+ }
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network clock processor pointer is NULL");
+ }
+
+ return bDispatch;
+}
+
+
+// When receiving a SCI msg, specialized SCI msg header has to be extracted from received SCI msg data
+//
+bool ClockSciMsg::identifySpecializedSciMsgHeader ( )
+{
+ logFunction();
+ bool bIdentifyHeader = false;
+
+ if (NULL != SciMsg::getSciMsgData())
+ {
+ // Set specialized SCI msg header size
+ //
+ SciMsg::setSpecializedSciMsgHeaderSize((unsigned long)sizeof(struct Network_Clock_Header));
+
+ // Get specialized SCI message header contents
+ //
+ if (SciMsg::getSciMsgDataLength() >= SciMsg::getSpecializedSciMsgHeaderSize()) // check that there are enough data to get the specialized SCI message header
+ {
+ mSpecializedSciMsgHeader = *((Network_Clock_Header*)SciMsg::getSciMsgData());
+ mSpecializedSciMsgHeader.id = ntohs(getSpecializedSciMsgHeader().id);
+ mSpecializedSciMsgHeader.flags = ntohs(getSpecializedSciMsgHeader().flags);
+ mSpecializedSciMsgHeader.reserved = ntohs(getSpecializedSciMsgHeader().reserved);
+ mSpecializedSciMsgHeader.tick_high = ntohl(getSpecializedSciMsgHeader().tick_high);
+ mSpecializedSciMsgHeader.tick_low = ntohl(getSpecializedSciMsgHeader().tick_low);
+
+ // Recompose tick value
+ //
+ uint64_t tempTickValue = (static_cast<uint64_t>(getSpecializedSciMsgHeader().tick_high)<<32) + static_cast<uint64_t>(getSpecializedSciMsgHeader().tick_low);
+
+ // Set specialized SCI msg attributes from specialized SCI msg header
+ //
+ bIdentifyHeader = setSpecializedSciMsgType (static_cast<Network_Clock_Type>(getSpecializedSciMsgHeader().type));
+ bIdentifyHeader &= setSpecializedSciMsgId (static_cast<Network_Clock_Id>(getSpecializedSciMsgHeader().id));
+ bIdentifyHeader &= setSpecializedSciMsgTick (static_cast<Network_Clock_Tick>(tempTickValue));
+
+ displaySpecializedSciMsgHeader();
+ }
+ else
+ {
+ errno = ENODATA;
+ throw Error(__PRETTY_FUNCTION__, "Not enough data to get the specialized SCI message header", errno);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI message data pointer is NULL");
+ }
+
+ return bIdentifyHeader;
+}
+
+
+// Check specialized SCI msg compatibility (check specialized SCI msg version)
+//
+bool ClockSciMsg::checkCompatibility ( ) const
+{
+ logFunction();
+ bool bCheck = false;
+
+ if (NETWORK_CLOCK_VERSION == getSpecializedSciMsgHeader().version)
+ {
+ bCheck = SciMsg::checkCompatibility();
+ }
+
+ return bCheck;
+}
+
+
+void ClockSciMsg::displaySpecializedSciMsgHeader( ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "clock SCI msg header = " << endl;
+ clog << logger(LOG_INFO) << "\tversion = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().version) << endl;
+ displaySpecializedSciMsgType(LOG_INFO);
+ clog << logger(LOG_INFO) << "\tid = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader().id << endl;
+ clog << logger(LOG_INFO) << "\tflags = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader().flags << endl;
+ clog << logger(LOG_INFO) << "\treserved = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader().reserved << endl;
+ clog << logger(LOG_INFO) << "\ttick = 0x" << setfill('0') << setw(8) << uppercase << hex << getSpecializedSciMsgHeader().tick_high \
+ << setfill('0') << setw(8) << uppercase << hex << getSpecializedSciMsgHeader().tick_low << dec << endl;
+}
+
+
+void ClockSciMsg::displaySpecializedSciMsgType ( int log_level ) const
+{
+ logFunction();
+
+ switch (getSpecializedSciMsgHeader().type)
+ {
+ case 0:
+ clog << logger(log_level) << "\ttype = NETWORK_CLOCK_TYPE_NONE" << endl;
+ break;
+ case 1:
+ clog << logger(log_level) << "\ttype = NETWORK_CLOCK_TYPE_REMOVE" << endl;
+ break;
+ case 2:
+ clog << logger(log_level) << "\ttype = NETWORK_CLOCK_TYPE_STATION" << endl;
+ break;
+ case 3:
+ clog << logger(log_level) << "\ttype = NETWORK_CLOCK_TYPE_FUNCTION_CALL" << endl;
+ break;
+ case 4:
+ clog << logger(log_level) << "\ttype = NETWORK_CLOCK_TYPE_PHY" << endl;
+ break;
+ case 5:
+ clog << logger(log_level) << "\ttype = NETWORK_CLOCK_TYPE_SYSTEM" << endl;
+ break;
+ default:
+ clog << logger(log_level) << "\ttype = unknown!" << endl;
+ break;
+ }
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+Network_Clock_Type ClockSciMsg::getSpecializedSciMsgType ( ) const
+{
+ return mSpecializedSciMsgType;
+}
+
+
+bool ClockSciMsg::setSpecializedSciMsgType ( const Network_Clock_Type type )
+{
+ mSpecializedSciMsgType = type;
+
+ return true;
+}
+
+
+Network_Clock_Id ClockSciMsg::getSpecializedSciMsgId ( ) const
+{
+ return mSpecializedSciMsgId;
+}
+
+
+bool ClockSciMsg::setSpecializedSciMsgId ( const Network_Clock_Id id )
+{
+ mSpecializedSciMsgId = id;
+
+ return true;
+}
+
+
+Network_Clock_Tick ClockSciMsg::getSpecializedSciMsgTick ( ) const
+{
+ return mSpecializedSciMsgTick;
+}
+
+
+bool ClockSciMsg::setSpecializedSciMsgTick ( const Network_Clock_Tick tick )
+{
+ mSpecializedSciMsgTick = tick;
+
+ return true;
+}
+
+
+bool ClockSciMsg::setId ( const Network_Clock_Id id )
+{
+ mSpecializedSciMsgHeader.id = id;
+
+ return true;
+}
+
+
+bool ClockSciMsg::setTickHigh ( const uint32_t tick_high )
+{
+ mSpecializedSciMsgHeader.tick_high = tick_high;
+
+ return true;
+}
+
+
+bool ClockSciMsg::setTickLow ( const uint32_t tick_low )
+{
+ mSpecializedSciMsgHeader.tick_low = tick_low;
+
+ return true;
+}
+
+
+void * ClockSciMsg::returnSpecializedSciMsgHeader ( ) const
+{
+ return (void*)&mSpecializedSciMsgHeader;
+}
+
+
+const Network_Clock_Header & ClockSciMsg::getSpecializedSciMsgHeader ( ) const
+{
+ return mSpecializedSciMsgHeader;
+}
+
+
+bool ClockSciMsg::setSpecializedSciMsgHeader ( const Network_Clock_Header & specialized_sci_msg_header )
+{
+ logFunction();
+ bool bSetHeader = false;
+
+ mSpecializedSciMsgHeader = specialized_sci_msg_header;
+
+ // Recompose tick value
+ //
+ uint64_t tempTickValue = (static_cast<uint64_t>(getSpecializedSciMsgHeader().tick_high)<<32) + static_cast<uint64_t>(getSpecializedSciMsgHeader().tick_low);
+
+ // Set specialized SCI msg attributes from specialized SCI msg header
+ //
+ bSetHeader = setSpecializedSciMsgType (static_cast<Network_Clock_Type>(getSpecializedSciMsgHeader().type));
+ bSetHeader &= setSpecializedSciMsgId (static_cast<Network_Clock_Id>(getSpecializedSciMsgHeader().id));
+ bSetHeader &= setSpecializedSciMsgTick (static_cast<Network_Clock_Tick>(tempTickValue));
+
+ displaySpecializedSciMsgHeader();
+
+ return bSetHeader;
+}
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/networkclock/src/NetworkClockEvt.cpp b/cesar/maximus/networkclock/src/NetworkClockEvt.cpp
new file mode 100644
index 0000000000..1b9f4f5a46
--- /dev/null
+++ b/cesar/maximus/networkclock/src/NetworkClockEvt.cpp
@@ -0,0 +1,269 @@
+/************************************************************************
+ NetworkClockEvt.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/src/NetworkClockEvt.cpp
+**************************************************************************/
+
+#include "NetworkClockEvt.h"
+
+#include "Station.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <cstring> // for 'strcpy()' and 'strcmp()'
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'clog' and 'cerr'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+NetworkClockEvt::NetworkClockEvt ( ):
+mStationId(0),
+mNetworkClockType(NETWORK_CLOCK_TYPE_NONE),
+mNetworkClockId(0),
+mpData(NULL)
+{
+ logFunction();
+
+ initAttributes();
+}
+
+NetworkClockEvt::NetworkClockEvt ( const Sci_Msg_Station_Id station_id,
+ const Network_Clock_Type network_clock_type,
+ const Network_Clock_Id id,
+ const void * p_data )
+{
+ logFunction();
+
+ setStationId (station_id);
+ setNetworkClockType (network_clock_type);
+ setNetworkClockId (id);
+ setData(p_data);
+
+ initAttributes();
+}
+
+
+NetworkClockEvt::NetworkClockEvt ( const NetworkClockEvt & evt )
+{
+ logFunction();
+
+ setStationId (evt.getStationId());
+ setNetworkClockType (evt.getNetworkClockType());
+ setNetworkClockId (evt.getNetworkClockId());
+ setData(evt.getData());
+
+ initAttributes();
+}
+
+
+void NetworkClockEvt::initAttributes ( )
+{
+ logFunction();
+}
+
+
+NetworkClockEvt::~NetworkClockEvt ( )
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "delete event: " << endl;
+ displayEvt();
+
+ mpData = NULL;
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool NetworkClockEvt::operator== ( const NetworkClockEvt & evt ) const
+{
+ logFunction();
+ bool bOperator = false;
+
+ if ( (getStationId() == evt.getStationId())
+ && (getNetworkClockId() == evt.getNetworkClockId())
+ && (getData() == evt.getData()) )
+ {
+ bOperator = true;
+ }
+
+ return bOperator;
+}
+
+
+NetworkClockEvt & NetworkClockEvt::operator= ( const NetworkClockEvt & evt )
+{
+ logFunction();
+
+ setStationId (evt.getStationId());
+ setNetworkClockType (evt.getNetworkClockType());
+ setNetworkClockId (evt.getNetworkClockId());
+ setData(evt.getData());
+
+ return *this;
+}
+
+
+void NetworkClockEvt::displayEvt ( ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "\t[station id = 0x" << setfill('0') << setw(4) << uppercase << hex << getStationId() \
+ << ", network clock type = " << displayNetworkClockType() \
+ << ", network clock id = 0x" << setfill('0') << setw(4) << uppercase << hex << getNetworkClockId() << "]" << dec << endl;
+}
+
+
+// private methods
+//
+
+
+string NetworkClockEvt::displayNetworkClockType ( ) const
+{
+ logFunction();
+ string type;
+
+ switch (getNetworkClockType())
+ {
+ case 0:
+ type.assign("NETWORK_CLOCK_TYPE_NONE");
+ break;
+ case 1:
+ type.assign("NETWORK_CLOCK_TYPE_REMOVE");
+ break;
+ case 2:
+ type.assign("NETWORK_CLOCK_TYPE_STATION");
+ break;
+ case 3:
+ type.assign("NETWORK_CLOCK_TYPE_FUNCTION_CALL");
+ break;
+ case 4:
+ type.assign("NETWORK_CLOCK_TYPE_PHY");
+ break;
+ case 5:
+ type.assign("NETWORK_CLOCK_TYPE_SYSTEM");
+ break;
+ default:
+ type.assign("unknown");
+ break;
+ }
+
+ return type;
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+bool NetworkClockEvt::setStationId ( const Sci_Msg_Station_Id station_id )
+{
+ mStationId = station_id;
+
+ return true;
+}
+
+
+Sci_Msg_Station_Id NetworkClockEvt::getStationId ( ) const
+{
+ return mStationId;
+}
+
+
+bool NetworkClockEvt::setNetworkClockType ( const Network_Clock_Type type )
+{
+ mNetworkClockType = type;
+
+ return true;
+}
+
+
+Network_Clock_Type NetworkClockEvt::getNetworkClockType ( ) const
+{
+ return mNetworkClockType;
+}
+
+
+bool NetworkClockEvt::setNetworkClockId ( const Network_Clock_Id id )
+{
+ mNetworkClockId = id;
+
+ return true;
+}
+
+
+Network_Clock_Id NetworkClockEvt::getNetworkClockId ( ) const
+{
+ return mNetworkClockId;
+}
+
+
+bool NetworkClockEvt::setData ( const void * p_data )
+{
+ mpData = const_cast<void *>(p_data);
+
+ return true;
+}
+
+
+void * NetworkClockEvt::getData ( ) const
+{
+ return mpData;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/networkclock/src/NetworkClockEvtList.cpp b/cesar/maximus/networkclock/src/NetworkClockEvtList.cpp
new file mode 100644
index 0000000000..2e3d8d3bb7
--- /dev/null
+++ b/cesar/maximus/networkclock/src/NetworkClockEvtList.cpp
@@ -0,0 +1,314 @@
+/************************************************************************
+ NetworkClockEvtList.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/src/NetworkClockEvtList.cpp
+**************************************************************************/
+
+#include "NetworkClockEvtList.h"
+
+#include "NetworkClockEvt.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+NetworkClockEvtList::NetworkClockEvtList ( )
+{
+ logFunction();
+
+ initAttributes();
+}
+
+
+void NetworkClockEvtList::initAttributes ( )
+{
+ logFunction();
+}
+
+
+NetworkClockEvtList::~NetworkClockEvtList ( )
+{
+ logFunction();
+
+ mListOfEvts.clear();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool NetworkClockEvtList::insertElement ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_insert )
+{
+ logFunction();
+ bool bInsert = false;
+
+ // If the event to insert already exists in the list, it is an update
+ // 1. Remove this event from the list
+ //
+ if (removeElement(evt_to_insert))
+ {
+ clog << logger(LOG_INFO) << "update tick at which the event has to be processed" << endl;
+ }
+
+ // 2. Insert the event at the required tick
+ //
+ mListOfEvts.insert(EvtsList::value_type(tick_value, evt_to_insert)); // return EvtsList::iterator
+ displayListOfEvts (tick_value);
+ bInsert = true;
+
+ return bInsert;
+}
+
+
+bool NetworkClockEvtList::removeElement ( const NetworkClockEvt & evt_to_remove )
+{
+ logFunction();
+ bool bRemove = false;
+
+ for (EvtsList::iterator it = mListOfEvts.begin(); it != mListOfEvts.end(); ++it)
+ {
+ if ( evt_to_remove == it->second )
+ {
+ clog << logger(LOG_INFO) << "remove element at tick " << it->first << ": " << endl;
+ it->second.displayEvt();
+ mListOfEvts.erase(it);
+ bRemove = true;
+ break;
+ }
+ }
+ displayListOfEvts();
+
+ return bRemove;
+}
+
+
+bool NetworkClockEvtList::removeElement ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_remove )
+{
+ logFunction();
+ bool bRemove = false;
+
+ pair<EvtsList::iterator, EvtsList::iterator> evtsToRemove = mListOfEvts.equal_range(tick_value);
+
+ for (EvtsList::iterator it = evtsToRemove.first; it != evtsToRemove.second; ++it)
+ {
+ if ( evt_to_remove == it->second )
+ {
+ clog << logger(LOG_INFO) << "remove element at tick " << tick_value << ": " << endl;
+ it->second.displayEvt();
+ mListOfEvts.erase(it);
+ bRemove = true;
+ break;
+ }
+ }
+ displayListOfEvts();
+
+ return bRemove;
+}
+
+
+bool NetworkClockEvtList::removeElement ( const Sci_Msg_Station_Id station_id )
+{
+ logFunction();
+ bool bRemove = false;
+
+ EvtsList::iterator pos;
+ for (EvtsList::iterator it = mListOfEvts.begin(); it != mListOfEvts.end();)
+ {
+ pos = it;
+ ++it;
+ if (station_id == pos->second.getStationId())
+ {
+ clog << logger(LOG_INFO) << "remove element at tick " << pos->first << ": " << endl;
+ pos->second.displayEvt();
+ mListOfEvts.erase(pos);
+ bRemove = true;
+ }
+ }
+ displayListOfEvts();
+
+ return bRemove;
+}
+
+
+bool NetworkClockEvtList::addElement ( const NetworkClockEvt & evt_to_add )
+{
+ return false;
+}
+
+
+// Return true while there are events to process at current tick, else return false
+// Return true if there is an event to process in the network clock event list
+// Return false if the network clock event list is empty
+//
+bool NetworkClockEvtList::getNextElement ( Network_Clock_Tick & tick_value, NetworkClockEvt * & p_next_evt_to_process )
+{
+ logFunction();
+ bool bGet = false;
+
+ if (!mListOfEvts.empty())
+ {
+ EvtsList::iterator evtIterator;
+
+ if (0 != mListOfEvts.count(tick_value))
+ {
+ /* Finds an element whose key is tick_value. */
+ evtIterator = mListOfEvts.find (tick_value);
+ }
+ else
+ {
+ /* Finds the first element whose key strictly greater than tick_value. */
+ evtIterator = mListOfEvts.upper_bound (tick_value);
+ }
+
+ // update current tick value
+ tick_value = evtIterator->first;
+
+ // set next event to process
+ p_next_evt_to_process = const_cast<NetworkClockEvt *>(&(evtIterator->second));
+
+ bGet = true;
+ }
+
+ return bGet;
+}
+
+
+void NetworkClockEvtList::displayListOfEvts ( ) const
+{
+ logFunction();
+ clog << logger(LOG_INFO) << "list of events = " << endl;
+
+ if (!mListOfEvts.empty())
+ {
+ for (EvtsList::const_iterator it = mListOfEvts.begin(); it != mListOfEvts.end(); ++it)
+ {
+ clog << logger(LOG_INFO) << "\tat tick " << it->first << ": " << endl;
+ const_cast<NetworkClockEvt&>(it->second).displayEvt();
+ }
+ }
+ else
+ {
+ clog << logger(LOG_INFO) << "\tempty!" << endl;
+ }
+}
+
+
+// private methods
+//
+
+
+bool NetworkClockEvtList::removePreviousElements ( const Network_Clock_Tick tick_value )
+{
+ logFunction();
+ bool bRemove = false;
+
+ if (!mListOfEvts.empty())
+ {
+ mListOfEvts.erase(tick_value);
+ EvtsList::size_type numberOfEvts = mListOfEvts.erase(tick_value);
+ clog << logger(LOG_INFO) << "remove " << numberOfEvts << " element(s)" << endl;
+
+ displayListOfEvts();
+ bRemove = true;
+ }
+ else
+ {
+ clog << logger(LOG_INFO) << "no elements to remove!" << endl;
+ }
+
+ return bRemove;
+}
+
+
+void NetworkClockEvtList::displayListOfEvts ( const Network_Clock_Tick tick_value ) const
+{
+ logFunction();
+
+ if (!mListOfEvts.empty())
+ {
+ clog << logger(LOG_INFO) << "number of elements at tick " << tick_value << ": " << mListOfEvts.count(tick_value) << endl;
+ }
+ else
+ {
+ clog << logger(LOG_INFO) << "list of events = empty!" << endl;
+ }
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// protected attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+bool NetworkClockEvtList::setListOfEvts ( EvtsList & list_of_evts )
+{
+ logFunction();
+
+ mListOfEvts = list_of_evts;
+ displayListOfEvts();
+
+ return true;
+}
+
+
+EvtsList & NetworkClockEvtList::getListOfEvts ( )
+{
+ return mListOfEvts;
+}
+
diff --git a/cesar/maximus/networkclock/src/NetworkClockEvtListTest.cpp b/cesar/maximus/networkclock/src/NetworkClockEvtListTest.cpp
new file mode 100644
index 0000000000..2e6900e30f
--- /dev/null
+++ b/cesar/maximus/networkclock/src/NetworkClockEvtListTest.cpp
@@ -0,0 +1,227 @@
+
+#include "NetworkClockEvtListTest.h"
+
+#include "NetworkClockEvt.h"
+#include "NetworkClockEvtList.h"
+
+#include "networkclock_types.h"
+
+#include "Logger.h"
+
+#include <string>
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (NetworkClockEvtListTest);
+
+
+void NetworkClockEvtListTest::setUp (void)
+{
+ logTest();
+
+ mpNetworkClockEvtList = new NetworkClockEvtList ();
+}
+
+
+void NetworkClockEvtListTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpNetworkClockEvtList)
+ {
+ delete (mpNetworkClockEvtList);
+ mpNetworkClockEvtList = NULL;
+ }
+}
+
+
+void NetworkClockEvtListTest::insertElementTest (void)
+{
+ logTest();
+
+ NetworkClockEvt evt;
+
+ CPPUNIT_ASSERT_MESSAGE ( "setNetworkClockId failed",
+ evt.setNetworkClockId(123) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "insertElement failed",
+ mpNetworkClockEvtList->insertElement (1, evt) );
+
+ mpNetworkClockEvtList->displayListOfEvts();
+}
+
+
+void NetworkClockEvtListTest::removeElementTest (void)
+{
+ logTest();
+
+ // Insert Event 1
+ //
+ NetworkClockEvt evt1;
+
+ CPPUNIT_ASSERT_MESSAGE ( "setNetworkClockId failed",
+ evt1.setNetworkClockId(1) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "setNetworkClockId failed",
+ evt1.setStationId(11000) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "insertElement failed",
+ mpNetworkClockEvtList->insertElement (2, evt1) );
+
+ // Insert Event 2
+ //
+ NetworkClockEvt evt2;
+ evt2.setNetworkClockId(2);
+ evt2.setStationId(12000);
+ mpNetworkClockEvtList->insertElement (3, evt2);
+
+ // Insert Event 3
+ //
+ NetworkClockEvt evt3;
+ evt3.setNetworkClockId(3);
+ evt3.setStationId(13000);
+ mpNetworkClockEvtList->insertElement (65, evt3);
+
+ // Insert Event 4
+ //
+ NetworkClockEvt evt4;
+ evt4.setNetworkClockId(4);
+ evt4.setStationId(14000);
+ mpNetworkClockEvtList->insertElement (5, evt4);
+
+ // Insert Event 5
+ //
+ NetworkClockEvt evt5;
+ evt5.setNetworkClockId(5);
+ evt5.setStationId(15000);
+ mpNetworkClockEvtList->insertElement (687, evt5);
+
+ // Insert Event 6
+ //
+ NetworkClockEvt evt6;
+ evt6.setNetworkClockId(6);
+ evt6.setStationId(14000);
+ mpNetworkClockEvtList->insertElement (98726, evt6);
+
+ // Insert Event 7
+ //
+ NetworkClockEvt evt7;
+ evt7.setNetworkClockId(7);
+ evt7.setStationId(13000);
+ mpNetworkClockEvtList->insertElement (0, evt7);
+
+ // Insert Event 8
+ //
+ NetworkClockEvt evt8;
+ evt8.setNetworkClockId(8);
+ evt8.setStationId(12000);
+ mpNetworkClockEvtList->insertElement (1, evt8);
+
+ // Insert Event 9
+ //
+ NetworkClockEvt evt9;
+ evt9.setNetworkClockId(9);
+ evt9.setStationId(11000);
+ mpNetworkClockEvtList->insertElement (68, evt9);
+
+ // Insert Event 10
+ //
+ NetworkClockEvt evt10;
+ evt10.setNetworkClockId(10);
+ evt10.setStationId(12000);
+ mpNetworkClockEvtList->insertElement (2, evt10);
+
+ // Update Event 7
+ //
+ NetworkClockEvt evt7bis (evt7);
+ mpNetworkClockEvtList->insertElement (7, evt7bis);
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeElement failed",
+ mpNetworkClockEvtList->removeElement (2, evt1) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeElement failed",
+ mpNetworkClockEvtList->removeElement(11000) );
+
+ mpNetworkClockEvtList->displayListOfEvts();
+}
+
+
+void NetworkClockEvtListTest::getNextElementTest (void)
+{
+ logTest();
+
+ Network_Clock_Tick tickValue = 0;
+ NetworkClockEvt * pEvt = NULL;
+
+ CPPUNIT_ASSERT_MESSAGE ( "getNextElement failed",
+ !mpNetworkClockEvtList->getNextElement (tickValue, pEvt)
+ && (NULL == pEvt) );
+
+ // Insert Event 1
+ //
+ NetworkClockEvt evt1;
+ evt1.setNetworkClockId(1);
+
+ CPPUNIT_ASSERT_MESSAGE ( "insertElement failed",
+ mpNetworkClockEvtList->insertElement (0, evt1) );
+
+ // Insert Event 2
+ //
+ NetworkClockEvt evt2;
+ evt2.setNetworkClockId(2);
+ mpNetworkClockEvtList->insertElement (3524, evt2);
+
+ // Insert Event 3
+ //
+ NetworkClockEvt evt3;
+ evt3.setNetworkClockId(3);
+ mpNetworkClockEvtList->insertElement (6457, evt3);
+
+ // Insert Event 4
+ //
+ NetworkClockEvt evt4;
+ evt4.setNetworkClockId(4);
+ mpNetworkClockEvtList->insertElement (111, evt4);
+
+ // Insert Event 5
+ //
+ NetworkClockEvt evt5;
+ evt5.setNetworkClockId(5);
+ mpNetworkClockEvtList->insertElement (111, evt5);
+
+ mpNetworkClockEvtList->displayListOfEvts();
+
+ CPPUNIT_ASSERT_MESSAGE ( "getNextElement failed",
+ mpNetworkClockEvtList->getNextElement (tickValue, pEvt)
+ && (NULL != pEvt)
+ && (evt1 == *pEvt)
+ && mpNetworkClockEvtList->removeElement (tickValue, *pEvt) ); // remove event 1
+
+ CPPUNIT_ASSERT_MESSAGE ( "getNextElement failed",
+ (mpNetworkClockEvtList->getNextElement (tickValue, pEvt))
+ && (NULL != pEvt)
+ && (evt4 == *pEvt)
+ && mpNetworkClockEvtList->removeElement (tickValue, *pEvt) ); // remove event 4
+
+ CPPUNIT_ASSERT_MESSAGE ( "getNextElement failed",
+ (mpNetworkClockEvtList->getNextElement (tickValue, pEvt))
+ && (NULL != pEvt)
+ && (evt5 == *pEvt)
+ && mpNetworkClockEvtList->removeElement (tickValue, *pEvt) ); // remove event 5
+
+ CPPUNIT_ASSERT_MESSAGE ( "getNextElement failed",
+ mpNetworkClockEvtList->getNextElement (tickValue, pEvt)
+ && (NULL != pEvt)
+ && (evt2 == *pEvt)
+ && mpNetworkClockEvtList->removeElement (tickValue, *pEvt) ); // remove event 2
+
+ CPPUNIT_ASSERT_MESSAGE ( "getNextElement failed",
+ mpNetworkClockEvtList->getNextElement (tickValue, pEvt)
+ && (NULL != pEvt)
+ && (evt3 == *pEvt)
+ && mpNetworkClockEvtList->removeElement (tickValue, *pEvt) ); // remove event 3
+
+ CPPUNIT_ASSERT_MESSAGE ( "getNextElement failed",
+ !mpNetworkClockEvtList->getNextElement (tickValue, pEvt) );
+}
+
diff --git a/cesar/maximus/networkclock/src/NetworkClockEvtTest.cpp b/cesar/maximus/networkclock/src/NetworkClockEvtTest.cpp
new file mode 100644
index 0000000000..c3f88ba25a
--- /dev/null
+++ b/cesar/maximus/networkclock/src/NetworkClockEvtTest.cpp
@@ -0,0 +1,45 @@
+
+#include "NetworkClockEvtTest.h"
+
+#include "NetworkClockEvt.h"
+
+#include "networkclock_types.h"
+
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (NetworkClockEvtTest);
+
+
+void NetworkClockEvtTest::setUp (void)
+{
+ logTest();
+
+ mpNetworkClockEvt = new NetworkClockEvt ();
+}
+
+
+void NetworkClockEvtTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpNetworkClockEvt)
+ {
+ delete (mpNetworkClockEvt);
+ mpNetworkClockEvt = NULL;
+ }
+}
+
+
+void NetworkClockEvtTest::simpleTest (void)
+{
+ logTest();
+
+ if (NULL == mpNetworkClockEvt)
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockEvt pointer is NULL" );
+ }
+}
+
diff --git a/cesar/maximus/networkclock/src/NetworkClockProcessor.cpp b/cesar/maximus/networkclock/src/NetworkClockProcessor.cpp
new file mode 100644
index 0000000000..18d77bc937
--- /dev/null
+++ b/cesar/maximus/networkclock/src/NetworkClockProcessor.cpp
@@ -0,0 +1,523 @@
+/************************************************************************
+ NetworkClockProcessor.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/networkclock/src/NetworkClockProcessor.cpp
+**************************************************************************/
+
+#include "NetworkClockProcessor.h"
+
+#include "NetworkClockEvtList.h"
+#include "NetworkClockEvt.h"
+#include "ClockSciMsg.h"
+#include "ISci.h"
+#include "ISystem.h"
+#include "IFunctionCall.h"
+#include "IPhy.h"
+#include "IEthernet.h"
+
+#include "sci_types.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <netinet/in.h> // for 'htonl()' and 'htons()'
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+// For the 'processNextEvt' function
+//
+#define callMemberFunction(object, pMember) (object.*(pMember))
+typedef bool (NetworkClockProcessor::*memberFunction)(NetworkClockEvt&);
+memberFunction arrayProcess[NETWORK_CLOCK_TYPE_NB] = { &NetworkClockProcessor::processEvtNone,
+ &NetworkClockProcessor::processEvtRemove,
+ &NetworkClockProcessor::processEvtStation,
+ &NetworkClockProcessor::processEvtFunctionCall,
+ &NetworkClockProcessor::processEvtPhy,
+ &NetworkClockProcessor::processEvtSystem,
+ &NetworkClockProcessor::processEvtEthernet };
+
+
+// Constructors/Destructors
+//
+
+
+NetworkClockProcessor::NetworkClockProcessor ( ):
+mCurrentTickValue(0),
+mpNetworkClockEvtList(NULL),
+mpSciServer(NULL),
+mpSystemManager(NULL),
+mpFunctionCallManager(NULL),
+mpPhyProcessor(NULL),
+mpEthernet(NULL)
+{
+ logFunction();
+
+ initAttributes ();
+}
+
+
+NetworkClockProcessor::NetworkClockProcessor ( ISci * p_sci_server,
+ ISystem * p_system_manager,
+ IFunctionCall * p_function_call_manager,
+ IPhy * p_phy_processor,
+ IEthernet * p_ethernet ):
+mCurrentTickValue(0),
+mpNetworkClockEvtList(NULL)
+{
+ logFunction();
+
+ if ( (NULL != p_sci_server)
+ && (NULL != p_system_manager)
+ && (NULL != p_function_call_manager)
+ && (NULL != p_phy_processor)
+ && (NULL != p_ethernet) )
+ {
+ mpSciServer = p_sci_server;
+ mpSystemManager = p_system_manager;
+ mpFunctionCallManager = p_function_call_manager;
+ mpPhyProcessor = p_phy_processor;
+ mpEthernet = p_ethernet;
+
+ registerClockSciMsg ();
+ mpPhyProcessor->setNetworkClock(this);
+ mpSystemManager->setNetworkClock(this);
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "A pointer is NULL", errno);
+ }
+ initAttributes ();
+}
+
+
+void NetworkClockProcessor::initAttributes ( )
+{
+ logFunction();
+
+ mpNetworkClockEvtList = new NetworkClockEvtList ();
+ if (NULL == mpNetworkClockEvtList)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network clock event list pointer is NULL");
+ }
+}
+
+
+NetworkClockProcessor::~NetworkClockProcessor ( )
+{
+ logFunction();
+
+ if (NULL != mpNetworkClockEvtList)
+ {
+ delete (mpNetworkClockEvtList);
+ mpNetworkClockEvtList = NULL;
+ }
+ if (NULL != mpSciServer)
+ {
+ mpSciServer = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ mpSystemManager = NULL;
+ }
+ if (NULL != mpFunctionCallManager)
+ {
+ mpFunctionCallManager = NULL;
+ }
+ if (NULL != mpPhyProcessor)
+ {
+ mpPhyProcessor = NULL;
+ }
+ if (NULL != mpEthernet)
+ {
+ mpEthernet = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+void NetworkClockProcessor::createEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_send )
+{
+ logFunction();
+
+ if ( !insertEvt (tick_value, evt_to_send) )
+ {
+ clog << logger(LOG_ERROR) << "cannot insert event!" << endl;
+ }
+}
+
+
+bool NetworkClockProcessor::insertEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_insert )
+{
+ logFunction();
+ bool bInsert = false;
+
+ if (NULL != mpNetworkClockEvtList)
+ {
+ if ( mpNetworkClockEvtList->insertElement (tick_value, evt_to_insert) )
+ {
+ bInsert = true;
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network clock event list pointer is NULL");
+ }
+
+ return bInsert;
+}
+
+
+bool NetworkClockProcessor::removeEvt ( const Network_Clock_Tick tick_value, const NetworkClockEvt & evt_to_remove )
+{
+ logFunction();
+ bool bRemove = false;
+
+ if (NULL != mpNetworkClockEvtList)
+ {
+ if ( mpNetworkClockEvtList->removeElement (tick_value, evt_to_remove) )
+ {
+ bRemove = true;
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network clock event list pointer is NULL");
+ }
+
+ return bRemove;
+}
+
+
+bool NetworkClockProcessor::removeEvts ( const Sci_Msg_Station_Id station_id )
+{
+ logFunction();
+
+ if (NULL == mpNetworkClockEvtList)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network clock event list pointer is NULL");
+ }
+
+ return mpNetworkClockEvtList->removeElement(station_id);
+}
+
+
+bool NetworkClockProcessor::processNextEvt ( const Network_Clock_Tick max_tick_value )
+{
+ logFunction();
+ bool bProcess = true;
+
+ /* If all stations are IDLE,
+ * get and process events at the current tick in the NetworkClockEvtList.
+ * If max tick value is reached, return false. */
+
+ if ( (NULL != mpNetworkClockEvtList) && (NULL != mpSystemManager) )
+ {
+ if (mpSystemManager->areAllActiveStationsIdle())
+ {
+ NetworkClockEvt * pEvtToProcess = NULL;
+ Network_Clock_Tick currentTickValue = getCurrentTickValue();
+
+ // If an event has been get, update tick and process evt
+ //
+ if (mpNetworkClockEvtList->getNextElement(currentTickValue, pEvtToProcess))
+ {
+ if (NULL == pEvtToProcess)
+ {
+ throw Error(__PRETTY_FUNCTION__, "get event pointer is NULL");
+ }
+ if ( (0 == max_tick_value) || (max_tick_value > currentTickValue) )
+ {
+ bProcess = setCurrentTickValue(currentTickValue);
+ clog << logger(LOG_INFO) << "processing event at tick " << dec << getCurrentTickValue() << "..." << endl;
+ bProcess &= callMemberFunction (*this, arrayProcess[pEvtToProcess->getNetworkClockType()]) (*pEvtToProcess);
+ if (bProcess)
+ {
+ // clear event that has been processed
+ mpNetworkClockEvtList->removeElement(currentTickValue, *pEvtToProcess);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "event at tick " << dec << getCurrentTickValue() << " has not been correctly processed!" << endl;
+ }
+ }
+ else
+ {
+ setCurrentTickValue(max_tick_value);
+ clog << logger(LOG_INFO) << "tick " << dec << getCurrentTickValue() << " is reached" << endl;
+ bProcess = false;
+ }
+ }
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "A pointer is NULL");
+ }
+
+ return bProcess;
+}
+
+
+bool NetworkClockProcessor::processEvtNone ( NetworkClockEvt & evt_to_process )
+{
+ logFunction();
+
+ errno = ENOMSG;
+ throw Error(__PRETTY_FUNCTION__, "event cannot be sent because type is not set", errno);
+
+ return false;
+}
+
+
+bool NetworkClockProcessor::processEvtRemove ( NetworkClockEvt & evt_to_process )
+{
+ logFunction();
+
+ errno = ENOMSG;
+ throw Error(__PRETTY_FUNCTION__, "event cannot be sent because type is set to REMOVE", errno);
+
+ return false;
+}
+
+
+// Goal of this method is to fill SCI msg data that have to be sent on an output pipe
+//
+bool NetworkClockProcessor::processEvtStation ( NetworkClockEvt & evt_to_process )
+{
+ logFunction();
+ bool bProcessStation = false;
+
+ clog << logger(LOG_COM) << "sending network clock SCI message..." << endl;
+
+ ClockSciMsg clockSciMsgToSend(this);
+
+ // Decompose current tick value into two uint32_t values
+ //
+ uint32_t netclockHigh=0, netclockLow=0;
+ netclockLow = (uint32_t)(getCurrentTickValue());
+ netclockHigh = (uint32_t)(((uint64_t)(getCurrentTickValue()) >> 32));
+
+ // Fill specialized SCI msg header
+ //
+ struct Network_Clock_Header clockSciMsgHeader = { NETWORK_CLOCK_VERSION,
+ static_cast<uint8_t>(evt_to_process.getNetworkClockType()),
+ evt_to_process.getNetworkClockId(),
+ 0x0000, // flags
+ 0x0000, // reserved
+ netclockHigh,
+ netclockLow };
+
+ // Set specialized SCI msg header
+ //
+ bProcessStation = clockSciMsgToSend.setSpecializedSciMsgHeader(clockSciMsgHeader);
+
+ // As specialized SCI msg header will be sent on an output pipe, 'hton' functions have to be called
+ //
+ clockSciMsgToSend.setId(htons(clockSciMsgToSend.getSpecializedSciMsgHeader().id));
+ clockSciMsgToSend.setTickHigh(htonl(clockSciMsgToSend.getSpecializedSciMsgHeader().tick_high));
+ clockSciMsgToSend.setTickLow(htonl(clockSciMsgToSend.getSpecializedSciMsgHeader().tick_low));
+
+ // Fill specialized SCI msg attributes:
+ // - header size
+ //
+ bProcessStation &= clockSciMsgToSend.setSpecializedSciMsgHeaderSize(static_cast<unsigned long>(sizeof(Network_Clock_Header)));
+
+ // Fill SCI msg attributes:
+ // - type
+ //
+ bProcessStation &= clockSciMsgToSend.setSciMsgType(SCI_MSG_TYPE_NETWORK_CLOCK);
+
+ // Fill specialized SCI msg data length and specialized SCI msg data
+ // When sending a clock SCI msg, there is no clock SCI msg data
+ //
+ bProcessStation &= clockSciMsgToSend.setSpecializedSciMsgDataLength(0);
+ bProcessStation &= clockSciMsgToSend.setSpecializedSciMsgData(NULL);
+
+ // Fill SCI msg attributes:
+ // - station id
+ //
+ bProcessStation &= clockSciMsgToSend.setSciMsgStationId(evt_to_process.getStationId());
+
+ if (0 != bProcessStation)
+ {
+ // SCI msg is sent on an output pipe by the SCI server
+ //
+ bProcessStation = sendEvtMsg (clockSciMsgToSend);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "event cannot be sent because it is not correctly filled in!" << endl;
+ }
+
+ return bProcessStation;
+}
+
+
+bool NetworkClockProcessor::processEvtFunctionCall ( NetworkClockEvt & evt_to_process )
+{
+ logFunction();
+
+ errno = ENOMSG;
+ throw Error(__PRETTY_FUNCTION__, "event cannot be sent because type is set to FUNCTION_CALL", errno);
+
+ return false;
+}
+
+
+bool NetworkClockProcessor::processEvtPhy ( NetworkClockEvt & evt_to_process )
+{
+ logFunction();
+
+ return getPhy()->receiveEvt(evt_to_process);
+}
+
+
+bool NetworkClockProcessor::processEvtSystem ( NetworkClockEvt & evt_to_process )
+{
+ logFunction();
+
+ return mpSystemManager->updateStationStatus(evt_to_process.getStationId(), MAXIMUS_STATION_STATUS_IDLE);
+}
+
+
+bool NetworkClockProcessor::processEvtEthernet ( NetworkClockEvt & evt_to_process )
+{
+ logFunction();
+
+ errno = ENOMSG;
+ throw Error(__PRETTY_FUNCTION__, "event cannot be processed because type is set to ETHERNET", errno);
+
+ return false;
+}
+
+
+// private methods
+//
+
+
+bool NetworkClockProcessor::sendEvtMsg ( ClockSciMsg & clock_sci_msg_to_send )
+{
+ logFunction();
+ bool bSend = false;
+
+ if (NULL != mpSciServer)
+ {
+ bSend = mpSciServer->fillSciMsg (clock_sci_msg_to_send);
+ bSend &= mpSciServer->sendSciMsg (clock_sci_msg_to_send);
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+
+ return bSend;
+}
+
+
+void NetworkClockProcessor::registerClockSciMsg ( )
+{
+ logFunction();
+
+ if (NULL != mpSciServer)
+ {
+ mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_NETWORK_CLOCK, new ClockSciMsg(this));
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+Network_Clock_Tick NetworkClockProcessor::getCurrentTickValue ( ) const
+{
+ return mCurrentTickValue;
+}
+
+
+bool NetworkClockProcessor::setCurrentTickValue ( const Network_Clock_Tick tick_value )
+{
+ bool bTick = false;
+
+ mCurrentTickValue = tick_value;
+ bTick = mpSciServer->updateTickValue(mCurrentTickValue);
+ bTick &= logger.updateTickValue(mCurrentTickValue);
+
+ return bTick;
+}
+
+
+NetworkClockEvtList * NetworkClockProcessor::getNetworkClockEvtList ( )
+{
+ return mpNetworkClockEvtList;
+}
+
+
+IPhy * NetworkClockProcessor::getPhy ( ) const
+{
+ if (NULL == mpPhyProcessor)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY processor pointer is NULL");
+ }
+
+ return mpPhyProcessor;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/networkclock/src/NetworkClockProcessorTest.cpp b/cesar/maximus/networkclock/src/NetworkClockProcessorTest.cpp
new file mode 100644
index 0000000000..c2aac959ea
--- /dev/null
+++ b/cesar/maximus/networkclock/src/NetworkClockProcessorTest.cpp
@@ -0,0 +1,401 @@
+
+#include "NetworkClockProcessorTest.h"
+
+#include "NetworkClockEvtList.h"
+#include "NetworkClockEvt.h"
+#include "NetworkClockProcessor.h"
+#include "SciServer.h"
+#include "SystemManager.h"
+#include "FunctionCallManager.h"
+#include "PhyProcessor.h"
+#include "Station.h"
+#include "EthernetProcessor.h"
+#include "PhySciMsgPre.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (NetworkClockProcessorTest);
+
+
+void NetworkClockProcessorTest::setUp (void)
+{
+ logTest();
+
+ try
+ {
+ mpSciServer = new SciServer();
+ if (NULL != mpSciServer)
+ {
+ mpFunctionCallManager = new FunctionCallManager(mpSciServer);
+ mpSystemManager = new SystemManager(mpSciServer);
+ mpPhyProcessor = new PhyProcessor(mpSciServer);
+ mpEthernet = new EthernetProcessor(mpSciServer);
+ if ( (NULL != mpFunctionCallManager)
+ && (NULL != mpSystemManager)
+ && (NULL != mpPhyProcessor)
+ && (NULL != mpEthernet) )
+ {
+ mpNetworkClockProcessor = new NetworkClockProcessor(mpSciServer, mpSystemManager, mpFunctionCallManager, mpPhyProcessor, mpEthernet);
+ }
+ }
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+}
+
+
+void NetworkClockProcessorTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpNetworkClockProcessor)
+ {
+ delete (mpNetworkClockProcessor);
+ mpNetworkClockProcessor = NULL;
+ }
+ if (NULL != mpFunctionCallManager)
+ {
+ delete (mpFunctionCallManager);
+ mpFunctionCallManager = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ delete (mpSystemManager);
+ mpSystemManager = NULL;
+ }
+ if (NULL != mpPhyProcessor)
+ {
+ delete (mpPhyProcessor);
+ mpPhyProcessor = NULL;
+ }
+ if (NULL != mpSciServer)
+ {
+ delete (mpSciServer);
+ mpSciServer = NULL;
+ }
+ if (NULL != mpEthernet)
+ {
+ delete (mpEthernet);
+ mpEthernet = NULL;
+ }
+}
+
+
+void NetworkClockProcessorTest::createEvtTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ try
+ {
+ NetworkClockEvt evt (123, NETWORK_CLOCK_TYPE_NONE, 456);
+ mpNetworkClockProcessor->createEvt(555, evt);
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::removeEvtTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ try
+ {
+ NetworkClockEvt evt (789, NETWORK_CLOCK_TYPE_NONE, 1011);
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeEvt failed",
+ !mpNetworkClockProcessor->removeEvt(555, evt) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
+ mpNetworkClockProcessor->insertEvt(555, evt) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeEvt failed",
+ mpNetworkClockProcessor->removeEvt(555, evt) );
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::removeEvtsTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ try
+ {
+ NetworkClockEvt evt (789, NETWORK_CLOCK_TYPE_NONE, 1011);
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeEvt failed",
+ !mpNetworkClockProcessor->removeEvts(789) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
+ mpNetworkClockProcessor->insertEvt(555, evt) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeEvt failed",
+ mpNetworkClockProcessor->removeEvts(789) );
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::processNextEvtTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ try
+ {
+ Sci_Msg_Station_Id stationId = 0;
+ stationId = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+ NetworkClockEvt evt (stationId, NETWORK_CLOCK_TYPE_STATION, 0);
+
+ CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
+ mpNetworkClockProcessor->insertEvt(0, evt) );
+
+ mpSystemManager->updateStationStatus(stationId, MAXIMUS_STATION_STATUS_IDLE);
+/*
+ CPPUNIT_ASSERT_MESSAGE ( "processNextEvt failed",
+ mpNetworkClockProcessor->processNextEvt() );
+*/
+ NetworkClockEvt evt1 (stationId, NETWORK_CLOCK_TYPE_STATION, 0);
+
+ CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
+ mpNetworkClockProcessor->insertEvt(1, evt1) );
+
+ mpSystemManager->updateStationStatus(stationId, MAXIMUS_STATION_STATUS_IDLE);
+/*
+ CPPUNIT_ASSERT_MESSAGE ( "processNextEvt failed",
+ mpNetworkClockProcessor->processNextEvt() );
+*/
+ NetworkClockEvt evtToProcess (stationId, NETWORK_CLOCK_TYPE_STATION, 0);
+
+ CPPUNIT_ASSERT_MESSAGE ( "insertEvt failed",
+ mpNetworkClockProcessor->insertEvt(4, evtToProcess) );
+
+ mpNetworkClockProcessor->getNetworkClockEvtList()->displayListOfEvts();
+ mpSystemManager->updateStationStatus(stationId, MAXIMUS_STATION_STATUS_IDLE);
+/*
+ CPPUNIT_ASSERT_MESSAGE ( "processNextEvt failed",
+ mpNetworkClockProcessor->processNextEvt() );
+*/
+ mpSystemManager->removeStation(stationId);
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::processEvtNoneTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ bool bTest = false;
+ try
+ {
+ NetworkClockEvt evt (0, NETWORK_CLOCK_TYPE_NONE, 0);
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtNone failed",
+ !mpNetworkClockProcessor->processEvtNone(evt) );
+ }
+ catch ( Error &e )
+ {
+ bTest = true;
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtNone failed", bTest );
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::processEvtRemoveTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ bool bTest = false;
+ try
+ {
+ NetworkClockEvt evt (0, NETWORK_CLOCK_TYPE_REMOVE, 0);
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtRemove failed",
+ !mpNetworkClockProcessor->processEvtRemove(evt) );
+ }
+ catch ( Error &e )
+ {
+ bTest = true;
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtRemove failed", bTest );
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::processEvtStationTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ try
+ {
+ // Create a station
+ //
+ Sci_Msg_Station_Id stationId = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+ NetworkClockEvt evt (stationId, NETWORK_CLOCK_TYPE_STATION, 2324);
+ mpSystemManager->updateStationStatus ( stationId, MAXIMUS_STATION_STATUS_IDLE );
+
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtStation failed",
+ mpNetworkClockProcessor->processEvtStation(evt) );
+
+ mpSystemManager->removeStation(stationId);
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::processEvtFunctionCallTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ bool bTest = false;
+ try
+ {
+ NetworkClockEvt evt (0, NETWORK_CLOCK_TYPE_FUNCTION_CALL, 0);
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtFunctionCall failed",
+ !mpNetworkClockProcessor->processEvtFunctionCall(evt) );
+ }
+ catch ( Error &e )
+ {
+ bTest = true;
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtFunctionCall failed", bTest );
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::processEvtPhyTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ Sci_Msg_Station_Id stationId = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+ PhySciMsgPre preamble(mpPhyProcessor);
+ NetworkClockEvt evt (0, NETWORK_CLOCK_TYPE_PHY, 0, &preamble);
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtPhy failed",
+ mpNetworkClockProcessor->processEvtPhy(evt) );
+ mpSystemManager->removeStation(stationId);
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::processEvtSystemTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ Sci_Msg_Station_Id stationId = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+ NetworkClockEvt evt (stationId, NETWORK_CLOCK_TYPE_SYSTEM, 0);
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtSystem failed",
+ mpNetworkClockProcessor->processEvtSystem(evt) );
+ mpSystemManager->removeStation(stationId);
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
+
+void NetworkClockProcessorTest::processEvtEthernetTest (void)
+{
+ logTest();
+
+ if ( NULL != mpNetworkClockProcessor )
+ {
+ bool bTest = false;
+ try
+ {
+ NetworkClockEvt evt (0, NETWORK_CLOCK_TYPE_ETHERNET, 0);
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtEthernet failed",
+ !mpNetworkClockProcessor->processEvtEthernet(evt) );
+ }
+ catch ( Error &e )
+ {
+ bTest = true;
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "processEvtEthernet failed", bTest );
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized NetworkClockProcessor pointer is NULL" );
+ }
+}
+
diff --git a/cesar/maximus/phy/Module b/cesar/maximus/phy/Module
new file mode 100644
index 0000000000..24c72a04fa
--- /dev/null
+++ b/cesar/maximus/phy/Module
@@ -0,0 +1,5 @@
+SOURCES := PhyProcessor.cpp PhySciMsg.cpp PhySciMsgPre.cpp PhySciMsgFc.cpp PhySciMsgMpdu.cpp PhySciMsgNoise.cpp
+ifdef UNITTEST
+SOURCES += PhyProcessorTest.cpp PhySciMsgTest.cpp PhySciMsgPreTest.cpp PhySciMsgFcTest.cpp PhySciMsgMpduTest.cpp PhySciMsgNoiseTest.cpp
+endif
+HOST_INCLUDES += maximus/phy/inc
diff --git a/cesar/maximus/phy/inc/IPhy.h b/cesar/maximus/phy/inc/IPhy.h
new file mode 100644
index 0000000000..96e425d2c3
--- /dev/null
+++ b/cesar/maximus/phy/inc/IPhy.h
@@ -0,0 +1,234 @@
+/************************************************************************
+ IPhy.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/interfaces/IPhy.h
+**************************************************************************/
+
+#ifndef IPHY_H
+#define IPHY_H
+
+#include "hal_phy_types.h"
+#include "networkclock_types.h" // for 'Network_Clock_Tick'
+
+#include <boost/function.hpp> // for 'PhyMpduCb'
+
+class PhySciMsg;
+class PhySciMsgMpdu;
+class NetworkClockEvt;
+class INetworkClock;
+class IChannel;
+
+typedef boost::function <void (PhySciMsgMpdu &)> PhyMpduCb;
+
+
+/**
+ * class IPhy
+ */
+
+class IPhy
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ IPhy ( ) { }
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~IPhy ( ) { }
+
+ // public methods
+ //
+
+ /**
+ * @param interface_cb
+ * Initialize PHY with an interface callback function for PHY SCI message MPDU reception.
+ */
+ virtual bool init ( PhyMpduCb interface_cb ) = 0;
+
+ /**
+ * Initialize PHY with the PLC frequency for PHY SCI message of type ZERO_CROSS.
+ * @param frequency
+ * @return bool
+ */
+ virtual bool init ( const float frequency ) = 0;
+
+ /**
+ * @return PhySciMsg *
+ */
+ virtual PhySciMsg * createMsg ( ) = 0;
+
+ /**
+ * Creates a PHY SCI message MPDU.
+ * @return PhySciMsgMpdu *
+ */
+ virtual PhySciMsgMpdu * createMpdu ( ) = 0;
+
+ /**
+ * Sends a PHY SCI message MPDU.
+ * This message has to be configured before transmission.
+ * @param p_mpdu
+ * @return bool
+ */
+ virtual bool sendMpdu ( PhySciMsgMpdu * p_mpdu ) = 0;
+
+ /**
+ * Sends the PHY SCI message associated to the received Network Clock event.
+ * @param received_evt
+ * @return bool
+ */
+ virtual bool receiveEvt ( NetworkClockEvt & received_evt ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type NONE or NOISE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveInvalid ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type PREAMBLE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receivePre ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveFc ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type PRS.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receivePrs ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type MPDU_PAYLOAD.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveMpdu ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type TONEMASK.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveTonemask ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type TONEMAP.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveTonemap ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * Processes the received PHY SCI message of type RX.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ virtual bool receiveRx ( PhySciMsg & received_phy_sci_msg ) = 0;
+
+ /**
+ * @return bool
+ * @param p_network_clock the new value of mpNetworkClock
+ */
+ virtual bool setNetworkClock ( INetworkClock * p_network_clock ) = 0;
+
+ /**
+ * @return bool
+ * @param p_channel the new value of mpChannel
+ */
+ virtual bool setChannel ( IChannel * p_channel ) = 0;
+
+ /**
+ * Sets the channel perturbation.
+ * @param is_channel_enabled the new value of mIsChannelEnabled
+ */
+ virtual bool setIsChannelEnabled ( const bool is_channel_enabled ) = 0;
+
+ /**
+ * Gets the TX ID.
+ * @return Phy_Tx_Id
+ */
+ virtual const Phy_Tx_Id getTxId ( ) const = 0;
+
+ /**
+ * Gets the tonemask.
+ * @return mpTonemask
+ */
+ virtual const uint8_t * getTonemask ( ) const = 0;
+
+ /**
+ * Check if the channel perturbation is enabled.
+ * @return mIsChannelEnabled
+ */
+ virtual bool isChannelEnabled ( ) const = 0;
+
+ /**
+ * Sets the power line frequency.
+ * @param frequency the new value of mFrequency
+ * @return bool
+ */
+ virtual bool setFrequency ( const float frequency ) = 0;
+
+ /**
+ * Gets the power line frequency.
+ * @return mFrequency
+ */
+ virtual const float getFrequency ( ) const = 0;
+
+ /**
+ * Activate the wrong preambles transmission feature.
+ * @param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+ * @param std_deviation the standard deviation
+ * @return bool
+ */
+ virtual bool activateFalseAlarm ( const Network_Clock_Tick average_duration, const float std_deviation ) = 0;
+
+ /**
+ * Deactivate the wrong preambles transmission feature.
+ * @return bool
+ */
+ virtual bool deactivateFalseAlarm ( ) = 0;
+
+};
+
+
+#endif // IPHY_H
diff --git a/cesar/maximus/phy/inc/PhyProcessor.h b/cesar/maximus/phy/inc/PhyProcessor.h
new file mode 100644
index 0000000000..aec51fc05f
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhyProcessor.h
@@ -0,0 +1,512 @@
+/************************************************************************
+ PhyProcessor.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/inc/PhyProcessor.h
+**************************************************************************/
+
+#ifndef PHYPROCESSOR_H
+#define PHYPROCESSOR_H
+
+#include "IPhy.h"
+
+#include "phy_types.h"
+
+#include <map> // for 'map' and 'multimap'
+
+class ISci;
+class PhySciMsgNoise;
+class PhySciMsgPre;
+
+struct Expected_Tx
+{
+ Phy_Tx_Id src_tx_id; // expected transmission ID
+ Sci_Msg_Station_Id src_station_id; // expected transmitting station ID
+};
+struct lttx
+{
+ bool operator() ( const Expected_Tx tx1, const Expected_Tx tx2 ) const
+ {
+ if (tx1.src_tx_id != tx2.src_tx_id)
+ {
+ return tx1.src_tx_id < tx2.src_tx_id;
+ }
+ else
+ {
+ return tx1.src_station_id < tx2.src_station_id;
+ }
+ }
+};
+typedef std::multimap<const Expected_Tx, const Sci_Msg_Station_Id, lttx> RxStationsList; // list of destination stations
+struct Frame_Control
+{
+ uint32_t fc_10;
+ uint32_t fc_av[4];
+};
+typedef std::map<const Expected_Tx, Frame_Control, lttx> RxFcList; // list of received Frame Control
+struct Mpdu_Payload
+{
+ unsigned short int msg_nb; // number of PHY SCI messages MPDU that have been received
+ unsigned long data_length;
+ unsigned char * p_data;
+ uint32_t pb_header[MAC_MAX_PB_PER_MPDU];
+};
+typedef std::map<const Expected_Tx, Mpdu_Payload, lttx> RxMpduList; // list of received MPDU
+
+
+/**
+ * class PhyProcessor
+ * Simulates the real HomePlugAV physical interface and data bus.
+ */
+
+class PhyProcessor : public IPhy
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+ ISci * mpSciServer;
+ INetworkClock * mpNetworkClock;
+ IChannel * mpChannel;
+
+ bool mIsChannelEnabled;
+
+ unsigned int mNbOfCarriers;
+ uint8_t * mpTonemask;
+
+ Phy_Tx_Id mTxId; // unique ID incremented for each transmission
+ // (PREAMBLE, FC, MPDU, and NOISE if enabled).
+ RxStationsList mListOfRxStations;
+
+ PhyMpduCb mInterfaceCb;
+ RxFcList mListOfRxFc;
+ RxMpduList mListOfRxMpdu;
+
+ float mFrequency;
+ Network_Clock_Tick mZeroCrossDelay;
+ PhySciMsg * mpZeroCross;
+
+ // For the wrong preambles transmission feature
+ bool mIsFalseAlarmActivated;
+ PhySciMsgPre * mpWrongPre;
+ Network_Clock_Tick mAverageDuration;
+ float mStdDeviation;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ PhyProcessor ( ISci * p_sci_server );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhyProcessor ( );
+
+ // public methods
+ //
+
+ /**
+ * @param interface_cb
+ * Initialize PHY with an interface callback function for PHY SCI message MPDU reception.
+ */
+ bool init ( PhyMpduCb interface_cb );
+
+ /**
+ * Initialize PHY with the PLC frequency for PHY SCI message of type ZERO_CROSS.
+ * @param frequency
+ * @return bool
+ */
+ bool init ( const float frequency );
+
+ /**
+ * @return PhySciMsg *
+ */
+ PhySciMsg * createMsg ( );
+
+ /**
+ * Creates a PHY SCI message MPDU.
+ * @return PhySciMsgMpdu *
+ */
+ PhySciMsgMpdu * createMpdu ( );
+
+ /**
+ * Sends a PHY SCI message MPDU.
+ * This message has to be configured before transmission.
+ * @param p_mpdu
+ * @return bool
+ */
+ bool sendMpdu ( PhySciMsgMpdu * p_mpdu );
+
+ /**
+ * Sends the PHY SCI message associated to the received Network Clock event.
+ * @return bool
+ * @param received_evt
+ */
+ bool receiveEvt ( NetworkClockEvt & received_evt );
+
+ /**
+ * Processes the received PHY SCI message of type NONE or NOISE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveInvalid ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type PREAMBLE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receivePre ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveFc ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type PRS.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receivePrs ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type MPDU_PAYLOAD.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveMpdu ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type TONEMASK.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveTonemask ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type TONEMAP.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveTonemap ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * Processes the received PHY SCI message of type RX.
+ * @return bool
+ * @param received_phy_sci_msg
+ */
+ bool receiveRx ( PhySciMsg & received_phy_sci_msg );
+
+ /**
+ * @return bool
+ * @param phy_sci_msg_to_send
+ */
+ bool sendMsgToAllStations ( PhySciMsg & phy_sci_msg_to_send ) const;
+
+ /**
+ * Activate the wrong preambles transmission feature.
+ * @param average_duration average number of ticks 25 MHz between two consecutive wrong preambles
+ * @param std_deviation the standard deviation
+ * @return bool
+ */
+ bool activateFalseAlarm ( const Network_Clock_Tick average_duration, const float std_deviation );
+
+ /**
+ * Deactivate the wrong preambles transmission feature.
+ * @return bool
+ */
+ bool deactivateFalseAlarm ( );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return bool
+ * @param p_network_clock the new value of mpNetworkClock
+ */
+ bool setNetworkClock ( INetworkClock * p_network_clock );
+
+ /**
+ * @return bool
+ * @param p_channel the new value of mpChannel
+ */
+ bool setChannel ( IChannel * p_channel );
+
+ /**
+ * Sets the channel perturbation.
+ * @param is_channel_enabled the new value of mIsChannelEnabled
+ */
+ bool setIsChannelEnabled ( const bool is_channel_enabled );
+
+ /**
+ * Gets the TX ID.
+ * @return mTxId
+ */
+ const Phy_Tx_Id getTxId ( ) const;
+
+ /**
+ * Gets the tonemask.
+ * @return mpTonemask
+ */
+ const uint8_t * getTonemask ( ) const;
+
+ /**
+ * Check if the channel perturbation is enabled.
+ * @return mIsChannelEnabled
+ */
+ bool isChannelEnabled ( ) const;
+
+ /**
+ * Sets the power line frequency.
+ * @param frequency the new value of mFrequency
+ * @return bool
+ */
+ bool setFrequency ( const float frequency );
+
+ /**
+ * Gets the power line frequency.
+ * @return mFrequency
+ */
+ const float getFrequency ( ) const;
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY processor class attributes.
+ */
+ void initAttributes ( );
+
+ /**
+ * Registers the PHY SCI message creation function to the SCI server.
+ */
+ void registerPhySciMsg ( );
+
+ /**
+ * Computes PREAMBLE transmission duration.
+ * @return preamble delay in ticks
+ */
+ Network_Clock_Tick calculatePreDelay ( ) const;
+
+ /**
+ * Computes Frame Control transmission duration.
+ * @return Frame Control delay in ticks
+ */
+ Network_Clock_Tick calculateFcDelay ( Phy_Fc_Mode fc_mode ) const;
+
+ /**
+ * Computes MPDU payload transission duration.
+ * @return MPDU payload delay in ticks
+ */
+ Network_Clock_Tick calculateMpduDelay ( Phy_Mod mod,
+ Phy_Fecrate fecrate,
+ unsigned short int pb_size,
+ Phy_Nb_Of_Pbs pb_nb,
+ Phy_Gil gil ) const;
+
+ /**
+ * @return bool
+ * @param phy_sci_msg_to_send
+ */
+ bool fillMsg ( PhySciMsg & phy_sci_msg_to_send ) const;
+
+ /**
+ * @return a pointer to SCI server
+ */
+ ISci * getSciServer ( ) const;
+
+ /**
+ * @return a pointer to Network Clock Processor
+ */
+ INetworkClock * getNetworkClock ( ) const;
+
+ /**
+ * Gets a pointer to Channel.
+ * @return mpChannel
+ */
+ IChannel * getChannel ( ) const;
+
+ /**
+ * Gets the number of carriers.
+ * @return mNbOfCarriers
+ */
+ const unsigned int getNbOfCarriers ( ) const;
+
+ /**
+ * Sets the number of carriers.
+ * @return bool
+ * @param nb_of_carriers the new value of mNbOfCarriers
+ */
+ bool setNbOfCarriers ( const unsigned int nb_of_carriers );
+
+ /**
+ * Sets the tonemask.
+ * @return bool
+ * @param length the tonemask length in octets
+ * @param p_tonemask the new value of mpTonemask
+ */
+ bool setTonemask ( const unsigned int length, const uint8_t * p_tonemask );
+
+ /**
+ * Increments the TX ID.
+ * @return bool
+ */
+ bool incrementTxId ( );
+
+ /**
+ * Gets the interface callback function for PHY SCI message MPDU reception.
+ * @return mInterfaceCb
+ */
+ PhyMpduCb getInterfaceCb ( ) const;
+
+ /**
+ * Gets the zero-cross delay for PHY SCI message of type ZERO_CROSS transmission.
+ * @return mZeroCrossDelay
+ */
+ const Network_Clock_Tick getZeroCrossDelay ( ) const;
+
+ /**
+ * Sets the zero-cross delay for PHY SCI message of type ZERO_CROSS transmission.
+ * @param zero_cross_delay the new value of mZeroCrossDelay
+ * @return bool
+ */
+ bool setZeroCrossDelay ( const Network_Clock_Tick zero_cross_delay );
+
+ /**
+ * Gets a pointer to the PHY SCI message of type ZERO_CROSS.
+ * @return mpZeroCross
+ */
+ PhySciMsg * getZeroCross ( ) const;
+
+ /**
+ * Schedules an event for next PHY SCI message of type ZERO_CROSS transmission.
+ * @return bool
+ */
+ bool scheduleZeroCross ( );
+
+ /**
+ * Sends a PHY SCI message of type MPDU to destination stations.
+ * @param mpdu the PHY SCI message MPDU to send
+ * @return bool
+ */
+ bool sendMpduToDestStations ( PhySciMsgMpdu & mpdu );
+
+ /**
+ * Sends an empty PHY SCI message of type NOISE to destination stations.
+ * @param noise the empty PHY SCI message NOISE to send
+ * @return bool
+ */
+ bool sendEmptyNoiseToDestStations ( PhySciMsgNoise & noise );
+
+ /**
+ * Sends PHY SCI message(s) of type MPDU
+ * and a PHY SCI message of type NOISE
+ * to destination stations.
+ * @param mpdu the PHY SCI message of type MPDU
+ * @return bool
+ */
+ bool sendMpduAndNoiseToDestStations ( PhySciMsgMpdu & mpdu );
+
+ /**
+ * Update the list of destination stations.
+ * Once a PHY SCI message MPDU has been sent to the destination stations,
+ * remove the destination stations from the reception list.
+ */
+ void updateListOfRxStations ( PhySciMsgMpdu & mpdu );
+
+ /**
+ * Check if the wrong preambles transmission is enabled or not.
+ * @return mIsFalseAlarmActivated
+ */
+ const bool isFalseAlarmActivated ( ) const;
+
+ /**
+ * Gets a pointer to the PHY SCI message of type PREAMBLE with the flag PHY_FLAG_WRONG_PREAMBLE set.
+ * @return mpWrongPre
+ */
+ PhySciMsgPre * getWrongPre ( ) const;
+
+ /**
+ * Gets the average number of ticks 25 MHz between 2 consecutive wrong preambles transmissions.
+ * @return mAverageDuration
+ */
+ const Network_Clock_Tick getAverageDuration ( ) const;
+
+ /**
+ * Gets the standard deviation (used to calculate date of the next wrong preamble transmission).
+ * @return mStdDeviation
+ */
+ const float getStdDeviation ( ) const;
+
+ /**
+ * Calculate date of next wrong preamble transmission.
+ * @return the calculated date in ticks 25 MHz
+ */
+ const Network_Clock_Tick calculateNextWrongPreDate ( ) const;
+
+ /**
+ * Schedules an event for next wrong preamble transmission.
+ * @param tick_wrong_pre the next wrong preamble should be transmitted at current date + tick_wrong_pre (in 25 MHz)
+ * @return bool
+ */
+ bool scheduleNextWrongPre ( const Network_Clock_Tick tick_wrong_pre ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYPROCESSOR_H
diff --git a/cesar/maximus/phy/inc/PhyProcessorTest.h b/cesar/maximus/phy/inc/PhyProcessorTest.h
new file mode 100644
index 0000000000..bcb8fdf1ac
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhyProcessorTest.h
@@ -0,0 +1,74 @@
+
+#ifndef PHYPROCESSORTEST_H
+#define PHYPROCESSORTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhyProcessor;
+class CoreEngine;
+
+
+class PhyProcessorTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhyProcessorTest);
+ CPPUNIT_TEST (initTest);
+ CPPUNIT_TEST (createMsgTest);
+ CPPUNIT_TEST (createMpduTest);
+ CPPUNIT_TEST (sendMsgTest);
+ CPPUNIT_TEST (sendMpduTest);
+ CPPUNIT_TEST (receiveEvtTest);
+ CPPUNIT_TEST (receiveInvalidTest);
+ CPPUNIT_TEST (receivePreTest);
+ CPPUNIT_TEST (receiveFcTest);
+ CPPUNIT_TEST (receivePrsTest);
+ CPPUNIT_TEST (receiveMpduTest);
+ CPPUNIT_TEST (receiveTonemaskTest);
+ CPPUNIT_TEST (receiveTonemapTest);
+ CPPUNIT_TEST (receiveRxTest);
+ CPPUNIT_TEST (setNetworkClockTest);
+ CPPUNIT_TEST (setChannelTest);
+ CPPUNIT_TEST (setIsChannelEnabledTest);
+ CPPUNIT_TEST (setFrequencyTest);
+ CPPUNIT_TEST (activateFalseAlarmTest);
+ CPPUNIT_TEST (deactivateFalseAlarmTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void initTest (void);
+ void createMsgTest (void);
+ void createMpduTest (void);
+ void sendMsgTest (void);
+ void sendMpduTest (void);
+ void receiveEvtTest (void);
+ void receiveInvalidTest (void);
+ void receivePreTest (void);
+ void receiveFcTest (void);
+ void receivePrsTest (void);
+ void receiveMpduTest (void);
+ void receiveTonemaskTest (void);
+ void receiveTonemapTest (void);
+ void receiveRxTest (void);
+ void setNetworkClockTest (void);
+ void setChannelTest (void);
+ void setIsChannelEnabledTest (void);
+ void setFrequencyTest (void);
+ void activateFalseAlarmTest (void);
+ void deactivateFalseAlarmTest (void);
+
+private:
+
+ PhyProcessor * mpPhyProcessor;
+ CoreEngine * mpCoreEngine;
+
+};
+
+
+#endif // PHYPROCESSORTEST_H
diff --git a/cesar/maximus/phy/inc/PhySciMsg.h b/cesar/maximus/phy/inc/PhySciMsg.h
new file mode 100644
index 0000000000..f543106e11
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsg.h
@@ -0,0 +1,524 @@
+/************************************************************************
+ PhySciMsg.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/inc/PhySciMsg.h
+**************************************************************************/
+
+#ifndef PHYSCIMSG_H
+#define PHYSCIMSG_H
+
+#include "SciMsg.h"
+
+#include "phy_types.h"
+#include "hal_phy_types.h"
+#include "networkclock_types.h"
+
+
+class IPhy;
+
+
+/**
+ * class PhySciMsg
+ */
+
+class PhySciMsg : public SciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+protected:
+
+ // protected attributes
+ //
+
+ // Get from specialized SCI msg header
+ //
+ Phy_Type mSpecializedSciMsgType;
+ Phy_Mpdu_Format mMpduFormat;
+ Phy_Nb_Of_Pbs mNbOfPbs;
+ unsigned short int mNbOfMsgs;
+ Phy_Fc_Mode mFcMode;
+ Phy_Short_Ppdu mShortPpdu;
+ Phy_Mod mMod;
+ Phy_Fecrate mFecrate;
+ Phy_Gil mGil;
+ Phy_Tonemap_Index mTonemapIndex;
+ Phy_Tx_Id mTxId;
+ Phy_Flags mFlags;
+ bool mIsEncrypted;
+ bool mIsCrcOk;
+ unsigned short int mPbSize;
+ unsigned short int mReserved; // NOT USED YET
+ Phy_Nb_Of_Symbols mNbOfSymbols;
+ uint32_t mIvArray[3];
+ uint32_t mNekArray[4];
+ uint32_t mPbMeasurementArray[PHY_PB_MAX_NB];
+ uint32_t mPbHeaderArray[PHY_PB_MAX_NB];
+
+ // Specialized SCI msg header
+ //
+ Phy_Header mSpecializedSciMsgHeader;
+
+ IPhy * mpPhyProcessor;
+
+ bool mIsSent;
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ PhySciMsg ( IPhy * p_phy_processor );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsg ( );
+
+ // public methods
+ //
+
+ /**
+ * Creates a PHY SCI message.
+ * @return SciMsg *
+ */
+ SciMsg * create ( ) const;
+
+ /**
+ * Handles a received PHY SCI message.
+ * @return bool
+ */
+ bool dispatchMsg ( );
+
+ /**
+ * When receiving a PHY SCI message,
+ * extracts the PHY SCI message header from the received SCI message data.
+ * @return bool
+ */
+ bool identifySpecializedSciMsgHeader ( );
+
+ /**
+ * Checks that software versions are compatible,
+ * i.e. checks specialized SCI msg compatibility (check specialized SCI msg version).
+ * @return bool
+ */
+ bool checkCompatibility ( ) const;
+
+ /**
+ * Checks PHY SCI message header values ranges,
+ * i.e. checks specialized SCI msg validity (check specialized SCI msg header coherence).
+ * @return bool
+ */
+ bool checkValidity ( ) const;
+
+ /**
+ * Displays the PHY SCI message header contents.
+ */
+ void displaySpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Display the specialized SCI message type.
+ */
+ void displaySpecializedSciMsgType ( int log_level ) const;
+
+ /**
+ * Sets the PHY SCI message attributes before transmission.
+ * @param clock_id ID of the Network Clock event received message
+ * @return bool
+ */
+ virtual bool prepare ( Network_Clock_Id clock_id = 0 );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+ /**
+ * Gets a pointer to the PHY SCI message header.
+ * @return mSpecializedSciMsgHeader into a void pointer
+ */
+ void * returnSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Gets the PHY SCI message header.
+ * @return mSpecializedSciMsgHeader
+ */
+ const Phy_Header & getSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Sets the value of the PHY SCI message header.
+ * @return bool
+ * @param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader
+ */
+ bool setSpecializedSciMsgHeader ( const Phy_Header & specialized_sci_msg_header );
+
+ /**
+ * Gets a pointer to the PHY processor.
+ * @return mpPhyProcessor
+ */
+ IPhy * getPhyProcessor ( ) const;
+
+ /**
+ * Gets the PHY SCI message type.
+ * @return mSpecializedSciMsgType
+ */
+ Phy_Type getSpecializedSciMsgType ( ) const;
+
+ /**
+ * Sets the PHY SCI message type.
+ * @return bool
+ * @param type the new value of mSpecializedSciMsgType
+ */
+ bool setSpecializedSciMsgType ( const Phy_Type type );
+
+ /**
+ * Gets the PHY SCI message MPDU format.
+ * @return mMpduFormat
+ */
+ Phy_Mpdu_Format getMpduFormat ( ) const;
+
+ /**
+ * Sets the PHY SCI message MPDU format.
+ * @return bool
+ * @param mpdu_format the new value of mMpduFormat
+ */
+ bool setMpduFormat ( const Phy_Mpdu_Format mpdu_format );
+
+ /**
+ * Gets the PHY SCI message PB number.
+ * @return mNbOfPbs
+ */
+ Phy_Nb_Of_Pbs getNbOfPbs ( ) const;
+
+ /**
+ * Sets the PHY SCI message PB number.
+ * @return bool
+ * @param nb_of_pbs the new value of mNbOfPbs
+ */
+ bool setNbOfPbs ( const Phy_Nb_Of_Pbs nb_of_pbs );
+
+ /**
+ * Gets the number of PHY SCI messages (composing the MPDU).
+ * @return mNbOfMsgs
+ */
+ const unsigned short int getNbOfMsgs ( ) const;
+
+ /**
+ * Sets the number of PHY SCI messages (composing the MPDU).
+ * @param nb_of_msgs the new value of mNbOfMsgs
+ * @return bool
+ */
+ bool setNbOfMsgs ( const unsigned short int nb_of_msgs );
+
+ /**
+ * Sets the PHY SCI message Frame Control mode.
+ * @return mFcMode
+ */
+ Phy_Fc_Mode getFcMode ( ) const;
+
+ /**
+ * Sets the PHY SCI message Frame Control mode.
+ * @return bool
+ * @param fc_mode the new value of mFcMode
+ */
+ virtual bool setFcMode ( const Phy_Fc_Mode fc_mode );
+
+ /**
+ * Gets the PHY SCI message short PPDU.
+ * @return mShortPpdu
+ */
+ Phy_Short_Ppdu getShortPpdu ( ) const;
+
+ /**
+ * Sets the PHY SCI message short PPDU.
+ * @return bool
+ * @param short_ppdu the new value of mShortPpdu
+ */
+ virtual bool setShortPpdu ( const Phy_Short_Ppdu short_ppdu );
+
+ /**
+ * Gets the PHY SCI message modulation.
+ * @return mMod
+ */
+ Phy_Mod getMod ( ) const;
+
+ /**
+ * Sets the PHY SCI message modulation.
+ * @return bool
+ * @param mod the new value of mMod
+ */
+ virtual bool setMod ( const Phy_Mod mod );
+
+ /**
+ * Gets the PHY SCI message FEC rate.
+ * @return mFecrate
+ */
+ Phy_Fecrate getFecrate ( ) const;
+
+ /**
+ * Sets the PHY SCI message FEC rate.
+ * @return bool
+ * @param fecrate the new value of mFecrate
+ */
+ virtual bool setFecrate ( const Phy_Fecrate fecrate );
+
+ /**
+ * Gets the PHY SCI message Guard Interval.
+ * @return mGil
+ */
+ Phy_Gil getGil ( ) const;
+
+ /**
+ * Sets the PHY SCI message Guard Interval.
+ * @return bool
+ * @param gil the new value of mGil
+ */
+ virtual bool setGil ( const Phy_Gil gil );
+
+ /**
+ * Gets the PHY SCI message tonemap index.
+ * @return mTonemapIndex
+ */
+ Phy_Tonemap_Index getTonemapIndex ( ) const;
+
+ /**
+ * Sets the PHY SCI message tonemap index.
+ * @return bool
+ * @param tonemap_index the new value of mTonemapIndex
+ */
+ bool setTonemapIndex ( const Phy_Tonemap_Index tonemap_index );
+
+ /**
+ * Sets the PHY SCI message transmission ID.
+ * @return mTxId
+ */
+ Phy_Tx_Id getTxId ( ) const;
+
+ /**
+ * Gets the PHY SCI message transmission ID.
+ * @return bool
+ * @param tx_id the new value of mTxId
+ */
+ bool setTxId ( const Phy_Tx_Id tx_id );
+
+ /**
+ * Gets the PHY SCI message flags.
+ * @return mFlags
+ */
+ Phy_Flags getFlags ( ) const;
+
+ /**
+ * Sets the PHY SCI message flags.
+ * @return bool
+ * @param flags the new value of mFlags
+ */
+ virtual bool setFlags ( const Phy_Flags flags );
+
+ /**
+ * Gets if the PHY SCI message is encrypted or not.
+ * @return mIsEncrypted
+ */
+ bool isEncrypted ( ) const;
+
+ /**
+ * Sets if the PHY SCI message is encrypted or not.
+ * @return bool
+ * @param is_encrypted the new value of mIsEncrypted
+ */
+ bool setIsEncrypted ( const bool is_encrypted );
+
+ /**
+ * Gets if the PHY SCI message CRC is OK or not.
+ * @return mIsCrcOk
+ */
+ bool isCrcOk ( ) const;
+
+ /**
+ * Sets if the PHY SCI message CRC is OK or not.
+ * @return bool
+ * @param is_crc_ok the new value of mIsCrcOk
+ */
+ bool setIsCrcOk ( const bool is_crc_ok );
+
+ /**
+ * Gets the PHY SCI message PB size.
+ * @return mPbSize
+ */
+ unsigned short int getPbSize ( ) const;
+
+ /**
+ * Sets the PHY SCI message PB size.
+ * @return bool
+ * @param pb_size the new value of mPbSize
+ */
+ bool setPbSize ( const unsigned short int pb_size );
+
+ /**
+ * Sets the PHY SCI message reserved field (NOT USED YET).
+ * @return mReserved
+ */
+ inline unsigned short int getReserved ( ) const { return mReserved; }
+
+ /**
+ * Sets the PHY SCI message reserved field (NOT USED YET).
+ * @return bool
+ * @param reserved the new value of mReserved
+ */
+ inline bool setReserved ( const unsigned short int reserved ) { mReserved = reserved;
+ return true; }
+
+ /**
+ * Gets the PHY SCI message symbols number.
+ * @return mNbOfSymbols
+ */
+ Phy_Nb_Of_Symbols getNbOfSymbols ( ) const;
+
+ /**
+ * Sets the PHY SCI message symbols number.
+ * @return bool
+ * @param nb_of_symbols the new value of mNbOfSymbols
+ */
+ bool setNbOfSymbols ( const Phy_Nb_Of_Symbols nb_of_symbols );
+
+ /**
+ * Gets the PHY SCI message IV array.
+ * @return mIvArray
+ */
+ const uint32_t * getIv ( ) const;
+
+ /**
+ * Sets the PHY SCI message IV array.
+ * @return bool
+ * @param iv the new value of mIvArray
+ */
+ bool setIv ( const uint32_t iv[3] );
+
+ /**
+ * Gets the PHY SCI message NEK array.
+ * @return mNekArray
+ */
+ const uint32_t * getNek ( ) const;
+
+ /**
+ * Sets the PHY SCI message NEK array.
+ * @return bool
+ * @param nek the new value of mNekArray
+ */
+ bool setNek ( const uint32_t nek[4] );
+
+ /**
+ * Gets the PHY SCI message PB measurement array.
+ * @return mPbMeasurementArray
+ */
+ const uint32_t * getPbMeasurement ( ) const;
+
+ /**
+ * Sets the PHY SCI message PB measurement array.
+ * @return bool
+ * @param pb_measurement the new value of mPbMeasurementArray
+ */
+ bool setPbMeasurement ( const uint32_t pb_measurement[PHY_PB_MAX_NB] );
+
+ /**
+ * Gets the PHY SCI message PB header array.
+ * @return mPbHeaderArray
+ */
+ const uint32_t * getPbHeader ( ) const;
+
+ /**
+ * @return bool
+ * @param pb_header the new value of mPbHeaderArray
+ */
+ bool setPbHeader ( const uint32_t pb_header[PHY_PB_MAX_NB] );
+
+ /**
+ * Checks if the PHY SCI message has been sent.
+ * @return mIsSent
+ */
+ virtual const bool isSent ( ) const;
+
+ /**
+ * Sets if the PHY SCI message has been sent.
+ * @param is_sent the new value of mIsSent
+ * @return bool
+ */
+ bool setIsSent ( const bool is_sent );
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes.
+ */
+ void initAttributes ( );
+
+ /**
+ * Displays the PHY SCI message header IV.
+ */
+ void displayIv ( ) const;
+
+ /**
+ * Displays the PHY SCI message header NEK.
+ */
+ void displayNek ( ) const;
+
+ /**
+ * Displays the PHY SCI message header PBs measurements.
+ */
+ void displayPbMeasurement ( ) const;
+
+ /**
+ * Displays the PHY SCI message header PBs headers.
+ */
+ void displayPbHeader ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYSCIMSG_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgFc.h b/cesar/maximus/phy/inc/PhySciMsgFc.h
new file mode 100644
index 0000000000..df549a1a61
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgFc.h
@@ -0,0 +1,148 @@
+/************************************************************************
+ PhySciMsgFc.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/inc/PhySciMsgFc.h
+**************************************************************************/
+
+#ifndef PHYSCIMSGFC_H
+#define PHYSCIMSGFC_H
+
+#include "PhySciMsg.h"
+
+
+/**
+ * class PhySciMsgFc
+ */
+
+class PhySciMsgFc : public PhySciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ uint32_t mFc10;
+ uint32_t mFcAvArray[4];
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ * Creates a PHY message of type FC_HYBRID_MODE or FC_AV_ONLY_MODE.
+ * @param p_phy_processor a pointer to the PHY interface
+ */
+ PhySciMsgFc ( IPhy * p_phy_processor );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsgFc ( );
+
+ // public methods
+ //
+
+ /**
+ * Sets the PHY SCI message class attributes before transmission,
+ * and fills specialized SCI msg data length and specialized SCI msg data
+ * for a PHY message of type FC_AV_ONLY_MODE or FC_HYBRID_MODE.
+ * @param clock_id ID of the Network Clock event received message
+ * @return bool
+ */
+ bool prepare ( Network_Clock_Id clock_id );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Gets the Frame Control 1.0.
+ * @return mFc10
+ */
+ const uint32_t getFc10 ( ) const;
+
+ /**
+ * Sets the Frame Control 1.0.
+ * @param fc_10 the new value of mFc10
+ * @return bool
+ */
+ bool setFc10 ( const uint32_t fc_10 );
+
+ /**
+ * Gets the Frame Control AV.
+ * @return mFcAvArray
+ */
+ const uint32_t * getFcAv ( ) const;
+
+ /**
+ * Sets the Frame Control AV.
+ * @param fc_av the new value of mFcAvArray
+ * @return bool
+ */
+ bool setFcAv ( const uint32_t fc_av[4] );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes.
+ * Fills PHY SCI message type.
+ */
+ void initAttributes ( );
+
+ // private attribute accessor methods
+ //
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYSCIMSGFC_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgFcTest.h b/cesar/maximus/phy/inc/PhySciMsgFcTest.h
new file mode 100644
index 0000000000..3c9a5f4f83
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgFcTest.h
@@ -0,0 +1,42 @@
+
+#ifndef PHYSCIMSGFCTEST_H
+#define PHYSCIMSGFCTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsgFc;
+class IPhy;
+class ISci;
+
+
+class PhySciMsgFcTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgFcTest);
+ CPPUNIT_TEST (prepareTest);
+ CPPUNIT_TEST (fc10Test);
+ CPPUNIT_TEST (fcAvTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void prepareTest (void);
+ void fc10Test (void);
+ void fcAvTest (void);
+
+private:
+
+ ISci * mpSci;
+ IPhy * mpPhy;
+ PhySciMsgFc * mpPhySciMsgFc;
+
+};
+
+
+#endif // PHYSCIMSGFCTEST_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgMpdu.h b/cesar/maximus/phy/inc/PhySciMsgMpdu.h
new file mode 100644
index 0000000000..ae92ddb628
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgMpdu.h
@@ -0,0 +1,290 @@
+/************************************************************************
+ PhySciMsgMpdu.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/inc/PhySciMsgMpdu.h
+**************************************************************************/
+
+#ifndef PHYSCIMSGMPDU_H
+#define PHYSCIMSGMPDU_H
+
+#include "PhySciMsg.h"
+
+class PhySciMsgPre;
+class PhySciMsgFc;
+
+
+/**
+ * class PhySciMsgMpdu
+ */
+
+class PhySciMsgMpdu : public PhySciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ unsigned long mPayloadLength;
+ unsigned char * mpPayload;
+
+ PhySciMsgPre * mpPre;
+ PhySciMsgFc * mpFc;
+
+ unsigned short int mNbOfPbsInLastMsg;
+ unsigned char mPbsArray[MAC_MAX_PB_PER_MPDU*MAC_PB520_BYTES];
+ uint32_t mPbsHeadersArray[MAC_MAX_PB_PER_MPDU];
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ * Creates a PHY SCI message of type MPDU_PAYLOAD.
+ * @param p_phy_processor a pointer to the PHY interface
+ */
+ PhySciMsgMpdu ( IPhy * p_phy_processor );
+
+ /**
+ * Copy Constructor
+ * Creates a PHY SCI message of type MPDU_PAYLOAD.
+ * @param phy_sci_msg a PHY SCI message
+ */
+ PhySciMsgMpdu ( PhySciMsg & phy_sci_msg );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsgMpdu ( );
+
+ // public methods
+ //
+
+ /**
+ * Segment the MPDU payload into PBs.
+ * Fills PBs headers.
+ * @return bool
+ */
+ bool segment ( );
+
+ /**
+ * Sets the PHY SCI message class attributes before transmission,
+ * and fills specialized SCI msg data length and specialized SCI msg data
+ * for a PHY message of type MPDU_PAYLOAD.
+ * @param clock_id ID of the Network Clock event received message
+ * @return bool
+ */
+ bool prepare ( Network_Clock_Id clock_id );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Gets the MPDU payload length.
+ * @return mPayloadLength
+ */
+ const unsigned long getPayloadLength ( ) const;
+
+ /**
+ * Gets the MPDU payload.
+ * @return mpPayload
+ */
+ const unsigned char * getPayload ( ) const;
+
+ /**
+ * @param length the new value of mPayloadLength
+ * @param p_payload the new value of mpPayload
+ * @return bool
+ */
+ bool setMpdu ( const unsigned long length, const unsigned char * p_payload );
+
+ /**
+ * Gets the PHY SCI message PREAMBLE.
+ * @return mpPre
+ */
+ PhySciMsgPre * getPre ( ) const;
+
+ /**
+ * Gets the PHY SCI message FC.
+ * @return mpFc
+ */
+ PhySciMsgFc * getFc ( ) const;
+
+ /**
+ * Gets the number of PBs into the last PHY SCI message composing the MPDU.
+ * @return mNbOfPbsInLastMsg
+ */
+ const unsigned short int getNbOfPbsInLastMsg ( ) const;
+
+ /**
+ * Sets the number of PBs into the last PHY SCI message composing the MPDU.
+ * @param nb_of_pbs_in_last_msg the new value of mNbOfPbsInLastMsg
+ * @return bool
+ */
+ bool setNbOfPbsInLastMsg ( const unsigned short int nb_of_pbs_in_last_msg );
+
+ /**
+ * Gets a pointer to the PBs of the nth PHY SCI message composing the MPDU.
+ * @return &mPbsArray[n*PHY_PB_MAX_NB*MAC_PB520_BYTES]
+ */
+ const unsigned char * getPbs ( const unsigned short int n = 0 ) const;
+
+ /**
+ * Checks if the PHY SCI message has been sent (MPDU, or FC in case of a short PPDU).
+ * @return (mIsSent || mpFc->mIsSent)
+ */
+ const bool isSent ( ) const;
+
+ /**
+ * Checks if the MPDU has been completely received
+ * (i.e. all PHY SCI messages MPDU composing the MPDU have been received).
+ * @param nb_of_received_msgs number of PHY SCI messages MPDU that have been received
+ * @return nb_of_received_msgs == mNbOfMsgs
+ */
+ const bool isReceived ( const unsigned short int nb_of_received_msgs ) const;
+
+ /**
+ * Sets the PHY SCI message Frame Control mode for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param fc_mode the new value of mFcMode, mpPre->mFcMode and mpFc->mFcMode
+ */
+ bool setFcMode ( const Phy_Fc_Mode fc_mode );
+
+ /**
+ * Sets the PHY SCI message short PPDU for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param short_ppdu the new value of mShortPpdu, mpPre->mShortPpdu and mpFc->mShortPpdu
+ */
+ bool setShortPpdu ( const Phy_Short_Ppdu short_ppdu );
+
+ /**
+ * Sets the PHY SCI message modulation for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param mod the new value of mMod, mpPre->mMod and mpFc->mMod
+ */
+ bool setMod ( const Phy_Mod mod );
+
+ /**
+ * Sets the PHY SCI message FEC rate for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param fecrate the new value of mFecrate, mpPre->mFecrate and mpFc->mFecrate
+ */
+ bool setFecrate ( const Phy_Fecrate fecrate );
+
+ /**
+ * Sets the PHY SCI message Guard Interval for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param gil the new value of mGil, mpPre->mGil and mpFc->mGil
+ */
+ bool setGil ( const Phy_Gil gil );
+
+ /**
+ * Sets the PHY SCI message flags for PREAMBLE, FC and MPDU.
+ * @return bool
+ * @param flags the new value of mFlags, mpPre->mFlags and mpFc->mFlags
+ */
+ bool setFlags ( const Phy_Flags flags );
+
+ /**
+ * Gets the Frame Control 1.0 of the PHY SCI message FC.
+ * @return mpFc->mFc10
+ */
+ const uint32_t getFc10 ( ) const;
+
+ /**
+ * Sets the Frame Control 1.0 of the PHY SCI message FC.
+ * @param fc_10 the new value of mpFc->mFc10
+ * @return bool
+ */
+ bool setFc10 ( const uint32_t fc_10 );
+
+ /**
+ * Gets the Frame Control AV of the PHY SCI message FC.
+ * @return mpFc->mFcAvArray
+ */
+ const uint32_t * getFcAv ( ) const;
+
+ /**
+ * Sets the Frame Control AV of the PHY SCI message FC.
+ * @param fc_av the new value of mpFc->mFcAvArray
+ * @return bool
+ */
+ bool setFcAv ( const uint32_t fc_av[4] );
+
+ /**
+ * Gets a pointer to the PB Header of the nth PHY SCI message composing the MPDU.
+ * @return &mPbsHeadersArray[n*PHY_PB_MAX_NB]
+ */
+ const uint32_t * getPbsHeaders ( const unsigned short int n ) const;
+
+ /**
+ * Sets the (n)th PB header.
+ * @param n indicates the number of the PB to set
+ * @param pb_header the value of the (n)th PB Header
+ * @return bool
+ */
+ bool setPbsHeaders ( const unsigned short int n, const uint32_t pb_header );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes.
+ * Fills PHY SCI message type.
+ * @param p_phy_processor a pointer to the PHY interface
+ */
+ void initAttributes ( IPhy * p_phy_processor );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYSCIMSGMPDU_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgMpduTest.h b/cesar/maximus/phy/inc/PhySciMsgMpduTest.h
new file mode 100644
index 0000000000..ce0b2fc8d3
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgMpduTest.h
@@ -0,0 +1,48 @@
+
+#ifndef PHYSCIMSGMPDUTEST_H
+#define PHYSCIMSGMPDUTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsgMpdu;
+class IPhy;
+class ISci;
+
+
+class PhySciMsgMpduTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgMpduTest);
+ CPPUNIT_TEST (segmentTest);
+ CPPUNIT_TEST (prepareTest);
+ CPPUNIT_TEST (setMpduTest);
+ CPPUNIT_TEST (setNbOfMsgsTest);
+ CPPUNIT_TEST (setNbOfPbsInLastMsgTest);
+ CPPUNIT_TEST (setPbsHeadersTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void segmentTest (void);
+ void prepareTest (void);
+ void setMpduTest (void);
+ void setNbOfMsgsTest (void);
+ void setNbOfPbsInLastMsgTest (void);
+ void setPbsHeadersTest (void);
+
+private:
+
+ ISci * mpSci;
+ IPhy * mpPhy;
+ PhySciMsgMpdu * mpPhySciMsgMpdu;
+
+};
+
+
+#endif // PHYSCIMSGMPDUTEST_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgNoise.h b/cesar/maximus/phy/inc/PhySciMsgNoise.h
new file mode 100644
index 0000000000..3afeab00d5
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgNoise.h
@@ -0,0 +1,87 @@
+
+#ifndef PHYSCIMSGNOISE_H_
+#define PHYSCIMSGNOISE_H_
+
+#include "PhySciMsg.h"
+
+
+/**
+ * class PhySciMsgNoise
+ */
+
+class PhySciMsgNoise : public PhySciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ * Creates a PHY message of type NOISE.
+ * @param p_phy a pointer to the PHY interface
+ */
+ PhySciMsgNoise ( IPhy * p_phy );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsgNoise ( );
+
+ // public methods
+ //
+
+ /**
+ * Sets the PHY SCI message class attributes before transmission
+ * for a PHY message of type NOISE.
+ * @return bool
+ */
+ bool prepare ( );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes:
+ * fills PHY SCI message type,
+ * and specialized SCI msg data length.
+ *
+ */
+ void initAttributes ( );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif /*PHYSCIMSGNOISE_H_*/
diff --git a/cesar/maximus/phy/inc/PhySciMsgNoiseTest.h b/cesar/maximus/phy/inc/PhySciMsgNoiseTest.h
new file mode 100644
index 0000000000..250af709e3
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgNoiseTest.h
@@ -0,0 +1,38 @@
+
+#ifndef PHYSCIMSGNOISETEST_H_
+#define PHYSCIMSGNOISETEST_H_
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsgNoise;
+class IPhy;
+class ISci;
+
+
+class PhySciMsgNoiseTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgNoiseTest);
+ CPPUNIT_TEST (prepareTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void prepareTest (void);
+
+private:
+
+ ISci * mpSci;
+ IPhy * mpPhy;
+ PhySciMsgNoise * mpPhySciMsgNoise;
+
+};
+
+
+#endif /*PHYSCIMSGNOISETEST_H_*/
diff --git a/cesar/maximus/phy/inc/PhySciMsgPre.h b/cesar/maximus/phy/inc/PhySciMsgPre.h
new file mode 100644
index 0000000000..5cdce244c1
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgPre.h
@@ -0,0 +1,116 @@
+/************************************************************************
+ PhySciMsgPre.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/inc/PhySciMsgPre.h
+**************************************************************************/
+
+#ifndef PHYSCIMSGPRE_H
+#define PHYSCIMSGPRE_H
+
+#include "PhySciMsg.h"
+
+
+/**
+ * class PhySciMsgPre
+ */
+
+class PhySciMsgPre : public PhySciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ * Creates a PHY message of type PREAMBLE.
+ * @param p_phy_processor a pointer to the PHY interface
+ */
+ PhySciMsgPre ( IPhy * p_phy_processor );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~PhySciMsgPre ( );
+
+ // public methods
+ //
+
+ /**
+ * Sets the PHY SCI message class attributes before transmission,
+ * and fills specialized SCI msg data length and specialized SCI msg data
+ * for a PHY SCI message of type PREAMBLE.
+ * @param clock_id ID of the Network Clock event received message
+ * @return bool
+ */
+ bool prepare ( Network_Clock_Id clock_id );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * Initializes the PHY SCI message class attributes.
+ * Fills PHY SCI message type.
+ */
+ void initAttributes ( );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // PHYSCIMSGPRE_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgPreTest.h b/cesar/maximus/phy/inc/PhySciMsgPreTest.h
new file mode 100644
index 0000000000..ff00d90436
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgPreTest.h
@@ -0,0 +1,38 @@
+
+#ifndef PHYSCIMSGPRETEST_H
+#define PHYSCIMSGPRETEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsgPre;
+class IPhy;
+class ISci;
+
+
+class PhySciMsgPreTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgPreTest);
+ CPPUNIT_TEST (prepareTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void prepareTest (void);
+
+private:
+
+ ISci * mpSci;
+ IPhy * mpPhy;
+ PhySciMsgPre * mpPhySciMsgPre;
+
+};
+
+
+#endif // PHYSCIMSGPRETEST_H
diff --git a/cesar/maximus/phy/inc/PhySciMsgTest.h b/cesar/maximus/phy/inc/PhySciMsgTest.h
new file mode 100644
index 0000000000..4619423ac9
--- /dev/null
+++ b/cesar/maximus/phy/inc/PhySciMsgTest.h
@@ -0,0 +1,38 @@
+
+#ifndef PHYSCIMSGTEST_H
+#define PHYSCIMSGTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class PhySciMsg;
+class PhyProcessor;
+class SciServer;
+
+
+class PhySciMsgTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (PhySciMsgTest);
+ CPPUNIT_TEST (dispatchMsgTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void dispatchMsgTest (void);
+
+private:
+
+ PhySciMsg * mpPhySciMsg;
+ PhyProcessor * mpPhyProcessor;
+ SciServer * mpSciServer;
+
+};
+
+
+#endif // PHYSCIMSGTEST_H
diff --git a/cesar/maximus/phy/src/PhyProcessor.cpp b/cesar/maximus/phy/src/PhyProcessor.cpp
new file mode 100644
index 0000000000..e176036557
--- /dev/null
+++ b/cesar/maximus/phy/src/PhyProcessor.cpp
@@ -0,0 +1,1530 @@
+/************************************************************************
+ PhyProcessor.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/src/PhyProcessor.cpp
+**************************************************************************/
+
+#include "PhyProcessor.h"
+
+#include "PhySciMsg.h"
+#include "PhySciMsgMpdu.h"
+#include "PhySciMsgNoise.h"
+#include "PhySciMsgPre.h"
+#include "ISci.h"
+#include "NetworkClockEvt.h"
+#include "INetworkClock.h"
+#include "IChannel.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include "hal/phy/maximus/dur/inc/maximus_dur.h"
+#include "hal/phy/maximus/inc/maximus_defs.h" // for 'MAXIMUS_PHY_FC_RECEPTION_DELAY_TCK' and 'MAXIMUS_PHY_MPDU_RECEPTION_DELAY_TCK'
+#include "mac/common/timings.h" // for 'MAC_PREAMBLE_TCK', 'MAC_PREAMBLE_HYBRID_TCK', 'MAC_FC_10_TCK', and 'MAC_FC_AV_TCK'
+
+#include <string> // for 'memset()' and 'memcpy()'
+#include <netinet/in.h> // for 'htonl()' and 'htons()'
+#include <boost/random/mersenne_twister.hpp> // for random
+#include <boost/random/normal_distribution.hpp>
+#include <boost/random/variate_generator.hpp>
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+PhyProcessor::PhyProcessor ( ISci * p_sci_server ):
+mpSciServer(NULL),
+mpNetworkClock(NULL),
+mpChannel(NULL),
+mIsChannelEnabled(false),
+mNbOfCarriers(0),
+mpTonemask(NULL),
+mTxId(0),
+mInterfaceCb(NULL),
+mFrequency(0),
+mZeroCrossDelay(0),
+mpZeroCross(NULL),
+mIsFalseAlarmActivated(false),
+mpWrongPre(NULL),
+mAverageDuration(0),
+mStdDeviation(0)
+{
+ logFunction();
+
+ if (NULL != p_sci_server)
+ {
+ mpSciServer = p_sci_server;
+ registerPhySciMsg();
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL", errno);
+ }
+
+ initAttributes();
+}
+
+
+void PhyProcessor::initAttributes ( )
+{
+ logFunction();
+}
+
+
+PhyProcessor::~PhyProcessor ( )
+{
+ logFunction();
+
+ if (NULL != mpSciServer)
+ {
+ mpSciServer = NULL;
+ }
+ if (NULL != mpNetworkClock)
+ {
+ mpNetworkClock = NULL;
+ }
+ if (NULL != mpChannel)
+ {
+ mpChannel = NULL;
+ }
+ if (NULL != mpTonemask)
+ {
+ delete [] mpTonemask;
+ mpTonemask = NULL;
+ }
+ mListOfRxStations.clear();
+ mListOfRxFc.clear();
+ if (NULL != mpZeroCross)
+ {
+ delete(mpZeroCross);
+ mpZeroCross = NULL;
+ }
+ for (RxMpduList::iterator it = mListOfRxMpdu.begin(); it != mListOfRxMpdu.end();)
+ {
+ RxMpduList::iterator pos = it;
+ ++it;
+ if (NULL != pos->second.p_data)
+ {
+ delete [] pos->second.p_data;
+ }
+ }
+ mListOfRxMpdu.clear();
+
+ if (NULL != mpWrongPre)
+ {
+ delete(mpWrongPre);
+ mpWrongPre = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool PhyProcessor::init ( PhyMpduCb interface_cb )
+{
+ logFunction();
+ bool bInit = false;
+
+ if (NULL != interface_cb)
+ {
+ mInterfaceCb = interface_cb;
+ bInit = true;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Callback function address is NULL", errno);
+ }
+
+ return bInit;
+}
+
+
+bool PhyProcessor::init ( const float frequency )
+{
+ logFunction();
+ bool bInit = false;
+
+ // Create a PHY SCI message of type ZERO_CROSS
+ mpZeroCross = new PhySciMsg(this);
+ bInit = mpZeroCross->setSpecializedSciMsgType(PHY_TYPE_ZERO_CROSS);
+ bInit &= mpZeroCross->setFlags(PHY_FLAG_CRC_OK);
+ bInit &= mpZeroCross->setSciMsgStationId(getpid());
+
+ // Set power line frequency
+ bInit = setFrequency(frequency);
+
+ if (0 != frequency)
+ {
+ // Calculate zero-cross delay, and set it
+ Network_Clock_Tick zeroCrossDelay = (Network_Clock_Tick)(25000000/(2*frequency));
+ bInit &= setZeroCrossDelay(zeroCrossDelay);
+
+ // Schedules a PHY SCI message of type ZERO_CROSS
+ bInit &= scheduleZeroCross();
+ }
+
+ return bInit;
+}
+
+
+PhySciMsg * PhyProcessor::createMsg ( )
+{
+ logFunction();
+
+ return new PhySciMsg(this);
+}
+
+
+PhySciMsgMpdu * PhyProcessor::createMpdu ( )
+{
+ logFunction();
+
+ return new PhySciMsgMpdu(this);
+}
+
+
+bool PhyProcessor::sendMpdu ( PhySciMsgMpdu * p_mpdu )
+{
+ logFunction();
+ bool bSendMpdu = false;
+
+ if (NULL == p_mpdu)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message MPDU pointer is NULL", errno);
+ }
+
+ // Schedule PREAMBLE message
+ Network_Clock_Tick tickPre = getNetworkClock()->getCurrentTickValue() + calculatePreDelay();
+ NetworkClockEvt evtPre ( 0, // station_id
+ NETWORK_CLOCK_TYPE_PHY,
+ 0, // id = 0 for PREAMBLE
+ (void *)p_mpdu->getPre() );
+ bSendMpdu = getNetworkClock()->insertEvt(tickPre, evtPre);
+
+ // Schedule FC message
+ Network_Clock_Tick tickFc = getNetworkClock()->getCurrentTickValue() + calculateFcDelay(p_mpdu->getFcMode());
+ NetworkClockEvt evtFc ( 0, // station_id
+ NETWORK_CLOCK_TYPE_PHY,
+ 0, // id = 0 for FC
+ (void *)p_mpdu->getFc() );
+ bSendMpdu &= getNetworkClock()->insertEvt(tickFc, evtFc);
+
+ // Schedule MPDU message(s)
+ if (!p_mpdu->getShortPpdu())
+ {
+ // segmentation in PBs
+ bSendMpdu &= p_mpdu->segment();
+
+ Network_Clock_Tick tickMpdu = getNetworkClock()->getCurrentTickValue() \
+ + calculateMpduDelay(p_mpdu->getMod(), \
+ p_mpdu->getFecrate(), \
+ p_mpdu->getPbSize(), \
+ p_mpdu->getNbOfPbs(), \
+ p_mpdu->getGil());
+
+ // insert a Network Clock event
+ NetworkClockEvt evtMpdu ( 0, // station_id
+ NETWORK_CLOCK_TYPE_PHY,
+ p_mpdu->getNbOfMsgs(), // id = message number for MPDU
+ (void *)p_mpdu );
+ bSendMpdu &= getNetworkClock()->insertEvt(tickMpdu, evtMpdu);
+ }
+
+ if (!bSendMpdu)
+ {
+ throw Error(__PRETTY_FUNCTION__, "cannot send MPDU", errno);
+ }
+
+ return bSendMpdu;
+}
+
+
+bool PhyProcessor::receiveEvt ( NetworkClockEvt & received_evt )
+{
+ logFunction();
+ bool bReceiveEvt = true;
+
+ PhySciMsg * pPhySciMsgToSend = (PhySciMsg *)received_evt.getData();
+ if (NULL == pPhySciMsgToSend)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message pointer is NULL", errno);
+ }
+
+ if (PHY_TYPE_PREAMBLE == pPhySciMsgToSend->getSpecializedSciMsgType())
+ {
+ // Increment TX ID at the beginning of each transmission
+ bReceiveEvt &= incrementTxId();
+ }
+
+ if (PHY_TYPE_MPDU_PAYLOAD == pPhySciMsgToSend->getSpecializedSciMsgType())
+ {
+ PhySciMsgMpdu * pMpdu = (PhySciMsgMpdu *)received_evt.getData();
+
+ // Set TX ID
+ bReceiveEvt &= pMpdu->setTxId(getTxId());
+
+ // Set station ID to Maximus PID
+ bReceiveEvt &= pMpdu->setSciMsgStationId(getpid());
+
+ if (!isChannelEnabled())
+ {
+ // For each PHY SCI message composing the MPDU
+ for (int n=1; n<=pMpdu->getNbOfMsgs(); n++)
+ {
+ // Prepare PHY SCI message before transmission
+ bReceiveEvt &= pMpdu->prepare(n);
+
+ // Set PHY SCI message PB Header
+ bReceiveEvt &= pMpdu->setPbHeader(pMpdu->getPbsHeaders(n-1));
+
+ // Send PHY SCI message MPDU
+ bReceiveEvt &= sendMpduToDestStations(*pMpdu);
+ }
+
+ // Send empty PHY SCI message NOISE
+ PhySciMsgNoise noise(this);
+ bReceiveEvt &= noise.setTxId(pMpdu->getTxId()); // set TX ID
+ bReceiveEvt &= noise.setSciMsgStationId(pMpdu->getSciMsgStationId()); // set station ID to Maximus PID
+ bReceiveEvt &= sendEmptyNoiseToDestStations(noise);
+
+ // Update list of destination stations
+ if (pMpdu->isSent())
+ {
+ updateListOfRxStations(*pMpdu);
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message MPDU has not been correctly sent");
+ }
+ }
+ else
+ {
+ bReceiveEvt &= sendMpduAndNoiseToDestStations(*pMpdu);
+ }
+ }
+ else if (PHY_TYPE_ZERO_CROSS == pPhySciMsgToSend->getSpecializedSciMsgType())
+ {
+ if (0 != getFrequency())
+ {
+ bReceiveEvt &= scheduleZeroCross();
+ bReceiveEvt &= sendMsgToAllStations(*pPhySciMsgToSend);
+ }
+ }
+ else if ( (PHY_TYPE_PREAMBLE == pPhySciMsgToSend->getSpecializedSciMsgType())
+ && (PHY_FLAG_WRONG_PREAMBLE == (pPhySciMsgToSend->getFlags() & PHY_FLAG_WRONG_PREAMBLE)) )
+ {
+ if (isFalseAlarmActivated())
+ {
+ // Prepare PHY SCI message before transmission
+ bReceiveEvt &= pPhySciMsgToSend->prepare(received_evt.getNetworkClockId());
+
+ bReceiveEvt &= sendMsgToAllStations(*pPhySciMsgToSend);
+
+ bReceiveEvt &= scheduleNextWrongPre(calculateNextWrongPreDate());
+ }
+ }
+ else
+ {
+ // Prepare PHY SCI message before transmission
+ bReceiveEvt &= pPhySciMsgToSend->prepare(received_evt.getNetworkClockId());
+
+ bReceiveEvt &= sendMsgToAllStations(*pPhySciMsgToSend);
+ }
+
+ return bReceiveEvt;
+}
+
+
+bool PhyProcessor::receiveInvalid ( PhySciMsg & received_phy_sci_msg )
+{
+ logFunction();
+
+ errno = ENOMSG;
+ throw Error(__PRETTY_FUNCTION__, "receive PHY SCI message of invalid type", errno);
+
+ return false;
+}
+
+
+bool PhyProcessor::receivePre ( PhySciMsg & received_phy_sci_msg )
+{
+ logFunction();
+
+ if (isChannelEnabled())
+ {
+ getChannel()->receivePre(received_phy_sci_msg.getSciMsgStationId(), getNetworkClock()->getCurrentTickValue());
+ }
+
+ return sendMsgToAllStations(received_phy_sci_msg);
+}
+
+
+bool PhyProcessor::receiveFc ( PhySciMsg & received_phy_sci_msg )
+{
+ logFunction();
+
+ // Check PHY SCI message data length
+ if ( ((PHY_TYPE_FC_HYBRID_MODE == received_phy_sci_msg.getSpecializedSciMsgType())
+ && (5*sizeof(uint32_t) != received_phy_sci_msg.getSpecializedSciMsgDataLength()))
+ || ((PHY_TYPE_FC_AV_ONLY_MODE == received_phy_sci_msg.getSpecializedSciMsgType())
+ && (4*sizeof(uint32_t) != received_phy_sci_msg.getSpecializedSciMsgDataLength()))
+ || (NULL == received_phy_sci_msg.getSpecializedSciMsgData()) )
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "received PHY SCI message FC is incorrect", errno);
+ }
+
+ if (NULL != getInterfaceCb())
+ {
+ Frame_Control fc;
+ unsigned char * pDataIndex = received_phy_sci_msg.getSpecializedSciMsgData();
+ if (PHY_TYPE_FC_HYBRID_MODE == received_phy_sci_msg.getSpecializedSciMsgType())
+ {
+ memcpy(&fc.fc_10, pDataIndex, sizeof(uint32_t));
+ pDataIndex += sizeof(uint32_t);
+ }
+ else
+ {
+ fc.fc_10 = 0;
+ }
+ memcpy(fc.fc_av, pDataIndex, 4*sizeof(uint32_t));
+
+ Expected_Tx tx;
+ tx.src_tx_id = received_phy_sci_msg.getTxId();
+ tx.src_station_id = received_phy_sci_msg.getSciMsgStationId();
+ mListOfRxFc[tx] = fc;
+ }
+
+ if (isChannelEnabled())
+ {
+ getChannel()->receiveFc(received_phy_sci_msg.getSciMsgStationId(), getNetworkClock()->getCurrentTickValue());
+ }
+
+ return sendMsgToAllStations(received_phy_sci_msg);
+}
+
+
+bool PhyProcessor::receivePrs ( PhySciMsg & received_phy_sci_msg )
+{
+ logFunction();
+
+ return sendMsgToAllStations(received_phy_sci_msg);
+}
+
+
+bool PhyProcessor::receiveMpdu ( PhySciMsg & received_phy_sci_msg )
+{
+ logFunction();
+ bool bReceiveMpdu = true;
+
+ PhySciMsgMpdu mpdu(received_phy_sci_msg);
+
+ // Check PHY SCI message data length
+ if ( (0 == mpdu.getSpecializedSciMsgDataLength())
+ || (NULL == mpdu.getSpecializedSciMsgData()) )
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "received PHY SCI message MPDU is incorrect", errno);
+ }
+
+ /**
+ * Lots of things to do in this function...
+ * Not optimized at all, but easier to understand!
+ * Following order has to be respected:
+ * 1. IF there is a reception callback
+ * OR IF the channel perturbation is enabled,
+ * THEN update list of received MPDU.
+ * 2. IF there is a reception callback
+ * AND IF the entire MPDU has been received,
+ * THEN call the reception callback.
+ * 3. IF the channel perturbation is disabled
+ * AND IF there is no reception callback
+ * OR IF there is a reception callback AND IF the entire MPDU has been received,
+ * THEN re-send the received MPDU and an empty NOISE at the end of the MPDU transmission
+ * to destination stations.
+ * 4. IF the channel perturbation is enabled
+ * AND IF the entire MPDU has been received,
+ * THEN send the entire MPDU (with PB measurement) and the NOISE to destination stations
+ * (noise must be sent only at the end of the MPDU transmission).
+ * 5. IF the entire MPDU has been received,
+ * THEN update RX lists.
+ */
+
+ // Create Expected_Tx for the list of received MPDU and the list of received FC
+ Expected_Tx tx;
+ tx.src_tx_id = mpdu.getTxId();
+ tx.src_station_id = mpdu.getSciMsgStationId();
+
+
+ /* 1. Update list of received MPDU. */
+
+ if ((NULL != getInterfaceCb()) || isChannelEnabled())
+ {
+ // Create Mpdu_Payload for the list of received MPDU
+ Mpdu_Payload payload;
+ memset(&payload, '\0', sizeof(struct Mpdu_Payload));
+
+ // Check if a PHY SCI message MPDU with the same transmission ID
+ // has already been received from this transmitting station
+ bool bFound = false;
+ for (RxMpduList::iterator it = mListOfRxMpdu.begin(); it != mListOfRxMpdu.end(); ++it)
+ {
+ if ((tx.src_tx_id == it->first.src_tx_id)
+ && (tx.src_station_id == it->first.src_station_id))
+ {
+ // If a PHY SCI message MPDU has already been received,
+ // update the Mpdu_Payload
+ unsigned long dataLength = mListOfRxMpdu[tx].data_length + mpdu.getSpecializedSciMsgDataLength();
+ unsigned char * pData = new unsigned char[dataLength];
+ memcpy(pData, mListOfRxMpdu[tx].p_data, mListOfRxMpdu[tx].data_length);
+ delete [] mListOfRxMpdu[tx].p_data;
+ memcpy(pData + mListOfRxMpdu[tx].data_length, mpdu.getSpecializedSciMsgData(), mpdu.getSpecializedSciMsgDataLength());
+ payload.msg_nb = mListOfRxMpdu[tx].msg_nb + 1;
+ payload.data_length = dataLength;
+ payload.p_data = pData;
+ memcpy(&payload.pb_header[mListOfRxMpdu[tx].msg_nb * PHY_PB_MAX_NB], mpdu.getPbHeader(), PHY_PB_MAX_NB * sizeof(uint32_t));
+
+ bFound = true;
+ break;
+ }
+ }
+
+ // It is the 1st PHY SCI message MPDU with the same transmission ID
+ // received from this transmitting station
+ if (!bFound)
+ {
+ payload.msg_nb = 1;
+ payload.data_length = mpdu.getSpecializedSciMsgDataLength();
+ payload.p_data = new unsigned char[payload.data_length];
+ memcpy(payload.p_data, mpdu.getSpecializedSciMsgData(), payload.data_length);
+ memcpy(payload.pb_header, mpdu.getPbHeader(), PHY_PB_MAX_NB * sizeof(uint32_t));
+ }
+
+ // Update list of received MPDU
+ mListOfRxMpdu[tx] = payload;
+ }
+ else // update number of received MPDU
+ {
+ if (0 != mListOfRxMpdu.count(tx))
+ {
+ mListOfRxMpdu[tx].msg_nb++;
+ }
+ else
+ {
+ Mpdu_Payload payload;
+ memset(&payload, '\0', sizeof(struct Mpdu_Payload));
+ payload.msg_nb = 1;
+ mListOfRxMpdu[tx] = payload;
+ }
+ }
+
+
+ /* 2. Call the reception callback. */
+
+ if ((NULL != getInterfaceCb()) && mpdu.isReceived(mListOfRxMpdu[tx].msg_nb))
+ {
+ // Check if a PHY SCI message FC with the same transmission ID
+ // has already been received from this transmitting station
+ bReceiveMpdu = false;
+ for (RxFcList::iterator it = mListOfRxFc.begin(); it != mListOfRxFc.end(); ++it)
+ {
+ if ((tx.src_tx_id == it->first.src_tx_id)
+ && (tx.src_station_id == it->first.src_station_id))
+ {
+ // Create a PHY SCI message MPDU and configure it
+ PhySciMsgMpdu rxMpdu(this);
+ bReceiveMpdu = rxMpdu.setSpecializedSciMsgDataLength(mListOfRxMpdu[tx].data_length);
+ bReceiveMpdu &= rxMpdu.setSpecializedSciMsgData(mListOfRxMpdu[tx].p_data);
+ bReceiveMpdu &= rxMpdu.setFc10((it->second).fc_10);
+ bReceiveMpdu &= rxMpdu.setFcAv((it->second).fc_av);
+
+ // Call the reception callback
+ getInterfaceCb()(rxMpdu);
+
+ // Update list of received FC
+ mListOfRxFc.erase(it);
+
+ break;
+ }
+ }
+
+ // If no PHY SCI message FC with the same transmission ID
+ // has been received from this transmitting station,
+ // raise an error
+ if (!bReceiveMpdu)
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "an MPDU has been received but its FC has not been retrieved", errno);
+ }
+ }
+
+
+ /* 3. Re-send the received MPDU and an empty NOISE at the end of the MPDU transmission
+ * to destination stations. */
+
+ if (!isChannelEnabled())
+ {
+ if (NULL == getInterfaceCb())
+ {
+ sendMpduToDestStations(mpdu);
+
+ if (mpdu.isReceived(mListOfRxMpdu[tx].msg_nb))
+ {
+ // Send empty PHY SCI message NOISE
+ PhySciMsgNoise noise(this);
+ bReceiveMpdu &= noise.setTxId(mpdu.getTxId());
+ bReceiveMpdu &= noise.setSciMsgStationId(mpdu.getSciMsgStationId());
+ bReceiveMpdu &= sendEmptyNoiseToDestStations(noise);
+
+ // Update list of received MPDU
+ mListOfRxMpdu.erase(tx);
+
+ // Update list of destination stations
+ updateListOfRxStations(mpdu);
+ }
+ }
+ else if (mpdu.isReceived(mListOfRxMpdu[tx].msg_nb))
+ {
+ // Update PHY SCI message data length and data
+ bReceiveMpdu &= mpdu.setMpdu(mListOfRxMpdu[tx].data_length, mListOfRxMpdu[tx].p_data);
+
+ // Segmentation in PBs
+ bReceiveMpdu &= mpdu.segment();
+
+ // For each PHY SCI message composing the MPDU
+ for (int n=1; n<=mpdu.getNbOfMsgs(); n++)
+ {
+ // Prepare PHY SCI message before transmission
+ bReceiveMpdu &= mpdu.prepare(n);
+
+ bReceiveMpdu &= sendMpduToDestStations(mpdu);
+ }
+ // Send empty PHY SCI message NOISE
+ PhySciMsgNoise noise(this);
+ bReceiveMpdu &= noise.setTxId(mpdu.getTxId());
+ bReceiveMpdu &= noise.setSciMsgStationId(mpdu.getSciMsgStationId());
+ bReceiveMpdu &= sendEmptyNoiseToDestStations(noise);
+
+ // Update list of destination stations
+ updateListOfRxStations(mpdu);
+ }
+ }
+
+
+ /* 4. Send the entire MPDU (with PB measurement) and the NOISE to destination stations. */
+
+ else if (mpdu.isReceived(mListOfRxMpdu[tx].msg_nb))
+ {
+ // Update PHY SCI message data length and data
+ bReceiveMpdu &= mpdu.setMpdu(mListOfRxMpdu[tx].data_length, mListOfRxMpdu[tx].p_data);
+
+ // Segmentation in PBs
+ bReceiveMpdu &= mpdu.segment();
+
+ bReceiveMpdu &= sendMpduAndNoiseToDestStations(mpdu);
+ }
+
+
+ /* 5. Update RX lists. */
+
+ if (((NULL != getInterfaceCb()) || isChannelEnabled()) && mpdu.isReceived(mListOfRxMpdu[tx].msg_nb))
+ {
+ // Update list of received MPDU
+ delete [] mListOfRxMpdu[tx].p_data;
+ mListOfRxMpdu.erase(tx);
+
+ // Update list of destination stations
+ updateListOfRxStations(mpdu);
+ }
+
+
+ return bReceiveMpdu;
+}
+
+
+bool PhyProcessor::receiveTonemask ( PhySciMsg & received_phy_sci_msg )
+{
+ logFunction();
+ bool bReceiveTonemask = false;
+
+ // Check PHY SCI message data length
+ if ( ((sizeof(unsigned int) + (PHY_CARRIER_NB+7)/8) != received_phy_sci_msg.getSpecializedSciMsgDataLength())
+ || (NULL == received_phy_sci_msg.getSpecializedSciMsgData()) )
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "received PHY SCI message TONEMASK is incorrect", errno);
+ }
+
+ // Set number of active carriers
+ unsigned int nbOfCarriers;
+ memcpy(&nbOfCarriers, received_phy_sci_msg.getSpecializedSciMsgData(), sizeof(unsigned int));
+ setNbOfCarriers(nbOfCarriers);
+
+ // Set tonemask
+ bReceiveTonemask = setTonemask(received_phy_sci_msg.getSpecializedSciMsgDataLength()-sizeof(unsigned int),
+ received_phy_sci_msg.getSpecializedSciMsgData()+sizeof(unsigned int));
+
+ if (isChannelEnabled())
+ {
+ bReceiveTonemask &= getChannel()->setTonemask(getTonemask());
+ }
+
+ return bReceiveTonemask;
+}
+
+
+bool PhyProcessor::receiveTonemap ( PhySciMsg & received_phy_sci_msg )
+{
+ logFunction();
+ bool bReceiveTonemap = true;
+
+ if (isChannelEnabled())
+ {
+ bReceiveTonemap = getChannel()->setTonemap(received_phy_sci_msg.getSciMsgStationId(),
+ received_phy_sci_msg.getSpecializedSciMsgDataLength(),
+ received_phy_sci_msg.getSpecializedSciMsgData());
+ }
+
+ return bReceiveTonemap;
+}
+
+
+bool PhyProcessor::receiveRx ( PhySciMsg & received_phy_sci_msg )
+{
+ logFunction();
+
+ // Check PHY SCI message data length
+ if ( (sizeof(Sci_Msg_Station_Id) != received_phy_sci_msg.getSpecializedSciMsgDataLength())
+ || (NULL == received_phy_sci_msg.getSpecializedSciMsgData()) )
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "received PHY SCI message RX is incorrect", errno);
+ }
+
+ // Update list of destination stations
+ Expected_Tx tx;
+ tx.src_tx_id = received_phy_sci_msg.getTxId();
+ tx.src_station_id = *((Sci_Msg_Station_Id *)received_phy_sci_msg.getSpecializedSciMsgData());
+ mListOfRxStations.insert(RxStationsList::value_type(tx, received_phy_sci_msg.getSciMsgStationId()));
+
+ return true;
+}
+
+
+bool PhyProcessor::sendMsgToAllStations ( PhySciMsg & phy_sci_msg_to_send ) const
+{
+ logFunction();
+ bool bSendToAll = false;
+
+ if (fillMsg(phy_sci_msg_to_send))
+ {
+ bSendToAll = getSciServer()->sendSciMsgToAllActiveStations(phy_sci_msg_to_send);
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message cannot be sent because it is not correctly filled in", errno);
+ }
+
+ return bSendToAll;
+}
+
+
+bool PhyProcessor::activateFalseAlarm ( const Network_Clock_Tick average_duration,
+ const float std_deviation )
+{
+ logFunction();
+ bool bActivate = true;
+
+ // Check input values
+ if ((0 == average_duration) || (0 > std_deviation))
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "average duration and/or standard deviation are out-of-range", errno);
+ }
+
+ // Set false alarm activated, average duration and standard deviation
+ mIsFalseAlarmActivated = true;
+ mAverageDuration = average_duration;
+ mStdDeviation = std_deviation;
+
+ if (NULL == mpWrongPre)
+ {
+ // Create a PHY SCI message of type PREAMBLE and set the flag PHY_FLAG_WRONG_PREAMBLE
+ mpWrongPre = new PhySciMsgPre(this);
+ bActivate &= mpWrongPre->setFlags(PHY_FLAG_CRC_OK + PHY_FLAG_WRONG_PREAMBLE);
+ }
+
+ // Schedules the first PHY SCI message of type PREAMBLE with the flag PHY_FLAG_WRONG_PREAMBLE set
+ bActivate &= scheduleNextWrongPre(PHY_PREAMBLE_DETECTION_DELAY_TCK);
+
+ return bActivate;
+}
+
+
+bool PhyProcessor::deactivateFalseAlarm ( )
+{
+ mIsFalseAlarmActivated = false;
+
+ return true;
+}
+
+
+bool PhyProcessor::setFrequency ( const float frequency )
+{
+ bool bFreq = false;
+
+ if (0 > frequency)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "frequency is negative", errno);
+ }
+ else
+ {
+ if (0 != frequency)
+ {
+ // Calculate zero-cross delay, and set it
+ Network_Clock_Tick zeroCrossDelay = (Network_Clock_Tick)(25000000/(2*frequency));
+ bFreq = setZeroCrossDelay(zeroCrossDelay);
+
+ if (0 == getFrequency())
+ {
+ // Schedules a PHY SCI message of type ZERO_CROSS
+ bFreq &= scheduleZeroCross();
+ }
+ }
+ else
+ {
+ mZeroCrossDelay = 0;
+ bFreq = true;
+ }
+
+ mFrequency = frequency;
+ }
+
+ if (isChannelEnabled())
+ {
+ // Set beacon period to Channel
+ getChannel()->setBeaconPeriod(getFrequency());
+ }
+
+ return bFreq;
+}
+
+
+const float PhyProcessor::getFrequency ( ) const
+{
+ if (0 > mFrequency)
+ {
+ throw Error(__PRETTY_FUNCTION__, "frequency is negative");
+ }
+
+ return mFrequency;
+}
+
+
+// private methods
+//
+
+
+void PhyProcessor::registerPhySciMsg ( )
+{
+ logFunction();
+
+ if (!getSciServer()->registerSpecializedSciMsg(SCI_MSG_TYPE_PHY, new PhySciMsg((IPhy*)this)))
+ {
+ throw Error(__PRETTY_FUNCTION__, "cannot register PHY SCI message to SCI server");
+ }
+}
+
+
+Network_Clock_Tick PhyProcessor::calculatePreDelay ( ) const
+{
+ logFunction();
+
+ return PHY_PREAMBLE_DETECTION_DELAY_TCK;
+}
+
+
+Network_Clock_Tick PhyProcessor::calculateFcDelay ( Phy_Fc_Mode fc_mode ) const
+{
+ logFunction();
+ Network_Clock_Tick fcDelay = 0;
+
+ // For frame control transmission/reception time
+ unsigned int preDuration = MAC_PREAMBLE_TCK; // in AV mode
+ unsigned int fcDuration = MAC_FC_AV_TCK; // in AV mode
+
+ // Calculate frame control transimission time
+ if ((PHY_FC_MODE_HYBRID_2 == fc_mode)
+ || (PHY_FC_MODE_AV_2 == fc_mode))
+ {
+ fcDuration *= 2; // 2 symbols
+ }
+ if ((PHY_FC_MODE_HYBRID_1 == fc_mode)
+ || (PHY_FC_MODE_HYBRID_2 == fc_mode))
+ {
+ preDuration = MAC_PREAMBLE_HYBRID_TCK; // in Hybrid mode
+ fcDuration += MAC_FC_10_TCK; // in Hybrid mode
+ }
+ fcDelay = (preDuration - PHY_PREAMBLE_DETECTION_DELAY_TCK) \
+ + fcDuration \
+ + MAXIMUS_PHY_FC_RECEPTION_DELAY_TCK;
+
+ return fcDelay;
+}
+
+
+Network_Clock_Tick PhyProcessor::calculateMpduDelay ( Phy_Mod mod,
+ Phy_Fecrate fecrate,
+ unsigned short int pb_size,
+ Phy_Nb_Of_Pbs pb_nb,
+ Phy_Gil gil ) const
+{
+ logFunction();
+ Network_Clock_Tick mpduDelay = 0;
+
+ /* MPDU delay depends on tonemask, modulation, fecrate, PB size, number of PBs, guard interval,
+ * number of bits per symbol, and number of symbols. */
+
+ // Calculate MPDU payload transimission time
+ //
+ unsigned int bitsPerSymbol = maximus_dur_bits_per_symbol(mod,
+ getTonemask(),
+ NULL,
+ getNbOfCarriers());
+ phy_pb_size_t pbSize = (MAC_PB520_BYTES == pb_size) ? PHY_PB_SIZE_520 : PHY_PB_SIZE_136;
+ unsigned int symbolNb = maximus_dur_symbol_nb(fecrate,
+ pbSize,
+ bitsPerSymbol,
+ pb_nb);
+ unsigned int durationInTicks = maximus_dur_data_tck(gil,
+ symbolNb);
+
+ mpduDelay = durationInTicks - MAXIMUS_PHY_FC_RECEPTION_DELAY_TCK + MAXIMUS_PHY_MPDU_RECEPTION_DELAY_TCK;
+
+ return mpduDelay;
+}
+
+
+bool PhyProcessor::fillMsg ( PhySciMsg & phy_sci_msg_to_send ) const
+{
+ logFunction();
+ bool bFill = false;
+
+ // Fill specialized SCI msg header
+ //
+ struct Phy_Header phySciMsgHeader;
+ phySciMsgHeader.version = phy_sci_msg_to_send.getSpecializedSciMsgHeader().version;
+ phySciMsgHeader.type = static_cast<uint8_t>(phy_sci_msg_to_send.getSpecializedSciMsgType());
+ phySciMsgHeader.mpdu_format = static_cast<uint8_t>(phy_sci_msg_to_send.getMpduFormat());
+ phySciMsgHeader.pb_nb = phy_sci_msg_to_send.getNbOfPbs();
+ if (PHY_TYPE_MPDU_PAYLOAD == phySciMsgHeader.type)
+ {
+ phySciMsgHeader.msg_nb = static_cast<uint8_t>(((PhySciMsgMpdu *)&phy_sci_msg_to_send)->getNbOfMsgs());
+ }
+ else
+ {
+ phySciMsgHeader.msg_nb = 1;
+ }
+ phySciMsgHeader.fc_mode = phy_sci_msg_to_send.getFcMode();
+ phySciMsgHeader.short_ppdu = phy_sci_msg_to_send.getShortPpdu();
+ phySciMsgHeader.mod = phy_sci_msg_to_send.getMod();
+ phySciMsgHeader.fecrate = phy_sci_msg_to_send.getFecrate();
+ phySciMsgHeader.gil = phy_sci_msg_to_send.getGil();
+ phySciMsgHeader.tonemap_index = phy_sci_msg_to_send.getTonemapIndex();
+ phySciMsgHeader.tx_id = htons(phy_sci_msg_to_send.getTxId());
+ phySciMsgHeader.flags = htons(phy_sci_msg_to_send.getFlags());
+ phySciMsgHeader.reserved = htons(phy_sci_msg_to_send.getReserved());
+ phySciMsgHeader.symbol_nb = htonl(phy_sci_msg_to_send.getNbOfSymbols());
+ for (unsigned int i=0; i<3; i++)
+ {
+ phySciMsgHeader.iv[i] = htonl(phy_sci_msg_to_send.getIv()[i]);
+ }
+ for (unsigned int i=0; i<4; i++)
+ {
+ phySciMsgHeader.nek[i] = htonl(phy_sci_msg_to_send.getNek()[i]);
+ }
+ for (unsigned int i=0; i<PHY_PB_MAX_NB; i++)
+ {
+ phySciMsgHeader.pb_measurement[i] = htonl(phy_sci_msg_to_send.getPbMeasurement()[i]);
+ phySciMsgHeader.pb_header[i] = htonl(phy_sci_msg_to_send.getPbHeader()[i]);
+ }
+
+ // Set specialized SCI msg header
+ //
+ bFill = phy_sci_msg_to_send.setSpecializedSciMsgHeader(phySciMsgHeader);
+
+ // Fill specialized SCI msg attributes:
+ // - header size
+ //
+ bFill &= phy_sci_msg_to_send.setSpecializedSciMsgHeaderSize(sizeof(struct Phy_Header));
+
+ // Fill SCI msg attributes:
+ // - type
+ //
+ bFill &= phy_sci_msg_to_send.setSciMsgType(SCI_MSG_TYPE_PHY);
+
+ return bFill;
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+ISci * PhyProcessor::getSciServer ( ) const
+{
+ if (NULL == mpSciServer)
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+
+ return mpSciServer;
+}
+
+
+bool PhyProcessor::setNetworkClock ( INetworkClock * p_network_clock )
+{
+ bool bSetNetworkClock = false;
+
+ if (NULL == p_network_clock)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Network Clock pointer is NULL", errno);
+ }
+ else
+ {
+ mpNetworkClock = p_network_clock;
+ bSetNetworkClock = true;
+ }
+
+ return bSetNetworkClock;
+}
+
+
+INetworkClock * PhyProcessor::getNetworkClock ( ) const
+{
+ if (NULL == mpNetworkClock)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network Clock pointer is NULL");
+ }
+
+ return mpNetworkClock;
+}
+
+
+bool PhyProcessor::setChannel ( IChannel * p_channel )
+{
+ bool bSetChannel = true;
+
+ if (NULL == p_channel)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Channel pointer is NULL", errno);
+ }
+
+ mpChannel = p_channel;
+ if (NULL != mpTonemask)
+ {
+ bSetChannel = p_channel->setTonemask(getTonemask());
+ }
+
+ return bSetChannel;
+}
+
+
+IChannel * PhyProcessor::getChannel ( ) const
+{
+ if (NULL == mpChannel)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Channel pointer is NULL");
+ }
+
+ return mpChannel;
+}
+
+
+bool PhyProcessor::setIsChannelEnabled ( const bool is_channel_enabled )
+{
+ mIsChannelEnabled = is_channel_enabled;
+
+ return true;
+}
+
+
+bool PhyProcessor::isChannelEnabled ( ) const
+{
+ return mIsChannelEnabled;
+}
+
+
+const unsigned int PhyProcessor::getNbOfCarriers ( ) const
+{
+ if ((PHY_CARRIER_NB < mNbOfCarriers) || (0 == mNbOfCarriers))
+ {
+ throw Error(__PRETTY_FUNCTION__, "number of carriers has not been correctly set");
+ }
+
+ return mNbOfCarriers;
+}
+
+
+bool PhyProcessor::setNbOfCarriers ( const unsigned int nb_of_carriers )
+{
+ if ((PHY_CARRIER_NB < nb_of_carriers) || (0 == nb_of_carriers))
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "number of carriers is out-of-range", errno);
+ }
+
+ mNbOfCarriers = nb_of_carriers;
+ return true;
+}
+
+
+const uint8_t * PhyProcessor::getTonemask ( ) const
+{
+ if (NULL == mpTonemask)
+ {
+ throw Error(__PRETTY_FUNCTION__, "tonemask pointer is NULL");
+ }
+
+ return mpTonemask;
+}
+
+
+bool PhyProcessor::setTonemask ( const unsigned int length, const uint8_t * p_tonemask )
+{
+ if (((PHY_CARRIER_NB+7)/8 != length) || (NULL == p_tonemask))
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "tonemask length is incorrect and/or tonemask pointer is NULL", errno);
+ }
+
+ // If tonemask has already been set, delete it before setting the new one
+ if (NULL != mpTonemask)
+ {
+ clog << logger(LOG_INFO) << "tonemask already set" << endl;
+ delete [] mpTonemask;
+ mpTonemask = NULL;
+ }
+
+ // Allocate memory and set tonemask
+ mpTonemask = new uint8_t[length];
+ return (NULL != memcpy(mpTonemask, p_tonemask, length));
+}
+
+
+const Phy_Tx_Id PhyProcessor::getTxId ( ) const
+{
+ return mTxId;
+}
+
+
+bool PhyProcessor::incrementTxId ( )
+{
+ mTxId++;
+
+ return true;
+}
+
+
+PhyMpduCb PhyProcessor::getInterfaceCb ( ) const
+{
+ return mInterfaceCb;
+}
+
+
+const Network_Clock_Tick PhyProcessor::getZeroCrossDelay ( ) const
+{
+ if (0 == mZeroCrossDelay)
+ {
+ throw Error(__PRETTY_FUNCTION__, "zero cross delay equals 0");
+ }
+
+ return mZeroCrossDelay;
+}
+
+
+bool PhyProcessor::setZeroCrossDelay ( const Network_Clock_Tick zero_cross_delay )
+{
+ if (0 == zero_cross_delay)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "zero cross delay equals 0", errno);
+ }
+
+ mZeroCrossDelay = zero_cross_delay;
+
+ return true;
+}
+
+
+PhySciMsg * PhyProcessor::getZeroCross ( ) const
+{
+ if (NULL == mpZeroCross)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message of type ZERO_CROSS pointer is NULL");
+ }
+
+ return mpZeroCross;
+}
+
+
+bool PhyProcessor::scheduleZeroCross ( )
+{
+ // Schedule ZERO_CROSS message
+ Network_Clock_Tick tickZeroCross = getNetworkClock()->getCurrentTickValue() + getZeroCrossDelay();
+ NetworkClockEvt evtZeroCross ( 0, // station_id
+ NETWORK_CLOCK_TYPE_PHY,
+ 0, // id = 0 for ZERO_CROSS
+ (void *)getZeroCross() );
+ return getNetworkClock()->insertEvt(tickZeroCross, evtZeroCross);
+}
+
+
+bool PhyProcessor::sendMpduToDestStations ( PhySciMsgMpdu & mpdu )
+{
+ logFunction();
+ bool bSendToDest = false;
+
+ if (fillMsg(mpdu))
+ {
+ Expected_Tx tx;
+ tx.src_tx_id = mpdu.getTxId();
+ tx.src_station_id = mpdu.getSciMsgStationId();
+
+ // Build list of destination stations
+ DestStationsList listOfDestStations;
+ for (RxStationsList::iterator it = mListOfRxStations.begin(); it != mListOfRxStations.end(); ++it)
+ {
+ if ((tx.src_tx_id == it->first.src_tx_id)
+ && (tx.src_station_id == it->first.src_station_id))
+ {
+ listOfDestStations.push_back(it->second);
+ }
+ }
+
+ bSendToDest = getSciServer()->sendSciMsgToDestStations(mpdu, listOfDestStations);
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message MPDU cannot be sent because it is not correctly filled in", errno);
+ }
+
+ return bSendToDest;
+}
+
+
+bool PhyProcessor::sendEmptyNoiseToDestStations ( PhySciMsgNoise & noise )
+{
+ logFunction();
+ bool bSendEmptyNoise = noise.prepare();
+
+ if (fillMsg(noise))
+ {
+ // Build list of destination stations
+ DestStationsList listOfDestStations;
+ for (RxStationsList::iterator it = mListOfRxStations.begin(); it != mListOfRxStations.end(); ++it)
+ {
+ if ((noise.getTxId() == it->first.src_tx_id)
+ && (noise.getSciMsgStationId() == it->first.src_station_id))
+ {
+ listOfDestStations.push_back(it->second);
+ }
+ }
+
+ bSendEmptyNoise &= getSciServer()->sendSciMsgToDestStations(noise, listOfDestStations);
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Empty PHY SCI message NOISE cannot be sent because it is not correctly filled in", errno);
+ }
+
+ return bSendEmptyNoise;
+}
+
+
+bool PhyProcessor::sendMpduAndNoiseToDestStations ( PhySciMsgMpdu & mpdu )
+{
+ logFunction();
+ bool bSendMpduAndNoise = true;
+
+ /**
+ * Lots of things to do in this function...
+ * Following order has to be respected:
+ * 1. Compute PB measurement and NOISE for each destination station.
+ * 2. Set PB measurement and send MPDU to each destination station.
+ * 3. Send NOISE to each destination station.
+ * 4. Update list of destination stations.
+ */
+
+ map<Sci_Msg_Station_Id, uint32_t *> listOfPbMeasurements;
+ map<Sci_Msg_Station_Id, PhySciMsgNoise *> listOfNoises;
+
+
+ /* 1. Compute PB measurement and NOISE for each destination station. */
+ Expected_Tx tx;
+ tx.src_tx_id = mpdu.getTxId();
+ tx.src_station_id = mpdu.getSciMsgStationId();
+
+ // Duplicate MPDU payload
+ bSendMpduAndNoise &= getChannel()->duplicateMpduPayload(mpdu);
+
+ // For each destination station
+ for (RxStationsList::iterator it = mListOfRxStations.begin(); it != mListOfRxStations.end(); ++it)
+ {
+ if ((tx.src_tx_id == it->first.src_tx_id)
+ && (tx.src_station_id == it->first.src_station_id))
+ {
+ // Create empty PB measurement and empty NOISE
+ uint32_t * pbMeasurementArray = new uint32_t[MAC_MAX_PB_PER_MPDU];
+ PhySciMsgNoise * pNoise = new PhySciMsgNoise(this);
+ bSendMpduAndNoise &= pNoise->setTxId(mpdu.getTxId());
+ bSendMpduAndNoise &= pNoise->setSciMsgStationId(mpdu.getSciMsgStationId());
+
+ // Let the Channel package fill in the PB measurement and the NOISE
+ bSendMpduAndNoise &= getChannel()->addPerturbation(pbMeasurementArray,
+ *pNoise,
+ mListOfRxMpdu[tx].pb_header,
+ mpdu,
+ mpdu.getSciMsgStationId(), // ID of the transmitting station
+ it->second, // ID of the destination station
+ getNetworkClock()->getCurrentTickValue());
+
+ // Save the PB measurement and the NOISE for the current destination station
+ listOfPbMeasurements[it->second] = pbMeasurementArray;
+ listOfNoises[it->second] = pNoise;
+ }
+ }
+
+ // Check number of destination stations
+ if (listOfPbMeasurements.size() != listOfNoises.size())
+ {
+ throw Error(__PRETTY_FUNCTION__, "number of elements in PB measurement and NOISE lists are different");
+ }
+
+
+ /* 2. Set PB measurement and send MPDU to each destination station. */
+
+ // Create an empty list of destination station,
+ // that will be composed of one element only
+ DestStationsList listOfDestStation;
+
+ // For each PHY SCI message composing the MPDU
+ for (int n = 0; n < mpdu.getNbOfMsgs(); n++)
+ {
+ // Prepare PHY SCI message before transmission
+ bSendMpduAndNoise &= mpdu.prepare(n+1);
+
+ // For each destination station
+ for (RxStationsList::iterator it = mListOfRxStations.begin(); it != mListOfRxStations.end(); ++it)
+ {
+ if ((mpdu.getTxId() == it->first.src_tx_id)
+ && (mpdu.getSciMsgStationId() == it->first.src_station_id))
+ {
+ // Set PB measurement of the current destination station
+ bSendMpduAndNoise &= mpdu.setPbMeasurement(listOfPbMeasurements[it->second] + n * PHY_PB_MAX_NB);
+
+ if (fillMsg(mpdu))
+ {
+ // Send the (n+1)th PHY SCI message MPDU to the current destination station
+ listOfDestStation.push_back(it->second);
+ bSendMpduAndNoise &= getSciServer()->sendSciMsgToDestStations(mpdu, listOfDestStation);
+
+ listOfDestStation.clear();
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message MPDU cannot be sent because it is not correctly filled in", errno);
+ }
+ }
+ }
+ }
+
+
+ /* 3. Send NOISE to each destination station. */
+
+ // For each destination station
+ for (RxStationsList::iterator it = mListOfRxStations.begin(); it != mListOfRxStations.end(); ++it)
+ {
+ if ((mpdu.getTxId() == it->first.src_tx_id)
+ && (mpdu.getSciMsgStationId() == it->first.src_station_id))
+ {
+ // Clear list of PB measurements
+ delete [] listOfPbMeasurements[it->second];
+ listOfPbMeasurements.erase(it->second);
+
+ // Prepare PHY SCI message before transmission
+ bSendMpduAndNoise &= (listOfNoises[it->second])->prepare();
+
+ // Send NOISE to the current destination station
+ if (fillMsg(*(listOfNoises[it->second])))
+ {
+ listOfDestStation.push_back(it->second);
+ bSendMpduAndNoise &= getSciServer()->sendSciMsgToDestStations(*(listOfNoises[it->second]), listOfDestStation);
+
+ // Clear list of noises
+ delete (listOfNoises[it->second]);
+ listOfNoises.erase(it->second);
+
+ listOfDestStation.clear();
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message NOISE cannot be sent because it is not correctly filled in", errno);
+ }
+ }
+ }
+
+
+ /* 4. Update list of destination stations. */
+
+ if (mpdu.isSent())
+ {
+ updateListOfRxStations(mpdu);
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message MPDU has not been correctly sent");
+ }
+
+
+ return bSendMpduAndNoise;
+}
+
+
+void PhyProcessor::updateListOfRxStations ( PhySciMsgMpdu & mpdu )
+{
+ logFunction();
+
+ for (RxStationsList::iterator it = mListOfRxStations.begin(); it != mListOfRxStations.end();)
+ {
+ RxStationsList::iterator pos = it;
+ ++it;
+ if ((mpdu.getTxId() == pos->first.src_tx_id)
+ && (mpdu.getSciMsgStationId() == pos->first.src_station_id))
+ {
+ mListOfRxStations.erase(pos);
+ }
+ }
+}
+
+
+const bool PhyProcessor::isFalseAlarmActivated ( ) const
+{
+ return mIsFalseAlarmActivated;
+}
+
+
+PhySciMsgPre * PhyProcessor::getWrongPre ( ) const
+{
+ if (NULL == mpWrongPre)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message of type PREAMBLE pointer is NULL");
+ }
+
+ return mpWrongPre;
+}
+
+
+const Network_Clock_Tick PhyProcessor::getAverageDuration ( ) const
+{
+ return mAverageDuration;
+}
+
+
+const float PhyProcessor::getStdDeviation ( ) const
+{
+ return mStdDeviation;
+}
+
+
+const Network_Clock_Tick PhyProcessor::calculateNextWrongPreDate ( ) const
+{
+ logFunction();
+
+ boost::mt19937 engine;
+ engine.seed(static_cast<unsigned int>(time(0)));
+ boost::normal_distribution<double> norm(getAverageDuration(), getStdDeviation());
+ boost::variate_generator<boost::mt19937, boost::normal_distribution<double> > normal(engine, norm);
+
+ return static_cast<Network_Clock_Tick>(normal());
+}
+
+
+bool PhyProcessor::scheduleNextWrongPre ( const Network_Clock_Tick tick_wrong_pre ) const
+{
+ logFunction();
+
+ // Schedule next wrong PREAMBLE message
+ NetworkClockEvt evtWrongPre ( 0, // station_id
+ NETWORK_CLOCK_TYPE_PHY,
+ 0, // id = 0 for PREAMBLE
+ (void *)getWrongPre() );
+
+ return getNetworkClock()->insertEvt(getNetworkClock()->getCurrentTickValue() + tick_wrong_pre, evtWrongPre);
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/phy/src/PhyProcessorTest.cpp b/cesar/maximus/phy/src/PhyProcessorTest.cpp
new file mode 100644
index 0000000000..0936ebb7b3
--- /dev/null
+++ b/cesar/maximus/phy/src/PhyProcessorTest.cpp
@@ -0,0 +1,583 @@
+
+#include "PhyProcessorTest.h"
+
+#include "PhyProcessor.h"
+#include "CoreEngine.h"
+#include "SystemManager.h"
+#include "PhySciMsg.h"
+#include "PhySciMsgPre.h"
+#include "PhySciMsgFc.h"
+#include "PhySciMsgMpdu.h"
+#include "NetworkClockEvt.h"
+#include "ChannelComputer.h"
+#include "SciServer.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+#include <iostream>
+#include <netinet/in.h> // for 'htons()'
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (PhyProcessorTest);
+
+bool isCbCalledTest = false;
+
+void interfaceCbTest ( PhySciMsgMpdu & mpdu )
+{
+ logTest();
+
+ isCbCalledTest = true;
+}
+
+
+void PhyProcessorTest::setUp (void)
+{
+ logTest();
+
+ mpCoreEngine = new CoreEngine();
+ mpPhyProcessor = (PhyProcessor*)mpCoreEngine->getPhy();
+ CPPUNIT_ASSERT_MESSAGE ( "PHY processor pointer is NULL", NULL != mpPhyProcessor );
+}
+
+
+void PhyProcessorTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpPhyProcessor)
+ {
+ mpPhyProcessor = NULL;
+ }
+ if (NULL != mpCoreEngine)
+ {
+ delete (mpCoreEngine);
+ mpCoreEngine = NULL;
+ }
+}
+
+
+void PhyProcessorTest::initTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE ( "init failed", mpPhyProcessor->init(&interfaceCbTest) );
+ CPPUNIT_ASSERT_MESSAGE ( "init failed", mpPhyProcessor->init(50) );
+}
+
+
+void PhyProcessorTest::createMsgTest (void)
+{
+ logTest();
+
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg );
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message not correctly created",
+ mpPhyProcessor == pPhySciMsg->getPhyProcessor() );
+
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+}
+
+
+void PhyProcessorTest::createMpduTest (void)
+{
+ logTest();
+
+ unsigned long length = 5;
+ unsigned char payload[length];
+ memset(payload, 'M', length);
+
+ PhySciMsgMpdu * pPhySciMsgMpdu = mpPhyProcessor->createMpdu();
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message MPDU pointer is NULL", NULL != pPhySciMsgMpdu );
+
+ pPhySciMsgMpdu->setMpdu(length, payload);
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message MPDU not correctly created",
+ (mpPhyProcessor == pPhySciMsgMpdu->getPhyProcessor())
+ && (length == pPhySciMsgMpdu->getPayloadLength())
+ && (0 == memcmp(payload, pPhySciMsgMpdu->getPayload(), length))
+ );
+
+ if (NULL != pPhySciMsgMpdu)
+ {
+ delete (pPhySciMsgMpdu);
+ pPhySciMsgMpdu = NULL;
+ }
+}
+
+
+void PhyProcessorTest::sendMsgTest (void)
+{
+ logTest();
+
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg );
+
+ // create the transmitting station
+ mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // create the destination station
+ Sci_Msg_Station_Id stationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // set the destination station
+ pPhySciMsg->setSciMsgStationId(stationId);
+
+ // set the type
+ pPhySciMsg->setSpecializedSciMsgType(PHY_TYPE_ZERO_CROSS);
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message has not been sent", mpPhyProcessor->sendMsgToAllStations(*pPhySciMsg) );
+
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+}
+
+
+void PhyProcessorTest::sendMpduTest (void)
+{
+ logTest();
+
+ // create MPDU
+ PhySciMsgMpdu * pPhySciMsgMpdu = mpPhyProcessor->createMpdu();
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message MPDU pointer is NULL", NULL != pPhySciMsgMpdu );
+
+ // configure MPDU
+ unsigned long length = 5;
+ unsigned char payload[length];
+ memset(payload, 'M', length);
+ pPhySciMsgMpdu->setMpdu(length, payload);
+
+ // set modulation
+ pPhySciMsgMpdu->setMod(PHY_MOD_ROBO);
+
+ // set carrier number and tonemask
+ unsigned int carrierNb = PHY_CARRIER_NB;
+ uint8_t tonemaskData[sizeof(unsigned int) + ((PHY_CARRIER_NB+7)/8)*sizeof(uint8_t)];
+ memcpy(tonemaskData, &carrierNb, sizeof(unsigned int));
+ memset(tonemaskData + sizeof(unsigned int), 0xCC, (PHY_CARRIER_NB+7)/8*sizeof(uint8_t));
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg );
+ pPhySciMsg->setSpecializedSciMsgDataLength(sizeof(unsigned int) + ((PHY_CARRIER_NB+7)/8)*sizeof(uint8_t));
+ pPhySciMsg->setSpecializedSciMsgData((unsigned char *)tonemaskData);
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message TONEMASK reception error",
+ mpPhyProcessor->receiveTonemask(*pPhySciMsg) );
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+
+ // set FEC rate
+ pPhySciMsgMpdu->setFecrate(PHY_FEC_RATE_1_2);
+
+ // set PB number
+ pPhySciMsgMpdu->setNbOfPbs(1);
+
+ // set Guard Interval
+ pPhySciMsgMpdu->setGil(PHY_GIL_417);
+
+ // set PB size
+ pPhySciMsgMpdu->setPbSize(MAC_PB136_BYTES);
+
+ // set FC mode
+ pPhySciMsgMpdu->setFcMode(PHY_FC_MODE_HYBRID_1);
+
+ // set FC
+ uint32_t fc_av[4];
+ memset(fc_av, 'A', 4*sizeof(uint32_t));
+ uint32_t fc_10 = 10;
+ pPhySciMsgMpdu->setFc10(fc_10);
+ pPhySciMsgMpdu->setFcAv(fc_av);
+
+ // create the transmitting station
+ mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // create the destination station
+ Sci_Msg_Station_Id stationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // set the destination station
+ pPhySciMsgMpdu->setSciMsgStationId(stationId);
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message MPDU not sent",
+ mpPhyProcessor->sendMpdu(pPhySciMsgMpdu) );
+
+ if (NULL != pPhySciMsgMpdu)
+ {
+ delete (pPhySciMsgMpdu);
+ pPhySciMsgMpdu = NULL;
+ }
+}
+
+
+void PhyProcessorTest::receiveEvtTest (void)
+{
+ logTest();
+
+ PhySciMsgMpdu * pPhySciMsgMpdu = mpPhyProcessor->createMpdu(); // will be deleted by 'receiveEvt'
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message MPDU pointer is NULL", NULL != pPhySciMsgMpdu);
+
+ unsigned long length = 5;
+ unsigned char payload[length];
+ memset(payload, 'M', length);
+ pPhySciMsgMpdu->setMpdu(length, payload);
+
+ pPhySciMsgMpdu->segment();
+
+ // create the destination station
+ Sci_Msg_Station_Id rxStationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // send an RX message
+ PhySciMsg rx(mpPhyProcessor);
+ rx.setSciMsgStationId(rxStationId);
+ rx.setSpecializedSciMsgDataLength(sizeof(Sci_Msg_Station_Id));
+ Sci_Msg_Station_Id txStationId = getpid();
+ rx.setSpecializedSciMsgData((unsigned char *)&txStationId);
+ CPPUNIT_ASSERT_MESSAGE ( "receiveRx failed", mpPhyProcessor->receiveRx(rx) );
+
+ NetworkClockEvt evt(0 /* station_id */, NETWORK_CLOCK_TYPE_PHY, 1 /* id */, (void *)pPhySciMsgMpdu);
+
+ CPPUNIT_ASSERT_MESSAGE ( "Event received but not correctly processed",
+ mpPhyProcessor->receiveEvt(evt) );
+
+ if (NULL != pPhySciMsgMpdu)
+ {
+ delete (pPhySciMsgMpdu);
+ pPhySciMsgMpdu = NULL;
+ }
+}
+
+
+void PhyProcessorTest::receiveInvalidTest (void)
+{
+ logTest();
+ bool bTest = false;
+
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg );
+
+ try
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "receiveInvalid failed", !mpPhyProcessor->receiveInvalid(*pPhySciMsg) );
+ }
+ catch (Error & e)
+ {
+ bTest = true;
+ }
+
+ CPPUNIT_ASSERT_MESSAGE ( "receiveInvalid failed", bTest);
+
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+}
+
+
+void PhyProcessorTest::receivePreTest (void)
+{
+ logTest();
+
+ PhySciMsgPre preamble(mpPhyProcessor);
+
+ // create the transmitting station
+ Sci_Msg_Station_Id stationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // create the destination station
+ mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // set station id
+ preamble.setSciMsgStationId(stationId);
+
+ CPPUNIT_ASSERT_MESSAGE ( "receivePre failed", mpPhyProcessor->receivePre(preamble) );
+}
+
+
+void PhyProcessorTest::receiveFcTest (void)
+{
+ logTest();
+
+ PhySciMsgFc frameControl(mpPhyProcessor);
+
+ // create the transmitting station
+ Sci_Msg_Station_Id stationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // create the destination station
+ mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // set station id
+ frameControl.setSciMsgStationId(stationId);
+
+ // set PHY SCI message data length and data
+ uint32_t fcAv[4];
+ memset(fcAv, 'F', 4*sizeof(uint32_t));
+ frameControl.setSpecializedSciMsgDataLength(4*sizeof(uint32_t));
+ frameControl.setSpecializedSciMsgData((unsigned char *)fcAv);
+
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMsg failed", mpPhyProcessor->receiveFc(frameControl) );
+}
+
+
+void PhyProcessorTest::receivePrsTest (void)
+{
+ logTest();
+
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg );
+
+ // create the transmitting station
+ Sci_Msg_Station_Id stationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // create the destination station
+ mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // set station id
+ pPhySciMsg->setSciMsgStationId(stationId);
+
+ // set the type
+ pPhySciMsg->setSpecializedSciMsgType(PHY_TYPE_PRS);
+
+ CPPUNIT_ASSERT_MESSAGE ( "receivePrs failed", mpPhyProcessor->receivePrs(*pPhySciMsg) );
+
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+}
+
+
+void PhyProcessorTest::receiveMpduTest (void)
+{
+ logTest();
+
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg );
+
+ // create the transmitting station
+ Sci_Msg_Station_Id txStationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // create the destination station
+ Sci_Msg_Station_Id rxStationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // set station id
+ Sci_Msg_Header sciHdr;
+ memset(&sciHdr, '\0', sizeof(struct Sci_Msg_Header));
+ sciHdr.station_id = txStationId;
+ pPhySciMsg->setSciMsgHeader(sciHdr);
+
+ // set type, msg nb and tx id
+ Phy_Header phyHdr;
+ memset(&phyHdr, '\0', sizeof(struct Phy_Header));
+ phyHdr.type = PHY_TYPE_MPDU_PAYLOAD;
+ phyHdr.msg_nb = 1;
+ phyHdr.tx_id = htons(33);
+ pPhySciMsg->setSpecializedSciMsgHeader(phyHdr);
+
+ // set PHY SCI message data length and data
+ unsigned long dataLength = MAC_PB520_BYTES;
+ unsigned char data[dataLength];
+ memset(data, 'D', dataLength);
+ pPhySciMsg->setSpecializedSciMsgDataLength(dataLength);
+ pPhySciMsg->setSpecializedSciMsgData(data);
+
+ // set the interface callback function for PHY SCI message MPDU reception
+ CPPUNIT_ASSERT_MESSAGE ( "init failed", mpPhyProcessor->init(&interfaceCbTest) );
+
+ // send a FC message
+ PhySciMsgFc frameControl(mpPhyProcessor);
+ frameControl.setSciMsgStationId(txStationId);
+ frameControl.setTxId(33);
+ uint32_t fcAv[4];
+ for (int i=0; i<4; i++)
+ {
+ fcAv[i] = i;
+ }
+ frameControl.setSpecializedSciMsgDataLength(4*sizeof(uint32_t));
+ frameControl.setSpecializedSciMsgData((unsigned char *)fcAv);
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMsg failed", mpPhyProcessor->receiveFc(frameControl) );
+
+ // send an RX message
+ PhySciMsg rx(mpPhyProcessor);
+ rx.setSciMsgStationId(rxStationId);
+ rx.setTxId(33);
+ rx.setSpecializedSciMsgDataLength(sizeof(Sci_Msg_Station_Id));
+ rx.setSpecializedSciMsgData((unsigned char *)&txStationId);
+ CPPUNIT_ASSERT_MESSAGE ( "receiveRx failed", mpPhyProcessor->receiveRx(rx) );
+
+ // send the MPDU
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMpdu failed", mpPhyProcessor->receiveMpdu(*pPhySciMsg)
+ && isCbCalledTest );
+
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+}
+
+
+void PhyProcessorTest::receiveTonemaskTest (void)
+{
+ logTest();
+
+ // set carrier number and tonemask
+ unsigned int tonemaskLength = (PHY_CARRIER_NB+7)/8;
+ unsigned int carrierNb = PHY_CARRIER_NB-3;
+ uint8_t tonemaskData[sizeof(unsigned int) + tonemaskLength];
+ memcpy(tonemaskData, &carrierNb, sizeof(unsigned int));
+ memset(tonemaskData + sizeof(unsigned int), 0xDD, tonemaskLength);
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg);
+ pPhySciMsg->setSpecializedSciMsgDataLength(sizeof(unsigned int) + tonemaskLength);
+ pPhySciMsg->setSpecializedSciMsgData((unsigned char *)tonemaskData);
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message TONEMASK reception error",
+ mpPhyProcessor->receiveTonemask(*pPhySciMsg));
+
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+}
+
+
+void PhyProcessorTest::receiveTonemapTest (void)
+{
+ logTest();
+
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg );
+
+ // create the transmitting station
+ Sci_Msg_Station_Id stationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // create the destination station
+ mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // set station id
+ pPhySciMsg->setSciMsgStationId(stationId);
+
+ CPPUNIT_ASSERT_MESSAGE ( "receiveTonemap failed", mpPhyProcessor->receiveTonemap(*pPhySciMsg) );
+
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+}
+
+
+void PhyProcessorTest::receiveRxTest (void)
+{
+ logTest();
+
+ PhySciMsg * pPhySciMsg = mpPhyProcessor->createMsg();
+
+ CPPUNIT_ASSERT_MESSAGE ( "PHY SCI message pointer is NULL", NULL != pPhySciMsg );
+
+ // create the transmitting station
+ Sci_Msg_Station_Id txStationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // create the destination station
+ Sci_Msg_Station_Id rxStationId = mpCoreEngine->getSystem()->createStation(mpCoreEngine->getSystem()->getDefaultStationExecutable());
+
+ // set the destination station
+ pPhySciMsg->setSciMsgStationId(rxStationId);
+
+ // set PHY SCI message data length and data
+ pPhySciMsg->setSpecializedSciMsgDataLength(sizeof(Sci_Msg_Station_Id));
+ pPhySciMsg->setSpecializedSciMsgData((unsigned char *)&txStationId);
+
+ CPPUNIT_ASSERT_MESSAGE ( "receiveRx failed", mpPhyProcessor->receiveRx(*pPhySciMsg) );
+
+ if (NULL != pPhySciMsg)
+ {
+ delete (pPhySciMsg);
+ pPhySciMsg = NULL;
+ }
+}
+
+
+void PhyProcessorTest::setNetworkClockTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE ( "setNetworkClock failed",
+ mpPhyProcessor->setNetworkClock(mpCoreEngine->getNetworkClock()) );
+}
+
+
+void PhyProcessorTest::setChannelTest (void)
+{
+ logTest();
+
+ SciServer sci;
+ SystemManager system((ISci *)&sci);
+ ChannelComputer channel(mpPhyProcessor, (ISystem *)&system);
+ CPPUNIT_ASSERT_MESSAGE ( "setChannel failed",
+ mpPhyProcessor->setChannel((IChannel *)&channel) );
+}
+
+
+void PhyProcessorTest::setIsChannelEnabledTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE ( "setIsChannelEnabled failed",
+ mpPhyProcessor->setIsChannelEnabled(true) );
+}
+
+
+void PhyProcessorTest::setFrequencyTest (void)
+{
+ logTest();
+
+ float freq = 52.5; // in Hz
+ CPPUNIT_ASSERT_MESSAGE ( "setFrequency failed",
+ mpPhyProcessor->init(50)
+ && mpPhyProcessor->setFrequency(freq)
+ && (freq == mpPhyProcessor->getFrequency()) );
+}
+
+
+void PhyProcessorTest::activateFalseAlarmTest (void)
+{
+ logTest();
+
+ Network_Clock_Tick averageDuration = 10;
+ float stdDeviation = 0.1;
+ CPPUNIT_ASSERT_MESSAGE ( "activateFalseAlarm failed",
+ mpPhyProcessor->activateFalseAlarm(averageDuration, stdDeviation) );
+ CPPUNIT_ASSERT_MESSAGE ( "activateFalseAlarm failed",
+ mpPhyProcessor->activateFalseAlarm(averageDuration, stdDeviation) );
+}
+
+
+void PhyProcessorTest::deactivateFalseAlarmTest (void)
+{
+ logTest();
+
+ Network_Clock_Tick averageDuration = 10;
+ float stdDeviation = 0.1;
+ CPPUNIT_ASSERT_MESSAGE ( "deactivateFalseAlarm failed", mpPhyProcessor->deactivateFalseAlarm() );
+ CPPUNIT_ASSERT_MESSAGE ( "activateFalseAlarm failed",
+ mpPhyProcessor->activateFalseAlarm(averageDuration, stdDeviation) );
+ CPPUNIT_ASSERT_MESSAGE ( "deactivateFalseAlarm failed", mpPhyProcessor->deactivateFalseAlarm() );
+}
+
diff --git a/cesar/maximus/phy/src/PhySciMsg.cpp b/cesar/maximus/phy/src/PhySciMsg.cpp
new file mode 100644
index 0000000000..99bce26c8d
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsg.cpp
@@ -0,0 +1,944 @@
+/************************************************************************
+ PhySciMsg.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/src/PhySciMsg.cpp
+**************************************************************************/
+
+#include "PhySciMsg.h"
+#include "IPhy.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include "mac/common/tonemap.h" // for 'TONEMAP_INDEX_NB'
+
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <netinet/in.h> // for 'ntohl()' and 'ntohs()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+#include <sstream> // for 'ostringstream'
+#include <string> // for 'memset()' and 'memcpy()'
+#include <boost/function.hpp> // for 'ReceiveFunction'
+using namespace std;
+
+typedef boost::function <bool (IPhy *, PhySciMsg &)> ReceiveFunction;
+ReceiveFunction receiveFunction[PHY_TYPE_NB] = { &IPhy::receiveInvalid, // NONE
+ &IPhy::receivePre, // PREAMBLE
+ &IPhy::receiveFc, // FC_HYBRID_MODE
+ &IPhy::receiveFc, // FC_AV_ONLY_MODE
+ &IPhy::receivePrs, // PRS
+ &IPhy::receiveMpdu, // MPDU_PAYLOAD
+ &IPhy::receiveTonemask, // TONEMASK
+ &IPhy::receiveTonemap, // TONEMAP
+ &IPhy::receiveInvalid, // NOISE
+ &IPhy::receiveRx, // RX
+ &IPhy::receiveInvalid }; // ZERO_CROSS
+
+
+// Constructors/Destructors
+//
+
+
+PhySciMsg::PhySciMsg ( IPhy * p_phy_processor ):
+mSpecializedSciMsgType(PHY_TYPE_NONE),
+mMpduFormat(PHY_MPDU_FORMAT_NONE),
+mNbOfPbs(0),
+mNbOfMsgs(1),
+mFcMode(PHY_FC_MODE_NONE),
+mShortPpdu(false),
+mMod(PHY_MOD_NONE),
+mFecrate(PHY_FEC_RATE_NONE),
+mGil(PHY_GIL_NONE),
+mTonemapIndex(0),
+mTxId(0),
+mFlags(PHY_FLAG_NONE),
+mIsEncrypted(false),
+mIsCrcOk(false),
+mPbSize(0),
+mReserved(0),
+mNbOfSymbols(0),
+mpPhyProcessor(NULL),
+mIsSent(false)
+{
+ logFunction();
+
+ if (NULL != p_phy_processor)
+ {
+ mpPhyProcessor = p_phy_processor;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY processor pointer is NULL", errno);
+ }
+
+ initAttributes ();
+}
+
+
+void PhySciMsg::initAttributes ( )
+{
+ logFunction();
+
+ memset(mIvArray, '\0', 3*sizeof(uint32_t));
+ memset(mNekArray, '\0', 4*sizeof(uint32_t));
+ memset(mPbMeasurementArray, '\0', PHY_PB_MAX_NB*sizeof(uint32_t));
+ memset(mPbHeaderArray, '\0', PHY_PB_MAX_NB*sizeof(uint32_t));
+
+ mSpecializedSciMsgHeader.version = PHY_VERSION;
+ mSpecializedSciMsgHeader.type = PHY_TYPE_NONE;
+ mSpecializedSciMsgHeader.mpdu_format = PHY_MPDU_FORMAT_NONE;
+ mSpecializedSciMsgHeader.pb_nb = 0x00;
+ mSpecializedSciMsgHeader.msg_nb = 0x01;
+ mSpecializedSciMsgHeader.fc_mode = PHY_FC_MODE_NONE;
+ mSpecializedSciMsgHeader.short_ppdu = 0x00;
+ mSpecializedSciMsgHeader.mod = PHY_MOD_NONE;
+ mSpecializedSciMsgHeader.fecrate = PHY_FEC_RATE_NONE;
+ mSpecializedSciMsgHeader.gil = PHY_GIL_NONE;
+ mSpecializedSciMsgHeader.tonemap_index = 0x00;
+ mSpecializedSciMsgHeader.reserved = 0x00;
+ mSpecializedSciMsgHeader.tx_id = 0x0000;
+ mSpecializedSciMsgHeader.flags = PHY_FLAG_NONE;
+ mSpecializedSciMsgHeader.symbol_nb = 0x00000000;
+ memset(mSpecializedSciMsgHeader.iv, '\0', 3*sizeof(uint32_t));
+ memset(mSpecializedSciMsgHeader.nek, '\0', 4*sizeof(uint32_t));
+ memset(mSpecializedSciMsgHeader.pb_measurement, '\0', PHY_PB_MAX_NB*sizeof(uint32_t));
+ memset(mSpecializedSciMsgHeader.pb_header, '\0', PHY_PB_MAX_NB*sizeof(uint32_t));
+}
+
+
+PhySciMsg::~PhySciMsg ( )
+{
+ logFunction();
+
+ if (NULL != mpPhyProcessor)
+ {
+ mpPhyProcessor = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+SciMsg * PhySciMsg::create ( ) const
+{
+ logFunction();
+
+ return new PhySciMsg (getPhyProcessor());
+}
+
+
+bool PhySciMsg::dispatchMsg ( )
+{
+ logFunction();
+
+ bool bDispatch = (receiveFunction[getSpecializedSciMsgType()])(getPhyProcessor(), *this);
+
+ if (!bDispatch)
+ {
+ throw Error(__PRETTY_FUNCTION__, "error while receiving PHY SCI message");
+ }
+
+ return bDispatch;
+}
+
+
+bool PhySciMsg::identifySpecializedSciMsgHeader ( )
+{
+ logFunction();
+ bool bIdentifyHeader = false;
+
+ if (NULL != SciMsg::getSciMsgData())
+ {
+ // Set specialized SCI msg header size
+ //
+ SciMsg::setSpecializedSciMsgHeaderSize((unsigned long)sizeof(struct Phy_Header));
+
+ // Get specialized SCI message header contents
+ //
+ if (SciMsg::getSciMsgDataLength() >= SciMsg::getSpecializedSciMsgHeaderSize()) // check that there are enough data to get the specialized SCI message header
+ {
+ bIdentifyHeader = setSpecializedSciMsgHeader(*((Phy_Header*)SciMsg::getSciMsgData()));
+ }
+ else
+ {
+ errno = ENODATA;
+ throw Error(__PRETTY_FUNCTION__, "Not enough data to get the specialized SCI message header", errno);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI message data pointer is NULL");
+ }
+
+ return bIdentifyHeader;
+}
+
+
+bool PhySciMsg::checkCompatibility ( ) const
+{
+ logFunction();
+ bool bCheck = false;
+
+ if (PHY_VERSION == getSpecializedSciMsgHeader().version)
+ {
+ bCheck = SciMsg::checkCompatibility();
+ }
+
+ return bCheck;
+}
+
+
+bool PhySciMsg::checkValidity ( ) const
+{
+ logFunction();
+ bool bCheck = false;
+
+ // Check header values ranges
+ //
+ if ((PHY_TYPE_NB > getSpecializedSciMsgHeader().type) && (PHY_TYPE_NONE < getSpecializedSciMsgHeader().type)
+ && (PHY_MPDU_FORMAT_NB > getSpecializedSciMsgHeader().mpdu_format)
+ && (PHY_PB_MAX_NB >= getSpecializedSciMsgHeader().pb_nb)
+ && (0 != getSpecializedSciMsgHeader().msg_nb) && (PHY_MSG_MAX_NB_PER_MPDU >= getSpecializedSciMsgHeader().msg_nb)
+ && (PHY_FC_MODE_NONE >= getSpecializedSciMsgHeader().fc_mode)
+ && ((0 == getSpecializedSciMsgHeader().short_ppdu) || (1 == getSpecializedSciMsgHeader().short_ppdu))
+ && (PHY_MOD_NONE >= getSpecializedSciMsgHeader().mod)
+ && (PHY_FEC_RATE_NONE >= getSpecializedSciMsgHeader().fecrate)
+ && (PHY_GIL_NONE >= getSpecializedSciMsgHeader().gil)
+ && (TONEMAP_INDEX_NB > getSpecializedSciMsgHeader().tonemap_index)
+ && (PHY_FLAG_MAX >= htons(getSpecializedSciMsgHeader().flags))
+ && (MAC_MAX_SYMB_PER_MPDU >= htonl(getSpecializedSciMsgHeader().symbol_nb))
+ && (NULL != getSpecializedSciMsgHeader().iv)
+ && (NULL != getSpecializedSciMsgHeader().nek)
+ && (NULL != getSpecializedSciMsgHeader().pb_measurement)
+ && (NULL != getSpecializedSciMsgHeader().pb_header))
+ {
+ // Check header coherence in case of MPDU payload
+ //
+ if (PHY_TYPE_MPDU_PAYLOAD == getSpecializedSciMsgHeader().type)
+ {
+ if (
+ (
+ ((PHY_MPDU_FORMAT_BEACON == getSpecializedSciMsgHeader().mpdu_format)
+ || (PHY_MPDU_FORMAT_SOF == getSpecializedSciMsgHeader().mpdu_format)
+ || (PHY_MPDU_FORMAT_SOUND == getSpecializedSciMsgHeader().mpdu_format)
+ || (PHY_MPDU_FORMAT_RSOF == getSpecializedSciMsgHeader().mpdu_format))
+ && (0 != getSpecializedSciMsgHeader().pb_nb)
+ )
+ ||
+ (
+ ((PHY_MPDU_FORMAT_SACK == getSpecializedSciMsgHeader().mpdu_format)
+ || (PHY_MPDU_FORMAT_RTS_CTS == getSpecializedSciMsgHeader().mpdu_format))
+ && (0 == getSpecializedSciMsgHeader().pb_nb)
+ )
+ )
+ {
+ bCheck = SciMsg::checkValidity();
+ }
+ }
+ else
+ {
+ bCheck = SciMsg::checkValidity();
+ }
+ }
+
+ return bCheck;
+}
+
+
+void PhySciMsg::displaySpecializedSciMsgHeader ( ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "PHY SCI msg header = " << endl;
+ clog << logger(LOG_INFO) << "\tversion = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().version) << endl;
+ displaySpecializedSciMsgType(LOG_INFO);
+ clog << logger(LOG_INFO) << "\tmpdu format = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().mpdu_format) << endl;
+ clog << logger(LOG_INFO) << "\tpb nb = " << dec << static_cast<unsigned short int>(getSpecializedSciMsgHeader().pb_nb) << endl;
+ clog << logger(LOG_INFO) << "\tmsg nb = " << dec << static_cast<unsigned short int>(getSpecializedSciMsgHeader().msg_nb) << endl;
+ clog << logger(LOG_INFO) << "\tfc mode = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().fc_mode) << endl;
+ clog << logger(LOG_INFO) << "\tshort ppdu = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().short_ppdu) << endl;
+ clog << logger(LOG_INFO) << "\tmod = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().mod) << endl;
+ clog << logger(LOG_INFO) << "\tfecrate = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().fecrate) << endl;
+ clog << logger(LOG_INFO) << "\tgil = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().gil) << endl;
+ clog << logger(LOG_INFO) << "\ttonemap index = " << dec << static_cast<unsigned short int>(getSpecializedSciMsgHeader().tonemap_index) << endl;
+ clog << logger(LOG_INFO) << "\treserved = 0x" << setfill('0') << setw(4) << uppercase << hex << ntohs(getSpecializedSciMsgHeader().reserved) << endl;
+ clog << logger(LOG_INFO) << "\ttx id = " << dec << ntohs(getSpecializedSciMsgHeader().tx_id) << endl;
+ clog << logger(LOG_INFO) << "\tflags = 0x" << setfill('0') << setw(4) << uppercase << hex << ntohs(getSpecializedSciMsgHeader().flags) << endl;
+ clog << logger(LOG_INFO) << "\tsymbol nb = " << dec << ntohl(getSpecializedSciMsgHeader().symbol_nb) << endl;
+ displayIv();
+ displayNek();
+ displayPbMeasurement();
+ displayPbHeader();
+}
+
+
+bool PhySciMsg::prepare ( Network_Clock_Id clock_id )
+{
+ logFunction();
+
+ return false;
+}
+
+
+void PhySciMsg::displaySpecializedSciMsgType ( int log_level ) const
+{
+ logFunction();
+
+ switch (getSpecializedSciMsgHeader().type)
+ {
+ case 0:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_NONE" << endl;
+ break;
+ case 1:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_PREAMBLE" << endl;
+ break;
+ case 2:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_FC_HYBRID_MODE" << endl;
+ break;
+ case 3:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_FC_AV_ONLY_MODE" << endl;
+ break;
+ case 4:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_PRS" << endl;
+ break;
+ case 5:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_MPDU_PAYLOAD" << endl;
+ break;
+ case 6:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_TONEMASK" << endl;
+ break;
+ case 7:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_TONEMAP" << endl;
+ break;
+ case 8:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_NOISE" << endl;
+ break;
+ case 9:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_RX" << endl;
+ break;
+ case 10:
+ clog << logger(log_level) << "\ttype = PHY_TYPE_ZERO_CROSS" << endl;
+ break;
+ default:
+ clog << logger(log_level) << "\ttype = unknown!" << endl;
+ break;
+ }
+}
+
+
+// private methods
+//
+
+
+void PhySciMsg::displayIv ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "\tiv = 0x ";
+ for (unsigned int i=0; i<3; i++)
+ {
+ oss << setfill('0') << setw(8) << uppercase << hex << htonl(getSpecializedSciMsgHeader().iv[i]) << " ";
+ }
+ oss << endl;
+ oss.flush();
+ clog << logger(LOG_INFO) << oss.str();
+}
+
+
+void PhySciMsg::displayNek ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "\tnek = 0x ";
+ for (unsigned int i=0; i<4; i++)
+ {
+ oss << setfill('0') << setw(8) << uppercase << hex << htonl(getSpecializedSciMsgHeader().nek[i]) << " ";
+ }
+ oss << endl;
+ oss.flush();
+ clog << logger(LOG_INFO) << oss.str();
+}
+
+
+void PhySciMsg::displayPbMeasurement ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "\tpb_measurement = 0x ";
+ for (unsigned int i=0; i<PHY_PB_MAX_NB; i++)
+ {
+ oss << setfill('0') << setw(8) << uppercase << hex << htonl(getSpecializedSciMsgHeader().pb_measurement[i]) << " ";
+ }
+ oss << endl;
+ oss.flush();
+ clog << logger(LOG_INFO) << oss.str();
+}
+
+
+void PhySciMsg::displayPbHeader ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "\tpb_header = 0x ";
+ for (unsigned int i=0; i<PHY_PB_MAX_NB; i++)
+ {
+ oss << setfill('0') << setw(8) << uppercase << hex << htonl(getSpecializedSciMsgHeader().pb_header[i]) << " ";
+ }
+ oss << endl;
+ oss.flush();
+ clog << logger(LOG_INFO) << oss.str();
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+void * PhySciMsg::returnSpecializedSciMsgHeader ( ) const
+{
+ return (void*)&mSpecializedSciMsgHeader;
+}
+
+
+const Phy_Header & PhySciMsg::getSpecializedSciMsgHeader ( ) const
+{
+ return mSpecializedSciMsgHeader;
+}
+
+
+bool PhySciMsg::setSpecializedSciMsgHeader ( const Phy_Header & specialized_sci_msg_header )
+{
+ logFunction();
+ bool bSetHdr = false;
+
+ mSpecializedSciMsgHeader = specialized_sci_msg_header;
+
+ // Set specialized SCI msg attributes from specialized SCI msg header
+ //
+ bSetHdr = setSpecializedSciMsgType (static_cast<Phy_Type>(getSpecializedSciMsgHeader().type));
+ bSetHdr &= setMpduFormat (static_cast<Phy_Mpdu_Format>(getSpecializedSciMsgHeader().mpdu_format));
+ bSetHdr &= setNbOfPbs (static_cast<Phy_Nb_Of_Pbs>(getSpecializedSciMsgHeader().pb_nb));
+ bSetHdr &= setNbOfMsgs (static_cast<unsigned short int>(getSpecializedSciMsgHeader().msg_nb));
+ bSetHdr &= setFcMode (static_cast<Phy_Fc_Mode>(getSpecializedSciMsgHeader().fc_mode));
+ bSetHdr &= setShortPpdu (static_cast<Phy_Short_Ppdu>(getSpecializedSciMsgHeader().short_ppdu));
+ bSetHdr &= setMod (static_cast<Phy_Mod>(getSpecializedSciMsgHeader().mod));
+ bSetHdr &= setFecrate (static_cast<Phy_Fecrate>(getSpecializedSciMsgHeader().fecrate));
+ bSetHdr &= setGil (static_cast<Phy_Gil>(getSpecializedSciMsgHeader().gil));
+ bSetHdr &= setTonemapIndex (static_cast<Phy_Tonemap_Index>(getSpecializedSciMsgHeader().tonemap_index));
+ bSetHdr &= setTxId (static_cast<Phy_Tx_Id>(ntohs(getSpecializedSciMsgHeader().tx_id)));
+ bSetHdr &= setFlags (static_cast<Phy_Flags>(ntohs(getSpecializedSciMsgHeader().flags)));
+ bSetHdr &= setIsEncrypted (PHY_FLAG_ENCRYPTED == (getFlags() & PHY_FLAG_ENCRYPTED));
+ bSetHdr &= setIsCrcOk (PHY_FLAG_CRC_OK == (getFlags() & PHY_FLAG_CRC_OK));
+ bSetHdr &= setPbSize ((PHY_FLAG_PB512 == (getFlags() & PHY_FLAG_PB512)) ? 512 : 128);
+ bSetHdr &= setReserved ((ntohs(getSpecializedSciMsgHeader().reserved)));
+ bSetHdr &= setNbOfSymbols (static_cast<Phy_Nb_Of_Symbols>(ntohl(getSpecializedSciMsgHeader().symbol_nb)));
+ uint32_t iv[3];
+ for (unsigned int i=0; i<3; i++)
+ {
+ iv[i] = ntohl(getSpecializedSciMsgHeader().iv[i]);
+ }
+ bSetHdr &= setIv (iv);
+ uint32_t nek[4];
+ for (unsigned int i=0; i<4; i++)
+ {
+ nek[i] = ntohl(getSpecializedSciMsgHeader().nek[i]);
+ }
+ bSetHdr &= setNek (nek);
+ uint32_t pbMeasurement[PHY_PB_MAX_NB];
+ uint32_t pbHeader[PHY_PB_MAX_NB];
+ for (unsigned int i=0; i<PHY_PB_MAX_NB; i++)
+ {
+ pbMeasurement[i] = ntohl(getSpecializedSciMsgHeader().pb_measurement[i]);
+ pbHeader[i] = ntohl(getSpecializedSciMsgHeader().pb_header[i]);
+ }
+ bSetHdr &= setPbMeasurement (pbMeasurement);
+ bSetHdr &= setPbHeader (pbHeader);
+
+ displaySpecializedSciMsgHeader();
+
+ return bSetHdr;
+}
+
+
+IPhy * PhySciMsg::getPhyProcessor ( ) const
+{
+ if (NULL == mpPhyProcessor)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY processor pointer is NULL");
+ }
+
+ return mpPhyProcessor;
+}
+
+
+Phy_Type PhySciMsg::getSpecializedSciMsgType ( ) const
+{
+ return mSpecializedSciMsgType;
+}
+
+
+bool PhySciMsg::setSpecializedSciMsgType ( const Phy_Type type )
+{
+ bool bSetType = false;
+
+ if ((PHY_TYPE_NB <= type) || (PHY_TYPE_NONE >= type))
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header type is out-of-range", errno);
+ }
+ else
+ {
+ mSpecializedSciMsgType = type;
+ bSetType = true;
+ }
+
+ return bSetType;
+}
+
+
+Phy_Mpdu_Format PhySciMsg::getMpduFormat ( ) const
+{
+ return mMpduFormat;
+}
+
+
+bool PhySciMsg::setMpduFormat ( const Phy_Mpdu_Format mpdu_format )
+{
+ bool bSetMpduFormat = false;
+
+ if (PHY_MPDU_FORMAT_NB <= mpdu_format)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header MPDU format is out-of-range", errno);
+ }
+ else
+ {
+ mMpduFormat = mpdu_format;
+ bSetMpduFormat = true;
+ }
+
+ return bSetMpduFormat;
+}
+
+
+Phy_Nb_Of_Pbs PhySciMsg::getNbOfPbs ( ) const
+{
+ return mNbOfPbs;
+}
+
+
+bool PhySciMsg::setNbOfPbs ( const Phy_Nb_Of_Pbs nb_of_pbs )
+{
+ bool bSetPbNb = false;
+
+ if (PHY_PB_MAX_NB < nb_of_pbs)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header PB number is out-of-range", errno);
+ }
+ else
+ {
+ mNbOfPbs = nb_of_pbs;
+
+ bSetPbNb = true;
+ }
+
+ return bSetPbNb;
+}
+
+
+const unsigned short int PhySciMsg::getNbOfMsgs ( ) const
+{
+ if ((0 == mNbOfMsgs) || (PHY_MSG_MAX_NB_PER_MPDU < mNbOfMsgs))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Number of PHY SCI messages is out-of-range");
+ }
+
+ return mNbOfMsgs;
+}
+
+
+bool PhySciMsg::setNbOfMsgs ( const unsigned short int nb_of_msgs )
+{
+ if ( (0 == nb_of_msgs) || (PHY_MSG_MAX_NB_PER_MPDU < nb_of_msgs))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Number of PHY SCI messages is out-of-range");
+ }
+
+ mNbOfMsgs = nb_of_msgs;
+ return true;
+}
+
+
+Phy_Fc_Mode PhySciMsg::getFcMode ( ) const
+{
+ return mFcMode;
+}
+
+
+bool PhySciMsg::setFcMode ( const Phy_Fc_Mode fc_mode )
+{
+ bool bSetFcMode = false;
+
+ if (PHY_FC_MODE_NONE < fc_mode)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header FC mode is out-of-range", errno);
+ }
+ else
+ {
+ mFcMode = fc_mode;
+ bSetFcMode = true;
+ }
+
+ return bSetFcMode;
+}
+
+
+Phy_Short_Ppdu PhySciMsg::getShortPpdu ( ) const
+{
+ return mShortPpdu;
+}
+
+
+bool PhySciMsg::setShortPpdu ( const Phy_Short_Ppdu short_ppdu )
+{
+ mShortPpdu = short_ppdu;
+
+ return true;
+}
+
+
+Phy_Mod PhySciMsg::getMod ( ) const
+{
+ return mMod;
+}
+
+
+bool PhySciMsg::setMod ( const Phy_Mod mod )
+{
+ bool bSetMod = false;
+
+ if (PHY_MOD_NONE < mod)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header modulation is out-of-range", errno);
+ }
+ else
+ {
+ mMod = mod;
+ bSetMod = true;
+ }
+
+ return bSetMod;
+}
+
+
+Phy_Fecrate PhySciMsg::getFecrate ( ) const
+{
+ return mFecrate;
+}
+
+
+bool PhySciMsg::setFecrate ( const Phy_Fecrate fecrate )
+{
+ bool bSetFecrate = false;
+
+ if (PHY_FEC_RATE_NONE < fecrate)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header FEC rate is out-of-range", errno);
+ }
+ else
+ {
+ mFecrate = fecrate;
+ bSetFecrate = true;
+ }
+
+ return bSetFecrate;
+}
+
+
+Phy_Gil PhySciMsg::getGil ( ) const
+{
+ return mGil;
+}
+
+
+bool PhySciMsg::setGil ( const Phy_Gil gil )
+{
+ bool bSetGil = false;
+
+ if (PHY_GIL_NONE < gil)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header Guard Interval is out-of-range", errno);
+ }
+ else
+ {
+ mGil = gil;
+ bSetGil = true;
+ }
+
+ return bSetGil;
+}
+
+
+Phy_Tonemap_Index PhySciMsg::getTonemapIndex ( ) const
+{
+ return mTonemapIndex;
+}
+
+
+bool PhySciMsg::setTonemapIndex ( const Phy_Tonemap_Index tonemap_index )
+{
+ bool bSetTonemapIndex = false;
+
+ if (TONEMAP_INDEX_NB <= tonemap_index)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header tonemap index is out-of-range", errno);
+ }
+ else
+ {
+ mTonemapIndex = tonemap_index;
+ bSetTonemapIndex = true;
+ }
+
+ return bSetTonemapIndex;
+}
+
+
+Phy_Tx_Id PhySciMsg::getTxId ( ) const
+{
+ return mTxId;
+}
+
+
+bool PhySciMsg::setTxId ( const Phy_Tx_Id tx_id )
+{
+ mTxId = tx_id;
+
+ return true;
+}
+
+
+Phy_Flags PhySciMsg::getFlags ( ) const
+{
+ return mFlags;
+}
+
+
+bool PhySciMsg::setFlags ( const Phy_Flags flags )
+{
+ bool bSetFlags = false;
+
+ if (PHY_FLAG_MAX < flags)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header flags is out-of-range", errno);
+ }
+ else
+ {
+ mFlags = flags;
+ bSetFlags = true;
+ }
+
+ return bSetFlags;
+}
+
+
+bool PhySciMsg::isEncrypted ( ) const
+{
+ return mIsEncrypted;
+}
+
+
+bool PhySciMsg::setIsEncrypted ( const bool is_encrypted )
+{
+ mIsEncrypted = is_encrypted;
+
+ return true;
+}
+
+
+bool PhySciMsg::isCrcOk ( ) const
+{
+ return mIsCrcOk;
+}
+
+
+bool PhySciMsg::setIsCrcOk ( const bool is_crc_ok )
+{
+ mIsCrcOk = is_crc_ok;
+
+ return true;
+}
+
+
+unsigned short int PhySciMsg::getPbSize ( ) const
+{
+ return mPbSize;
+}
+
+
+bool PhySciMsg::setPbSize ( const unsigned short int pb_size )
+{
+ bool bSetPbSize = false;
+
+ if ( (MAC_PB136_BYTES != pb_size) && (MAC_PB520_BYTES != pb_size) )
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PB size is out-of-range", errno);
+ }
+ else
+ {
+ mPbSize = pb_size;
+ bSetPbSize = true;
+ }
+
+ return bSetPbSize;
+}
+
+Phy_Nb_Of_Symbols PhySciMsg::getNbOfSymbols ( ) const
+{
+ return mNbOfSymbols;
+}
+
+
+bool PhySciMsg::setNbOfSymbols ( const Phy_Nb_Of_Symbols nb_of_symbols )
+{
+ bool bSetSymbolNb = false;
+
+ if (MAC_MAX_SYMB_PER_MPDU < nb_of_symbols)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message header symbol number is out-of-range", errno);
+ }
+ else
+ {
+ mNbOfSymbols = nb_of_symbols;
+ bSetSymbolNb = true;
+ }
+
+ return bSetSymbolNb;
+}
+
+
+const uint32_t * PhySciMsg::getIv ( ) const
+{
+ return mIvArray;
+}
+
+
+bool PhySciMsg::setIv ( const uint32_t iv[3] )
+{
+ return (NULL != memcpy(mIvArray, iv, 3*sizeof(uint32_t)));
+}
+
+
+const uint32_t * PhySciMsg::getNek ( ) const
+{
+ return mNekArray;
+}
+
+
+bool PhySciMsg::setNek ( const uint32_t nek[4] )
+{
+ return (NULL != memcpy(mNekArray, nek, 4*sizeof(uint32_t)));
+}
+
+
+const uint32_t * PhySciMsg::getPbMeasurement ( ) const
+{
+ return mPbMeasurementArray;
+}
+
+
+bool PhySciMsg::setPbMeasurement ( const uint32_t pb_measurement[PHY_PB_MAX_NB] )
+{
+ return (NULL != memcpy(mPbMeasurementArray, pb_measurement, PHY_PB_MAX_NB*sizeof(uint32_t)));
+}
+
+
+const uint32_t * PhySciMsg::getPbHeader ( ) const
+{
+ return mPbHeaderArray;
+}
+
+
+bool PhySciMsg::setPbHeader ( const uint32_t pb_header[PHY_PB_MAX_NB] )
+{
+ return (NULL != memcpy(mPbHeaderArray, pb_header, PHY_PB_MAX_NB*sizeof(uint32_t)));
+}
+
+
+const bool PhySciMsg::isSent ( ) const
+{
+ return mIsSent;
+}
+
+
+bool PhySciMsg::setIsSent ( const bool is_sent )
+{
+ logFunction();
+
+ mIsSent = is_sent;
+ return true;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/phy/src/PhySciMsgFc.cpp b/cesar/maximus/phy/src/PhySciMsgFc.cpp
new file mode 100644
index 0000000000..759808da5f
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgFc.cpp
@@ -0,0 +1,189 @@
+/************************************************************************
+ PhySciMsgFc.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/src/PhySciMsgFc.cpp
+**************************************************************************/
+
+#include "PhySciMsgFc.h"
+#include "IPhy.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+// for 'getpid()'
+#include <sys/types.h>
+#include <unistd.h>
+
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+PhySciMsgFc::PhySciMsgFc ( IPhy * p_phy_processor ) : PhySciMsg ( p_phy_processor ),
+mFc10(0)
+{
+ logFunction();
+
+ initAttributes ();
+}
+
+
+void PhySciMsgFc::initAttributes ( )
+{
+ logFunction();
+
+ memset(mFcAvArray, '\0', 4*sizeof(uint32_t));
+
+ // Set PHY SCI message type
+ PhySciMsg::setSpecializedSciMsgType(PHY_TYPE_FC_AV_ONLY_MODE);
+}
+
+
+PhySciMsgFc::~PhySciMsgFc( )
+{
+ logFunction();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool PhySciMsgFc::prepare ( Network_Clock_Id clock_id )
+{
+ logFunction();
+ bool bPrepare = false;
+
+ /* For a PHY message of type FC_AV_ONLY_MODE,
+ * PHY SCI message data only contain AV Frame Control (128 bits). */
+
+ if (PHY_TYPE_FC_AV_ONLY_MODE == PhySciMsg::getSpecializedSciMsgType())
+ {
+ // Set length of PHY SCI message data
+ bPrepare = SciMsg::setSpecializedSciMsgDataLength(4*sizeof(uint32_t));
+
+ // Set PHY SCI message data
+ bPrepare &= SciMsg::setSpecializedSciMsgData((unsigned char *)getFcAv());
+ }
+
+ /* For a PHY message of type FC_HYBRID_MODE,
+ * PHY SCI message data contain HP1.0.1 Frame Control (25 bits => on 4 octets)
+ * and AV Frame Control (128 bits). */
+
+ else if (PHY_TYPE_FC_HYBRID_MODE == PhySciMsg::getSpecializedSciMsgType())
+ {
+ // Set length of PHY SCI message data
+ bPrepare = SciMsg::setSpecializedSciMsgDataLength(5*sizeof(uint32_t));
+
+ // Set PHY SCI message data
+ unsigned char data[5*sizeof(uint32_t)];
+ memcpy(data, (unsigned char *)&mFc10, sizeof(uint32_t));
+ memcpy(data+sizeof(uint32_t), (unsigned char *)getFcAv(), 4*sizeof(uint32_t));
+ bPrepare &= SciMsg::setSpecializedSciMsgData(data);
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message type is not FC");
+ }
+
+ // Set TX ID
+ bPrepare &= PhySciMsg::setTxId(PhySciMsg::getPhyProcessor()->getTxId());
+
+ // Set station ID to Maximus PID
+ bPrepare &= SciMsg::setSciMsgStationId(getpid());
+
+ if (PhySciMsg::getShortPpdu())
+ {
+ // Indicate that MPDU transmission is finished
+ PhySciMsg::setIsSent(true);
+ }
+
+ return bPrepare;
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+const uint32_t PhySciMsgFc::getFc10 ( ) const
+{
+ return mFc10;
+}
+
+
+bool PhySciMsgFc::setFc10 ( const uint32_t fc_10 )
+{
+ mFc10 = fc_10;
+
+ // Set PHY SCI message type
+ return PhySciMsg::setSpecializedSciMsgType(PHY_TYPE_FC_HYBRID_MODE);
+}
+
+
+const uint32_t * PhySciMsgFc::getFcAv ( ) const
+{
+ return mFcAvArray;
+}
+
+
+bool PhySciMsgFc::setFcAv ( const uint32_t fc_av[4] )
+{
+ return (NULL != memcpy(mFcAvArray, fc_av, 4*sizeof(uint32_t)));
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/phy/src/PhySciMsgFcTest.cpp b/cesar/maximus/phy/src/PhySciMsgFcTest.cpp
new file mode 100644
index 0000000000..f0bd22fe8f
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgFcTest.cpp
@@ -0,0 +1,131 @@
+
+#include "PhySciMsgFcTest.h"
+
+#include "PhySciMsgFc.h"
+#include "PhyProcessor.h"
+#include "SciServer.h"
+
+#include "Logger.h"
+
+// for 'getpid()'
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (PhySciMsgFcTest);
+
+
+void PhySciMsgFcTest::setUp (void)
+{
+ logTest();
+
+ mpSci = new SciServer();
+ mpPhy = new PhyProcessor(mpSci);
+ mpPhySciMsgFc = new PhySciMsgFc(mpPhy);
+ uint32_t fcAv[4];
+ memset(fcAv, '\0', 4*sizeof(uint32_t));
+ CPPUNIT_ASSERT_MESSAGE ( "creation failed",
+ (mpPhy == mpPhySciMsgFc->getPhyProcessor())
+ && (PHY_TYPE_FC_AV_ONLY_MODE == mpPhySciMsgFc->getSpecializedSciMsgType())
+ && (0 == mpPhySciMsgFc->getFc10())
+ && (0 == memcmp(fcAv, mpPhySciMsgFc->getFcAv(), 4*sizeof(uint32_t))) );
+}
+
+
+void PhySciMsgFcTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgFc)
+ {
+ delete (mpPhySciMsgFc);
+ mpPhySciMsgFc = NULL;
+ }
+ if (NULL != mpPhy)
+ {
+ delete (mpPhy);
+ mpPhy = NULL;
+ }
+ if (NULL != mpSci)
+ {
+ delete (mpSci);
+ mpSci = NULL;
+ }
+}
+
+
+void PhySciMsgFcTest::prepareTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgFc)
+ {
+ const uint32_t fc10 = 123;
+ uint32_t fcAv[4];
+ memset(fcAv, '1', 4*sizeof(uint32_t));
+ mpPhySciMsgFc->setFcAv(fcAv);
+ CPPUNIT_ASSERT_MESSAGE ( "prepare failed",
+ (mpPhySciMsgFc->prepare(0 /* clock_id */ ))
+ && (0 == mpPhySciMsgFc->getTxId())
+ && (getpid() == mpPhySciMsgFc->getSciMsgStationId())
+ && (4*sizeof(uint32_t) == mpPhySciMsgFc->getSpecializedSciMsgDataLength())
+ && (0 == memcmp((unsigned char *)fcAv, mpPhySciMsgFc->getSpecializedSciMsgData(), 4*sizeof(uint32_t)))
+ && (!mpPhySciMsgFc->isSent()) );
+
+ mpPhySciMsgFc->setFc10(fc10);
+ mpPhySciMsgFc->setShortPpdu(true);
+ CPPUNIT_ASSERT_MESSAGE ( "prepare failed",
+ (mpPhySciMsgFc->prepare(0 /* clock_id */ ))
+ && (0 == mpPhySciMsgFc->getTxId())
+ && (getpid() == mpPhySciMsgFc->getSciMsgStationId())
+ && (5*sizeof(uint32_t) == mpPhySciMsgFc->getSpecializedSciMsgDataLength())
+ && (0 == memcmp((unsigned char *)&fc10, mpPhySciMsgFc->getSpecializedSciMsgData(), sizeof(uint32_t)))
+ && (0 == memcmp((unsigned char *)fcAv, mpPhySciMsgFc->getSpecializedSciMsgData()+sizeof(uint32_t), 4*sizeof(uint32_t)))
+ && (mpPhySciMsgFc->isSent()) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message FC pointer is NULL");
+ }
+}
+
+
+void PhySciMsgFcTest::fc10Test (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgFc)
+ {
+ const uint32_t fc10 = 789;
+ CPPUNIT_ASSERT_MESSAGE ( "fc10 failed",
+ (mpPhySciMsgFc->setFc10(fc10))
+ && (fc10 == mpPhySciMsgFc->getFc10())
+ && (PHY_TYPE_FC_HYBRID_MODE == mpPhySciMsgFc->getSpecializedSciMsgType()) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message FC pointer is NULL");
+ }
+}
+
+
+void PhySciMsgFcTest::fcAvTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgFc)
+ {
+ uint32_t fcAv[4];
+ memset(fcAv, '2', 4*sizeof(uint32_t));
+ CPPUNIT_ASSERT_MESSAGE ( "fcAv failed",
+ (mpPhySciMsgFc->setFcAv(fcAv))
+ && (0 == memcmp((unsigned char *)fcAv, mpPhySciMsgFc->getFcAv(), 4*sizeof(uint32_t))) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message FC pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/phy/src/PhySciMsgMpdu.cpp b/cesar/maximus/phy/src/PhySciMsgMpdu.cpp
new file mode 100644
index 0000000000..48507cca7a
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgMpdu.cpp
@@ -0,0 +1,529 @@
+/************************************************************************
+ PhySciMsgMpdu.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/src/PhySciMsgMpdu.cpp
+**************************************************************************/
+
+#include "PhySciMsgMpdu.h"
+#include "PhySciMsgPre.h"
+#include "PhySciMsgFc.h"
+#include "IPhy.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+// for 'getpid()'
+#include <sys/types.h>
+#include <unistd.h>
+
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+PhySciMsgMpdu::PhySciMsgMpdu ( IPhy * p_phy_processor ) : PhySciMsg ( p_phy_processor ),
+mPayloadLength(0),
+mpPayload(NULL),
+mpPre(NULL),
+mpFc(NULL),
+mNbOfPbsInLastMsg(0)
+{
+ logFunction();
+
+ initAttributes(p_phy_processor);
+}
+
+
+PhySciMsgMpdu::PhySciMsgMpdu ( PhySciMsg & phy_sci_msg ) : PhySciMsg ( phy_sci_msg.getPhyProcessor() ),
+mPayloadLength(0),
+mpPayload(NULL),
+mpPre(NULL),
+mpFc(NULL),
+mNbOfPbsInLastMsg(0)
+{
+ logFunction();
+
+ // Initialize PHY SCI message MPDU attributes
+ initAttributes(phy_sci_msg.getPhyProcessor());
+
+ // Copy SCI message attributes
+ SciMsg::setSciMsgHeader(*phy_sci_msg.getSciMsgHeader());
+
+ // Copy PHY SCI message attributes
+ PhySciMsg::setSpecializedSciMsgHeader(phy_sci_msg.getSpecializedSciMsgHeader());
+ PhySciMsg::setSpecializedSciMsgDataLength(phy_sci_msg.getSpecializedSciMsgDataLength());
+ PhySciMsg::setSpecializedSciMsgData(phy_sci_msg.getSpecializedSciMsgData());
+
+ // Copy PHY SCI message MPDU attributes
+ setMpdu(PhySciMsg::getSpecializedSciMsgDataLength(), PhySciMsg::getSpecializedSciMsgData());
+}
+
+
+void PhySciMsgMpdu::initAttributes ( IPhy * p_phy_processor )
+{
+ logFunction();
+
+ // Create PREAMBLE message
+ mpPre = new PhySciMsgPre(p_phy_processor);
+ if (NULL == mpPre)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message PREAMBLE pointer is NULL");
+ }
+
+ // Create FC message
+ mpFc = new PhySciMsgFc(p_phy_processor);
+ if (NULL == mpFc)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message FC pointer is NULL");
+ }
+
+ memset(mPbsArray, '\0', MAC_MAX_PB_PER_MPDU*MAC_PB520_BYTES);
+ memset(mPbsHeadersArray, '\0', MAC_MAX_PB_PER_MPDU * sizeof(uint32_t));
+
+ // Set PHY SCI message type
+ PhySciMsg::setSpecializedSciMsgType(PHY_TYPE_MPDU_PAYLOAD);
+}
+
+
+PhySciMsgMpdu::~PhySciMsgMpdu ( )
+{
+ logFunction();
+
+ if (NULL != mpPayload)
+ {
+ delete [] mpPayload;
+ mpPayload = NULL;
+ }
+ if (NULL != mpPre)
+ {
+ delete (mpPre);
+ mpPre = NULL;
+ }
+ if (NULL != mpFc)
+ {
+ delete (mpFc);
+ mpFc = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool PhySciMsgMpdu::segment ( )
+{
+ logFunction();
+ bool bSegment = false;
+
+ if ( MAC_PB136_BYTES < getPayloadLength() ) // MPDU is composed of 512-octet PBs
+ {
+ // Set PB size
+ bSegment = PhySciMsg::setPbSize(MAC_PB520_BYTES);
+
+ /* Calculate total number of PBs. */
+
+ unsigned short int totalNbOfPbs = getPayloadLength() / PhySciMsg::getPbSize();
+ if ( 0 != getPayloadLength() % PhySciMsg::getPbSize() )
+ {
+ totalNbOfPbs++;
+ }
+ if (MAC_MAX_PB_PER_MPDU < totalNbOfPbs)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Total number of PBs exceeds maximum number of PBs per MPDU");
+ }
+
+ /* Calculate number of PHY SCI messages needed to transmit all PBs,
+ * and number of PBs to transmit in each PHY SCI message. */
+
+ unsigned short int nbOfMsgs = 1;
+ unsigned short int nbOfPbs = totalNbOfPbs;
+ unsigned short int nbOfPbsInLastMsg = totalNbOfPbs;
+
+ if ( PHY_PB_MAX_NB < totalNbOfPbs ) // MPDU is composed of several PHY SCI messages
+ {
+ nbOfMsgs = totalNbOfPbs / PHY_PB_MAX_NB;
+ nbOfPbs = PHY_PB_MAX_NB;
+ nbOfPbsInLastMsg = totalNbOfPbs % PHY_PB_MAX_NB;
+ if ( 0 != nbOfPbsInLastMsg )
+ {
+ nbOfMsgs++;
+ }
+ else
+ {
+ nbOfPbsInLastMsg = nbOfPbs;
+ }
+ }
+
+ // Set number of PHY SCI messages
+ bSegment &= PhySciMsg::setNbOfMsgs(nbOfMsgs);
+
+ // Set number of PBs
+ bSegment &= PhySciMsg::setNbOfPbs(nbOfPbs);
+
+ // Set number of PBs into the last PHY SCI message
+ bSegment &= setNbOfPbsInLastMsg(nbOfPbsInLastMsg);
+
+ // Reset PBs array
+ memset(mPbsArray, '\0', MAC_MAX_PB_PER_MPDU*MAC_PB520_BYTES);
+
+ // Set PBs array
+ for (int i = 0; i < nbOfMsgs-1; i++)
+ {
+ memcpy(&mPbsArray[i*PHY_PB_MAX_NB*MAC_PB520_BYTES], getPayload()+i*PHY_PB_MAX_NB*MAC_PB520_BYTES, PHY_PB_MAX_NB*MAC_PB520_BYTES);
+ }
+ memcpy(&mPbsArray[(nbOfMsgs-1)*PHY_PB_MAX_NB*MAC_PB520_BYTES], getPayload()+(nbOfMsgs-1)*PHY_PB_MAX_NB*MAC_PB520_BYTES, getPayloadLength()-((nbOfMsgs-1)*PHY_PB_MAX_NB*MAC_PB520_BYTES));
+ }
+
+ else // MPDU is composed of one 128-octet PB
+ {
+ // Set PB size
+ bSegment = PhySciMsg::setPbSize(MAC_PB136_BYTES);
+
+ // Set number of PHY SCI messages
+ bSegment &= PhySciMsg::setNbOfMsgs(1);
+
+ // Set number of PBs
+ bSegment &= PhySciMsg::setNbOfPbs(1);
+
+ // Set number of PBs into the last PHY SCI message
+ bSegment &= setNbOfPbsInLastMsg(1);
+
+ // Set PBs array
+ memcpy(mPbsArray, getPayload(), getPayloadLength());
+ }
+
+ return bSegment;
+}
+
+
+bool PhySciMsgMpdu::prepare ( Network_Clock_Id clock_id )
+{
+ logFunction();
+ bool bPrepare = false;
+
+ if ((0 == clock_id) || (PhySciMsg::getNbOfMsgs() < clock_id))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network Clock ID is out-of-range");
+ }
+ else if (PhySciMsg::getNbOfMsgs() == clock_id) // This is the last PHY SCI message composing the MPDU
+ {
+ // Set number of PBs
+ bPrepare = PhySciMsg::setNbOfPbs(getNbOfPbsInLastMsg());
+
+ // Indicate that MPDU transmission is finished
+ bPrepare &= PhySciMsg::setIsSent(true);
+ }
+
+ /* For a PHY message of type MPDU_PAYLOAD,
+ * PHY SCI message data only contain MPDU payload
+ * ('nb_of_pbs' PBs of 128 or 512 octets depending on PHY_FLAG_PB512). */
+
+ // Set length of PHY SCI message data = PB number * PB size
+ bPrepare = SciMsg::setSpecializedSciMsgDataLength(PhySciMsg::getNbOfPbs()*PhySciMsg::getPbSize());
+
+ // Set PHY SCI message data
+ bPrepare &= SciMsg::setSpecializedSciMsgData(getPbs(clock_id-1));
+
+ return bPrepare;
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+const unsigned long PhySciMsgMpdu::getPayloadLength ( ) const
+{
+ return mPayloadLength;
+}
+
+
+const unsigned char * PhySciMsgMpdu::getPayload ( ) const
+{
+ if (NULL == mpPayload)
+ {
+ throw Error(__PRETTY_FUNCTION__, "MPDU payload pointer is NULL");
+ }
+
+ return mpPayload;
+}
+
+
+bool PhySciMsgMpdu::setMpdu ( const unsigned long length, const unsigned char * p_payload )
+{
+ logFunction();
+ bool bSetMpdu = false;
+
+ /* If MPDU payload has already been set,
+ * delete the previous MPDU payload. */
+
+ if (NULL != mpPayload)
+ {
+ delete [] mpPayload;
+ mpPayload = NULL;
+ }
+
+ if ((0 != length) && (NULL != p_payload))
+ {
+ // Set MPDU payload length
+ mPayloadLength = length;
+
+ // Allocate and set MPDU payload
+ mpPayload = new unsigned char [length];
+ bSetMpdu = (NULL != memcpy(mpPayload, p_payload, length));
+ }
+ else
+ {
+ mPayloadLength = 0;
+ mpPayload = NULL;
+ }
+
+ return bSetMpdu;
+}
+
+
+PhySciMsgPre * PhySciMsgMpdu::getPre ( ) const
+{
+ if (NULL == mpPre)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message PREAMBLE pointer is NULL");
+ }
+
+ return mpPre;
+}
+
+
+PhySciMsgFc * PhySciMsgMpdu::getFc ( ) const
+{
+ if (NULL == mpFc)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PHY SCI message FC pointer is NULL");
+ }
+
+ return mpFc;
+}
+
+
+const unsigned short int PhySciMsgMpdu::getNbOfPbsInLastMsg ( ) const
+{
+ if ((0 == mNbOfPbsInLastMsg) || (PHY_PB_MAX_NB < mNbOfPbsInLastMsg))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Number of PBs into the last PHY SCI message is out-of-range");
+ }
+
+ return mNbOfPbsInLastMsg;
+}
+
+
+bool PhySciMsgMpdu::setNbOfPbsInLastMsg ( const unsigned short int nb_of_pbs_in_last_msg )
+{
+ if ( (0 == nb_of_pbs_in_last_msg) || (PHY_PB_MAX_NB < nb_of_pbs_in_last_msg))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Number of PBs into the last PHY SCI message is out-of-range");
+ }
+
+ mNbOfPbsInLastMsg = nb_of_pbs_in_last_msg;
+ return true;
+}
+
+
+const unsigned char * PhySciMsgMpdu::getPbs ( const unsigned short int n ) const
+{
+ if (PHY_MSG_MAX_NB_PER_MPDU <= n)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PBs array index exceeds PBs array size");
+ }
+
+ return &mPbsArray[n*PHY_PB_MAX_NB*MAC_PB520_BYTES];
+}
+
+
+const bool PhySciMsgMpdu::isSent ( ) const
+{
+ return (PhySciMsg::isSent() || getFc()->isSent());
+}
+
+
+const bool PhySciMsgMpdu::isReceived ( const unsigned short int nb_of_received_msgs ) const
+{
+ return (nb_of_received_msgs == PhySciMsg::getNbOfMsgs());
+}
+
+
+bool PhySciMsgMpdu::setFcMode ( const Phy_Fc_Mode fc_mode )
+{
+ bool bSetFcMode = false;
+
+ bSetFcMode = getPre()->setFcMode(fc_mode);
+ bSetFcMode &= getFc()->setFcMode(fc_mode);
+ bSetFcMode &= PhySciMsg::setFcMode(fc_mode);
+
+ return bSetFcMode;
+}
+
+
+bool PhySciMsgMpdu::setShortPpdu ( const Phy_Short_Ppdu short_ppdu )
+{
+ bool bSetShort;
+
+ bSetShort = getPre()->setShortPpdu(short_ppdu);
+ bSetShort &= getFc()->setShortPpdu(short_ppdu);
+ bSetShort &= PhySciMsg::setShortPpdu(short_ppdu);
+
+ return bSetShort;
+}
+
+
+bool PhySciMsgMpdu::setMod ( const Phy_Mod mod )
+{
+ bool bSetMod = false;
+
+ bSetMod = getPre()->setMod(mod);
+ bSetMod &= getFc()->setMod(mod);
+ bSetMod &= PhySciMsg::setMod(mod);
+
+ return bSetMod;
+}
+
+
+bool PhySciMsgMpdu::setFecrate ( const Phy_Fecrate fecrate )
+{
+ bool bSetFecrate = false;
+
+ bSetFecrate = getPre()->setFecrate(fecrate);
+ bSetFecrate &= getFc()->setFecrate(fecrate);
+ bSetFecrate &= PhySciMsg::setFecrate(fecrate);
+
+ return bSetFecrate;
+}
+
+
+bool PhySciMsgMpdu::setGil ( const Phy_Gil gil )
+{
+ bool bSetGil = false;
+
+ bSetGil = getPre()->setGil(gil);
+ bSetGil &= getFc()->setGil(gil);
+ bSetGil &= PhySciMsg::setGil(gil);
+
+ return bSetGil;
+}
+
+
+bool PhySciMsgMpdu::setFlags ( const Phy_Flags flags )
+{
+ bool bSetFlags = false;
+
+ bSetFlags = getPre()->setFlags(flags);
+ bSetFlags &= getFc()->setFlags(flags);
+ bSetFlags &= PhySciMsg::setFlags(flags);
+
+ return bSetFlags;
+}
+
+
+const uint32_t PhySciMsgMpdu::getFc10 ( ) const
+{
+ return getFc()->getFc10();
+}
+
+
+bool PhySciMsgMpdu::setFc10 ( const uint32_t fc_10 )
+{
+ return getFc()->setFc10(fc_10);
+}
+
+
+const uint32_t * PhySciMsgMpdu::getFcAv ( ) const
+{
+ return getFc()->getFcAv();
+}
+
+
+bool PhySciMsgMpdu::setFcAv ( const uint32_t fc_av[4] )
+{
+ return getFc()->setFcAv(fc_av);
+}
+
+
+const uint32_t * PhySciMsgMpdu::getPbsHeaders ( const unsigned short int n ) const
+{
+ if (PHY_MSG_MAX_NB_PER_MPDU <= n)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PBs Headers array index exceeds PBs Headers array size");
+ }
+
+ return &mPbsHeadersArray[n*PHY_PB_MAX_NB];
+}
+
+
+bool PhySciMsgMpdu::setPbsHeaders ( const unsigned short int n, const uint32_t pb_header )
+{
+ if (MAC_MAX_PB_PER_MPDU <= n)
+ {
+ throw Error(__PRETTY_FUNCTION__, "PB number is out-of-range");
+ }
+ else
+ {
+ mPbsHeadersArray[n] = pb_header;
+ }
+
+ return true;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/phy/src/PhySciMsgMpduTest.cpp b/cesar/maximus/phy/src/PhySciMsgMpduTest.cpp
new file mode 100644
index 0000000000..534d495d9d
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgMpduTest.cpp
@@ -0,0 +1,321 @@
+
+#include "PhySciMsgMpduTest.h"
+
+#include "PhySciMsgMpdu.h"
+#include "PhyProcessor.h"
+#include "SciServer.h"
+
+#include "Logger.h"
+
+// for 'getpid()'
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (PhySciMsgMpduTest);
+
+
+void PhySciMsgMpduTest::setUp (void)
+{
+ logTest();
+
+ mpSci = new SciServer();
+ mpPhy = new PhyProcessor(mpSci);
+ mpPhySciMsgMpdu = new PhySciMsgMpdu(mpPhy);
+ unsigned char pbs[MAC_MAX_PB_PER_MPDU*MAC_PB520_BYTES];
+ memset(pbs, '\0', MAC_MAX_PB_PER_MPDU*MAC_PB520_BYTES);
+ CPPUNIT_ASSERT_MESSAGE ( "creation failed",
+ (mpPhy == mpPhySciMsgMpdu->getPhyProcessor())
+ && (0 == mpPhySciMsgMpdu->getPayloadLength())
+ && (NULL != mpPhySciMsgMpdu->getPre())
+ && (NULL != mpPhySciMsgMpdu->getFc())
+ && (0 == memcmp(pbs, mpPhySciMsgMpdu->getPbs(0), MAC_MAX_PB_PER_MPDU*MAC_PB520_BYTES))
+ && (PHY_TYPE_MPDU_PAYLOAD == mpPhySciMsgMpdu->getSpecializedSciMsgType()) );
+}
+
+
+void PhySciMsgMpduTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgMpdu)
+ {
+ delete (mpPhySciMsgMpdu);
+ mpPhySciMsgMpdu = NULL;
+ }
+ if (NULL != mpPhy)
+ {
+ delete (mpPhy);
+ mpPhy = NULL;
+ }
+ if (NULL != mpSci)
+ {
+ delete (mpSci);
+ mpSci = NULL;
+ }
+}
+
+
+void PhySciMsgMpduTest::segmentTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgMpdu)
+ {
+ /* Test with one PB of 128 octet. */
+
+ unsigned char pb[MAC_PB136_BYTES];
+ for (unsigned char i=0; i<MAC_PB136_BYTES; i++)
+ {
+ pb[i] = i;
+ }
+ mpPhySciMsgMpdu->setMpdu(MAC_PB136_BYTES, pb);
+
+ CPPUNIT_ASSERT_MESSAGE ( "segment failed",
+ (mpPhySciMsgMpdu->segment())
+ && (MAC_PB136_BYTES == mpPhySciMsgMpdu->getPbSize())
+ && (1 == mpPhySciMsgMpdu->getNbOfPbs())
+ && (1 == mpPhySciMsgMpdu->getNbOfPbsInLastMsg())
+ && (1 == mpPhySciMsgMpdu->getNbOfMsgs())
+ && (0 == memcmp(pb, mpPhySciMsgMpdu->getPbs(), MAC_PB136_BYTES)) );
+
+ /* Test with n PBs of 512 octets. */
+
+ unsigned short int nbOfPbsInLastMsg = 0;
+ unsigned short int nbOfMsgs = 0;
+ unsigned char c = 'A';
+
+ for (int nb=1; nb<100; nb++)
+ {
+ unsigned short int nbOfPbs;
+ if (PHY_PB_MAX_NB < nb)
+ {
+ nbOfPbs = PHY_PB_MAX_NB;
+ }
+ else
+ {
+ nbOfPbs = nb;
+ }
+ nbOfPbsInLastMsg = nb % PHY_PB_MAX_NB;
+ nbOfMsgs = nb / PHY_PB_MAX_NB;
+ if (0 != nbOfPbsInLastMsg)
+ {
+ nbOfMsgs++;
+ }
+ else
+ {
+ nbOfPbsInLastMsg = nbOfPbs;
+ }
+ const unsigned long length = nb*MAC_PB520_BYTES;
+ unsigned char payload[length];
+ for (unsigned int i=0; i<length; i++)
+ {
+ payload[i] = c;
+ }
+ mpPhySciMsgMpdu->setMpdu(length, payload);
+
+ CPPUNIT_ASSERT_MESSAGE ( "segment failed",
+ (mpPhySciMsgMpdu->segment())
+ && (MAC_PB520_BYTES == mpPhySciMsgMpdu->getPbSize())
+ && (nbOfPbs == (unsigned short int)mpPhySciMsgMpdu->getNbOfPbs())
+ && (nbOfPbsInLastMsg == mpPhySciMsgMpdu->getNbOfPbsInLastMsg())
+ && (nbOfMsgs == mpPhySciMsgMpdu->getNbOfMsgs())
+ && (0 == memcmp(payload, mpPhySciMsgMpdu->getPbs(), length))
+ );
+
+ for (int j=0; j<nbOfMsgs-1; j++)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "segment failed",
+ 0 == memcmp(&payload[j*PHY_PB_MAX_NB*MAC_PB520_BYTES], mpPhySciMsgMpdu->getPbs(j), nbOfPbs*MAC_PB520_BYTES) );
+ }
+ CPPUNIT_ASSERT_MESSAGE ( "segment failed",
+ 0 == memcmp(&payload[(nbOfMsgs-1)*PHY_PB_MAX_NB*MAC_PB520_BYTES], mpPhySciMsgMpdu->getPbs(nbOfMsgs-1), nbOfPbsInLastMsg*MAC_PB520_BYTES) );
+
+ c++;
+ }
+
+ /* Test with random data length. */
+
+ const unsigned long dataLength = 20007; // an odd number
+ const unsigned short int nbOfPbs = dataLength/MAC_PB520_BYTES + 1;
+ nbOfPbsInLastMsg = nbOfPbs % PHY_PB_MAX_NB;
+ nbOfMsgs = nbOfPbs / PHY_PB_MAX_NB;
+ if (0 != nbOfPbsInLastMsg)
+ {
+ nbOfMsgs++;
+ }
+ else
+ {
+ nbOfPbsInLastMsg = PHY_PB_MAX_NB;
+ }
+ unsigned char data[nbOfPbs*MAC_PB520_BYTES];
+ memset(data, '7', dataLength);
+ memset(&data[dataLength], '\0', nbOfPbs*MAC_PB520_BYTES-dataLength);
+ mpPhySciMsgMpdu->setMpdu(dataLength, data);
+
+ CPPUNIT_ASSERT_MESSAGE ( "segment failed",
+ (mpPhySciMsgMpdu->segment())
+ && (MAC_PB520_BYTES == mpPhySciMsgMpdu->getPbSize())
+ && (PHY_PB_MAX_NB == mpPhySciMsgMpdu->getNbOfPbs())
+ && (nbOfPbsInLastMsg == mpPhySciMsgMpdu->getNbOfPbsInLastMsg())
+ && (nbOfMsgs == mpPhySciMsgMpdu->getNbOfMsgs())
+ && (0 == memcmp(data, mpPhySciMsgMpdu->getPbs(0), (nbOfMsgs-1)*PHY_PB_MAX_NB*MAC_PB520_BYTES))
+ && (0 == memcmp(&data[(nbOfMsgs-1)*PHY_PB_MAX_NB*MAC_PB520_BYTES], mpPhySciMsgMpdu->getPbs(nbOfMsgs-1), nbOfPbsInLastMsg*MAC_PB520_BYTES))
+ );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message MPDU pointer is NULL");
+ }
+}
+
+
+void PhySciMsgMpduTest::prepareTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgMpdu)
+ {
+ const unsigned short int nbOfPbs = 50;
+ unsigned short int nbOfPbsInLastMsg = nbOfPbs % PHY_PB_MAX_NB;
+ unsigned short int nbOfMsgs = nbOfPbs / PHY_PB_MAX_NB;
+ if (0 != nbOfPbsInLastMsg)
+ {
+ nbOfMsgs++;
+ }
+ else
+ {
+ nbOfPbsInLastMsg = PHY_PB_MAX_NB;
+ }
+ const unsigned long length = nbOfPbs*MAC_PB520_BYTES;
+ unsigned char payload[length];
+ unsigned char c = 'A';
+ for (int i=0; i<nbOfPbs; i++)
+ {
+ for (int j=0; j<MAC_PB520_BYTES; j++)
+ {
+ payload[i*MAC_PB520_BYTES+j] = c;
+ }
+ c++;
+ }
+ mpPhySciMsgMpdu->setMpdu(length, payload);
+ mpPhySciMsgMpdu->segment();
+
+ // Test the PHY SCI messages
+ for (int i=1; i<nbOfMsgs; i++)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "prepare failed",
+ (mpPhySciMsgMpdu->prepare((Network_Clock_Id)i))
+ && (PHY_PB_MAX_NB == mpPhySciMsgMpdu->getNbOfPbs())
+ && (!mpPhySciMsgMpdu->isSent())
+ && (PHY_PB_MAX_NB*MAC_PB520_BYTES == mpPhySciMsgMpdu->getSpecializedSciMsgDataLength())
+ && (0 == memcmp(&payload[(i-1)*PHY_PB_MAX_NB*MAC_PB520_BYTES], mpPhySciMsgMpdu->getSpecializedSciMsgData(), PHY_PB_MAX_NB*MAC_PB520_BYTES))
+ );
+ }
+ // Test second (and last) PHY SCI message
+ CPPUNIT_ASSERT_MESSAGE ( "prepare failed",
+ (mpPhySciMsgMpdu->prepare((Network_Clock_Id)nbOfMsgs))
+ && (nbOfPbsInLastMsg == mpPhySciMsgMpdu->getNbOfPbs())
+ && (mpPhySciMsgMpdu->isSent())
+ && ((unsigned long)nbOfPbsInLastMsg*MAC_PB520_BYTES == mpPhySciMsgMpdu->getSpecializedSciMsgDataLength())
+ && (0 == memcmp(&payload[(nbOfMsgs-1)*PHY_PB_MAX_NB*MAC_PB520_BYTES], mpPhySciMsgMpdu->getSpecializedSciMsgData(), nbOfPbsInLastMsg*MAC_PB520_BYTES))
+ );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message MPDU pointer is NULL");
+ }
+}
+
+
+void PhySciMsgMpduTest::setMpduTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgMpdu)
+ {
+ unsigned long length1 = 10;
+ unsigned char payload1[length1];
+ memcpy(payload1, "1234567890", length1);
+
+ CPPUNIT_ASSERT_MESSAGE ( "setMpdu failed",
+ (mpPhySciMsgMpdu->setMpdu(length1, payload1))
+ && (length1 == mpPhySciMsgMpdu->getPayloadLength())
+ && (0 == memcmp(payload1, mpPhySciMsgMpdu->getPayload(), length1)) );
+
+ unsigned long length2 = 5;
+ unsigned char payload2[length2];
+ memcpy(payload2, "abcde", length2);
+
+ CPPUNIT_ASSERT_MESSAGE ( "setMpdu failed",
+ (mpPhySciMsgMpdu->setMpdu(length2, payload2))
+ && (length2 == mpPhySciMsgMpdu->getPayloadLength())
+ && (0 == memcmp(payload2, mpPhySciMsgMpdu->getPayload(), length2)) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message MPDU pointer is NULL");
+ }
+}
+
+
+void PhySciMsgMpduTest::setNbOfMsgsTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgMpdu)
+ {
+ const unsigned short int n = 8;
+ CPPUNIT_ASSERT_MESSAGE ( "setNbOfMsgs failed",
+ (mpPhySciMsgMpdu->setNbOfMsgs(n))
+ && (n == mpPhySciMsgMpdu->getNbOfMsgs()) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message MPDU pointer is NULL");
+ }
+}
+
+
+void PhySciMsgMpduTest::setNbOfPbsInLastMsgTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgMpdu)
+ {
+ const unsigned short int n = PHY_PB_MAX_NB;
+ CPPUNIT_ASSERT_MESSAGE ( "setNbOfPbsInLastMsg failed",
+ (mpPhySciMsgMpdu->setNbOfPbsInLastMsg(n))
+ && (n == mpPhySciMsgMpdu->getNbOfPbsInLastMsg()) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message MPDU pointer is NULL");
+ }
+}
+
+
+void PhySciMsgMpduTest::setPbsHeadersTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgMpdu)
+ {
+ const unsigned short int n = 31;
+ const uint32_t pbHeader = 0x02000000;
+ uint32_t expectedPbHeader[PHY_PB_MAX_NB];
+ memset(expectedPbHeader, '\0', PHY_PB_MAX_NB * sizeof(uint32_t));
+ expectedPbHeader[n] = pbHeader;
+ CPPUNIT_ASSERT_MESSAGE ( "setPbsHeaders failed",
+ mpPhySciMsgMpdu->setPbsHeaders(n, pbHeader) );
+ CPPUNIT_ASSERT_MESSAGE ( "getPbsHeaders failed",
+ (0 == memcmp(expectedPbHeader, mpPhySciMsgMpdu->getPbsHeaders(0), PHY_PB_MAX_NB * sizeof(uint32_t))) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message MPDU pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/phy/src/PhySciMsgNoise.cpp b/cesar/maximus/phy/src/PhySciMsgNoise.cpp
new file mode 100644
index 0000000000..eb57ccb2a1
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgNoise.cpp
@@ -0,0 +1,86 @@
+
+#include "PhySciMsgNoise.h"
+#include "IPhy.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+// for 'getpid()'
+#include <sys/types.h>
+#include <unistd.h>
+
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+PhySciMsgNoise::PhySciMsgNoise ( IPhy * p_phy ) : PhySciMsg ( p_phy )
+{
+ logFunction();
+
+ initAttributes ();
+}
+
+
+void PhySciMsgNoise::initAttributes ( )
+{
+ logFunction();
+
+ // Set PHY SCI message type
+ PhySciMsg::setSpecializedSciMsgType(PHY_TYPE_NOISE);
+}
+
+
+PhySciMsgNoise::~PhySciMsgNoise ( )
+{
+ logFunction();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool PhySciMsgNoise::prepare ( )
+{
+ logFunction();
+
+ // Set flags
+ return PhySciMsg::setFlags(PHY_FLAG_CRC_OK);
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/phy/src/PhySciMsgNoiseTest.cpp b/cesar/maximus/phy/src/PhySciMsgNoiseTest.cpp
new file mode 100644
index 0000000000..521e0feef9
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgNoiseTest.cpp
@@ -0,0 +1,64 @@
+
+#include "PhySciMsgNoiseTest.h"
+
+#include "PhySciMsgNoise.h"
+#include "PhyProcessor.h"
+#include "SciServer.h"
+
+#include "Logger.h"
+
+// for 'getpid()'
+#include <sys/types.h>
+#include <unistd.h>
+
+using namespace std;
+
+
+CPPUNIT_TEST_SUITE_REGISTRATION (PhySciMsgNoiseTest);
+
+
+void PhySciMsgNoiseTest::setUp (void)
+{
+ logTest();
+
+ mpSci = new SciServer();
+ mpPhy = new PhyProcessor(mpSci);
+ mpPhySciMsgNoise = new PhySciMsgNoise(mpPhy);
+ CPPUNIT_ASSERT_MESSAGE ( "creation failed",
+ (mpPhy == mpPhySciMsgNoise->getPhyProcessor())
+ && (NULL != mpPhySciMsgNoise)
+ && (PHY_TYPE_NOISE == mpPhySciMsgNoise->getSpecializedSciMsgType()) );
+}
+
+
+void PhySciMsgNoiseTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgNoise)
+ {
+ delete (mpPhySciMsgNoise);
+ mpPhySciMsgNoise = NULL;
+ }
+ if (NULL != mpPhy)
+ {
+ delete (mpPhy);
+ mpPhy = NULL;
+ }
+ if (NULL != mpSci)
+ {
+ delete (mpSci);
+ mpSci = NULL;
+ }
+}
+
+
+void PhySciMsgNoiseTest::prepareTest (void)
+{
+ logTest();
+
+ CPPUNIT_ASSERT_MESSAGE ( "prepare failed",
+ (mpPhySciMsgNoise->prepare())
+ && (PHY_FLAG_CRC_OK == mpPhySciMsgNoise->getFlags()) );
+}
+
diff --git a/cesar/maximus/phy/src/PhySciMsgPre.cpp b/cesar/maximus/phy/src/PhySciMsgPre.cpp
new file mode 100644
index 0000000000..70089340ad
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgPre.cpp
@@ -0,0 +1,124 @@
+/************************************************************************
+ PhySciMsgPre.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/phy/src/PhySciMsgPre.cpp
+**************************************************************************/
+
+#include "PhySciMsgPre.h"
+#include "IPhy.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+// for 'getpid()'
+#include <sys/types.h>
+#include <unistd.h>
+
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+PhySciMsgPre::PhySciMsgPre ( IPhy * p_phy_processor ) : PhySciMsg ( p_phy_processor )
+{
+ logFunction();
+
+ initAttributes ();
+}
+
+
+void PhySciMsgPre::initAttributes ( )
+{
+ logFunction();
+
+ // Set PHY SCI message type
+ PhySciMsg::setSpecializedSciMsgType(PHY_TYPE_PREAMBLE);
+}
+
+
+PhySciMsgPre::~PhySciMsgPre ( )
+{
+ logFunction();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool PhySciMsgPre::prepare ( Network_Clock_Id clock_id )
+{
+ logFunction();
+ bool bPrepare = false;
+
+ /* For a PHY message of type PREAMBLE,
+ * PHY SCI message data are empty. */
+
+ // Set TX ID
+ bPrepare = PhySciMsg::setTxId(PhySciMsg::getPhyProcessor()->getTxId());
+
+ // Set station ID to Maximus PID
+ bPrepare &= SciMsg::setSciMsgStationId(getpid());
+
+ return bPrepare;
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/phy/src/PhySciMsgPreTest.cpp b/cesar/maximus/phy/src/PhySciMsgPreTest.cpp
new file mode 100644
index 0000000000..9c3fff554d
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgPreTest.cpp
@@ -0,0 +1,72 @@
+
+#include "PhySciMsgPreTest.h"
+
+#include "PhySciMsgPre.h"
+#include "PhyProcessor.h"
+#include "SciServer.h"
+
+#include "Logger.h"
+
+// for 'getpid()'
+#include <sys/types.h>
+#include <unistd.h>
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (PhySciMsgPreTest);
+
+
+void PhySciMsgPreTest::setUp (void)
+{
+ logTest();
+
+ mpSci = new SciServer();
+ mpPhy = new PhyProcessor(mpSci);
+ mpPhySciMsgPre = new PhySciMsgPre(mpPhy);
+ CPPUNIT_ASSERT_MESSAGE ( "creation failed",
+ (mpPhy == mpPhySciMsgPre->getPhyProcessor())
+ && (NULL != mpPhySciMsgPre)
+ && (PHY_TYPE_PREAMBLE == mpPhySciMsgPre->getSpecializedSciMsgType()) );
+}
+
+
+void PhySciMsgPreTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgPre)
+ {
+ delete (mpPhySciMsgPre);
+ mpPhySciMsgPre = NULL;
+ }
+ if (NULL != mpPhy)
+ {
+ delete (mpPhy);
+ mpPhy = NULL;
+ }
+ if (NULL != mpSci)
+ {
+ delete (mpSci);
+ mpSci = NULL;
+ }
+}
+
+
+void PhySciMsgPreTest::prepareTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsgPre)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "prepare failed",
+ (mpPhySciMsgPre->prepare(0 /* clock_id */ ))
+ && (0 == mpPhySciMsgPre->getTxId())
+ && (getpid() == mpPhySciMsgPre->getSciMsgStationId()) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PHY SCI message PREAMBLE pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/phy/src/PhySciMsgTest.cpp b/cesar/maximus/phy/src/PhySciMsgTest.cpp
new file mode 100644
index 0000000000..2292a06f5b
--- /dev/null
+++ b/cesar/maximus/phy/src/PhySciMsgTest.cpp
@@ -0,0 +1,77 @@
+
+#include "PhySciMsgTest.h"
+
+#include "PhySciMsg.h"
+#include "PhyProcessor.h"
+#include "SciServer.h"
+
+#include "Logger.h"
+#include "Error.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (PhySciMsgTest);
+
+
+void PhySciMsgTest::setUp (void)
+{
+ logTest();
+
+ mpSciServer = new SciServer();
+ mpPhyProcessor = new PhyProcessor (mpSciServer);
+ mpPhySciMsg = new PhySciMsg (mpPhyProcessor);
+}
+
+
+void PhySciMsgTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsg)
+ {
+ delete (mpPhySciMsg);
+ mpPhySciMsg = NULL;
+ }
+ if (NULL != mpPhyProcessor)
+ {
+ delete (mpPhyProcessor);
+ mpPhyProcessor = NULL;
+ }
+ if (NULL != mpSciServer)
+ {
+ delete (mpSciServer);
+ mpSciServer = NULL;
+ }
+}
+
+
+void PhySciMsgTest::dispatchMsgTest (void)
+{
+ logTest();
+
+ if (NULL != mpPhySciMsg)
+ {
+ int type = PHY_TYPE_TONEMASK;
+ unsigned int carrierNb = (PHY_CARRIER_NB+7)/8;
+ unsigned char tonemask[sizeof(unsigned int) + carrierNb];
+ memcpy(tonemask, &carrierNb, sizeof(unsigned int));
+ memset(tonemask + sizeof(unsigned int), 'T', carrierNb);
+ mpPhySciMsg->setSpecializedSciMsgDataLength(sizeof(unsigned int) + (PHY_CARRIER_NB+7)/8);
+ mpPhySciMsg->setSpecializedSciMsgData(tonemask);
+ CPPUNIT_ASSERT_MESSAGE("setSpecializedSciMsgType failed", mpPhySciMsg->setSpecializedSciMsgType((Phy_Type)type));
+ CPPUNIT_ASSERT_MESSAGE("dispatchMsg failed", mpPhySciMsg->dispatchMsg());
+
+ type = PHY_TYPE_RX;
+ Sci_Msg_Station_Id txStationId = 123;
+ mpPhySciMsg->setSpecializedSciMsgDataLength(sizeof(Sci_Msg_Station_Id));
+ mpPhySciMsg->setSpecializedSciMsgData((unsigned char *)&txStationId);
+ CPPUNIT_ASSERT_MESSAGE("setSpecializedSciMsgType failed", mpPhySciMsg->setSpecializedSciMsgType((Phy_Type)type));
+ CPPUNIT_ASSERT_MESSAGE("dispatchMsg failed", mpPhySciMsg->dispatchMsg());
+ }
+ else
+ {
+ CPPUNIT_FAIL ("PhySciMsg pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/python/Makefile b/cesar/maximus/python/Makefile
new file mode 100644
index 0000000000..d8686216cb
--- /dev/null
+++ b/cesar/maximus/python/Makefile
@@ -0,0 +1,9 @@
+BASE = ../..
+
+HOST_PROGRAMS = interface.so
+
+interface.so_SOURCES = interface_module.cpp
+interface.so_MODULES = lib/python maximus lib
+interface.so_LDLIBS = -fPIC -shared
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/maximus/python/doc/fulminata_maximus_scenario_engine.odt b/cesar/maximus/python/doc/fulminata_maximus_scenario_engine.odt
new file mode 100755
index 0000000000..c1fd556c0b
--- /dev/null
+++ b/cesar/maximus/python/doc/fulminata_maximus_scenario_engine.odt
Binary files differ
diff --git a/cesar/maximus/python/doc/fulminata_maximus_scenario_engine.xmi b/cesar/maximus/python/doc/fulminata_maximus_scenario_engine.xmi
new file mode 100755
index 0000000000..8946d8348f
--- /dev/null
+++ b/cesar/maximus/python/doc/fulminata_maximus_scenario_engine.xmi
@@ -0,0 +1,1386 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<XMI xmlns:UML="http://schema.omg.org/spec/UML/1.3" verified="false" timestamp="2008-02-19T16:33:55" xmi.version="1.2" >
+ <XMI.header>
+ <XMI.documentation>
+ <XMI.exporter>umbrello uml modeller http://uml.sf.net</XMI.exporter>
+ <XMI.exporterVersion>1.5.6</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="interface" isRoot="false" isAbstract="false" name="interface" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="constructor" isRoot="false" isAbstract="false" name="constructor" />
+ <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="struct" isRoot="false" isAbstract="false" name="struct" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="typedef" isRoot="false" isAbstract="false" name="typedef" />
+ <UML:Stereotype isSpecification="false" isLeaf="false" visibility="public" namespace="m1" xmi.id="friend" isRoot="false" isAbstract="false" name="friend" />
+ <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="agtmZAmehdXM" isRoot="false" isAbstract="false" name="int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="JcPKyEye9iP3" isRoot="false" isAbstract="false" name="char" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="txbVRO36HpfQ" isRoot="false" isAbstract="false" name="bool" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ZJ5BrRm819Tz" isRoot="false" isAbstract="false" name="float" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LRcU81Wzx7SM" isRoot="false" isAbstract="false" name="double" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="VVSkI78sPE3E" isRoot="false" isAbstract="false" name="short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="dpMdwnaHDClJ" isRoot="false" isAbstract="false" name="long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="CFI9MjVrEwaX" isRoot="false" isAbstract="false" name="unsigned int" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1iPQuScWFz9B" isRoot="false" isAbstract="false" name="unsigned short" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="mjQxu9G6PXDl" isRoot="false" isAbstract="false" name="unsigned long" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="GgbUcB1crO0m" isRoot="false" isAbstract="false" name="string" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="ARgEDvWDshpX" isRoot="false" isAbstract="false" name="const short int" elementReference="ek5GEEjxefv1" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="mXu6MdkX4QlH" isRoot="false" isAbstract="false" name="const float" elementReference="ZJ5BrRm819Tz" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="psrQPqT9L430" isRoot="false" isAbstract="false" name="const ChannelPoint&amp;" elementReference="VsbjUz1jzxim" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="5ToJ3zPrsGFF" isRoot="false" isAbstract="false" name="ChannelPoint&amp;" elementReference="VsbjUz1jzxim" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="oL4FZe2AHfNk" isRoot="false" isAbstract="false" name="const Network_Clock_Tick" elementReference="OMC8n0NgoyNC" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WndGhsLWd8YJ" isRoot="false" isAbstract="false" name="uint32_t*" elementReference="7rs81OTZw4E7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="8gZ2im9FZlVF" isRoot="false" isAbstract="false" name="PhySciMsgNoise&amp;" elementReference="nNLPS46tYU5B" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="hfBiNMiT2GVk" isRoot="false" isAbstract="false" name="const uint32_t*" elementReference="7rs81OTZw4E7" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="kj4rGrwwW6er" isRoot="false" isAbstract="false" name="const PhySciMsgMpdu&amp;" elementReference="r6SeLQ0E8ets" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="WzilSttBcw0q" isRoot="false" isAbstract="false" name="const Sci_Msg_Station_Id" elementReference="iF6aeCsJls2b" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="1XretJvqfug3" isRoot="false" isAbstract="false" name="const unsigned int" elementReference="CFI9MjVrEwaX" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="HSbuMHwp53nG" isRoot="false" isAbstract="false" name="const uint8_t*" elementReference="eNNzwM7vtyZm" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="PfzwSs1KcVMd" isRoot="false" isAbstract="false" name="const Channel_Settings_Key&amp;" elementReference="aXMfZ9tQ8GTx" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="PVMPlwqpaaYi" isRoot="false" isAbstract="false" name="std::map&lt; const Channel_Settings_Key, ChannelSettings *, ltkey >" elementReference="qYY4ISujM3Ed" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="tq6FaofPTzwd" isRoot="false" isAbstract="false" name="StationsList*" elementReference="0IENWuVgMRRQ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="3YkVVg8j3o2Y" isRoot="false" isAbstract="false" name="IPhy*" elementReference="5VCzTkjjCKbZ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="rxKsjMRYfTiU" isRoot="false" isAbstract="false" name="ISystem*" elementReference="P5iAKaTM6Drb" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="X118ilRkx2cY" isRoot="false" isAbstract="false" name="const unsigned short int" elementReference="SRA7JvZo6AuO" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="zypnSFDYKlG8" isRoot="false" isAbstract="false" name="const Channel_Mod" elementReference="kbTW3DFGwneP" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="fLpWgryb0030" isRoot="false" isAbstract="false" name="const unsigned char*" elementReference="eniEjhTPROwl" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="b4ob1ibWBqLq" isRoot="false" isAbstract="false" name="PhySciMsgMpdu&amp;" elementReference="r6SeLQ0E8ets" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="NBTpmTxZCmcb" isRoot="false" isAbstract="false" name="const bool" elementReference="txbVRO36HpfQ" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="LlOVV04Zpapx" isRoot="false" isAbstract="false" name="std::vector&lt; ChannelSettings * >&amp;" elementReference="AlwnfvQ24tqq" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="su73E4iG7Y8j" isRoot="false" isAbstract="false" name="const unsigned long" elementReference="mjQxu9G6PXDl" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="41M2qczWxT6z" isRoot="false" isAbstract="false" name="uint8_t*" elementReference="eNNzwM7vtyZm" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="m2IzC9ii2UsR" isRoot="false" isAbstract="false" name="const double" elementReference="LRcU81Wzx7SM" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="448sjDF59poj" isRoot="false" isAbstract="false" name="const ChannelPoint" elementReference="VsbjUz1jzxim" />
+ <UML:DataType stereotype="datatype" isSpecification="false" isLeaf="false" visibility="public" namespace="Datatypes" xmi.id="BVdJY7XV1Crz" isRoot="false" isAbstract="false" name="unsigned int&amp;" elementReference="CFI9MjVrEwaX" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ka695HsLyRqa" isRoot="false" isAbstract="false" name="Maximus simulator" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="rGkvr2wbb0ig" isRoot="false" isAbstract="false" name="station_id=1" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ACuye0MTG4P7" isRoot="false" isAbstract="false" name="station_id=2" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="t1tc2bTZdTo7" isRoot="false" isAbstract="false" name="SCI server" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="EPI1UgANf3xg" isRoot="false" isAbstract="false" name="PHY processor" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="xbRaG9lhs3GA" isRoot="false" isAbstract="false" name="SCI msg" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="y0Zndhh8NjGq" isRoot="false" isAbstract="false" name="PHY SCI msg" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ouQgLFbCZBH6" isRoot="false" isAbstract="false" name="USER" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="R2g1PPyRrFdJ" isRoot="false" isAbstract="false" name="bool [PHY_CARRIER_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="pKHo6OTH6XRU" isRoot="false" isAbstract="false" name="stationsList" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="MjbCnbmzupQK" isRoot="false" isAbstract="false" name="bool [PHY_CARRIER_MAX_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="iF6aeCsJls2b" isRoot="false" isAbstract="false" name="Sci_Msg_Station_Id" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="IVIVFrTsSA9W" isRoot="false" isAbstract="false" name="unsigned char [PHY_CARRIER_MAX_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="OTUqbbMS8cB5" isRoot="false" isAbstract="false" name="float [PHY_CARRIER_MAX_NB][interval_nb]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="Y2z0vH5PWhVj" isRoot="false" isAbstract="false" name="unsigned char [TONEMAP_INDEX_NB][PHY_CARRIER_MAX_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="NNrPbFIBbTWJ" isRoot="false" isAbstract="false" name="float [interval_nb][PHY_CARRIER_MAX_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="OMC8n0NgoyNC" isRoot="false" isAbstract="false" name="Network_Clock_Tick" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="QCc0kys9xMnl" isRoot="false" isAbstract="false" name="const float[interval_nb][PHY_CARRIER_MAX_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="pnRk9DVlgulU" isRoot="false" isAbstract="false" name="const unsigned char [PHY_CARRIER_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0ZbYQWqDJFyR" isRoot="false" isAbstract="false" name="const unsigned char [PHY_CARRIER_MAX_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="SRA7JvZo6AuO" isRoot="false" isAbstract="false" name="unsigned short int" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="71EBB6ZerqDE" isRoot="false" isAbstract="false" name="Phy_Tonemap_Index" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ryY5K4jdy734" isRoot="false" isAbstract="false" name="unsigned char *" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="5hM3oO8IvMZa" isRoot="false" isAbstract="false" name="Phy_Header &amp;" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="yBbPCZ8HGSK2" isRoot="false" isAbstract="false" name="uint8_t [PHY_SYMBOL_MAX_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="TwO4O4jLDIiP" isRoot="false" isAbstract="false" name="uint16_t [PHY_CARRIER_MAX_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="p0EIenqzKrdV" isRoot="false" isAbstract="false" name="Point" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="ihYvkGnalcj8" type="agtmZAmehdXM" name="I" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="DcQ21IYgvf4A" type="agtmZAmehdXM" name="Q" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="0PpuG29IN9r4" type="CFI9MjVrEwaX" name="C" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="lRK3GxXGwC31" isRoot="false" isAbstract="false" isQuery="false" name="code" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mXxquaFcgKTK" value="" type="eniEjhTPROwl" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="tGjpAvxFMVQv" isRoot="false" isAbstract="false" isQuery="false" name="decode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="fsUnMzU0oJzm" value="" type="eniEjhTPROwl" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="2UAE6pa80TlD" isRoot="false" isAbstract="false" isQuery="false" name="setC" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="08ssluxBHCfG" value="" type="CFI9MjVrEwaX" name="N" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VGvoUjjCRsDk" value="" type="ryY5K4jdy734" name="mpdu_payload" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OgKLO7M3nXAL" value="" type="agtmZAmehdXM" name="mpdu_index" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="iRfrv7uIeAaZ" isRoot="false" isAbstract="false" isQuery="false" name="setIQ" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VAMLmupGxElF" value="" type="agtmZAmehdXM" name="I" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uCytgOJgVmGl" value="" type="agtmZAmehdXM" name="Q" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="eniEjhTPROwl" isRoot="false" isAbstract="false" name="unsigned char" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="zwpATNw5hYwj" isRoot="false" isAbstract="false" name="PhyProcessor" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="J5I5GN6BUVNH" isRoot="false" isAbstract="false" name="PhySciMsg &amp;" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="CvLZ2CQ63P41" isRoot="false" isAbstract="false" name="station_id=3" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="IW1PTWwAuJXf" isRoot="false" isAbstract="false" name="unsigned int [MAXIMUS_PHY_MOD_NB]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="ek5GEEjxefv1" isRoot="false" isAbstract="false" name="short int" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="7rs81OTZw4E7" isRoot="false" isAbstract="false" name="uint32_t" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="eNNzwM7vtyZm" isRoot="false" isAbstract="false" name="uint8_t" />
+ <UML:Package isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="6elj96McODtx" isRoot="false" isAbstract="false" name="std" >
+ <UML:Namespace.ownedElement>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="6elj96McODtx" xmi.id="qYY4ISujM3Ed" isRoot="false" isAbstract="false" name="map" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="6elj96McODtx" xmi.id="AlwnfvQ24tqq" isRoot="false" isAbstract="false" name="vector" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Generalization isSpecification="false" child="FA5tCgQO5jOX" visibility="public" namespace="Logical View" xmi.id="guI259xtgWxy" parent="MJNkMwYhFv8H" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="0IENWuVgMRRQ" isRoot="false" isAbstract="false" name="StationsList" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="P5iAKaTM6Drb" isRoot="false" isAbstract="false" name="ISystem" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="kbTW3DFGwneP" isRoot="false" isAbstract="false" name="Channel_Mod" />
+ <UML:Generalization isSpecification="false" child="FA5tCgQO5jOX" visibility="public" namespace="Logical View" xmi.id="sOkJkhMy5511" parent="MJNkMwYhFv8H" discriminator="" name="" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="MMOOLBCfmrGJ" isRoot="false" isAbstract="false" name="uint8_t [(PHY_CARRIER_MAX_NB+1)/2]" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="5VCzTkjjCKbZ" isRoot="false" isAbstract="false" name="IPhy" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="nNLPS46tYU5B" isRoot="false" isAbstract="false" name="PhySciMsgNoise" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="r6SeLQ0E8ets" isRoot="false" isAbstract="false" name="PhySciMsgMpdu" />
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="aXMfZ9tQ8GTx" isRoot="false" isAbstract="false" name="Channel_Settings_Key" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="FsOabmphHzei" type="iF6aeCsJls2b" name="tx_station_id" />
+ <UML:Attribute isSpecification="false" visibility="public" xmi.id="jNPug1TGWnt5" type="iF6aeCsJls2b" name="rx_station_id" />
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="umW20xxGpJoP" isRoot="false" isAbstract="false" name="ltkey" >
+ <UML:Classifier.feature>
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="3d6Ick1K5QEl" isRoot="false" isAbstract="false" isQuery="false" name="operator ( )" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="wEoKDxqvdkhA" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TIrIZffdGlvq" value="" type="PfzwSs1KcVMd" name="key1" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TuAXJMGi1GcR" value="" type="PfzwSs1KcVMd" name="key2" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="zSo720DHUtK4" isRoot="false" isAbstract="false" name="ChannelSettingsList" />
+ <UML:Class comment="class ChannelComputer" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="FA5tCgQO5jOX" isRoot="false" isAbstract="false" name="ChannelComputer" >
+ <UML:GeneralizableElement.generalization>
+ <UML:Generalization xmi.idref="guI259xtgWxy" />
+ <UML:Generalization xmi.idref="sOkJkhMy5511" />
+ <UML:Generalization xmi.idref="KY1cn4F7HHaL" />
+ </UML:GeneralizableElement.generalization>
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="vLNKsMwHnQ5O" type="zSo720DHUtK4" name="mListOfChannelSettings" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="uHZmB3x8YrWn" type="SRA7JvZo6AuO" name="mNumberOfCopiesArray" ownerScope="classifier" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="EPgLV4JWKVtq" type="tq6FaofPTzwd" name="mpListOfStations" />
+ <UML:Attribute comment="// private attributes//// for random" isSpecification="false" visibility="private" xmi.id="iNWc4oZxCl7B" type="IWPuXt3VypIz" name="mEngine" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="GQR4rnp7JCzr" type="ZJ5BrRm819Tz" name="mPowerScaleArray" ownerScope="classifier" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="GewSP3dgS2iJ" type="41M2qczWxT6z" name="mpTonemask" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="pXR9jOynPIoD" type="CFI9MjVrEwaX" name="mBeaconPeriod" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="PNXlmw9fnFuL" isRoot="false" isAbstract="false" isQuery="false" name="ChannelComputer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rL49qwyEJTx3" value="" type="3YkVVg8j3o2Y" name="p_phy" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Neig7djUiPf1" value="" type="rxKsjMRYfTiU" name="p_system" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="y8L4KAg9702o" isRoot="false" isAbstract="false" isQuery="false" name="~ ChannelComputer" />
+ <UML:Operation comment="// public methods// /**
+Compute PB measurement and NOISE.
+@param pb_measurement_array the PB measurement to fill in (for all PBs composing the MPDU)
+@param noise the PHY SCI message NOISE to fill in
+@param pb_header_array the PB header of each PB composing the MPDU
+@param mpdu a PHY SCI message MPDU that contains the complete received MPDU payload
+@param tx_station_id the ID of the transmitting station
+@param rx_station_id the ID of the destination station
+@param current_tick the current Network Clock tick
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="LRN0s3UGfAwm" isRoot="false" isAbstract="false" isQuery="false" name="addPerturbation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zd95SlqOdqdd" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="meGU1tTz0m2I" value="" type="WndGhsLWd8YJ" name="pb_measurement_array" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="wiR3gRq1sB2l" value="" type="8gZ2im9FZlVF" name="noise" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="EU1tfvdRXrtX" value="" type="hfBiNMiT2GVk" name="pb_header_array" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="lLWj7Y14EQ5v" value="" type="kj4rGrwwW6er" name="mpdu" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="svwi6wRIRQ94" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MmVreMONht4n" value="" type="WzilSttBcw0q" name="rx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="P5reTuXLoR2s" value="" type="oL4FZe2AHfNk" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add Channel Settings to the list.
+Called when a station is created => create its associated Channel Settings.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="MTBnuIpE5I5h" isRoot="false" isAbstract="false" isQuery="false" name="addChannelSettings" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zR12RM2LZqgm" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eS2KL67i9wMc" value="" type="WzilSttBcw0q" name="created_station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when the PHY processor receives a preamble.
+@param current_tick the current Network Clock tick
+@param tx_station_id the ID of the transmitting station
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qrweJyXfPgQH" isRoot="false" isAbstract="false" isQuery="false" name="receivePre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="nUhRCPZC2hFS" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="yDV1VZg7ziRI" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mY0vULWJCSxT" value="" type="oL4FZe2AHfNk" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when the PHY processor receives a frame control.
+@param current_tick the current Network Clock tick
+@param tx_station_id the ID of the transmitting station
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="OS6l8U35hW6C" isRoot="false" isAbstract="false" isQuery="false" name="receiveFc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="S5r4uSfttewJ" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3nK2TjIGGJ9i" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ef1o7xGTPMFW" value="" type="oL4FZe2AHfNk" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the Channel Computer class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="jRbAQQ47XE3x" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="Update the list of Channel Settings.
+Called when channel perturbation has to be added.
+Check if stations have been removed => remove their associated Channel Settings." isSpecification="false" isLeaf="false" visibility="private" xmi.id="qQZrSJeClEK9" isRoot="false" isAbstract="false" isQuery="false" name="updateListOfChannelSettings" />
+ <UML:Operation comment="// public methods// /**
+Duplicate the MPDU payload.
+@param mpdu a PHY SCI message MPDU that contains the complete received MPDU payload
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="OZe7W5VrVgaA" isRoot="false" isAbstract="false" isQuery="false" name="duplicateMpduPayload" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="1weamIKXm0wx" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eXkNB8JdLiXJ" value="" type="b4ob1ibWBqLq" name="mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Find Channel Settings.
+@param tx_station_id the ID of the transmitting station
+@param rx_station_id the ID of the destination station
+@return a list of Channel Settings" isSpecification="false" isLeaf="false" visibility="public" xmi.id="09RFjqmd0dax" isRoot="false" isAbstract="false" isQuery="false" name="findChannelSettings" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PU9PBOsdRjfL" type="LlOVV04Zpapx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="T1b73JO0VdWP" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MN7FXFtWPJl8" value="" type="WzilSttBcw0q" name="rx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="7Vk78K2bMeiN" value="" type="NBTpmTxZCmcb" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Sets the tonemask.
+@param p_tonemask the new value of mpTonemask
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="fYXdFW0u7v45" isRoot="false" isAbstract="false" isQuery="false" name="setTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="9KF3z9Ky5yWr" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="TmjfeN9KMrw5" value="" type="HSbuMHwp53nG" name="p_tonemask" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemap of the current transmission.
+@return bool
+@param tx_station_id the ID of the transmitting station
+@param length the tonemap length in octets
+@param p_tonemap the tonemap" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BALxxO2awYCA" isRoot="false" isAbstract="false" isQuery="false" name="setTonemap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="FqMzqJwDn3by" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2C4956EYqxBS" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ILncAjhMt1Hp" value="" type="su73E4iG7Y8j" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="PJPKpbUslW1r" value="" type="fLpWgryb0030" name="p_tonemap" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the beacon period in ticks 25 MHz.
+@return bool
+@param frequency the power-line frequency" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dGNRBZuSsh40" isRoot="false" isAbstract="false" isQuery="false" name="setBeaconPeriod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="RTZrAFCJXPKU" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OkMGld58vSSk" value="" type="mXu6MdkX4QlH" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets a tonemask value.
+@param carrier_index
+@return a boolean value indicating if the requested carrier is enabled or not" isSpecification="false" isLeaf="false" visibility="private" xmi.id="XLTP0YPPGkf1" isRoot="false" isAbstract="false" isQuery="false" name="getTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="YeSdbwSqlppZ" type="NBTpmTxZCmcb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Li9EAazAUZwt" value="" type="X118ilRkx2cY" name="carrier_index" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the beacon period in ticks 25 MHz.
+@return mBeaconPeriod" isSpecification="false" isLeaf="false" visibility="private" xmi.id="2s4IahHvPPAX" isRoot="false" isAbstract="false" isQuery="false" name="getBeaconPeriod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6mnrpOpFpM6x" type="1XretJvqfug3" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// protected methods// All following protected methods could be declared as private methods,// but they are declared as protected methods to be unitarly tested.///**
+Gets the sigma factor.
+@param modulation the tonemap modulation
+@param snr_in_db the SNR value in dB
+@return the sigma factor" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="z7iRgeJqCCrj" isRoot="false" isAbstract="false" isQuery="false" name="getSigma" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="bGG7gbbED2qo" type="m2IzC9ii2UsR" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="VuoAPHpR7tih" value="" type="zypnSFDYKlG8" name="modulation" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="YzaxOiULnAlS" value="" type="mXu6MdkX4QlH" name="snr_in_db" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the PowerScale.
+@param modulation the tonemap modulation
+@return 1 / (PowerScale^2)" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="jfqqWYV4W41s" isRoot="false" isAbstract="false" isQuery="false" name="getPowerScale" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="yGeh3UH7E2y1" type="mXu6MdkX4QlH" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="mTCaex2QzINB" value="" type="zypnSFDYKlG8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the linear SNR.
+@param snr_in_db the SNR value in dB
+@return the linear SNR value" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="P3rRYhqHMh6s" isRoot="false" isAbstract="false" isQuery="false" name="getLinearSnr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="OnED8IAhZOoD" type="m2IzC9ii2UsR" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="DbwjfvcQPoy1" value="" type="mXu6MdkX4QlH" name="snr_in_db" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add noise.
+@param point the original point coordinates
+@param sigma the sigma factor
+@return the noise point coordinates" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="jyRgGnpfqf5M" isRoot="false" isAbstract="false" isQuery="false" name="addNoise" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="xOPBQDzMUe4V" type="448sjDF59poj" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MvcjciboHWXv" value="" type="psrQPqT9L430" name="point" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="R7LqtHpaFHGV" value="" type="m2IzC9ii2UsR" name="sigma" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the BER.
+@param codeA / codeB the 2 codes to compare
+@return the BER" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="XOXms3hJA084" isRoot="false" isAbstract="false" isQuery="false" name="computeBer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="6LdINbJlNWwV" type="X118ilRkx2cY" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="HxcWCtzEv87e" value="" type="X118ilRkx2cY" name="codeA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="LKjS9WAeshOk" value="" type="X118ilRkx2cY" name="codeB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the noise.
+@param pointA / pointB the 2 points coordinates
+@return the (distance)^2 between the 2 points" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="k41t27vK3XoF" isRoot="false" isAbstract="false" isQuery="false" name="computeNoise" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="o6CNS1YQPybn" type="1XretJvqfug3" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OmSJsXxBrfey" value="" type="psrQPqT9L430" name="pointA" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9oazTyhE0i53" value="" type="psrQPqT9L430" name="pointB" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the FER.
+@param ber the BER of the current PB
+@param n the average number of bits coded per carrier on the current PB
+@param modulation the tonemap modulation
+@return the FER" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="o0LrX74wtWDl" isRoot="false" isAbstract="false" isQuery="false" name="computeFer" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Ba9dCD9GWmYt" type="mXu6MdkX4QlH" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="39xsoZovNOuo" value="" type="X118ilRkx2cY" name="ber" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Lb2LH5O55hub" value="" type="1XretJvqfug3" name="n" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="pzViTiSVrNNd" value="" type="zypnSFDYKlG8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Compute the CRC error.
+@param fer the FER of the current PB
+@return the CRC error" isSpecification="false" isLeaf="false" visibility="protected" xmi.id="wAYHYS5t16DH" isRoot="false" isAbstract="false" isQuery="false" name="computeCrcError" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="NqckMYF8cQU3" type="NBTpmTxZCmcb" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="BZMFHFq6ELmf" value="" type="mXu6MdkX4QlH" name="fer" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="class IChannel" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="MJNkMwYhFv8H" isRoot="false" isAbstract="false" name="IChannel" >
+ <UML:Classifier.feature>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="11oV4ziv3AYN" isRoot="false" isAbstract="false" isQuery="false" name="IChannel" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="YYbhCSZWluH5" isRoot="false" isAbstract="false" isQuery="false" name="~ IChannel" />
+ <UML:Operation comment="// public methods// /**
+Compute PB measurement and NOISE.
+@param pb_measurement_array the PB measurement to fill in
+@param noise the PHY SCI message NOISE to fill in
+@param pb_header_array the PB header of each PB composing the MPDU
+@param mpdu a PHY SCI message MPDU that contains the complete received MPDU payload
+@param tx_station_id the ID of the transmitting station
+@param rx_station_id the ID of the destination station
+@param current_tick the current Network Clock tick
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qnn4itLhu9Bz" isRoot="false" isAbstract="true" isQuery="false" name="addPerturbation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="R2Toy4bAcinn" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1t1u1Cr63jC2" value="" type="WndGhsLWd8YJ" name="pb_measurement_array" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bojFxHYw8Xo7" value="" type="8gZ2im9FZlVF" name="noise" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="2dxZMQmxFVCA" value="" type="hfBiNMiT2GVk" name="pb_header_array" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="SNKUdoCdP8Cl" value="" type="kj4rGrwwW6er" name="mpdu" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nwmJ2RBUmTwN" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="F70eDCPj96Tc" value="" type="WzilSttBcw0q" name="rx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zMlZIlP3fCNi" value="" type="oL4FZe2AHfNk" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Add Channel Settings to the list.
+Called when a station is created => create its associated Channel Settings.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="bWALx5iDCipN" isRoot="false" isAbstract="true" isQuery="false" name="addChannelSettings" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="wu3SgaK4Oumi" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uF62LZeIuPrA" value="" type="WzilSttBcw0q" name="created_station_id" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when the PHY processor receives a preamble.
+@param tx_station_id the ID of the transmitting station
+@param current_tick the current Network Clock tick
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="AGEpQZVz3eK0" isRoot="false" isAbstract="true" isQuery="false" name="receivePre" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="R0q1QK4pLXdJ" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="j0Bti1GbEMdX" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="uFpmceuks6XJ" value="" type="oL4FZe2AHfNk" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Called when the PHY processor receives a frame control.
+@param tx_station_id the ID of the transmitting station
+@param current_tick the current Network Clock tick
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="d3GgfZfOZoHG" isRoot="false" isAbstract="true" isQuery="false" name="receiveFc" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="ZCTAuFxo9yFo" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="pVp1pSYhfLTH" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zM1sQY94ZPiE" value="" type="oL4FZe2AHfNk" name="current_tick" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// /**
+Duplicate the MPDU payload.
+@param mpdu a PHY SCI message MPDU that contains the complete received MPDU payload
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="PujNU9MyUc3R" isRoot="false" isAbstract="true" isQuery="false" name="duplicateMpduPayload" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="WXquRccqaRs0" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="xX2WY1uSiHwr" value="" type="b4ob1ibWBqLq" name="mpdu" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Find Channel Settings.
+@param tx_station_id the ID of the transmitting station
+@param rx_station_id the ID of the destination station
+@return a list of Channel Settings" isSpecification="false" isLeaf="false" visibility="public" xmi.id="hYiS0RDqSc09" isRoot="false" isAbstract="true" isQuery="false" name="findChannelSettings" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="jwn4SQO1apBT" type="LlOVV04Zpapx" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="nlp4OJFwDJNs" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0gvOr8GYew0f" value="" type="WzilSttBcw0q" name="rx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3rVG8q99X2VO" value="" type="NBTpmTxZCmcb" name="both_directions" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemask.
+@param p_tonemask the new value of mpTonemask
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qCYOB46xZJIN" isRoot="false" isAbstract="true" isQuery="false" name="setTonemask" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="26HA5Uyb1mUR" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="ThYihpYABMxg" value="" type="HSbuMHwp53nG" name="p_tonemask" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemap of the current transmission.
+@return bool
+@param tx_station_id the ID of the transmitting station
+@param length the tonemap length in octets
+@param p_tonemap the tonemap" isSpecification="false" isLeaf="false" visibility="public" xmi.id="34qsc33QFZoO" isRoot="false" isAbstract="true" isQuery="false" name="setTonemap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="M4HxV9vF4jHW" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="evLBEcYfH4Oz" value="" type="WzilSttBcw0q" name="tx_station_id" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="bA9ohvCLoWU0" value="" type="su73E4iG7Y8j" name="length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="83gP52MxwT18" value="" type="fLpWgryb0030" name="p_tonemap" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the beacon period in ticks 25 MHz.
+@return bool
+@param frequency the power-line frequency" isSpecification="false" isLeaf="false" visibility="public" xmi.id="WhMdFTMpdTdI" isRoot="false" isAbstract="true" isQuery="false" name="setBeaconPeriod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="7dXiTh9TnQdq" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MoeBK8BS9rpF" value="" type="mXu6MdkX4QlH" name="frequency" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the beacon period in ticks 25 MHz.
+@return mBeaconPeriod" isSpecification="false" isLeaf="false" visibility="public" xmi.id="tCCndBu9sGk6" isRoot="false" isAbstract="true" isQuery="false" name="getBeaconPeriod" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="tZQuLuLiybdS" type="1XretJvqfug3" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Generalization isSpecification="false" child="FA5tCgQO5jOX" visibility="public" namespace="Logical View" xmi.id="KY1cn4F7HHaL" parent="MJNkMwYhFv8H" discriminator="" name="" />
+ <UML:Package isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="uPECzXJFnTOn" isRoot="false" isAbstract="false" name="boost" >
+ <UML:Namespace.ownedElement>
+ <UML:Class isSpecification="false" isLeaf="false" visibility="public" namespace="uPECzXJFnTOn" xmi.id="IWPuXt3VypIz" isRoot="false" isAbstract="false" name="mt19937" />
+ </UML:Namespace.ownedElement>
+ </UML:Package>
+ <UML:Class comment="ChannelPoint.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelPoint.h
+//**
+class ChannelPoint" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="VsbjUz1jzxim" isRoot="false" isAbstract="false" name="ChannelPoint" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// public attributes// // abscissa" isSpecification="false" visibility="public" xmi.id="hRU6f1aVcHyc" type="ZJ5BrRm819Tz" name="I" />
+ <UML:Attribute comment="// ordinate" isSpecification="false" visibility="public" xmi.id="IhZENLi13oFI" type="ZJ5BrRm819Tz" name="Q" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="0zDce8bMX5QB" isRoot="false" isAbstract="false" isQuery="false" name="ChannelPoint" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kVbwfpKRKEVh" isRoot="false" isAbstract="false" isQuery="false" name="~ ChannelPoint" />
+ <UML:Operation comment="// public methods// /**
+Operator =
+@param channel_point
+@return ChannelPoint &amp;" isSpecification="false" isLeaf="false" visibility="public" xmi.id="rGEtgzA0EaD8" isRoot="false" isAbstract="false" isQuery="false" name="operator =" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="kYfoHwINao51" type="5ToJ3zPrsGFF" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tNQDbtuR98Ko" value="" type="psrQPqT9L430" name="channel_point" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Operator ==
+@param channel_point
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="5iOQmRPfmnrL" isRoot="false" isAbstract="false" isQuery="false" name="operator ==" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VCUGc67TdVOx" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="glmqs7cxaQFb" value="" type="psrQPqT9L430" name="channel_point" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Checks Channel Point values ranges,
+i.e. checks I and Q coordinates validity.
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="OeSEtgTyOpM9" isRoot="false" isAbstract="false" isQuery="false" name="checkValidity" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="PhdLIGl1oQp4" type="txbVRO36HpfQ" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Vo4VsHm3o6I5" isRoot="false" isAbstract="false" isQuery="false" name="ChannelPoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="L6BXRyDTALMi" value="" type="ZJ5BrRm819Tz" name="i" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="pqBVtugPikua" value="" type="mXu6MdkX4QlH" name="q" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="ChannelMapping.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelMapping.h
+//**
+class ChannelMapping" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="HjupUSYowhI4" isRoot="false" isAbstract="false" name="ChannelMapping" >
+ <UML:Classifier.feature>
+ <UML:Attribute comment="// private attributes//" isSpecification="false" visibility="private" xmi.id="ZSwkq19bojv2" type="VsbjUz1jzxim" name="mPoint" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="Ge7RT8Ckq5ZI" type="SRA7JvZo6AuO" name="mCode" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="V57RkPTHrQ2f" type="SRA7JvZo6AuO" name="mNbOfBitsArray" ownerScope="classifier" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="P9GDsAF7oLYH" type="ek5GEEjxefv1" name="mMappingArray" ownerScope="classifier" />
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="4DctbcZ0lnEe" isRoot="false" isAbstract="false" isQuery="false" name="ChannelMapping" />
+ <UML:Operation stereotype="constructor" comment="Constructors" isSpecification="false" isLeaf="false" visibility="public" xmi.id="xRjlmH0Ez1Tl" isRoot="false" isAbstract="false" isQuery="false" name="ChannelMapping" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="e9XQwl2sCldx" value="" type="X118ilRkx2cY" name="code" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="0eBxdci9ekFK" isRoot="false" isAbstract="false" isQuery="false" name="ChannelMapping" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Th3OhfxLoUji" value="" type="psrQPqT9L430" name="point" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="DjaPUCMSoVQR" isRoot="false" isAbstract="false" isQuery="false" name="~ ChannelMapping" />
+ <UML:Operation comment="// public methods// /**
+Computes the code from the already set I and Q coordinates.
+@param modulation the used modulation
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="66Ykoo2IT5gA" isRoot="false" isAbstract="false" isQuery="false" name="computeCode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="L6RvuUwPgOdG" type="X118ilRkx2cY" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="XIQ0O586ecbi" value="" type="zypnSFDYKlG8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Computes the I and Q coordinates from an already set code.
+@param modulation the used modulation
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="nowhba6bZwOz" isRoot="false" isAbstract="false" isQuery="false" name="computePoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Sik6D63angu6" type="psrQPqT9L430" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="9ZXTLlcs30rP" value="" type="zypnSFDYKlG8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the code.
+@param code the new value of mCode
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="jtReTM98izcO" isRoot="false" isAbstract="false" isQuery="false" name="setCode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uf7g4ukP09Ks" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qbzoZ0nxSxIq" value="" type="X118ilRkx2cY" name="code" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the code.
+@return mCode" isSpecification="false" isLeaf="false" visibility="public" xmi.id="huvhfiqMaF13" isRoot="false" isAbstract="false" isQuery="false" name="getCode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="bEHHatW3bG9p" type="SRA7JvZo6AuO" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the coordinates.
+@param point the new value of mPoint
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="c8CI5oguNdiw" isRoot="false" isAbstract="false" isQuery="false" name="setPoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KAP7qHBixGOz" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="dTt5RCv64oni" value="" type="psrQPqT9L430" name="point" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Channel Point.
+@return mPoint" isSpecification="false" isLeaf="false" visibility="public" xmi.id="Uc44r38RCKjF" isRoot="false" isAbstract="false" isQuery="false" name="getPoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="B7O9Gg2suH7S" type="5ToJ3zPrsGFF" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the I coordinate.
+@return mPoint.I" isSpecification="false" isLeaf="false" visibility="public" xmi.id="I0RSI9iPWrpV" isRoot="false" isAbstract="false" isQuery="false" name="getI" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="AbVmpcZ9mwHa" type="mXu6MdkX4QlH" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the Q coordinate.
+@param q mPoint.Q
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="fD4zThhtEUMY" isRoot="false" isAbstract="false" isQuery="false" name="setQ" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="EQI9hh8soWz2" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="5YMFnEF4FhWX" value="" type="mXu6MdkX4QlH" name="q" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the Q coordinate.
+@return mPoint.Q" isSpecification="false" isLeaf="false" visibility="public" xmi.id="qEuK4jnjvsgO" isRoot="false" isAbstract="false" isQuery="false" name="getQ" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="Azs2F0UPZ09P" type="mXu6MdkX4QlH" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Retrieve the integer (except for QAM8) I and Q coordinates from the already set I and Q coordinates.
+@param modulation the used modulation
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="o3dYjumm81LP" isRoot="false" isAbstract="false" isQuery="false" name="retrievePoint" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="cgYNdnxrEGyv" type="448sjDF59poj" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="8HAG5wPTP3yk" value="" type="zypnSFDYKlG8" name="modulation" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Sets the code.
+@param modulation the used modulation
+@param mpdu_payload_length the length of the MPDU payload
+@param p_mpdu_payload pointer to the MPDU payload
+@param mpdu_index indicates the current index of the MPDU payload (in bits)
+@return bool (and update mpdu_index)" isSpecification="false" isLeaf="false" visibility="public" xmi.id="rCiZ34ts7WOo" isRoot="false" isAbstract="false" isQuery="false" name="setCode" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="v6ljakjkicmx" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="Q9aXAtuGA3WD" value="" type="zypnSFDYKlG8" name="modulation" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="zwhMxd6npmKq" value="" type="su73E4iG7Y8j" name="mpdu_payload_length" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="qDgvh5j5EHcM" value="" type="fLpWgryb0030" name="p_mpdu_payload" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="pvkef4STH9Ow" value="" type="BVdJY7XV1Crz" name="mpdu_index" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the I coordinate.
+@param i the new value of mPoint.I
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="no29iM1Z9CGC" isRoot="false" isAbstract="false" isQuery="false" name="setI" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="aEK9EUYpA5Al" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="KSVqaKu0ZipJ" value="" type="mXu6MdkX4QlH" name="i" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ </UML:Classifier.feature>
+ </UML:Class>
+ <UML:Class comment="ChannelSettings.h - Copyright buret
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the &quot;headings&quot; directory in uml to point to a directory
+where you have your heading files.
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+/usr/share/apps/umbrello/headings/heading.h
+-->Code Generators searches for heading files based on the file extension
+i.e. it will look for a file name ending in &quot;.h&quot; to include in C++ header
+files, and for a file name ending in &quot;.java&quot; to include in all generated
+java code.
+If you name the file &quot;heading.&lt;extension>&quot;, Code Generator will always
+choose this file even if there are other files with the same extension in the
+directory. If you name the file something else, it must be the only one with that
+extension in the directory to guarantee that Code Generator will choose it.
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/channel/inc/ChannelSettings.h
+//**
+class ChannelSettings" isSpecification="false" isLeaf="false" visibility="public" namespace="Logical View" xmi.id="PGF0sP6Kgb0l" isRoot="false" isAbstract="false" name="ChannelSettings" >
+ <UML:Classifier.feature>
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="YzQ8Jmmx2Rx1" initialValue="0" type="OMC8n0NgoyNC" name="mPreDetectionDate" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="C8LZTmT1jr71" initialValue="0" type="OMC8n0NgoyNC" name="mFcReceptionDate" />
+ <UML:Attribute comment="// private attributes//" isSpecification="false" visibility="private" xmi.id="ECT43sTE9tu7" type="txbVRO36HpfQ" name="mIsConfigured" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="8uij0qPBhzDF" type="ZJ5BrRm819Tz" name="mSnrArray" />
+ <UML:Attribute isSpecification="false" visibility="private" xmi.id="dsqJeeDqqfut" type="kbTW3DFGwneP" name="mTonemapArray" />
+ <UML:Operation isSpecification="false" isLeaf="false" visibility="public" xmi.id="N1iX9W91mjbs" isRoot="false" isAbstract="false" isQuery="false" name="setSnr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="eTOzncRBd8im" value="" type="QCc0kys9xMnl" name="snr" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation stereotype="constructor" comment="// Constructors/Destructors// /**
+Empty Constructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="cnVd2iEDTGap" isRoot="false" isAbstract="false" isQuery="false" name="ChannelSettings" />
+ <UML:Operation comment="Empty Destructor" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dccFV5HKv9Wt" isRoot="false" isAbstract="false" isQuery="false" name="~ ChannelSettings" />
+ <UML:Operation comment="// public methods// // public attribute accessor methods// // private attribute accessor methods// /**
+Sets the PRE detection date.
+@param date tick at which the preamble has been received
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="CRgGs5fVq86t" isRoot="false" isAbstract="false" isQuery="false" name="setPreDetectionDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="s7c6LY1GemxC" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="d5bmZVy09CqC" value="" type="oL4FZe2AHfNk" name="date" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the FC reception date.
+@param date tick at which the frame control has been received
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="rJ3xOwjhyyGc" isRoot="false" isAbstract="false" isQuery="false" name="setFcReceptionDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="VhwBJg8tvS27" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="1OremcKPfw9E" value="" type="oL4FZe2AHfNk" name="date" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// private methods// /**
+Initializes the Channel Settings class attributes." isSpecification="false" isLeaf="false" visibility="private" xmi.id="P5CYI2l7Km5i" isRoot="false" isAbstract="false" isQuery="false" name="initAttributes" />
+ <UML:Operation comment="Gets the PRE detection date.
+@return mPreDetectionDate tick at which the preamble has been received" isSpecification="false" isLeaf="false" visibility="private" xmi.id="goPeldGm16Ol" isRoot="false" isAbstract="false" isQuery="false" name="getPreDetectionDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="uZu5e4qWCRdV" type="oL4FZe2AHfNk" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the FC reception date.
+@return mFcReceptionDate tick at which the frame control has been received" isSpecification="false" isLeaf="false" visibility="private" xmi.id="iiALeHZ1Njaf" isRoot="false" isAbstract="false" isQuery="false" name="getFcReceptionDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="zcmcNjoqQj1h" type="oL4FZe2AHfNk" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public methods// /**
+Gets the first symbol start date (in ticks).
+@return tick at which the first symbol has started" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dWaTBSKgoPJ3" isRoot="false" isAbstract="false" isQuery="false" name="getFirstSymbolStartDate" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="N9aGZbOUAGXm" type="oL4FZe2AHfNk" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the tonemap modulation.
+@param carrier the current carrier number
+@return the tonemap modulation" isSpecification="false" isLeaf="false" visibility="public" xmi.id="M3QGTU7iw8dM" isRoot="false" isAbstract="false" isQuery="false" name="getModulation" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="LLIVmt0kUkKp" type="zypnSFDYKlG8" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="MmOSniAOCkrL" value="" type="1XretJvqfug3" name="carrier" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the SNR in dB.
+@param interval the current interval number
+@param carrier the current carrier number
+@return the SNR in dB" isSpecification="false" isLeaf="false" visibility="public" xmi.id="AB0zYJ2vLR9m" isRoot="false" isAbstract="false" isQuery="false" name="getSnr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="U6fsnga9n8PM" type="mXu6MdkX4QlH" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="tEUpM8CisaAg" value="" type="oL4FZe2AHfNk" name="beacon_period" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="GI4R2umB3mAc" value="" type="oL4FZe2AHfNk" name="symbol_start_date" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4AXPZg9TueIH" value="" type="1XretJvqfug3" name="carrier" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="// public attribute accessor methods// // private attribute accessor methods// /**
+Gets if the channel has been configured.
+@return mIsConfigured" isSpecification="false" isLeaf="false" visibility="public" xmi.id="kSxc26GHOJiP" isRoot="false" isAbstract="false" isQuery="false" name="isConfigured" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="hlqp2LbLhsoR" type="NBTpmTxZCmcb" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the SNR.
+@param snr_value SNR value in dB
+@return bool" isSpecification="false" isLeaf="false" visibility="public" xmi.id="BSaEFiqHsNgS" isRoot="false" isAbstract="false" isQuery="false" name="setSnr" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="joBDZT01YfrL" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="3pvwRBD9e8ke" value="" type="mXu6MdkX4QlH" name="snr_value" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets the tonemap of the current transmission.
+@return bool
+@param tonemap_array the new value of mTonemapArray" isSpecification="false" isLeaf="false" visibility="public" xmi.id="dzYH8IvKHpvW" isRoot="false" isAbstract="false" isQuery="false" name="setTonemap" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="JPU6YuRFdF5f" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="OvxQVcfl5Duw" value="" type="zypnSFDYKlG8" name="tonemap_array[]" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Sets if the channel is configured.
+@param is_configured the new value of mIsConfigured
+@return bool" isSpecification="false" isLeaf="false" visibility="private" xmi.id="w6NMjCexlRoY" isRoot="false" isAbstract="false" isQuery="false" name="setIsConfigured" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="beyIWmjGbtR8" type="txbVRO36HpfQ" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="0MvEx1tWQRx1" value="" type="NBTpmTxZCmcb" name="is_configured" />
+ </UML:BehavioralFeature.parameter>
+ </UML:Operation>
+ <UML:Operation comment="Gets the time interval.
+@param symbol_start_date the current symbol start date in ticks
+@return the interval number" isSpecification="false" isLeaf="false" visibility="private" xmi.id="Z1yyRvzefObL" isRoot="false" isAbstract="false" isQuery="false" name="getInterval" >
+ <UML:BehavioralFeature.parameter>
+ <UML:Parameter kind="return" xmi.id="KS7s5wEPMgTu" type="1XretJvqfug3" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="4QwoboIxLg3I" value="" type="oL4FZe2AHfNk" name="beacon_period" />
+ <UML:Parameter isSpecification="false" visibility="private" xmi.id="rgELEMnmNlko" value="" type="oL4FZe2AHfNk" name="symbol_start_date" />
+ </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="894" snapy="10" showatts="1" xmi.id="gixkluDaZdUp" documentation="" type="1" showops="1" showpackage="1" name="class diagram channel computer" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="912" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="314" showattsigs="601" x="125" fillcolor="#ffffc0" y="350" showopsigs="600" linewidth="none" height="558" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="FA5tCgQO5jOX" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="182" showattsigs="601" x="184" fillcolor="#ffffc0" y="27" showopsigs="600" linewidth="none" height="261" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="MJNkMwYhFv8H" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,50,1,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" totalcountb="2" indexb="1" linewidth="none" widgetbid="MJNkMwYhFv8H" widgetaid="FA5tCgQO5jOX" xmi.id="guI259xtgWxy" linecolor="none" >
+ <linepath>
+ <startpoint startx="218" starty="350" />
+ <endpoint endx="218" endy="288" />
+ </linepath>
+ </assocwidget>
+ </associations>
+ </diagram>
+ <diagram snapgrid="0" showattsig="1" fillcolor="#ffffc0" linewidth="0" zoom="100" showgrid="0" showopsig="1" usefillcolor="1" snapx="10" canvaswidth="910" snapy="10" showatts="1" xmi.id="qdI3cPCM6cK0" documentation="" type="3" showops="1" showpackage="1" name="sequence diagram global" localid="7JggHOMZzMnz" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="824" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="143" x="337" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ka695HsLyRqa" decon="0" localid="apCSEDC2oS6O" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="111" x="73" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="rGkvr2wbb0ig" decon="0" localid="Ia2G2qocfz2t" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="103" x="696" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ACuye0MTG4P7" decon="0" localid="7JggHOMZzMnz" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <notewidget usesdiagramfillcolor="1" width="188" x="209" fillcolor="none" y="575" linewidth="none" height="50" usefillcolor="1" isinstance="0" xmi.id="IStaETkdi0j5" showstereotype="1" text="pb_measurement is empty" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="188" x="530" fillcolor="none" y="576" linewidth="none" height="50" usefillcolor="1" isinstance="0" xmi.id="srWZhXyIrLIM" showstereotype="1" text="pb_measurement is filled in" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="233" x="425" fillcolor="none" y="146" linewidth="none" height="71" usefillcolor="1" isinstance="0" xmi.id="tM9tcbkDpExS" showstereotype="1" text="Tonemask is described on 1155 carriers. It is sent once at program start." usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="300" x="425" fillcolor="none" y="430" linewidth="none" height="97" usefillcolor="1" isinstance="0" xmi.id="NCpDY8ZPSiH5" showstereotype="1" text="Tonemap is described on 1155 carriers. It is sent before each TX using the TM.
+For TX in ROBO mode, Maximus should know which modulation to applied." usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="191" x="532" fillcolor="none" y="671" linewidth="none" height="50" usefillcolor="1" isinstance="0" xmi.id="vgNaXDp4Y1sl" showstereotype="1" text="with time noise and frequency noise" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="278" x="129" fillcolor="none" y="173" operation="phy msg (TONEMASK)" linewidth="none" widgetbid="apCSEDC2oS6O" height="8" usefillcolor="1" seqnum="1" textid="Z3so7HtCYasq" widgetaid="Ia2G2qocfz2t" isinstance="0" xmi.id="AcZqbchlobhR" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="165" x="147" fillcolor="none" y="151" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Z3so7HtCYasq" text="1: phy msg (TONEMASK)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="278" x="129" fillcolor="none" y="274" operation="phy msg (PREAMBLE)" linewidth="none" widgetbid="apCSEDC2oS6O" height="8" usefillcolor="1" seqnum="2" textid="D5opmFOp8CuN" widgetaid="Ia2G2qocfz2t" isinstance="0" xmi.id="DPvXBuinSYM2" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="161" x="186" fillcolor="none" y="252" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="D5opmFOp8CuN" showstereotype="1" text="2: phy msg (PREAMBLE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="337" x="409" fillcolor="none" y="307" operation="phy msg (PREAMBLE)" linewidth="none" widgetbid="7JggHOMZzMnz" height="8" usefillcolor="1" seqnum="2.1" textid="QS5qyPsBUhyG" widgetaid="apCSEDC2oS6O" isinstance="0" xmi.id="67uezkcC7YkI" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="173" x="414" fillcolor="none" y="285" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="QS5qyPsBUhyG" showstereotype="1" text="2.1: phy msg (PREAMBLE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="278" x="129" fillcolor="none" y="355" operation="phy msg (FC_AV_ONLY_MODE)" linewidth="none" widgetbid="apCSEDC2oS6O" height="8" usefillcolor="1" seqnum="3" textid="Oj3B4SmNHDpb" widgetaid="Ia2G2qocfz2t" isinstance="0" xmi.id="JXLvabAdZ2of" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="221" x="147" fillcolor="none" y="333" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Oj3B4SmNHDpb" showstereotype="1" text="3: phy msg (FC_AV_ONLY_MODE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="337" x="409" fillcolor="none" y="396" operation="phy msg (FC_AV_ONLY_MODE)" linewidth="none" widgetbid="7JggHOMZzMnz" height="8" usefillcolor="1" seqnum="3.1" textid="JPNrQBWmuXvy" widgetaid="apCSEDC2oS6O" isinstance="0" xmi.id="ME7N0gMKEiFm" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="233" x="414" fillcolor="none" y="374" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="JPNrQBWmuXvy" showstereotype="1" text="3.1: phy msg (FC_AV_ONLY_MODE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="278" x="129" fillcolor="none" y="563" operation="phy msg (MPDU_PAYLOAD)" linewidth="none" widgetbid="apCSEDC2oS6O" height="8" usefillcolor="1" seqnum="5" textid="e9HR1oM0j2Jy" widgetaid="Ia2G2qocfz2t" isinstance="0" xmi.id="MdygpgtayGxn" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="199" x="147" fillcolor="none" y="541" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="e9HR1oM0j2Jy" text="5: phy msg (MPDU_PAYLOAD)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="337" x="409" fillcolor="none" y="563" operation="phy msg (MPDU_PAYLOAD)" linewidth="none" widgetbid="7JggHOMZzMnz" height="8" usefillcolor="1" seqnum="5.1" textid="LbiJre4UlLvm" widgetaid="apCSEDC2oS6O" isinstance="0" xmi.id="vOm8kjk4Lgi8" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="211" x="414" fillcolor="none" y="541" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="LbiJre4UlLvm" text="5.1: phy msg (MPDU_PAYLOAD)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="337" x="409" fillcolor="none" y="657" operation="phy msg (NOISE)" linewidth="none" widgetbid="7JggHOMZzMnz" height="8" usefillcolor="1" seqnum="5.2" textid="JyEcfwiyVPFL" widgetaid="apCSEDC2oS6O" isinstance="0" xmi.id="7FkqF2p8QbGA" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="145" x="461" fillcolor="none" y="635" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="JyEcfwiyVPFL" text="5.2: phy msg (NOISE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="278" x="129" fillcolor="none" y="475" operation="phy msg (TONEMAP)" linewidth="none" widgetbid="apCSEDC2oS6O" height="8" usefillcolor="1" seqnum="4" textid="LOJl0YuHU6t9" widgetaid="Ia2G2qocfz2t" isinstance="0" xmi.id="3JpoeiYlxJbB" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="156" x="134" fillcolor="none" y="453" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="LOJl0YuHU6t9" text="4: phy msg (TONEMAP)" 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="1458" snapy="10" showatts="1" xmi.id="X42GTN9PoAyH" documentation="" type="3" showops="1" showpackage="1" name="sequence diagram maximus" localid="iG3Nps5Lu2Mn" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1641" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="111" x="19" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="rGkvr2wbb0ig" decon="0" localid="3DAVyBoln7OB" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="87" x="213" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="t1tc2bTZdTo7" decon="0" localid="pvUd5Su7d2cZ" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="114" x="554" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="EPI1UgANf3xg" decon="0" localid="dODGr1LexpH0" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="142" x="699" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="FA5tCgQO5jOX" decon="0" localid="NYu3arhDDuR4" multipleinstance="0" drawasactor="0" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="103" x="1139" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ACuye0MTG4P7" decon="0" localid="unhpayno6tfH" 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="387" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="y0Zndhh8NjGq" decon="0" localid="niFReFLgyuZm" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="57" x="1271" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ouQgLFbCZBH6" decon="0" localid="asRxXJUOaOs0" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <notewidget usesdiagramfillcolor="1" width="234" x="582" fillcolor="none" y="344" linewidth="none" height="71" usefillcolor="1" isinstance="0" xmi.id="h94z0oip6zcC" showstereotype="1" text="if already set by another station, return an error if a different tonemask is received" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <objectwidget usesdiagramfillcolor="0" width="127" x="916" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="PGF0sP6Kgb0l" decon="0" localid="iG3Nps5Lu2Mn" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <notewidget usesdiagramfillcolor="1" width="233" x="45" fillcolor="none" y="138" linewidth="none" height="71" usefillcolor="1" isinstance="0" xmi.id="XNhoyoP1qY7e" showstereotype="1" text="Tonemask is described on 1155 carriers. It is sent once at program start." usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="300" x="20" fillcolor="none" y="939" linewidth="none" height="97" usefillcolor="1" isinstance="0" xmi.id="hqoOxdLglCpc" showstereotype="1" text="Tonemap is described on 1155 carriers. It is sent before each TX using the TM.
+For TX in ROBO mode, Maximus should know which modulation to applied." usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="180" x="75" fillcolor="none" y="238" operation="PHY msg (TONEMASK)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="1" textid="qsL3mm5gXkV8" widgetaid="3DAVyBoln7OB" isinstance="0" xmi.id="X5fao37AazDA" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="167" x="84" fillcolor="none" y="216" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="qsL3mm5gXkV8" text="1: PHY msg (TONEMASK)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="180" x="75" fillcolor="none" y="399" operation="PHY msg (PREAMBLE)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="2" textid="V0qCm3Vi3FWN" widgetaid="3DAVyBoln7OB" isinstance="0" xmi.id="rrJ9iTwEnK49" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="163" x="80" fillcolor="none" y="377" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="V0qCm3Vi3FWN" text="2: PHY msg (PREAMBLE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="180" x="75" fillcolor="none" y="1066" operation="PHY msg (TONEMAP)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="4" textid="ftRXfy3geebu" widgetaid="3DAVyBoln7OB" isinstance="0" xmi.id="L3omNKIOraEr" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="163" x="88" fillcolor="none" y="1044" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="ftRXfy3geebu" text="4: PHY msg (TONEMAP)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="181" x="257" fillcolor="none" y="265" operation="dispatch msg ()" linewidth="none" widgetbid="niFReFLgyuZm" height="8" usefillcolor="1" seqnum="1.1" textid="vCCIjlQ6bD0S" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="b208fWbLMhyw" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="136" x="298" fillcolor="none" y="243" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="vCCIjlQ6bD0S" text="1.1: dispatch msg ()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="181" x="257" fillcolor="none" y="440" operation="dispatch msg ()" linewidth="none" widgetbid="niFReFLgyuZm" height="8" usefillcolor="1" seqnum="2.1" textid="XFjtxfoqsy9Z" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="aTS6yi3Xk1eQ" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="136" x="294" fillcolor="none" y="418" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="XFjtxfoqsy9Z" showstereotype="1" text="2.1: dispatch msg ()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="181" x="257" fillcolor="none" y="678" operation="dispatch msg()" linewidth="none" widgetbid="niFReFLgyuZm" height="8" usefillcolor="1" seqnum="3.1" textid="qUaZVCx0SgsN" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="jZfIndiL78R3" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="132" x="262" fillcolor="none" y="656" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="qUaZVCx0SgsN" text="3.1: dispatch msg()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="170" x="440" fillcolor="none" y="302" operation="receive tonemask (PHY SCI msg)" linewidth="none" widgetbid="dODGr1LexpH0" height="8" usefillcolor="1" seqnum="1.2" textid="2Iy7RQAFsjoO" widgetaid="niFReFLgyuZm" isinstance="0" xmi.id="MgDCcKlJsPcd" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="250" x="445" fillcolor="none" y="280" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="2Iy7RQAFsjoO" text="1.2: receive tonemask (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="170" x="440" fillcolor="none" y="464" operation="receive preamble (PHY SCI msg)" linewidth="none" widgetbid="dODGr1LexpH0" height="8" usefillcolor="1" seqnum="2.2" textid="Cho46Of7eeE3" widgetaid="niFReFLgyuZm" isinstance="0" xmi.id="vjMLQEgkuswU" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="244" x="445" fillcolor="none" y="442" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Cho46Of7eeE3" text="2.2: receive preamble (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="170" x="440" fillcolor="none" y="1140" operation="receive tonemap (PHY SCI msg)" linewidth="none" widgetbid="dODGr1LexpH0" height="8" usefillcolor="1" seqnum="4.2" textid="bMkg1Os4QFLK" widgetaid="niFReFLgyuZm" isinstance="0" xmi.id="DtzvmrpE2W04" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="243" x="445" fillcolor="none" y="1118" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="bMkg1Os4QFLK" text="4.2: receive tonemap (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="353" x="257" fillcolor="none" y="534" operation="send msg (PHY SCI msg)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="2.5" textid="5zkAU00p74Ai" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="VhUvuoGCBrRN" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="195" x="281" fillcolor="none" y="512" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="5zkAU00p74Ai" text="2.5: send msg (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="932" x="257" fillcolor="none" y="579" operation="PHY msg (PREAMBLE)" linewidth="none" widgetbid="unhpayno6tfH" height="8" usefillcolor="1" seqnum="2.6" textid="JSR9XTHDZt45" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="HCOTNDukIrSR" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="175" x="267" fillcolor="none" y="557" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="JSR9XTHDZt45" showstereotype="1" text="2.6: PHY msg (PREAMBLE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="180" x="75" fillcolor="none" y="646" operation="PHY msg (FC_AV_ONLY_MODE)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="3" textid="Zhw6ADKj5Mog" widgetaid="3DAVyBoln7OB" isinstance="0" xmi.id="cNozaghrV7Ip" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="223" x="80" fillcolor="none" y="624" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Zhw6ADKj5Mog" showstereotype="1" text="3: PHY msg (FC_AV_ONLY_MODE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="181" x="257" fillcolor="none" y="1106" operation="dispatch msg ()" linewidth="none" widgetbid="niFReFLgyuZm" height="8" usefillcolor="1" seqnum="4.1" textid="w2PIwyZ3QrjY" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="wVhd8YYauIE1" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="136" x="262" fillcolor="none" y="1084" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="w2PIwyZ3QrjY" text="4.1: dispatch msg ()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="170" x="440" fillcolor="none" y="708" operation="receive FC (PHY SCI msg)" linewidth="none" widgetbid="dODGr1LexpH0" height="8" usefillcolor="1" seqnum="3.2" textid="t41nKGpFICXC" widgetaid="niFReFLgyuZm" isinstance="0" xmi.id="t8guysgvLNWT" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="198" x="445" fillcolor="none" y="686" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="t41nKGpFICXC" showstereotype="1" text="3.2: receive FC (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="353" x="257" fillcolor="none" y="807" operation="send msg (PHY SCI msg)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="3.5" textid="H8EMrtQSCMPt" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="gA4wMZ8UbL3U" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="195" x="281" fillcolor="none" y="785" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="H8EMrtQSCMPt" text="3.5: send msg (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="932" x="257" fillcolor="none" y="854" operation="PHY msg (FC_AV_ONLY_MODE)" linewidth="none" widgetbid="unhpayno6tfH" height="8" usefillcolor="1" seqnum="3.6" textid="dwoCHpgWvvtm" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="noTHEo4uz6oJ" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="235" x="268" fillcolor="none" y="832" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="dwoCHpgWvvtm" showstereotype="1" text="3.6: PHY msg (FC_AV_ONLY_MODE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="180" x="75" fillcolor="none" y="1254" operation="PHY msg (MPDU_PAYLOAD)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="5" textid="8ZTvFzq8qat5" widgetaid="3DAVyBoln7OB" isinstance="0" xmi.id="Jcc5gU2lIMMC" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="201" x="80" fillcolor="none" y="1232" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="8ZTvFzq8qat5" showstereotype="1" text="5: PHY msg (MPDU_PAYLOAD)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="181" x="257" fillcolor="none" y="1288" operation="dispatch msg ()" linewidth="none" widgetbid="niFReFLgyuZm" height="8" usefillcolor="1" seqnum="5.1" textid="m532RPEXyfSC" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="mshMg3kzdK2I" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="136" x="262" fillcolor="none" y="1266" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="m532RPEXyfSC" text="5.1: dispatch msg ()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="170" x="440" fillcolor="none" y="1322" operation="receive MPDU (PHY SCI msg)" linewidth="none" widgetbid="dODGr1LexpH0" height="8" usefillcolor="1" seqnum="5.2" textid="Fhet2hBmkEp9" widgetaid="niFReFLgyuZm" isinstance="0" xmi.id="fIITsBZc1Ezh" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="221" x="445" fillcolor="none" y="1300" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Fhet2hBmkEp9" text="5.2: receive MPDU (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="353" x="257" fillcolor="none" y="1453" operation="send msg (PHY SCI msg)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="5.4" textid="o7lnxzqaHK2w" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="c6xYdiuSYlEe" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="195" x="262" fillcolor="none" y="1431" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="o7lnxzqaHK2w" text="5.4: send msg (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="932" x="257" fillcolor="none" y="1511" operation="PHY msg (MPDU_PAYLOAD)" linewidth="none" widgetbid="unhpayno6tfH" height="8" usefillcolor="1" seqnum="5.5" textid="hjoGU2uH7d22" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="LOpngd6Ij1oM" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="213" x="262" fillcolor="none" y="1489" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="hjoGU2uH7d22" text="5.5: PHY msg (MPDU_PAYLOAD)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="353" x="257" fillcolor="none" y="1566" operation="send msg (PHY SCI msg)" linewidth="none" widgetbid="pvUd5Su7d2cZ" height="8" usefillcolor="1" seqnum="5.6" textid="QWcGEsXpz2YD" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="Pf6r4QIR7pB6" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="203" x="262" fillcolor="none" y="1544" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="QWcGEsXpz2YD" text="5.6: send msg (PHY SCI msg)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="932" x="257" fillcolor="none" y="1609" operation="PHY msg (NOISE)" linewidth="none" widgetbid="unhpayno6tfH" height="8" usefillcolor="1" seqnum="5.7" textid="mdfrSqxrKZ5Y" widgetaid="pvUd5Su7d2cZ" isinstance="0" xmi.id="GRMb9VGWBMND" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="155" x="262" fillcolor="none" y="1587" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="mdfrSqxrKZ5Y" text="5.7: PHY msg (NOISE)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="157" x="612" fillcolor="none" y="1171" operation="BALxxO2awYCA" linewidth="none" widgetbid="NYu3arhDDuR4" height="8" usefillcolor="1" seqnum="4.3" textid="FsdpD1lAYuX2" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="6tGl6PP1piEa" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="837" x="617" fillcolor="none" y="1149" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="FsdpD1lAYuX2" text="4.3: setTonemap(tx_station_id : const Sci_Msg_Station_Id, length : const unsigned long, p_tonemap : const unsigned char*) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="157" x="612" fillcolor="none" y="332" operation="fYXdFW0u7v45" linewidth="none" widgetbid="NYu3arhDDuR4" height="8" usefillcolor="1" seqnum="1.3" textid="oyH4FIsmjMnd" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="0ea9mnvPOz8D" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="352" x="617" fillcolor="none" y="310" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="oyH4FIsmjMnd" text="1.3: setTonemask(p_tonemask : const uint8_t*) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="157" x="612" fillcolor="none" y="494" operation="qrweJyXfPgQH" linewidth="none" widgetbid="NYu3arhDDuR4" height="8" usefillcolor="1" seqnum="2.3" textid="FmRal8d0mKsL" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="q7x8JGpaGYcr" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="665" x="617" fillcolor="none" y="472" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="FmRal8d0mKsL" showstereotype="1" text="2.3: receivePre(tx_station_id : const Sci_Msg_Station_Id, current_tick : const Network_Clock_Tick) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="157" x="612" fillcolor="none" y="745" operation="OS6l8U35hW6C" linewidth="none" widgetbid="NYu3arhDDuR4" height="8" usefillcolor="1" seqnum="3.3" textid="9WbSBVHWt1w6" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="VgNj3rHVA6es" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="658" x="617" fillcolor="none" y="723" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="9WbSBVHWt1w6" showstereotype="1" text="3.3: receiveFc(tx_station_id : const Sci_Msg_Station_Id, current_tick : const Network_Clock_Tick) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="207" x="771" fillcolor="none" y="785" operation="rJ3xOwjhyyGc" linewidth="none" widgetbid="iG3Nps5Lu2Mn" height="8" usefillcolor="1" seqnum="3.4" textid="fEktuJp4hoN5" widgetaid="NYu3arhDDuR4" isinstance="0" xmi.id="C9q4zpJcLPes" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="417" x="776" fillcolor="none" y="763" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="fEktuJp4hoN5" showstereotype="1" text="3.4: setFcReceptionDate(date : const Network_Clock_Tick) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="207" x="771" fillcolor="none" y="515" operation="CRgGs5fVq86t" linewidth="none" widgetbid="iG3Nps5Lu2Mn" height="8" usefillcolor="1" seqnum="2.4" textid="hzPrvJoRRWSV" widgetaid="NYu3arhDDuR4" isinstance="0" xmi.id="m59xDlN772zf" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="423" x="776" fillcolor="none" y="493" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="hzPrvJoRRWSV" showstereotype="1" text="2.4: setPreDetectionDate(date : const Network_Clock_Tick) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="318" x="980" fillcolor="none" y="162" operation="N1iX9W91mjbs" linewidth="none" widgetbid="iG3Nps5Lu2Mn" height="8" usefillcolor="1" seqnum="0" textid="69FbMxXh4qus" widgetaid="asRxXJUOaOs0" isinstance="0" xmi.id="o91EgffKrvqF" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="423" x="985" fillcolor="none" y="140" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="69FbMxXh4qus" text="0: setSnr(snr : const float[interval_nb][PHY_CARRIER_MAX_NB])" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="157" x="612" fillcolor="none" y="1362" operation="addPerturbation()" linewidth="none" widgetbid="NYu3arhDDuR4" height="8" usefillcolor="1" seqnum="5.3" textid="ZwsIbgkqlGwo" widgetaid="dODGr1LexpH0" isinstance="0" xmi.id="mkSrDPCjpToZ" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="149" x="617" fillcolor="none" y="1340" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="ZwsIbgkqlGwo" showstereotype="1" text="5.3: addPerturbation()" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="207" x="771" fillcolor="none" y="1209" operation="dzYH8IvKHpvW" linewidth="none" widgetbid="iG3Nps5Lu2Mn" height="8" usefillcolor="1" seqnum="" textid="brWHhG3EgPgP" widgetaid="NYu3arhDDuR4" isinstance="0" xmi.id="VBUTLWqLNO3T" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="390" x="776" fillcolor="none" y="1187" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="brWHhG3EgPgP" showstereotype="1" text=": setTonemap(tonemap_array[] : const Channel_Mod) : 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="1882" snapy="10" showatts="1" xmi.id="wHQW0owEmBOE" documentation="" type="3" showops="1" showpackage="1" name="sequence diagram channel" localid="g4uHNUZyzX5B" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1271" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="114" x="25" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="EPI1UgANf3xg" decon="0" localid="JSGw5HTuusup" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="138" x="251" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="FA5tCgQO5jOX" decon="0" localid="u4Vw6zChn0FB" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="127" x="544" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="PGF0sP6Kgb0l" decon="0" localid="VcHEp6yBGZmE" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <notewidget usesdiagramfillcolor="1" width="167" x="1063" fillcolor="none" y="847" linewidth="none" height="50" usefillcolor="1" isinstance="0" xmi.id="HOSEWhecreBb" showstereotype="1" text="for P2 coordinates" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="151" x="961" fillcolor="none" y="763" linewidth="none" height="76" usefillcolor="1" isinstance="0" xmi.id="fokHPWTHSe6Q" showstereotype="1" text="get the P0 coordinates from the code C0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="165" x="1386" fillcolor="none" y="871" linewidth="none" height="77" usefillcolor="1" isinstance="0" xmi.id="4xzip5SwM7Ck" showstereotype="1" text="get the code C2 from the P2 coordinates" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="275" x="28" fillcolor="none" y="308" linewidth="none" height="60" usefillcolor="1" isinstance="0" xmi.id="r571dUJXBSUA" showstereotype="1" text="Do actions 1 to 13 for each carrier of each symbol" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="135" x="172" fillcolor="none" y="1153" linewidth="none" height="81" usefillcolor="1" isinstance="0" xmi.id="L6D0iIcPJ49O" showstereotype="1" text="Do actions 14 and 15 at the end of each PB" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <objectwidget usesdiagramfillcolor="0" width="192" x="855" fillcolor="#ffffc0" y="48" instancename="mapping0" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="HjupUSYowhI4" decon="0" localid="a8y22aDmxi4S" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="192" x="1139" fillcolor="#ffffc0" y="48" instancename="mapping1" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="HjupUSYowhI4" decon="0" localid="PNVizgbJacYd" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="192" x="1467" fillcolor="#ffffc0" y="48" instancename="mapping2" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="HjupUSYowhI4" decon="0" localid="ui3PEJBmn8rj" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="687" operation="z7iRgeJqCCrj" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="6" textid="uYaEkn1fsPxQ" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="9QRr8oHrIyOQ" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="547" x="326" fillcolor="none" y="665" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="uYaEkn1fsPxQ" showstereotype="1" text="6: getSigma(modulation : const Channel_Mod, snr_in_db : const float) : const double" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="285" x="321" fillcolor="none" y="578" operation="M3QGTU7iw8dM" linewidth="none" widgetbid="VcHEp6yBGZmE" height="8" usefillcolor="1" seqnum="4" textid="fJs8zIVwsUpx" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="jRTpUCUaTrp5" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="518" x="326" fillcolor="none" y="556" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="fJs8zIVwsUpx" text="4: getModulation(carrier : const unsigned int) : const Channel_Mod" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="506" operation="P3rRYhqHMh6s" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="3" textid="4S9x0L8wK3Te" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="muSfiL1vGzl3" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="350" x="326" fillcolor="none" y="484" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="4S9x0L8wK3Te" showstereotype="1" text="3: getLinearSnr(snr_in_db : const float) : const double" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="627" operation="jfqqWYV4W41s" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="5" textid="WtHx3BbQh5q4" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="IrO6a4kn04VS" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="416" x="326" fillcolor="none" y="605" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="WtHx3BbQh5q4" showstereotype="1" text="5: getPowerScale(modulation : const Channel_Mod) : const float" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="182" operation="09RFjqmd0dax" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="0.1" textid="jq17ZjwGkSkg" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="HOn0jC4IxHwb" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="1113" x="326" fillcolor="none" y="160" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="jq17ZjwGkSkg" text="0.1: findChannelSettings(tx_station_id : const Sci_Msg_Station_Id, rx_station_id : const Sci_Msg_Station_Id, both_directions : const bool) : std::vector&lt; ChannelSettings * >&amp;" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="236" x="83" fillcolor="none" y="130" operation="LRN0s3UGfAwm" linewidth="none" widgetbid="u4Vw6zChn0FB" height="8" usefillcolor="1" seqnum="0" textid="yJ8aftxYwuoW" widgetaid="JSGw5HTuusup" isinstance="0" xmi.id="vYaZ8E857Uzs" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="1790" x="88" fillcolor="none" y="108" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="yJ8aftxYwuoW" text="0: addPerturbation(pb_measurement_array : uint32_t*, noise : PhySciMsgNoise&amp;, pb_header_array : const uint32_t*, mpdu : const PhySciMsgMpdu&amp;, tx_station_id : const Sci_Msg_Station_Id, rx_station_id : const Sci_Msg_Station_Id, current_tick : const Network_Clock_Tick) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="285" x="321" fillcolor="none" y="247" operation="dWaTBSKgoPJ3" linewidth="none" widgetbid="VcHEp6yBGZmE" height="8" usefillcolor="1" seqnum="0.2" textid="GZIM315LGZEW" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="7Gbh73pmyjD4" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="380" x="326" fillcolor="none" y="225" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="GZIM315LGZEW" showstereotype="1" text="0.2: getFirstSymbolStartDate() : const Network_Clock_Tick" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="629" x="321" fillcolor="none" y="758" operation="rCiZ34ts7WOo" linewidth="none" widgetbid="a8y22aDmxi4S" height="8" usefillcolor="1" seqnum="7" textid="mpdOyViWiQTz" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="NPrLTDPM1My6" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="1076" x="326" fillcolor="none" y="736" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="mpdOyViWiQTz" showstereotype="1" text="7: setCode(modulation : const Channel_Mod, mpdu_payload_length : const unsigned long, p_mpdu_payload : const unsigned char*, mpdu_index : unsigned int&amp;) : bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="629" x="321" fillcolor="none" y="802" operation="nowhba6bZwOz" linewidth="none" widgetbid="a8y22aDmxi4S" height="8" usefillcolor="1" seqnum="8" textid="NZDmZTbnQy08" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="9YVTK9l70IqV" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="478" x="326" fillcolor="none" y="780" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="NZDmZTbnQy08" text="8: computePoint(modulation : const Channel_Mod) : const ChannelPoint&amp;" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="844" operation="jyRgGnpfqf5M" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="9" textid="X8sw5uavM44a" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="u7dxbPK1G8Yu" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="548" x="326" fillcolor="none" y="822" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="X8sw5uavM44a" text="9: addNoise(point : const ChannelPoint&amp;, sigma : const double) : const ChannelPoint" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="913" x="321" fillcolor="none" y="899" operation="o3dYjumm81LP" linewidth="none" widgetbid="PNVizgbJacYd" height="8" usefillcolor="1" seqnum="10" textid="TviPGPMNGWmm" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="AboEaCBFVTRe" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="467" x="326" fillcolor="none" y="877" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="TviPGPMNGWmm" text="10: retrievePoint(modulation : const Channel_Mod) : const ChannelPoint" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="1241" x="321" fillcolor="none" y="952" operation="66Ykoo2IT5gA" linewidth="none" widgetbid="ui3PEJBmn8rj" height="8" usefillcolor="1" seqnum="11" textid="nuZRxZVATbii" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="BEczhLNQKErc" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="507" x="326" fillcolor="none" y="930" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="nuZRxZVATbii" showstereotype="1" text="11: computeCode(modulation : const Channel_Mod) : const unsigned short int" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="999" operation="XOXms3hJA084" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="12" textid="g4GGNIBXMiNb" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="ltqm7OE0pjjp" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="707" x="326" fillcolor="none" y="977" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="g4GGNIBXMiNb" showstereotype="1" text="12: computeBer(codeA : const unsigned short int, codeB : const unsigned short int) : const unsigned short int" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="1155" operation="o0LrX74wtWDl" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="14" textid="NQHoDpzJblzE" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="p9IvJtNiyBIa" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="747" x="326" fillcolor="none" y="1133" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="NQHoDpzJblzE" text="14: computeFer(ber : const unsigned short int, n : const unsigned int, modulation : const Channel_Mod) : const float" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="1215" operation="wAYHYS5t16DH" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="15" textid="5fcFCtaBtUj2" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="QtHPrgMs3A6u" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="325" x="326" fillcolor="none" y="1193" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="5fcFCtaBtUj2" showstereotype="1" text="15: computeCrcError(fer : const float) : const bool" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="321" fillcolor="none" y="1070" operation="k41t27vK3XoF" linewidth="none" widgetbid="u4Vw6zChn0FB" height="32" usefillcolor="1" seqnum="13" textid="RzzRQLxjTpPs" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="pe8kGhrJKg63" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="646" x="326" fillcolor="none" y="1048" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="RzzRQLxjTpPs" text="13: computeNoise(pointA : const ChannelPoint&amp;, pointB : const ChannelPoint&amp;) : const unsigned int" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="285" x="321" fillcolor="none" y="393" operation="AB0zYJ2vLR9m" linewidth="none" widgetbid="VcHEp6yBGZmE" height="8" usefillcolor="1" seqnum="1" textid="tYOTbc6noQuY" widgetaid="u4Vw6zChn0FB" isinstance="0" xmi.id="ncXBJkvSItqN" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="905" x="326" fillcolor="none" y="371" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="tYOTbc6noQuY" text="1: getSnr(beacon_period : const Network_Clock_Tick, symbol_start_date : const Network_Clock_Tick, carrier : const unsigned int) : const float" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="608" fillcolor="none" y="437" operation="Z1yyRvzefObL" linewidth="none" widgetbid="VcHEp6yBGZmE" height="32" usefillcolor="1" seqnum="2" textid="KgciLhLFiQt2" widgetaid="VcHEp6yBGZmE" isinstance="0" xmi.id="kPRSVvRUyNkh" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="802" x="613" fillcolor="none" y="415" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="KgciLhLFiQt2" showstereotype="1" text="2: getInterval(beacon_period : const Network_Clock_Tick, symbol_start_date : const Network_Clock_Tick) : const unsigned int" 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="1340" snapy="10" showatts="1" xmi.id="NdBn9ALHuRov" documentation="" type="3" showops="1" showpackage="1" name="sequence diagram phy" localid="vTN4WfHZyzzP" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="808" >
+ <widgets>
+ <objectwidget usesdiagramfillcolor="0" width="145" x="742" fillcolor="#ffffc0" y="48" instancename="sta_Rx" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ACuye0MTG4P7" decon="0" localid="TEq0CDwjmGJP" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="152" x="73" fillcolor="#ffffc0" y="48" instancename="sta_Tx" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="rGkvr2wbb0ig" decon="0" localid="wsGISdwu93Fw" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="143" x="422" fillcolor="#ffffc0" y="48" instancename="" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="ka695HsLyRqa" decon="0" localid="UzpajIea0XQC" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <objectwidget usesdiagramfillcolor="0" width="123" x="999" fillcolor="#ffffc0" y="48" instancename="sta" linewidth="none" height="28" usefillcolor="1" isinstance="0" xmi.id="CvLZ2CQ63P41" decon="0" localid="vTN4WfHZyzzP" multipleinstance="0" drawasactor="0" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,0,50,0,1,0,0,0" linecolor="#ff0000" />
+ <notewidget usesdiagramfillcolor="1" width="288" x="725" fillcolor="none" y="375" linewidth="none" height="77" usefillcolor="1" isinstance="0" xmi.id="vaLJXLQEXaTQ" showstereotype="1" text="sta_Rx informs Maximus that it is waiting for a phy msg MPDU PAYLOAD with station_id=1 and tx_id=n." usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ <notewidget usesdiagramfillcolor="1" width="254" x="945" fillcolor="none" y="596" linewidth="none" height="76" usefillcolor="1" isinstance="0" xmi.id="xI2mvXuq5XQ1" showstereotype="1" text="Maximus does not forward the message to this station because the station did not request it." usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </widgets>
+ <messages>
+ <messagewidget usesdiagramfillcolor="1" width="342" x="150" fillcolor="none" y="157" operation="phy msg PREAMBLE (station_id=1, tx_id=n)" linewidth="none" widgetbid="UzpajIea0XQC" height="8" usefillcolor="1" seqnum="1" textid="bOloW713jQsW" widgetaid="wsGISdwu93Fw" isinstance="0" xmi.id="Mv0zqKRZhUnv" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="308" x="155" fillcolor="none" y="135" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="bOloW713jQsW" showstereotype="1" text="1: phy msg PREAMBLE (station_id=1, tx_id=n)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="342" x="150" fillcolor="none" y="272" operation="phy msg FC (station_id=1, tx_id=n)" linewidth="none" widgetbid="UzpajIea0XQC" height="8" usefillcolor="1" seqnum="2" textid="9Lu6jLuuqk9N" widgetaid="wsGISdwu93Fw" isinstance="0" xmi.id="fQ14khLUfnNq" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="251" x="155" fillcolor="none" y="250" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="9Lu6jLuuqk9N" text="2: phy msg FC (station_id=1, tx_id=n)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="342" x="150" fillcolor="none" y="620" operation="phy msg MPDU PAYLOAD (station_id=1, tx_id=n)" linewidth="none" widgetbid="UzpajIea0XQC" height="8" usefillcolor="1" seqnum="3" textid="knYyVvmnygjd" widgetaid="wsGISdwu93Fw" isinstance="0" xmi.id="2ezxScrI455n" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="338" x="155" fillcolor="none" y="598" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="knYyVvmnygjd" showstereotype="1" text="3: phy msg MPDU PAYLOAD (station_id=1, tx_id=n)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="319" x="494" fillcolor="none" y="158" operation="phy msg PREAMBLE (station_id=1, tx_id=n)" linewidth="none" widgetbid="TEq0CDwjmGJP" height="8" usefillcolor="1" seqnum="1.1" textid="Vp1SBTakUluB" widgetaid="UzpajIea0XQC" isinstance="0" xmi.id="jNrUtdvesECz" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="315" x="499" fillcolor="none" y="136" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Vp1SBTakUluB" showstereotype="1" text="1.1: phy msg PREAMBLE (station_id=1, tx_id=n)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="565" x="494" fillcolor="none" y="206" operation="phy msg PREAMBLE (station_id=1, tx_id=n)" linewidth="none" widgetbid="vTN4WfHZyzzP" height="8" usefillcolor="1" seqnum="1.2" textid="RXJBTM0Jf1co" widgetaid="UzpajIea0XQC" isinstance="0" xmi.id="WJhwQHceMTqC" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="315" x="499" fillcolor="none" y="184" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="RXJBTM0Jf1co" showstereotype="1" text="1.2: phy msg PREAMBLE (station_id=1, tx_id=n)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="319" x="494" fillcolor="none" y="269" operation="phy msg FC (station_id=1, tx_id=n)" linewidth="none" widgetbid="TEq0CDwjmGJP" height="8" usefillcolor="1" seqnum="2.1" textid="OLVTLWolFCsg" widgetaid="UzpajIea0XQC" isinstance="0" xmi.id="Q6PapcRWPuEz" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="263" x="499" fillcolor="none" y="247" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="OLVTLWolFCsg" showstereotype="1" text="2.1: phy msg FC (station_id=1, tx_id=n)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="565" x="494" fillcolor="none" y="507" operation="phy msg FC (station_id=1, tx_id=n)" linewidth="none" widgetbid="vTN4WfHZyzzP" height="8" usefillcolor="1" seqnum="2.2" textid="EBWXiv4NpPQR" widgetaid="UzpajIea0XQC" isinstance="0" xmi.id="OBh7pccOhqSd" sequencemessagetype="1001" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="263" x="499" fillcolor="none" y="485" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="EBWXiv4NpPQR" showstereotype="1" text="2.2: phy msg FC (station_id=1, tx_id=n)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="815" fillcolor="none" y="298" operation="phy_rx_prepare (short_ppdu=false)" linewidth="none" widgetbid="TEq0CDwjmGJP" height="32" usefillcolor="1" seqnum="2.1.1" textid="w3lqVE3FVdpA" widgetaid="TEq0CDwjmGJP" isinstance="0" xmi.id="YGIWHyaOQQR1" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="274" x="820" fillcolor="none" y="276" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="w3lqVE3FVdpA" showstereotype="1" text="2.1.1: phy_rx_prepare (short_ppdu=false)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="1061" fillcolor="none" y="537" operation="phy_rx_prepare (short_ppdu=true)" linewidth="none" widgetbid="vTN4WfHZyzzP" height="32" usefillcolor="1" seqnum="2.2.1" textid="37M4PIbBIbTx" widgetaid="vTN4WfHZyzzP" isinstance="0" xmi.id="YWBfB4JOZN86" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="270" x="1066" fillcolor="none" y="515" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="37M4PIbBIbTx" showstereotype="1" text="2.2.1: phy_rx_prepare (short_ppdu=true)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="319" x="494" fillcolor="none" y="354" operation="phy msg RX (station_id=2, tx_id=n, src_station_id=1)" linewidth="none" widgetbid="UzpajIea0XQC" height="8" usefillcolor="1" seqnum="2.1.2" textid="Q9fmWfwVXIRK" widgetaid="TEq0CDwjmGJP" isinstance="0" xmi.id="6pUz2zEfdQkC" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="390" x="499" fillcolor="none" y="332" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="Q9fmWfwVXIRK" text="2.1.2: phy msg RX (station_id=2, tx_id=n, src_station_id=1)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="319" x="494" fillcolor="none" y="630" operation="phy msg MPDU PAYLOAD (station_id=1, tx_id=n)" linewidth="none" widgetbid="TEq0CDwjmGJP" height="8" usefillcolor="1" seqnum="3.1" textid="BygjONyynXM1" widgetaid="UzpajIea0XQC" isinstance="0" xmi.id="uRpeGm54E613" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="350" x="499" fillcolor="none" y="608" linewidth="none" posttext="" role="704" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="BygjONyynXM1" showstereotype="1" text="3.1: phy msg MPDU PAYLOAD (station_id=1, tx_id=n)" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" />
+ </messagewidget>
+ <messagewidget usesdiagramfillcolor="1" width="48" x="150" fillcolor="none" y="664" operation="tx_id++" linewidth="none" widgetbid="wsGISdwu93Fw" height="32" usefillcolor="1" seqnum="4" textid="dA4iPXnEjCVb" widgetaid="wsGISdwu93Fw" isinstance="0" xmi.id="3DGqw8zT8FYD" sequencemessagetype="1001" showstereotype="1" usesdiagramusefillcolor="1" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="none" >
+ <floatingtext usesdiagramfillcolor="1" width="76" x="155" fillcolor="none" y="642" linewidth="none" posttext="" role="705" height="22" usefillcolor="1" pretext="" isinstance="0" xmi.id="dA4iPXnEjCVb" showstereotype="1" text="4: tx_id++" 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="1100" snapy="10" showatts="1" xmi.id="ZpAs8xwGrNaW" documentation="" type="1" showops="1" showpackage="1" name="class diagram channel settings" localid="" showstereotype="1" showscope="1" snapcsgrid="0" font="Sans Serif,10,-1,0,50,0,0,0,0,0" linecolor="#ff0000" canvasheight="1107" >
+ <widgets>
+ <classwidget usesdiagramfillcolor="0" width="908" showattsigs="601" x="72" fillcolor="#ffffc0" y="42" showopsigs="601" linewidth="none" height="396" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="PGF0sP6Kgb0l" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="449" showattsigs="601" x="199" fillcolor="#ffffc0" y="941" showopsigs="601" linewidth="none" height="162" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="VsbjUz1jzxim" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ <classwidget usesdiagramfillcolor="0" width="1079" showattsigs="601" x="17" fillcolor="#ffffc0" y="486" showopsigs="601" linewidth="none" height="378" usefillcolor="1" showpubliconly="0" showattributes="1" isinstance="0" xmi.id="HjupUSYowhI4" showoperations="1" showpackage="1" showscope="1" showstereotype="1" usesdiagramusefillcolor="0" font="Sans Serif,10,-1,5,75,0,0,0,0,0" linecolor="#ff0000" />
+ </widgets>
+ <messages/>
+ <associations>
+ <assocwidget totalcounta="2" indexa="1" visibilityB="200" totalcountb="2" indexb="1" linewidth="none" widgetbid="VsbjUz1jzxim" widgetaid="HjupUSYowhI4" xmi.id="ZSwkq19bojv2" type="510" changeabilityA="900" changeabilityB="900" linecolor="none" visibilityA="200" >
+ <linepath>
+ <startpoint startx="221" starty="864" />
+ <endpoint endx="221" endy="941" />
+ </linepath>
+ <floatingtext usesdiagramfillcolor="1" width="64" x="161" fillcolor="none" y="917" linewidth="none" posttext="" role="710" height="22" usefillcolor="1" pretext="+" isinstance="0" xmi.id="RACYAu1DgR4Z" showstereotype="1" text="mPoint" 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: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="NdBn9ALHuRov" documentation="" uniqueid="KS7s5wEPMgTu" />
+ <listview>
+ <listitem open="1" type="800" label="Views" >
+ <listitem open="1" type="801" id="Logical View" >
+ <listitem open="0" type="813" id="FA5tCgQO5jOX" >
+ <listitem open="0" type="814" id="vLNKsMwHnQ5O" />
+ <listitem open="0" type="814" id="uHZmB3x8YrWn" />
+ <listitem open="0" type="814" id="EPgLV4JWKVtq" />
+ <listitem open="0" type="814" id="iNWc4oZxCl7B" />
+ <listitem open="0" type="814" id="GQR4rnp7JCzr" />
+ <listitem open="0" type="814" id="GewSP3dgS2iJ" />
+ <listitem open="0" type="814" id="pXR9jOynPIoD" />
+ <listitem open="0" type="815" id="PNXlmw9fnFuL" />
+ <listitem open="0" type="815" id="y8L4KAg9702o" />
+ <listitem open="0" type="815" id="LRN0s3UGfAwm" />
+ <listitem open="0" type="815" id="MTBnuIpE5I5h" />
+ <listitem open="0" type="815" id="qrweJyXfPgQH" />
+ <listitem open="0" type="815" id="OS6l8U35hW6C" />
+ <listitem open="0" type="815" id="jRbAQQ47XE3x" />
+ <listitem open="0" type="815" id="qQZrSJeClEK9" />
+ <listitem open="0" type="815" id="OZe7W5VrVgaA" />
+ <listitem open="0" type="815" id="09RFjqmd0dax" />
+ <listitem open="0" type="815" id="fYXdFW0u7v45" />
+ <listitem open="0" type="815" id="BALxxO2awYCA" />
+ <listitem open="0" type="815" id="dGNRBZuSsh40" />
+ <listitem open="0" type="815" id="XLTP0YPPGkf1" />
+ <listitem open="0" type="815" id="2s4IahHvPPAX" />
+ <listitem open="0" type="815" id="z7iRgeJqCCrj" />
+ <listitem open="0" type="815" id="jfqqWYV4W41s" />
+ <listitem open="0" type="815" id="P3rRYhqHMh6s" />
+ <listitem open="0" type="815" id="jyRgGnpfqf5M" />
+ <listitem open="0" type="815" id="XOXms3hJA084" />
+ <listitem open="0" type="815" id="k41t27vK3XoF" />
+ <listitem open="0" type="815" id="o0LrX74wtWDl" />
+ <listitem open="0" type="815" id="wAYHYS5t16DH" />
+ </listitem>
+ <listitem open="0" type="813" id="HjupUSYowhI4" >
+ <listitem open="0" type="814" id="ZSwkq19bojv2" />
+ <listitem open="0" type="814" id="Ge7RT8Ckq5ZI" />
+ <listitem open="0" type="814" id="V57RkPTHrQ2f" />
+ <listitem open="0" type="814" id="P9GDsAF7oLYH" />
+ <listitem open="0" type="815" id="4DctbcZ0lnEe" />
+ <listitem open="0" type="815" id="xRjlmH0Ez1Tl" />
+ <listitem open="0" type="815" id="0eBxdci9ekFK" />
+ <listitem open="0" type="815" id="DjaPUCMSoVQR" />
+ <listitem open="0" type="815" id="66Ykoo2IT5gA" />
+ <listitem open="0" type="815" id="nowhba6bZwOz" />
+ <listitem open="0" type="815" id="jtReTM98izcO" />
+ <listitem open="0" type="815" id="huvhfiqMaF13" />
+ <listitem open="0" type="815" id="c8CI5oguNdiw" />
+ <listitem open="0" type="815" id="Uc44r38RCKjF" />
+ <listitem open="0" type="815" id="I0RSI9iPWrpV" />
+ <listitem open="0" type="815" id="fD4zThhtEUMY" />
+ <listitem open="0" type="815" id="qEuK4jnjvsgO" />
+ <listitem open="0" type="815" id="o3dYjumm81LP" />
+ <listitem open="0" type="815" id="rCiZ34ts7WOo" />
+ <listitem open="0" type="815" id="no29iM1Z9CGC" />
+ </listitem>
+ <listitem open="0" type="813" id="VsbjUz1jzxim" >
+ <listitem open="0" type="814" id="hRU6f1aVcHyc" />
+ <listitem open="0" type="814" id="IhZENLi13oFI" />
+ <listitem open="0" type="815" id="0zDce8bMX5QB" />
+ <listitem open="0" type="815" id="kVbwfpKRKEVh" />
+ <listitem open="0" type="815" id="rGEtgzA0EaD8" />
+ <listitem open="0" type="815" id="5iOQmRPfmnrL" />
+ <listitem open="0" type="815" id="OeSEtgTyOpM9" />
+ <listitem open="0" type="815" id="Vo4VsHm3o6I5" />
+ </listitem>
+ <listitem open="0" type="813" id="PGF0sP6Kgb0l" >
+ <listitem open="0" type="814" id="YzQ8Jmmx2Rx1" />
+ <listitem open="0" type="814" id="C8LZTmT1jr71" />
+ <listitem open="0" type="814" id="ECT43sTE9tu7" />
+ <listitem open="0" type="814" id="8uij0qPBhzDF" />
+ <listitem open="0" type="814" id="dsqJeeDqqfut" />
+ <listitem open="0" type="815" id="N1iX9W91mjbs" />
+ <listitem open="0" type="815" id="cnVd2iEDTGap" />
+ <listitem open="0" type="815" id="dccFV5HKv9Wt" />
+ <listitem open="0" type="815" id="CRgGs5fVq86t" />
+ <listitem open="0" type="815" id="rJ3xOwjhyyGc" />
+ <listitem open="0" type="815" id="P5CYI2l7Km5i" />
+ <listitem open="0" type="815" id="goPeldGm16Ol" />
+ <listitem open="0" type="815" id="iiALeHZ1Njaf" />
+ <listitem open="0" type="815" id="dWaTBSKgoPJ3" />
+ <listitem open="0" type="815" id="M3QGTU7iw8dM" />
+ <listitem open="0" type="815" id="AB0zYJ2vLR9m" />
+ <listitem open="0" type="815" id="kSxc26GHOJiP" />
+ <listitem open="0" type="815" id="BSaEFiqHsNgS" />
+ <listitem open="0" type="815" id="dzYH8IvKHpvW" />
+ <listitem open="0" type="815" id="w6NMjCexlRoY" />
+ <listitem open="0" type="815" id="Z1yyRvzefObL" />
+ </listitem>
+ <listitem open="1" type="813" id="zSo720DHUtK4" />
+ <listitem open="0" type="813" id="kbTW3DFGwneP" />
+ <listitem open="0" type="813" id="aXMfZ9tQ8GTx" >
+ <listitem open="0" type="814" id="FsOabmphHzei" />
+ <listitem open="0" type="814" id="jNPug1TGWnt5" />
+ </listitem>
+ <listitem open="0" type="813" id="MJNkMwYhFv8H" >
+ <listitem open="0" type="815" id="11oV4ziv3AYN" />
+ <listitem open="0" type="815" id="YYbhCSZWluH5" />
+ <listitem open="0" type="815" id="qnn4itLhu9Bz" />
+ <listitem open="0" type="815" id="bWALx5iDCipN" />
+ <listitem open="0" type="815" id="AGEpQZVz3eK0" />
+ <listitem open="0" type="815" id="d3GgfZfOZoHG" />
+ <listitem open="0" type="815" id="PujNU9MyUc3R" />
+ <listitem open="0" type="815" id="hYiS0RDqSc09" />
+ <listitem open="0" type="815" id="qCYOB46xZJIN" />
+ <listitem open="0" type="815" id="34qsc33QFZoO" />
+ <listitem open="0" type="815" id="WhMdFTMpdTdI" />
+ <listitem open="0" type="815" id="tCCndBu9sGk6" />
+ </listitem>
+ <listitem open="0" type="813" id="5VCzTkjjCKbZ" />
+ <listitem open="0" type="813" id="P5iAKaTM6Drb" />
+ <listitem open="1" type="813" id="ka695HsLyRqa" />
+ <listitem open="1" type="813" id="OMC8n0NgoyNC" />
+ <listitem open="1" type="813" id="y0Zndhh8NjGq" />
+ <listitem open="1" type="813" id="EPI1UgANf3xg" />
+ <listitem open="1" type="813" id="zwpATNw5hYwj" />
+ <listitem open="1" type="813" id="J5I5GN6BUVNH" />
+ <listitem open="0" type="813" id="r6SeLQ0E8ets" />
+ <listitem open="0" type="813" id="nNLPS46tYU5B" />
+ <listitem open="1" type="813" id="5hM3oO8IvMZa" />
+ <listitem open="1" type="813" id="71EBB6ZerqDE" />
+ <listitem open="0" type="813" id="p0EIenqzKrdV" >
+ <listitem open="0" type="814" id="ihYvkGnalcj8" />
+ <listitem open="0" type="814" id="DcQ21IYgvf4A" />
+ <listitem open="0" type="814" id="0PpuG29IN9r4" />
+ <listitem open="0" type="815" id="lRK3GxXGwC31" />
+ <listitem open="0" type="815" id="tGjpAvxFMVQv" />
+ <listitem open="0" type="815" id="2UAE6pa80TlD" />
+ <listitem open="0" type="815" id="iRfrv7uIeAaZ" />
+ </listitem>
+ <listitem open="1" type="813" id="xbRaG9lhs3GA" />
+ <listitem open="1" type="813" id="t1tc2bTZdTo7" />
+ <listitem open="1" type="813" id="iF6aeCsJls2b" />
+ <listitem open="0" type="813" id="0IENWuVgMRRQ" />
+ <listitem open="1" type="813" id="ouQgLFbCZBH6" />
+ <listitem open="1" type="813" id="MjbCnbmzupQK" />
+ <listitem open="1" type="813" id="R2g1PPyRrFdJ" />
+ <listitem open="1" type="813" id="QCc0kys9xMnl" />
+ <listitem open="1" type="813" id="0ZbYQWqDJFyR" />
+ <listitem open="1" type="813" id="pnRk9DVlgulU" />
+ <listitem open="1" type="813" id="OTUqbbMS8cB5" />
+ <listitem open="1" type="813" id="NNrPbFIBbTWJ" />
+ <listitem open="0" type="813" id="umW20xxGpJoP" >
+ <listitem open="0" type="815" id="3d6Ick1K5QEl" />
+ </listitem>
+ <listitem open="0" type="813" id="ek5GEEjxefv1" />
+ <listitem open="1" type="813" id="rGkvr2wbb0ig" />
+ <listitem open="1" type="813" id="ACuye0MTG4P7" />
+ <listitem open="1" type="813" id="CvLZ2CQ63P41" />
+ <listitem open="1" type="813" id="pKHo6OTH6XRU" />
+ <listitem open="1" type="813" id="TwO4O4jLDIiP" />
+ <listitem open="0" type="813" id="7rs81OTZw4E7" />
+ <listitem open="0" type="813" id="eNNzwM7vtyZm" />
+ <listitem open="1" type="813" id="MMOOLBCfmrGJ" />
+ <listitem open="1" type="813" id="yBbPCZ8HGSK2" />
+ <listitem open="1" type="813" id="eniEjhTPROwl" />
+ <listitem open="1" type="813" id="ryY5K4jdy734" />
+ <listitem open="1" type="813" id="IVIVFrTsSA9W" />
+ <listitem open="1" type="813" id="Y2z0vH5PWhVj" />
+ <listitem open="1" type="813" id="IW1PTWwAuJXf" />
+ <listitem open="1" type="813" id="SRA7JvZo6AuO" />
+ <listitem open="0" type="818" id="uPECzXJFnTOn" >
+ <listitem open="0" type="813" id="IWPuXt3VypIz" />
+ </listitem>
+ <listitem open="0" type="818" id="6elj96McODtx" >
+ <listitem open="0" type="813" id="qYY4ISujM3Ed" />
+ <listitem open="0" type="813" id="AlwnfvQ24tqq" />
+ </listitem>
+ <listitem open="0" type="830" id="Datatypes" >
+ <listitem open="0" type="829" id="5ToJ3zPrsGFF" />
+ <listitem open="0" type="829" id="3YkVVg8j3o2Y" />
+ <listitem open="0" type="829" id="rxKsjMRYfTiU" />
+ <listitem open="0" type="829" id="b4ob1ibWBqLq" />
+ <listitem open="0" type="829" id="8gZ2im9FZlVF" />
+ <listitem open="0" type="829" id="tq6FaofPTzwd" />
+ <listitem open="1" type="829" id="txbVRO36HpfQ" />
+ <listitem open="1" type="829" id="JcPKyEye9iP3" />
+ <listitem open="0" type="829" id="448sjDF59poj" />
+ <listitem open="0" type="829" id="psrQPqT9L430" />
+ <listitem open="0" type="829" id="zypnSFDYKlG8" />
+ <listitem open="0" type="829" id="PfzwSs1KcVMd" />
+ <listitem open="0" type="829" id="oL4FZe2AHfNk" />
+ <listitem open="0" type="829" id="kj4rGrwwW6er" />
+ <listitem open="0" type="829" id="WzilSttBcw0q" />
+ <listitem open="0" type="829" id="NBTpmTxZCmcb" />
+ <listitem open="0" type="829" id="m2IzC9ii2UsR" />
+ <listitem open="0" type="829" id="mXu6MdkX4QlH" />
+ <listitem open="0" type="829" id="ARgEDvWDshpX" />
+ <listitem open="0" type="829" id="hfBiNMiT2GVk" />
+ <listitem open="0" type="829" id="HSbuMHwp53nG" />
+ <listitem open="0" type="829" id="fLpWgryb0030" />
+ <listitem open="0" type="829" id="1XretJvqfug3" />
+ <listitem open="0" type="829" id="su73E4iG7Y8j" />
+ <listitem open="0" type="829" id="X118ilRkx2cY" />
+ <listitem open="1" type="829" id="LRcU81Wzx7SM" />
+ <listitem open="1" type="829" id="ZJ5BrRm819Tz" />
+ <listitem open="1" type="829" id="agtmZAmehdXM" />
+ <listitem open="1" type="829" id="dpMdwnaHDClJ" />
+ <listitem open="1" type="829" id="VVSkI78sPE3E" />
+ <listitem open="0" type="829" id="PVMPlwqpaaYi" />
+ <listitem open="0" type="829" id="LlOVV04Zpapx" />
+ <listitem open="1" type="829" id="GgbUcB1crO0m" />
+ <listitem open="0" type="829" id="WndGhsLWd8YJ" />
+ <listitem open="0" type="829" id="41M2qczWxT6z" />
+ <listitem open="1" type="829" id="CFI9MjVrEwaX" />
+ <listitem open="0" type="829" id="BVdJY7XV1Crz" />
+ <listitem open="1" type="829" id="mjQxu9G6PXDl" />
+ <listitem open="1" type="829" id="1iPQuScWFz9B" />
+ </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="C++" />
+ </codegeneration>
+ </XMI.extensions>
+</XMI>
diff --git a/cesar/maximus/python/lib/cesar/maximus_dur.py b/cesar/maximus/python/lib/cesar/maximus_dur.py
new file mode 100644
index 0000000000..1c5e08232c
--- /dev/null
+++ b/cesar/maximus/python/lib/cesar/maximus_dur.py
@@ -0,0 +1,97 @@
+#! usr/bin/env python
+
+#print __name__
+
+from interface import *
+from maximus.station.sta import PHY_CARRIER_NB
+
+def maximus_dur_carrier_nb(maximus, station, tonemask):
+ """Counts the number of used carriers.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ tonemask - must be a bits field (note: you can use the method "get_tonemask()" of the STA class)
+ Returns number of carriers.
+ """
+ # Create and send a function call to call the following Maximus duration function:
+ # "uint maximus_dur_carrier_nb (const u8 *tonemask);"
+ rsp = maximus.create_fcall("maximus_dur_carrier_nb")\
+ .add_param("tonemask", tonemask)\
+ .send(station)
+ return rsp.bind_param_ulong("carrier_nb")
+
+def maximus_dur_bits_per_symbol(maximus, station, mod, tonemask, tonemap, carrier_nb):
+ """Computes the number of bits per OFDM symbol.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ mod - PHY modulation
+ tonemask - must be a bits field (note: you can use the method "get_tonemask()" of the STA class)
+ tonemap - must be a bits field or None for ROBO modes
+ carrier_nb - number of carriers for this tonemap
+ Returns the number of bits per OFDM symbol.
+ """
+ # Create and send a function call to call the following Maximus duration function:
+ # "uint maximus_dur_bits_per_symbol (phy_mod_t mod, const u8 *tonemask, const blk_t *tonemap, uint carrier_nb);"
+ if tonemap is None:
+ tonemap = ((PHY_CARRIER_NB + 1) / 2) * '\0'
+ rsp = maximus.create_fcall("maximus_dur_bits_per_symbol")\
+ .add_param_ulong("mod", mod)\
+ .add_param("tonemask", tonemask)\
+ .add_param("tonemap", tonemap)\
+ .add_param_ulong("carrier_nb", carrier_nb)\
+ .send(station)
+ return rsp.bind_param_ulong("bits_per_symbol")
+
+def maximus_dur_symbol_nb(maximus, station, fecrate, pb_size, bits_per_symbol, pb_nb):
+ """Computes the number of symbols for a given number of PB.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ fecrate - FEC encoding rate
+ pb_size - PB size
+ bits_per_symbol - number of bits per symbol
+ pb_nb - PB number
+ Returns the number of used symbols.
+ """
+ # Create and send a function call to call the following Maximus duration function:
+ # "uint maximus_dur_symbol_nb (phy_fecrate_t fecrate, phy_pb_size_t pb_size, uint bits_per_symbol, uint pb_nb);"
+ rsp = maximus.create_fcall("maximus_dur_symbol_nb")\
+ .add_param_ulong("fecrate", fecrate)\
+ .add_param_ulong("pb_size", pb_size)\
+ .add_param_ulong("bits_per_symbol", bits_per_symbol)\
+ .add_param_ulong("pb_nb", pb_nb)\
+ .send(station)
+ return rsp.bind_param_ulong("symbol_nb")
+
+def maximus_dur_data_tck(maximus, station, gil, symbol_nb):
+ """Computes the duration of the data part of a frame for a given number of symbols.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ gil - guard interval for third symbol and following symbols
+ symbol_nb - number of OFDM symbols
+ Returns the duration in ticks.
+ """
+ # Create and send a function call to call the following Maximus duration function:
+ # "uint maximus_dur_data_tck (phy_gil_t gil, uint symbol_nb);"
+ rsp = maximus.create_fcall("maximus_dur_data_tck")\
+ .add_param_ulong("gil", gil)\
+ .add_param_ulong("symbol_nb", symbol_nb)\
+ .send(station)
+ return rsp.bind_param_ulong("data_tck")
+
+def maximus_dur(maximus, station, tonemask, mod, tonemap, fecrate, pb_size, pb_nb, gil):
+ """Computes the duration of the data part of a frame.
+ maximus - the Maximus object, already initialized
+ station - the destination station (note: you can use the method "get()" of the STA class)
+ tonemask - must be a bits field (note: you can use the method "get_tonemask()" of the STA class)
+ mod - PHY modulation
+ tonemap - must be a bits field or None for ROBO modes
+ fecrate - FEC encoding rate
+ pb_size - PB size
+ pb_nb - PB number
+ gil - guard interval for third symbol and following symbols
+ Returns the duration in ticks.
+ """
+ return maximus_dur_data_tck(maximus, station, gil,\
+ maximus_dur_symbol_nb(maximus, station, fecrate, pb_size,\
+ maximus_dur_bits_per_symbol(maximus, station, mod, tonemask, tonemap,\
+ maximus_dur_carrier_nb(maximus, station, tonemask)),\
+ pb_nb))
diff --git a/cesar/maximus/python/lib/cesar/sta_cesar.py b/cesar/maximus/python/lib/cesar/sta_cesar.py
new file mode 100644
index 0000000000..bf02b23e4e
--- /dev/null
+++ b/cesar/maximus/python/lib/cesar/sta_cesar.py
@@ -0,0 +1,44 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.station import *
+from string import *
+
+# Find constant defining the additional number of MME buffers to allocate into the station
+base = '../../../../'
+header = 'interface/interface.h'
+define = 'INTERFACE_BUFFER_LIST_NUM_SLOTS'
+f = open(__file__[:__file__.find(".py") - len(__name__)] + base + header, 'r') # or ".pyc"
+s = f.read()
+f.close()
+begin = s.find(define) + len(define)
+while s[begin] == " " or s[begin] == "\t":
+ begin += 1
+end = begin
+while s[end] in digits: # digits is the string '0123456789'
+ end += 1
+INTERFACE_BUFFER_LIST_NUM_SLOTS = int(s[begin:end])
+
+def STACesar(maximus,\
+ executable = None,\
+ debug = False,\
+ name = None,\
+ data_buffer_nb=0,\
+ mme_buffer_nb=1,\
+ interface_buffer_nb=0,\
+ config_mode = 'MME',\
+ config = Config()):
+ """This function creates a STA object with the given arguments,
+ with an additional number of MME buffers to allocate into the station,
+ and returns the created STA object.
+ """
+ return STA(maximus,\
+ executable = executable,\
+ debug = debug,\
+ name = name,\
+ data_buffer_nb=data_buffer_nb,\
+ mme_buffer_nb=mme_buffer_nb,\
+ interface_buffer_nb=INTERFACE_BUFFER_LIST_NUM_SLOTS,\
+ config_mode = config_mode,\
+ config = config)
diff --git a/cesar/maximus/python/lib/fcVf/__init__.py b/cesar/maximus/python/lib/fcVf/__init__.py
new file mode 100644
index 0000000000..ae0fc2de39
--- /dev/null
+++ b/cesar/maximus/python/lib/fcVf/__init__.py
@@ -0,0 +1 @@
+from fcVfFields import *
diff --git a/cesar/maximus/python/lib/fcVf/crc24/__init__.py b/cesar/maximus/python/lib/fcVf/crc24/__init__.py
new file mode 100644
index 0000000000..96bcf63b8d
--- /dev/null
+++ b/cesar/maximus/python/lib/fcVf/crc24/__init__.py
@@ -0,0 +1 @@
+from pycrc24 import *
diff --git a/cesar/maximus/python/lib/fcVf/crc24/crc24.py b/cesar/maximus/python/lib/fcVf/crc24/crc24.py
new file mode 100644
index 0000000000..3f453d6271
--- /dev/null
+++ b/cesar/maximus/python/lib/fcVf/crc24/crc24.py
@@ -0,0 +1,84 @@
+# -*- coding: Latin-1 -*-
+
+
+# Class Options
+###############################################################################
+class Options(object):
+ """
+ The options parsing and validationg class
+ """
+
+ """
+ Bitmap of the algorithms
+ """
+ Algo_None = 0x00
+ Algo_Bit_by_Bit = 0x01
+ Algo_Bit_by_Bit_Fast = 0x02
+ Algo_Table_Driven = 0x04
+
+ # Class constructor
+ ###############################################################################
+ def __init__(self, version):
+ self.ProgramName = "pycrc"
+ self.Version = version
+ self.VersionStr = "%s v%s" % (self.ProgramName, self.Version)
+ self.WebAddress = "http://www.tty1.net/pycrc/"
+ self.Width = None
+ self.Poly = None
+ self.ReflectIn = None
+ self.XorIn = None
+ self.ReflectOut = None
+ self.XorOut = None
+ self.TableIdxWidth = 8
+ self.TableWidth = 1 << self.TableIdxWidth
+ self.Verbose = False
+ self.CheckString = "123456789"
+
+ self.Algorithm = self.Algo_None
+ self.SymbolPrefix = "crc_"
+ self.OutputFile = None
+ self.Action = "check_string"
+ self.CStd = None
+
+
+ #CRC24 :
+ self.Width=24
+ self.Poly=0x864cfbL
+ self.ReflectIn=False
+ self.XorIn=0xb704ceL
+ self.ReflectOut=False
+ self.XorOut=0x0L
+ self.parse()
+
+
+ # function parse
+ ###############################################################################
+ def parse(self):
+ """
+ Parses and validates the options given as arguments
+ """
+ if self.Width != None:
+ if self.Width <= 0:
+ sys.stderr.write("Error: Width must be strictly positive\n")
+ sys.exit(1)
+ self.MSB_Mask = 0x1 << (self.Width - 1)
+ self.Mask = ((self.MSB_Mask - 1) << 1) | 1
+ if self.Poly != None:
+ self.Poly = self.Poly & self.Mask
+ if self.XorIn != None:
+ self.XorIn = self.XorIn & self.Mask
+ if self.XorOut != None:
+ self.XorOut = self.XorOut & self.Mask
+ else:
+ self.MSB_Mask = None
+ self.Mask = None
+
+ if self.Width == None or \
+ self.Poly == None or \
+ self.ReflectIn == None or \
+ self.XorIn == None or \
+ self.ReflectOut == None or \
+ self.XorOut == None:
+ self.UndefinedCrcParameters = True
+ else:
+ self.UndefinedCrcParameters = False
diff --git a/cesar/maximus/python/lib/fcVf/crc24/crc24_algorithms.py b/cesar/maximus/python/lib/fcVf/crc24/crc24_algorithms.py
new file mode 100644
index 0000000000..9158758dd4
--- /dev/null
+++ b/cesar/maximus/python/lib/fcVf/crc24/crc24_algorithms.py
@@ -0,0 +1,172 @@
+# -*- coding: Latin-1 -*-
+
+# Class Crc
+###############################################################################
+class Crc(object):
+ """
+ A base class for CRC routines.
+ """
+
+ # constructor
+ ###############################################################################
+ def __init__(self, opt):
+ """The Crc constructor.
+
+ The opt parameter is an object containing the following members:
+ Width
+ Poly
+ ReflectIn
+ XorIn
+ ReflectOut
+ XorOut
+ """
+ self.Width = opt.Width
+ self.Poly = opt.Poly
+ self.ReflectIn = opt.ReflectIn
+ self.XorIn = opt.XorIn
+ self.ReflectOut = opt.ReflectOut
+ self.XorOut = opt.XorOut
+
+ self.MSB_Mask = 0x1 << (opt.Width - 1)
+ self.Mask = ((opt.MSB_Mask - 1) << 1) | 1
+ if opt.TableIdxWidth != None:
+ self.TableIdxWidth = opt.TableIdxWidth
+ self.TableWidth = 1 << opt.TableIdxWidth
+ else:
+ self.TableIdxWidth = 8
+ self.TableWidth = 1 << self.TableIdxWidth
+
+ # function reflect
+ ###############################################################################
+ def reflect(self, data, width):
+ """
+ reflects a data word, i.e. reverts the bit order
+ """
+ x = 0
+ for i in range(width):
+ x = x | (((data >> (width - i -1)) & 1) << i)
+ return x
+
+ # function handle_bit
+ ###############################################################################
+ def __handle_bit(self, register, new_bit):
+ """
+ This function is part of the bit_by_bit algorithm.
+ It function takes one bit from the augmented message as argument and returns the new crc value
+ """
+ register_msb = register & self.MSB_Mask
+ register = (register << 1) & self.Mask
+ if new_bit != 0:
+ register = register | 1
+ if register_msb != 0:
+ register = register ^ self.Poly
+ return register & self.Mask
+
+ # function bit_by_bit
+ ###############################################################################
+ def bit_by_bit(self, str):
+ """
+ Classic simple and slow CRC implementation.
+ This function iterates bit by bit over the augmented input message and returns the calculated CRC value at the end
+ """
+ register = self.XorIn
+ for j in range(self.Width):
+ bit = register & 1
+ if bit != 0:
+ register = ((register ^ self.Poly) >> 1) | self.MSB_Mask
+ else:
+ register = register >> 1
+ register &= self.Mask
+
+ for i in range(len(str)):
+ octet = ord(str[i])
+ if self.ReflectIn:
+ octet = self.reflect(octet, 8)
+ for j in range(8):
+ new_bit = octet & (0x80 >> j)
+ register = self.__handle_bit(register, new_bit)
+ for j in range(self.Width):
+ register = self.__handle_bit(register, 0)
+
+ if self.ReflectOut:
+ register = self.reflect(register, self.Width)
+ register = register ^ self.XorOut
+ return register
+
+ # function bit_by_bit_fast
+ ###############################################################################
+ def bit_by_bit_fast(self, str):
+ """
+ This is a slightly modified version of the bit_by_bit algorithm: it does not need to loop over the augmented bit,
+ i.e. the Width 0-bits wich are appended to the input message in the bit_by_bit algorithm.
+ """
+ register = self.XorIn
+
+ for i in range(len(str)):
+ octet = ord(str[i])
+ if self.ReflectIn:
+ octet = self.reflect(octet, 8)
+ for j in range(8):
+ bit = register & self.MSB_Mask
+ register <<= 1
+ if octet & (0x80 >> j):
+ bit ^= self.MSB_Mask
+ if bit:
+ register ^= self.Poly
+ register &= self.Mask
+ if self.ReflectOut:
+ register = self.reflect(register, self.Width)
+ register = register ^ self.XorOut
+ return register
+
+ # function gen_table
+ ###############################################################################
+ def gen_table(self):
+ """
+ This function generates the CRC table used for the table_driven CRC algorithm.
+ The Python version cannot handle tables of a different size rather than 8.
+ See the generated C code for tables with different sizes instead.
+ """
+ tbl = {}
+ for i in range(1 << self.TableIdxWidth):
+ register = i
+ if self.ReflectIn:
+ register = self.reflect(register, self.TableIdxWidth)
+ register = register << (self.Width - self.TableIdxWidth)
+ for j in range(self.TableIdxWidth):
+ if register & self.MSB_Mask != 0:
+ register = (register << 1) ^ self.Poly
+ else:
+ register = (register << 1)
+ if self.ReflectIn:
+ register = self.reflect(register, self.Width)
+ tbl[i] = register & self.Mask
+ return tbl
+
+ # function table_driven
+ ###############################################################################
+ def table_driven(self, str):
+ """
+ The Standard table_driven CRC algorithm.
+ """
+ tbl = self.gen_table()
+
+ if not self.ReflectIn:
+ register = self.XorIn
+ for i in range(len(str)):
+ octet = ord(str[i])
+ tblidx = ((register >> (self.Width - 8)) ^ octet) & 0xff
+ register = ((register << 8) ^ tbl[tblidx]) & self.Mask
+ else:
+ register = self.reflect(self.XorIn, self.Width)
+ for i in range(len(str)):
+ octet = ord(str[i])
+ tblidx = (register ^ octet) & 0xff
+ register = ((register >> 8) ^ tbl[tblidx]) & self.Mask
+ register = self.reflect(register, self.Width)
+
+ if self.ReflectOut:
+ register = self.reflect(register, self.Width)
+ register = register ^ self.XorOut
+ return register
+
diff --git a/cesar/maximus/python/lib/fcVf/crc24/pycrc24.py b/cesar/maximus/python/lib/fcVf/crc24/pycrc24.py
new file mode 100644
index 0000000000..2f8f4df7fc
--- /dev/null
+++ b/cesar/maximus/python/lib/fcVf/crc24/pycrc24.py
@@ -0,0 +1,44 @@
+# -*- coding: Latin-1 -*-
+
+from crc24 import Options
+from crc24_algorithms import Crc
+
+
+# function check_string
+###############################################################################
+def check_string(myString):
+
+
+ opt=Options("0.6.4")
+ opt.CheckString=myString
+ """
+ Returns the calculated CRC sum of a string
+ """
+ if opt.UndefinedCrcParameters:
+ sys.stderr.write("Error: undefined parameters\n")
+ sys.exit(1)
+ if opt.Algorithm == 0:
+ opt.Algorithm = opt.Algo_Bit_by_Bit | opt.Algo_Bit_by_Bit_Fast | opt.Algo_Table_Driven
+
+ alg = Crc(opt)
+ crc = this_crc = None
+ if opt.Algorithm & opt.Algo_Bit_by_Bit:
+ this_crc = alg.bit_by_bit(opt.CheckString)
+ if crc != None and this_crc != crc:
+ sys.stderr.write("Error: different checksums: 0x%x, 0x%x\n" % (this_crc, crc))
+ sys.exit(1)
+ crc = this_crc
+ if opt.Algorithm & opt.Algo_Bit_by_Bit_Fast:
+ this_crc = alg.bit_by_bit_fast(opt.CheckString)
+ if crc != None and this_crc != crc:
+ sys.stderr.write("Error: different checksums: 0x%x, 0x%x\n" % (this_crc, crc))
+ sys.exit(1)
+ crc = this_crc
+ if opt.Algorithm & opt.Algo_Table_Driven:
+ opt.TableIdxWidth = 8 # FIXME cowardly refusing to use less bits for the table
+ this_crc = alg.table_driven(opt.CheckString)
+ if crc != None and this_crc != crc:
+ sys.stderr.write("Error: different checksums: 0x%x, 0x%x\n" % (this_crc, crc))
+ sys.exit(1)
+ crc = this_crc
+ return crc
diff --git a/cesar/maximus/python/lib/fcVf/fcVfFields.py b/cesar/maximus/python/lib/fcVf/fcVfFields.py
new file mode 100644
index 0000000000..8adefcba91
--- /dev/null
+++ b/cesar/maximus/python/lib/fcVf/fcVfFields.py
@@ -0,0 +1,758 @@
+# -*- coding:Utf-8 -*-
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+#from maximus import *
+from maximus import FC_AV, MACFrameHeader, MACFrame
+
+#print "Create Frame Control"
+myFC_AV = FC_AV()
+#print "Create MAC Frame Header"
+myMacFrameHeader = MACFrameHeader()
+myMacFrame = MACFrame()
+
+#Frame Control Variant Fields
+
+from struct import *
+
+from math import *
+from random import randrange #random library is used : randrange(),
+from Constants import *
+
+from crc24 import *
+
+
+#FcVfFields lists all fields existing in every Frame Control Variant Fields
+class FcVfFields():
+
+ #Network Encryption Key
+ nek = randrange(0,pow(2,128)-1,1) #Random by default
+ nekField = pack('QQ',nek%pow_2_64,nek/pow_2_64)
+ def createNek(self, myNek=None, myRandomNek=False):
+ if myNek!=None:
+ self.nek = myNek
+ elif myRandomNek==True:
+ self.nek = randrange(0,pow(2,128)-1,1)
+ self.nekField = pack('QQ',self.nek%pow_2_64,self.nek/pow_2_64)
+ print "nek = "+hex(self.nek)
+
+ #Beacon Time Stamp
+ bts = randrange(0,pow(2,32),1) #Random by default
+ btsField = pack('I',bts)
+ def createBts(self, myBts=None):
+ if myBts!=None:
+ self.bts = myBts
+ self.btsField = pack('I',self.bts)
+ print "bts = "+hex(self.bts)
+
+ #Beacon Time Offset
+ bto_0 = randrange(-pow(2,15)+1,pow(2,15)-1,1) #Random by default
+ bto_0Field = pack('h',bto_0)
+ def createBto_0(self, myBto_0=None):
+ if myBto_0!=None:
+ self.bto_0 = myBto_0
+ self.bto_0Field = pack('h',self.bto_0)
+ print "bto_0 = "+hex(self.bto_0)
+
+ #Beacon Time Offset
+ bto_1 = randrange(-pow(2,15)+1,pow(2,15)-1,1) #Random by default
+ bto_1Field = pack('h',bto_1)
+ def createBto_1(self, myBto_1=None):
+ if myBto_1!=None:
+ self.bto_1 = myBto_1
+ self.bto_1Field = pack('h',self.bto_1)
+ print "bto_1 = "+hex(self.bto_1)
+
+ #Beacon Time Offset
+ bto_2 = randrange(-pow(2,15)+1,pow(2,15)-1,1) #Random by default
+ bto_2Field = pack('h',bto_2)
+ def createBto_2(self, myBto_2=None):
+ if myBto_2!=None:
+ self.bto_2 = myBto_2
+ self.bto_2Field = pack('h',self.bto_2)
+ print "bto_2 = "+hex(self.bto_2)
+
+ #Beacon Time Offset
+ bto_3 = randrange(-pow(2,15)+1,pow(2,15)-1,1) #Random by default
+ bto_3Field = pack('h',bto_3)
+ def createBto_3(self, myBto_3=None):
+ if myBto_3!=None:
+ self.bto_3 = myBto_3
+ self.bto_3Field = pack('h',self.bto_3)
+ print "bto_3 = "+hex(self.bto_3)
+
+ #STEI
+ stei = 0
+ steiField = pack('B',stei)
+ def createStei(self, myStei=None):
+ if myStei!=None:
+ self.stei=myStei
+ self.steiField = pack('B',self.stei)
+ print "stei = "+hex(self.stei)
+
+ #DTEI
+ dtei = 0
+ dteiField = pack('B',dtei)
+ def createDtei(self, myDtei=None):
+ if myDtei!=None:
+ self.dtei=myDtei
+ self.dteiField = pack('B',self.dtei)
+ print "dtei = "+hex(self.dtei)
+
+ #LID
+ lid = 0
+ lidField = pack('B',lid)
+ def createLid(self, myLid=None):
+ if myLid!=None:
+ self.lid=myLid
+ self.lidField = pack('B',self.lid)
+ print "lid = "+hex(self.lid)
+
+ cfs = 0 #Contesion Free Session #CSMA Allocation by default
+ bdf = 0 #Beacon detect Flag #Not Heard by default
+ hp10df = 0 #Home Plug 1.0.1 Detect Flag #Not detected by default
+ hp11df = 0 #Home Plug 1.1 Detect Flag #Not detected by default
+ eks = 0 #Encryption Key Select #0 by default
+ cfsBdfHp10dfHp11dfEks = int(cfs + bdf*pow(2,1) + hp10df*pow(2,2) + hp11df*pow(2,3) + eks*pow(2,4))
+ cfsBdfHp10dfHp11dfEksField = pack('B',cfsBdfHp10dfHp11dfEks)
+ def createCfsBdfHp10dfHp11dfEks(self, myCfs=None, myBdf=None, myHp10df=None, myHp11df=None, myEks=None, myCfsBdfHp10dfHp11dfEks=None):
+ if myCfs!=None or myBdf!=None or myHp10df!=None or myHp11df!=None or myEks!=None:
+ if myCfs!=None:
+ self.cfs=myCfs
+ if myBdf!=None:
+ self.bdf=myBdf
+ if myHp10df!=None:
+ self.hp10df=myHp10df
+ if myHp11df!=None:
+ self.hp11df=myHp11df
+ if myEks!=None:
+ self.eks=myEks
+ self.cfsBdfHp10dfHp11dfEks = int(self.cfs + self.bdf*pow(2,1) + self.hp10df*pow(2,2) + self.hp11df*pow(2,3) + self.eks*pow(2,4))
+ if myCfsBdfHp10dfHp11dfEks!=None:
+ self.cfsBdfHp10dfHp11dfEks = myCfsBdfHp10dfHp11dfEks
+ print "cfsBdfHp10dfHp11dfEks = "+hex(self.cfsBdfHp10dfHp11dfEks)
+ else:
+ print "cfs = "+hex(self.cfs)
+ print "bdf = "+hex(self.bdf)
+ print "hp10df = "+hex(self.hp10df)
+ print "hp11df = "+hex(self.hp11df)
+ print "eks = "+hex(self.eks)
+ self.cfsBdfHp10dfHp11dfEksField = pack('B',self.cfsBdfHp10dfHp11dfEks)
+
+ #Pending PHY Blocks
+ intPpb = 0
+ if intPpb >= 16:
+ ppbExponent = max(0,int(log(max(2,intPpb),2))-3)
+ ppbMantissa = max(0,int(16*(intPpb/pow(2,ppbExponent+3)-1)))
+ else:
+ ppbExponent = 0
+ ppbMantissa = intPpb
+ ppb = int(ppbExponent + ppbMantissa*pow(2,4))
+ ppbField = pack('B',ppb)
+ def createPpb(self, myIntPpb=None, myPpb=None):
+ if myIntPpb!=None:
+ self.intPpb=myIntPpb
+ if self.intPpb >= 16:
+ self.ppbExponent = max(0,int(log(max(2,self.intPpb),2))-3)
+ self.ppbMantissa = max(0,int(16*(self.intPpb/pow(2,self.ppbExponent+3)-1)))
+ else:
+ self.ppbExponent = 0
+ self.ppbMantissa = self.intPpb
+ self.ppb = int(self.ppbExponent + self.ppbMantissa*pow(2,4))
+ elif myPpb!=None:
+ self.ppb=myPpb
+ self.ppbField = pack('B',self.ppb)
+ print "ppb = "+hex(self.ppb)
+
+ #Bit Loading Estimation
+ intBle = 0
+ bleExponent = max(0,int(log(max(2,intBle),2))-1)
+ bleMantissa = max(0,int(32*(intBle/pow(2,bleExponent+1)-1)))
+ ble = int(bleExponent + bleMantissa*pow(2,3))
+ bleField = pack('B',ble)
+ def createBle(self, myIntBle=None, myBle=None):
+ if myIntBle!=None:
+ self.intBle=myIntBle
+ self.bleExponent = max(0,int(log(max(2,self.intBle),2))-1)
+ self.bleMantissa = max(0,int(32*(self.intBle/pow(2,self.bleExponent+1)-1)))
+ self.ble = int(self.bleExponent + self.bleMantissa*pow(2,3))
+ if myBle!=None:
+ self.ble=myBle
+ self.bleField = pack('B',self.ble)
+ print "ble = "+hex(self.ble)
+
+ pbSz = 0 #PHY Block Size #520 octets by default
+ numSym = 1 #Number of symbol #1 by default
+ tmi_AV = 0 #Home Plug AV Tone Map Index #ROBO by default
+ pbSzNumSymTmi_AV = int(pbSz + numSym*pow(2,1) + tmi_AV*pow(2,3))
+ pbSzNumSymTmi_AVField = pack('B',pbSzNumSymTmi_AV)
+ def createPbSzNumSymTmi_AV(self, myPbSz=None, myNumSym=None, myTmi_AV=None, myPbSzNumSymTmi_AV=None):
+ if myPbSz!=None or myNumSym!=None or myTmi_AV!=None:
+ if myPbSz!=None:
+ self.pbSz=myPbSz
+ if myNumSym!=None:
+ self.numSym=myNumSym
+ if myTmi_AV!=None:
+ self.tmi_AV=myTmi_AV
+ self.pbSzNumSymTmi_AV = int(self.pbSz + self.numSym*pow(2,1) + self.tmi_AV*pow(2,3))
+ if myPbSzNumSymTmi_AV!=None:
+ self.pbSzNumSymTmi_AV = myPbSzNumSymTmi_AV
+ print "pbSzNumSymTmi_AV = "+hex(self.pbSzNumSymTmi_AV)
+ else:
+ print "pbSz = "+hex(self.pbSz)
+ print "numSym = "+hex(self.numSym)
+ print "tmi_AV = "+hex(self.tmi_AV)
+ self.pbSzNumSymTmi_AVField = pack('B',self.pbSzNumSymTmi_AV)
+
+ fl_AV = 0x3E #Home Plug AV Frame Length #79.36 µs by default
+ mpduCnt = 0 #MPDU Count #not a burst or last by default
+ burstCnt = 0 #Burst Count #0 by default
+ fl_AVMpduCntBurstCnt = int(fl_AV + mpduCnt*pow(2,12) + burstCnt*pow(2,14))
+ fl_AVMpduCntBurstCntField = pack('H',fl_AVMpduCntBurstCnt)
+ def createFl_AVMpduCntBurstCnt(self, myFl_AV=None, myMpduCnt=None, myBurstCnt=None, myFl_AVMpduCntBurstCnt=None):
+ if myFl_AV!=None or myMpduCnt!=None or myBurstCnt!=None:
+ if myFl_AV!=None:
+ self.fl_AV=myFl_AV
+ if myMpduCnt!=None:
+ self.mpduCnt=myMpduCnt
+ if myBurstCnt!=None:
+ self.burstCnt=myBurstCnt
+ self.fl_AVMpduCntBurstCnt = int(self.fl_AV + self.mpduCnt*pow(2,12) + self.burstCnt*pow(2,14))
+ if myFl_AVMpduCntBurstCnt!=None:
+ self.fl_AVMpduCntBurstCnt = myFl_AVMpduCntBurstCnt
+ print "fl_AVMpduCntBurstCnt = "+hex(self.fl_AVMpduCntBurstCnt)
+ else:
+ print "fl_AV = "+hex(self.fl_AV)
+ print "mpduCnt = "+hex(self.mpduCnt)
+ print "burstCnt = "+hex(self.burstCnt)
+ self.fl_AVMpduCntBurstCntField = pack('H',self.fl_AVMpduCntBurstCnt)
+
+ bbf = 0 #Bidirectional Burst Flag #Terminated after this MPDU by default
+ mrtfl = 0 #Max Reverse Transmission FL #163.84 µs by default
+ dcppcf = 0 #Different CP PHY Clock Flag #Not different by default
+ mcf = 0 #Multicast Flag #Unicast by default
+ mnbf = 0 #MultiNetwork Broadcast Flag #0 by default
+ bbfMrtflDcppcfMcfMnbf = int(bbf + mrtfl*pow(2,1) + dcppcf*pow(2,5) + mcf*pow(2,6) + mnbf*pow(2,7))
+ bbfMrtflDcppcfMcfMnbfField = pack('B',bbfMrtflDcppcfMcfMnbf)
+ def createBbfMrtflDcppcfMcfMnbf(self, myBbf=None, myMrtfl=None, myDcppcf=None, myMcf=None, myMnbf=None, myBbfMrtflDcppcfMcfMnbf=None):
+ if myBbf!=None or myMrtfl!=None or myDcppcf!=None or myMcf!=None or myMnbf!=None:
+ if myBbf!=None:
+ self.bbf=myBbf
+ if myMrtfl!=None:
+ self.mrtfl=myMrtfl
+ if myDcppcf!=None:
+ self.dcppcf=myDcppcf
+ if myMcf!=None:
+ self.mcf=myMcf
+ if myMnbf!=None:
+ self.mnbf=myMnbf
+ self.bbfMrtflDcppcfMcfMnbf = int(self.bbf + self.mrtfl*pow(2,1) + self.dcppcf*pow(2,5) + self.mcf*pow(2,6) + self.mnbf*pow(2,7))
+ if myBbfMrtflDcppcfMcfMnbf!=None:
+ self.bbfMrtflDcppcfMcfMnbf = myBbfMrtflDcppcfMcfMnbf
+ print "bbfMrtflDcppcfMcfMnbf = "+hex(self.bbfMrtflDcppcfMcfMnbf)
+ else:
+ print "bbf = "+hex(self.bbf)
+ print "mrtfl = "+hex(self.mrtfl)
+ print "dcppcf = "+hex(self.dcppcf)
+ print "mcf = "+hex(self.mcf)
+ print "mnbf = "+hex(self.mnbf)
+ self.bbfMrtflDcppcfMcfMnbfField = pack('B',self.bbfMrtflDcppcfMcfMnbf)
+
+ rsr = 0 #Request SACK retransmission #Not requested by default
+ clst = 0 #Convergence Layer SAP Type #Ethernet II by default
+ mfsCmdMgmt = 4 #Management MFS Command #NOP by default
+ mfsCmdData = 4 #Data MFS Command #NOP by default
+ rsrClstMfsCmdMgmtMfsCmdData = int(rsr + clst*pow(2,1) + mfsCmdMgmt*pow(2,2) + mfsCmdData*pow(2,5))
+ rsrClstMfsCmdMgmtMfsCmdDataField = pack('B',rsrClstMfsCmdMgmtMfsCmdData)
+ def createRsrClstMfsCmdMgmtMfsCmdData(self, myRsr=None, myClst=None, myMfsCmdMgmt=None, myMfsCmdData=None, myRsrClstMfsCmdMgmtMfsCmdData=None):
+ if myRsr!=None or myClst!=None or myMfsCmdMgmt!=None or myMfsCmdData!=None:
+ if myRsr!=None:
+ self.rsr=myRsr
+ if myClst!=None:
+ self.clst=myClst
+ if myMfsCmdMgmt!=None:
+ self.mfsCmdMgmt=myMfsCmdMgmt
+ if myMfsCmdData!=None:
+ self.mfsCmdData=myMfsCmdData
+ self.rsrClstMfsCmdMgmtMfsCmdData = int(self.rsr + self.clst*pow(2,1) + self.mfsCmdMgmt*pow(2,2) + self.mfsCmdData*pow(2,5))
+ if myRsrClstMfsCmdMgmtMfsCmdData!=None:
+ self.rsrClstMfsCmdMgmtMfsCmdData = myRsrClstMfsCmdMgmtMfsCmdData
+ print "rsrClstMfsCmdMgmtMfsCmdData = "+hex(self.rsrClstMfsCmdMgmtMfsCmdData)
+ else:
+ print "rsr = "+hex(self.rsr)
+ print "clst = "+hex(self.clst)
+ print "mfsCmdMgmt = "+hex(self.mfsCmdMgmt)
+ print "mfsCmdData = "+hex(self.mfsCmdData)
+ self.rsrClstMfsCmdMgmtMfsCmdDataField = pack('B',self.rsrClstMfsCmdMgmtMfsCmdData)
+
+ mfsRspMgmt = 0 #Management MFS Response #ACK by default
+ mfsRspData = 1 #Data MFS Response #ACK by default
+ bm_SACKI = 0 #Bit Map SACK Info #All Succesfully Received by default
+ mfsRspMgmtMfsRspDataBm_SACKI = int(mfsRspMgmt + mfsRspData*pow(2,2) + bm_SACKI*pow(2,4))
+ mfsRspMgmtMfsRspDataBm_SACKIField = pack('B',mfsRspMgmtMfsRspDataBm_SACKI)
+ def createMfsRspMgmtMfsRspDataBm_SACKI(self, myMfsRspMgmt=None, myMfsRspData=None, myBm_SACKI=None, myMfsRspMgmtMfsRspDataBm_SACKI=None):
+ if myMfsRspMgmt!=None or myMfsRspData!=None or myBm_SACKI!=None:
+ if myMfsRspMgmt!=None:
+ self.mfsRspMgmt=myMfsRspMgmt
+ if myMfsRspData!=None:
+ self.mfsRspData=myMfsRspData
+ if myBm_SACKI!=None:
+ self.bm_SACKI=myBm_SACKI
+ self.mfsRspMgmtMfsRspDataBm_SACKI = int(self.mfsRspMgmt + self.mfsRspData*pow(2,2) + self.bm_SACKI*pow(2,4))
+ if myMfsRspMgmtMfsRspDataBm_SACKI!=None:
+ self.mfsRspMgmtMfsRspDataBm_SACKI = myMfsRspMgmtMfsRspDataBm_SACKI
+ print "mfsRspMgmtMfsRspDataBm_SACKI = "+hex(self.mfsRspMgmtMfsRspDataBm_SACKI)
+ else:
+ print "mfsRspMgmt = "+hex(self.mfsRspMgmt)
+ print "mfsRspData = "+hex(self.mfsRspData)
+ print "bm_SACKI = "+hex(self.bm_SACKI)
+ self.mfsRspMgmtMfsRspDataBm_SACKIField = pack('B',self.mfsRspMgmtMfsRspDataBm_SACKI)
+
+ #cfs = 0 #Contesion Free Session #CSMA Allocation by default
+ #bdf = 0 #Beacon detect Flag #Not Heard by default
+ svn = 0 #SACK Version Number #Curent Version by default
+ rrtf = 0 #Request Reverse Transmission Flag #Not Requested by default
+ #mfsRspData = 1 #Data MFS Response #ACK by default
+ #mfsRspMgmt = 0 #Management MFS Response #ACK by default
+ cfsBdfSvnRrtfMfsRspDataMfsRspMgmt = int(cfs + bdf*pow(2,1) + svn*pow(2,2) + rrtf*pow(2,3) + mfsRspMgmt*pow(2,4) + mfsRspData*pow(2,6))
+ cfsBdfSvnRrtfMfsRspDataMfsRspMgmtField = pack('B',cfsBdfSvnRrtfMfsRspDataMfsRspMgmt)
+ def createCfsBdfSvnRrtfMfsRspDataMfsRspMgmt(self, myCfs=None, myBdf=None, mySvn=None, myRrtf=None, myMfsRspMgmt=None, myMfsRspData=None, myCfsBdfSvnRrtfMfsRspDataMfsRspMgmt=None):
+ if myCfs!=None or myBdf!=None or mySvn!=None or myRrtf!=None or myMfsRspMgmt!=None or myMfsRspData!=None:
+ if myCfs!=None:
+ self.cfs=myCfs
+ if myBdf!=None:
+ self.bdf=myBdf
+ if mySvn!=None:
+ self.svn=mySvn
+ if myRrtf!=None:
+ self.rrtf=myRrtf
+ if myMfsRspMgmt!=None:
+ self.mfsRspMgmt=myMfsRspMgmt
+ if myMfsRspData!=None:
+ self.mfsRspData=myMfsRspData
+ self.cfsBdfSvnRrtfMfsRspDataMfsRspMgmt = int(self.cfs + self.bdf*pow(2,1) + self.svn*pow(2,2) + self.rrtf*pow(2,3) + self.mfsRspMgmt*pow(2,4) + self.mfsRspData*pow(2,6))
+ if myCfsBdfSvnRrtfMfsRspDataMfsRspMgmt!=None:
+ self.cfsBdfSvnRrtfMfsRspDataMfsRspMgmt = myCfsBdfSvnRrtfMfsRspDataMfsRspMgmt
+ print "cfsBdfSvnRrtfMfsRspDataMfsRspMgmt = "+hex(self.cfsBdfSvnRrtfMfsRspDataMfsRspMgmt)
+ else:
+ print "cfs = "+hex(self.cfs)
+ print "bdf = "+hex(self.bdf)
+ print "svn = "+hex(self.svn)
+ print "rrtf = "+hex(self.rrtf)
+ print "mfsRspMgmt = "+hex(self.mfsRspMgmt)
+ print "mfsRspData = "+hex(self.mfsRspData)
+ self.cfsBdfSvnRrtfMfsRspDataMfsRspMgmtField = pack('B',self.cfsBdfSvnRrtfMfsRspDataMfsRspMgmt)
+
+ #SACKTs
+ sackts = []
+ sacktsField = ""
+ i = 0
+ while i < 4:
+ sackts.append(i)
+ i=i+1
+ sacktsField = pack('B', sackts[0] + sackts[1]*pow(2,2) + sackts[2]*pow(2,4) + sackts[3]*pow(2,6))
+ def createSackts(self, mySackt0=None, mySackt1=None, mySackt2=None, mySackt3=None):
+ print "sackts :"
+ if mySackt0!=None:
+ self.sackts[0]=mySackt0
+ print "sackts[0] = "+hex(self.sackts[0])
+ if mySackt1!=None:
+ self.sackts[1]=mySackt1
+ print "sackts[1] = "+hex(self.sackts[1])
+ if mySackt2!=None:
+ self.sackts[2]=mySackt2
+ print "sackts[2] = "+hex(self.sackts[2])
+ if mySackt3!=None:
+ self.sackts[3]=mySackt3
+ print "sackts[3] = "+hex(self.sackts[3])
+ self.sacktsField=pack('B',self.sackts[0] + self.sackts[1]*pow(2,2) + self.sackts[2]*pow(2,4) + self.sackts[3]*pow(2,6))
+
+ #SACK Infomation, Bit Pad, Receive Window Size and Request Reverse Transmission
+ sackiPad = 0 #8 or 9 octets size Field #0 by default
+ rxwsz = 0 #0 or 4 bits size Field #4 Segments by default
+ rrtl = 0 #0 or 4 bits size Field #163.84 µs by default
+ shortPad = False #size of sackiPadRxwszRrtl = 7 octets (instead of 10)
+ sackiPadRxwszRrtl = int((rrtl*pow(2,4)*rrtf + rxwsz*pow(2,4)*((rrtf+1)%2) + rxwsz*rrtf)*pow_2_63 + sackiPad)
+ sackiPadRxwszRrtlField = pack('Q',sackiPadRxwszRrtl%pow_2_64)+pack('B',sackiPadRxwszRrtl/pow_2_64)
+ def createSackiPadRxwszRrtl(self, mySackiPad=None, myRxwsz=None, myRrtl=None, myShortPad=None):
+ if mySackiPad!=None:
+ self.sackiPad=mySackiPad
+ print "sackiPad = "+hex(self.sackiPad)
+ if myRxwsz!=None:
+ self.rxwsz=myRxwsz
+ print "rxwsz = "+hex(self.rxwsz)
+ if myRrtl!=None:
+ self.rrtl=myRrtl
+ print "rrtl = "+hex(self.rrtl)
+ if myShortPad!=None:
+ self.shortPad=myShortPad
+ if self.shortPad == False:
+ self.sackiPadRxwszRrtl = int((self.rrtl*pow(2,4)*self.rrtf + self.rxwsz*pow(2,4)*((self.rrtf+1)%2) + self.rxwsz*self.rrtf)*pow_2_63 + self.sackiPad)
+ self.sackiPadRxwszRrtlField = pack('Q',self.sackiPadRxwszRrtl%pow_2_64) + pack('B',self.sackiPadRxwszRrtl/pow_2_64)
+ else:
+ self.sackiPadRxwszRrtl = int((self.rrtl*pow(2,4)*self.rrtf + self.rxwsz*pow(2,4)*((self.rrtf+1)%2) + self.rxwsz*self.rrtf)*pow(2,39) + self.sackiPad)
+ self.sackiPadRxwszRrtlField = pack('Q',self.sackiPadRxwszRrtl)[0:6]
+
+ #SACK Data, Bit Pad, Receive Window Size and Request Reverse Transmission
+ sackdPadRxwszRrtlField = sacktsField + sackiPadRxwszRrtlField
+ def createSackdPadRxwszRrtl(self, mySackt0=None, mySackt1=None, mySackt2=None, mySackt3=None, mySackiPad=None, myRxwsz=None, myRrtl=None, myShortPad=None):
+ self.createSackts(mySackt0, mySackt1, mySackt2, mySackt3)
+ self.createSackiPadRxwszRrtl(mySackiPad, myRxwsz, myRrtl, myShortPad)
+ self.sackdPadRxwszRrtlField = self.sacktsField + self.sackiPadRxwszRrtlField
+
+ #cfs = 0 #Contesion Free Session #CSMA Allocation by default
+ #bdf = 0 #Beacon detect Flag #Not Heard by default
+ #hp10df = 0 #Home Plug 1.0.1 Detect Flag #Not detected by default
+ #hp11df = 0 #Home Plug 1.1 Detect Flag #Not detected by default
+ rtsf = 0 #RTS Flag #CTS by default
+ igf = 0 #Immediate Grant Flag #0 by default
+ #mnbf = 0 #MultiNetwork Broadcast Flag #0 by default
+ #mcf = 0 #Multicast Flag #Unicast by default
+ cfsBdfHp10dfHp11dfRtsfIgfMnbfMcf = int(cfs + bdf*pow(2,1) + hp10df*pow(2,2) + hp11df*pow(2,3) + rtsf*pow(2,4) + igf*pow(2,5) + mnbf*pow(2,6) + mcf*pow(2,7))
+ cfsBdfHp10dfHp11dfRtsfIgfMnbfMcfField = pack('B',cfsBdfHp10dfHp11dfRtsfIgfMnbfMcf)
+ def createCfsBdfHp10dfHp11dfRtsfIgfMnbfMcf(self, myCfs=None, myBdf=None, myHp10df=None, myHp11df=None, myRtsf=None, myIgf=None, myMnbf=None, myMcf=None, myCfsBdfHp10dfHp11dfRtsfIgfMnbfMcf=None):
+ if myCfs!=None or myBdf!=None or myHp10df!=None or myHp11df!=None or myRtsf!=None or myIgf!=None or myMnbf!=None or myMcf!=None:
+ if myCfs!=None:
+ self.cfs=myCfs
+ if myBdf!=None:
+ self.bdf=myBdf
+ if myHp10df!=None:
+ self.hp10df=myHp10df
+ if myHp11df!=None:
+ self.hp11df=myHp11df
+ if myRtsf!=None:
+ self.rtsf=myRtsf
+ if myIgf!=None:
+ self.igf=myIgf
+ if myMnbf!=None:
+ self.mnbf=myMnbf
+ if myMcf!=None:
+ self.mcf=myMcf
+ self.cfsBdfHp10dfHp11dfRtsfIgfMnbfMcf = int(self.cfs + self.bdf*pow(2,1) + self.hp10df*pow(2,2) + self.hp11df*pow(2,3) + self.rtsf*pow(2,4) + self.igf*pow(2,5) + self.mnbf*pow(2,6) + self.mcf*pow(2,7))
+ if myCfsBdfHp10dfHp11dfRtsfIgfMnbfMcf!=None:
+ self.cfsBdfHp10dfHp11dfRtsfIgfMnbfMcf = myCfsBdfHp10dfHp11dfRtsfIgfMnbfMcf
+ print "cfsBdfHp10dfHp11dfRtsfIgfMnbfMcf = "+hex(self.cfsBdfHp10dfHp11dfRtsfIgfMnbfMcf)
+ else:
+ print "cfs = "+hex(self.cfs)
+ print "bdf = "+hex(self.bdf)
+ print "hp10df = "+hex(self.hp10df)
+ print "hp11df = "+hex(self.hp11df)
+ print "rtsf = "+hex(self.rtsf)
+ print "igf = "+hex(self.igf)
+ print "mnbf = "+hex(self.mnbf)
+ print "mcf = "+hex(self.mcf)
+ self.cfsBdfHp10dfHp11dfRtsfIgfMnbfMcfField = pack('B',self.cfsBdfHp10dfHp11dfRtsfIgfMnbfMcf)
+
+ #Duration and reserved
+ durNRsvd = 10000 #10000 *1.28 µs = 12.8 ms by default
+ durNRsvdField = pack('Q',durNRsvd)
+ def createDurNRsvd(self, myDurNRsvd=None):
+ if myDurNRsvd!=None:
+ self.durNRsvd=myDurNRsvd
+ self.durNRsvdField = pack('Q',self.durNRsvd)
+ print "durNRsvd = "+hex(self.durNRsvd)
+
+ #cfs = 0 #Contesion Free Session #CSMA Allocation by default
+ #pbSz = 0 #PHY Block Size #520 octets by default
+ #bdf = 0 #Beacon detect Flag #Not Heard by default
+ saf = 0 #Sound ACK Flag #Sound MPDU by default
+ scf = 0 #Sound Complete Flag #Not Complete by default
+ req_TM = 7 #Max Tone Map Requested #7 Tone Maps supported by default
+ cfsPbSzBdfSafScfReq_TM = int(cfs + pbSz*pow(2,1) + bdf*pow(2,2) + saf*pow(2,3) + scf*pow(2,4) + req_TM*pow(2,5))
+ cfsPbSzBdfSafScfReq_TMField = pack('B',cfsPbSzBdfSafScfReq_TM)
+ def createCfsPbSzBdfSafScfReq_TM(self, myCfs=None, myPbSz=None, myBdf=None, mySaf=None, myScf=None, myReq_TM=None, myCfsPbSzBdfSafScfReq_TM=None):
+ if myCfs!=None or myPbSz!=None or myBdf!=None or mySaf!=None or myScf!=None or myReq_TM!=None:
+ if myCfs!=None:
+ self.cfs=myCfs
+ if myPbSz!=None:
+ self.pbSz=myPbSz
+ if myBdf!=None:
+ self.bdf=myBdf
+ if mySaf!=None:
+ self.saf=mySaf
+ if myScf!=None:
+ self.scf=myScf
+ if myReq_TM!=None:
+ self.req_TM=myReq_TM
+ self.cfsPbSzBdfSafScfReq_TM = int(self.cfs + self.pbSz*pow(2,1) + self.bdf*pow(2,2) + self.saf*pow(2,3) + self.scf*pow(2,4) + self.req_TM*pow(2,5))
+ if myCfsPbSzBdfSafScfReq_TM!=None:
+ self.cfsPbSzBdfSafScfReq_TM = myCfsPbSzBdfSafScfReq_TM
+ print "cfsPbSzBdfSafScfReq_TM = "+hex(self.cfsPbSzBdfSafScfReq_TM)
+ else:
+ print "cfs = "+hex(self.cfs)
+ print "pbSz = "+hex(self.pbSz)
+ print "bdf = "+hex(self.bdf)
+ print "saf = "+hex(self.saf)
+ print "scf = "+hex(self.scf)
+ print "req_TM = "+hex(self.req_TM)
+ self.cfsPbSzBdfSafScfReq_TMField = pack('B',self.cfsPbSzBdfSafScfReq_TM)
+
+ #fl_AV = 0x3E #Home Plug AV Frame Length #79.36 µs by default
+ #mpduCnt = 0 #MPDU Count #not a burst or last by default
+ fl_AVMpduCnt = int(fl_AV + mpduCnt*pow(2,12))
+ fl_AVMpduCntField = pack('H',fl_AVMpduCnt)
+ def createFl_AVMpduCnt(self, myFl_AV=None, myMpduCnt=None, myFl_AVMpduCnt=None):
+ if myFl_AV!=None or myMpduCnt!=None:
+ if myFl_AV!=None:
+ self.fl_AV=myFl_AV
+ if myMpduCnt!=None:
+ self.mpduCnt=myMpduCnt
+ self.fl_AVMpduCnt = int(self.fl_AV + self.mpduCnt*pow(2,12))
+ if myFl_AVMpduCnt!=None:
+ self.fl_AVMpduCnt = myFl_AVMpduCnt
+ print "fl_AVMpduCnt = "+hex(self.fl_AVMpduCnt)
+ else:
+ print "fl_AV = "+hex(self.fl_AV)
+ print "mpduCnt = "+hex(self.mpduCnt)
+ self.fl_AVMpduCntField = pack('H',self.fl_AVMpduCnt)
+
+ #Sound Reason Code
+ src = 4 #4 by default
+ srcField = pack('B',src)
+ def createSrc(self, mySrc=None):
+ if mySrc!=None:
+ self.src=mySrc
+ self.srcField = pack('B',self.src)
+ print "src = "+hex(self.src)
+
+ rsof_fl_AV = 0x3E #Reverse SOF Frame Length #79.36 µs by default
+ #tmi_AV = 0 #Home Plug AV Tone Map Index #ROBO by default
+ #pbSz = 0 #PHY Block Size #520 octets by default
+ rsof_fl_AVTmi_AVPbSz = int(rsof_fl_AV + tmi_AV*pow(2,12) + pbSz*pow(2,15))
+ rsof_fl_AVTmi_AVPbSzField = pack('H',rsof_fl_AVTmi_AVPbSz)
+ def createRsof_fl_AVTmi_AVPbSz(self, myRsof_fl_AV=None, myTmi_AV=None, myPbSz=None, myRsof_fl_AVTmi_AVPbSz=None):
+ if myRsof_fl_AV!=None or myTmi_AV!=None or myPbSz!=None:
+ if myRsof_fl_AV!=None:
+ self.rsof_fl_AV=myRsof_fl_AV
+ if myTmi_AV!=None:
+ self.tmi_AV=myTmi_AV
+ if myPbSz!=None:
+ self.pbSz=myPbSz
+ self.rsof_fl_AVTmi_AVPbSz = int(self.rsof_fl_AV + self.tmi_AV*pow(2,12) + self.pbSz*pow(2,15))
+ if myRsof_fl_AVTmi_AVPbSz!=None:
+ self.rsof_fl_AVTmi_AVPbSz = myRsof_fl_AVTmi_AVPbSz
+ print "rsof_fl_AVTmi_AVPbSz = "+hex(self.rsof_fl_AVTmi_AVPbSz)
+ else:
+ print "rsof_fl_AV = "+hex(self.rsof_fl_AV)
+ print "tmi_AV = "+hex(self.tmi_AV)
+ print "pbSz = "+hex(self.pbSz)
+ self.rsof_fl_AVTmi_AVPbSzField = pack('H',self.rsof_fl_AVTmi_AVPbSz)
+
+ #numSym = 1 #Number of symbol #1 by default
+ #mfsCmdMgmt = 4 #Management MFS Command #NOP by default
+ #mfsCmdData = 4 #Data MFS Command #NOP by default
+ numSymMfsCmdMgmtMfsCmdData = int(numSym + mfsCmdMgmt*pow(2,2) + mfsCmdData*pow(2,5))
+ numSymMfsCmdMgmtMfsCmdDataField = pack('B',numSymMfsCmdMgmtMfsCmdData)
+ def createNumSymMfsCmdMgmtMfsCmdData(self, myNumSym=None, myMfsCmdMgmt=None, myMfsCmdData=None, myNumSymMfsCmdMgmtMfsCmdData=None):
+ if myNumSym!=None or myMfsCmdMgmt!=None or myMfsCmdData!=None:
+ if myNumSym!=None:
+ self.numSym=myNumSym
+ if myMfsCmdMgmt!=None:
+ self.mfsCmdMgmt=myMfsCmdMgmt
+ if myMfsCmdData!=None:
+ self.mfsCmdData=myMfsCmdData
+ self.numSymMfsCmdMgmtMfsCmdData = int(self.numSym + self.mfsCmdMgmt*pow(2,2) + self.mfsCmdData*pow(2,5))
+ if myNumSymMfsCmdMgmtMfsCmdData!=None:
+ self.numSymMfsCmdMgmtMfsCmdData = myNumSymMfsCmdMgmtMfsCmdData
+ print "numSymMfsCmdMgmtMfsCmdData = "+hex(self.numSymMfsCmdMgmtMfsCmdData)
+ else:
+ print "numSym = "+hex(self.numSym)
+ print "mfsCmdMgmt = "+hex(self.mfsCmdMgmt)
+ print "mfsCmdData = "+hex(self.mfsCmdData)
+ self.numSymMfsCmdMgmtMfsCmdDataField = pack('B',self.numSymMfsCmdMgmtMfsCmdData)
+
+
+ #Beacon Variant Field
+ bvf = btsField + bto_0Field + bto_1Field + bto_2Field + bto_3Field
+ def createBvf(self, myBts=None, myBto_0=None, myBto_1=None, myBto_2=None, myBto_3=None, myBvf=None):
+ if myBvf!=None:
+ self.bvf = myBvf
+ print "bvf = "+self.bvf
+ else:
+ print "bvf :"
+ self.createBts(myBts)
+ self.createBto_0(myBto_0)
+ self.createBto_1(myBto_1)
+ self.createBto_2(myBto_2)
+ self.createBto_3(myBto_3)
+ self.bvf = self.btsField + self.bto_0Field + self.bto_1Field + self.bto_2Field + self.bto_3Field
+
+
+ #SOF Variant Field
+ sofvf = steiField + dteiField + lidField + cfsBdfHp10dfHp11dfEksField + ppbField + bleField + pbSzNumSymTmi_AVField + fl_AVMpduCntBurstCntField + bbfMrtflDcppcfMcfMnbfField + rsrClstMfsCmdMgmtMfsCmdDataField + mfsRspMgmtMfsRspDataBm_SACKIField
+ def createSofvf(self, myStei=None, myDtei=None, myLid=None, myCfs=None, myBdf=None, myHp10df=None, myHp11df=None, myEks=None, myPpb=None, myBle=None, myPbSz=None, myNumSym=None, myTmi_AV=None, myFl_AV=None, myMpduCnt=None, myBurstCnt=None, myBbf=None, myMrtfl=None, myDcppcf=None, myMcf=None, myMnbf=None, myRsr=None, myClst=None, myMfsCmdMgmt=None, myMfsCmdData=None, myMfsRspMgmt=None, myMfsRspData=None, myBm_SACKI=None, mySofvf=None):
+ if mySofvf!=None:
+ self.sofvf = mySofvf
+ print "sofvf = "+self.sofvf
+ else:
+ print "sofvf :"
+ self.createStei(myStei)
+ self.createDtei(myDtei)
+ self.createLid(myLid)
+ self.createCfsBdfHp10dfHp11dfEks(myCfs, myBdf, myHp10df, myHp11df, myEks)
+ self.createPpb(myPpb)
+ self.createBle(myBle)
+ self.createPbSzNumSymTmi_AV(myPbSz, myNumSym, myTmi_AV)
+ self.createFl_AVMpduCntBurstCnt(myFl_AV, myMpduCnt, myBurstCnt)
+ self.createRsrClstMfsCmdMgmtMfsCmdData(myRsr, myClst, myMfsCmdMgmt, myMfsCmdData)
+ self.createMfsRspMgmtMfsRspDataBm_SACKI(myMfsRspMgmt, myMfsRspData, myBm_SACKI)
+ self.createBbfMrtflDcppcfMcfMnbf(myBbf, myMrtfl, myDcppcf, myMcf, myMnbf)
+ self.sofvf = self.steiField + self.dteiField + self.lidField + self.cfsBdfHp10dfHp11dfEksField + self.ppbField + self.bleField + self.pbSzNumSymTmi_AVField + self.fl_AVMpduCntBurstCntField + self.bbfMrtflDcppcfMcfMnbfField + self.rsrClstMfsCmdMgmtMfsCmdDataField + self.mfsRspMgmtMfsRspDataBm_SACKIField
+
+
+ #SACK Variant Field
+ sackvf = dteiField + cfsBdfSvnRrtfMfsRspDataMfsRspMgmtField + sackdPadRxwszRrtlField
+ def createSackvf(self, myDtei=None, myCfs=None, myBdf=None, mySvn=None, myRrtf=None, myMfsRspMgmt=None, myMfsRspData=None, mySackt0=None, mySackt1=None, mySackt2=None, mySackt3=None, mySackiPad=None, myRxwsz=None, myRrtl=None, mySackvf=None):
+ if mySackvf!=None:
+ self.sackvf = mySackvf
+ print "sackvf = "+self.sackvf
+ else:
+ print "sackvf :"
+ self.createDtei(myDtei)
+ self.createCfsBdfSvnRrtfMfsRspDataMfsRspMgmt(myCfs, myBdf, mySvn, myRrtf, myMfsRspMgmt, myMfsRspData)
+ self.createSackdPadRxwszRrtl(mySackt0, mySackt1, mySackt2, mySackt3, mySackiPad, myRxwsz, myRrtl)
+ self.sackvf = self.dteiField + self.cfsBdfSvnRrtfMfsRspDataMfsRspMgmtField + self.sackdPadRxwszRrtlField
+
+
+ #RTS/CTS Variant Field
+ rtsctsvf = steiField + dteiField + lidField + cfsBdfHp10dfHp11dfRtsfIgfMnbfMcfField + durNRsvdField
+ def createRtsctsvf(self, myStei=None, myDtei=None, myLid=None, myCfs=None, myBdf=None, myHp10df=None, myHp11df=None, myRtsf=None, myIgf=None, myMnbf=None, myMcf=None, myDurNRsvd=None, myRtsctsvf=None):
+ if myRtsctsvf!=None:
+ self.rtsctsvf = myRtsctsvf
+ print "rtsctsvf = "+self.rtsctsvf
+ else:
+ print "rtsctsvf :"
+ self.createStei(myStei)
+ self.createDtei(myDtei)
+ self.createLid(myLid)
+ self.createCfsBdfHp10dfHp11dfRtsfIgfMnbfMcf(myCfs, myBdf, myHp10df, myHp11df, myRtsf, myIgf, myMnbf, myMcf)
+ self.createDurNRsvd(myDurNRsvd)
+ self.rtsctsvf = self.steiField + self.dteiField + self.lidField + self.cfsBdfHp10dfHp11dfRtsfIgfMnbfMcfField + self.durNRsvdField
+
+
+ #Sound Variant Field
+ soundvf = steiField + dteiField + lidField + cfsPbSzBdfSafScfReq_TMField + fl_AVMpduCntField + ppbField + srcField + pack('B',0)*4
+ def createSoundvf(self, myStei=None, myDtei=None, myLid=None, myCfs=None, myPbSz=None, myBdf=None, mySaf=None, myScf=None, myReq_TM=None, myFl_AV=None, myMpduCnt=None, myPpb=None, mySrc=None, mySoundvf=None):
+ if mySoundvf!=None:
+ self.soundvf = mySoundvf
+ print "soundvf = "+self.soundvf
+ else:
+ print "soundvf :"
+ self.createStei(myStei)
+ self.createDtei(myDtei)
+ self.createLid(myLid)
+ self.createCfsPbSzBdfSafScfReq_TM(myCfs, myPbSz, myBdf, mySaf, myScf, myReq_TM)
+ self.createFl_AVMpduCnt(myFl_AV, myMpduCnt)
+ self.createPpb(myPpb)
+ self.createSrc(mySrc)
+ self.soundvf = self.steiField + self.dteiField + self.lidField + self.cfsPbSzBdfSafScfReq_TMField + self.fl_AVMpduCntField + self.ppbField + self.srcField + pack('B',0)*4
+
+
+ #Reverse SOF Variant Field
+ sackiPadRxwszRrtl = int((rrtl*pow(2,4)*rrtf + rxwsz*pow(2,4)*((rrtf+1)%2) + rxwsz*rrtf)*pow(2,39) + sackiPad)
+ sackiPadRxwszRrtlField = pack('Q',sackiPadRxwszRrtl%pow_2_64)[0:6]
+ sackdPadRxwszRrtlField = sacktsField + sackiPadRxwszRrtlField
+ rsofvf = dteiField + cfsBdfSvnRrtfMfsRspDataMfsRspMgmtField + sackdPadRxwszRrtlField + rsof_fl_AVTmi_AVPbSzField + numSymMfsCmdMgmtMfsCmdDataField
+ def createRsofvf(self, myDtei=None, myCfs=None, myBdf=None, mySvn=None, myRrtf=None, myMfsRspMgmt=None, myMfsRspData=None, mySackt0=None, mySackt1=None, mySackt2=None, mySackt3=None, mySackiPad=None, myRxwsz=None, myRrtl=None, myShortPad=True, myRsof_fl_AV=None, myTmi_AV=None, myPbSz=None, myNumSym=None, myMfsCmdMgmt=None, myMfsCmdData=None, myRsofvf=None):
+ if myRsofvf!=None:
+ self.rsofvf = myRsofvf
+ print "rsofvf = "+self.rsofvf
+ else:
+ print "rsofvf :"
+ self.createDtei(myDtei)
+ self.createCfsBdfSvnRrtfMfsRspDataMfsRspMgmt(myCfs, myBdf, mySvn, myRrtf, myMfsRspMgmt, myMfsRspData)
+ self.createSackdPadRxwszRrtl(mySackt0, mySackt1, mySackt2, mySackt3, mySackiPad, myRxwsz, myRrtl, myShortPad)
+ self.createRsof_fl_AVTmi_AVPbSz(myRsof_fl_AV, myTmi_AV, myPbSz)
+ self.createNumSymMfsCmdMgmtMfsCmdData(myPbSz, myNumSym, myTmi_AV)
+ self.rsofvf = self.dteiField + self.cfsBdfSvnRrtfMfsRspDataMfsRspMgmtField + self.sackdPadRxwszRrtlField + self.rsof_fl_AVTmi_AVPbSzField + self.numSymMfsCmdMgmtMfsCmdDataField
+
+
+ #DT_AV - ACCESS - SNID
+ snid = 0xA
+ access = 0 #in home by default
+ dt_AV = 1 #SOF by default
+ dt_AVAccessSnid = int(dt_AV + access*pow(2,3) + snid*pow(2,4))
+ dt_AVAccessSnidField = pack('B',dt_AVAccessSnid)
+ def createDt_AVAccessSnid(self, myDt_AV=None, myAccess=None, mySnid=None, myDt_AVAccessSnid=None):
+ if myDt_AV!=None:
+ self.dt_AV=myDt_AV
+ if myAccess!=None:
+ self.access=myAccess
+ if mySnid!=None:
+ self.snid=mySnid
+ if myDt_AVAccessSnid!=None:
+ self.dt_AVAccessSnid=myDt_AVAccessSnid
+ print "dt_AVAccessSnid = "+hex(self.dt_AVAccessSnid)
+ else:
+ self.dt_AVAccessSnid = int(self.dt_AV + self.access*pow(2,3) + self.snid*pow(2,4))
+ print "dt_AV = "+DT_AV[self.dt_AV]
+ print "access = "+hex(self.access)
+ print "snid = "+hex(self.snid)
+ self.dt_AVAccessSnidField = pack('B',self.dt_AVAccessSnid)
+
+
+ #VF_AV
+ vf_AV = sofvf #SOF by default
+ def createVf_AV(self, myBts=None, myBto_0=None, myBto_1=None, myBto_2=None, myBto_3=None, myBvf=None, myStei=None, myDtei=None, myLid=None, myCfs=None, myBdf=None, myHp10df=None, myHp11df=None, myEks=None, myPpb=None, myBle=None, myPbSz=None, myNumSym=None, myTmi_AV=None, myFl_AV=None, myMpduCnt=None, myBurstCnt=None, myBbf=None, myMrtfl=None, myDcppcf=None, myMcf=None, myMnbf=None, myRsr=None, myClst=None, myMfsCmdMgmt=None, myMfsCmdData=None, myMfsRspMgmt=None, myMfsRspData=None, myBm_SACKI=None, mySofvf=None, mySvn=None, myRrtf=None, mySackt0=None, mySackt1=None, mySackt2=None, mySackt3=None, mySackiPad=None, myRxwsz=None, myRrtl=None, mySackvf=None, myRtsf=None, myIgf=None, myDurNRsvd=None, myRtsctsvf=None, mySaf=None, myScf=None, myReq_TM=None, mySrc=None, mySoundvf=None, myShortPad=True, myRsof_fl_AV=None, myRsofvf=None): #SOF by default
+ if self.dt_AV==beacon:
+ self.createBvf(myBts, myBto_0, myBto_1, myBto_2, myBto_3, myBvf)
+ self.vf_AV = self.bvf
+ elif self.dt_AV==sof:
+ self.createSofvf(myStei, myDtei, myLid, myCfs, myBdf, myHp10df, myHp11df, myEks, myPpb, myBle, myPbSz, myNumSym, myTmi_AV, myFl_AV, myMpduCnt, myBurstCnt, myBbf, myMrtfl, myDcppcf, myMcf, myMnbf, myRsr, myClst, myMfsCmdMgmt, myMfsCmdData, myMfsRspMgmt, myMfsRspData, myBm_SACKI, mySofvf)
+ self.vf_AV = self.sofvf
+ elif self.dt_AV==sack:
+ self.createSackvf(myDtei, myCfs, myBdf, mySvn, myRrtf, myMfsRspMgmt, myMfsRspData, mySackt0, mySackt1, mySackt2, mySackt3, mySackiPad, myRxwsz, myRrtl, mySackvf)
+ self.vf_AV = self.sackvf
+ elif self.dt_AV==rtsCts:
+ self.createRtsctsvf(myStei, myDtei, myLid, myCfs, myBdf, myHp10df, myHp11df, myRtsf, myIgf, myMnbf, myMcf, myDurNRsvd, myRtsctsvf)
+ self.vf_AVField = self.rtsctsvf
+ elif self.dt_AV==sound:
+ self.createSoundvf(myStei, myDtei, myLid, myCfs, myPbSz, myBdf, mySaf, myScf, myReq_TM, myFl_AV, myMpduCnt, myPpb, mySrc, mySoundvf)
+ self.vf_AV = self.soundvf
+ elif self.dt_AV==rsof:
+ self.createRsofvf(myDtei, myCfs, myBdf, mySvn, myRrtf, myMfsRspMgmt, myMfsRspData, mySackt0, mySackt1, mySackt2, mySackt3, mySackiPad, myRxwsz, myRrtl, myShortPad, myRsof_fl_AV, myTmi_AV, myPbSz, myNumSym, myMfsCmdMgmt, myMfsCmdData, myRsofvf)
+ self.vf_AV = self.rsofvf
+
+
+ #FCCS_AV
+ fccs_AV = check_string(dt_AVAccessSnidField + vf_AV)
+ fccs_AVField = pack('I',fccs_AV)[0:3]
+ def createFccs_AV(self, myFccs_AV=None):
+ if myFccs_AV!=None:
+ self.fccs_AV=myFccs_AV
+ else:
+ self.fccs_AV = check_string(self.dt_AVAccessSnidField + self.vf_AV)
+ self.fccs_AVField = pack('I',self.fccs_AV)[0:3]
+ print "fccs_AV = "+hex(self.fccs_AV)
+
+
+ #FC_AV
+ fc_AV = dt_AVAccessSnidField + vf_AV + fccs_AVField
+ iv_SOF = dt_AVAccessSnidField + vf_AV
+ def createFc_AV(self, myFc_AV=None, myDt_AV=None, myAccess=None, mySnid=None, myDt_AVAccessSnid=None, myBts=None, myBto_0=None, myBto_1=None, myBto_2=None, myBto_3=None, myBvf=None, myStei=None, myDtei=None, myLid=None, myCfs=None, myBdf=None, myHp10df=None, myHp11df=None, myEks=None, myPpb=None, myBle=None, myPbSz=None, myNumSym=None, myTmi_AV=None, myFl_AV=None, myMpduCnt=None, myBurstCnt=None, myBbf=None, myMrtfl=None, myDcppcf=None, myMcf=None, myMnbf=None, myRsr=None, myClst=None, myMfsCmdMgmt=None, myMfsCmdData=None, myMfsRspMgmt=None, myMfsRspData=None, myBm_SACKI=None, mySofvf=None, mySvn=None, myRrtf=None, mySackt0=None, mySackt1=None, mySackt2=None, mySackt3=None, mySackiPad=None, myRxwsz=None, myRrtl=None, mySackvf=None, myRtsf=None, myIgf=None, myDurNRsvd=None, myRtsctsvf=None, mySaf=None, myScf=None, myReq_TM=None, mySrc=None, mySoundvf=None, myShortPad=True, myRsof_fl_AV=None, myRsofvf=None, myFccs_AV=None, myIv_SOF=None):
+ print "fc_AV :"
+ if myFc_AV!=None:
+ self.fc_AV=myFc_AV
+ self.iv_SOF=self.fc_AV[0:12]
+ print "iv_SOF = "+hex(self.iv_SOF)
+ else:
+ self.createDt_AVAccessSnid(myDt_AV, myAccess, mySnid, myDt_AVAccessSnid)
+ self.createVf_AV(myBts, myBto_0, myBto_1, myBto_2, myBto_3, myBvf, myStei, myDtei, myLid, myCfs, myBdf, myHp10df, myHp11df, myEks, myPpb, myBle, myPbSz, myNumSym, myTmi_AV, myFl_AV, myMpduCnt, myBurstCnt, myBbf, myMrtfl, myDcppcf, myMcf, myMnbf, myRsr, myClst, myMfsCmdMgmt, myMfsCmdData, myMfsRspMgmt, myMfsRspData, myBm_SACKI, mySofvf, mySvn, myRrtf, mySackt0, mySackt1, mySackt2, mySackt3, mySackiPad, myRxwsz, myRrtl, mySackvf, myRtsf, myIgf, myDurNRsvd, myRtsctsvf, mySaf, myScf, myReq_TM, mySrc, mySoundvf, myShortPad, myRsof_fl_AV, myRsofvf)
+ self.createFccs_AV(myFccs_AV)
+ self.fc_AV = self.dt_AVAccessSnidField + self.vf_AV + self.fccs_AVField
+ self.iv_SOF = self.vf_AV
+
+ myFC_AV.set_dt_av(self.dt_AV)
+ myFC_AV.set_access(self.access)
+ myFC_AV.set_snid(self.snid)
+ myFC_AV.set_vf_av(self.vf_AV)
+ myFC_AV.set_fccs_av(self.fccs_AV)
+ myMacFrame.FC_AV = myFC_AV
+
+ print "iv_SOF = "+hex(unpack('QI',self.iv_SOF)[0]+unpack('QI',self.iv_SOF)[1]*pow_2_64)
+
+
+
diff --git a/cesar/maximus/python/lib/framing.py b/cesar/maximus/python/lib/framing.py
new file mode 100644
index 0000000000..8f86665aca
--- /dev/null
+++ b/cesar/maximus/python/lib/framing.py
@@ -0,0 +1,45 @@
+# -*- coding:Utf-8 -*-
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+#from maximus import *
+#import unittest
+#from interface import *
+
+##print "Instantiate a Maximus object and initialize it."
+#maximus = Maximus()
+#maximus.init(sys.argv)
+##print "Create a station."
+#myStaA = maximus.create_sta()
+##print "Set tonemask"
+#fcall1 = maximus.create_fcall('set_tonemask')
+#fcall1.send(myStaA)
+
+from binascii import * #binascii library is used : crc32(),
+
+from macFrame import *
+myMacFields = MacFields()
+
+#print "Create MME Header"
+myMmHeader = MMHeader()
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cesar/maximus/python/lib/macFrame.py b/cesar/maximus/python/lib/macFrame.py
new file mode 100644
index 0000000000..6cfa5f34ed
--- /dev/null
+++ b/cesar/maximus/python/lib/macFrame.py
@@ -0,0 +1,122 @@
+# -*- coding:Utf-8 -*-
+
+#from maximus import *
+#import unittest
+from interface import *
+
+from mmentry import *
+mmentryMethod = MmentryMethod()
+from fcVf import *
+myFcVfFields = FcVfFields()
+
+
+
+#print "Instantiate a Maximus object and initialize it."
+maximus = Maximus()
+maximus.init(sys.argv)
+#print "Create a station."
+myStaA = maximus.create_sta()
+#myStaA.debug()
+#print "Set tonemask"
+fcall1 = maximus.create_fcall('set_tonemask')
+fcall1.send(myStaA)
+
+
+#print "Send an MPDU containing one PB of 128 octets"
+def create_fcall_128():
+ #print "Create a fcall for an MPDU containing one PB of 128 octets"
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ short_ppdu = False
+ mod = 2 # PHY_MOD_MINI_ROBO
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ pb_size = 0 # PHY_PB_SIZE_136
+ gil = 1 # PHY_GIL_567
+ pb_nb = 1
+ fcall_128 = maximus.create_fcall('prepare_rx')
+ fcall_128.add_param_ushort("fc_mode", fc_mode)
+ fcall_128.add_param_bool("short_ppdu", short_ppdu)
+ fcall_128.add_param_ushort("mod", mod)
+ fcall_128.add_param_ushort("fecrate", fecrate)
+ fcall_128.add_param_ushort("pb_size", pb_size)
+ fcall_128.add_param_ushort("gil", gil)
+ fcall_128.add_param_ushort("pb_nb", pb_nb)
+ return fcall_128
+
+# Send an MPDU containing "myPbNum" PBs of 512 octets
+def create_fcall_512(myPbNum = 1):
+ # Create a fcall for an MPDU containing "myPbNum" PBs of 512 octets
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ short_ppdu = False
+ mod = 3 # PHY_MOD_TM
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ pb_size = 1 # PHY_PB_SIZE_520
+ gil = 1 # PHY_GIL_567
+ pb_nb = myPbNum
+ fcall_512 = maximus.create_fcall('prepare_rx')
+ fcall_512.add_param_ushort("fc_mode", fc_mode)
+ fcall_512.add_param_bool("short_ppdu", short_ppdu)
+ fcall_512.add_param_ushort("mod", mod)
+ fcall_512.add_param_ushort("fecrate", fecrate)
+ fcall_512.add_param_ushort("pb_size", pb_size)
+ fcall_512.add_param_ushort("gil", gil)
+ fcall_512.add_param_ushort("pb_nb", pb_nb)
+ return fcall_512
+
+#macFields fill all fields existing in MAC Frame
+class MacFields():
+
+ #MAC Frame
+
+ def createMacFrame(self, myOda=staAAddress, myOsa=maxAddress, myVlanTag=0, myMtype=0xe188, myMmv=0, myMmtype=mmentryMethod.mmentryFields.mmtype, myNfmi=None, myFnMi=None, myFmsn=0, myMmentry=None, myEncapsulatedMmEntry=None, myFc_AV=None, myDt_AV=1, myAccess=None, mySnid=None, myDt_AVAccessSnid=None, myBts=None, myBto_0=None, myBto_1=None, myBto_2=None, myBto_3=None, myBvf=None, myStei=None, myDtei=None, myLid=None, myCfs=None, myBdf=None, myHp10df=None, myHp11df=None, myEks=None, myPpb=None, myBle=None, myPbSz=None, myNumSym=None, myTmi_AV=None, myFl_AV=None, myMpduCnt=None, myBurstCnt=None, myBbf=None, myMrtfl=None, myDcppcf=None, myMcf=None, myMnbf=None, myRsr=None, myClst=None, myMfsCmdMgmt=None, myMfsCmdData=None, myMfsRspMgmt=None, myMfsRspData=None, myBm_SACKI=None, mySofvf=None, mySvn=None, myRrtf=None, mySackt0=None, mySackt1=None, mySackt2=None, mySackt3=None, mySackiPad=None, myRxwsz=None, myRrtl=None, mySackvf=None, myRtsf=None, myIgf=None, myDurNRsvd=None, myRtsctsvf=None, mySaf=None, myScf=None, myReq_TM=None, mySrc=None, mySoundvf=None, myShortPad=True, myRsof_fl_AV=None, myRsofvf=None, myFccs_AV=None, myIv_SOF=None):
+ if myMmentry == None:
+ myMmentry = mmentryMethod.mmentryFields.mmentry
+ thisNfmi = (len(myMmentry)-1)/1492
+ thisFnMi = 0
+ rspu = ""
+ while thisFnMi<=thisNfmi:
+ myEncapsulatedMme.createEncapsulatedMmEntry(myOda, myOsa, myVlanTag, myMtype, myMmv, myMmtype, myNfmi, myFnMi, myFmsn, myMmentry, myEncapsulatedMmEntry, thisFnMi)
+ myMacFrameHeader.set_mft(mmeMft)
+ myMacFrameHeader.set_mfl(min(mmentryMethod.mmentryFields.mmeMfl,1518))
+ if mmentryMethod.mmentryFields.mmeMfl<=122:
+ fcall_128 = create_fcall_128()
+ fcall_128.send(myStaA)
+ else:
+ fcall_512 = create_fcall_512(int(((min(mmentryMethod.mmentryFields.mmeMfl,1518)-1)/506)+1))
+ fcall_512.send(myStaA)
+ mmentryMethod.mmentryFields.mmeMfl = mmentryMethod.mmentryFields.mmeMfl-1492
+ myMacFrame.set_macframeheader(myMacFrameHeader)
+ myMacFrame.set_ats(None)
+ confunder = randrange(0,pow(2,32)-1,1)
+ myMacFrame.set_msdu(myMme)
+ myMacFrame.set_confounder(confunder)
+ icv = unpack('I',pack('i',crc32(myMacFrame.get_msdu())))[0]
+ myMacFrame.set_icv(icv)
+ myFcVfFields.createFc_AV(myFc_AV, myDt_AV, myAccess, mySnid, myDt_AVAccessSnid, myBts, myBto_0, myBto_1, myBto_2, myBto_3, myBvf, myStei, myDtei, myLid, myCfs, myBdf, myHp10df, myHp11df, myEks, myPpb, myBle, myPbSz, myNumSym, myTmi_AV, myFl_AV, myMpduCnt, myBurstCnt, myBbf, myMrtfl, myDcppcf, myMcf, myMnbf, myRsr, myClst, myMfsCmdMgmt, myMfsCmdData, myMfsRspMgmt, myMfsRspData, myBm_SACKI, mySofvf, mySvn, myRrtf, mySackt0, mySackt1, mySackt2, mySackt3, mySackiPad, myRxwsz, myRrtl, mySackvf, myRtsf, myIgf, myDurNRsvd, myRtsctsvf, mySaf, myScf, myReq_TM, mySrc, mySoundvf, myShortPad, myRsof_fl_AV, myRsofvf, myFccs_AV, myIv_SOF)
+ myMacFrame.set_iv(myFcVfFields.iv_SOF) #IV_SOF NOT IV !!!
+ myMacFrame.set_nek(myFcVfFields.nekField)
+ myMacFrame.send(maximus)
+ rspc = recv(maximus) #PB Objects list
+ rspc = rspc[0].get_pblist()
+ receivedPbNum = len(rspc)
+ rspt = ""
+ i=0
+ while i<receivedPbNum:
+ rspt = rspt + rspc[i]
+ i=i+1
+ rspc = rspt[:int(unpack('H',rspt[0:2])[0]/4)+6+1-4]
+ maximus.wait(100000)
+ rspuH = rspc[:29]
+ rspu = rspu + rspc[29:]
+ thisFnMi = thisFnMi + 1
+ return rspuH + rspu
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cesar/maximus/python/lib/mmentry/Constants.py b/cesar/maximus/python/lib/mmentry/Constants.py
new file mode 100644
index 0000000000..bc0e69b526
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/Constants.py
@@ -0,0 +1,317 @@
+# -*- coding:Utf-8 -*-
+
+pow_2_64=18446744073709551616
+pow_2_63=9223372036854775808
+
+MAX_TONE_MAPS = 7
+
+
+#------ Maximus Python's constants -------
+
+#Maximus Simulator 48 bits address
+maxAddress = "MaxSim" #= 0x6D695378614D
+staAAddress = "myStaA" #= 0x41617453796D
+
+#Delimiter Type = DT_AV
+ #= First field of the HomePlug AV Frame Control Block
+ #= 3-bits field that identifies the "Frame Type of Message"
+beacon = 0
+sof = 1
+sack = 2
+rtsCts = 3
+sound = 4
+rsof = 5
+rsv0 = 6
+rsv1 = 7
+
+DT_AV = {0x00:"Beacon",
+0x01:"Start of Frame (SOF)",
+0x02:"Selective Acknowledgement (SACK)",
+0x03:"Request to Send (RTS)/Clear to Send(CTS)",
+0x04:"Sound",
+0x05:"Reverse Start of Frame (RSOF)",
+0x06:"Reserved",
+0x07:"Reserved"
+}
+
+#rx :
+timeOutRx = 5000 #timeOutRx default's value = 5s
+ #time count is here supposed to be in ms
+
+#MAC Frame Type = MFT
+ #= First field of the MAC Frame Header
+ #= 2-bits field that identifies the "MAC Frame Type"
+mfsMft = 0 #MAC Frame Stream
+msduWOatsMft = 1 #MSDU WithOut ATS
+msduWatsMft = 2 #MSDU With ATS
+mmeMft = 3 #Management Message
+
+
+#MME Interpretation
+#--- Station - Central Coordination ---
+CC_CCO_APPOINT_REQ = 0x0000 #(See Note #1)
+CC_CCO_APPOINT_CNF = 0x0001 #(See Note #1)
+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 #(See Note #3)
+CC_LINK_INFO_RSP = 0x000B #(See Note #3)
+CC_HANDOVER_REQ = 0x000C #(See Note #4)
+CC_HANDOVER_CNF = 0x000D #(See Note #4)
+CC_HANDOVER_INFO_IND = 0x0010 #(See Note #4)
+CC_HANDOVER_INFO_RSP = 0x0011 #(See Note #4)
+CC_DISCOVER_LIST_REQ = 0x0014
+CC_DISCOVER_LIST_CNF = 0x0015
+CC_DISCOVER_LIST_IND = 0x0016
+CC_LINK_NEW_REQ = 0x0018 #(See Note #2)
+CC_LINK_NEW_CNF = 0x0019 #(See Note #2)
+CC_LINK_MOD_REQ = 0x001C #(See Note #2)
+CC_LINK_MOD_CNF = 0x001D #(See Note #2)
+CC_LINK_SQZ_REQ = 0x0020 #(See Note #5)
+CC_LINK_SQZ_CNF = 0x0021 #(See Note #5)
+CC_LINK_REL_REQ = 0x0024 #(See Note #2)
+CC_LINK_REL_IND = 0x0025 #(See Note #2)
+CC_DETECT_REPORT_REQ = 0x0028 #(See Note #6)
+CC_DETECT_REPORT_CNF = 0x0029 #(See Note #6)
+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 #(See Note #7)
+CC_RELAY_IND = 0x003D #(See Note #7)
+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 = 0x0050 #(See Note #8)
+CC_DCPPC_RSP = 0x0051 #(See Note #8)
+CC_HP1_DET_REQ = 0x0054
+CC_HP1_DET_CNF = 0x0055
+CC_BLE_UPDATE_IND = 0x0058
+#to 0x1FFC : Reserved for future use = 0x005C
+#--- Proxy Coordinator ---
+CP_PROXY_APPOINT_REQ = 0x2000 #(See Note #9)
+CP_PROXY_APPOINT_CNF = 0x2001 #(See Note #9)
+PH_PROXY_APPOINT_IND = 0x2004 #(See Note #9)
+CP_PROXY_WAKE_REQ = 0x2008 #(See Note #9)
+#to 0x3FFC : Reserved for future use = 0x200C
+#--- CCo - CCo ---
+NN_INL_REQ = 0x4000
+NN_INL_CNF = 0x4001
+NN_NEW_NET_REQ = 0x4004
+NN_NEW_NET_CNF = 0x4005
+NN_NEW_NET_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 = 0x4010
+#to 0x5FFC : Reserved for future use = 0x4014
+#--- Station - Station ---
+CM_UNASSOCIATED_STA_IND = 0x6000
+CM_ENCRYPTED_PAYLOAD_IND = 0x6004
+CM_ENCRYPTED_PAYLOAD_RSP = 0x6005
+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 = 0x6014
+CM_TM_UPDATE_IND = 0x6018
+CM_AMP_MAP_REQ = 0x601C
+CM_AMP_MAP_CNF = 0x601D
+CM_BRG_INFO_REQ = 0x6020 #(See Note #10)
+CM_BRG_INFO_CNF = 0x6021 #(See Note #10)
+CM_CONN_NEW_REQ = 0x6024 #(See Note #2)
+CM_CONN_NEW_CNF = 0x6025 #(See Note #2)
+CM_CONN_REL_IND = 0x6028 #(See Note #2)
+CM_CONN_REL_RSP = 0x6029 #(See Note #2)
+CM_CONN_MOD_REQ = 0x602C #(See Note #2)
+CM_CONN_MOD_CNF = 0x602D #(See Note #2)
+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 = 0x6044
+CM_NW_STATS_REQ = 0x6048
+CM_NW_STATS_CNF = 0x6049
+CM_LINK_STATS_REQ = 0x604C
+CM_LINK_STATS_CNF = 0x604D
+#to 0x7FFC : Reserved for future use = 0x6050
+#--- Manufacturer Specific ---
+#to 0x9FFC : Manufacturer Specific Messages = 0x8000
+#--- Vendor Specific ---
+#to 0xBFFC : Vendor-Specific Messages = 0xA000
+
+
+
+#1-octet Field Identifier (FID) field
+#CSPEC_Field
+Delay_Bound = 0x00
+Jitter_Bound = 0x01
+Average_MSDU_Size = 0x02
+Maximum_MSDU_Size = 0x03
+Average_Data_Rate = 0x04
+Minimum_Data_Rate = 0x05
+Maximum_Data_Rate = 0x06
+Maximum_Inter_TXOP_time = 0x07
+Minimum_Inter_TXOP_time = 0x08
+Maximum_Burst_Size = 0x09
+Exception_Policy = 0x0a
+Inactivity_Interval = 0x0b
+MSDU_Error_Rate = 0x0c
+CLST = 0x0d
+CDESC = 0x0e
+Vendor_Specific = 0x0f
+ATS_Tolerance = 0x10
+Smallest_Tolerable_Average_Data_Rate = 0x11
+Original_Average_Data_Rate = 0x12
+#QoS_and_MAC_Parameter_Field_(CM-CM)
+Rx_Window_Size = 0x13
+Smoothing_Buffer_Size = 0x14
+Bidirectional_Burst_CM_CM = 0x15
+#QoS_and_MAC_Parameter_Field_(CM-CCo)
+TXOPs_per_Beacon_Period = 0x80
+Average_Number_of_PBs_per_TXOP = 0x81
+Minimum_Number_of_PBs_per_TXOP = 0x82
+Maximum_Number_of_PBs_per_TXOP = 0x83
+PPB_Threshold = 0x84
+Surplus_Bandwidth = 0x85
+Exception_Policy = 0x0a
+CDESC = 0x0e
+Vendor_Specific = 0x86
+Smallest_Tolerable_Average_Number_of_PBs_per_TXOP = 0x87
+Original_Average_Number_of_PBs_per_TXOP = 0x88
+Bidirectional_Burst_CM_CCO = 0x89
+
+
+
+#Global ID
+globalId = []
+i=0x80
+while i <= 0xF7:
+ globalId.append(i)
+ i=i+1
+i=0xFC
+while i <= 0xFE:
+ globalId.append(i)
+ i=i+1
+
+
+
+#Classifier_Rule_Identifier = Classifier_Rule_Identifier
+Ethernet_Destination_Address_Identifier = 0x00
+Ethernet_Source_Address_Identifier = 0x01
+VLAN_User_Priority_Identifier = 0x02
+VLAN_ID_Identifier = 0x03
+IPv4_Type_of_Service_Identifier = 0x04
+IPv4_Protocol_Identifier = 0x05
+IPv4_Source_Address_Identifier = 0x06
+IPv4_Destination_Address_Identifier = 0x07
+IPv6_Traffic_Class_Identifier = 0x08
+IPv6_Flow_Label_Identifier = 0x09
+IPv6_Source_Address_Identifier = 0x0A
+IPv6_Destination_Address_Identifier = 0x0B
+TCP_Source_Port_Identifier = 0x0C
+TCP_Destination_Port_Identifier = 0x0D
+UDP_Source_Port_Identifier = 0x0E
+UDP_Destination_Port_Identifier = 0x0F
+#-_Identifier = 0x10_–_0xDF
+#Vendor_defined_Classifier_Rule_Identifier = 0xE0_–_0xFF
+
+
+
+#Classifier_Rule_Identifier:Classifier_Rule_Size_(Octets)
+classifierRuleSize = {
+Ethernet_Destination_Address_Identifier:6,
+Ethernet_Source_Address_Identifier:6,
+VLAN_User_Priority_Identifier:1,
+VLAN_ID_Identifier:2,
+IPv4_Type_of_Service_Identifier:1,
+IPv4_Protocol_Identifier:1,
+IPv4_Source_Address_Identifier:4,
+IPv4_Destination_Address_Identifier:4,
+IPv6_Traffic_Class_Identifier:1,
+IPv6_Flow_Label_Identifier:3,
+IPv6_Source_Address_Identifier:16,
+IPv6_Destination_Address_Identifier:16,
+TCP_Source_Port_Identifier:2,
+TCP_Destination_Port_Identifier:2,
+UDP_Source_Port_Identifier:2,
+UDP_Destination_Port_Identifier:2
+#-_Identifier:-
+#Vendor_defined_Classifier_Rule_Identifier:-
+}
+
+
+
+
+#Interpretation = BEHDR_Value
+Non_Persistent_Schedule_BENTRY = 0x00
+Persistent_Schedule_BENTRY = 0x01
+Regions_BENTRY = 0x02
+MAC_Address_BENTRY = 0x03
+Discover_BENTRY = 0x04
+Discovered_Info_BENTRY = 0x05
+Beacon_Period_Start_Time_Offset_BENTRY = 0x06
+Encryption_Key_Change_BENTRY = 0x07
+CCo_Handover_BENTRY = 0x08
+Beacon_Relocation_BENTRY = 0x09
+AC_Line_Sync_Countdown_BENTRY = 0x0A
+Change_NumSlots_BENTRY = 0x0B
+Change_HM_BENTRY = 0x0C
+Change_SNID_BENTRY = 0x0D
+#Reserved_for_future_use = 0x0E-0xFE
+Vendor_Specific_BENTRY = 0xFF
+
+
+#BMI
+BMI = {
+0x00:"Non_Persistent_Schedule_BENTRY",
+0x01:"Persistent_Schedule_BENTRY",
+0x02:"Regions_BENTRY",
+0x03:"MAC_Address_BENTRY",
+0x04:"Discover_BENTRY",
+0x05:"Discovered_Info_BENTRY",
+0x06:"Beacon_Period_Start_Time_Offset_BENTRY",
+0x07:"Encryption_Key_Change_BENTRY",
+0x08:"CCo_Handover_BENTRY",
+0x09:"Beacon_Relocation_BENTRY",
+0x0A:"AC_Line_Sync_Countdown_BENTRY",
+0x0B:"Change_NumSlots_BENTRY",
+0x0C:"Change_HM_BENTRY",
+0x0D:"Change_SNID_BENTRY",
+0xFF:"Vendor_Specific_BENTRY"
+}
+
+
+
+
+
+
+
+
+
diff --git a/cesar/maximus/python/lib/mmentry/__init__.py b/cesar/maximus/python/lib/mmentry/__init__.py
new file mode 100644
index 0000000000..e3f95270ae
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/__init__.py
@@ -0,0 +1 @@
+from mmentryMethod import *
diff --git a/cesar/maximus/python/lib/mmentry/aes128/AES.py b/cesar/maximus/python/lib/mmentry/aes128/AES.py
new file mode 100644
index 0000000000..8413f4c109
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/aes128/AES.py
@@ -0,0 +1,31 @@
+"""Abstract class for AES."""
+
+class AES:
+ def __init__(self, key, mode, IV, implementation):
+ if len(key) not in (16, 24, 32):
+ raise AssertionError()
+ if mode != 2:
+ raise AssertionError()
+ if len(IV) != 16:
+ raise AssertionError()
+ self.isBlockCipher = True
+ self.block_size = 16
+ self.implementation = implementation
+ if len(key)==16:
+ self.name = "aes128"
+ elif len(key)==24:
+ self.name = "aes192"
+ elif len(key)==32:
+ self.name = "aes256"
+ else:
+ raise AssertionError()
+
+ #CBC-Mode encryption, returns ciphertext
+ #WARNING: *MAY* modify the input as well
+ def encrypt(self, plaintext):
+ assert(len(plaintext) % 16 == 0)
+
+ #CBC-Mode decryption, returns plaintext
+ #WARNING: *MAY* modify the input as well
+ def decrypt(self, ciphertext):
+ assert(len(ciphertext) % 16 == 0) \ No newline at end of file
diff --git a/cesar/maximus/python/lib/mmentry/aes128/Python_AES.py b/cesar/maximus/python/lib/mmentry/aes128/Python_AES.py
new file mode 100644
index 0000000000..657152f892
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/aes128/Python_AES.py
@@ -0,0 +1,68 @@
+"""Pure-Python AES implementation."""
+
+from cryptomath import *
+
+from AES import *
+from rijndael import rijndael
+
+def new(key, mode, IV):
+ return Python_AES(key, mode, IV)
+
+class Python_AES(AES):
+ def __init__(self, key, mode, IV):
+ AES.__init__(self, key, mode, IV, "python")
+ self.rijndael = rijndael(key, 16)
+ self.IV = IV
+
+ def encrypt(self, plaintext):
+ AES.encrypt(self, plaintext)
+
+ plaintextBytes = stringToBytes(plaintext)
+ chainBytes = stringToBytes(self.IV)
+
+ #CBC Mode: For each block...
+ for x in range(len(plaintextBytes)/16):
+
+ #XOR with the chaining block
+ blockBytes = plaintextBytes[x*16 : (x*16)+16]
+ for y in range(16):
+ blockBytes[y] ^= chainBytes[y]
+ blockString = bytesToString(blockBytes)
+
+ #Encrypt it
+ encryptedBytes = stringToBytes(self.rijndael.encrypt(blockString))
+
+ #Overwrite the input with the output
+ for y in range(16):
+ plaintextBytes[(x*16)+y] = encryptedBytes[y]
+
+ #Set the next chaining block
+ chainBytes = encryptedBytes
+
+ self.IV = bytesToString(chainBytes)
+ return bytesToString(plaintextBytes)
+
+ def decrypt(self, ciphertext):
+ AES.decrypt(self, ciphertext)
+
+ ciphertextBytes = stringToBytes(ciphertext)
+ chainBytes = stringToBytes(self.IV)
+
+ #CBC Mode: For each block...
+ for x in range(len(ciphertextBytes)/16):
+
+ #Decrypt it
+ blockBytes = ciphertextBytes[x*16 : (x*16)+16]
+ blockString = bytesToString(blockBytes)
+ decryptedBytes = stringToBytes(self.rijndael.decrypt(blockString))
+
+ #XOR with the chaining block and overwrite the input with output
+ for y in range(16):
+ decryptedBytes[y] ^= chainBytes[y]
+ ciphertextBytes[(x*16)+y] = decryptedBytes[y]
+
+ #Set the next chaining block
+ chainBytes = blockBytes
+
+ self.IV = bytesToString(chainBytes)
+ return bytesToString(ciphertextBytes)
diff --git a/cesar/maximus/python/lib/mmentry/aes128/__init__.py b/cesar/maximus/python/lib/mmentry/aes128/__init__.py
new file mode 100644
index 0000000000..d6738ad516
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/aes128/__init__.py
@@ -0,0 +1 @@
+from Python_AES import *
diff --git a/cesar/maximus/python/lib/mmentry/aes128/compat.py b/cesar/maximus/python/lib/mmentry/aes128/compat.py
new file mode 100644
index 0000000000..7d2d9250d8
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/aes128/compat.py
@@ -0,0 +1,140 @@
+"""Miscellaneous functions to mask Python version differences."""
+
+import sys
+import os
+
+if sys.version_info < (2,2):
+ raise AssertionError("Python 2.2 or later required")
+
+if sys.version_info < (2,3):
+
+ def enumerate(collection):
+ return zip(range(len(collection)), collection)
+
+ class Set:
+ def __init__(self, seq=None):
+ self.values = {}
+ if seq:
+ for e in seq:
+ self.values[e] = None
+
+ def add(self, e):
+ self.values[e] = None
+
+ def discard(self, e):
+ if e in self.values.keys():
+ del(self.values[e])
+
+ def union(self, s):
+ ret = Set()
+ for e in self.values.keys():
+ ret.values[e] = None
+ for e in s.values.keys():
+ ret.values[e] = None
+ return ret
+
+ def issubset(self, other):
+ for e in self.values.keys():
+ if e not in other.values.keys():
+ return False
+ return True
+
+ def __nonzero__( self):
+ return len(self.values.keys())
+
+ def __contains__(self, e):
+ return e in self.values.keys()
+
+ def __iter__(self):
+ return iter(set.values.keys())
+
+
+if os.name != "java":
+
+ import array
+ def createByteArraySequence(seq):
+ return array.array('B', seq)
+ def createByteArrayZeros(howMany):
+ return array.array('B', [0] * howMany)
+ def concatArrays(a1, a2):
+ return a1+a2
+
+ def bytesToString(bytes):
+ return bytes.tostring()
+ def stringToBytes(s):
+ bytes = createByteArrayZeros(0)
+ bytes.fromstring(s)
+ return bytes
+
+ import math
+ def numBits(n):
+ if n==0:
+ return 0
+ s = "%x" % n
+ return ((len(s)-1)*4) + \
+ {'0':0, '1':1, '2':2, '3':2,
+ '4':3, '5':3, '6':3, '7':3,
+ '8':4, '9':4, 'a':4, 'b':4,
+ 'c':4, 'd':4, 'e':4, 'f':4,
+ }[s[0]]
+ return int(math.floor(math.log(n, 2))+1)
+
+ BaseException = Exception
+ import sys
+ import traceback
+ def formatExceptionTrace(e):
+ newStr = "".join(traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ return newStr
+
+else:
+ #Jython 2.1 is missing lots of python 2.3 stuff,
+ #which we have to emulate here:
+ #NOTE: JYTHON SUPPORT NO LONGER WORKS, DUE TO USE OF GENERATORS.
+ #THIS CODE IS LEFT IN SO THAT ONE JYTHON UPDATES TO 2.2, IT HAS A
+ #CHANCE OF WORKING AGAIN.
+
+ import java
+ import jarray
+
+ def createByteArraySequence(seq):
+ if isinstance(seq, type("")): #If it's a string, convert
+ seq = [ord(c) for c in seq]
+ return jarray.array(seq, 'h') #use short instead of bytes, cause bytes are signed
+ def createByteArrayZeros(howMany):
+ return jarray.zeros(howMany, 'h') #use short instead of bytes, cause bytes are signed
+ def concatArrays(a1, a2):
+ l = list(a1)+list(a2)
+ return createByteArraySequence(l)
+
+ #WAY TOO SLOW - MUST BE REPLACED------------
+ def bytesToString(bytes):
+ return "".join([chr(b) for b in bytes])
+
+ def stringToBytes(s):
+ bytes = createByteArrayZeros(len(s))
+ for count, c in enumerate(s):
+ bytes[count] = ord(c)
+ return bytes
+ #WAY TOO SLOW - MUST BE REPLACED------------
+
+ def numBits(n):
+ if n==0:
+ return 0
+ n= 1L * n; #convert to long, if it isn't already
+ return n.__tojava__(java.math.BigInteger).bitLength()
+
+ #Adjust the string to an array of bytes
+ def stringToJavaByteArray(s):
+ bytes = jarray.zeros(len(s), 'b')
+ for count, c in enumerate(s):
+ x = ord(c)
+ if x >= 128: x -= 256
+ bytes[count] = x
+ return bytes
+
+ BaseException = java.lang.Exception
+ import sys
+ import traceback
+ def formatExceptionTrace(e):
+ newStr = "".join(traceback.format_exception(sys.exc_type, sys.exc_value, sys.exc_traceback))
+ return newStr \ No newline at end of file
diff --git a/cesar/maximus/python/lib/mmentry/aes128/cryptomath.py b/cesar/maximus/python/lib/mmentry/aes128/cryptomath.py
new file mode 100644
index 0000000000..51d6dff7c8
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/aes128/cryptomath.py
@@ -0,0 +1,400 @@
+"""cryptomath module
+
+This module has basic math/crypto code."""
+
+import os
+import math
+import base64
+import binascii
+import sha
+
+from compat import *
+
+
+# **************************************************************************
+# Load Optional Modules
+# **************************************************************************
+
+# Try to load M2Crypto/OpenSSL
+try:
+ from M2Crypto import m2
+ m2cryptoLoaded = True
+
+except ImportError:
+ m2cryptoLoaded = False
+
+
+# Try to load cryptlib
+try:
+ import cryptlib_py
+ try:
+ cryptlib_py.cryptInit()
+ except cryptlib_py.CryptException, e:
+ #If tlslite and cryptoIDlib are both present,
+ #they might each try to re-initialize this,
+ #so we're tolerant of that.
+ if e[0] != cryptlib_py.CRYPT_ERROR_INITED:
+ raise
+ cryptlibpyLoaded = True
+
+except ImportError:
+ cryptlibpyLoaded = False
+
+#Try to load GMPY
+try:
+ import gmpy
+ gmpyLoaded = True
+except ImportError:
+ gmpyLoaded = False
+
+#Try to load pycrypto
+try:
+ import Crypto.Cipher.AES
+ pycryptoLoaded = True
+except ImportError:
+ pycryptoLoaded = False
+
+
+# **************************************************************************
+# PRNG Functions
+# **************************************************************************
+
+# Get os.urandom PRNG
+try:
+ os.urandom(1)
+ def getRandomBytes(howMany):
+ return stringToBytes(os.urandom(howMany))
+ prngName = "os.urandom"
+
+except:
+ # Else get cryptlib PRNG
+ if cryptlibpyLoaded:
+ def getRandomBytes(howMany):
+ randomKey = cryptlib_py.cryptCreateContext(cryptlib_py.CRYPT_UNUSED,
+ cryptlib_py.CRYPT_ALGO_AES)
+ cryptlib_py.cryptSetAttribute(randomKey,
+ cryptlib_py.CRYPT_CTXINFO_MODE,
+ cryptlib_py.CRYPT_MODE_OFB)
+ cryptlib_py.cryptGenerateKey(randomKey)
+ bytes = createByteArrayZeros(howMany)
+ cryptlib_py.cryptEncrypt(randomKey, bytes)
+ return bytes
+ prngName = "cryptlib"
+
+ else:
+ #Else get UNIX /dev/urandom PRNG
+ try:
+ devRandomFile = open("/dev/urandom", "rb")
+ def getRandomBytes(howMany):
+ return stringToBytes(devRandomFile.read(howMany))
+ prngName = "/dev/urandom"
+ except IOError:
+ #Else get Win32 CryptoAPI PRNG
+ try:
+ import win32prng
+ def getRandomBytes(howMany):
+ s = win32prng.getRandomBytes(howMany)
+ if len(s) != howMany:
+ raise AssertionError()
+ return stringToBytes(s)
+ prngName ="CryptoAPI"
+ except ImportError:
+ #Else no PRNG :-(
+ def getRandomBytes(howMany):
+ raise NotImplementedError("No Random Number Generator "\
+ "available.")
+ prngName = "None"
+
+# **************************************************************************
+# Converter Functions
+# **************************************************************************
+
+def bytesToNumber(bytes):
+ total = 0L
+ multiplier = 1L
+ for count in range(len(bytes)-1, -1, -1):
+ byte = bytes[count]
+ total += multiplier * byte
+ multiplier *= 256
+ return total
+
+def numberToBytes(n):
+ howManyBytes = numBytes(n)
+ bytes = createByteArrayZeros(howManyBytes)
+ for count in range(howManyBytes-1, -1, -1):
+ bytes[count] = int(n % 256)
+ n >>= 8
+ return bytes
+
+def bytesToBase64(bytes):
+ s = bytesToString(bytes)
+ return stringToBase64(s)
+
+def base64ToBytes(s):
+ s = base64ToString(s)
+ return stringToBytes(s)
+
+def numberToBase64(n):
+ bytes = numberToBytes(n)
+ return bytesToBase64(bytes)
+
+def base64ToNumber(s):
+ bytes = base64ToBytes(s)
+ return bytesToNumber(bytes)
+
+def stringToNumber(s):
+ bytes = stringToBytes(s)
+ return bytesToNumber(bytes)
+
+def numberToString(s):
+ bytes = numberToBytes(s)
+ return bytesToString(bytes)
+
+def base64ToString(s):
+ try:
+ return base64.decodestring(s)
+ except binascii.Error, e:
+ raise SyntaxError(e)
+ except binascii.Incomplete, e:
+ raise SyntaxError(e)
+
+def stringToBase64(s):
+ return base64.encodestring(s).replace("\n", "")
+
+def mpiToNumber(mpi): #mpi is an openssl-format bignum string
+ if (ord(mpi[4]) & 0x80) !=0: #Make sure this is a positive number
+ raise AssertionError()
+ bytes = stringToBytes(mpi[4:])
+ return bytesToNumber(bytes)
+
+def numberToMPI(n):
+ bytes = numberToBytes(n)
+ ext = 0
+ #If the high-order bit is going to be set,
+ #add an extra byte of zeros
+ if (numBits(n) & 0x7)==0:
+ ext = 1
+ length = numBytes(n) + ext
+ bytes = concatArrays(createByteArrayZeros(4+ext), bytes)
+ bytes[0] = (length >> 24) & 0xFF
+ bytes[1] = (length >> 16) & 0xFF
+ bytes[2] = (length >> 8) & 0xFF
+ bytes[3] = length & 0xFF
+ return bytesToString(bytes)
+
+
+
+# **************************************************************************
+# Misc. Utility Functions
+# **************************************************************************
+
+def numBytes(n):
+ if n==0:
+ return 0
+ bits = numBits(n)
+ return int(math.ceil(bits / 8.0))
+
+def hashAndBase64(s):
+ return stringToBase64(sha.sha(s).digest())
+
+def getBase64Nonce(numChars=22): #defaults to an 132 bit nonce
+ bytes = getRandomBytes(numChars)
+ bytesStr = "".join([chr(b) for b in bytes])
+ return stringToBase64(bytesStr)[:numChars]
+
+
+# **************************************************************************
+# Big Number Math
+# **************************************************************************
+
+def getRandomNumber(low, high):
+ if low >= high:
+ raise AssertionError()
+ howManyBits = numBits(high)
+ howManyBytes = numBytes(high)
+ lastBits = howManyBits % 8
+ while 1:
+ bytes = getRandomBytes(howManyBytes)
+ if lastBits:
+ bytes[0] = bytes[0] % (1 << lastBits)
+ n = bytesToNumber(bytes)
+ if n >= low and n < high:
+ return n
+
+def gcd(a,b):
+ a, b = max(a,b), min(a,b)
+ while b:
+ a, b = b, a % b
+ return a
+
+def lcm(a, b):
+ #This will break when python division changes, but we can't use // cause
+ #of Jython
+ return (a * b) / gcd(a, b)
+
+#Returns inverse of a mod b, zero if none
+#Uses Extended Euclidean Algorithm
+def invMod(a, b):
+ c, d = a, b
+ uc, ud = 1, 0
+ while c != 0:
+ #This will break when python division changes, but we can't use //
+ #cause of Jython
+ q = d / c
+ c, d = d-(q*c), c
+ uc, ud = ud - (q * uc), uc
+ if d == 1:
+ return ud % b
+ return 0
+
+
+if gmpyLoaded:
+ def powMod(base, power, modulus):
+ base = gmpy.mpz(base)
+ power = gmpy.mpz(power)
+ modulus = gmpy.mpz(modulus)
+ result = pow(base, power, modulus)
+ return long(result)
+
+else:
+ #Copied from Bryan G. Olson's post to comp.lang.python
+ #Does left-to-right instead of pow()'s right-to-left,
+ #thus about 30% faster than the python built-in with small bases
+ def powMod(base, power, modulus):
+ nBitScan = 5
+
+ """ Return base**power mod modulus, using multi bit scanning
+ with nBitScan bits at a time."""
+
+ #TREV - Added support for negative exponents
+ negativeResult = False
+ if (power < 0):
+ power *= -1
+ negativeResult = True
+
+ exp2 = 2**nBitScan
+ mask = exp2 - 1
+
+ # Break power into a list of digits of nBitScan bits.
+ # The list is recursive so easy to read in reverse direction.
+ nibbles = None
+ while power:
+ nibbles = int(power & mask), nibbles
+ power = power >> nBitScan
+
+ # Make a table of powers of base up to 2**nBitScan - 1
+ lowPowers = [1]
+ for i in xrange(1, exp2):
+ lowPowers.append((lowPowers[i-1] * base) % modulus)
+
+ # To exponentiate by the first nibble, look it up in the table
+ nib, nibbles = nibbles
+ prod = lowPowers[nib]
+
+ # For the rest, square nBitScan times, then multiply by
+ # base^nibble
+ while nibbles:
+ nib, nibbles = nibbles
+ for i in xrange(nBitScan):
+ prod = (prod * prod) % modulus
+ if nib: prod = (prod * lowPowers[nib]) % modulus
+
+ #TREV - Added support for negative exponents
+ if negativeResult:
+ prodInv = invMod(prod, modulus)
+ #Check to make sure the inverse is correct
+ if (prod * prodInv) % modulus != 1:
+ raise AssertionError()
+ return prodInv
+ return prod
+
+
+#Pre-calculate a sieve of the ~100 primes < 1000:
+def makeSieve(n):
+ sieve = range(n)
+ for count in range(2, int(math.sqrt(n))):
+ if sieve[count] == 0:
+ continue
+ x = sieve[count] * 2
+ while x < len(sieve):
+ sieve[x] = 0
+ x += sieve[count]
+ sieve = [x for x in sieve[2:] if x]
+ return sieve
+
+sieve = makeSieve(1000)
+
+def isPrime(n, iterations=5, display=False):
+ #Trial division with sieve
+ for x in sieve:
+ if x >= n: return True
+ if n % x == 0: return False
+ #Passed trial division, proceed to Rabin-Miller
+ #Rabin-Miller implemented per Ferguson & Schneier
+ #Compute s, t for Rabin-Miller
+ if display: print "*",
+ s, t = n-1, 0
+ while s % 2 == 0:
+ s, t = s/2, t+1
+ #Repeat Rabin-Miller x times
+ a = 2 #Use 2 as a base for first iteration speedup, per HAC
+ for count in range(iterations):
+ v = powMod(a, s, n)
+ if v==1:
+ continue
+ i = 0
+ while v != n-1:
+ if i == t-1:
+ return False
+ else:
+ v, i = powMod(v, 2, n), i+1
+ a = getRandomNumber(2, n)
+ return True
+
+def getRandomPrime(bits, display=False):
+ if bits < 10:
+ raise AssertionError()
+ #The 1.5 ensures the 2 MSBs are set
+ #Thus, when used for p,q in RSA, n will have its MSB set
+ #
+ #Since 30 is lcm(2,3,5), we'll set our test numbers to
+ #29 % 30 and keep them there
+ low = (2L ** (bits-1)) * 3/2
+ high = 2L ** bits - 30
+ p = getRandomNumber(low, high)
+ p += 29 - (p % 30)
+ while 1:
+ if display: print ".",
+ p += 30
+ if p >= high:
+ p = getRandomNumber(low, high)
+ p += 29 - (p % 30)
+ if isPrime(p, display=display):
+ return p
+
+#Unused at the moment...
+def getRandomSafePrime(bits, display=False):
+ if bits < 10:
+ raise AssertionError()
+ #The 1.5 ensures the 2 MSBs are set
+ #Thus, when used for p,q in RSA, n will have its MSB set
+ #
+ #Since 30 is lcm(2,3,5), we'll set our test numbers to
+ #29 % 30 and keep them there
+ low = (2 ** (bits-2)) * 3/2
+ high = (2 ** (bits-1)) - 30
+ q = getRandomNumber(low, high)
+ q += 29 - (q % 30)
+ while 1:
+ if display: print ".",
+ q += 30
+ if (q >= high):
+ q = getRandomNumber(low, high)
+ q += 29 - (q % 30)
+ #Ideas from Tom Wu's SRP code
+ #Do trial division on p and q before Rabin-Miller
+ if isPrime(q, 0, display=display):
+ p = (2 * q) + 1
+ if isPrime(p, display=display):
+ if isPrime(q, display=display):
+ return p
diff --git a/cesar/maximus/python/lib/mmentry/aes128/rijndael.py b/cesar/maximus/python/lib/mmentry/aes128/rijndael.py
new file mode 100644
index 0000000000..cb2f547346
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/aes128/rijndael.py
@@ -0,0 +1,392 @@
+"""
+A pure python (slow) implementation of rijndael with a decent interface
+
+To include -
+
+from rijndael import rijndael
+
+To do a key setup -
+
+r = rijndael(key, block_size = 16)
+
+key must be a string of length 16, 24, or 32
+blocksize must be 16, 24, or 32. Default is 16
+
+To use -
+
+ciphertext = r.encrypt(plaintext)
+plaintext = r.decrypt(ciphertext)
+
+If any strings are of the wrong length a ValueError is thrown
+"""
+
+# ported from the Java reference code by Bram Cohen, bram@gawth.com, April 2001
+# this code is public domain, unless someone makes
+# an intellectual property claim against the reference
+# code, in which case it can be made public domain by
+# deleting all the comments and renaming all the variables
+
+import copy
+import string
+
+
+
+#-----------------------
+#TREV - ADDED BECAUSE THERE'S WARNINGS ABOUT INT OVERFLOW BEHAVIOR CHANGING IN
+#2.4.....
+import os
+if os.name != "java":
+ import exceptions
+ if hasattr(exceptions, "FutureWarning"):
+ import warnings
+ warnings.filterwarnings("ignore", category=FutureWarning, append=1)
+#-----------------------
+
+
+
+shifts = [[[0, 0], [1, 3], [2, 2], [3, 1]],
+ [[0, 0], [1, 5], [2, 4], [3, 3]],
+ [[0, 0], [1, 7], [3, 5], [4, 4]]]
+
+# [keysize][block_size]
+num_rounds = {16: {16: 10, 24: 12, 32: 14}, 24: {16: 12, 24: 12, 32: 14}, 32: {16: 14, 24: 14, 32: 14}}
+
+A = [[1, 1, 1, 1, 1, 0, 0, 0],
+ [0, 1, 1, 1, 1, 1, 0, 0],
+ [0, 0, 1, 1, 1, 1, 1, 0],
+ [0, 0, 0, 1, 1, 1, 1, 1],
+ [1, 0, 0, 0, 1, 1, 1, 1],
+ [1, 1, 0, 0, 0, 1, 1, 1],
+ [1, 1, 1, 0, 0, 0, 1, 1],
+ [1, 1, 1, 1, 0, 0, 0, 1]]
+
+# produce log and alog tables, needed for multiplying in the
+# field GF(2^m) (generator = 3)
+alog = [1]
+for i in xrange(255):
+ j = (alog[-1] << 1) ^ alog[-1]
+ if j & 0x100 != 0:
+ j ^= 0x11B
+ alog.append(j)
+
+log = [0] * 256
+for i in xrange(1, 255):
+ log[alog[i]] = i
+
+# multiply two elements of GF(2^m)
+def mul(a, b):
+ if a == 0 or b == 0:
+ return 0
+ return alog[(log[a & 0xFF] + log[b & 0xFF]) % 255]
+
+# substitution box based on F^{-1}(x)
+box = [[0] * 8 for i in xrange(256)]
+box[1][7] = 1
+for i in xrange(2, 256):
+ j = alog[255 - log[i]]
+ for t in xrange(8):
+ box[i][t] = (j >> (7 - t)) & 0x01
+
+B = [0, 1, 1, 0, 0, 0, 1, 1]
+
+# affine transform: box[i] <- B + A*box[i]
+cox = [[0] * 8 for i in xrange(256)]
+for i in xrange(256):
+ for t in xrange(8):
+ cox[i][t] = B[t]
+ for j in xrange(8):
+ cox[i][t] ^= A[t][j] * box[i][j]
+
+# S-boxes and inverse S-boxes
+S = [0] * 256
+Si = [0] * 256
+for i in xrange(256):
+ S[i] = cox[i][0] << 7
+ for t in xrange(1, 8):
+ S[i] ^= cox[i][t] << (7-t)
+ Si[S[i] & 0xFF] = i
+
+# T-boxes
+G = [[2, 1, 1, 3],
+ [3, 2, 1, 1],
+ [1, 3, 2, 1],
+ [1, 1, 3, 2]]
+
+AA = [[0] * 8 for i in xrange(4)]
+
+for i in xrange(4):
+ for j in xrange(4):
+ AA[i][j] = G[i][j]
+ AA[i][i+4] = 1
+
+for i in xrange(4):
+ pivot = AA[i][i]
+ if pivot == 0:
+ t = i + 1
+ while AA[t][i] == 0 and t < 4:
+ t += 1
+ assert t != 4, 'G matrix must be invertible'
+ for j in xrange(8):
+ AA[i][j], AA[t][j] = AA[t][j], AA[i][j]
+ pivot = AA[i][i]
+ for j in xrange(8):
+ if AA[i][j] != 0:
+ AA[i][j] = alog[(255 + log[AA[i][j] & 0xFF] - log[pivot & 0xFF]) % 255]
+ for t in xrange(4):
+ if i != t:
+ for j in xrange(i+1, 8):
+ AA[t][j] ^= mul(AA[i][j], AA[t][i])
+ AA[t][i] = 0
+
+iG = [[0] * 4 for i in xrange(4)]
+
+for i in xrange(4):
+ for j in xrange(4):
+ iG[i][j] = AA[i][j + 4]
+
+def mul4(a, bs):
+ if a == 0:
+ return 0
+ r = 0
+ for b in bs:
+ r <<= 8
+ if b != 0:
+ r = r | mul(a, b)
+ return r
+
+T1 = []
+T2 = []
+T3 = []
+T4 = []
+T5 = []
+T6 = []
+T7 = []
+T8 = []
+U1 = []
+U2 = []
+U3 = []
+U4 = []
+
+for t in xrange(256):
+ s = S[t]
+ T1.append(mul4(s, G[0]))
+ T2.append(mul4(s, G[1]))
+ T3.append(mul4(s, G[2]))
+ T4.append(mul4(s, G[3]))
+
+ s = Si[t]
+ T5.append(mul4(s, iG[0]))
+ T6.append(mul4(s, iG[1]))
+ T7.append(mul4(s, iG[2]))
+ T8.append(mul4(s, iG[3]))
+
+ U1.append(mul4(t, iG[0]))
+ U2.append(mul4(t, iG[1]))
+ U3.append(mul4(t, iG[2]))
+ U4.append(mul4(t, iG[3]))
+
+# round constants
+rcon = [1]
+r = 1
+for t in xrange(1, 30):
+ r = mul(2, r)
+ rcon.append(r)
+
+del A
+del AA
+del pivot
+del B
+del G
+del box
+del log
+del alog
+del i
+del j
+del r
+del s
+del t
+del mul
+del mul4
+del cox
+del iG
+
+class rijndael:
+ def __init__(self, key, block_size = 16):
+ if block_size != 16 and block_size != 24 and block_size != 32:
+ raise ValueError('Invalid block size: ' + str(block_size))
+ if len(key) != 16 and len(key) != 24 and len(key) != 32:
+ raise ValueError('Invalid key size: ' + str(len(key)))
+ self.block_size = block_size
+
+ ROUNDS = num_rounds[len(key)][block_size]
+ BC = block_size / 4
+ # encryption round keys
+ Ke = [[0] * BC for i in xrange(ROUNDS + 1)]
+ # decryption round keys
+ Kd = [[0] * BC for i in xrange(ROUNDS + 1)]
+ ROUND_KEY_COUNT = (ROUNDS + 1) * BC
+ KC = len(key) / 4
+
+ # copy user material bytes into temporary ints
+ tk = []
+ for i in xrange(0, KC):
+ tk.append((ord(key[i * 4]) << 24) | (ord(key[i * 4 + 1]) << 16) |
+ (ord(key[i * 4 + 2]) << 8) | ord(key[i * 4 + 3]))
+
+ # copy values into round key arrays
+ t = 0
+ j = 0
+ while j < KC and t < ROUND_KEY_COUNT:
+ Ke[t / BC][t % BC] = tk[j]
+ Kd[ROUNDS - (t / BC)][t % BC] = tk[j]
+ j += 1
+ t += 1
+ tt = 0
+ rconpointer = 0
+ while t < ROUND_KEY_COUNT:
+ # extrapolate using phi (the round key evolution function)
+ tt = tk[KC - 1]
+ tk[0] ^= (S[(tt >> 16) & 0xFF] & 0xFF) << 24 ^ \
+ (S[(tt >> 8) & 0xFF] & 0xFF) << 16 ^ \
+ (S[ tt & 0xFF] & 0xFF) << 8 ^ \
+ (S[(tt >> 24) & 0xFF] & 0xFF) ^ \
+ (rcon[rconpointer] & 0xFF) << 24
+ rconpointer += 1
+ if KC != 8:
+ for i in xrange(1, KC):
+ tk[i] ^= tk[i-1]
+ else:
+ for i in xrange(1, KC / 2):
+ tk[i] ^= tk[i-1]
+ tt = tk[KC / 2 - 1]
+ tk[KC / 2] ^= (S[ tt & 0xFF] & 0xFF) ^ \
+ (S[(tt >> 8) & 0xFF] & 0xFF) << 8 ^ \
+ (S[(tt >> 16) & 0xFF] & 0xFF) << 16 ^ \
+ (S[(tt >> 24) & 0xFF] & 0xFF) << 24
+ for i in xrange(KC / 2 + 1, KC):
+ tk[i] ^= tk[i-1]
+ # copy values into round key arrays
+ j = 0
+ while j < KC and t < ROUND_KEY_COUNT:
+ Ke[t / BC][t % BC] = tk[j]
+ Kd[ROUNDS - (t / BC)][t % BC] = tk[j]
+ j += 1
+ t += 1
+ # inverse MixColumn where needed
+ for r in xrange(1, ROUNDS):
+ for j in xrange(BC):
+ tt = Kd[r][j]
+ Kd[r][j] = U1[(tt >> 24) & 0xFF] ^ \
+ U2[(tt >> 16) & 0xFF] ^ \
+ U3[(tt >> 8) & 0xFF] ^ \
+ U4[ tt & 0xFF]
+ self.Ke = Ke
+ self.Kd = Kd
+
+ def encrypt(self, plaintext):
+ if len(plaintext) != self.block_size:
+ raise ValueError('wrong block length, expected ' + str(self.block_size) + ' got ' + str(len(plaintext)))
+ Ke = self.Ke
+
+ BC = self.block_size / 4
+ ROUNDS = len(Ke) - 1
+ if BC == 4:
+ SC = 0
+ elif BC == 6:
+ SC = 1
+ else:
+ SC = 2
+ s1 = shifts[SC][1][0]
+ s2 = shifts[SC][2][0]
+ s3 = shifts[SC][3][0]
+ a = [0] * BC
+ # temporary work array
+ t = []
+ # plaintext to ints + key
+ for i in xrange(BC):
+ t.append((ord(plaintext[i * 4 ]) << 24 |
+ ord(plaintext[i * 4 + 1]) << 16 |
+ ord(plaintext[i * 4 + 2]) << 8 |
+ ord(plaintext[i * 4 + 3]) ) ^ Ke[0][i])
+ # apply round transforms
+ for r in xrange(1, ROUNDS):
+ for i in xrange(BC):
+ a[i] = (T1[(t[ i ] >> 24) & 0xFF] ^
+ T2[(t[(i + s1) % BC] >> 16) & 0xFF] ^
+ T3[(t[(i + s2) % BC] >> 8) & 0xFF] ^
+ T4[ t[(i + s3) % BC] & 0xFF] ) ^ Ke[r][i]
+ t = copy.copy(a)
+ # last round is special
+ result = []
+ for i in xrange(BC):
+ tt = Ke[ROUNDS][i]
+ result.append((S[(t[ i ] >> 24) & 0xFF] ^ (tt >> 24)) & 0xFF)
+ result.append((S[(t[(i + s1) % BC] >> 16) & 0xFF] ^ (tt >> 16)) & 0xFF)
+ result.append((S[(t[(i + s2) % BC] >> 8) & 0xFF] ^ (tt >> 8)) & 0xFF)
+ result.append((S[ t[(i + s3) % BC] & 0xFF] ^ tt ) & 0xFF)
+ return string.join(map(chr, result), '')
+
+ def decrypt(self, ciphertext):
+ if len(ciphertext) != self.block_size:
+ raise ValueError('wrong block length, expected ' + str(self.block_size) + ' got ' + str(len(plaintext)))
+ Kd = self.Kd
+
+ BC = self.block_size / 4
+ ROUNDS = len(Kd) - 1
+ if BC == 4:
+ SC = 0
+ elif BC == 6:
+ SC = 1
+ else:
+ SC = 2
+ s1 = shifts[SC][1][1]
+ s2 = shifts[SC][2][1]
+ s3 = shifts[SC][3][1]
+ a = [0] * BC
+ # temporary work array
+ t = [0] * BC
+ # ciphertext to ints + key
+ for i in xrange(BC):
+ t[i] = (ord(ciphertext[i * 4 ]) << 24 |
+ ord(ciphertext[i * 4 + 1]) << 16 |
+ ord(ciphertext[i * 4 + 2]) << 8 |
+ ord(ciphertext[i * 4 + 3]) ) ^ Kd[0][i]
+ # apply round transforms
+ for r in xrange(1, ROUNDS):
+ for i in xrange(BC):
+ a[i] = (T5[(t[ i ] >> 24) & 0xFF] ^
+ T6[(t[(i + s1) % BC] >> 16) & 0xFF] ^
+ T7[(t[(i + s2) % BC] >> 8) & 0xFF] ^
+ T8[ t[(i + s3) % BC] & 0xFF] ) ^ Kd[r][i]
+ t = copy.copy(a)
+ # last round is special
+ result = []
+ for i in xrange(BC):
+ tt = Kd[ROUNDS][i]
+ result.append((Si[(t[ i ] >> 24) & 0xFF] ^ (tt >> 24)) & 0xFF)
+ result.append((Si[(t[(i + s1) % BC] >> 16) & 0xFF] ^ (tt >> 16)) & 0xFF)
+ result.append((Si[(t[(i + s2) % BC] >> 8) & 0xFF] ^ (tt >> 8)) & 0xFF)
+ result.append((Si[ t[(i + s3) % BC] & 0xFF] ^ tt ) & 0xFF)
+ return string.join(map(chr, result), '')
+
+def encrypt(key, block):
+ return rijndael(key, len(block)).encrypt(block)
+
+def decrypt(key, block):
+ return rijndael(key, len(block)).decrypt(block)
+
+def test():
+ def t(kl, bl):
+ b = 'b' * bl
+ r = rijndael('a' * kl, bl)
+ assert r.decrypt(r.encrypt(b)) == b
+ t(16, 16)
+ t(16, 24)
+ t(16, 32)
+ t(24, 16)
+ t(24, 24)
+ t(24, 32)
+ t(32, 16)
+ t(32, 24)
+ t(32, 32)
+
diff --git a/cesar/maximus/python/lib/mmentry/bmi/__init__.py b/cesar/maximus/python/lib/mmentry/bmi/__init__.py
new file mode 100644
index 0000000000..f189dd89ca
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/bmi/__init__.py
@@ -0,0 +1 @@
+from bmiMethod import *
diff --git a/cesar/maximus/python/lib/mmentry/bmi/bmiBody.py b/cesar/maximus/python/lib/mmentry/bmi/bmiBody.py
new file mode 100644
index 0000000000..a4077ea200
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/bmi/bmiBody.py
@@ -0,0 +1,21 @@
+# -*- coding:Utf-8 -*-
+class BmiBody():
+
+
+ #Interpretation
+ Non_Persistent_Schedule_BENTRY = "NS+RSVD+SAI(STPF+GLID+ST+ET)*NS=6Fields"
+ Persistent_Schedule_BENTRY = ""
+ Regions_BENTRY = ""
+ MAC_Address_BENTRY = ""
+ Discover_BENTRY = ""
+ Discovered_Info_BENTRY = ""
+ Beacon_Period_Start_Time_Offset_BENTRY = ""
+ Encryption_Key_Change_BENTRY = ""
+ CCo_Handover_BENTRY = ""
+ Beacon_Relocation_BENTRY = ""
+ AC_Line_Sync_Countdown_BENTRY = ""
+ Change_NumSlots_BENTRY = ""
+ Change_HM_BENTRY = ""
+ Change_SNID_BENTRY = ""
+ #Reserved_for_future_use
+ Vendor_Specific_BENTRY = ""
diff --git a/cesar/maximus/python/lib/mmentry/bmi/bmiMethod.py b/cesar/maximus/python/lib/mmentry/bmi/bmiMethod.py
new file mode 100644
index 0000000000..a0fa7fb6fb
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/bmi/bmiMethod.py
@@ -0,0 +1,482 @@
+# -*- coding:Utf-8 -*-
+#BMI Methods
+
+from bmiBody import *
+from struct import *
+import sys
+sys.path.append('../../python/lib/mmentry')
+from Constants import *
+from random import *
+
+
+#BmiMethod can create every BMI Body of Beacons
+# from BMI format
+class BmiMethod():
+
+ bmiBody = BmiBody()
+
+ #createNon_Persistent_Schedule_BENTRY creates
+ # the BENTRY Field of the Beacon
+ ns = 63
+ #SAIs :
+ stpf = [] #Star Time Field present by default
+ glid = [] #Local CSMA allocation by default
+ st = [] #0 µs by default
+ et = [] #AllocationTimeUnit by default
+ rsvd = 0 #Reserved = 0 by default
+ sais = []
+ saisField = []
+ i = 0
+ stpf.append(1)
+ glid.append(0x7F)
+ st.append(0)
+ et.append(int(randrange(0,3906/(ns-i),1)))
+ sai = (stpf[i]+glid[i]*pow(2,1)+st[i]*pow(2,8)+et[i]*pow(2,20))*stpf[i] + (stpf[i]+glid[i]*pow(2,1)+et[i]*pow(2,8))*((stpf[i]+1)%2)
+ sais.append(sai)
+ saisField.append(pack('I',sai)[0:3+stpf[i]])
+ i = i + 1
+ while i < ns-1:
+ stpf.append(0)
+ glid.append(0x7F)
+ st.append(et[i-1])
+ et.append(int(randrange(et[i-1],((3906-et[i-1])/(ns-i))+et[i-1],1)))
+ sai = (stpf[i]+glid[i]*pow(2,1)+st[i]*pow(2,8)+et[i]*pow(2,20))*stpf[i] + (stpf[i]+glid[i]*pow(2,1)+et[i]*pow(2,8))*((stpf[i]+1)%2)
+ sais.append(sai)
+ saisField.append(pack('I',sai)[0:3+stpf[i]])
+ i = i + 1
+ stpf.append(0)
+ glid.append(0x7F)
+ st.append(et[i-1])
+ et.append(3906)
+ sai = (stpf[i]+glid[i]*pow(2,1)+st[i]*pow(2,8)+et[i]*pow(2,20))*stpf[i] + (stpf[i]+glid[i]*pow(2,1)+et[i]*pow(2,8))*((stpf[i]+1)%2)
+ sais.append(sai)
+ saisField.append(pack('I',sai)[0:3+stpf[i]])
+ i = i + 1
+ def createNon_Persistent_Schedule_BENTRY(self, myNs=None, myStpf=None, myGlid=None, myFirtsSt=None, MyRandomEt=False, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myNs!=None:
+ self.ns=myNs
+ self.i = 0
+ if myStpf!=None:
+ self.stpf[self.i] = myStpf
+ if myGlid!=None:
+ self.glid[self.i] = myGlid
+ if myFirtsSt!=None:
+ self.stpf[self.i] = 1
+ self.st[self.i] = myFirtsSt
+ if MyRandomEt!=False:
+ self.et[self.i] = int(randrange(0,3906/(self.ns-self.i),1))
+ self.sai = (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.st[self.i]*pow(2,8)+self.et[self.i]*pow(2,20))*self.stpf[self.i] + (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.et[self.i]*pow(2,8))*((self.stpf[self.i]+1)%2)
+ self.sais[self.i] = self.sai
+ self.saisField[self.i] = pack('I',self.sai)[0:3+self.stpf[self.i]]
+ self.i = self.i + 1
+ while self.i < self.ns-1:
+ if myStpf!=None:
+ self.stpf[self.i] = myStpf
+ if myGlid!=None:
+ self.glid[self.i] = myGlid
+ if self.stpf[self.i]==0:
+ self.st[self.i] = self.et[self.i-1]
+ if MyRandomEt!=False:
+ self.et[self.i] = int(randrange(self.et[self.i-1],((3906-self.et[self.i-1])/(self.ns-self.i))+self.et[self.i-1],1))
+ self.sai = (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.st[self.i]*pow(2,8)+self.et[self.i]*pow(2,20))*self.stpf[self.i] + (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.et[self.i]*pow(2,8))*((self.stpf[self.i]+1)%2)
+ self.sais[self.i] = self.sai
+ self.saisField[self.i] = pack('I',self.sai)[0:3+self.stpf[self.i]]
+ self.i = self.i + 1
+ if myStpf!=None:
+ self.stpf[self.i] = myStpf
+ if myGlid!=None:
+ self.glid[self.i] = myGlid
+ if self.stpf[self.i]==0:
+ self.st[self.i] = self.et[self.i-1]
+ self.et[self.i] = 3906
+ self.sai = (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.st[self.i]*pow(2,8)+self.et[self.i]*pow(2,20))*self.stpf[self.i] + (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.et[self.i]*pow(2,8))*((self.stpf[self.i]+1)%2)
+ self.sais[self.i] = self.sai
+ self.saisField[self.i] = pack('I',self.sai)[0:3+self.stpf[self.i]]
+ self.i = self.i + 1
+ self.bmiBody.Non_Persistent_Schedule_BENTRY = pack('B',self.ns)
+ self.i = 0
+ print "ns = "+hex(self.ns)
+ while self.i < self.ns:
+ self.bmiBody.Non_Persistent_Schedule_BENTRY = self.bmiBody.Non_Persistent_Schedule_BENTRY + self.saisField[self.i]
+ print "stpf["+str(self.i)+"] = "+hex(self.stpf[self.i])
+ print "glid["+str(self.i)+"] = "+hex(self.glid[self.i])
+ print "st["+str(self.i)+"] = "+hex(self.st[self.i])
+ print "et["+str(self.i)+"] = "+hex(self.et[self.i])
+ self.i = self.i + 1
+ return self.bmiBody.Non_Persistent_Schedule_BENTRY
+
+ #createPersistent_Schedule_BENTRY creates
+ # the BENTRY Field of the Beacon
+ pscd = 0 #Currently used schedule by default
+ cscd = 0 #Only for the current period by default
+ #ns = 63
+ ##SAIs :
+ #stpf = [] #Star Time Field present by default
+ #glid = [] #Local CSMA allocation by default
+ #st = [] #0 µs by default
+ #et = [] #AllocationTimeUnit by default
+ #rsvd = 0 #Reserved = 0 by default
+ #sais = []
+ #saisField = []
+ #i = 0
+ #stpf.append(1)
+ #glid.append(0x7F)
+ #st.append(0)
+ #et.append(int(randrange(0,3906/(ns-i),1)))
+ #sai = (stpf[i]+glid[i]*pow(2,1)+st[i]*pow(2,8)+et[i]*pow(2,20))*stpf[i] + (stpf[i]+glid[i]*pow(2,1)+et[i]*pow(2,8))*((stpf[i]+1)%2)
+ #sais.append(sai)
+ #saisField.append(pack('I',sai)[0:3+stpf[i]])
+ #i = i + 1
+ #while i < ns-1:
+ #stpf.append(0)
+ #glid.append(0x7F)
+ #st.append(et[i-1])
+ #et.append(int(randrange(et[i-1],((3906-et[i-1])/(ns-i))+et[i-1],1)))
+ #sai = (stpf[i]+glid[i]*pow(2,1)+st[i]*pow(2,8)+et[i]*pow(2,20))*stpf[i] + (stpf[i]+glid[i]*pow(2,1)+et[i]*pow(2,8))*((stpf[i]+1)%2)
+ #sais.append(sai)
+ #saisField.append(pack('I',sai)[0:3+stpf[i]])
+ #i = i + 1
+ #stpf.append(0)
+ #glid.append(0x7F)
+ #st.append(et[i-1])
+ #et.append(3906)
+ #sai = (stpf[i]+glid[i]*pow(2,1)+st[i]*pow(2,8)+et[i]*pow(2,20))*stpf[i] + (stpf[i]+glid[i]*pow(2,1)+et[i]*pow(2,8))*((stpf[i]+1)%2)
+ #sais.append(sai)
+ #saisField.append(pack('I',sai)[0:3+stpf[i]])
+ #i = i + 1
+ def createPersistent_Schedule_BENTRY(self, myPscd=None, myCscd=None, myNs=None, myStpf=None, myGlid=None, myFirtsSt=None, MyRandomEt=False, param8=None, param9=None, paramA=None, paramB=None):
+ if myPscd!=None:
+ self.pscd=myPscd
+ if myCscd!=None:
+ self.cscd=myCscd
+ if myNs!=None:
+ self.ns=myNs
+ self.i = 0
+ if myStpf!=None:
+ self.stpf[self.i] = myStpf
+ if myGlid!=None:
+ self.glid[self.i] = myGlid
+ if myFirtsSt!=None:
+ self.stpf[self.i] = 1
+ self.st[self.i] = myFirtsSt
+ if MyRandomEt!=False:
+ self.et[self.i] = int(randrange(0,3906/(self.ns-self.i),1))
+ self.sai = (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.st[self.i]*pow(2,8)+self.et[self.i]*pow(2,20))*self.stpf[self.i] + (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.et[self.i]*pow(2,8))*((self.stpf[self.i]+1)%2)
+ self.sais[self.i] = self.sai
+ self.saisField[self.i] = pack('I',self.sai)[0:3+self.stpf[self.i]]
+ self.i = self.i + 1
+ while self.i < self.ns-1:
+ if myStpf!=None:
+ self.stpf[self.i] = myStpf
+ if myGlid!=None:
+ self.glid[self.i] = myGlid
+ if self.stpf[self.i]==0:
+ self.st[self.i] = self.et[self.i-1]
+ if MyRandomEt!=False:
+ self.et[self.i] = int(randrange(self.et[self.i-1],((3906-self.et[self.i-1])/(self.ns-self.i))+self.et[self.i-1],1))
+ self.sai = (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.st[self.i]*pow(2,8)+self.et[self.i]*pow(2,20))*self.stpf[self.i] + (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.et[self.i]*pow(2,8))*((self.stpf[self.i]+1)%2)
+ self.sais[self.i] = self.sai
+ self.saisField[self.i] = pack('I',self.sai)[0:3+self.stpf[self.i]]
+ self.i = self.i + 1
+ if myStpf!=None:
+ self.stpf[self.i] = myStpf
+ if myGlid!=None:
+ self.glid[self.i] = myGlid
+ if self.stpf[self.i]==0:
+ self.st[self.i] = self.et[self.i-1]
+ self.et[self.i] = 3906
+ self.sai = (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.st[self.i]*pow(2,8)+self.et[self.i]*pow(2,20))*self.stpf[self.i] + (self.stpf[self.i]+self.glid[self.i]*pow(2,1)+self.et[self.i]*pow(2,8))*((self.stpf[self.i]+1)%2)
+ self.sais[self.i] = self.sai
+ self.saisField[self.i] = pack('I',self.sai)[0:3+self.stpf[self.i]]
+ self.i = self.i + 1
+ self.bmiBody.Persistent_Schedule_BENTRY = pack('B',self.pscd + self.cscd*pow(2,3)) + pack('B',self.ns)
+ self.i = 0
+ print "pscd = "+hex(self.pscd)
+ print "cscd = "+hex(self.cscd)
+ print "ns = "+hex(self.ns)
+ while self.i < self.ns:
+ self.bmiBody.Persistent_Schedule_BENTRY = self.bmiBody.Persistent_Schedule_BENTRY + self.saisField[self.i]
+ print "stpf["+str(self.i)+"] = "+hex(self.stpf[self.i])
+ print "glid["+str(self.i)+"] = "+hex(self.glid[self.i])
+ print "st["+str(self.i)+"] = "+hex(self.st[self.i])
+ print "et["+str(self.i)+"] = "+hex(self.et[self.i])
+ self.i = self.i + 1
+ return self.bmiBody.Persistent_Schedule_BENTRY
+
+ #createRegions_BENTRY creates
+ # the BENTRY Field of the Beacon
+ nr = 63
+ rt = [] #Reserved Regions by default
+ ret = [] #AllocationTimeUnit by default
+ rtRets = []
+ rtRetsField = []
+ i = 0
+ rt.append(0)
+ ret.append(int(randrange(0,3906/(nr-i),1)))
+ rtRet = rt[i] + ret[i]*pow(2,4)
+ rtRets.append(rtRet)
+ rtRetsField.append(pack('H',rtRet))
+ i = i + 1
+ while i < nr-1:
+ rt.append(0)
+ ret.append(int(randrange(ret[i-1],((3906-ret[i-1])/(nr-i))+ret[i-1],1)))
+ rtRet = rt[i] + ret[i]*pow(2,4)
+ rtRets.append(rtRet)
+ rtRetsField.append(pack('H',rtRet))
+ i = i + 1
+ rt.append(0)
+ ret.append(3906)
+ rtRet = rt[i] + ret[i]*pow(2,4)
+ rtRets.append(rtRet)
+ rtRetsField.append(pack('H',rtRet))
+ i = i + 1
+ def createRegions_BENTRY(self, myNr=None, myRt=None, MyRandomRet=False, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myNr!=None:
+ self.nr=myNr
+ self.i = 0
+ if myRt!=None:
+ self.rt[self.i] = myRt
+ if MyRandomRet!=False:
+ self.ret[self.i] = int(randrange(0,3906/(self.nr-self.i),1))
+ self.rtRet = self.rt[self.i] + self.ret[self.i]*pow(2,4)
+ self.rtRets[self.i] = self.rtRet
+ self.rtRetsField[self.i] = pack('H',self.rtRet)
+ self.i = self.i + 1
+ while self.i < self.nr-1:
+ if myRt!=None:
+ self.rt[self.i] = myRt
+ if MyRandomRet!=False:
+ self.ret[self.i] = int(randrange(self.ret[self.i-1],((3906-self.ret[self.i-1])/(self.nr-self.i))+self.ret[self.i-1],1))
+ self.rtRet = self.rt[self.i] + self.ret[self.i]*pow(2,4)
+ self.rtRets[self.i] = self.rtRet
+ self.rtRetsField[self.i] = pack('H',self.rtRet)
+ self.i = self.i + 1
+ if myRt!=None:
+ self.rt[self.i] = myRt
+ self.ret[self.i] = 3906
+ self.rtRet = self.rt[self.i] + self.ret[self.i]*pow(2,4)
+ self.rtRets[self.i] = self.rtRet
+ self.rtRetsField[self.i] = pack('H',self.rtRet)
+ self.i = self.i + 1
+ self.bmiBody.Regions_BENTRY = pack('B',self.nr)
+ self.i = 0
+ print "nr = "+hex(self.nr)
+ while self.i < self.nr:
+ self.bmiBody.Regions_BENTRY = self.bmiBody.Regions_BENTRY + self.rtRetsField[self.i]
+ print "rt["+str(self.i)+"] = "+hex(self.rt[self.i])
+ print "ret["+str(self.i)+"] = "+hex(self.ret[self.i])
+ self.i = self.i + 1
+ return self.bmiBody.Regions_BENTRY
+
+ #createMAC_Address_BENTRY creates
+ # the BENTRY Field of the Beacon
+ macAddress = 0x5952544E4542 #="BENTRY"
+ def createMAC_Address_BENTRY(self, myMacAddress=None, param2=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myMacAddress!=None:
+ self.macAddress=myMacAddress
+ self.bmiBody.MAC_Address_BENTRY = pack('Q',self.macAddress)[0:6]
+ print "macAddress = "+hex(self.macAddress)
+ return self.bmiBody.MAC_Address_BENTRY
+
+ #createDiscover_BENTRY creates
+ # the BENTRY Field of the Beacon
+ tei = 0x54
+ def createDiscover_BENTRY(self, myTei=None, param2=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myTei!=None:
+ self.tei=myTei
+ self.bmiBody.Discover_BENTRY = pack('B',self.tei)
+ print "tei = "+hex(self.tei)
+ return self.bmiBody.Discover_BENTRY
+
+ #createDiscovered_Info_BENTRY creates
+ # the BENTRY Field of the Beacon
+ updated = 0 #Not changed by default
+ ccoCapability = 0 #Level 0 by default
+ proxyNetworkCapability = 0 #Not supported by default
+ backupCcoCapability = 0 #Not supported by default
+ ccoStatus = 0 #Not CCo by default
+ pcoStatus = 0 #Not PCo by default
+ backupCcoStatus = 0 #Not Backup CCo by default
+ numDisSta = 0 #0 by default
+ numDisNet = 0 #0 by default
+ authenticationStatus = 0 #Not Authenticated by default
+ userAppointedCcoStatus = 0 #Not User Appointed CCo by default
+ def createDiscovered_Info_BENTRY(self, myUpdated=None, myCcoCapability=None, myProxyNetworkCapability=None, myBackupCcoCapability=None, myCcoStatus=None, myPcoStatus=None, myBackupCcoStatus=None, myNumDisSta=None, myNumDisNet=None, myAuthenticationStatus=None, myUserAppointedCcoStatus=None):
+ if myUpdated!=None:
+ self.updated=myUpdated
+ if myCcoCapability!=None:
+ self.ccoCapability=myCcoCapability
+ if myProxyNetworkCapability!=None:
+ self.proxyNetworkCapability=myProxyNetworkCapability
+ if myBackupCcoCapability!=None:
+ self.backupCcoCapability=myBackupCcoCapability
+ if myCcoStatus!=None:
+ self.ccoStatus=myCcoStatus
+ if myPcoStatus!=None:
+ self.pcoStatus=myPcoStatus
+ if myBackupCcoStatus!=None:
+ self.backupCcoStatus=myBackupCcoStatus
+ if myNumDisSta!=None:
+ self.numDisSta=myNumDisSta
+ if myNumDisNet!=None:
+ self.numDisNet=myNumDisNet
+ if myAuthenticationStatus!=None:
+ self.authenticationStatus=myAuthenticationStatus
+ if myUserAppointedCcoStatus!=None:
+ self.userAppointedCcoStatus=myUserAppointedCcoStatus
+ self.bmiBody.Discovered_Info_BENTRY = pack('B',self.updated + self.ccoCapability*pow(2,1) + self.proxyNetworkCapability*pow(2,3) + self.backupCcoCapability*pow(2,4) + self.ccoStatus*pow(2,5) + self.pcoStatus*pow(2,6) + self.backupCcoStatus*pow(2,7)) + pack('B',self.numDisSta) + pack('B',self.numDisNet) + pack('B',self.authenticationStatus + self.userAppointedCcoStatus*pow(2,1))
+ print "updated = "+hex(self.updated)
+ print "ccoCapability = "+hex(self.ccoCapability)
+ print "proxyNetworkCapability = "+hex(self.proxyNetworkCapability)
+ print "backupCcoCapability = "+hex(self.backupCcoCapability)
+ print "ccoStatus = "+hex(self.ccoStatus)
+ print "pcoStatus = "+hex(self.pcoStatus)
+ print "backupCcoStatus = "+hex(self.backupCcoStatus)
+ print "numDisSta = "+hex(self.numDisSta)
+ print "numDisNet = "+hex(self.numDisNet)
+ print "authenticationStatus = "+hex(self.authenticationStatus)
+ print "userAppointedCcoStatus = "+hex(self.userAppointedCcoStatus)
+ return self.bmiBody.Discovered_Info_BENTRY
+
+ #createBeacon_Period_Start_Time_Offset_BENTRY creates
+ # the BENTRY Field of the Beacon
+ bpsto = 0 #0 by default
+ def createBeacon_Period_Start_Time_Offset_BENTRY(self, myBpsto=None, param2=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myBpsto!=None:
+ self.bpsto=myBpsto
+ self.bmiBody.Beacon_Period_Start_Time_Offset_BENTRY = pack('I',self.bpsto)[0:3]
+ print "bpsto = "+hex(self.bpsto)
+ return self.bmiBody.Beacon_Period_Start_Time_Offset_BENTRY
+
+ #createEncryption_Key_Change_BENTRY creates
+ # the BENTRY Field of the Beacon
+ kccd = 1 #Next Beacon Period by default
+ kbc = 0 #NEK Period by default
+ newEks = 0 #0 by default
+ def createEncryption_Key_Change_BENTRY(self, myKccd=None, myKbc=None, myNewEks=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myKccd!=None:
+ self.kccd=myKccd
+ if myKbc!=None:
+ self.kbc=myKbc
+ if myNewEks!=None:
+ self.newEks=myNewEks
+ self.bmiBody.Encryption_Key_Change_BENTRY = pack('B',self.kccd + self.kbc*pow(2,6)) + pack('B',self.newEks)
+ print "kccd = "+hex(self.kccd)
+ print "kbc = "+hex(self.kbc)
+ print "newEks = "+hex(self.newEks)
+ return self.bmiBody.Encryption_Key_Change_BENTRY
+
+ #createCCo_Handover_BENTRY creates
+ # the BENTRY Field of the Beacon
+ hcd = 0 #0 by default
+ nctei = 0x4e #='N' by default
+ def createCCo_Handover_BENTRY(self, myHcd=None, myNtcei=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myHcd!=None:
+ self.hcd=myHcd
+ if myNtcei!=None:
+ self.nctei=myNtcei
+ self.bmiBody.CCo_Handover_BENTRY = pack('B',self.hcd) + pack('B',self.nctei)
+ print "hcd = "+hex(self.hcd)
+ print "nctei = "+hex(self.nctei)
+ return self.bmiBody.CCo_Handover_BENTRY
+
+ #createBeacon_Relocation_BENTRY creates
+ # the BENTRY Field of the Beacon
+ rcd = 0 #0 by default
+ rlt = 0 #0 by default
+ lgf = 0 #0 by default
+ rlo = 0 #0 by default
+ rlSlotId = 0 #0 by default
+ def createBeacon_Relocation_BENTRY(self, myRcd=None, myRlt=None, myLgf=None, myRlo=None, myRlSlotId=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myRcd!=None:
+ self.rcd=myRcd
+ if myRlt!=None:
+ self.rlt=myRlt
+ if myLgf!=None:
+ self.lgf=myLgf
+ if myRlo!=None:
+ self.rlo=myRlo
+ if myRlSlotId!=None:
+ self.rlSlotId=myRlSlotId
+ self.bmiBody.Beacon_Relocation_BENTRY = pack('B',self.rcd + self.rlt*pow(2,6) + self.lgf*pow(2,7)) + pack('Q',self.rlo + self.rlSlotId*pow(2,17))[0:3]
+ print "rcd = "+hex(self.rcd)
+ print "rlt = "+hex(self.rlt)
+ print "lgf = "+hex(self.lgf)
+ print "rlo = "+hex(self.rlo)
+ print "rlSlotId = "+hex(self.rlSlotId)
+ return self.bmiBody.Beacon_Relocation_BENTRY
+
+ #createAC_Line_Sync_Countdown_BENTRY creates
+ # the BENTRY Field of the Beacon
+ countDown = 1 #Next Beacon Period by default
+ reasonCode = 0 #Shut down by default
+ def createAC_Line_Sync_Countdown_BENTRY(self, myCountDown=None, myReasonCode=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myCountDown!=None:
+ self.countDown=myCountDown
+ if myReasonCode!=None:
+ self.reasonCode=myReasonCode
+ self.bmiBody.AC_Line_Sync_Countdown_BENTRY = pack('B',self.countDown) + pack('B',self.reasonCode)
+ print "countDown = "+hex(self.countDown)
+ print "reasonCode = "+hex(self.reasonCode)
+ return self.bmiBody.AC_Line_Sync_Countdown_BENTRY
+
+ #createChange_NumSlots_BENTRY creates
+ # the BENTRY Field of the Beacon
+ nsccd = 1 #Next Beacon Period by default
+ newNumSlot = 0 #0 by default
+ def createChange_NumSlots_BENTRY(self, myNsccd=None, myNewNumSlot=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myNsccd!=None:
+ self.nsccd=myNsccd
+ if myNewNumSlot!=None:
+ self.newNumSlot=myNewNumSlot
+ self.bmiBody.Change_NumSlots_BENTRY = pack('B',self.nsccd) + pack('B',self.newNumSlot)
+ print "nsccd = "+hex(self.nsccd)
+ print "newNumSlot = "+hex(self.newNumSlot)
+ return self.bmiBody.Change_NumSlots_BENTRY
+
+ #createChange_HM_BENTRY creates
+ # the BENTRY Field of the Beacon
+ hmccd = 1 #Next Beacon Period by default
+ newHm = 0 #0 by default
+ def createChange_HM_BENTRY(self, myHmccd=None, myNewHm=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myHmccd!=None:
+ self.hmccd=myHmccd
+ if myNewHm!=None:
+ self.newHm=myNewHm
+ self.bmiBody.Change_HM_BENTRY = pack('B',self.hmccd + self.newHm*pow(2,6))
+ print "hmccd = "+hex(self.hmccd)
+ print "newHm = "+hex(self.newHm)
+ return self.bmiBody.Change_HM_BENTRY
+
+ #createChange_SNID_BENTRY creates
+ # the BENTRY Field of the Beacon
+ sccd = 1 #Next Beacon Period by default
+ newSnid = 0 #0 by default
+ def createChange_SNID_BENTRY(self, mySccd=None, myNewSnid=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if mySccd!=None:
+ self.sccd=mySccd
+ if myNewSnid!=None:
+ self.newSnid=myNewSnid
+ self.bmiBody.Change_SNID_BENTRY = pack('B',self.sccd + self.newSnid*pow(2,4))
+ print "sccd = "+hex(self.sccd)
+ print "newSnid = "+hex(self.newSnid)
+ return self.bmiBody.Change_SNID_BENTRY
+
+ #
+ def __init__(self):
+ #Beacon_Field
+ self.dico = {Non_Persistent_Schedule_BENTRY:self.createNon_Persistent_Schedule_BENTRY,
+ Persistent_Schedule_BENTRY:self.createPersistent_Schedule_BENTRY,
+ Regions_BENTRY:self.createRegions_BENTRY,
+ MAC_Address_BENTRY:self.createMAC_Address_BENTRY,
+ Discover_BENTRY:self.createDiscover_BENTRY,
+ Discovered_Info_BENTRY:self.createDiscovered_Info_BENTRY,
+ Beacon_Period_Start_Time_Offset_BENTRY:self.createBeacon_Period_Start_Time_Offset_BENTRY,
+ Encryption_Key_Change_BENTRY:self.createEncryption_Key_Change_BENTRY,
+ CCo_Handover_BENTRY:self.createCCo_Handover_BENTRY,
+ Beacon_Relocation_BENTRY:self.createBeacon_Relocation_BENTRY,
+ AC_Line_Sync_Countdown_BENTRY:self.createAC_Line_Sync_Countdown_BENTRY,
+ Change_NumSlots_BENTRY:self.createChange_NumSlots_BENTRY,
+ Change_HM_BENTRY:self.createChange_HM_BENTRY,
+ Change_SNID_BENTRY:self.createChange_SNID_BENTRY
+ }
diff --git a/cesar/maximus/python/lib/mmentry/encapsulation/__init__.py b/cesar/maximus/python/lib/mmentry/encapsulation/__init__.py
new file mode 100644
index 0000000000..5660af2567
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/encapsulation/__init__.py
@@ -0,0 +1 @@
+from encapsulation import *
diff --git a/cesar/maximus/python/lib/mmentry/encapsulation/encapsulation.py b/cesar/maximus/python/lib/mmentry/encapsulation/encapsulation.py
new file mode 100644
index 0000000000..d09deedfbf
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/encapsulation/encapsulation.py
@@ -0,0 +1,250 @@
+# -*- coding:Utf-8 -*-
+
+#------ Encapsulated MME Library Prototypes -------
+
+import sys
+sys.path.append('../../python/lib/mmentry')
+
+from Constants import * #Constants library is used : mme
+from struct import * #struct library is used : pack(),
+
+#import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+from maximus import *
+
+#print "Create MME"
+myMme = MME()
+
+#The Encapsulated MME is composed by :
+
+class EncapsulatedMme():
+
+ #Original Destination address in the MME is a 6 Bytes field
+ oda = unpack('Q',staAAddress+"\x00\x00")[0]
+ odaField = staAAddress
+ #createOda creates the Original Destination Address Field in the MME
+ def createOda(self, myOda=None):
+ try:
+ if myOda!=None:
+ self.oda=myOda
+ self.odaField = pack('Q',self.oda)[0:6]
+ except:
+ if myOda!=None:
+ self.odaField=myOda
+ self.oda = unpack('Q',self.odaField+"\x00\x00")[0]
+ print "oda = "+hex(self.oda)
+
+ #Original source address in the MME is a 6 Bytes field
+ # by default equals to the Maximus Simulator Address
+ osa = unpack('Q',maxAddress+"\x00\x00")[0]
+ osaField = maxAddress
+ #osa = maxAddress
+ #osaField = pack('Q',osa)[0:6]
+ #createOsa creates the Original Destination Address Field in the MME
+ def createOsa(self, myOsa=None):
+ try:
+ if myOsa!=None:
+ self.osa=myOsa
+ self.osaField = pack('Q',self.osa)[0:6]
+ except:
+ if myOsa!=None:
+ self.osaField=myOsa
+ self.osa = unpack('Q',self.osaField+"\x00\x00")[0]
+ print "osa = "+hex(self.osa)
+
+ #VLAN Tag in the MME is an optional 4 Bytes field
+ # by convention if vlanTag = 0, there is no VLAN Tag Field in the MME
+ vlanTag = 0x00000000
+ vlanTagField = pack('I',vlanTag)
+ #createVlanTag creates the otional VLAN Tag Field in The MME
+ def createVlanTag(self, myVlanTag=None):
+ try:
+ if myVlanTag!=None:
+ self.vlanTagField=myVlanTag
+ self.vlanTag = unpack('I',self.vlanTagField)[0]
+ except:
+ if myVlanTag!=None:
+ self.vlanTag=myVlanTag
+ self.vlanTagField = pack('I',self.vlanTag)
+ print "vlanTag = "+hex(self.vlanTag)
+
+ #mtype in the MME is a 2 Bytes Field
+ mtype = 0xe188 #Default IEEE value
+ mtypeField = pack('H',mtype)
+ #createMtype creates the MTYPE Field in the MME
+ def createMtype(self, myMtype=None):
+ try:
+ if myMtype!=None:
+ self.mtype=myMtype
+ self.mtypeField = pack('H',self.mtype)
+ except:
+ if myMtype!=None:
+ self.mtypeField=myMtype
+ self.mtype = unpack('H',self.mtypeField)[0]
+ print "mtype = "+hex(self.mtype)
+
+ #MMV in the MME is a 1 Byte Field
+ # equals to 0 for HPAV Specification V1.0
+ # equals to 1 for HPAV Specification V1.1
+ # all others values are reserved
+ mmv = 0
+ mmvField = pack('B',mmv)
+ #createMmv creates the MMV Field in the MME
+ def createMmv(self, myMmv=None):
+ try:
+ if myMmv!=None:
+ self.mmv=myMmv
+ self.mmvField = pack('B',self.mmv)
+ except:
+ if myMmv!=None:
+ self.mmvField=myMmv
+ self.mmv = unpack('B',self.mmvField)[0]
+ print "mmv = "+hex(self.mmv)
+
+ #MMTYPE in the MME is a 2 Bytes Field
+ # corresponding to the MME Type
+ # see MME interpretation in the Constants
+ mmtype = 0
+ mmtypeField = pack('H',mmtype)
+ #createMmtype creates the MMTYPE Field in the MME
+ def createMmtype(self, myMmtype=None):
+ try:
+ if myMmtype!=None:
+ self.mmtype=myMmtype
+ self.mmtypeField = pack('H',self.mmtype)
+ except:
+ if myMmtype!=None:
+ self.mmtypeField=myMmtype
+ self.mmtype = unpack('H',self.mmtypeField)[0]
+ print "mmtype = "+hex(self.mmtype)
+
+ #FMI in the MME is a 2 Bytes Field composed by :
+ # - MSByte :
+ # - 4 MSBits = NF_MI = Number of fragments
+ # - 4 LSBits = FN_MI = Fragment Number
+ # - LSByte = FMSN = Fragmentation Message Sequence Number
+ nfMi = 0 #by default MMENTRY is not Fragmented
+ fnMi = 0 #by default First or Only Fragment
+ fmsn = 0 #initialized to 0 by default
+ #FMI equals to NF_MI 12 bits left shifted
+ # +FN_MI 4 bits left shifted
+ # +FNSM
+ #First or Only fragment FMI
+ fmi = nfMi*pow(2,8+4)+fnMi*pow(2,8)+fmsn
+ #First or Only fragment FMI Field
+ fmiField = pack('H',fmi)
+ #creatFmi creates the FMI Field in the MME
+ def createFmi(self, myNfmi=None, myFnMi=None, myFmsn=None, myFmi=None):
+ if myFmi!=None:
+ try:
+ self.fmi = myFmi
+ self.fmiField = pack('H',self.fmi)
+ self.fmsn = self.fmi%pow(2,8)
+ self.fnMi = (self.fmi/pow(2,8))%pow(2,4)
+ self.nfMi = self.fmi/pow(2,12)
+ except:
+ self.fmiField = myFmi
+ self.fmi = unpack('H',self.fmiField)[0]
+ self.fmsn = int(self.fmi%pow(2,8))
+ self.fnMi = int((self.fmi/pow(2,8))%pow(2,4))
+ self.nfMi = int(self.fmi/pow(2,12))
+ else:
+ if myNfmi!=None:
+ self.nfMi=myNfmi
+ if myFnMi!=None:
+ self.fnMi=myFnMi
+ if myFmsn!=None:
+ self.fmsn=myFmsn
+ #FMI computation
+ self.fmi=self.nfMi*pow(2,8+4)+self.fnMi*pow(2,8)+self.fmsn
+ #FMI Field creation
+ self.fmiField = pack('H',self.fmi)
+ print "nfMi = "+hex(self.nfMi)
+ print "fnMi = "+hex(self.fnMi)
+ print "fmsn = "+hex(self.fmsn)
+
+ #MMENTRY in the MME is a m Bytes field
+ mmentryField = ""
+ #createMmentry creates the MMENTRY Field in the MME
+ def createMmentry(self, myMmentry=None):
+ if myMmentry!=None:
+ self.mmentryField=myMmentry
+ #print "mmentry = "+self.mmentryField
+
+
+ #MME Frame (CM_ENCRYPTED_PAYLOAD.IND Encapsulated MM Entry Field)
+ encapsulatedMmEntry = ""
+ #createEncapsulatedMmEntry creates the Encapsulated MM Entry Field in the encrypted MME
+ def createEncapsulatedMmEntry(self, myOda=None, myOsa=None, myVlanTag=None, myMtype=None, myMmv=None, myMmtype=None, myNfmi=None, myFnMi=0, myFmsn=0, myMmentry=None, myEncapsulatedMmEntry=None, myThisFnMi=None):
+ if myEncapsulatedMmEntry=="ToEncrypt":
+ print "encapsulatedMmEntry :"
+ self.createOda(myOda)
+ self.createOsa(myOsa)
+ self.createVlanTag(myVlanTag)
+ self.createMtype(myMtype)
+ self.createMmv(myMmv)
+ self.createMmtype(myMmtype)
+ if myNfmi == None:
+ myNfmi = int((len(myMmentry)-1)/1492)
+ if myFnMi==None:
+ myFnMi = myThisFnMi
+ self.createFmi(myNfmi, myFnMi, myFmsn)
+ if myThisFnMi == None:
+ myThisFnMi = self.fnMi
+ self.createMmentry(myMmentry) #No fragmentation before encryption
+ self.encapsulatedMmEntry = self.odaField + self.osaField + self.vlanTagField + self.mtypeField + self.mmvField + self.mmtypeField + self.fmiField + self.mmentryField
+ try:
+ myMme.set_mmheader(self.encapsulatedMmEntry[:23])
+ myMme.set_mmentry(self.mmentryField)
+ except:
+ print "MM Entry too long"
+ return self.encapsulatedMmEntry
+ elif myEncapsulatedMmEntry!=None:
+ self.encapsulatedMmEntry=myEncapsulatedMmEntry
+ self.createOda(myOda=self.encapsulatedMmEntry[0:6])
+ self.createOsa(myOsa=self.encapsulatedMmEntry[6:12])
+ self.createVlanTag(myVlanTag=self.encapsulatedMmEntry[12:16])
+ self.createMtype(myMtype=self.encapsulatedMmEntry[16:18])
+ self.createMmv(myMmv=self.encapsulatedMmEntry[18:19])
+ self.createMmtype(myMmtype=self.encapsulatedMmEntry[19:21])
+ self.createFmi(myFmi = self.encapsulatedMmEntry[21:23])
+ self.createMmentry(myMmentry=self.encapsulatedMmEntry[23:])
+ return self.mmentryField
+ else:
+ print "encapsulatedMmEntry :"
+ self.createOda(myOda)
+ self.createOsa(myOsa)
+ self.createVlanTag(myVlanTag)
+ self.createMtype(myMtype)
+ self.createMmv(myMmv)
+ self.createMmtype(myMmtype)
+ if myNfmi == None:
+ myNfmi = int((len(myMmentry)-1)/1492)
+ if myFnMi==None:
+ myFnMi = myThisFnMi
+ self.createFmi(myNfmi, myFnMi, myFmsn)
+ if myThisFnMi == None:
+ myThisFnMi = self.fnMi
+ self.createMmentry(myMmentry[myThisFnMi*1492:(myThisFnMi+1)*1492])
+ self.encapsulatedMmEntry = self.odaField + self.osaField + self.vlanTagField + self.mtypeField + self.mmvField + self.mmtypeField + self.fmiField + self.mmentryField
+ try:
+ myMme.set_mmheader(self.encapsulatedMmEntry[:23])
+ myMme.set_mmentry(self.mmentryField)
+ except:
+ print "MM Entry too long"
+ return self.encapsulatedMmEntry
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cesar/maximus/python/lib/mmentry/fid/__init__.py b/cesar/maximus/python/lib/mmentry/fid/__init__.py
new file mode 100644
index 0000000000..76061d23cf
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/fid/__init__.py
@@ -0,0 +1 @@
+from fidMethod import *
diff --git a/cesar/maximus/python/lib/mmentry/fid/fidBody.py b/cesar/maximus/python/lib/mmentry/fid/fidBody.py
new file mode 100644
index 0000000000..867c101e0b
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/fid/fidBody.py
@@ -0,0 +1,39 @@
+# -*- coding:Utf-8 -*-
+class FidBody():
+ #CSPEC_Field
+ Delay_Bound = "1234"
+ Jitter_Bound = "1234"
+ Average_MSDU_Size = "12"
+ Maximum_MSDU_Size = "12"
+ Average_Data_Rate = "12"
+ Minimum_Data_Rate = "12"
+ Maximum_Data_Rate = "12"
+ Maximum_Inter_TXOP_time = "12"
+ Minimum_Inter_TXOP_time = "12"
+ Maximum_Burst_Size = "12"
+ Exception_Policy = "1"
+ Inactivity_Interval = "1234"
+ MSDU_Error_Rate = "12"
+ CLST = "1"
+ CDESC = "13or37"
+ Vendor_Specific = "Var"
+ ATS_Tolerance = "12"
+ Smallest_Tolerable_Average_Data_Rate = "12"
+ Original_Average_Data_Rate = "12"
+ #QoS_and_MAC_Parameter_Field_(CM-CM)
+ Rx_Window_Size = "12"
+ Smoothing_Buffer_Size = "123"
+ Bidirectional_Burst_CM_CM = "1"
+ #QoS_and_MAC_Parameter_Field_(CM-CCo)
+ TXOPs_per_Beacon_Period = "1"
+ Average_Number_of_PBs_per_TXOP = "12"
+ Minimum_Number_of_PBs_per_TXOP = "12"
+ Maximum_Number_of_PBs_per_TXOP = "12"
+ PPB_Threshold = "12"
+ Surplus_Bandwidth = "12"
+ #Exception_Policy = "1" #Twice Defined
+ #CDESC = "13or37" #Twice Defined
+ #Vendor_Specific = "Var" #Twice Defined ???
+ Smallest_Tolerable_Average_Number_of_PBs_per_TXOP = "12"
+ Original_Average_Number_of_PBs_per_TXOP = "12"
+ Bidirectional_Burst_CM_CCO = "1"
diff --git a/cesar/maximus/python/lib/mmentry/fid/fidMethod.py b/cesar/maximus/python/lib/mmentry/fid/fidMethod.py
new file mode 100644
index 0000000000..d9072b0388
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/fid/fidMethod.py
@@ -0,0 +1,528 @@
+# -*- coding:Utf-8 -*-
+#FID Methods
+
+from fidBody import *
+from struct import *
+import sys
+sys.path.append('../../python/lib/mmentry')
+from Constants import *
+
+#FidMethod can create every FID Body of CSPEC
+# from FID format
+class FidMethod():
+
+ fidBody = FidBody()
+
+ #createDelay_Bound_FID creates
+ # the FID Field of the CSPEC
+ Delay_Bound = 10000000 #10 seconds by default
+ def createDelay_Bound_FID(self, myDelay_Bound=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myDelay_Bound!=None:
+ self.Delay_Bound=myDelay_Bound
+ self.fidBody.Delay_Bound = pack('I',self.Delay_Bound)
+ print "Delay_Bound = "+hex(self.Delay_Bound)
+ return self.fidBody.Delay_Bound
+
+ #createJitter_Bound_FID creates
+ # the FID Field of the CSPEC
+ Jitter_Bound = 10000000 #10 seconds by default
+ def createJitter_Bound_FID(self, myJitter_Bound=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myJitter_Bound!=None:
+ self.Jitter_Bound=myJitter_Bound
+ self.fidBody.Jitter_Bound = pack('I',self.Jitter_Bound)
+ print "Jitter_Bound = "+hex(self.Jitter_Bound)
+ return self.fidBody.Jitter_Bound
+
+ #createAverage_MSDU_Size_FID creates
+ # the FID Field of the CSPEC
+ Average_MSDU_Size = 502 #502 octets by default (ie 1 fragment = 1/3 Max size)
+ def createAverage_MSDU_Size_FID(self, myAverage_MSDU_Size=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myAverage_MSDU_Size!=None:
+ self.Average_MSDU_Size=myAverage_MSDU_Size
+ self.fidBody.Average_MSDU_Size = pack('H',self.Average_MSDU_Size)
+ print "Average_MSDU_Size = "+hex(self.Average_MSDU_Size)
+ return self.fidBody.Average_MSDU_Size
+
+ #createMaximum_MSDU_Size_FID creates
+ # the FID Field of the CSPEC
+ Maximum_MSDU_Size = 1506 #1506 octets by default (ie 3 fragments)
+ def createMaximum_MSDU_Size_FID(self, myMaximum_MSDU_Size=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myMaximum_MSDU_Size!=None:
+ self.Maximum_MSDU_Size=myMaximum_MSDU_Size
+ self.fidBody.Maximum_MSDU_Size = pack('H',self.Maximum_MSDU_Size)
+ print "Maximum_MSDU_Size = "+hex(self.Maximum_MSDU_Size)
+ return self.fidBody.Maximum_MSDU_Size
+
+ #createAverage_Data_Rate_FID creates
+ # the FID Field of the CSPEC
+ Average_Data_Rate = 10000 #100 Mbps by default (ie 1/2 Max Rate)
+ def createAverage_Data_Rate_FID(self, myAverage_Data_Rate=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myAverage_Data_Rate!=None:
+ self.Average_Data_Rate=myAverage_Data_Rate
+ self.fidBody.Average_Data_Rate = pack('H',self.Average_Data_Rate)
+ print "Average_Data_Rate = "+hex(self.Average_Data_Rate)
+ return self.fidBody.Average_Data_Rate
+
+ #createMinimum_Data_Rate_FID creates
+ # the FID Field of the CSPEC
+ Minimum_Data_Rate = 1 #10 Kbps by default (ie Min Rate)
+ def createMinimum_Data_Rate_FID(self, myMinimum_Data_Rate=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myMinimum_Data_Rate!=None:
+ self.Minimum_Data_Rate=myMinimum_Data_Rate
+ self.fidBody.Minimum_Data_Rate = pack('H',self.Minimum_Data_Rate)
+ print "Minimum_Data_Rate = "+hex(self.Minimum_Data_Rate)
+ return self.fidBody.Minimum_Data_Rate
+
+ #createMaximum_Data_Rate_FID creates
+ # the FID Field of the CSPEC
+ Maximum_Data_Rate = 20000 #200 Mbps by default (ie Max Rate)
+ def createMaximum_Data_Rate_FID(self, myMaximum_Data_Rate=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myMaximum_Data_Rate!=None:
+ self.Maximum_Data_Rate=myMaximum_Data_Rate
+ self.fidBody.Maximum_Data_Rate = pack('H',self.Maximum_Data_Rate)
+ print "Maximum_Data_Rate = "+hex(self.Maximum_Data_Rate)
+ return self.fidBody.Maximum_Data_Rate
+
+ #createMaximum_Inter-TXOP_time_FID creates
+ # the FID Field of the CSPEC
+ Maximum_Inter_TXOP_time = 10000 #10 milliseconds by default
+ def createMaximum_Inter_TXOP_time_FID(self, myMaximum_Inter_TXOP_time=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myMaximum_Inter_TXOP_time!=None:
+ self.Maximum_Inter_TXOP_time=myMaximum_Inter_TXOP_time
+ self.fidBody.Maximum_Inter_TXOP_time = pack('H',self.Maximum_Inter_TXOP_time)
+ print "Maximum_Inter_TXOP_time = "+hex(self.Maximum_Inter_TXOP_time)
+ return self.fidBody.Maximum_Inter_TXOP_time
+
+ #createMinimum_Inter-TXOP_time_FID creates
+ # the FID Field of the CSPEC
+ Minimum_Inter_TXOP_time = 40 #40 microseconds by default
+ def createMinimum_Inter_TXOP_time_FID(self, myMinimum_Inter_TXOP_time=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myMinimum_Inter_TXOP_time!=None:
+ self.Minimum_Inter_TXOP_time=myMinimum_Inter_TXOP_time
+ self.fidBody.Minimum_Inter_TXOP_time = pack('H',self.Minimum_Inter_TXOP_time)
+ print "Minimum_Inter_TXOP_time = "+hex(self.Minimum_Inter_TXOP_time)
+ return self.fidBody.Minimum_Inter_TXOP_time
+
+ #createMaximum_Burst_Size_FID creates
+ # the FID Field of the CSPEC
+ Maximum_Burst_Size = 1506 #1506 octets by default (ie 3 fragments)
+ def createMaximum_Burst_Size_FID(self, myMaximum_Burst_Size=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myMaximum_Burst_Size!=None:
+ self.Maximum_Burst_Size=myMaximum_Burst_Size
+ self.fidBody.Maximum_Burst_Size = pack('H',self.Maximum_Burst_Size)
+ print "Maximum_Burst_Size = "+hex(self.Maximum_Burst_Size)
+ return self.fidBody.Maximum_Burst_Size
+
+ #createException_Policy_FID creates
+ # the FID Field of the CSPEC
+ Exception_Policy = 0 #0=terminate the connection by default
+ def createException_Policy_FID(self, myException_Policy=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myException_Policy!=None:
+ self.Exception_Policy=myException_Policy
+ self.fidBody.Exception_Policy = pack('B',self.Exception_Policy)
+ print "Exception_Policy = "+hex(self.Exception_Policy)
+ return self.fidBody.Exception_Policy
+
+ #createInactivity_Interval_FID creates
+ # the FID Field of the CSPEC
+ Inactivity_Interval = 60000000 #60 seconds by default
+ def createInactivity_Interval_FID(self, myInactivity_Interval=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myInactivity_Interval!=None:
+ self.Inactivity_Interval=myInactivity_Interval
+ self.fidBody.Inactivity_Interval = pack('I',self.Inactivity_Interval)
+ print "Inactivity_Interval = "+hex(self.Inactivity_Interval)
+ return self.fidBody.Inactivity_Interval
+
+ #createMSDU_Error_Rate_FID creates
+ # the FID Field of the CSPEC
+ xMSDU_Error_Rate = 1 #x*10^-y :
+ yMSDU_Error_Rate = 2 #1% by default
+ def createMSDU_Error_Rate_FID(self, myXMSDU_Error_Rate=None, myYMSDU_Error_Rate=None, param3=None, param4=None, param5=None, param6=None):
+ if myXMSDU_Error_Rate!=None:
+ self.xMSDU_Error_Rate=myXMSDU_Error_Rate
+ if myYMSDU_Error_Rate!=None:
+ self.yMSDU_Error_Rate=myYMSDU_Error_Rate
+ self.fidBody.MSDU_Error_Rate = pack('B',self.xMSDU_Error_Rate) + pack('B',self.yMSDU_Error_Rate)
+ print "xMSDU_Error_Rate = "+hex(self.xMSDU_Error_Rate)
+ print "yMSDU_Error_Rate = "+hex(self.yMSDU_Error_Rate)
+ return self.fidBody.MSDU_Error_Rate
+
+ #createCLST_FID creates
+ # the FID Field of the CSPEC
+ CLST = 0 #0=IEEE 802.3 SAP by default
+ def createCLST_FID(self, myCLST=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myCLST!=None:
+ self.CLST=myCLST
+ self.fidBody.CLST = pack('B',self.CLST)
+ print "CLST = "+hex(self.CLST)
+ return self.fidBody.CLST
+
+ #CDESC Fields :
+
+ # IP Protocol Version
+ # =0=IPv4
+ # =1=IPv6
+ ipVersion = 0
+ ipVersionField = pack('B',ipVersion)
+ def createIpVersion(self, myIpVersion=None):
+ if myIpVersion!=None:
+ self.ipVersion=myIpVersion
+ self.ipVersionField = pack('B',self.ipVersion)
+ print "ipVersion = "+hex(self.ipVersion)
+
+ # IP Address or Source HLE
+ # 4 octets long for IPv4
+ # 16 octets long for IPv6
+ sourceIpAddress = 0x41424344
+ if ipVersion == 0:
+ sourceIpAddressField = pack('I',sourceIpAddress)
+ else:
+ #if IPv6 : IP Address = "8 MSBytes" + "8 LSBytes"
+ sourceIpAddressField = pack('Q',sourceIpAddress/pow_2_64) + pack('Q',sourceIpAddress%pow_2_64) #pow_2_64=2^64
+ def createSourceIpAddress(self, mySourceIpAddress=None):
+ if mySourceIpAddress!=None:
+ self.sourceIpAddress=mySourceIpAddress
+ if self.ipVersion == 0:
+ self.sourceIpAddressField = pack('I',self.sourceIpAddress)
+ else:
+ #if IPv6 : IP Address = "8 MSBytes" + "8 LSBytes"
+ self.sourceIpAddressField = pack('Q',self.sourceIpAddress/pow_2_64) + pack('Q',self.sourceIpAddress%pow_2_64)
+ print "sourceIpAddress = "+hex(self.sourceIpAddress)
+
+ # IP Port Number of Source HLE
+ sourceIpPort = 0x6162
+ sourceIpPortField = pack('H',sourceIpPort)
+ def createSourceIpPort(self, mySourceIpPort=None):
+ if mySourceIpPort!=None:
+ self.sourceIpPort=mySourceIpPort
+ self.sourceIpPortField = pack('H',self.sourceIpPort)
+ print "sourceIpPort = "+hex(self.sourceIpPort)
+
+ # IP Address of Destination HLE
+ # 4 octets long for IPv4
+ # 16 octets long for IPv6
+ destinationIpAddress = 0x61626364
+ if ipVersion == 0:
+ destinationIpAddressField = pack('I',destinationIpAddress)
+ else:
+ #if IPv6 : IP Address = "8 MSBytes" + "8 LSBytes"
+ destinationIpAddressField = pack('Q',destinationIpAddress/pow_2_64) + pack('Q',destinationIpAddress%pow_2_64)
+ def createDestinationIpAddress(self, myDestinationIpAddress=None):
+ if myDestinationIpAddress!=None:
+ self.destinationIpAddress=myDestinationIpAddress
+ if self.ipVersion == 0:
+ self.destinationIpAddressField = pack('I',self.destinationIpAddress)
+ else:
+ #if IPv6 : IP Address = "8 MSBytes" + "8 LSBytes"
+ self.destinationIpAddressField = pack('Q',self.destinationIpAddress/pow_2_64) + pack('Q',self.destinationIpAddress%pow_2_64)
+ print "destinationIpAddress = "+hex(self.destinationIpAddress)
+
+ # IP Port Number of destination HLE
+ destinationIpPort = 0x7879
+ destinationIpPortField = pack('H',destinationIpPort)
+ def createDestinationIpPort(self, myDestinationIpPort=None):
+ if myDestinationIpPort!=None:
+ self.destinationIpPort=myDestinationIpPort
+ self.destinationIpPortField = pack('H',self.destinationIpPort)
+ print "destinationIpPort = "+hex(self.destinationIpPort)
+
+ # IP Protocol Type
+ #
+ # ASSIGNED INTERNET PROTOCOL NUMBERS
+ #
+ #In the Internet Protocol (IP) [33] there is a field, called Protocol,
+ #to identify the the next level protocol. This is an 8 bit field.
+ #
+ #Assigned Internet Protocol Numbers
+ #
+ #Decimal Protocol Numbers
+ #------- ----------------
+ #0 Reserved
+ #1 ICMP
+ #2 Unassigned
+ #3 Gateway-to-Gateway
+ #4 CMCC Gateway Monitoring Message
+ #5 ST
+ #6 TCP
+ #7 UCL
+ #8 Unassigned
+ #9 Secure
+ #10 BBN RCC Monitoring
+ #11 NVP
+ #12 PUP
+ #13 Pluribus
+ #14 Telenet
+ #15 XNET
+ #16 Chaos
+ #17 User Datagram
+ #18 Multiplexing
+ #19 DCN
+ #20 TAC Monitoring
+ #21-62 Unassigned
+ #63 any local network
+ #64 SATNET and Backroom EXPAK
+ #65 MIT Subnet Support
+ #66-68 Unassigned
+ #69 SATNET Monitoring
+ #70 Unassigned
+ #71 Internet Packet Core Utility
+ #72-75 Unassigned
+ #76 Backroom SATNET Monitoring
+ #77 Unassigned
+ #78 WIDEBAND Monitoring
+ #79 WIDEBAND EXPAK
+ #80-254 Unassigned
+ #255 Reserved
+ protocolType = 6 #TCP by default
+ protocolTypeField = pack('B',protocolType)
+ def createProtocolType(self, myProtocolType=None):
+ if myProtocolType!=None:
+ self.protocolType=myProtocolType
+ self.protocolTypeField = pack('B',self.protocolType)
+ print "protocolType = "+hex(self.protocolType)
+
+ #createCDESC_FID creates
+ # the FID Field of the CSPEC
+ CDESC = 0
+ def createCDESC_FID(self, myIpVersion=None, mySourceIpAddress=None, mySourceIpPort=None, myDestinationIpAddress=None, myDestinationIpPort=None, myProtocolType=None):
+ print "CDESC :"
+ self.createIpVersion(myIpVersion)
+ self.createSourceIpAddress(mySourceIpAddress)
+ self.createSourceIpPort(mySourceIpPort)
+ self.createDestinationIpAddress(myDestinationIpAddress)
+ self.createDestinationIpPort(myDestinationIpPort)
+ self.createProtocolType(myProtocolType)
+ self.fidBody.CDESC = self.ipVersionField + self.sourceIpAddressField + self.sourceIpPortField + self.destinationIpAddressField + self.destinationIpPortField + self.protocolTypeField
+ return self.fidBody.CDESC
+
+ #Vendor Specific Fields :
+
+ # Organizationally Unique Identifier
+ oui = 0x535043 #OUI = "SPC" = SPiDCOM
+ ouiField = pack('I',oui)[0:3]
+ def createOui(self, myOui=None):
+ if myOui!=None:
+ self.oui=myOui
+ self.ouiField = pack('I',self.oui)[0:3]
+ print "oui = "+hex(self.oui)
+
+ # Vendor Defined Fields
+ vendorDefined = 0
+ if vendorDefined == 0:
+ vendorDefinedField = ""
+ else:
+ vendorDefinedField = pack('Q',vendorDefined)
+ def createVendorDefined(self, myVendorDefined=None):
+ if myVendorDefined!=None:
+ self.vendorDefined=myVendorDefined
+ if self.vendorDefined == 0:
+ self.vendorDefinedField = ""
+ else:
+ self.vendorDefinedField = pack('Q',self.vendorDefined)
+ print "vendorDefined = "+hex(self.vendorDefined)
+
+ #createVendor_Specific_FID creates
+ # the FID Field of the CSPEC
+ Vendor_Specific = 0
+ def createVendor_Specific_FID(self, myOui=None, myVendorDefined=None, param3=None, param4=None, param5=None, param6=None):
+ print "Vendor_Specific = "+hex(self.Vendor_Specific)
+ createOui(myOui)
+ createVendorDefined(myVendorDefined)
+ self.fidBody.Vendor_Specific = self.ouiField + self.vendorDefinedField
+ return self.fidBody.Vendor_Specific
+
+ #createVendor_Specific_FID creates
+ # the FID Field of the CSPEC
+ ATS_Tolerance = 0 #0 microseconds by default
+ def createATS_Tolerance_FID(self, myATS_Tolerance=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myATS_Tolerance!=None:
+ self.ATS_Tolerance=myATS_Tolerance
+ self.fidBody.ATS_Tolerance = pack('H',self.ATS_Tolerance)
+ print "ATS_Tolerance = "+hex(self.ATS_Tolerance)
+ return self.fidBody.ATS_Tolerance
+
+ #createSmallest_Tolerable_Average_Data_Rate_FID creates
+ # the FID Field of the CSPEC
+ Smallest_Tolerable_Average_Data_Rate = 1 #10 Kbps by default (ie Min Rate)
+ def createSmallest_Tolerable_Average_Data_Rate_FID(self, mySmallest_Tolerable_Average_Data_Rate=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if mySmallest_Tolerable_Average_Data_Rate!=None:
+ self.Smallest_Tolerable_Average_Data_Rate=mySmallest_Tolerable_Average_Data_Rate
+ self.fidBody.Smallest_Tolerable_Average_Data_Rate = pack('H',self.Smallest_Tolerable_Average_Data_Rate)
+ print "Smallest_Tolerable_Average_Data_Rate = "+hex(self.Smallest_Tolerable_Average_Data_Rate)
+ return self.fidBody.Smallest_Tolerable_Average_Data_Rate
+
+ #createOriginal_Average_Data_Rate_FID creates
+ # the FID Field of the CSPEC
+ Original_Average_Data_Rate = 10000 #100 Mbps by default (ie 1/2 Max Rate)
+ def createOriginal_Average_Data_Rate_FID(self, myOriginal_Average_Data_Rate=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myOriginal_Average_Data_Rate!=None:
+ self.Original_Average_Data_Rate=myOriginal_Average_Data_Rate
+ self.fidBody.Original_Average_Data_Rate = pack('H',self.Original_Average_Data_Rate)
+ print "Original_Average_Data_Rate = "+hex(self.Original_Average_Data_Rate)
+ return self.fidBody.Original_Average_Data_Rate
+
+ #createRx_Window_Size_FID creates
+ # the FID Field of the CSPEC
+ Rx_Window_Size = 1 #512 octets by default
+ def createRx_Window_Size_FID(self, myRx_Window_Size=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myRx_Window_Size!=None:
+ self.Rx_Window_Size=myRx_Window_Size
+ self.fidBody.Rx_Window_Size = pack('H',self.Rx_Window_Size)
+ print "Rx_Window_Size = "+hex(self.Rx_Window_Size)
+ return self.fidBody.Rx_Window_Size
+
+ #createSmoothing_Buffer_Size_FID creates
+ # the FID Field of the CSPEC
+ Smoothing_Buffer_Size = 0x100000 #1 Mo by default
+ def createSmoothing_Buffer_Size_FID(self, mySmoothing_Buffer_Size=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if mySmoothing_Buffer_Size!=None:
+ self.Smoothing_Buffer_Size=mySmoothing_Buffer_Size
+ self.fidBody.Smoothing_Buffer_Size = pack('I',self.Smoothing_Buffer_Size)[0:3]
+ print "Smoothing_Buffer_Size = "+hex(self.Smoothing_Buffer_Size)
+ return self.fidBody.Smoothing_Buffer_Size
+
+ #createBidirectional_Burst_CM_CM_FID creates
+ # the FID Field of the CSPEC
+ # 0 : both links are local links
+ # 1 : Bidirectional Bursts in CFP will always end with a SACK
+ # 2 : Bidirectional Burst in CFP may end with a Reverse SOF
+ Bidirectional_Burst_CM_CM = 0 #Local links by default
+ def createBidirectional_Burst_CM_CM_FID(self, myBidirectional_Burst_CM_CM=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myBidirectional_Burst_CM_CM!=None:
+ self.Bidirectional_Burst_CM_CM=myBidirectional_Burst_CM_CM
+ self.fidBody.Bidirectional_Burst_CM_CM = pack('B',self.Bidirectional_Burst_CM_CM)
+ print "Bidirectional_Burst_CM_CM = "+hex(self.Bidirectional_Burst_CM_CM)
+ return self.fidBody.Bidirectional_Burst_CM_CM
+
+ #createTXOPs_per_Beacon_Period_FID creates
+ # the FID Field of the CSPEC
+ TXOPs_per_Beacon_Period = 0 #1 TXOP per Beacon Period by default
+ def createTXOPs_per_Beacon_Period_FID(self, myTXOPs_per_Beacon_Period=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myTXOPs_per_Beacon_Period!=None:
+ self.TXOPs_per_Beacon_Period=myTXOPs_per_Beacon_Period
+ self.fidBody.TXOPs_per_Beacon_Period = pack('B',self.TXOPs_per_Beacon_Period)
+ print "TXOPs_per_Beacon_Period = "+hex(self.TXOPs_per_Beacon_Period)
+ return self.fidBody.TXOPs_per_Beacon_Period
+
+ #createAverage_Number_of_PBs_per_TXOP_FID creates
+ # the FID Field of the CSPEC
+ Average_Number_of_PBs_per_TXOP = 2 #2 PB per TXOP by default
+ def createAverage_Number_of_PBs_per_TXOP_FID(self, myAverage_Number_of_PBs_per_TXOP=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myAverage_Number_of_PBs_per_TXOP!=None:
+ self.Average_Number_of_PBs_per_TXOP=myAverage_Number_of_PBs_per_TXOP
+ self.fidBody.Average_Number_of_PBs_per_TXOP = pack('H',self.Average_Number_of_PBs_per_TXOP)
+ print "Average_Number_of_PBs_per_TXOP = "+hex(self.Average_Number_of_PBs_per_TXOP)
+ return self.fidBody.Average_Number_of_PBs_per_TXOP
+
+ #createMinimum_Number_of_PBs_per_TXOP_FID creates
+ # the FID Field of the CSPEC
+ Minimum_Number_of_PBs_per_TXOP = 1 #1 PB per TXOP by default
+ def createMinimum_Number_of_PBs_per_TXOP_FID(self, myMinimum_Number_of_PBs_per_TXOP=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myMinimum_Number_of_PBs_per_TXOP!=None:
+ self.Minimum_Number_of_PBs_per_TXOP=myMinimum_Number_of_PBs_per_TXOP
+ self.fidBody.Minimum_Number_of_PBs_per_TXOP = pack('H',self.Minimum_Number_of_PBs_per_TXOP)
+ print "Minimum_Number_of_PBs_per_TXOP = "+hex(self.Minimum_Number_of_PBs_per_TXOP)
+ return self.fidBody.Minimum_Number_of_PBs_per_TXOP
+
+ #createMaximum_Number_of_PBs_per_TXOP_FID creates
+ # the FID Field of the CSPEC
+ Maximum_Number_of_PBs_per_TXOP = 3 #3 PB per TXOP by default
+ def createMaximum_Number_of_PBs_per_TXOP_FID(self, myMaximum_Number_of_PBs_per_TXOP=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myMaximum_Number_of_PBs_per_TXOP!=None:
+ self.Maximum_Number_of_PBs_per_TXOP=myMaximum_Number_of_PBs_per_TXOP
+ self.fidBody.Maximum_Number_of_PBs_per_TXOP = pack('H',self.Maximum_Number_of_PBs_per_TXOP)
+ print "Maximum_Number_of_PBs_per_TXOP = "+hex(self.Maximum_Number_of_PBs_per_TXOP)
+ return self.fidBody.Maximum_Number_of_PBs_per_TXOP
+
+ #createPPB_Threshold_FID creates
+ # the FID Field of the CSPEC
+ PPB_Threshold = 3 #3 PB by default
+ def createPPB_Threshold_FID(self, myPPB_Threshold=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myPPB_Threshold!=None:
+ self.PPB_Threshold=myPPB_Threshold
+ self.fidBody.PPB_Threshold = pack('H',self.PPB_Threshold)
+ print "PPB_Threshold = "+hex(self.PPB_Threshold)
+ return self.fidBody.createPPB_Threshold_FID
+
+ #createSurplus_Bandwidth_FID creates
+ # the FID Field of the CSPEC
+ Surplus_Bandwidth = 0 #0 No surplus Bandwith required by default
+ def createSurplus_Bandwidth_FID(self, mySurplus_Bandwidth=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if mySurplus_Bandwidth!=None:
+ self.Surplus_Bandwidth=mySurplus_Bandwidth
+ self.fidBody.Surplus_Bandwidth = pack('H',self.Surplus_Bandwidth)
+ print "Surplus_Bandwidth = "+hex(self.Surplus_Bandwidth)
+ return self.fidBody.createSurplus_Bandwidth_FID
+
+ #createSmallest_Tolerable_Average_Number_of_PBs_per_TXOP_FID creates
+ # the FID Field of the CSPEC
+ Smallest_Tolerable_Average_Number_of_PBs_per_TXOP = 1 #1 PB per TXOP by default
+ def createSmallest_Tolerable_Average_Number_of_PBs_per_TXOP_FID(self, mySmallest_Tolerable_Average_Number_of_PBs_per_TXOP=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if mySmallest_Tolerable_Average_Number_of_PBs_per_TXOP!=None:
+ self.Smallest_Tolerable_Average_Number_of_PBs_per_TXOP=mySmallest_Tolerable_Average_Number_of_PBs_per_TXOP
+ self.fidBody.Smallest_Tolerable_Average_Number_of_PBs_per_TXOP = pack('H',self.Smallest_Tolerable_Average_Number_of_PBs_per_TXOP)
+ print "Smallest_Tolerable_Average_Number_of_PBs_per_TXOP = "+hex(self.Smallest_Tolerable_Average_Number_of_PBs_per_TXOP)
+ return self.fidBody.Smallest_Tolerable_Average_Number_of_PBs_per_TXOP
+
+ #createOriginal_Average_Number_of_PBs_per_TXOP_FID creates
+ # the FID Field of the CSPEC
+ Original_Average_Number_of_PBs_per_TXOP = 2 #2 PB per TXOP by default
+ def createOriginal_Average_Number_of_PBs_per_TXOP_FID(self, myOriginal_Average_Number_of_PBs_per_TXOP=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myOriginal_Average_Number_of_PBs_per_TXOP!=None:
+ self.Original_Average_Number_of_PBs_per_TXOP=myOriginal_Average_Number_of_PBs_per_TXOP
+ self.fidBody.Original_Average_Number_of_PBs_per_TXOP = pack('H',self.Original_Average_Number_of_PBs_per_TXOP)
+ print "Original_Average_Number_of_PBs_per_TXOP = "+hex(self.Original_Average_Number_of_PBs_per_TXOP)
+ return self.fidBody.Original_Average_Number_of_PBs_per_TXOP
+
+ #createBidirectional_Burst_CM_CM_FID creates
+ # the FID Field of the CSPEC
+ # 0 : Bidirectional Bursts will always end with a SACK
+ # 1 : Bidirectional Burst may end with a Reverse SOF
+ Bidirectional_Burst_CM_CCO = 0 #SACK by default
+ def createBidirectional_Burst_CM_CCO_FID(self, myBidirectional_Burst_CM_CCO=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ if myBidirectional_Burst_CM_CCO!=None:
+ self.Bidirectional_Burst_CM_CCO=myBidirectional_Burst_CM_CCO
+ self.fidBody.Bidirectional_Burst_CM_CCO = pack('B',self.Bidirectional_Burst_CM_CCO)
+ print "Bidirectional_Burst_CM_CCO = "+hex(self.Bidirectional_Burst_CM_CCO)
+ return self.fidBody.Bidirectional_Burst_CM_CCO
+
+ #
+ def __init__(self):
+ #CSPEC_Field
+ self.dico = {Delay_Bound:self.createDelay_Bound_FID,
+ Jitter_Bound:self.createJitter_Bound_FID,
+ Average_MSDU_Size:self.createAverage_MSDU_Size_FID,
+ Maximum_MSDU_Size:self.createMaximum_MSDU_Size_FID,
+ Average_Data_Rate:self.createAverage_Data_Rate_FID,
+ Minimum_Data_Rate:self.createMinimum_Data_Rate_FID,
+ Maximum_Data_Rate:self.createMaximum_Data_Rate_FID,
+ Maximum_Inter_TXOP_time:self.createMaximum_Inter_TXOP_time_FID,
+ Minimum_Inter_TXOP_time:self.createMinimum_Inter_TXOP_time_FID,
+ Maximum_Burst_Size:self.createMaximum_Burst_Size_FID,
+ Exception_Policy:self.createException_Policy_FID,
+ Inactivity_Interval:self.createInactivity_Interval_FID,
+ MSDU_Error_Rate:self.createMSDU_Error_Rate_FID,
+ CLST:self.createCLST_FID,
+ CDESC:self.createCDESC_FID,
+ Vendor_Specific:self.createVendor_Specific_FID,
+ ATS_Tolerance:self.createATS_Tolerance_FID,
+ Smallest_Tolerable_Average_Data_Rate:self.createSmallest_Tolerable_Average_Data_Rate_FID,
+ Original_Average_Data_Rate:self.createOriginal_Average_Data_Rate_FID,
+ #QoS_and_MAC_Parameter_Field_(CM_CM):self.createQoS_and_MAC_Parameter_Field_(CM_CM)
+ Rx_Window_Size:self.createRx_Window_Size_FID,
+ Smoothing_Buffer_Size:self.createSmoothing_Buffer_Size_FID,
+ Bidirectional_Burst_CM_CM:self.createBidirectional_Burst_CM_CM_FID,
+ #QoS_and_MAC_Parameter_Field_(CM_CCo):self.createQoS_and_MAC_Parameter_Field_(CM_CCo)
+ TXOPs_per_Beacon_Period:self.createTXOPs_per_Beacon_Period_FID,
+ Average_Number_of_PBs_per_TXOP:self.createAverage_Number_of_PBs_per_TXOP_FID,
+ Minimum_Number_of_PBs_per_TXOP:self.createMinimum_Number_of_PBs_per_TXOP_FID,
+ Maximum_Number_of_PBs_per_TXOP:self.createMaximum_Number_of_PBs_per_TXOP_FID,
+ PPB_Threshold:self.createPPB_Threshold_FID,
+ Surplus_Bandwidth:self.createSurplus_Bandwidth_FID,
+ #Exception_Policy:self.createException_Policy
+ #CDESC:self.createCDESC
+ #Vendor_Specific:self.createVendor_Specific
+ Smallest_Tolerable_Average_Number_of_PBs_per_TXOP:self.createSmallest_Tolerable_Average_Number_of_PBs_per_TXOP_FID,
+ Original_Average_Number_of_PBs_per_TXOP:self.createOriginal_Average_Number_of_PBs_per_TXOP_FID,
+ Bidirectional_Burst_CM_CCO:self.createBidirectional_Burst_CM_CCO_FID
+ }
diff --git a/cesar/maximus/python/lib/mmentry/mmentry.py b/cesar/maximus/python/lib/mmentry/mmentry.py
new file mode 100644
index 0000000000..28321ea0dc
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/mmentry.py
@@ -0,0 +1,121 @@
+# -*- coding:Utf-8 -*-
+
+class Mmentry():
+ #MMENTRY format by MME
+ #--- Station - Central Coordination ---
+ CC_CCO_APPOINT_REQ = "1234567"
+ CC_CCO_APPOINT_CNF = "1"
+ CC_BACKUP_APPOINT_REQ = "1"
+ CC_BACKUP_APPOINT_CNF = "1"
+ CC_LINK_INFO_REQ = ""
+ CC_LINK_INFO_CNF = "1"+"Var"+"*N"+"=b"
+ CC_LINK_INFO_IND = "1"+"Var"+"*N"+"=b"
+ CC_LINK_INFO_RSP = ""
+ CC_HANDOVER_REQ = "12"
+ CC_HANDOVER_CNF = "1"
+ CC_HANDOVER_INFO_IND = "123"+"N*"+"123456789"+"=b"
+ CC_HANDOVER_INFO_RSP = ""
+ CC_DISCOVER_LIST_REQ = ""
+ CC_DISCOVER_LIST_CNF = "1"+"M*"+"123456789ABC"+"N*"+"123456789ABCD"+"=b"
+ CC_DISCOVER_LIST_IND = "1"+"M*"+"123456789ABC"+"N*"+"123456789ABCD"+"=b"
+ CC_LINK_NEW_REQ = "123456789ABCDE"+"Var"+"1"+"123"+"*N"+"1"+"123"+"*K"+"=a"
+ CC_LINK_NEW_CNF = "12345"+"Var"+"=a"
+ CC_LINK_MOD_REQ = "12"+"Var"+"Var"+"Var"+"=a"
+ CC_LINK_MOD_CNF = "123"+"Var"+"=a"
+ CC_LINK_SQZ_REQ = "12"+"Var"+"=a"
+ CC_LINK_SQZ_CNF = "123"+"Var"+"=a"
+ CC_LINK_REL_REQ = "1234"+"Var"+"=a"
+ CC_LINK_REL_IND = "123456789"+"Var"+"Var"+"=a"
+ CC_DETECT_REPORT_REQ = "12"+"N"+"=a"
+ CC_DETECT_REPORT_CNF = "1"+"123456"+"*N"+"=a"
+ CC_WHO_RU_REQ = "1234567"
+ CC_WHO_RU_CNF = "1234567"+"123456"+"12345678*8"
+ CC_ASSOC_REQ = "123456789A"
+ CC_ASSOC_CNF = "123456789ABC"
+ CC_LEAVE_REQ = "1"
+ CC_LEAVE_CNF = ""
+ CC_LEAVE_IND = "12345678"
+ CC_LEAVE_RSP = ""
+ CC_SET_TEI_MAP_REQ = ""
+ CC_SET_TEI_MAP_IND = "12"+"12345678"+"*n"+"=b"
+ CC_RELAY_REQ = "123456789"+"Var"+"=a"
+ CC_RELAY_IND = "123456789"+"Var"+"=a"
+ CC_BEACON_RELIABILITY_REQ = ""
+ CC_BEACON_RELIABILITY_CNF = "1234"
+ CC_ALLOC_MOVE_REQ = "1234"+"Var"+"Var"+"=a"
+ CC_ALLOC_MOVE_CNF = "123"
+ CC_ACCESS_NEW_REQ = "12345678"+"Var"+"Var"+"=a"
+ CC_ACCESS_NEW_CNF = "123456"
+ CC_ACCESS_NEW_IND = "123456789ABC"
+ CC_ACCESS_NEW_RSP = "1234"+"Var"+"Var"+"=a"
+ CC_ACCESS_REL_REQ = "123"
+ CC_ACCESS_REL_CNF = "123"
+ CC_ACCESS_REL_IND = "123"
+ CC_ACCESS_REL_RSP = "123"
+ CC_DCPPC_IND = "1"
+ CC_DCPPC_RSP = ""
+ CC_HP1_DET_REQ = ""
+ CC_HP1_DET_CNF = "123456"
+ CC_BLE_UPDATE_IND = "1"+"Var"+"=a"
+ #to 0x1FFC : Reserved for future use
+ #--- Proxy Coordinator ---
+ CP_PROXY_APPOINT_REQ = "1234"+"12345678"+"*N"+"=b"
+ CP_PROXY_APPOINT_CNF = "12"
+ PH_PROXY_APPOINT_IND = "123456789ABCDEF"
+ CP_PROXY_WAKE_REQ = ""
+ #to 0x3FFC : Reserved for future use
+ #--- CCo - CCo ---
+ NN_INL_REQ = "123456789ABCDE"+"123456789ABCD"+"*N"+"=a"
+ NN_INL_CNF = "123456789ABCDE"+"123456789ABCD"+"*N"+"=a"
+ NN_NEW_NET_REQ = "123456789ABCDE"
+ NN_NEW_NET_CNF = "1234"+"Var"+"=a"
+ NN_NEW_NET_IND = "1234"
+ NN_ADD_ALLOC_REQ = "1234567"+"1234"+"*n"+"=a"
+ NN_ADD_ALLOC_CNF = "1234"
+ NN_ADD_ALLOC_IND = "1234"
+ NN_REL_ALLOC_REQ = "1234567"+"1234"+"*n"+"=a"
+ NN_REL_ALLOC_CNF = "1234"
+ NN_REL_NET_IND = "1234567"+"1234"+"*n"+"=a"
+ #to 0x5FFC : Reserved for future use
+ #--- Station - Station ---
+ CM_UNASSOCIATED_STA_IND = "12345678"
+ CM_ENCRYPTED_PAYLOAD_IND = "123456"+"12345678"+"12345678"+"12"+"0-15"+"Var"+"0or4"+"0or1"+"0or2"+"0or1"+"0-15"+"0or1"+"=a"
+ CM_ENCRYPTED_PAYLOAD_RSP = "1234"
+ CM_SET_KEY_REQ = "123456789ABCDE"+"1234567"+"1"+"12345678"+"12345678"
+ CM_SET_KEY_CNF = "123456789ABCDE"
+ CM_GET_KEY_REQ = "123456789"+"12345678"+"Var"+"=a"
+ CM_GET_KEY_CNF = "123456789A"+"123456789ABC"+"Var"+"=a"
+ CM_SC_JOIN_REQ = "1"
+ CM_SC_JOIN_CNF = "12345678"
+ CM_CHAN_EST_IND = "123456789AB"+"L"+"1"+"123"+"*M"+"1234567"+"N*0_5"+"(N%2)*0_5"
+ CM_TM_UPDATE_IND = "12"+"L"+"1"+"123"+"*M"+"1234567"+"12"+"*N"+"=a"
+ CM_AMP_MAP_REQ = "12"+"N*0_5"+"=a" #+"(N%2)*0_5"???
+ CM_AMP_MAP_CNF = "1"
+ CM_BRG_INFO_REQ = ""
+ CM_BRG_INFO_CNF = "1"+"Var"+"=a"
+ CM_CONN_NEW_REQ = "12"+"Var"+"Var"+"=a"
+ CM_CONN_NEW_CNF = "1234"+"Var"+"=a"
+ CM_CONN_REL_IND = "123"+"Var"+"=a"
+ CM_CONN_REL_RSP = "12"
+ CM_CONN_MOD_REQ = "12"+"Var"+"=a"
+ CM_CONN_MOD_CNF = "123"+"Var"+"=a"
+ CM_CONN_INFO_REQ = "1234"
+ CM_CONN_INFO_CNF = "1"+"Var"+"*N"+"=b"
+ CM_STA_CAP_REQ = ""
+ CM_STA_CAP_CNF = "123456789ABCDEF"+"123456789A"
+ CM_NW_INFO_REQ = ""
+ CM_NW_INFO_CNF = "1"+"Var"+"*N"+"=a"
+ CM_GET_BEACON_REQ = "1234567"
+ CM_GET_BEACON_CNF = "123456789ABC"+"Var"+"=a"
+ CM_HFID_REQ = "1"+"0or6"+"0or64"+"=a"
+ CM_HFID_CNF = "1"+"12345678"+"12345678"+"12345678"+"12345678"+"12345678"+"12345678"+"12345678"+"12345678"
+ CM_MME_ERROR_IND = "123456"
+ CM_NW_STATS_REQ = ""
+ CM_NW_STATS_CNF = "1"+"12345678"+"*L"+"=b"
+ CM_LINK_STATS_REQ = "12345678"+"12345678"+"12"
+ CM_LINK_STATS_CNF = "12"+"Var"+"=a"
+ #to 0x7FFC : Reserved for future use
+ #--- Manufacturer Specific ---
+ #to 0x9FFC : Manufacturer Specific Messages
+ #--- Vendor Specific ---
+ #to 0xBFFC : Vendor-Specific Messages
diff --git a/cesar/maximus/python/lib/mmentry/mmentryFields.py b/cesar/maximus/python/lib/mmentry/mmentryFields.py
new file mode 100644
index 0000000000..8a81d1473d
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/mmentryFields.py
@@ -0,0 +1,3258 @@
+# -*- coding:Utf-8 -*-
+
+
+
+#MMENTRY Fields
+
+from struct import *
+from fid import *
+from math import *
+from random import randrange #random library is used : randrange(),
+from Constants import * #Constants library is used : classifierRuleSize[], MAX_TONE_MAPS,
+from binascii import * #binascii library is used : crc32(),
+from bmi import *
+from aes128 import *
+
+from encapsulation import *
+myEncapsulatedMme=EncapsulatedMme()
+
+#CINFO identifies the attributes of the Connection and the MAC and PAL
+# operations required by the Connection at the source and destinations
+# STAs. The format of the CINFO fields is shown in Table 7-145.
+# A separate CINFO field is required for the forward and reverse
+# directions of the Connection.
+# The CINFO, QoS, and MAC parameter fields specifically apply to the
+# forward or Reverse Links, as indicated in the CSPEC.
+class Cinfo():
+ #CINFO :
+
+ # CINFO Validity
+ valid = 1 #1:CINFO is Valid, 0:CINFO is not Valid
+ validField = pack('B',valid)
+ def createValid(self, myValid=None):
+ if myValid!=None:
+ self.valid=myValid
+ self.validField = pack('B',self.valid)
+ print "valid = "+hex(self.valid)
+
+ # Connections and Network Modes
+ # 0=contention-free service
+ # 1=contention-based service
+ # 2=contention-free sevice prefered
+ macServiceType = 2
+ if valid == 1:
+ macServiceTypeField = pack('B',macServiceType)
+ else:
+ macServiceTypeField = ""
+ def createMacServiceType(self, myMacServiceType=None):
+ if myMacServiceType!=None:
+ self.macServiceType=myMacServiceType
+ if self.valid == 1:
+ self.macServiceTypeField = pack('B',self.macServiceType)
+ else:
+ self.macServiceTypeField = ""
+ print "macServiceType = "+hex(self.macServiceType)
+
+ # Channel Access Priority
+ userPriority = 0
+ if valid == 1:
+ userPriorityField = pack('B',userPriority)
+ else:
+ userPriorityField = ""
+ def createUserPriority(self, myUserPriority=None):
+ if myUserPriority!=None:
+ self.userPriority=myUserPriority
+ if self.valid == 1:
+ self.userPriorityField = pack('B',self.userPriority)
+ else:
+ self.userPriorityField = ""
+ print "userPriority = "+hex(self.userPriority)
+
+ # Arrival Time Stamp to HLE
+ # 0=ATS should not be passed to HLE
+ # 1=ATS should be passed to HLE
+ ats = 1
+ if valid == 1:
+ atsField = pack('B',ats)
+ else:
+ atsField = ""
+ def createAts(self, myAts=None):
+ if myAts!=None:
+ self.ats=myAts
+ if self.valid == 1:
+ self.atsField = pack('B',self.ats)
+ else:
+ self.atsField = ""
+ print "ats = "+hex(self.ats)
+
+ # Smoothing Requested
+ # 0=Smotthing is not requested
+ # 1=if supported receiver should activate smoothing
+ smoothing = 1
+ if valid == 1:
+ smoothingField = pack('B',smoothing)
+ else:
+ smoothingField = ""
+ def createSmoothing(self, mySmoothing=None):
+ if mySmoothing!=None:
+ self.smoothing=mySmoothing
+ if self.valid == 1:
+ self.smoothingField = pack('B',self.smoothing)
+ else:
+ self.smoothingField = ""
+ print "smoothing = "+hex(self.smoothing)
+
+ #CINFO Field :
+ cinfo = validField + macServiceTypeField + userPriorityField + atsField + smoothingField
+ def createCinfo(self, myValid=None, myMacServiceType=None, myUserPriority=None, myAts=None, mySmoothing=None):
+ self.createValid(myValid)
+ self.createMacServiceType(myMacServiceType)
+ self.createUserPriority(myUserPriority)
+ self.createAts(myAts)
+ self.createSmoothing(mySmoothing)
+ self.cinfo = self.validField + self.macServiceTypeField + self.userPriorityField + self.atsField + self.smoothingField
+
+#The QoS and MAC parameters identify the QoS requirements (delay, jitter, data
+# rates), as well as MAC parameters that are specific to the particular
+# Connection. The QoS parameters are generated by the Connection Manager using
+# the Auto-Connect function or through PAL-specific primitives exchanged
+# between the higher layer applications and the CM.Each QoS and MAC parameter
+# field consists of a Forward/Reverse (F/R) field, a Length (LEN) field, and a
+# 1-octet Field Identifier (FID) field, followed by the Body of the QoS and MAC
+# Parameter field. Table 7-146 shows the format of a QoS and MAC parameter
+# field. The QMPs exchanged between the HLE and Connection Manager are shown in
+# Table 7-147. The QoS and MAC parameters exchanged between two CMs include the
+# parameters shown in Table 7-147 and Table 7-148. The QoS and MAC parameters
+# exchanged between the CM and CCo are shown in Table 7-149.
+class Qmp():
+ #QMP :
+
+ # Forward/Reverse Field
+ # 0=Forward from source to receiver
+ # 1=Reverse from receiver to source
+ fR = 0
+ fRField = pack('B',fR)
+ def createFR(self, myFR=None):
+ if myFR!=None:
+ self.fR=myFR
+ self.fRField = pack('B',self.fR)
+ print "fR = "+hex(self.fR)
+
+ #Length of the Body Field
+ length = 1
+ lengthField = pack('B',length)
+ def createLength(self):
+ self.length = len(self.dataField)
+ self.lengthField = pack('B',self.length)
+ print "length = "+hex(self.length)
+
+ #Identifier of the QoS and MAC Parameter Field
+ fid = Delay_Bound #Delay_Bound by default
+ fidField = pack('B',fid)
+ def createFid(self, myFid=None):
+ if myFid!=None:
+ self.fid=myFid
+ self.fidField = pack('B',self.fid)
+ print "fid = "+hex(self.fid)
+
+ #Data of the QoS and MAC Parameter Field
+ data = FidMethod()
+ dataField = data.dico[fid]()
+ def createBody(self, param1=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ print "fidBody :"
+ #print self.data.dico[self.fid]
+ self.dataField = self.data.dico[self.fid](param1, param2, param3, param4, param5, param6)
+ self.createLength()
+
+ #QMP Field :
+ qmp = fRField + lengthField + fidField + dataField
+ def createQmp(self, myFR=None, myFid=None, param1=None, param2=None, param3=None, param4=None, param5=None, param6=None):
+ self.createFR(myFR)
+ self.createFid(myFid)
+ self.createBody(param1, param2, param3, param4, param5, param6)
+ #self.createLength()
+ self.qmp = self.fRField + self.lengthField + self.fidField + self.dataField
+
+#ConnectionSpecification
+class Cspec():
+ #Length of CSPEC including the 2 CSPEC_LEN field octets
+ cspecLen = 2
+ cspecLenField = pack('H',cspecLen)
+ def createCspecLen(self):
+ if self.cspecLen != 0:
+ self.cspecLen = 2 + len(self.cinfoForward.cinfo) + len(self.cinfoReverse.cinfo) + len(self.qmpForward.qmp) + len(self.qmpReverse.qmp)
+ self.cspecLenField = pack('H',self.cspecLen)
+ print "cspecLen = "+hex(self.cspecLen)
+
+ #CINFO Forward Field
+ print "cinfoForward :"
+ cinfoForward = Cinfo()
+
+ #CINFO Reverse Field
+ print "cinfoReverse :"
+ cinfoReverse = Cinfo()
+
+ #QMP Forward Field
+ print "qmpForward :"
+ qmpForward = Qmp()
+
+ #QMP Reverse Field
+ print "qmpReverse :"
+ qmpReverse = Qmp()
+
+ #CSPEC Field :
+ cspec = cspecLenField + cinfoForward.cinfo + cinfoReverse.cinfo + qmpForward.qmp + qmpReverse.qmp
+ def createCspec(self, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ if myCsepcLen!=None:
+ self.cspecLen=myCsepcLen
+ if self.cspecLen != 0:
+ print "cinfoForward :"
+ self.cinfoForward.createCinfo(myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF)
+ print "cinfoReverse :"
+ self.cinfoReverse.createCinfo(myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR)
+ print "qmpForward :"
+ self.qmpForward.createQmp(myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F)
+ print "qmpReverse :"
+ self.qmpReverse.createQmp(myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.createCspecLen()
+ self.cspec = self.cspecLenField + self.cinfoForward.cinfo + self.cinfoReverse.cinfo + self.qmpForward.qmp + self.qmpReverse.qmp
+ else:
+ self.createCspecLen()
+ self.cspec = self.cspecLenField
+
+#Bit Loading Estimate
+class Ble():
+
+ #Number of intervals
+ num = 255 #By default MAX Bit Loading Estimates are available
+ numField = pack('B',num)
+ def createNum(self, myNum=None):
+ if myNum!=None:
+ self.num=myNum
+ self.numField = pack('B',self.num)
+ print "num = "+hex(self.num)
+
+ #Interval End Time #1-N and Bit Loading Estimate #1-N
+ endTime = []
+ endTimeField = []
+ intBle = [] #BLE integer format
+ exponent = []
+ mantissa = []
+ interval = [] #BLE is splited into 5 mantissa MSbits and 3 exponent LSbits
+ intervalField = []
+ i = 0
+ while i < num:
+ endTime.append(0)
+ endTimeField.append(pack('H',endTime[i]))
+ intBle.append(0)
+ exponent.append(max(0,int(log(max(2,intBle[0]),2))-1))
+ mantissa.append(max(0,int(32*(intBle[0]/pow(2,exponent[0]+1)-1))))
+ interval.append(int(mantissa[i]*pow(2,3)+exponent[i])) #is the Bit Loading Estimate #1-N
+ intervalField.append(pack('B',interval[i]))
+ i=i+1
+ num=0
+ def createIntervalEndTimeAndBitLoadingEstimate(self, myEndTime=None, myIntBle=None, myInterval=None):
+ self.i = 0
+ while self.i < self.num:
+ if myEndTime!=None:
+ self.endTime[self.i]=myEndTime
+ print "endTime["+str(self.i)+"] = "+hex(self.endTime[self.i])
+ self.endTimeField[self.i] = pack('H',self.endTime[self.i])
+ if myIntBle!=None:
+ self.intBle[self.i]=myIntBle
+ self.exponent[self.i] = max(0,int(log(max(2,self.intBle[self.i]),2))-1)
+ self.mantissa[self.i] = max(0,int(32*(self.intBle[self.i]/pow(2,self.exponent[self.i]+1)-1)))
+ self.interval[self.i] = int(self.mantissa[self.i]*pow(2,3)+self.exponent[self.i])
+ if myInterval!=None:
+ self.interval[self.i]=myInterval
+ print "interval["+str(self.i)+"] = "+hex(self.interval[self.i])
+ self.intervalField[self.i] = pack('B',self.interval[self.i])
+ self.i = self.i + 1
+
+ #BLE Field :
+ ble = numField
+ i = 0
+ while i < num:
+ ble = ble + endTimeField[i] + intervalField[i]
+ i = i + 1
+ def createBle(self, myNum=None, myEndTime=None, myIntBle=None, myInterval=None):
+ self.createNum(myNum)
+ self.createIntervalEndTimeAndBitLoadingEstimate(myEndTime, myIntBle, myInterval)
+ self.ble = self.numField
+ self.i = 0
+ while self.i < self.num:
+ self.ble = self.ble + self.endTimeField[self.i] + self.intervalField[self.i]
+ self.i = self.i + 1
+
+#Connection Identifier
+class Cid():
+ tei = 0
+ teiField = pack('B',tei)
+ def createTei(self, myTei=None):
+ if myTei!=None:
+ self.tei=myTei
+ self.teiField = pack('B',self.tei)
+ print "tei = "+hex(self.tei)
+ llidF = 0
+ llidFField = pack('B',llidF)
+ def createLlidF(self, myLlidF=None):
+ if myLlidF!=None:
+ self.llidF=myLlidF
+ self.llidFField = pack('B',self.llidF)
+ print "llidF = "+hex(self.llidF)
+ cid = teiField + llidFField
+ def createCid(self, myTei=None, myLlidF=None):
+ self.createTei(myTei)
+ self.createLlidF(myLlidF)
+ self.cid = self.teiField + self.llidFField
+
+#Global Link Informations
+class GlobalLinkInfo():
+ print "cid :"
+ cid = Cid()
+ stei = 0
+ steiField = pack('B',stei)
+ def createStei(self, myStei=None):
+ if myStei!=None:
+ self.stei=myStei
+ self.steiField = pack('B',self.stei)
+ print "stei = "+hex(self.stei)
+ dtei = 0
+ dteiField = pack('B',dtei)
+ def createDtei(self, myDtei=None):
+ if myDtei!=None:
+ self.dtei=myDtei
+ self.dteiField = pack('B',self.dtei)
+ print "dtei = "+hex(self.dtei)
+ lidF = 0xFF
+ lidFField = pack('B',lidF)
+ def createLidF(self, myLidF=None):
+ if myLidF!=None:
+ self.lidF=myLidF
+ self.lidFField = pack('B',self.lidF)
+ print "lidF = "+hex(self.lidF)
+ lidR = 0xFF
+ lidRField = pack('B',lidR)
+ def createLidR(self, myLidR=None):
+ if myLidR!=None:
+ self.lidR=myLidR
+ self.lidRField = pack('B',self.lidR)
+ print "lidR = "+hex(self.lidR)
+ cspec = Cspec()
+ bleForward = Ble()
+ bleReverse = Ble()
+
+ globalLinkInfo = cid.cid + steiField + dteiField + lidFField + lidRField + cspec.cspec + bleForward.ble + bleReverse.ble
+ def createGlobalLinkInfo(self, myTei=None, myLlidF=None, myStei=None, myDtei=None, myLidF=None, myLidR=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None, myNumF=None, myEndTimeL=None, myIntBleL=None, myIntervalL=None, myNumR=None, myEndTimeR=None, myIntBleR=None, myIntervalR=None):
+ self.cid.createCid(myTei, myLlidF)
+ self.createStei(myStei)
+ self.createDtei(myDtei)
+ self.createLidF(myLidF)
+ self.createLidR(myLidR)
+ print "cspec :"
+ self.cspec.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ print "bleForward :"
+ self.bleForward.createBle(myNumF, myEndTimeL, myIntBleL, myIntervalL)
+ print "bleReverse :"
+ self.bleReverse.createBle(myNumR, myEndTimeR, myIntBleR, myIntervalR)
+ self.globalLinkInfo = self.cid.cid + self.steiField + self.dteiField + self.lidFField + self.lidRField + self.cspec.cspec + self.bleForward.ble + self.bleReverse.ble
+
+#Connection Informations
+class ConnInfo():
+ print "cid :"
+ cid = Cid()
+ stei = 0
+ steiField = pack('B',stei)
+ def createStei(self, myStei=None):
+ if myStei!=None:
+ self.stei=myStei
+ self.steiField = pack('B',self.stei)
+ print "stei = "+hex(self.stei)
+ dtei = 0
+ dteiField = pack('B',dtei)
+ def createDtei(self, myDtei=None):
+ if myDtei!=None:
+ self.dtei=myDtei
+ self.dteiField = pack('B',self.dtei)
+ print "dtei = "+hex(self.dtei)
+ lidF = 0xFF
+ lidFField = pack('B',lidF)
+ def createLidF(self, myLidF=None):
+ if myLidF!=None:
+ self.lidF=myLidF
+ self.lidFField = pack('B',self.lidF)
+ print "lidF = "+hex(self.lidF)
+ lidR = 0xFF
+ lidRField = pack('B',lidR)
+ def createLidR(self, myLidR=None):
+ if myLidR!=None:
+ self.lidR=myLidR
+ self.lidRField = pack('B',self.lidR)
+ print "lidR = "+hex(self.lidR)
+ cspec = Cspec()
+
+ ConnInfo = cid.cid + steiField + dteiField + lidFField + lidRField + cspec.cspec
+ def createConnInfo(self, myTei=None, myLlidF=None, myStei=None, myDtei=None, myLidF=None, myLidR=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ self.cid.createCid(myTei, myLlidF)
+ self.createStei(myStei)
+ self.createDtei(myDtei)
+ self.createLidF(myLidF)
+ self.createLidR(myLidR)
+ print "cspec :"
+ self.cspec.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.ConnInfo = self.cid.cid + self.steiField + self.dteiField + self.lidFField + self.lidRField + self.cspec.cspec
+
+#Station Informations
+class StaInfo():
+ tei = 0
+ teiField = pack('B',tei)
+ def createTei(self, myTei=None):
+ if myTei!=None:
+ self.tei=myTei
+ self.teiField = pack('B',self.tei)
+ print "tei = "+hex(self.tei)
+ macAddress = 0
+ macAddressField = pack('Q',macAddress)[0:6]
+ def createMacAddress(self, myMacAddress=None):
+ if myMacAddress!=None:
+ self.macAddress=myMacAddress
+ self.macAddressField = pack('Q',self.macAddress)[0:6]
+ print "macAddress = "+hex(self.macAddress)
+ status = 0
+ statusField = pack('B',status)
+ def createStatus(self, myStatus=None):
+ if myStatus!=None:
+ self.status=myStatus
+ self.statusField = pack('B',self.status)
+ print "status = "+hex(self.status)
+ ptei = 0
+ pteiField = pack('B',ptei)
+ def createPtei(self, myPtei=None):
+ if myPtei!=None:
+ self.ptei=myPtei
+ self.pteiField = pack('B',self.ptei)
+ print "ptei = "+hex(self.ptei)
+ staInfo = teiField + macAddressField + statusField + pteiField
+ def createStaInfo(self, myTei=None, myMacAddress=None, myStatus=None, myPtei=None):
+ self.createTei(myTei)
+ self.createMacAddress(myMacAddress)
+ self.createStatus(myStatus)
+ self.createPtei(myPtei)
+ self.staInfo = self.teiField + self.macAddressField + self.statusField + self.pteiField
+
+#STA Info
+class StationInfo():
+ macAddress = 0
+ macAddressField = pack('Q',macAddress)[0:6]
+ def createMacAddress(self, myMacAddress=None):
+ if myMacAddress!=None:
+ self.macAddress=myMacAddress
+ self.macAddressField = pack('Q',self.macAddress)[0:6]
+ print "macAddress = "+hex(self.macAddress)
+ tei = 0
+ teiField = pack('B',tei)
+ def createTei(self, myTei=None):
+ if myTei!=None:
+ self.tei=myTei
+ self.teiField = pack('B',self.tei)
+ print "tei = "+hex(self.tei)
+ sameNetwork = 1 #SameNetwork by default
+ sameNetworkField = pack('B',sameNetwork)
+ def createSameNetwork(self, mySameNetwork=None):
+ if mySameNetwork!=None:
+ self.sameNetwork=mySameNetwork
+ self.sameNetworkField = pack('B',self.sameNetwork)
+ print "sameNetwork = "+hex(self.sameNetwork)
+ snid = 0xA
+ access = 0 #in home by default
+ snidAccess = int(snid + access*pow(2,4))
+ snidAccessField = pack('B',snidAccess)
+ def createSnidAccess(self, mySnid=None, myAccess=None, mySnidAccess=None):
+ if mySnidAccess!=None:
+ try:
+ self.snidAccess=mySnidAccess
+ self.snidAccessField = pack('B',self.snidAccess)
+ except:
+ self.snidAccessField=mySnidAccess
+ self.snidAccess = unpack('B',self.snidAccessField[0])[0]
+ else:
+ if mySnid!=None:
+ self.snid=mySnid
+ if myAccess!=None:
+ self.access=myAccess
+ else:
+ self.snidAccess = int(self.snid + self.access*pow(2,4))
+ self.snidAccessField = pack('B',self.snidAccess)
+ print "snidAccess = "+hex(self.snidAccess)
+ reserved = 0
+ ccoCapability = 0 #does not support QoS and TDMA by default
+ proxyNetworkCapability = 0 #STA does not support Proxy Networking by default
+ backupCcoCapability = 0 #STA does not support the Backup CCo function by default
+ ccoStatus = 0 #STA is not the CCo by default
+ pcoStatus = 0 #STA is not a PCo by default
+ backupCcoStatus = 0 #STA is not a Backup CCo by default
+ ninthOctet = int(reserved + ccoCapability*pow(2,1) + proxyNetworkCapability*pow(2,3) + backupCcoCapability*pow(2,4) + ccoStatus*pow(2,5) + pcoStatus*pow(2,6) + backupCcoStatus*pow(2,7))
+ ninthOctetField = pack('B',ninthOctet)
+ def createNinthOctet(self, myCcoCapability=None, myProxyNetworkCapability=None, myBackupCcoCapability=None, myCcoStatus=None, myPcoStatus=None, myBackupCcoStatus=None, myNinthOctet=None):
+ if myCcoCapability!=None:
+ self.ccoCapability=myCcoCapability
+ if myProxyNetworkCapability!=None:
+ self.proxyNetworkCapability=myProxyNetworkCapability
+ if myBackupCcoCapability!=None:
+ self.backupCcoCapability=myBackupCcoCapability
+ if myCcoStatus!=None:
+ self.ccoStatus=myCcoStatus
+ if myPcoStatus!=None:
+ self.pcoStatus=myPcoStatus
+ if myBackupCcoStatus!=None:
+ self.backupCcoStatus=myBackupCcoStatus
+ if myNinthOctet!=None:
+ self.ninthOctet=myNinthOctet
+ else:
+ self.ninthOctet = int(self.reserved + self.ccoCapability*pow(2,1) + self.proxyNetworkCapability*pow(2,3) + self.backupCcoCapability*pow(2,4) + self.ccoStatus*pow(2,5) + self.pcoStatus*pow(2,6) + self.backupCcoStatus*pow(2,7))
+ self.ninthOctetField = pack('B',self.ninthOctet)
+ print "ninthOctet = "+hex(self.ninthOctet)
+ signalLevel = 0 #information not available by default
+ signalLevelField = pack('B',signalLevel)
+ def createSignalLevel(self, mySignalLevel=None):
+ if mySignalLevel!=None:
+ self.signalLevel=mySignalLevel
+ self.signalLevelField = pack('B',self.signalLevel)
+ print "signalLevel = "+hex(self.signalLevel)
+ averageBle = Ble()
+
+ stationInfo = macAddressField + teiField + sameNetworkField + snidAccessField + ninthOctetField + signalLevelField + averageBle.intervalField[0]
+ def createStationInfo(self, myMacAddress=None, myTei=None, mySameNetwork=None, mySnid=None, myAccess=None, mySnidAccess=None, myCcoCapability=None, myProxyNetworkCapability=None, myBackupCcoCapability=None, myCcoStatus=None, myPcoStatus=None, myBackupCcoStatus=None, myNinthOctet=None, mySignalLevel=None, myEndTime=None, myIntBle=None, myInterval=None):
+ self.createMacAddress(myMacAddress)
+ self.createTei(myTei)
+ self.createSameNetwork(mySameNetwork)
+ self.createSnidAccess(mySnid, myAccess, mySnidAccess)
+ self.createNinthOctet(myCcoCapability, myProxyNetworkCapability, myBackupCcoCapability, myCcoStatus, myPcoStatus, myBackupCcoStatus, myNinthOctet)
+ self.createSignalLevel(mySignalLevel)
+ print "averageBle :"
+ self.averageBle.createBle(1, myEndTime, myIntBle, myInterval)
+ self.stationInfo = self.macAddressField + self.teiField + self.sameNetworkField + self.snidAccessField + self.ninthOctetField + self.signalLevelField + self.averageBle.intervalField[0]
+
+#Network Info
+class NetworkInfo():
+ reserved = 0
+ securityLevel = 0 #Simple connect by default
+ nidOffset = 0x0f0e0d0c
+ nid = int(nidOffset + securityLevel*pow(2,52) + reserved*pow(2,54))
+ nidField = pack('Q',nid)[0:7]
+ def createNid(self, mySecurityLevel=None, myNidOffset=None, myNid=None):
+ if mySecurityLevel!=None:
+ self.securityLevel=mySecurityLevel
+ if myNidOffset!=None:
+ self.nidOffset=myNidOffset
+ if myNid!=None:
+ self.nid=myNid
+ else:
+ self.nid = int(self.nidOffset + self.securityLevel*pow(2,52) + self.reserved*pow(2,54))
+ self.nidField = pack('Q',self.nid)[0:7]
+ print "nid = "+hex(self.nid)
+ snid = 0xA
+ access = 0 #in home by default
+ snidAccess = int(snid + access*pow(2,4))
+ snidAccessField = pack('B',snidAccess)
+ def createSnidAccess(self, mySnid=None, myAccess=None, mySnidAccess=None):
+ if mySnid!=None:
+ self.snid=mySnid
+ if myAccess!=None:
+ self.access=myAccess
+ if mySnidAccess!=None:
+ self.snidAccess=mySnidAccess
+ else:
+ self.snidAccess = int(self.snid + self.access*pow(2,4))
+ self.snidAccessField = pack('B',self.snidAccess)
+ print "snidAccess = "+hex(self.snidAccess)
+ hm=0 #AV Only Mode by default
+ hmField = pack('B',hm)
+ def createHm(self, myHm=None):
+ if myHm!=None:
+ self.hm=myHm
+ self.hmField = pack('B',self.hm)
+ print "hm = "+hex(self.hm)
+ numSlot = 0 #1 beacon slot by default
+ numSlotField = pack('B',numSlot)
+ def createNumSlot(self, myNumSlot=None):
+ if myNumSlot!=None:
+ self.numSlot=myNumSlot
+ self.numSlotField = pack('B',self.numSlot)
+ print "numSlot = "+hex(self.numSlot)
+ coordonatingStatus = 0 #Unknow by default
+ coordonatingStatusField = pack('B',coordonatingStatus)
+ def createCoordonatingStatus(self, myCoordonatingStatus=None):
+ if myCoordonatingStatus!=None:
+ self.coordonatingStatus=myCoordonatingStatus
+ self.coordonatingStatusField = pack('B',self.coordonatingStatus)
+ print "coordonatingStatus = "+hex(self.coordonatingStatus)
+ offset = 0 #In the same group by default
+ offsetField = pack('H',offset)
+ def createOffset(self, myOffset=None):
+ if myOffset!=None:
+ self.offset=myOffset
+ self.offsetField = pack('H',self.offset)
+ print "offset = "+hex(self.offset)
+ networkInfo = nidField + snidAccessField + hmField + numSlotField + coordonatingStatusField + offsetField
+ def createNetworkInfo(self, mySecurityLevel=None, myNidOffset=None, myNid=None, mySnid=None, myAccess=None, mySnidAccess=None, myHm=None, myNumSlot=None, myCoordonatingStatus=None, myOffset=None):
+ self.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.createSnidAccess(mySnid, myAccess, mySnidAccess)
+ self.createHm(myHm)
+ self.createNumSlot(myNumSlot)
+ self.createCoordonatingStatus(myCoordonatingStatus)
+ self.createOffset(myOffset)
+ self.networkInfo = self.nidField + self.snidAccessField + self.hmField + self.numSlotField + self.coordonatingStatusField + self.offsetField
+
+#Network Information of the AVLN
+class NwInfo():
+ reserved = 0
+ securityLevel = 0 #Simple connect by default
+ nidOffset = 0x0f0e0d0c
+ nid = int(nidOffset + securityLevel*pow(2,52) + reserved*pow(2,54))
+ nidField = pack('Q',nid)[0:7]
+ def createNid(self, mySecurityLevel=None, myNidOffset=None, myNid=None):
+ if mySecurityLevel!=None:
+ self.securityLevel=mySecurityLevel
+ if myNidOffset!=None:
+ self.nidOffset=myNidOffset
+ if myNid!=None:
+ self.nid=myNid
+ else:
+ self.nid = int(self.nidOffset + self.securityLevel*pow(2,52) + self.reserved*pow(2,54))
+ self.nidField = pack('Q',self.nid)[0:7]
+ print "nid = "+hex(self.nid)
+ snid = 0xA
+ snidField = pack('B',snid)
+ def createSnid(self, mySnid=None):
+ if mySnid!=None:
+ self.snid=mySnid
+ self.snidField = pack('B',self.snid)
+ print "snid = "+hex(self.snid)
+ tei=0
+ teiField = pack('B',tei)
+ def createTei(self, myTei=None):
+ if myTei!=None:
+ self.tei=myTei
+ self.teiField = pack('B',self.tei)
+ print "tei = "+hex(self.tei)
+ stationRole = 0 #Station by default
+ stationRoleField = pack('B',stationRole)
+ def createStationRole(self, myStationRole=None):
+ if myStationRole!=None:
+ self.stationRole=myStationRole
+ self.stationRoleField = pack('B',self.stationRole)
+ print "stationRole = "+hex(self.stationRole)
+ cco_MacAddress = 0x63614D6F4343 #A default CCo MAC Address by default
+ cco_MacAddressField = pack('Q',cco_MacAddress)[0:6]
+ def createCco_MacAddress(self, myCco_MacAddress=None):
+ if myCco_MacAddress!=None:
+ self.cco_MacAddress=myCco_MacAddress
+ self.cco_MacAddressField = pack('Q',self.cco_MacAddress)[0:6]
+ print "cco_MacAddress = "+hex(self.cco_MacAddress)
+ access = 0 #in home by default
+ accessField = pack('B',access)
+ def createAccess(self, myAccess=None):
+ if myAccess!=None:
+ self.access=myAccess
+ self.accessField = pack('B',self.access)
+ print "access = "+hex(self.access)
+ numCordNws = 0 #in home by default
+ numCordNwsField = pack('B',numCordNws)
+ def createNumCordNws(self, myNumCordNws=None):
+ if myNumCordNws!=None:
+ self.numCordNws=myNumCordNws
+ self.numCordNwsField = pack('B',self.numCordNws)
+ print "numCordNws = "+hex(self.numCordNws)
+ nwInfo = nidField + snidField + teiField + stationRoleField + cco_MacAddressField + accessField + numCordNwsField
+ def createNwInfo(self, mySecurityLevel=None, myNidOffset=None, myNid=None, mySnid=None, myTei=None, myStationRole=None, myCco_MacAddress=None, myAccess=None, myNumCordNws=None):
+ self.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.createSnid(mySnid)
+ self.createTei(myTei)
+ self.createStationRole(myStationRole)
+ self.createCco_MacAddress(myCco_MacAddress)
+ self.createAccess(myAccess)
+ self.createNumCordNws(myNumCordNws)
+ self.nwInfo = self.nidField + self.snidField + self.teiField + self.stationRoleField + self.cco_MacAddressField + self.accessField + self.numCordNwsField
+
+#GLIDs
+class Glids():
+ glids = []
+ glidsField = []
+ numGlid = 255
+ i = 0
+ while i < numGlid:
+ glids.append(0xFF) #Local CSMA allocation by default
+ glidsField.append(pack('B',glids[i]))
+ i=i+1
+ def createGlids(self, myNumGlid=None, myGlids=None):
+ if myNumGlid!=None:
+ self.numGlid=myNumGlid
+ self.i = 0
+ while self.i < self.numGlid:
+ if myGlids!=None:
+ self.glids[self.i]=myGlids
+ self.glidsField[self.i]=pack('B',self.glids[self.i])
+ print "glids["+str(self.i)+"] = "+hex(self.glids[self.i])
+ self.i = self.i + 1
+
+#GLID Info
+class GlidsInfo():
+ glidsInfo = []
+ cfDetecteds = []
+ cfDetectedsField = []
+ csmaDetecteds = []
+ csmaDetectedsField = []
+ hp1Detecteds = []
+ hp1DetectedsField = []
+ othersDetecteds = []
+ othersDetectedsField = []
+ signalLevels = []
+ signalLevelsField = []
+ numGlid = 255
+ glids = Glids()
+ #glids.createGlids(numGlid)
+ def createGlids(self, myNumGlid=None, myGlids=None):
+ if myNumGlid!=None:
+ self.numGlid=myNumGlid
+ self.glids.createGlids(self.numGlid, myGlids)
+ i=0
+ while i<numGlid:
+ cfDetecteds.append(0) #Not detected by default
+ cfDetectedsField.append(pack('B',cfDetecteds[i]))
+ i=i+1
+ def createCfDetecteds(self, myCfDetecteds=None):
+ self.i=0
+ while self.i<self.numGlid:
+ if myCfDetecteds!=None:
+ self.cfDetecteds[self.i]=myCfDetecteds
+ self.cfDetectedsField[self.i] = pack('B',self.cfDetecteds[self.i])
+ print "cfDetecteds["+str(self.i)+"] = "+hex(self.cfDetecteds[self.i])
+ self.i=self.i+1
+ i=0
+ while i<numGlid:
+ csmaDetecteds.append(0) #Not detected by default
+ csmaDetectedsField.append(pack('B',csmaDetecteds[i]))
+ i=i+1
+ def createCsmaDetecteds(self, myCsmaDetecteds=None):
+ self.i=0
+ while self.i<self.numGlid:
+ if myCsmaDetecteds!=None:
+ self.csmaDetecteds[self.i]=myCsmaDetecteds
+ self.csmaDetectedsField[self.i] = pack('B',self.csmaDetecteds[self.i])
+ print "csmaDetecteds["+str(self.i)+"] = "+hex(self.csmaDetecteds[self.i])
+ self.i=self.i+1
+ i=0
+ while i<numGlid:
+ hp1Detecteds.append(0) #Not detected by default
+ hp1DetectedsField.append(pack('B',hp1Detecteds[i]))
+ i=i+1
+ def createHp1Detecteds(self, myHp1Detecteds=None):
+ self.i=0
+ while self.i<self.numGlid:
+ if myHp1Detecteds!=None:
+ self.hp1Detecteds[self.i]=myHp1Detecteds
+ self.hp1DetectedsField[self.i] = pack('B',self.hp1Detecteds[self.i])
+ print "hp1Detecteds["+str(self.i)+"] = "+hex(self.hp1Detecteds[self.i])
+ self.i=self.i+1
+ i=0
+ while i<numGlid:
+ othersDetecteds.append(0) #Not detected by default
+ othersDetectedsField.append(pack('B',othersDetecteds[i]))
+ i=i+1
+ def createOthersDetecteds(self, myOthersDetecteds=None):
+ self.i=0
+ while self.i<self.numGlid:
+ if myOthersDetecteds!=None:
+ self.othersDetecteds[self.i]=myOthersDetecteds
+ self.othersDetectedsField[self.i] = pack('B',self.othersDetecteds[self.i])
+ print "othersDetecteds["+str(self.i)+"] = "+hex(self.othersDetecteds[self.i])
+ self.i=self.i+1
+ i=0
+ while i<numGlid:
+ signalLevels.append(0) #Not detected by default
+ signalLevelsField.append(pack('B',signalLevels[i]))
+ i=i+1
+ def createSignalLevels(self, mySignalLevels=None):
+ self.i=0
+ while self.i<self.numGlid:
+ if mySignalLevels!=None:
+ self.signalLevels[self.i]=mySignalLevels
+ self.signalLevelsField[self.i] = pack('B',self.signalLevels[self.i])
+ print "signalLevels["+str(self.i)+"] = "+hex(self.signalLevels[self.i])
+ self.i=self.i+1
+ averageBle = Ble()
+
+ i=0
+ while i<numGlid:
+ glidsInfo.append(glids.glidsField[i] + cfDetectedsField[i] + csmaDetectedsField[i] + hp1DetectedsField[i] + othersDetectedsField[i] + signalLevelsField[i] + averageBle.intervalField[i])
+ i=i+1
+ def createGlidsInfo(self, myNumGlid=None, myGlids=None, myCfDetecteds=None, myCsmaDetecteds=None, myHp1Detecteds=None, myOthersDetecteds=None, mySignalLevels=None, myEndTime=None, myIntBle=None, myInterval=None):
+ self.createGlids(myNumGlid, myGlids)
+ self.createCfDetecteds(myCfDetecteds)
+ self.createCsmaDetecteds(myCsmaDetecteds)
+ self.createHp1Detecteds(myHp1Detecteds)
+ self.createOthersDetecteds(myOthersDetecteds)
+ self.createSignalLevels(mySignalLevels)
+ print "averageBle :"
+ self.averageBle.createBle(self.numGlid, myEndTime, myIntBle, myInterval)
+ self.i=0
+ while self.i<self.numGlid:
+ self.glidsInfo[self.i] = self.glids.glidsField[self.i] + self.cfDetectedsField[self.i] + self.csmaDetectedsField[self.i] + self.hp1DetectedsField[self.i] + self.othersDetectedsField[self.i] + self.signalLevelsField[self.i] + self.averageBle.intervalField[self.i]
+ self.i=self.i+1
+
+
+
+
+#MmentryFields lists all fields existing in every MMENTRY
+class MmentryFields():
+
+ #MMENTRY
+ mmentry = ""
+
+ #MMTYPE
+ mmtype = 0
+
+ #Request Type
+ reqType = 0 #0 is the default processed value
+ reqTypeField = pack('B',reqType)
+ def createReqType(self, myReqType=None):
+ try:
+ if myReqType!=None:
+ self.reqType=myReqType
+ self.reqTypeField = pack('B',self.reqType)
+ except:
+ if myReqType!=None:
+ self.reqTypeField=myReqType
+ self.reqType = unpack('B',self.reqTypeField[0])[0]
+ print "reqType = "+hex(self.reqType)
+
+ #Response Type
+ resType = 0 #0 is the default processed value
+ resTypeField = pack('B',resType)
+ def createResType(self, myResType=None):
+ if myResType!=None:
+ self.resType=myResType
+ self.resTypeField = pack('B',self.resType)
+ print "resType = "+hex(self.resType)
+
+ #Request Identifier
+ reqId = 0 #0 is the default processed value
+ reqIdField = pack('B',reqId)
+ def createReqId(self, myReqId=None):
+ if myReqId!=None:
+ self.reqId=myReqId
+ self.reqIdField = pack('B',self.reqId)
+ print "reqId = "+hex(self.reqId)
+
+ #MAC Address of the STA
+ macAddress = 0
+ macAddressField = pack('Q',macAddress)[0:6]
+ def createMacAddress(self,myMacAddress=None):
+ try:
+ if myMacAddress!=None:
+ self.macAddress=myMacAddress
+ self.macAddressField = pack('Q',self.macAddress)[0:6]
+ except:
+ if myMacAddress!=None:
+ self.macAddressField=myMacAddress
+ self.macAddress = unpack('Q',self.macAddressField[:6]+"\x00\x00")[0]
+ print "macAddress = "+hex(self.macAddress)
+
+ #Results Codes
+ result = 0
+ resultField = pack('B',result)
+ def createResult(self, myResult=None):
+ if myResult!=None:
+ try:
+ self.result=myResult
+ self.resultField = pack('B',self.result)
+ except:
+ self.resultField=myResult
+ self.result = unpack('B',self.resultField[0])[0]
+ print "result = "+hex(self.result)
+
+ #Become Backup CCo or Release Duty
+ appointRelease = 0
+ appointReleaseField = pack('B',appointRelease)
+ def createAppointRelease(self, myAppointRelease=None):
+ if myAppointRelease!=None:
+ self.appointRelease=myAppointRelease
+ self.appointReleaseField = pack('B',self.appointRelease)
+ print "appointRelease = "+hex(self.appointRelease)
+
+ #Number
+ num = 255
+ numField = pack('B',num)
+ def createNum(self, myNum=None):
+ if myNum!=None:
+ try:
+ self.num=myNum
+ self.numField = pack('B',self.num)
+ except:
+ self.numField=myNum
+ self.num = unpack('B',self.numField[0])[0]
+ print "num = "+hex(self.num)
+
+ #Link Information of the Global Links
+ globalLinks = []
+ i = 0
+ while i < num:
+ globalLinks.append(GlobalLinkInfo())
+ i=i+1
+ def createGlobalLinks(self, myNum=None, myTei=None, myLlidF=None, myStei=None, myDtei=None, myLidF=None, myLidR=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None, myNumF=None, myEndTimeL=None, myIntBleL=None, myIntervalL=None, myNumR=None, myEndTimeR=None, myIntBleR=None, myIntervalR=None):
+ self.createNum(myNum)
+ self.i = 0
+ while self.i < self.num:
+ print "globalLinks["+str(self.i)+"] :"
+ self.globalLinks[self.i].createGlobalLinkInfo(myTei, myLlidF, myStei, myDtei, myLidF, myLidR, myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R, myNumF, myEndTimeL, myIntBleL, myIntervalL, myNumR, myEndTimeR, myIntBleR, myIntervalR)
+ self.i = self.i + 1
+
+ #Soft/Hard
+ softHard = 0 #Soft Handover by default
+ softHardField = pack('B',softHard)
+ def createSoftHard(self, mySoftHard=None):
+ if mySoftHard!=None:
+ self.softHard=mySoftHard
+ self.softHardField = pack('B',self.softHard)
+ print "softHard = "+hex(self.softHard)
+
+ #Reason
+ reason = 0 #User-appointed by default
+ reasonField = pack('B',reason)
+ def createReason(self, myReason=None):
+ if myReason!=None:
+ self.reason=myReason
+ self.reasonField = pack('B',self.reason)
+ print "reason = "+hex(self.reason)
+
+ #Reason Code indicating the reason for sending CC_HANDOVER_INFO.IND
+ rsc = 0 #Handover in progress by default
+ rscField = pack('B',rsc)
+ def createRsc(self, myRsc=None):
+ if myRsc!=None:
+ self.rsc=myRsc
+ self.rscField = pack('B',self.rsc)
+ print "rsc = "+hex(self.rsc)
+
+ #TEI of the Backup CCo
+ backupCco = 0 #no backupCco by default
+ backupCcoField = pack('B',backupCco)
+ def createBackupCco(self, myBackupCco=None):
+ if myBackupCco!=None:
+ self.backupCco=myBackupCco
+ self.backupCcoField = pack('B',self.backupCco)
+ print "backupCco = "+hex(self.backupCco)
+
+ #Information of the Stations
+ stasInfo = []
+ i = 0
+ while i < num:
+ stasInfo.append(StaInfo())
+ i=i+1
+ def createStasInfo(self, myNum=None, myTei=None, myMacAddress=None, myStatus=None, myPtei=None):
+ self.createNum(myNum)
+ self.i = 0
+ while self.i < self.num:
+ print "stasInfo["+str(self.i)+"] :"
+ self.stasInfo[self.i].createStaInfo(myTei, myMacAddress, myStatus, myPtei)
+ self.i = self.i + 1
+
+ #Number of STA
+ numSta = 255
+ numStaField = pack('B',numSta)
+ def createNumSta(self, myNumSta=None):
+ if myNumSta!=None:
+ self.numSta=myNumSta
+ self.numStaField = pack('B',self.numSta)
+ print "numSta = "+hex(self.numSta)
+
+ #Number of Network
+ numNet = 255
+ numNetField = pack('B',numNet)
+ def createNumNet(self, myNumNet=None):
+ if myNumNet!=None:
+ self.numNet=myNumNet
+ self.numNetField = pack('B',self.numNet)
+ print "numNet = "+hex(self.numNet)
+
+ #Number of AVLN that the station is a member
+ numNws = 255
+ numNwsField = pack('B',numNws)
+ def createNumNws(self, myNumNws=None):
+ if myNumNws!=None:
+ self.numNws=myNumNws
+ self.numNwsField = pack('B',self.numNws)
+ print "numNws = "+hex(self.numNws)
+
+ #STAs Info
+ stationsInfo = []
+ i = 0
+ while i < numSta:
+ stationsInfo.append(StationInfo())
+ i=i+1
+ def createStationsInfo(self, myNumSta=None, myMacAddress=None, myTei=None, mySameNetwork=None, mySnid=None, myAccess=None, mySnidAccess=None, myCcoCapability=None, myProxyNetworkCapability=None, myBackupCcoCapability=None, myCcoStatus=None, myPcoStatus=None, myBackupCcoStatus=None, myNinthOctet=None, mySignalLevel=None, myEndTime=None, myIntBle=None, myInterval=None):
+ self.createNumSta(myNumSta)
+ self.i = 0
+ while self.i < self.numSta:
+ print "stationsInfo["+str(self.i)+"] :"
+ self.stationsInfo[self.i].createStationInfo(myMacAddress, myTei, mySameNetwork, mySnid, myAccess, mySnidAccess, myCcoCapability, myProxyNetworkCapability, myBackupCcoCapability, myCcoStatus, myPcoStatus, myBackupCcoStatus, myNinthOctet, mySignalLevel, myEndTime, myIntBle, myInterval)
+ self.i = self.i + 1
+
+ #Networks Info
+ networksInfo = []
+ i = 0
+ while i < numNet:
+ networksInfo.append(NetworkInfo())
+ i=i+1
+ def createNetworksInfo(self, myNumNet=None, mySecurityLevel=None, myNidOffset=None, myNid=None, mySnid=None, myAccess=None, mySnidAccess=None, myHm=None, myNumSlot=None, myCoordonatingStatus=None, myOffset=None):
+ self.createNumNet(myNumNet)
+ self.i = 0
+ while self.i < self.numNet:
+ print "networksInfo["+str(self.i)+"] :"
+ self.networksInfo[self.i].createNetworkInfo(mySecurityLevel, myNidOffset, myNid, mySnid, myAccess, mySnidAccess, myHm, myNumSlot, myCoordonatingStatus, myOffset)
+ self.i = self.i + 1
+
+ #Networks Informations
+ nwsInfo = []
+ i = 0
+ while i < numNws:
+ nwsInfo.append(NwInfo())
+ i=i+1
+ def createNwsInfo(self, myNumNws=None, mySecurityLevel=None, myNidOffset=None, myNid=None, mySnid=None, myTei=None, myStationRole=None, myCco_MacAddress=None, myAccess=None, myNumCordNws=None):
+ self.createNumNws(myNumNws)
+ self.i = 0
+ while self.i < self.numNws:
+ print "nwsInfo["+str(self.i)+"] :"
+ self.nwsInfo[self.i].createNwInfo(mySecurityLevel, myNidOffset, myNid, mySnid, myTei, myStationRole, myCco_MacAddress, myAccess, myNumCordNws)
+ self.i = self.i + 1
+
+ #Init MAC Address of the STA
+ initMacAddress = 0
+ initMacAddressField = pack('Q',initMacAddress)[0:6]
+ def createInitMacAddress(self, myInitMacAddress=None):
+ if myInitMacAddress!=None:
+ self.initMacAddress=myInitMacAddress
+ self.initMacAddressField = pack('Q',self.initMacAddress)[0:6]
+ print "initMacAddress = "+hex(self.initMacAddress)
+
+ #Term MAC Address of the STA
+ termMacAddress = 0
+ termMacAddressField = pack('Q',termMacAddress)[0:6]
+ def createTermMacAddress(self, myTermMacAddress=None):
+ if myTermMacAddress!=None:
+ self.termMacAddress=myTermMacAddress
+ self.termMacAddressField = pack('Q',self.termMacAddress)[0:6]
+ print "termMacAddress = "+hex(self.termMacAddress)
+
+ #Connection Identifier
+ cid = Cid()
+ cidField = cid.cid
+ def createCid(self, myTei=None, myLlidF=None):
+ print "cid :"
+ self.cid.createCid(myTei, myLlidF)
+ self.cidField=self.cid.cid
+
+ #Connection Specification
+ cspec = Cspec()
+ cspecField = cspec.cspec
+ def createCspec(self, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "cspec :"
+ self.cspec.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.cspecField=self.cspec.cspec
+
+ #Forward Link Bit Loading Estimates
+ forwardLinkBle = Ble()
+ forwardLinkBleField=forwardLinkBle.ble
+ def createForwardLinkBle(self, myNum=None, myEndTime=None, myIntBle=None, myInterval=None):
+ print "forwardLinkBle :"
+ self.createNum(myNum)
+ self.forwardLinkBle.createBle(self.num, myEndTime, myIntBle, myInterval)
+ self.forwardLinkBleField=self.forwardLinkBle.ble
+
+ #Reverse Link Bit Loading Estimates
+ reverseLinkBle = Ble()
+ reverseLinkBleField=reverseLinkBle.ble
+ def createReverseLinkBle(self, myNum=None, myEndTime=None, myIntBle=None, myInterval=None):
+ print "reverseLinkBle :"
+ self.createNum(myNum)
+ self.reverseLinkBle.createBle(self.num, myEndTime, myIntBle, myInterval)
+ self.reverseLinkBleField=self.reverseLinkBle.ble
+
+ #Forward Link GLID
+ glidF = 0xFF #Local CSMA allocation by default
+ glidFField = pack('B',glidF)
+ def createGlidF(self, myGlidF=None):
+ if myGlidF!=None:
+ self.glidF=myGlidF
+ self.glidFField = pack('B',self.glidF)
+ print "glidF = "+hex(self.glidF)
+
+ #Reverse Link GLID
+ glidR = 0xFF #Local CSMA allocation by default
+ glidRField = pack('B',glidR)
+ def createGlidR(self, myGlidR=None):
+ if myGlidR!=None:
+ self.glidR=myGlidR
+ self.glidRField = pack('B',self.glidR)
+ print "glidR = "+hex(self.glidR)
+
+ #Proposed CSPEC
+ proposedCspec = Cspec()
+ proposedCspecField = proposedCspec.cspec
+ def createProposedCspec(self, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "proposedCspec :"
+ self.proposedCspec.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.proposedCspecField=self.proposedCspec.cspec
+
+ #Modified CSPEC
+ modifiedCspec = Cspec()
+ modifiedCspecField = modifiedCspec.cspec
+ def createModifiedCspec(self, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "modifiedCspec :"
+ self.modifiedCspec.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.modifiedCspecField=self.modifiedCspec.cspec
+
+ #Terminal Equipment identifier
+ tei = 0
+ teiField = pack('B',tei)
+ def createTei(self, myTei=None):
+ if myTei!=None:
+ self.tei=myTei
+ self.teiField = pack('B',self.tei)
+ print "tei = "+hex(self.tei)
+
+ #Violated CSPEC
+ violatedCspec = Cspec()
+ violatedCspecField = violatedCspec.cspec
+ def createViolatedCspec(self, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "violatedCspec :"
+ self.violatedCspec.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.violatedCspecField=self.violatedCspec.cspec
+
+ #Releasing Station MAC Address
+ releasingStationMacAddress = 0
+ releasingStationMacAddressField = pack('Q',releasingStationMacAddress)[0:6]
+ def createReleasingStationMacAddress(self, myReleasingStationMacAddress=None):
+ if myReleasingStationMacAddress!=None:
+ self.releasingStationMacAddress=myReleasingStationMacAddress
+ self.releasingStationMacAddressField = pack('Q',self.releasingStationMacAddress)[0:6]
+ print "releasingStationMacAddress = "+hex(self.releasingStationMacAddress)
+
+ #Duration
+ duration = 0 #0 beacon period by default
+ durationField = pack('B',duration)
+ def createDuration(self, myDuration=None):
+ if myDuration!=None:
+ self.duration=myDuration
+ self.durationField = pack('B',self.duration)
+ print "duration = "+hex(self.duration)
+
+ #Number of GLID
+ numGlid = 255
+ numGlidField = pack('B',numGlid)
+ def createNumGlid(self, myNumGlid=None):
+ if myNumGlid!=None:
+ self.numGlid=myNumGlid
+ self.numGlidField = pack('B',self.numGlid)
+ print "numGlid = "+hex(self.numGlid)
+
+ #GLIDs
+ glids = Glids()
+ glids.numGlid = numGlid
+ glids.createGlids()
+ def createGlids(self, myNumGlid=None, myGlids=None):
+ print "glids :"
+ self.createNumGlid(myNumGlid)
+ self.glids.createGlids(self.numGlid, myGlids)
+
+ #GLIDs Info
+ glidsInfo = GlidsInfo()
+ glidsInfo.numGlid = numGlid
+ glidsInfo.createGlidsInfo()
+ def createGlidsInfo(self, myNumGlid=None, myCfDetecteds=None, myCsmaDetecteds=None, myHp1Detecteds=None, myOthersDetecteds=None, mySignalLevels=None, myEndTime=None, myIntBle=None, myInterval=None):
+ print "glidsInfo :"
+ self.createNumGlid(myNumGlid)
+ self.glidsInfo.numGlid = self.numGlid
+ self.glidsInfo.createGlidsInfo(self.numGlid, myCfDetecteds, myCsmaDetecteds, myHp1Detecteds, myOthersDetecteds, mySignalLevels, myEndTime, myIntBle, myInterval)
+
+ #Network Identifier
+ reserved = 0
+ securityLevel = 0 #Simple connect by default
+ nidOffset = 0x0f0e0d0c
+ nid = int(nidOffset + securityLevel*pow(2,52) + reserved*pow(2,54))
+ nidField = pack('Q',nid)[0:7]
+ def createNid(self, mySecurityLevel=None, myNidOffset=None, myNid=None):
+ if myNid!=None:
+ try:
+ self.nid=myNid
+ self.nidField = pack('Q',self.nid)[0:7]
+ except:
+ self.nidField=myNid
+ self.nid = unpack('Q',self.nid[:7]+"\x00")[0]
+ elif mySecurityLevel!=None or myNidOffset!=None:
+ if mySecurityLevel!=None:
+ self.securityLevel=mySecurityLevel
+ if myNidOffset!=None:
+ self.nidOffset=myNidOffset
+ self.nid = int(self.nidOffset + self.securityLevel*pow(2,52) + self.reserved*pow(2,54))
+ self.nidField = pack('Q',self.nid)[0:7]
+ print "nid = "+hex(self.nid)
+
+ #CCo's MAC Address
+ cmac = 0x43414D6F4343 #="CCoMAC"
+ cmacField = pack('Q',cmac)[0:6]
+ def createCmac(self, myCmac=None):
+ if myCmac!=None:
+ self.cmac=myCmac
+ self.cmacField = pack('Q',self.cmac)[0:6]
+ print "cmac = "+hex(self.cmac)
+
+ #Human Friendly Identifier
+ # Maximus simulator HFID by default :
+ hfid = "SPiDCOM MAXIMUS SIMULATOR HUMAN FRIENDLY IDENTIFIER : " + maxAddress #pack('Q',maxAddress)[0:6]
+ hfidField = hfid
+ while len(hfidField)<64:
+ hfidField = hfidField + pack('B',0)
+ def createHfid(self, myHfid=None):
+ if myHfid!=None:
+ self.hfid=myHfid
+ self.hfidField = self.hfid
+ while len(self.hfidField)<64:
+ self.hfidField = self.hfidField + pack('B',0)
+ print "hfid = "+self.hfid
+
+ #CCo Capability
+ ccoCapability = 0 #level 0 by default
+ ccoCapabilityField = pack('B',ccoCapability)
+ def createCcoCapability(self, myCcoCapability=None):
+ if myCcoCapability!=None:
+ try:
+ self.ccoCapability=myCcoCapability
+ self.ccoCapabilityField = pack('B',self.ccoCapability)
+ except:
+ self.ccoCapabilityField=myCcoCapability
+ self.ccoCapability = unpack('B',self.ccoCapabilityField[0])[0]
+ print "ccoCapability = "+hex(self.ccoCapability)
+
+ #Proxy Networking Capability
+ proxyNetworkingCapability = 0 #not supported by default
+ proxyNetworkingCapabilityField = pack('B',proxyNetworkingCapability)
+ def createProxyNetworkingCapability(self, myProxyNetworkingCapability=None):
+ if myProxyNetworkingCapability!=None:
+ try:
+ self.proxyNetworkingCapability=myProxyNetworkingCapability
+ self.proxyNetworkingCapabilityField = pack('B',self.proxyNetworkingCapability)
+ except:
+ self.proxyNetworkingCapabilityField=myProxyNetworkingCapability
+ self.proxyNetworkingCapability = unpack('B',self.proxyNetworkingCapabilityField[0])[0]
+ print "proxyNetworkingCapability = "+hex(self.proxyNetworkingCapability)
+
+ #SNID
+ snid = 0xA
+ access = 0 #in home by default
+ snidAccess = int(snid + access*pow(2,4))
+ snidAccessField = pack('B',snidAccess)
+ def createSnidAccess(self, mySnid=None, myAccess=None, mySnidAccess=None):
+ if mySnidAccess!=None:
+ try:
+ self.snidAccess=mySnidAccess
+ self.snidAccessField = pack('B',self.snidAccess)
+ except:
+ self.snidAccessField=mySnidAccess
+ self.snidAccess = unpack('B',self.snidAccessField[0])[0]
+ print "snidAccess = "+hex(self.snidAccess)
+ else:
+ if mySnid!=None:
+ self.snid=mySnid
+ if myAccess!=None:
+ self.access=myAccess
+ self.snidAccess = int(self.snid + self.access*pow(2,4))
+ self.snidAccessField = pack('B',self.snidAccess)
+ print "snid = "+hex(self.snid)
+ print "access = "+hex(self.access)
+ print "snidAccess = "+hex(self.snidAccess)
+
+ #TEI assigned to the station
+ staTei = 0 #no backupCco by default
+ staTeiField = pack('B',staTei)
+ def createStaTei(self, myStaTei=None):
+ if myStaTei!=None:
+ try:
+ self.staTei=myStaTei
+ self.staTeiField = pack('B',self.staTei)
+ except:
+ self.staTeiField=myStaTei
+ self.staTei = unpack('B',self.staTeiField[0])[0]
+ print "staTei = "+hex(self.staTei)
+
+ #Lease Time
+ leaseTime = 0x000F #15min by default
+ leaseTimeField = pack('H',leaseTime)
+ def createLeaseTime(self, myLeaseTime=None):
+ if myLeaseTime!=None:
+ try:
+ self.leaseTime=myLeaseTime
+ self.leaseTimeField = pack('H',self.leaseTime)
+ except:
+ self.leaseTimeField=myLeaseTime
+ self.leaseTime = unpack('H',self.leaseTimeField[0:2])[0]
+ print "leaseTime = "+hex(self.leaseTime)
+
+ #Mode
+ mode = 0 #Update by default
+ modeField = pack('B',mode)
+ def createMode(self, myMode=None):
+ if myMode!=None:
+ try:
+ self.mode=myMode
+ self.modeField = pack('B',self.mode)
+ except:
+ self.modeField=myMode
+ self.mode = unpack('B',self.modeField[0])[0]
+ print "mode = "+hex(self.mode)
+
+ #TEIs
+ teis = []
+ teisField = []
+ i = 0
+ while i < num:
+ teis.append(i)
+ teisField.append(pack('B',teis[i]))
+ i=i+1
+ def createTeis(self, myNum=None, myTei=None):
+ print "teis :"
+ self.createNum(myNum)
+ try:
+ self.i = 0
+ while self.i < self.num:
+ if myTei!=None:
+ self.teis[self.i]=int((myTei+self.i)%pow(2,8))
+ self.teisField[self.i]=pack('B',self.teis[self.i])
+ #print "teis["+str(self.i)+"] = "+hex(self.teis[self.i])
+ self.i = self.i + 1
+ except:
+ if myTei!=None:
+ self.i = 0
+ while self.i < self.num:
+ self.teisField[self.i]=myTei[self.i*8]
+ self.teis[self.i]=unpack('B',self.teisField[self.i])[0]
+ #print "teis["+str(self.i)+"] = "+hex(self.teis[self.i])
+ self.i = self.i + 1
+
+ #MAC Addresses
+ addrs = []
+ addrsField = []
+ i = 0
+ while i < num:
+ addrs.append(i+0x123456)
+ addrsField.append(pack('Q',addrs[i])[0:6])
+ i=i+1
+ def createAddrs(self, myNum=None, myAddr=None):
+ print "addrs : "
+ self.createNum(myNum)
+ try:
+ self.i = 0
+ while self.i < self.num:
+ if myAddr!=None:
+ self.addrs[self.i]=int((myAddr+self.i)%pow(2,48))
+ self.addrsField[self.i]=pack('Q',self.addrs[self.i])[0:6]
+ #print "addrs["+str(self.i)+"] = "+hex(self.addrs[self.i])
+ self.i = self.i + 1
+ except:
+ if myAddr!=None:
+ self.i = 0
+ while self.i < self.num:
+ self.addrsField[self.i]=myAddr[self.i*8:(self.i*8)+6]
+ self.addrs[self.i]=unpack('Q',self.addrsField[self.i]+"\x00\x00")[0]
+ #print "addrs["+str(self.i)+"] = "+hex(self.addrs[self.i])
+ self.i = self.i + 1
+
+ #Statuses
+ statuses = []
+ statusesField = []
+ i = 0
+ while i < num:
+ statuses.append(0) #associated by default
+ statusesField.append(pack('B',statuses[i]))
+ i=i+1
+ def createStatuses(self, myNum=None, myStatus=None):
+ print "statuses :"
+ self.createNum(myNum)
+ try:
+ self.i = 0
+ while self.i < self.num:
+ if myStatus!=None:
+ self.statuses[self.i]=myStatus
+ self.statusesField[self.i]=pack('B',self.statuses[self.i])
+ #print "statuses["+str(self.i)+"] = "+hex(self.statuses[self.i])
+ self.i = self.i + 1
+ except:
+ if myStatus!=None:
+ self.i = 0
+ while self.i < self.num:
+ self.statusesField[self.i]=myStatus[self.i*8]
+ self.statuses[self.i]=unpack('B',self.statusesField[self.i])[0]
+ #print "statuses["+str(self.i)+"] = "+hex(self.statuses[self.i])
+ self.i = self.i + 1
+
+ #TEIs + MAC Addresses + Statuses
+ teisAddrsStatuses = []
+ i = 0
+ while i < num:
+ teisAddrsStatuses.append(teisField[i]+addrsField[i]+statusesField[i])
+ i=i+1
+ def createTeisAddrsStatuses(self, myNum=None, myTei=None, myAddr=None, myStatus=None):
+ print "teisAddrsStatuses :"
+ self.createTeis(myNum, myTei)
+ self.createAddrs(self.num, myAddr)
+ self.createStatuses(self.num, myStatus)
+ self.i = 0
+ while self.i < self.num:
+ self.teisAddrsStatuses[self.i]=self.teisField[self.i]+self.addrsField[self.i]+self.statusesField[self.i]
+ self.i = self.i + 1
+
+ #Final STA MAC Address
+ fda = 0x43414D414446 #="FDAMAC"
+ fdaField = pack('Q',fda)[0:6]
+ def createFda(self, myFda=None):
+ if myFda!=None:
+ self.fda=myFda
+ self.fdaField = pack('Q',self.fda)[0:6]
+ print "fda = "+hex(self.fda)
+
+ #Final STA TEI
+ fTei = 0 #no backupCco by default
+ fTeiField = pack('B',fTei)
+ def createFTei(self, myFTei=None):
+ if myFTei!=None:
+ self.fTei=myFTei
+ self.fTeiField = pack('B',self.fTei)
+ print "fTei = "+hex(self.fTei)
+
+ #Payload
+ payload = "MME"
+ def createPayload(self, myPayload=None):
+ if myPayload!=None:
+ self.payload = myPayload
+ print "payload = "+payload
+
+ #Length of payload
+ length = len(payload)
+ lengthField = pack('H',length)
+ def createLength(self):
+ self.length = len(self.payload)
+ self.lengthField = pack('H',self.length)
+ print "length = "+hex(self.length)
+
+ #Original STA MAC Address
+ oda = 0x43414D41444F #="ODAMAC"
+ odaField = pack('Q',oda)[0:6]
+ def createOda(self, myOda=None):
+ if myOda!=None:
+ self.oda=myOda
+ self.odaField = pack('Q',self.oda)[0:6]
+ print "oda = "+hex(self.oda)
+
+ #Original STA TEI
+ oTei = 0 #no backupCco by default
+ oTeiField = pack('B',oTei)
+ def createOTei(self, myOTei=None):
+ if myOTei!=None:
+ self.oTei=myOTei
+ self.oTeiField = pack('B',self.oTei)
+ print "oTei = "+hex(self.oTei)
+
+ #Number of Beacon Periods
+ nbp = 0
+ nbpField = pack('H',nbp)
+ def createNbp(self, myNbp=None):
+ if myNbp!=None:
+ self.nbp=myNbp
+ self.nbpField = pack('H',self.nbp)
+ print "nbp = "+hex(self.nbp)
+
+ #Number of Missed Beacons
+ nmb = 0
+ nmbField = pack('H',nmb)
+ def createNmb(self, myNmb=None):
+ if myNmb!=None:
+ self.nmb=myNmb
+ self.nmbField = pack('H',self.nmb)
+ print "nmb = "+hex(self.nmb)
+
+ #STEI
+ stei = 0
+ steiField = pack('B',stei)
+ def createStei(self, myStei=None):
+ if myStei!=None:
+ self.stei=myStei
+ self.steiField = pack('B',self.stei)
+ print "stei = "+hex(self.stei)
+
+ #DTEI
+ dtei = 0
+ dteiField = pack('B',dtei)
+ def createDtei(self, myDtei=None):
+ if myDtei!=None:
+ self.dtei=myDtei
+ self.dteiField = pack('B',self.dtei)
+ print "dtei = "+hex(self.dtei)
+
+ #DAddr
+ dAddr = 0x644143414D44 #="DMACAd"
+ dAddrField = pack('Q',dAddr)[0:6]
+ def createDAddr(self, myDAddr=None):
+ if myDAddr!=None:
+ self.dAddr=myDAddr
+ self.dAddrField = pack('Q',self.dAddr)[0:6]
+ print "dAddr = "+hex(self.dAddr)
+
+ #LLID
+ llid = 0
+ llidField = pack('B',llid)
+ def createLlid(self, myLlid=None):
+ if myLlid!=None:
+ self.llid=myLlid
+ self.llidField = pack('B',self.llid)
+ print "llid = "+hex(self.llid)
+
+ #Bit Loading Estimates
+ ble = Ble()
+ bleField=ble.ble
+ def createBle(self, myNum=None, myEndTime=None, myIntBle=None, myInterval=None):
+ print "ble : "
+ self.createNum(myNum)
+ self.ble.createBle(self.num, myEndTime, myIntBle, myInterval)
+ self.bleField=self.ble.ble
+
+ #GCID-F
+ gcidF = 0xFF #Local CSMA allocation by default
+ gcidFField = pack('B',gcidF)
+ def createGcidF(self, myGcidF=None):
+ if myGcidF!=None:
+ self.gcidF=myGcidF
+ self.gcidFField = pack('B',self.gcidF)
+ print "gcidF = "+hex(self.gcidF)
+
+ #GCID-R
+ gcidR = 0xFF #Local CSMA allocation by default
+ gcidRField = pack('B',gcidR)
+ def createGcidR(self, myGcidR=None):
+ if myGcidR!=None:
+ self.gcidR=myGcidR
+ self.gcidRField = pack('B',self.gcidR)
+ print "gcidR = "+hex(self.gcidR)
+
+ #ChanEstF
+ chanEstF = 0
+ chanEstFField = pack('B',chanEstF)
+ def createChanEstF(self, myChanEstF=None):
+ if myChanEstF!=None:
+ self.chanEstF=myChanEstF
+ self.chanEstFField = pack('B',self.chanEstF)
+ print "chanEstF = "+hex(self.chanEstF)
+
+ #ChanEstR
+ chanEstR = 0
+ chanEstRField = pack('B',chanEstR)
+ def createChanEstR(self, myChanEstR=None):
+ if myChanEstR!=None:
+ self.chanEstR=myChanEstR
+ self.chanEstRField = pack('B',self.chanEstR)
+ print "chanEstR = "+hex(self.chanEstR)
+
+ #Bit Loading Estimates Forward
+ bleF = Ble()
+ bleFField=bleF.ble
+ def createBleF(self, myNum=None, myEndTime=None, myIntBle=None, myInterval=None):
+ print "bleF : "
+ self.createNum(myNum)
+ self.bleF.createBle(self.num, myEndTime, myIntBle, myInterval)
+ self.bleFField=self.bleF.ble
+
+ #Bit Loading Estimates Reverse
+ bleR = Ble()
+ bleRField=bleR.ble
+ def createBleR(self, myNum=None, myEndTime=None, myIntBle=None, myInterval=None):
+ print "bleR : "
+ self.createNum(myNum)
+ self.bleR.createBle(self.num, myEndTime, myIntBle, myInterval)
+ self.bleRField=self.bleR.ble
+
+ #Cause
+ cause = 0
+ causeField = pack('B',cause)
+ def createCause(self):
+ self.causeField = pack('B',self.cause)
+ print "cause = "+hex(self.cause)
+
+ #DCPPC
+ dcppc = 0
+ dcppcField = pack('B',dcppc)
+ def createDcppc(self, myDcppc=None):
+ if myDcppc!=None:
+ self.dcppc=myDcppc
+ self.dcppcField = pack('B',self.dcppc)
+ print "dcppc = "+hex(self.dcppc)
+
+ #Number of HomePlug 1.0.1 transmission detected
+ nhp10 = 0
+ nhp10Field = pack('H',nhp10)
+ def createNhp10(self, myNhp10=None):
+ if myNhp10!=None:
+ self.nhp10=myNhp10
+ self.nhp10Field = pack('H',self.nhp10)
+ print "nhp10 = "+hex(self.nhp10)
+
+ #Number of HomePlug 1.1 transmission detected
+ nhp11 = 0
+ nhp11Field = pack('H',nhp11)
+ def createNhp11(self, myNhp11=None):
+ if myNhp11!=None:
+ self.nhp11=myNhp11
+ self.nhp11Field = pack('H',self.nhp11)
+ print "nhp11 = "+hex(self.nhp11)
+
+ #Payload Encryption Key Select
+ peks = 0x0F #Not encripted by default
+ peksField = pack('B',peks)
+ def createPeks(self, myPeks=None):
+ try:
+ if myPeks!=None:
+ self.peks=myPeks
+ self.peksField = pack('B',self.peks)
+ except:
+ if myPeks!=None:
+ self.peksField=myPeks
+ self.peks = unpack('B',self.peksField[0])[0]
+ print "peks = "+hex(self.peks)
+
+ #AVLN Status
+ avlnStatus = 0
+ avlnStatusField = pack('B',avlnStatus)
+ def createAvlnStatus(self, myAvlnStatus=None):
+ try:
+ if myAvlnStatus!=None:
+ self.avlnStatus=myAvlnStatus
+ self.avlnStatusField = pack('B',self.avlnStatus)
+ except:
+ if myAvlnStatus!=None:
+ self.avlnStatusField=myAvlnStatus
+ self.avlnStatus = unpack('B',self.avlnStatusField[0])[0]
+ print "avlnStatus = "+hex(self.avlnStatus)
+
+ #Protocol ID
+ pid = 0
+ pidField = pack('B',pid)
+ def createPid(self, myPid=None):
+ try:
+ if myPid!=None:
+ self.pid=myPid
+ self.pidField = pack('B',self.pid)
+ except:
+ if myPid!=None:
+ self.pidField=myPid
+ self.pid = unpack('B',self.pidField[0])[0]
+ print "pid = "+hex(self.pid)
+
+ #Protocol Run Number
+ prn = randrange(0,pow(2,16)-1,1)
+ prnField = pack('H',prn)
+ def createPrn(self, myPrn=None):
+ try:
+ if myPrn!=None:
+ self.prn=myPrn
+ else:
+ self.prn=randrange(0,pow(2,16)-1,1)
+ self.prnField = pack('H',self.prn)
+ except:
+ if myPrn!=None:
+ self.prnField=myPrn
+ else:
+ self.prnField=pack('H',randrange(0,pow(2,16)-1,1))
+ self.prn = unpack('H',self.prnField[:2])[0]
+ print "prn = "+hex(self.prn)
+
+ #Protocol Message Number
+ pmn = 0
+ pmnField = pack('B',pmn)
+ def createPmn(self, myPmn=None, reset=False):
+ try:
+ if myPmn!=None:
+ self.pmn=myPmn
+ elif reset==True:
+ self.pmn=0
+ else:
+ self.pmn=self.pmn + 1
+ self.pmnField = pack('B',self.pmn)
+ except:
+ if myPmn!=None:
+ self.pmnField=myPmn
+ elif reset==True:
+ self.pmnField=pack('B',0)
+ else:
+ self.pmnField=pack('B',self.pmn + 1)
+ self.pmn = unpack('B',self.pmnField[0])[0]
+ print "pmn = "+hex(self.pmn)
+
+ #Key Type
+ keyType = 5 #No key by default
+ keyTypeField = pack('B',keyType)
+ def createKeyType(self, myKeyType=None):
+ try:
+ if myKeyType!=None:
+ self.keyType=myKeyType
+ self.keyTypeField = pack('B',self.keyType)
+ except:
+ if myKeyType!=None:
+ self.keyTypeField=myKeyType
+ self.keyType = unpack('B',self.keyTypeField[0])[0]
+ print "keyType = "+hex(self.keyType)
+
+ #My Nonce
+ myNonce = randrange(0,pow(2,32)-1,1)
+ myNonceField = pack('I',myNonce)
+ def createMyNonce(self, myMyNonce=None):
+ if myMyNonce!=None:
+ try:
+ self.myNonceField=myMyNonce
+ self.myNonce = unpack('I',self.myNonceField[:4])[0]
+ except:
+ self.myNonce=myMyNonce
+ self.myNonceField = pack('I',self.myNonce)
+ else:
+ self.myNonce=randrange(0,pow(2,32)-1,1)
+ self.myNonceField = pack('I',self.myNonce)
+ print "myNonce = "+hex(self.myNonce)
+
+ #Your Nonce
+ yourNonce = 0
+ yourNonceField = pack('I',yourNonce)
+ def createYourNonce(self, myYourNonce=None):
+ if myYourNonce!=None:
+ try:
+ self.yourNonceField=myYourNonce
+ self.yourNonce = unpack('I',self.yourNonceField[:4])[0]
+ except:
+ self.yourNonce=myYourNonce
+ self.yourNonceField = pack('I',self.yourNonce)
+ else:
+ self.yourNonceField = pack('I',self.yourNonce)
+ print "yourNonce = "+hex(self.yourNonce)
+
+ #New Encryption Key Select or Payload Encryption Key Select
+ newEks = 0x0F #Not encripted by default
+ newEksField = pack('B',newEks)
+ def createNewEks(self, myNewEks=None):
+ try:
+ if myNewEks!=None:
+ self.newEks=myNewEks
+ self.newEksField = pack('B',self.newEks)
+ except:
+ if myNewEks!=None:
+ self.newEksField=myNewEks
+ self.newEks = unpack('B',self.newEksField[0])[0]
+ print "newEks = "+hex(self.newEks)
+
+ #New Key
+ newKey = 0x4142434445464748494A4B4C4D4E4F50
+ newKeyField = pack('Q',newKey%pow_2_64)+pack('Q',newKey/pow_2_64)
+ def createNewKey(self, myNewKey=None):
+ try:
+ if myNewKey!=None:
+ self.newKey=myNewKey
+ self.newKeyField = pack('Q',self.newKey%pow_2_64)+pack('Q',self.newKey/pow_2_64)
+ except:
+ if myNewKey!=None:
+ self.newKeyField=myNewKey
+ self.newKey = unpack('QQ',self.newKeyField[:16])[0] + unpack('QQ',self.newKeyField[:16])[1]*pow_2_64
+ print "newKey = "+hex(self.newKey)
+
+ #Request Type
+ requestType = 0 #Direct by default
+ requestTypeField = pack('B',requestType)
+ def createRequestType(self, myRequestType=None):
+ try:
+ if myRequestType!=None:
+ self.requestType=myRequestType
+ self.requestTypeField = pack('B',self.requestType)
+ except:
+ if myRequestType!=None:
+ self.requestTypeField=myRequestType
+ self.requestType = unpack('B',self.requestTypeField[0])[0]
+ print "requestType = "+hex(self.requestType)
+
+ #Requested Key Type
+ requestedKeyType = 5 #No key by default
+ requestedKeyTypeField = pack('B',requestedKeyType)
+ def createRequestedKeyType(self, myRequestedKeyType=None):
+ try:
+ if myRequestedKeyType!=None:
+ self.requestedKeyType=myRequestedKeyType
+ self.requestedKeyTypeField = pack('B',self.requestedKeyType)
+ except:
+ if myRequestedKeyType!=None:
+ self.requestedKeyTypeField=myRequestedKeyType
+ self.requestedKeyType = unpack('B',self.requestedKeyTypeField[0])[0]
+ print "requestedKeyType = "+hex(self.requestedKeyType)
+
+ #HASH KEY
+ hashKey = []
+ i=0
+ hashKeyField = ""
+ while i<48:
+ hashKey.append(randrange(0,pow_2_64-1,1))
+ hashKeyField = hashKeyField + pack('Q',hashKey[i])
+ i=i+1
+ def createHashKey(self, myHashKey=None):
+ print "hashKeyField = "
+ if myHashKey!=None:
+ try:
+ self.hashKey=myHashKey
+ self.hashKeyField = ""
+ self.i=0
+ while self.i<48:
+ self.hashKeyField = self.hashKeyField + pack('Q',self.hashKey[self.i])
+ print hex(self.hashKey[self.i])
+ self.i=self.i+1
+ except:
+ self.hashKeyField=myHashKey
+ self.hashKey = []
+ self.i=0
+ while self.i<48*8:
+ self.hashKey.append(unpack('Q',self.hashKeyField[self.i:self.i+8])[0])
+ print hex(self.hashKey[int(self.i/8)])
+ self.i=self.i+8
+ else:
+ self.hashKeyField = ""
+ self.i=0
+ while self.i<48:
+ self.hashKey[self.i]=randrange(0,pow_2_64-1,1)
+ self.hashKeyField = self.hashKeyField + pack('Q',self.hashKey[self.i])
+ print hex(self.hashKey[self.i])
+ self.i=self.i+1
+
+ #Key
+ key = 0x4142434445464748494A4B4C4D4E4F50
+ keyField = pack('Q',newKey%pow_2_64)+pack('Q',newKey/pow_2_64)
+ def createKey(self, myKey=None):
+ try:
+ if myKey!=None:
+ self.key=myKey
+ self.keyField = pack('Q',self.key%pow_2_64)+pack('Q',self.key/pow_2_64)
+ except:
+ if myKey!=None:
+ self.keyField=myKey
+ self.key = unpack('QQ',self.keyField[:16])[0]+unpack('QQ',self.keyField[:16])[1]*pow_2_64
+ print "key = "+hex(self.key)
+
+ #Statuses and Capabilities : AVLN Status - CCo Capability - Proxy Network Capability - Backup CCo Capability - CCo Status - PCo Status - Backup CCo Status
+ avlnStatus = 0 #Not authenticated with an AVLN by default
+ ccoCapability = 0 #does not support QoS and TDMA by default
+ proxyNetworkCapability = 0 #STA does not support Proxy Networking by default
+ backupCcoCapability = 0 #STA does not support the Backup CCo function by default
+ ccoStatus = 0 #STA is not the CCo by default
+ pcoStatus = 0 #STA is not a PCo by default
+ backupCcoStatus = 0 #STA is not a Backup CCo by default
+ statusesNCapabilities = int(avlnStatus + ccoCapability*pow(2,1) + proxyNetworkCapability*pow(2,3) + backupCcoCapability*pow(2,4) + ccoStatus*pow(2,5) + pcoStatus*pow(2,6) + backupCcoStatus*pow(2,7))
+ statusesNCapabilitiesField = pack('B',statusesNCapabilities)
+ def createStatusesNCapabilities(self, myAvlnStatus=None, myCcoCapability=None, myProxyNetworkCapability=None, myBackupCcoCapability=None, myCcoStatus=None, myPcoStatus=None, myBackupCcoStatus=None, myStatusesNCapabilities=None):
+ if myAvlnStatus!=None:
+ self.avlnStatus=myAvlnStatus
+ if myCcoCapability!=None:
+ self.ccoCapability=myCcoCapability
+ if myProxyNetworkCapability!=None:
+ self.proxyNetworkCapability=myProxyNetworkCapability
+ if myBackupCcoCapability!=None:
+ self.backupCcoCapability=myBackupCcoCapability
+ if myCcoStatus!=None:
+ self.ccoStatus=myCcoStatus
+ if myPcoStatus!=None:
+ self.pcoStatus=myPcoStatus
+ if myBackupCcoStatus!=None:
+ self.backupCcoStatus=myBackupCcoStatus
+ if myStatusesNCapabilities!=None:
+ self.statusesNCapabilities=myStatusesNCapabilities
+ else:
+ self.statusesNCapabilities = int(self.avlnStatus + self.ccoCapability*pow(2,1) + self.proxyNetworkCapability*pow(2,3) + self.backupCcoCapability*pow(2,4) + self.ccoStatus*pow(2,5) + self.pcoStatus*pow(2,6) + self.backupCcoStatus*pow(2,7))
+ self.statusesNCapabilitiesField = pack('B',self.statusesNCapabilities)
+ print "statusesNCapabilitiesField = "+hex(self.statusesNCapabilitiesField)
+
+ #Encryption Key Select or Payload Encryption Key Select
+ eks = 0x0F #Not encripted by default
+ eksField = pack('B',eks)
+ def createEks(self, myEks=None):
+ try:
+ if myEks!=None:
+ self.eks=myEks
+ self.eksField = pack('B',self.eks)
+ except:
+ if myEks!=None:
+ self.eksField=myEks
+ self.eks = unpack('B',self.eksField[0])[0]
+ print "eks = "+hex(self.eks)
+
+ #Response Type
+ responseType = 0
+ responseTypeField = pack('B',responseType)
+ def createResponseType(self, myResponseType=None):
+ if myResponseType!=None:
+ self.responseType=myResponseType
+ self.responseTypeField = pack('B',self.responseType)
+ print "responseType = "+hex(self.responseType)
+
+ #Bridging Station Flag
+ bsf = 0x0F #Does not perform bridging functions by default
+ bsfField = pack('B',bsf)
+ def createBsf(self, myBsf=None):
+ if myBsf!=None:
+ self.bsf=myBsf
+ self.bsfField = pack('B',self.bsf)
+ print "bsf = "+hex(self.bsf)
+
+ #STEI of the Bridge
+ btei = 0
+ bteiField = pack('B',btei)
+ def createBtei(self, myBtei=None):
+ if myBtei!=None:
+ self.btei=myBtei
+ self.bteiField = pack('B',self.btei)
+ print "btei = "+hex(self.btei)
+
+ #Nbdaber of Bridged destinations
+ nbda = 255
+ nbdaField = pack('B',nbda)
+ def createNbda(self, myNbda=None):
+ if myNbda!=None:
+ self.nbda=myNbda
+ self.nbdaField = pack('B',self.nbda)
+ print "nbda = "+hex(self.nbda)
+
+ #Bridged Destination Addresses
+ bdas = []
+ bdasField = []
+ i = 0
+ while i < nbda:
+ bdas.append(i+0x414442000000)
+ bdasField.append(pack('Q',bdas[i])[0:6])
+ i=i+1
+ def createBdas(self, myNbda=None, myBda=None):
+ print "bdas : "
+ self.createNbda(myNbda)
+ self.i = 0
+ while self.i < self.nbda:
+ if myBda!=None:
+ self.bdas[self.i]=int((myBda+self.i)%pow(2,48))
+ self.bdasField[self.i]=pack('Q',self.bdas[self.i])[0:6]
+ print "bdas["+str(self.i)+"] = "+hex(self.bdas[self.i])
+ self.i = self.i + 1
+
+ #Classifier Rule Set :
+ # - Classifier Rule Set Version
+ # - Number of Classifier Rules
+ # - Classifier Rule Identifier - Classifier Rule Length - Classifier Rule -* Number of Classifier Rules-
+ classifierRuleSetVersion = 0 #Current version by default
+ classifierRuleSetVersionField = pack('B',classifierRuleSetVersion)
+ def createClassifierRuleSetVersion(self, myClassifierRuleSetVersion=None):
+ if myClassifierRuleSetVersion!=None:
+ self.classifierRuleSetVersion=myClassifierRuleSetVersion
+ self.classifierRuleSetVersionField = pack('B',self.classifierRuleSetVersion)
+ print "classifierRuleSetVersion = "+hex(self.classifierRuleSetVersion)
+ numberofClassifierRules = 255 #Max number by default
+ numberofClassifierRulesField = pack('B',numberofClassifierRules)
+ def createNumberofClassifierRules(self, myNumberofClassifierRules=None):
+ if myNumberofClassifierRules!=None:
+ self.numberofClassifierRules=myNumberofClassifierRules
+ self.numberofClassifierRulesField = pack('B',self.numberofClassifierRules)
+ print "numberofClassifierRules = "+hex(self.numberofClassifierRules)
+ classifierRuleIdentifiers = [] #Ethernet_Destination_Address_Identifier by default
+ classifierRuleLengths = [] #Ethernet_Destination_Address_Identifier Length by default
+ i=0
+ classifierRuleIdentifiersField = []
+ classifierRuleLengthsField = []
+ while i<numberofClassifierRules:
+ classifierRuleIdentifiers.append(Ethernet_Destination_Address_Identifier)
+ classifierRuleIdentifiersField.append(pack('B',classifierRuleIdentifiers[i]))
+ classifierRuleLengths.append(classifierRuleSize[classifierRuleIdentifiers[i]])
+ classifierRuleLengthsField.append(pack('B',classifierRuleLengths[i]))
+ i=i+1
+ def createClassifierRuleIdentifiersNLengths(self, myNumberofClassifierRules=None, myClassifierRuleIdentifier=None):
+ print "classifierRuleIdentifiers and classifierRuleLengths :"
+ self.createNumberofClassifierRules(myNumberofClassifierRules)
+ self.i = 0
+ while self.i < self.numberofClassifierRules:
+ if myClassifierRuleIdentifier!=None:
+ self.classifierRuleIdentifiers[self.i]=myClassifierRuleIdentifier
+ self.classifierRuleIdentifiersField[self.i]=pack('B',self.classifierRuleIdentifiers[self.i])
+ print "classifierRuleIdentifiers["+str(self.i)+"] = "+hex(self.classifierRuleIdentifiers[self.i])
+ self.classifierRuleLengths[self.i]=classifierRuleSize[self.classifierRuleIdentifiers[self.i]]
+ self.classifierRuleLengthsField[self.i]=pack('B',self.classifierRuleLengths[self.i])
+ print "classifierRuleLengths["+str(self.i)+"] = "+hex(self.classifierRuleLengths[self.i])
+ self.i = self.i + 1
+ classifierRules = [] #Ethernet_Destination_Address_Identifier Rule by default
+ i=0
+ classifierRulesField = []
+ while i<numberofClassifierRules:
+ classifierRules.append(0x644168744500+i)
+ if classifierRuleSize[classifierRuleIdentifiers[i]] <= 8:
+ classifierRulesField.append(pack('Q',classifierRules[i])[0:classifierRuleSize[classifierRuleIdentifiers[i]]])
+ elif classifierRuleSize[classifierRuleIdentifiers[i]] <= 16:
+ classifierRulesField.append(pack('Q',classifierRules[i]%pow_2_64)+pack('Q',classifierRules[i]/pow_2_64)[0:classifierRuleSize[classifierRuleIdentifiers[i]]-8])
+ i=i+1
+ def createClassifierRules(self, myClassifierRules=None):
+ self.i=0
+ while self.i<self.numberofClassifierRules:
+ if myClassifierRules!=None:
+ self.classifierRules[self.i]=myClassifierRules
+ if classifierRuleSize[self.classifierRuleIdentifiers[self.i]] <= 8:
+ self.classifierRulesField[self.i]=pack('Q',self.classifierRules[self.i])[0:classifierRuleSize[self.classifierRuleIdentifiers[self.i]]]
+ elif classifierRuleSize[self.classifierRuleIdentifiers[self.i]] <= 16:
+ self.classifierRulesField[self.i]=pack('Q',self.classifierRules[self.i]%pow_2_64)+pack('Q',self.classifierRules[self.i]/pow_2_64)[0:classifierRuleSize[self.classifierRuleIdentifiers[self.i]]-8]
+ print "classifierRules["+str(self.i)+"] = "+hex(self.classifierRules[self.i])
+ self.i=self.i+1
+ classifierRuleSetField = classifierRuleSetVersionField + numberofClassifierRulesField
+ i=0
+ while i<numberofClassifierRules:
+ classifierRuleSetField = classifierRuleSetField + classifierRuleIdentifiersField[i] + classifierRuleLengthsField[i] + classifierRulesField[i]
+ i=i+1
+ def createClassifierRuleSetField(self, myClassifierRuleSetVersion=None, myNumberofClassifierRules=None, myClassifierRuleIdentifier=None, myClassifierRules=None):
+ print "classifierRuleSetField :"
+ self.createClassifierRuleSetVersion(myClassifierRuleSetVersion)
+ self.createClassifierRuleIdentifiersNLengths(myNumberofClassifierRules, myClassifierRuleIdentifier)
+ self.createClassifierRules(myClassifierRules)
+ self.classifierRuleSetField = self.classifierRuleSetVersionField + self.numberofClassifierRulesField
+ self.i = 0
+ while self.i < self.numberofClassifierRules:
+ self.classifierRuleSetField = self.classifierRuleSetField + self.classifierRuleIdentifiersField[self.i] + self.classifierRuleLengthsField[self.i] + self.classifierRulesField[self.i]
+ self.i = self.i + 1
+
+ #Maximum FL_AV in multiples of 1.28µs
+ maxFL_AV = 0x0FFF #5241.6µs by default
+ maxFL_AVField = pack('H',maxFL_AV)
+ def createMaxFL_AV(self, myMaxFL_AV=None):
+ if myMaxFL_AV!=None:
+ self.maxFL_AV=myMaxFL_AV
+ self.maxFL_AVField = pack('H',self.maxFL_AV)
+ print "maxFL_AV = "+hex(self.maxFL_AV)
+
+ #Response Interframe Spacing for MPDUs with one OFDM Symbol
+ rifs_AV_OneSym = 0x18 #30.72µs by default
+ rifs_AV_OneSymField = pack('B',rifs_AV_OneSym)
+ def createRifs_AV_OneSym(self, myRifs_AV_OneSym=None):
+ if myRifs_AV_OneSym!=None:
+ self.rifs_AV_OneSym=myRifs_AV_OneSym
+ self.rifs_AV_OneSymField = pack('B',self.rifs_AV_OneSym)
+ print "rifs_AV_OneSym = "+hex(self.rifs_AV_OneSym)
+
+ #Response Interframe Spacing for MPDUs with two OFDM Symbols
+ rifs_AV_TwoSym = 0x18 #30.72µs by default
+ rifs_AV_TwoSymField = pack('B',rifs_AV_TwoSym)
+ def createRifs_AV_TwoSym(self, myRifs_AV_TwoSym=None):
+ if myRifs_AV_TwoSym!=None:
+ self.rifs_AV_TwoSym=myRifs_AV_TwoSym
+ self.rifs_AV_TwoSymField = pack('B',self.rifs_AV_TwoSym)
+ print "rifs_AV_TwoSym = "+hex(self.rifs_AV_TwoSym)
+
+ #Response Interframe Spacing for MPDUs with more than two OFDM Symbols
+ rifs_AV_G2Sym = 0x18 #30.72µs by default
+ rifs_AV_G2SymField = pack('B',rifs_AV_G2Sym)
+ def createRifs_AV_G2Sym(self, myRifs_AV_G2Sym=None):
+ if myRifs_AV_G2Sym!=None:
+ self.rifs_AV_G2Sym=myRifs_AV_G2Sym
+ self.rifs_AV_G2SymField = pack('B',self.rifs_AV_G2Sym)
+ print "rifs_AV_G2Sym = "+hex(self.rifs_AV_G2Sym)
+
+ #Response Type
+ respt = 0 #Default Tone Map by default
+ resptField = pack('B',respt)
+ def createRespt(self, myRespt=None):
+ if myRespt!=None:
+ self.respt=myRespt
+ self.resptField = pack('B',self.respt)
+ print "respt = "+hex(self.respt)
+
+ #Maximum number of Tone Map that the receiver can support
+ maxtm = 0x1F #31 Tone Map (equal to max possible) by default
+ maxtmField = pack('B',maxtm)
+ def createMaxtm(self, myMaxtm=None):
+ if myMaxtm!=None:
+ self.maxtm=myMaxtm
+ self.maxtmField = pack('B',self.maxtm)
+ print "maxtm = "+hex(self.maxtm)
+
+ #TMI_AV of the default Tone Map
+ cp_TMI_AV = 0 #MODE ROBO by default
+ cp_TMI_AVField = pack('B',cp_TMI_AV)
+ def createCp_TMI_AV(self, myCp_TMI_AV=None):
+ if myCp_TMI_AV!=None:
+ self.cp_TMI_AV=myCp_TMI_AV
+ self.cp_TMI_AVField = pack('B',self.cp_TMI_AV)
+ print "cp_TMI_AV = "+hex(self.cp_TMI_AV)
+
+ #Sound Control During Contention Period
+ scl_CP = 0 #Without adapted Tone Map by default
+ scl_CPField = pack('B',scl_CP)
+ def createScl_CP(self, myScl_CP=None):
+ if myScl_CP!=None:
+ self.scl_CP=myScl_CP
+ self.scl_CPField = pack('B',self.scl_CP)
+ print "scl_CP = "+hex(self.scl_CP)
+
+ #Sound Control During Contention Free Period
+ scl_CFP = 0 #Without adapted Tone Map by default
+ scl_CFPField = pack('B',scl_CFP)
+ def createScl_CFP(self, myScl_CFP=None):
+ if myScl_CFP!=None:
+ self.scl_CFP=myScl_CFP
+ self.scl_CFPField = pack('B',self.scl_CFP)
+ print "scl_CFP = "+hex(self.scl_CFP)
+
+ #Number of entries in the valid TMI_AV List
+ ntmi_AV = min(maxtm,MAX_TONE_MAPS) #Max 7 by default
+ ntmi_AVField = pack('B',ntmi_AV)
+ def createNtmi_AV(self, myNtmi_AV=None):
+ if myNtmi_AV!=None:
+ self.ntmi_AV=min(self.maxtm,MAX_TONE_MAPS,myNtmi_AV)
+ self.ntmi_AVField = pack('B',self.ntmi_AV)
+ print "ntmi_AV = "+hex(self.ntmi_AV)
+
+ #TMI_AV
+ tmi_AVs = []
+ tmi_AVsField = []
+ i = 0
+ while i < ntmi_AV:
+ tmi_AVs.append(0) #MODE ROBO by default
+ tmi_AVsField.append(pack('B',tmi_AVs[i]))
+ i=i+1
+ def createTmi_AV(self, myNtmi_AV=None, myTmi_AV=None):
+ print "tmi_AVs : "
+ self.createNtmi_AV(myNtmi_AV)
+ self.i = 0
+ while self.i < self.ntmi_AV:
+ if myTmi_AV!=None:
+ self.tmi_AVs[self.i]=myTmi_AV
+ self.tmi_AVsField[self.i]=pack('B',self.tmi_AVs[self.i])
+ print "tmi_AVs["+str(self.i)+"] = "+hex(self.tmi_AVs[self.i])
+ self.i = self.i + 1
+
+ #Number of Intervals
+ nint = 32 #Max 32 by default
+ nintField = pack('B',nint)
+ def createNint(self, myNint=None):
+ if myNint!=None:
+ self.nint=min(self.maxtm,MAX_TONE_MAPS,myNint)
+ self.nintField = pack('B',self.nint)
+ print "nint = "+hex(self.nint)
+
+ #End Time and TMI_AV of the AC Line
+ ets = []
+ etsField = []
+ int_TMI_AVs = []
+ int_TMI_AVsField = []
+ i = 0
+ ets.append(int(randrange(0,3906/(nint-i),1)))
+ i=i+1
+ while i < nint-1:
+ ets.append(int(randrange(ets[i-1],((3906-ets[i-1])/(nint-i))+ets[i-1],1))) #Random End Time by default
+ i=i+1
+ ets.append(3907)
+ i=i+1
+ i=0
+ while i < nint:
+ etsField.append(pack('H',ets[i]))
+ i=i+1
+ i=0
+ while i < nint:
+ int_TMI_AVs.append(randrange(0,maxtm,1)) #Random MODE by default
+ int_TMI_AVsField.append(pack('B',int_TMI_AVs[i]))
+ i=i+1
+
+ def createEtNInt_TMI_AV(self, myNint=None, myRandomEt=False, myInt_TMI_AV=None, myRandomInt_TMI_AV=False):
+ self.createNint(myNint)
+ print "ets : "
+ if myRandomEt==True:
+ self.i=0
+ self.ets[self.i]=int(randrange(0,3906/(self.nint-self.i),1))
+ self.i=self.i+1
+ while self.i < self.nint-1:
+ self.ets[self.i]=int(randrange(self.ets[self.i-1],((3906-self.ets[self.i-1])/(self.nint-self.i))+self.ets[self.i-1],1)) #Random End Time by default
+ self.i=self.i+1
+ self.ets[self.i]=3907
+ self.i=self.i+1
+ self.i=0
+ while self.i < self.nint:
+ self.etsField[self.i]=pack('H',self.ets[self.i])
+ print "ets["+str(self.i)+"] = "+hex(self.ets[self.i])
+ self.i=self.i+1
+ print "int_TMI_AVs : "
+ self.i=0
+ while self.i < self.nint:
+ if myInt_TMI_AV!=None:
+ self.int_TMI_AVs[self.i]=min(0x1F,myInt_TMI_AV)
+ elif myRandomInt_TMI_AV==True:
+ self.int_TMI_AVs[self.i]=randrange(0,self.maxtm,1) #Random MODE by default
+ self.int_TMI_AVsField[self.i]=pack('B',self.int_TMI_AVs[self.i])
+ print "int_TMI_AVs["+str(self.i)+"] = "+hex(self.int_TMI_AVs[self.i])
+ self.i=self.i+1
+
+ #TMI_AV of the attached Tone Map
+ newTMI_AV = 0 #MODE ROBO by default
+ newTMI_AVField = pack('B',newTMI_AV)
+ def createNewTMI_AV(self, myNewTMI_AV=None):
+ if myNewTMI_AV!=None:
+ self.newTMI_AV=myNewTMI_AV
+ self.newTMI_AVField = pack('B',self.newTMI_AV)
+ print "newTMI_AV = "+hex(self.newTMI_AV)
+
+ #CP Flag for the new Tone Map
+ cpf = 0 #Shall not be applied by default
+ cpfField = pack('B',cpf)
+ def createCpf(self, myCpf=None):
+ if myCpf!=None:
+ self.cpf=myCpf
+ self.cpfField = pack('B',self.cpf)
+ print "cpf = "+hex(self.cpf)
+
+ #FEC Type/Code Rate
+ fecType = 0 #1/2 rate Turbo Convolution Encoder by default
+ fecTypeField = pack('B',fecType)
+ def createFecType(self, myFecType=None):
+ if myFecType!=None:
+ self.fecType=myFecType
+ self.fecTypeField = pack('B',self.fecType)
+ print "fecType = "+hex(self.fecType)
+
+ #Guard Interval Length
+ gil = 0 #GI 417 by default
+ gilField = pack('B',gil)
+ def createGil(self, myGil=None):
+ if myGil!=None:
+ self.gil=myGil
+ self.gilField = pack('B',self.gil)
+ print "gil = "+hex(self.gil)
+
+ #Carrier Bit Loading Data Encoding
+ cbd_Enc = 0 #Carrier Bit Loading Data With Binary Encoding by default
+ cbd_EncField = pack('B',cbd_Enc)
+ def createCbd_Enc(self, myCbd_Enc=None):
+ if myCbd_Enc!=None:
+ self.cbd_Enc=myCbd_Enc
+ self.cbd_EncField = pack('B',self.cbd_Enc)
+ print "cbd_Enc = "+hex(self.cbd_Enc)
+
+ #Number of Carrier Bit Loading Data Entries
+ cbd_Len = 1155 #Maximum Number of carrier by default
+ cbd_LenField = pack('H',cbd_Len)
+ def createCbd_Len(self, myCbd_Len=None):
+ if myCbd_Len!=None:
+ self.cbd_Len=myCbd_Len
+ self.cbd_LenField = pack('H',self.cbd_Len)
+ print "cbd_Len = "+hex(self.cbd_Len)
+
+ #Carrier Bit Loading Data
+ cbds = []
+ cbdsField = []
+ i = 0
+ while i < cbd_Len:
+ cbds.append(1) #BPSK by default
+ i=i+1
+ cbds.append(0) #PAD (in case cbd_Len is an odd number)
+ i = 0
+ while i < cbd_Len + (cbd_Len % 2):
+ cbdsField.append(pack('B',cbds[i] + cbds[i+1]*pow(2,4)))
+ i=i+2
+ def createCbd(self, myCbd_Len=None, myCbd=None):
+ self.createCbd_Len(myCbd_Len)
+ print "cbds : "
+ if myCbd!=None:
+ self.i = 0
+ while self.i < self.cbd_Len + (self.cbd_Len % 2):
+ self.cbds[self.i]=myCbd
+ self.cbds[self.i+1]=myCbd
+ self.i=self.i+2
+ self.cbds[self.cbd_Len]=0
+ self.i = 0
+ while self.i < self.cbd_Len + (self.cbd_Len % 2):
+ self.cbdsField[self.i/2] = pack('B',self.cbds[self.i]+(self.cbds[self.i+1]*pow(2,4)))
+ print "cbds["+str(self.i)+"] = "+hex(self.cbds[self.i])
+ print "cbds["+str(self.i+1)+"] = "+hex(self.cbds[self.i+1])
+ self.i = self.i + 2
+
+ #TMI_AV of the Tone Map to update
+ oldTMI_AV = 0 #MODE ROBO by default
+ oldTMI_AVField = pack('B',oldTMI_AV)
+ def createOldTMI_AV(self, myOldTMI_AV=None):
+ if myOldTMI_AV!=None:
+ self.oldTMI_AV=myOldTMI_AV
+ self.oldTMI_AVField = pack('B',self.oldTMI_AV)
+ print "oldTMI_AV = "+hex(self.oldTMI_AV)
+
+ #Number of Carrier Bit Loading Update Data Entries
+ cbud_Len = 1155 #Maximum Number of carrier by default
+ cbud_LenField = pack('H',cbud_Len)
+ def createCbud_Len(self, myCbud_Len=None):
+ if myCbud_Len!=None:
+ self.cbud_Len=myCbud_Len
+ self.cbud_LenField = pack('H',self.cbud_Len)
+ print "cbud_Len = "+hex(self.cbud_Len)
+
+ #Carrier Bit Loading Update Data
+ cbuds = []
+ cbudsIndex = []
+ cbudsModulation = []
+ cbudsField = []
+ i = 0
+ while i < cbud_Len:
+ cbudsIndex.append(i)
+ cbudsModulation.append(1) #BPSK by default
+ cbuds.append(cbudsIndex[i]+cbudsModulation[i]*pow(2,12))
+ cbudsField.append(pack('H',cbuds[i]))
+ i=i+1
+ def createCbud(self, myCbud_Len=None, myCbudModulation=None):
+ self.createCbud_Len(myCbud_Len)
+ print "cbuds : "
+ if myCbudModulation!=None:
+ self.i = 0
+ while self.i < self.cbud_Len:
+ self.cbudsModulation[self.i]=myCbudModulation
+ self.i=self.i+1
+ self.i = 0
+ while self.i < self.cbud_Len:
+ self.cbuds[self.i] = int(self.cbudsIndex[self.i]+self.cbudsModulation[self.i]*pow(2,12))
+ self.cbudsField[self.i] = pack('H',self.cbuds[self.i])
+ print "cbuds["+str(self.i)+"] = "+hex(self.cbuds[self.i])
+ self.i = self.i + 1
+
+ #AES Encryption Initialization Vector
+ iv = randrange(0,pow(2,128)-1,1) #Random by default
+ ivField = pack('Q',iv%pow_2_64)+pack('Q',iv/pow_2_64)
+ def createIv(self, myIv=None, myRandomIv=False):
+ try:
+ if myIv!=None:
+ self.iv=myIv
+ elif myRandomIv==True :
+ self.iv=randrange(0,pow(2,16*8)-1,1)
+ self.ivField = pack('Q',self.iv%pow_2_64)+pack('Q',self.iv/pow_2_64)
+ except:
+ if myIv!=None:
+ self.ivField=myIv
+ self.iv = unpack('QQ',self.ivField[:16])[0]+unpack('QQ',self.ivField[:16])[1]*pow_2_64
+ print "iv = "+hex(self.iv)
+
+ #Universaly Unique Identifier
+ uuid = randrange(0,pow(2,16*8)-1,1) #Random by default
+ uuidField = pack('Q',uuid%pow_2_64)+pack('Q',uuid/pow_2_64)
+ def createUuid(self, myUuid=None, myRandomUuid=False):
+ try:
+ if myUuid!=None:
+ self.uuid=myUuid
+ elif myRandomUuid==True :
+ self.uuid=randrange(0,pow(2,16*8)-1,1)
+ self.uuidField = pack('Q',self.uuid%pow_2_64)+pack('Q',self.uuid/pow_2_64)
+ except:
+ if myUuid!=None:
+ self.uuidField=myUuid
+ elif myRandomUuid==True :
+ self.uuidFied = pack('Q',randrange(0,pow(2,8*8)-1,1))+pack('Q',randrange(0,pow(2,8*8)-1,1))
+ randrange(0,pow(2,16*8)-1,1)
+ self.uuid = unpack('QQ',self.uuidField[:16])[0] + unpack('QQ',self.uuidField[:16])[1]*pow_2_64
+ #int(unpack('QQ',self.uuidField)[0]+unpack('QQ',self.uuidField)[1]*pow(2,8*8))
+ print "uuid = "+hex(self.uuid)
+
+ #Length of the Random Filler
+ rfLenEncrypted = 1
+ rfLenEncryptedField = pack('B',rfLenEncrypted)
+ def createRfLenEncrypted(self, myRfLenEncrypted=None):
+ try:
+ if myRfLenEncrypted!=None:
+ self.rfLenEncrypted = myRfLenEncrypted
+ else:
+ self.rfLenEncrypted = randrange(0,15,1)
+ self.rfLenEncryptedField = pack('B',self.rfLenEncrypted)
+ except:
+ if myRfLenEncrypted!=None:
+ self.rfLenEncryptedField = myRfLenEncrypted
+ self.rfLenEncrypted = unpack('B',self.rfLenEncrypted[0])[0]
+ print "rfLenEncrypted = "+hex(self.rfLenEncrypted)
+
+ #Encrypted Random Filler
+ randomFillerEncrypted = 0x41
+ randomFillerEncryptedField = ""
+ def createRandomFillerEncrypted(self, myRfLenEncrypted=None, myRandomFillerEncrypted=None):
+ self.createRfLenEncrypted(myRfLenEncrypted)
+ try:
+ if myRandomFillerEncrypted!=None:
+ self.randomFillerEncrypted=myRandomFillerEncrypted
+ elif self.rfLenEncrypted != 0:
+ self.randomFillerEncrypted=randrange(0,pow(2,self.rfLenEncrypted*8)-1,1)
+ if self.rfLenEncrypted == 0:
+ self.randomFillerEncryptedField = ""
+ self.randomFillerEncrypted=None
+ print "randomFillerEncrypted = None"
+ elif self.rfLenEncrypted <= 8:
+ self.randomFillerEncryptedField=pack('Q',self.randomFillerEncrypted)[0:self.rfLenEncrypted]
+ print "randomFillerEncrypted = "+hex(self.randomFillerEncrypted)
+ elif self.rfLenEncrypted <= 15:
+ self.randomFillerEncryptedField=pack('Q',self.randomFillerEncrypted%pow_2_64)+pack('Q',self.randomFillerEncrypted/pow_2_64)[0:self.rfLenEncrypted-8]
+ print "randomFillerEncrypted = "+hex(self.randomFillerEncrypted)
+ except:
+ if myRandomFillerEncrypted!=None:
+ self.randomFillerEncryptedField=myRandomFillerEncrypted
+ if self.rfLenEncrypted == 0:
+ self.randomFillerEncrypted = None
+ print "randomFillerEncrypted = None"
+ elif self.rfLenEncrypted <= 8:
+ self.randomFillerEncrypted=unpack('QQ',self.randomFillerEncryptedField[:self.rfLenEncrypted]+"\x00"*(16-self.rfLenEncrypted))[0]
+ print "randomFillerEncrypted = "+hex(self.randomFillerEncrypted)
+ elif self.rfLenEncrypted <= 15:
+ self.randomFillerEncrypted = unpack('QQ',self.randomFillerEncryptedField[:self.rfLenEncrypted]+"\x00"*(16-self.rfLenEncrypted))[0]+unpack('QQ',self.randomFillerEncryptedField[:self.rfLenEncrypted]+"\x00"*(16-self.rfLenEncrypted))[1]*pow_2_64
+ print "randomFillerEncrypted = "+hex(self.randomFillerEncrypted)
+
+ #Encrypted MM or HLE Payload
+ mmOrHlePayloadEncryptedField = ""
+ def createMmOrHlePayloadEncrypted(self, myPid=None, myOda=None, myOsa=None, myVlanTag=None, myMtype=None, myMmv=None, myMmtype=None, myNfmi=None, myFnMi=None, myFmsn=None, myMmentry=None, myEncapsulatedMmEntry=None, myMmOrHlePayloadEncrypted=None):
+ if myMmentry==None:
+ myMmentry = self.mmentry
+ if myMtype==None:
+ myMtype = self.mmtype
+ if myPid==4:
+ self.mmOrHlePayloadEncryptedField = myMmOrHlePayloadEncrypted
+ else:
+ self.mmOrHlePayloadEncryptedField = myEncapsulatedMme.createEncapsulatedMmEntry(myOda, myOsa, myVlanTag, myMtype, myMmv, myMmtype, myNfmi, myFnMi, myFmsn, myMmentry, myEncapsulatedMmEntry)
+ #print "mmOrHlePayloadEncrypted = "+self.mmOrHlePayloadEncryptedField
+
+ #Length of Encrypted MM or HLE Payload
+ lengthForEncryption = len(mmOrHlePayloadEncryptedField)
+ lengthForEncryptionField = pack('H',lengthForEncryption)
+ def createLengthForEncryption(self, myLengthForEncryption=None):
+ if myLengthForEncryption!=None:
+ try:
+ self.lengthForEncryption = myLengthForEncryption
+ self.lengthForEncryptionField = pack('H',self.lengthForEncryption)
+ except:
+ self.lengthForEncryptionField = myLengthForEncryption
+ self.lengthForEncryption = unpack('H',self.lengthForEncryptionField[:2])[0]
+ else:
+ self.lengthForEncryption = len(self.mmOrHlePayloadEncryptedField)
+ self.lengthForEncryptionField = pack('H',self.lengthForEncryption)
+ print "lengthForEncryption = "+hex(self.lengthForEncryption)
+
+ #Encrypted CRC of the MM or HLE Payload
+ crcEncrypted = 0x41424344
+ crcEncryptedField = pack('I',crcEncrypted)
+ def createCrcEncrypted(self, myCrcEncrypted=None):
+ if myCrcEncrypted!=None:
+ try:
+ self.crcEncryptedField = myCrcEncrypted
+ self.crcEncrypted = unpack('I',self.crcEncryptedField[:4])[0]
+ except:
+ self.crcEncrypted = myCrcEncrypted
+ self.crcEncryptedField = pack('I',self.crcEncrypted)
+ else:
+ self.crcEncrypted = unpack('I',pack('i',crc32(self.mmOrHlePayloadEncryptedField)))[0]
+ self.crcEncryptedField = pack('I',self.crcEncrypted)
+ print "crcEncrypted = "+hex(self.crcEncrypted)
+
+ #Encrypted PRN
+ prnEncrypted = 0x4142
+ prnEncryptedField = pack('H',prnEncrypted)
+ def createPrnEncrypted(self, myPrnEncrypted=None, myRandomPrn=None):
+ if myPrnEncrypted!=None:
+ try:
+ self.prnEncrypted = myPrnEncrypted
+ self.prnEncryptedField = pack('H',self.prnEncrypted)
+ except:
+ self.prnEncryptedField = myPrnEncrypted
+ self.prnEncrypted = unpack('H',self.prnEncryptedField[:2])[0]
+ elif myRandomPrn == True:
+ self.prnEncrypted = randrange(0,pow(2,16)-1,1)
+ self.prnEncryptedField = pack('H',self.prnEncrypted)
+ else:
+ self.prnEncryptedField = pack('H',self.prnEncrypted)
+ print "prnEncrypted = "+hex(self.prnEncrypted)
+
+ #Encrypted PMN
+ pmnEncrypted = 0x00
+ pmnEncryptedField = pack('B',pmnEncrypted)
+ def createPmnEncrypted(self, myPmnEncrypted=None):
+ if myPmnEncrypted!=None:
+ try:
+ self.pmnEncryptedField = myPmnEncrypted
+ self.pmnEncrypted = unpack('B',self.pmnEncryptedField[0])[0]
+ except:
+ self.pmnEncrypted = myPmnEncrypted
+ self.pmnEncryptedField = pack('B',self.pmnEncrypted)
+ else:
+ self.pmnEncryptedField = pack('B',self.pmnEncrypted)
+ print "pmnEncrypted = "+hex(self.pmnEncrypted)
+
+ #Encrypted Padding
+ paddingEncrypted = 0
+ paddingEncryptedSize = (16 - (len(randomFillerEncryptedField + mmOrHlePayloadEncryptedField + crcEncryptedField + pidField + prnEncryptedField + pmnEncryptedField + rfLenEncryptedField)%16))%16
+ if paddingEncryptedSize <= 8:
+ paddingEncryptedField=pack('Q',paddingEncrypted)[0:paddingEncryptedSize]
+ elif paddingEncryptedSize <= 15:
+ paddingEncryptedField = pack('Q',paddingEncrypted%pow_2_64) + pack('Q',paddingEncrypted/pow_2_64)[0:paddingEncryptedSize-8]
+ def createPaddingEncrypted(self, myPaddingEncrypted=None):
+ self.paddingEncryptedSize = (16 - (len(self.randomFillerEncryptedField + self.mmOrHlePayloadEncryptedField + self.crcEncryptedField + self.pidField + self.prnEncryptedField + self.pmnEncryptedField + self.rfLenEncryptedField)%16))%16
+ if myPaddingEncrypted!=None:
+ try:
+ self.paddingEncryptedSize = len(myPaddingEncrypted)
+ self.paddingEncryptedField = myPaddingEncrypted
+ if self.paddingEncryptedSize == 0:
+ self.paddingEncrypted=None
+ elif self.paddingEncryptedSize <= 8:
+ self.paddingEncrypted=unpack('QQ',self.paddingEncryptedField[:len(self.paddingEncryptedField)]+"\x00"*(16-len(self.paddingEncryptedField)))[0]
+ elif self.paddingEncryptedSize <= 15:
+ self.paddingEncrypted = unpack('QQ',self.paddingEncryptedField[:len(self.paddingEncryptedField)]+"\x00"*(16-len(self.paddingEncryptedField)))[0] + unpack('QQ',self.paddingEncryptedField[:len(self.paddingEncryptedField)]+"\x00"*(16-len(self.paddingEncryptedField)))[1] * pow_2_64
+ except:
+ self.paddingEncrypted = myPaddingEncrypted
+ self.paddingEncryptedField=""
+ while myPaddingEncrypted > 0:
+ self.paddingEncryptedField = self.paddingEncryptedField + pack('B',myPaddingEncrypted%256)
+ myPaddingEncrypted = int(myPaddingEncrypted / 256)
+ self.paddingEncryptedSize = len(self.paddingEncryptedField)
+ elif self.paddingEncryptedSize != 0:
+ self.paddingEncrypted = randrange(0,pow(2,self.paddingEncryptedSize*8)-1,1)
+ if self.paddingEncryptedSize == 0:
+ self.paddingEncryptedField=""
+ print "paddingEncrypted = None"
+ elif self.paddingEncryptedSize <= 8:
+ self.paddingEncryptedField=pack('Q',self.paddingEncrypted)[0:self.paddingEncryptedSize]
+ print "paddingEncrypted = "+hex(self.paddingEncrypted)
+ elif self.paddingEncryptedSize <= 15:
+ self.paddingEncryptedField = pack('Q',self.paddingEncrypted%pow_2_64) + pack('Q',self.paddingEncrypted/pow_2_64)[0:self.paddingEncryptedSize-8]
+ print "paddingEncrypted = "+hex(self.paddingEncrypted)
+
+ #Reason Code
+ reasonCode = 0 #MME not supported by default
+ reasonCodeField = pack('B',reasonCode)
+ def createReasonCode(self, myReasonCode=None):
+ if myReasonCode!=None:
+ try:
+ self.reasonCode=myReasonCode
+ self.reasonCodeField = pack('B',self.reasonCode)
+ except:
+ self.reasonCodeField=myReasonCode
+ self.reasonCode = unpack('B',self.reasonCodeField[0])[0]
+ print "reasonCode = "+hex(self.reasonCode)
+
+ #Management Message Version of the received MME
+ rx_MMV = 0 #1.0 by default
+ rx_MMVField = pack('B',rx_MMV)
+ def createRx_MMV(self, myRx_MMV=None):
+ if myRx_MMV!=None:
+ try:
+ self.rx_MMV=myRx_MMV
+ self.rx_MMVField = pack('B',self.rx_MMV)
+ except:
+ self.rx_MMVField=myRx_MMV
+ self.rx_MMV = unpack('B',self.rx_MMVField[0])[0]
+ print "rx_MMV = "+hex(self.rx_MMV)
+
+ #Management Message Type of the received MME
+ rx_MMTYPE = 0 #1.0 by default
+ rx_MMTYPEField = pack('H',rx_MMTYPE)
+ def createRx_MMTYPE(self, myRx_MMTYPE=None):
+ if myRx_MMTYPE!=None:
+ try:
+ self.rx_MMTYPE=myRx_MMTYPE
+ self.rx_MMTYPEField = pack('H',self.rx_MMTYPE)
+ except:
+ self.rx_MMTYPEField=myRx_MMTYPE
+ self.rx_MMTYPE = unpack('H',self.rx_MMTYPEField[:2])[0]
+ print "rx_MMTYPE = "+hex(self.rx_MMTYPE)
+
+ #Byte offset of first or only invalid field in MME
+ invalidByteOffset = 0 #First octet by default
+ invalidByteOffsetField = pack('H',invalidByteOffset)
+ def createInvalidByteOffset(self, myInvalidByteOffset=None):
+ if myInvalidByteOffset!=None:
+ try:
+ self.invalidByteOffset=myInvalidByteOffset
+ self.invalidByteOffsetField = pack('H',self.invalidByteOffset)
+ except:
+ self.invalidByteOffsetField=myInvalidByteOffset
+ self.invalidByteOffset = unpack('H',self.invalidByteOffsetField[:2])[0]
+ print "invalidByteOffset = "+hex(self.invalidByteOffset)
+
+ #LLID-R
+ llidR = 0
+ llidRField = pack('B',llidR)
+ def createLlidR(self, myLlidR=None):
+ if myLlidR!=None:
+ self.llidR=myLlidR
+ self.llidFieldR = pack('B',self.llidR)
+ print "llidR = "+hex(self.llidR)
+
+ #Number of connection
+ numConn = 255
+ numConnField = pack('B',numConn)
+ def createNumConn(self, myNumConn=None):
+ if myNumConn!=None:
+ self.numConn=myNumConn
+ self.numConnField = pack('B',self.numConn)
+ print "numConn = "+hex(self.numConn)
+
+ #Connection Informations
+ connInfos = []
+ i = 0
+ while i < numConn:
+ connInfos.append(ConnInfo())
+ i=i+1
+ def createConnInfos(self, myNumConn=None, myTei=None, myLlidF=None, myStei=None, myDtei=None, myLidF=None, myLidR=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ self.createNumConn(myNumConn)
+ self.i = 0
+ while self.i < self.numConn:
+ print "connInfos["+str(self.i)+"] :"
+ self.connInfos[self.i].createConnInfo(myTei, myLlidF, myStei, myDtei, myLidF, myLidR, myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.i = self.i + 1
+
+ #HomePlug AV Version
+ avVersion = 0 #Current and only version by default
+ avVersionField = pack('B',avVersion)
+ def createAvVersion(self, myAvVersion=None):
+ if myAvVersion!=None:
+ self.avVersion=myAvVersion
+ self.avVersionField = pack('B',self.avVersion)
+ print "avVersion = "+hex(self.avVersion)
+
+ #Organizationnaly Unique Identifier
+ oui = 0x49554F
+ ouiField = pack('I',oui)[0:3]
+ def createOui(self, myOui=None):
+ if myOui!=None:
+ self.oui = myOui
+ self.ouiField = pack('I',self.oui)[0:3]
+ print "oui = "+hex(self.oui)
+
+ #Auto Connect Capability
+ autoConnect = 0 #Not supported by default
+ autoConnectField = pack('B',autoConnect)
+ def createAutoConnect(self, myAutoConnect=None):
+ if myAutoConnect!=None:
+ self.autoConnect=myAutoConnect
+ self.autoConnectField = pack('B',self.autoConnect)
+ print "autoConnect = "+hex(self.autoConnect)
+
+ #Smoothing Capability
+ smoothing = 0 #Not supported by default
+ smoothingField = pack('B',smoothing)
+ def createSmoothing(self, mySmoothing=None):
+ if mySmoothing!=None:
+ self.smoothing=mySmoothing
+ self.smoothingField = pack('B',self.smoothing)
+ print "smoothing = "+hex(self.smoothing)
+
+ #Proxy Capability
+ proxyCapable = 0 #Not capable by default
+ proxyCapableField = pack('B',proxyCapable)
+ def createProxyCapable(self, myProxyCapable=None):
+ if myProxyCapable!=None:
+ self.proxyCapable=myProxyCapable
+ self.proxyCapableField = pack('B',self.proxyCapable)
+ print "proxyCapable = "+hex(self.proxyCapable)
+
+ #Backup CCo-capable
+ backupCcoCapable = 0 #Not supported by default
+ backupCcoCapableField = pack('B',backupCcoCapable)
+ def createBackupCcoCapable(self, myBackupCcoCapable=None):
+ if myBackupCcoCapable!=None:
+ self.backupCcoCapable=myBackupCcoCapable
+ self.backupCcoCapableField = pack('B',self.backupCcoCapable)
+ print "backupCcoCapable = "+hex(self.backupCcoCapable)
+
+ #Soft Hand Over Support
+ softHandOver = 0 #Not supported by default
+ softHandOverField = pack('B',softHandOver)
+ def createSoftHandOver(self, mySoftHandOver=None):
+ if mySoftHandOver!=None:
+ self.softHandOver=mySoftHandOver
+ self.softHandOverField = pack('B',self.softHandOver)
+ print "softHandOver = "+hex(self.softHandOver)
+
+ #Two Symbol Frame Control
+ twoSymFc = 0 #Not supported by default
+ twoSymFcField = pack('B',twoSymFc)
+ def createTwoSymFc(self, myTwoSymFc=None):
+ if myTwoSymFc!=None:
+ self.twoSymFc=myTwoSymFc
+ self.twoSymFcField = pack('B',self.twoSymFc)
+ print "twoSymFc = "+hex(self.twoSymFc)
+
+ #Ability to support Enhanced Coexistance with HomePlug 1.1
+ homePlug11Cap = 0 #Not capable by default
+ homePlug11CapField = pack('B',homePlug11Cap)
+ def createHomePlug11Cap(self, myHomePlug11Cap=None):
+ if myHomePlug11Cap!=None:
+ self.homePlug11Cap=myHomePlug11Cap
+ self.homePlug11CapField = pack('B',self.homePlug11Cap)
+ print "homePlug11Cap = "+hex(self.homePlug11Cap)
+
+ #HomePlug 1.0.1 Interoperability
+ homePlug10Interop = 0 #Not capable by default
+ homePlug10InteropField = pack('B',homePlug10Interop)
+ def createHomePlug10Interop(self, myHomePlug10Interop=None):
+ if myHomePlug10Interop!=None:
+ self.homePlug10Interop=myHomePlug10Interop
+ self.homePlug10InteropField = pack('B',self.homePlug10Interop)
+ print "homePlug10Interop = "+hex(self.homePlug10Interop)
+
+ #Capability of Operating in Various Regulatory Domains
+ regulatoryCap = 0 #North America Only
+ regulatoryCapField = pack('B',regulatoryCap)
+ def createRegulatoryCap(self, myRegulatoryCap=None):
+ if myRegulatoryCap!=None:
+ self.regulatoryCap=myRegulatoryCap
+ self.regulatoryCapField = pack('B',self.regulatoryCap)
+ print "regulatoryCap = "+hex(self.regulatoryCap)
+
+ #Bidirectional Bursting Capability
+ bidirectionalBursting = 0 #Not capable by default
+ bidirectionalBurstingField = pack('B',bidirectionalBursting)
+ def createBidirectionalBursting(self, myBidirectionalBursting=None):
+ if myBidirectionalBursting!=None:
+ self.bidirectionalBursting=myBidirectionalBursting
+ self.bidirectionalBurstingField = pack('B',self.bidirectionalBursting)
+ print "bidirectionalBursting = "+hex(self.bidirectionalBursting)
+
+ #Implementation Version
+ implementationVer = 0 #0 by default
+ implementationVerField = pack('H',implementationVer)
+ def createImplementationVer(self, myImplementationVer=None):
+ if myImplementationVer!=None:
+ self.implementationVer=myImplementationVer
+ self.implementationVerField = pack('H',self.implementationVer)
+ print "implementationVer = "+hex(self.implementationVer)
+
+ #MAC Addresse of the STAs
+ das = []
+ dasField = []
+ i = 0
+ while i < numSta:
+ das.append(i+0x123456789000)
+ dasField.append(pack('Q',das[i])[0:6])
+ i=i+1
+ def createDas(self, myNumSta=None, myDa=None):
+ print "das : "
+ self.createNumSta(myNumSta)
+ self.i = 0
+ while self.i < self.numSta:
+ if myDa!=None:
+ self.das[self.i]=int((myDa+self.i)%pow(2,48))
+ self.dasField[self.i]=pack('Q',self.das[self.i])[0:6]
+ print "das["+str(self.i)+"] = "+hex(self.das[self.i])
+ self.i = self.i + 1
+
+ #Average PHY Data Rate Transmission
+ avgPhyDR_Tx = []
+ avgPhyDR_TxField = []
+ i = 0
+ while i < numSta:
+ avgPhyDR_Tx.append(255-i)
+ avgPhyDR_TxField.append(pack('B',avgPhyDR_Tx[i]))
+ i=i+1
+ def createAvgPhyDR_Tx(self, myNumSta=None, myAvgPhyDR_Tx=None):
+ print "avgPhyDR_Tx : "
+ self.createNumSta(myNumSta)
+ self.i = 0
+ while self.i < self.numSta:
+ if myAvgPhyDR_Tx!=None:
+ self.avgPhyDR_Tx[self.i]=int((myAvgPhyDR_Tx+self.i)%pow(2,48))
+ self.avgPhyDR_TxField[self.i]=pack('B',self.avgPhyDR_Tx[self.i])
+ print "avgPhyDR_Tx["+str(self.i)+"] = "+hex(self.avgPhyDR_Tx[self.i])
+ self.i = self.i + 1
+
+ #Average PHY Data Rate Reception
+ avgPhyDR_Rx = []
+ avgPhyDR_RxField = []
+ i = 0
+ while i < numSta:
+ avgPhyDR_Rx.append(i)
+ avgPhyDR_RxField.append(pack('B',avgPhyDR_Rx[i]))
+ i=i+1
+ def createAvgPhyDR_Rx(self, myNumSta=None, myAvgPhyDR_Rx=None):
+ print "avgPhyDR_Rx : "
+ self.createNumSta(myNumSta)
+ self.i = 0
+ while self.i < self.numSta:
+ if myAvgPhyDR_Rx!=None:
+ self.avgPhyDR_Rx[self.i]=int((myAvgPhyDR_Rx+self.i)%pow(2,48))
+ self.avgPhyDR_RxField[self.i]=pack('B',self.avgPhyDR_Rx[self.i])
+ print "avgPhyDR_Rx["+str(self.i)+"] = "+hex(self.avgPhyDR_Rx[self.i])
+ self.i = self.i + 1
+
+ #das + avgPhyDR_Tx + avgPhyDR_Rx
+ dasAvgPhyDR_TxAvgPhyDR_Rx = []
+ i = 0
+ while i < numSta:
+ dasAvgPhyDR_TxAvgPhyDR_Rx.append(dasField[i]+avgPhyDR_TxField[i]+avgPhyDR_RxField[i])
+ i=i+1
+ def createDasAvgPhyDR_TxAvgPhyDR_Rx(self, myNumSta=None, myDa=None, myAvgPhyDR_Tx=None, myAvgPhyDR_Rx=None):
+ print "dasAvgPhyDR_TxAvgPhyDR_Rx :"
+ #self.createNumSta(myNumSta)
+ self.createDas(myNumSta, myDa)
+ self.createAvgPhyDR_Tx(self.numSta, myAvgPhyDR_Tx)
+ self.createAvgPhyDR_Rx(self.numSta, myAvgPhyDR_Rx)
+ self.i = 0
+ while self.i < self.numSta:
+ self.dasAvgPhyDR_TxAvgPhyDR_Rx[self.i]=self.dasField[self.i]+self.avgPhyDR_TxField[self.i]+self.avgPhyDR_RxField[self.i]
+ self.i = self.i + 1
+
+ #LID
+ lid = 0
+ lidField = pack('B',lid)
+ def createLid(self, myLid=None):
+ if myLid!=None:
+ self.lid=myLid
+ self.lidField = pack('B',self.lid)
+ print "lid = "+hex(self.lid)
+
+ #Transmit Link Flag
+ tlFlag = 0 #Transmit Link by default
+ tlFlagField = pack('B',tlFlag)
+ def createTlFlag(self, myTlFlag=None):
+ if myTlFlag!=None:
+ self.tlFlag=myTlFlag
+ self.tlFlagField = pack('B',self.tlFlag)
+ print "tlFlag = "+hex(self.tlFlag)
+
+ #Management Link Flag
+ mgmt_Flag = 0 #Transmit Link by default
+ mgmt_FlagField = pack('B',mgmt_Flag)
+ def createMgmt_Flag(self, myMgmt_Flag=None):
+ if myMgmt_Flag!=None:
+ self.mgmt_Flag=myMgmt_Flag
+ self.mgmt_FlagField = pack('B',self.mgmt_Flag)
+ print "mgmt_Flag = "+hex(self.mgmt_Flag)
+
+ #Destination or Source MAC Address
+ daSa = 0x4153726F4144 #="DAorSA"
+ daSaField = pack('Q',daSa)[0:6]
+ def createDaSa(self, myDaSa=None):
+ if myDaSa!=None:
+ self.daSa=myDaSa
+ self.daSaField = pack('Q',self.daSa)[0:6]
+ print "daSa = "+hex(self.daSa)
+
+ #Beacon Period Counter
+ beaconPeriodCnt = 0 #0 by default
+ beaconPeriodCntField = pack('H',beaconPeriodCnt)
+ def createBeaconPeriodCnt(self, myBeaconPeriodCnt=None):
+ if myBeaconPeriodCnt!=None:
+ self.beaconPeriodCnt=myBeaconPeriodCnt
+ self.beaconPeriodCntField = pack('H',self.beaconPeriodCnt)
+ print "beaconPeriodCnt = "+hex(self.beaconPeriodCnt)
+
+ #Number of MSDU
+ numMsdus = 0 #0 by default
+ numMsdusField = pack('I',numMsdus)
+ def createNumMsdus(self, myNumMsdus=None):
+ if myNumMsdus!=None:
+ self.numMsdus=myNumMsdus
+ self.numMsdusField = pack('I',self.numMsdus)
+ print "numMsdus = "+hex(self.numMsdus)
+
+ #Number of MSDU Payload octets
+ octets = 0 #0 by default
+ octetsField = pack('I',octets)
+ def createOctets(self, myOctets=None):
+ if myOctets!=None:
+ self.octets=myOctets
+ self.octetsField = pack('I',self.octets)
+ print "octets = "+hex(self.octets)
+
+ #Number of generated segments
+ numSegs = 0 #0 by default
+ numSegsField = pack('I',numSegs)
+ def createNumSegs(self, myNumSegs=None):
+ if myNumSegs!=None:
+ self.numSegs=myNumSegs
+ self.numSegsField = pack('I',self.numSegs)
+ print "numSegs = "+hex(self.numSegs)
+
+ #Number of segments
+ numSeg_Suc = 0 #0 by default
+ numSeg_SucField = pack('I',numSeg_Suc)
+ def createNumSeg_Suc(self, myNumSeg_Suc=None):
+ if myNumSeg_Suc!=None:
+ self.numSeg_Suc=myNumSeg_Suc
+ self.numSeg_SucField = pack('I',self.numSeg_Suc)
+ print "numSeg_Suc = "+hex(self.numSeg_Suc)
+
+ #Number of Dropped segments
+ numSeg_Dropped = 0 #0 by default
+ numSeg_DroppedField = pack('I',numSeg_Dropped)
+ def createNumSeg_Dropped(self, myNumSeg_Dropped=None):
+ if myNumSeg_Dropped!=None:
+ self.numSeg_Dropped=myNumSeg_Dropped
+ self.numSeg_DroppedField = pack('I',self.numSeg_Dropped)
+ print "numSeg_Dropped = "+hex(self.numSeg_Dropped)
+
+ #Number of Missed segments
+ numSeg_Missed = 0 #0 by default
+ numSeg_MissedField = pack('I',numSeg_Missed)
+ def createNumSeg_Missed(self, myNumSeg_Missed=None):
+ if myNumSeg_Missed!=None:
+ self.numSeg_Missed=myNumSeg_Missed
+ self.numSeg_MissedField = pack('I',self.numSeg_Missed)
+ print "numSeg_Missed = "+hex(self.numSeg_Missed)
+
+ #Number of Handed Over PBs
+ numPbs = 0 #0 by default
+ numPbsField = pack('I',numPbs)
+ def createNumPbs(self, myNumPbs=None):
+ if myNumPbs!=None:
+ self.numPbs=myNumPbs
+ self.numPbsField = pack('I',self.numPbs)
+ print "numPbs = "+hex(self.numPbs)
+
+ #number of MPDUs
+ numMpdus = 0 #0 by default
+ numMpdusField = pack('I',numMpdus)
+ def createNumMpdus(self, myNumMpdus=None):
+ if myNumMpdus!=None:
+ self.numMpdus=myNumMpdus
+ self.numMpdusField = pack('I',self.numMpdus)
+ print "numMpdus = "+hex(self.numMpdus)
+
+ #Number of Bursts
+ numBursts = 0 #0 by default
+ numBurstsField = pack('I',numBursts)
+ def createNumBursts(self, myNumBursts=None):
+ if myNumBursts!=None:
+ self.numBursts=myNumBursts
+ self.numBurstsField = pack('I',self.numBursts)
+ print "numBursts = "+hex(self.numBursts)
+
+ #Number of Successfully Acknoledged MPDUs
+ numSacks = 0 #0 by default
+ numSacksField = pack('I',numSacks)
+ def createNumSacks(self, myNumSacks=None):
+ if myNumSacks!=None:
+ self.numSacks=myNumSacks
+ self.numSacksField = pack('I',self.numSacks)
+ print "numSacks = "+hex(self.numSacks)
+
+ #Number of Collected Latency Information Bins
+ numLatBins = 255
+ numLatBinsField = pack('B',numLatBins)
+ def createNumLatBins(self, myNumLatBins=None):
+ if myNumLatBins!=None:
+ self.numLatBins=myNumLatBins
+ self.numLatBinsField = pack('B',self.numLatBins)
+ print "numLatBins = "+hex(self.numLatBins)
+
+ #Number of Failed ICV MAC Frame
+ numIcvFails = 255
+ numIcvFailsField = pack('B',numIcvFails)
+ def createNumIcvFails(self, myNumIcvFails=None):
+ if myNumIcvFails!=None:
+ self.numIcvFails=myNumIcvFails
+ self.numIcvFailsField = pack('B',self.numIcvFails)
+ print "numIcvFails = "+hex(self.numIcvFails)
+
+ #Latency Bin Granularity ( 0 = 1 Beacon Period, 1 and more in milliseconds )
+ latBinGran = 0 #One Beacon Period by default
+ latBinGranField = pack('B',latBinGran)
+ def createLatBinGran(self, myLatBinGran=None):
+ if myLatBinGran!=None:
+ self.latBinGran=myLatBinGran
+ self.latBinGranField = pack('B',self.latBinGran)
+ print "latBinGran = "+hex(self.latBinGran)
+
+ #Number of successfully transmitted PBs with ranged latency
+ latBin = []
+ latBinField = []
+ i = 0
+ while i < numLatBins:
+ latBin.append(i)
+ latBinField.append(pack('I',latBin[i]))
+ i=i+1
+ def createLatBin(self, myNumLatBins=None, myLatBin=None, myRandomLatBin=False):
+ print "latBin : "
+ self.createNumLatBins(myNumLatBins)
+ self.i = 0
+ while self.i < self.numLatBins:
+ if myLatBin!=None:
+ self.latBin[self.i]=int((myLatBin+self.i)%pow(2,32))
+ elif myRandomLatBin==True:
+ self.latBin[self.i]=randrange(0,pow(2,4*8)-1,1)
+ self.latBinField[self.i]=pack('I',self.latBin[self.i])
+ print "latBin["+str(self.i)+"] = "+hex(self.latBin[self.i])
+ self.i = self.i + 1
+
+ #Receive MFS LinkStats
+ receiveMfsLinkStats = beaconPeriodCntField + numMsdusField + octetsField + numSeg_SucField + numSeg_MissedField + numPbsField + numBurstsField + numMpdusField + numIcvFailsField
+ def createReceiveMfsLinkStats(self, myBeaconPeriodCnt=None, myNumMsdus=None, myOctets=None, myNumSeg_Suc=None, myNumSeg_Missed=None, myNumPbs=None, myNumBursts=None, myNumMpdus=None, myNumIcvFails=None):
+ print "receiveMfsLinkStats :"
+ self.createBeaconPeriodCnt(myBeaconPeriodCnt)
+ self.createNumMsdus(myNumMsdus)
+ self.createOctets(myOctets)
+ self.createNumSeg_Suc(myNumSeg_Suc)
+ self.createNumSeg_Missed(myNumSeg_Missed)
+ self.createNumPbs(myNumPbs)
+ self.createNumBursts(myNumBursts)
+ self.createNumMpdus(myNumMpdus)
+ self.createNumIcvFails(myNumIcvFails)
+ self.receiveMfsLinkStats = self.beaconPeriodCntField + self.numMsdusField + self.octetsField + self.numSeg_SucField + self.numSeg_MissedField + self.numPbsField + self.numBurstsField + self.numMpdusField + self.numIcvFailsField
+
+ #Transmit MFS LinkStats
+ transmitMfsLinkStats = beaconPeriodCntField + numMsdusField + octetsField + numSegsField + numSeg_SucField + numSeg_DroppedField + numPbsField + numMpdusField + numBurstsField + numSacksField + numLatBinsField + latBinGranField
+ i = 0
+ while i < numLatBins:
+ transmitMfsLinkStats = transmitMfsLinkStats + latBinField[i]
+ i=i+1
+ def createTransmitMfsLinkStats(self, myBeaconPeriodCnt=None, myNumMsdus=None, myOctets=None, myNumSegs=None, myNumSeg_Suc=None, myNumSeg_Dropped=None, myNumPbs=None, myNumMpdus=None, myNumBursts=None, myNumSacks=None, myNumLatBins=None, myLatBinGran=None, myLatBin=None, myRandomLatBin=False):
+ print "transmitMfsLinkStats :"
+ self.createBeaconPeriodCnt(myBeaconPeriodCnt)
+ self.createNumMsdus(myNumMsdus)
+ self.createOctets(myOctets)
+ self.createNumSegs(myNumSegs)
+ self.createNumSeg_Suc(myNumSeg_Suc)
+ self.createNumSeg_Dropped(myNumSeg_Dropped)
+ self.createNumPbs(myNumPbs)
+ self.createNumMpdus(myNumMpdus)
+ self.createNumBursts(myNumBursts)
+ self.createNumSacks(myNumSacks)
+ self.createLatBinGran(myLatBinGran)
+ self.createLatBin(myNumLatBins,myLatBin,myRandomLatBin)
+ self.transmitMfsLinkStats = self.beaconPeriodCntField + self.numMsdusField + self.octetsField + self.numSegsField + self.numSeg_SucField + self.numSeg_DroppedField + self.numPbsField + self.numMpdusField + self.numBurstsField + self.numSacksField + self.numLatBinsField + self.latBinGranField
+ self.i = 0
+ while self.i < self.numLatBins:
+ self.transmitMfsLinkStats = self.transmitMfsLinkStats + self.latBinField[self.i]
+ self.i = self.i + 1
+
+ hm = 0 #AV Only Mode by default
+ securityLevel = 0 #Simple connect by default
+ nidOffset = 0x0f0e0d0c
+ nid = int(nidOffset + securityLevel*pow(2,52))
+ nidHm = int(nid + hm*pow(2,54))
+ nidHmField = pack('Q',nidHm)[0:7]
+ def createNidHm(self, mySecurityLevel=None, myNidOffset=None, myNid=None, myHm=None, myNidHm=None):
+ if mySecurityLevel!=None or myNidOffset!=None:
+ if mySecurityLevel!=None:
+ self.securityLevel=mySecurityLevel
+ if myNidOffset!=None:
+ self.nidOffset=myNidOffset
+ self.nid = int(self.nidOffset + self.securityLevel*pow(2,52))
+ if myNid!=None:
+ self.nid=myNid
+ if myHm!=None:
+ self.Hm=myHm
+ self.nidHm = int(self.nid + self.hm*pow(2,54))
+ if myNidHm!=None:
+ self.nidHm=myNidHm
+ print "nidHm = "+hex(self.nidHm)
+ else:
+ print "nid = "+hex(self.nid)
+ print "hm = "+hex(self.hm)
+ self.nidHmField = pack('Q',self.nidHm)[0:7]
+
+ bt = 0 #Central beacon by default
+ ncnr = 0 #not reported by default
+ npsm = 0 #not active by default
+ numSlot = 0 #1 beacon slot by default
+ btNcnrNpsmNumSlot = int(bt + ncnr*pow(2,3) + npsm*pow(2,4) + numSlot*pow(2,5))
+ btNcnrNpsmNumSlotField = pack('B',btNcnrNpsmNumSlot)
+ def createBtNcnrNpsmNumSlot(self, myBt=None, myNcnr=None, myNpsm=None, myNumSlot=None, myBtNcnrNpsmNumSlot=None):
+ if myBt!=None or myNcnr!=None or myNpsm!=None or myNumSlot!=None:
+ if myBt!=None:
+ self.bt=myBt
+ if myNcnr!=None:
+ self.ncnr=myNcnr
+ if myNpsm!=None:
+ self.npsm=myNpsm
+ if myNumSlot!=None:
+ self.numSlot=myNumSlot
+ self.btNcnrNpsmNumSlot = int(self.bt + self.ncnr*pow(2,3) + self.npsm*pow(2,4) + self.numSlot*pow(2,5))
+ if myBtNcnrNpsmNumSlot!=None:
+ self.btNcnrNpsmNumSlot = myBtNcnrNpsmNumSlot
+ print "btNcnrNpsmNumSlot = "+hex(self.btNcnrNpsmNumSlot)
+ else:
+ print "bt = "+hex(self.bt)
+ print "ncnr = "+hex(self.ncnr)
+ print "npsm = "+hex(self.npsm)
+ print "numSlot = "+hex(self.numSlot)
+ self.btNcnrNpsmNumSlotField = pack('B',self.btNcnrNpsmNumSlot)
+
+ #Beacon Slot Usage
+ slotUsage = 0 #All slot free by default
+ slotUsageField = pack('B',slotUsage)
+ def createSlotUsage(self, mySlotUsage=None):
+ if mySlotUsage!=None:
+ self.slotUsage=mySlotUsage
+ self.slotUsageField = pack('B',self.slotUsage)
+ print "slotUsage = "+hex(self.slotUsage)
+
+ slotId = 0 #First beacon slot by default
+ aclss = 0 #0 by default
+ hoip = 0 #Hand Over Not in Progress by default
+ rtsbf = 0 #0 by default
+ slotIdAclssHoipRtsbf = int(slotId + aclss*pow(2,3) + hoip*pow(2,6) + rtsbf*pow(2,7))
+ slotIdAclssHoipRtsbfField = pack('B',slotIdAclssHoipRtsbf)
+ def createSlotIdAclssHoipRtsbf(self, mySlotId=None, myAclss=None, myHoip=None, myRtsbf=None, mySlotIdAclssHoipRtsbf=None):
+ if mySlotId!=None or myAclss!=None or myHoip!=None or myRtsbf!=None:
+ if mySlotId!=None:
+ self.slotId=mySlotId
+ if myAclss!=None:
+ self.aclss=myAclss
+ if myHoip!=None:
+ self.hoip=myHoip
+ if myRtsbf!=None:
+ self.rtsbf=myRtsbf
+ self.slotIdAclssHoipRtsbf = int(self.slotId + self.aclss*pow(2,3) + self.hoip*pow(2,6) + self.rtsbf*pow(2,7))
+ if mySlotIdAclssHoipRtsbf!=None:
+ self.slotIdAclssHoipRtsbf = mySlotIdAclssHoipRtsbf
+ print "slotIdAclssHoipRtsbf = "+hex(self.slotIdAclssHoipRtsbf)
+ else:
+ print "slotId = "+hex(self.slotId)
+ print "aclss = "+hex(self.aclss)
+ print "hoip = "+hex(self.hoip)
+ print "rtsbf = "+hex(self.rtsbf)
+ self.slotIdAclssHoipRtsbfField = pack('B',self.slotIdAclssHoipRtsbf)
+
+ nm = 0 #Uncoordinated Mode by default
+ ccoCap = 0 #Level 0 by default
+ rsvd = 0 #reserved = 0 by default
+ nmCcoCapRsvd = int(nm + ccoCap*pow(2,2) + rsvd*pow(2,4))
+ nmCcoCapRsvdField = pack('B',nmCcoCapRsvd)
+ def createNmCcoCaptsbf(self, myNm=None, myCcoCap=None, myNmCcoCapRsvd=None):
+ if myNm!=None or myCcoCap!=None:
+ if myNm!=None:
+ self.nm=myNm
+ if myCcoCap!=None:
+ self.ccoCap=myCcoCap
+ self.nmCcoCapRsvd = int(self.nm + self.ccoCap*pow(2,2))
+ if myNmCcoCapRsvd!=None:
+ self.nmCcoCapRsvd = myNmCcoCapRsvd
+ print "nmCcoCapRsvd = "+hex(self.nmCcoCapRsvd)
+ else:
+ print "nm = "+hex(self.nm)
+ print "ccoCap = "+hex(self.ccoCap)
+ self.nmCcoCapRsvdField = pack('B',self.nmCcoCapRsvd)
+
+ #Number of Beacon Entries
+ nbe = 255
+ nbeField = pack('B',nbe)
+ def createNbe(self, myNbe=None):
+ if myNbe!=None:
+ self.nbe=myNbe
+ self.nbeField = pack('B',self.nbe)
+ print "nbe = "+hex(self.nbe)
+
+ #Beacon Entry Headers
+ behdr = []
+ behdrField = []
+ i = 0
+ while i < nbe:
+ behdr.append(i%0x0E)
+ behdrField.append(pack('B',behdr[i]))
+ i=i+1
+ def createBehdr(self, myNbe=None, myBehdr=None, myRandomBehdr=False):
+ self.createNbe(myNbe)
+ self.i = 0
+ while self.i < self.nbe:
+ if myBehdr!=None:
+ self.behdr[self.i]=int((myBehdr+self.i)%0x0E)
+ elif myRandomBehdr==True:
+ self.behdr[self.i]=randrange(0,0x0D,1)
+ self.behdrField[self.i]=pack('B',self.behdr[self.i])
+ print "behdr["+str(self.i)+"] = "+BMI[self.behdr[self.i]]
+ print "bentryField["+str(self.i)+"] = "#+self.bentryField[self.i]
+ self.bentryField[self.i] = self.bentry.dico[self.behdr[self.i]]()
+ self.i = self.i + 1
+
+ #Becon Management information Field
+ bentry = BmiMethod()
+ bentryField = []
+ i = 0
+ while i < nbe:
+ bentryField.append(bentry.dico[behdr[i]]())
+ i=i+1
+ def createBentry(self, myBmiNumber=0, myBehdr=None, param1=None, param2=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myBehdr==None:
+ myBehdr=self.behdr[myBmiNumber]
+ self.behdr[myBmiNumber]=myBehdr
+ print "behdr["+str(myBmiNumber)+"] = "+BMI[self.behdr[myBmiNumber]]
+ print "bentryField["+str(myBmiNumber)+"] = "#+self.bentryField[self.i]
+ self.bentryField[myBmiNumber] = self.bentry.dico[myBehdr](param1, param2, param3, param4, param5, param6, param7, param8, param9, paramA, paramB)
+
+ #Beacon Management Information
+ bmiField = nbeField
+ i = 0
+ while i < nbe:
+ bmiField = bmiField + behdrField[i] + bentryField[i]
+ i=i+1
+ def createBmi(self, myNbe=None, myRandomBehdr=False, myBmiNumber=None, myBehdr=None, param1=None, param2=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ if myBmiNumber!=None:
+ self.createBentry(myBmiNumber, myBehdr, param1, param2, param3, param4, param5, param6, param7, param8, param9, paramA, paramB)
+ print "bmi :"
+ self.createBehdr(myNbe, None, False)
+ else:
+ print "bmi :"
+ self.createBehdr(myNbe, myBehdr, myRandomBehdr)
+ self.bmiField = self.nbeField
+ self.i = 0
+ while self.i < self.nbe:
+ self.bmiField = self.bmiField + self.behdrField[self.i] + self.bentryField[self.i]
+ self.i = self.i + 1
+
+ #MAC Frame Length = MFL
+ mmeMfl = 59 #MFL = 59 by default
+ def createMmeMfl(self, myMmentry=""):
+ self.mmeMfl = len(myMmentry) + 26 #len(mmHeaderWithVLanTag)+len(confunder)-1
+ #In Maximus VLanTag is always present
+ if self.mmeMfl < 59:
+ self.mmeMfl = 59
+ print "mmeMfl = "+hex(self.mmeMfl)
+
+ #AES cryption
+ encryptedFields = ""
+ myEncryption=new(keyField,2,ivField)
+ def createEncryptedFields(self, myIvOrUuid=None, myIvOrUuidRandom=False, myRandomFillerEncrypted=None, myOda=None, myOsa=None, myVlanTag=None, myMtype=None, myMmv=None, myMmtype=None, myNfmi=None, myFnMi=None, myFmsn=None, myMmentry=None, myEncapsulatedMmEntry=None, myMmOrHlePayloadEncrypted=None, myCrcEncrypted=None, myPidEncrypted=None, myPrnEncrypted=None, myRandomPrn=None, myPmnEncrypted=None, myPaddingEncrypted=None, myRfLenEncrypted=None, myKey=None, myEncryptedFields=None):
+ self.myEncryption = new(self.keyField,2,self.ivField)
+ if myEncryptedFields == None:
+ self.createIv(myIvOrUuid, myIvOrUuidRandom)
+ self.createRandomFillerEncrypted(myRfLenEncrypted, myRandomFillerEncrypted)
+ self.createMmOrHlePayloadEncrypted(self.pid, myOda, myOsa, myVlanTag, myMtype, myMmv, myMmtype, myNfmi, myFnMi, myFmsn, myMmentry, myEncapsulatedMmEntry, myMmOrHlePayloadEncrypted)
+ self.createLengthForEncryption()
+ self.createCrcEncrypted(myCrcEncrypted)
+ self.createPrnEncrypted(myPrnEncrypted, myRandomPrn)
+ self.createPmnEncrypted(myPmnEncrypted)
+ self.createPaddingEncrypted(myPaddingEncrypted)
+ self.createKey(myKey)
+ self.encryptedFields = self.randomFillerEncryptedField + self.mmOrHlePayloadEncryptedField + self.crcEncryptedField + self.pidField + self.prnEncryptedField + self.pmnEncryptedField + self.paddingEncryptedField + self.rfLenEncryptedField
+ if self.peks != 0x0F:
+ self.encryptedFields=self.myEncryption.encrypt(self.encryptedFields)
+ return self.ivField + self.lengthForEncryptionField + self.encryptedFields
+ else:
+ self.createKey(myKey)
+ self.encryptedFields = myEncryptedFields
+ self.createIv(myIv = self.encryptedFields[0:16])
+ self.createLengthForEncryption(myLengthForEncryption = self.encryptedFields[16:18])
+ self.encryptedFields=self.encryptedFields[18:]
+ if self.peks != 0x0F:
+ self.myEncryption = new(self.keyField,2,self.ivField)
+ self.encryptedFields=self.myEncryption.decrypt(self.encryptedFields)
+ self.createRandomFillerEncrypted(myRfLenEncrypted = self.encryptedFields[len(self.encryptedFields)-1:], myRandomFillerEncrypted = self.encryptedFields[0:unpack('B',self.encryptedFields[len(self.encryptedFields)-1:])[0]])
+ self.createMmOrHlePayloadEncrypted( myEncapsulatedMmEntry = self.encryptedFields[self.rfLenEncrypted:self.rfLenEncrypted+self.lengthForEncryption] )
+ self.createCrcEncrypted( myCrcEncrypted = self.encryptedFields[self.rfLenEncrypted+self.lengthForEncryption:self.rfLenEncrypted+self.lengthForEncryption+4] )
+ self.createPid( myPid = self.encryptedFields[self.rfLenEncrypted+self.lengthForEncryption+4:self.rfLenEncrypted+self.lengthForEncryption+4+1] )
+ self.createPrnEncrypted( myPrnEncrypted = self.encryptedFields[self.rfLenEncrypted+self.lengthForEncryption+4+1:self.rfLenEncrypted+self.lengthForEncryption+4+1+2] )
+ self.createPmnEncrypted( myPmnEncrypted = self.encryptedFields[self.rfLenEncrypted+self.lengthForEncryption+4+1+2:self.rfLenEncrypted+self.lengthForEncryption+4+1+2+1] )
+ self.createPaddingEncrypted( myPaddingEncrypted = self.encryptedFields[self.rfLenEncrypted+self.lengthForEncryption+4+1+2+1:len(self.encryptedFields)-1] )
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cesar/maximus/python/lib/mmentry/mmentryMethod.py b/cesar/maximus/python/lib/mmentry/mmentryMethod.py
new file mode 100644
index 0000000000..d936202a41
--- /dev/null
+++ b/cesar/maximus/python/lib/mmentry/mmentryMethod.py
@@ -0,0 +1,2089 @@
+# -*- coding:Utf-8 -*-
+#MMENTRY Methods
+
+from mmentry import *
+from mmentryFields import *
+
+#MmentryMethod can create every MMENTRY of MME
+# from MMENTRY format and MMENTRY fields
+class MmentryMethod():
+
+ mmentry = Mmentry() #Creates MMENTRY format
+ mmentryFields = MmentryFields() #Creates MMENTRY fields
+
+
+
+ #----- Station - Central Coordination -----
+
+
+
+ #createCC_CCO_APPOINT_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_CCO_APPOINT.REQ MME
+ def createCC_CCO_APPOINT_REQ_MMENTRY(self, myReqType=None, myMacAddress=None, myMmentry=None):
+ print "CC_CCO_APPOINT.REQ ="
+ #CC_CCO_APPOINT_REQ_MMENTRY is composed by 2 fields :
+ # - ReqType
+ # - macAddress
+ if myMmentry == None:
+ self.mmentryFields.createReqType(myReqType)
+ #MAC Address field is not present when ReqType = 0x01
+ if self.mmentryFields.reqType == 0x01:
+ self.mmentryFields.macAddress = 0
+ self.mmentryFields.createMacAddress(myMacAddress)
+ self.mmentry.CC_CCO_APPOINT_REQ = self.mmentryFields.reqTypeField + self.mmentryFields.macAddressField
+ self.mmentryFields.mmentry = self.mmentry.CC_CCO_APPOINT_REQ
+ self.mmentryFields.mmtype = CC_CCO_APPOINT_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createReqType(myMmentry[0])
+ if self.mmentryFields.reqType != 0x01:
+ self.mmentryFields.createMacAddress(myMmentry[1:])
+ else:
+ self.mmentryFields.createMacAddress(0)
+
+
+ #createCC_CCO_APPOINT_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_CCO_APPOINT.CNF MME
+ def createCC_CCO_APPOINT_CNF_MMENTRY(self, myResult=None):
+ print "CC_CCO_APPOINT.CNF ="
+ #CC_CCO_APPOINT_CNF_MMENTRY is composed by 1 field :
+ # - Result
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CC_CCO_APPOINT_CNF = self.mmentryFields.resultField
+ self.mmentryFields.mmentry = self.mmentry.CC_CCO_APPOINT_CNF
+ self.mmentryFields.mmtype = CC_CCO_APPOINT_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_BACKUP_APPOINT_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_BACKUP_APPOINT.REQ MME
+ def createCC_BACKUP_APPOINT_REQ_MMENTRY(self, myAppointRelease=None):
+ print "CC_BACKUP_APPOINT.REQ ="
+ #CC_BACKUP_APPOINT_REQ_MMENTRY is composed by 1 field :
+ # - AppointRelease
+ self.mmentryFields.createAppointRelease(myAppointRelease)
+ self.mmentry.CC_BACKUP_APPOINT_REQ = self.mmentryFields.appointReleaseField
+ self.mmentryFields.mmentry = self.mmentry.CC_BACKUP_APPOINT_REQ
+ self.mmentryFields.mmtype = CC_BACKUP_APPOINT_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_BACKUP_APPOINT_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_BACKUP_APPOINT.CNF MME
+ def createCC_BACKUP_APPOINT_CNF_MMENTRY(self, myResult=None):
+ print "CC_BACKUP_APPOINT.CNF ="
+ #CC_BACKUP_APPOINT_CNF_MMENTRY is composed by 1 field :
+ # - Result
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CC_BACKUP_APPOINT_CNF = self.mmentryFields.resultField
+ self.mmentryFields.mmentry = self.mmentry.CC_BACKUP_APPOINT_CNF
+ self.mmentryFields.mmtype = CC_BACKUP_APPOINT_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_LINK_INFO.REQ has no MMENTRY
+ def createCC_LINK_INFO_REQ_MMENTRY(self):
+ print "CC_LINK_INFO.REQ ="
+ #CC_LINK_INFO_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CC_LINK_INFO_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_INFO_REQ
+ self.mmentryFields.mmtype = CC_LINK_INFO_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_INFO_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_INFO.CNF MME
+ def createCC_LINK_INFO_CNF_MMENTRY(self, myNum=0, myTei=None, myLlidF=None, myStei=None, myDtei=None, myLidF=None, myLidR=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None, myNumF=None, myEndTimeL=None, myIntBleL=None, myIntervalL=None, myNumR=None, myEndTimeR=None, myIntBleR=None, myIntervalR=None):
+ print "CC_LINK_INFO.CNF ="
+ #CC_LINK_INFO_CNF_MMENTRY is composed by 2 fields :
+ # - Num
+ # - GlobalLinkInfo -* Num-
+ #self.mmentryFields.createNum(myNum)
+ self.mmentryFields.createGlobalLinks(myNum, myTei, myLlidF, myStei, myDtei, myLidF, myLidR, myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R, myNumF, myEndTimeL, myIntBleL, myIntervalL, myNumR, myEndTimeR, myIntBleR, myIntervalR)
+ self.mmentry.CC_LINK_INFO_CNF = self.mmentryFields.numField
+ self.i=0
+ while self.i<self.mmentryFields.num:
+ self.mmentry.CC_LINK_INFO_CNF = self.mmentry.CC_LINK_INFO_CNF + self.mmentryFields.globalLinks[self.i].globalLinkInfo
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_INFO_CNF
+ self.mmentryFields.mmtype = CC_LINK_INFO_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_INFO_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_INFO.IND MME
+ def createCC_LINK_INFO_IND_MMENTRY(self, myNum=0, myTei=None, myLlidF=None, myStei=None, myDtei=None, myLidF=None, myLidR=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None, myNumF=None, myEndTimeL=None, myIntBleL=None, myIntervalL=None, myNumR=None, myEndTimeR=None, myIntBleR=None, myIntervalR=None):
+ print "CC_LINK_INFO.IND ="
+ #CC_LINK_INFO_IND_MMENTRY is composed by 2 fields :
+ # - Num
+ # - GlobalLinkInfo -* Num-
+ #self.mmentryFields.createNum(myNum)
+ self.mmentryFields.createGlobalLinks(myNum, myTei, myLlidF, myStei, myDtei, myLidF, myLidR, myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R, myNumF, myEndTimeL, myIntBleL, myIntervalL, myNumR, myEndTimeR, myIntBleR, myIntervalR)
+ self.mmentry.CC_LINK_INFO_IND = self.mmentryFields.numField
+ self.i=0
+ while self.i<self.mmentryFields.num:
+ self.mmentry.CC_LINK_INFO_IND = self.mmentry.CC_LINK_INFO_IND + self.mmentryFields.globalLinks[self.i].globalLinkInfo
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_INFO_IND
+ self.mmentryFields.mmtype = CC_LINK_INFO_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_LINK_INFO.RSP has no MMENTRY
+ def createCC_LINK_INFO_RSP_MMENTRY(self):
+ print "CC_LINK_INFO.RSP ="
+ #CC_LINK_INFO_RSP_MMENTRY is composed by 0 field :
+ self.mmentry.CC_LINK_INFO_RSP = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_INFO_RSP
+ self.mmentryFields.mmtype = CC_LINK_INFO_RSP
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_HANDOVER_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_HANDOVER.REQ MME
+ def createCC_HANDOVER_REQ_MMENTRY(self, mySoftHard=None, myReason=None):
+ print "CC_HANDOVER.REQ ="
+ #CC_HANDOVER_REQ_MMENTRY is composed by 2 fields :
+ # - Soft/Hard
+ # - Reason
+ self.mmentryFields.createSoftHard(mySoftHard)
+ self.mmentryFields.createReason(myReason)
+ self.mmentry.CC_HANDOVER_REQ = self.mmentryFields.softHardField + self.mmentryFields.reasonField
+ self.mmentryFields.mmentry = self.mmentry.CC_HANDOVER_REQ
+ self.mmentryFields.mmtype = CC_HANDOVER_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_HANDOVER_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_HANDOVER.CNF MME
+ def createCC_HANDOVER_CNF_MMENTRY(self, myResult=None):
+ print "CC_HANDOVER.CNF ="
+ #CC_HANDOVER_CNF_MMENTRY is composed by 1 field :
+ # - Result
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CC_HANDOVER_CNF = self.mmentryFields.resultField
+ self.mmentryFields.mmentry = self.mmentry.CC_HANDOVER_CNF
+ self.mmentryFields.mmtype = CC_HANDOVER_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_HANDOVER_INFO_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_HANDOVER_INFO.IND MME
+ def createCC_HANDOVER_INFO_IND_MMENTRY(self, myRsc=None,myBackupCco=None,myNum=0):
+ print "CC_HANDOVER_INFO.IND ="
+ #CC_HANDOVER_INFO_IND_MMENTRY is composed by 4 field :
+ # - RSC
+ # - BackupCCo
+ # - Num
+ # - STA_Info -*Num-
+ self.mmentryFields.createRsc(myRsc)
+ self.mmentryFields.createBackupCco(myBackupCco)
+ self.mmentryFields.createNum(myNum)
+ self.mmentry.CC_HANDOVER_INFO_IND = self.mmentryFields.rscField + self.mmentryFields.backupCcoField + self.mmentryFields.numField
+ self.i=0
+ while self.i<self.mmentryFields.num:
+ self.mmentry.CC_HANDOVER_INFO_IND = self.mmentry.CC_HANDOVER_INFO_IND + self.mmentryFields.stasInfo[self.i].staInfo
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CC_HANDOVER_INFO_IND
+ self.mmentryFields.mmtype = CC_HANDOVER_INFO_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_HANDOVER_INFO.RSP has no MMENTRY
+ def createCC_HANDOVER_INFO_RSP_MMENTRY(self):
+ print "CC_HANDOVER_INFO.RSP ="
+ #CC_HANDOVER_INFO_RSP_MMENTRY is composed by 0 field :
+ self.mmentry.CC_HANDOVER_INFO_RSP = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_HANDOVER_INFO_RSP
+ self.mmentryFields.mmtype = CC_HANDOVER_INFO_RSP
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_DISCOVER_LIST.REQ has no MMENTRY
+ def createCC_DISCOVER_LIST_REQ_MMENTRY(self):
+ print "CC_DISCOVER_LIST.REQ ="
+ #CC_DISCOVER_LIST_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CC_DISCOVER_LIST_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_DISCOVER_LIST_REQ
+ self.mmentryFields.mmtype = CC_DISCOVER_LIST_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_DISCOVER_LIST_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_DISCOVER_LIST.CNF MME
+ def createCC_DISCOVER_LIST_CNF_MMENTRY(self, myNumSta=0, myMacAddress=None, myTei=None, mySameNetwork=None, mySnidStation=None, myAccessStation=None, mySnidAccessStation=None, myCcoCapability=None, myProxyNetworkCapability=None, myBackupCcoCapability=None, myCcoStatus=None, myPcoStatus=None, myBackupCcoStatus=None, myNinthOctet=None, mySignalLevel=None, myEndTime=None, myIntBle=None, myNumNet=0, mySecurityLevel=None, myNidOffset=None, myNid=None, mySnidNetwork=None, myAccessNetwork=None, mySnidAccessNetwork=None, myHm=None, myNumSlot=None, myCoordonatingStatus=None, myOffset=None):
+ print "CC_DISCOVER_LIST.CNF ="
+ #CC_DISCOVER_LIST_CNF_MMENTRY is composed by 4 field :
+ # - NumStation
+ # - StationInfo -*NumStation-
+ # - NumNetwork
+ # - NetworkInfo -*NumNetwork-
+ self.mmentryFields.createStationsInfo(myNumSta, myMacAddress, myTei, mySameNetwork, mySnidStation, myAccessStation, mySnidAccessStation, myCcoCapability, myProxyNetworkCapability, myBackupCcoCapability, myCcoStatus, myPcoStatus, myBackupCcoStatus, myNinthOctet, mySignalLevel, myEndTime, myIntBle)
+ self.mmentry.CC_DISCOVER_LIST_CNF = self.mmentryFields.numStaField
+ self.i=0
+ while self.i<self.mmentryFields.numSta:
+ self.mmentry.CC_DISCOVER_LIST_CNF = self.mmentry.CC_DISCOVER_LIST_CNF + self.mmentryFields.stationsInfo[self.i].stationInfo
+ self.i=self.i+1
+ self.mmentryFields.createNetworksInfo(myNumNet, mySecurityLevel, myNidOffset, myNid, mySnidNetwork, myAccessNetwork, mySnidAccessNetwork, myHm, myNumSlot, myCoordonatingStatus, myOffset)
+ self.mmentry.CC_DISCOVER_LIST_CNF = self.mmentry.CC_DISCOVER_LIST_CNF + self.mmentryFields.numNetField
+ self.i=0
+ while self.i<self.mmentryFields.numNet:
+ self.mmentry.CC_DISCOVER_LIST_CNF = self.mmentry.CC_DISCOVER_LIST_CNF + self.mmentryFields.networksInfo[self.i].networkInfo
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CC_DISCOVER_LIST_CNF
+ self.mmentryFields.mmtype = CC_DISCOVER_LIST_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_DISCOVER_LIST_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_DISCOVER_LIST.IND MME
+ def createCC_DISCOVER_LIST_IND_MMENTRY(self, myNumSta=0, myMacAddress=None, myTei=None, mySameNetwork=None, mySnidStation=None, myAccessStation=None, mySnidAccessStation=None, myCcoCapability=None, myProxyNetworkCapability=None, myBackupCcoCapability=None, myCcoStatus=None, myPcoStatus=None, myBackupCcoStatus=None, myNinthOctet=None, mySignalLevel=None, myEndTime=None, myIntBle=None, myNumNet=0, mySecurityLevel=None, myNidOffset=None, myNid=None, mySnidNetwork=None, myAccessNetwork=None, mySnidAccessNetwork=None, myHm=None, myNumSlot=None, myCoordonatingStatus=None, myOffset=None):
+ print "CC_DISCOVER_LIST.IND ="
+ #CC_DISCOVER_LIST_IND_MMENTRY is composed by 4 field :
+ # - NumStation
+ # - StationInfo -*NumStation-
+ # - NumNetwork
+ # - NetworkInfo -*NumNetwork-
+ self.mmentryFields.createStationsInfo(myNumSta, myMacAddress, myTei, mySameNetwork, mySnidStation, myAccessStation, mySnidAccessStation, myCcoCapability, myProxyNetworkCapability, myBackupCcoCapability, myCcoStatus, myPcoStatus, myBackupCcoStatus, myNinthOctet, mySignalLevel, myEndTime, myIntBle)
+ self.mmentry.CC_DISCOVER_LIST_IND = self.mmentryFields.numStaField
+ self.i=0
+ while self.i<self.mmentryFields.numSta:
+ self.mmentry.CC_DISCOVER_LIST_IND = self.mmentry.CC_DISCOVER_LIST_IND + self.mmentryFields.stationsInfo[self.i].stationInfo
+ self.i=self.i+1
+ self.mmentryFields.createNetworksInfo(myNumNet, mySecurityLevel, myNidOffset, myNid, mySnidNetwork, myAccessNetwork, mySnidAccessNetwork, myHm, myNumSlot, myCoordonatingStatus, myOffset)
+ self.mmentry.CC_DISCOVER_LIST_IND = self.mmentry.CC_DISCOVER_LIST_IND + self.mmentryFields.numNetField
+ self.i=0
+ while self.i<self.mmentryFields.numNet:
+ self.mmentry.CC_DISCOVER_LIST_IND = self.mmentry.CC_DISCOVER_LIST_IND + self.mmentryFields.networksInfo[self.i].networkInfo
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CC_DISCOVER_LIST_IND
+ self.mmentryFields.mmtype = CC_DISCOVER_LIST_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_NEW_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_NEW.REQ MME
+ def createCC_LINK_NEW_REQ_MMENTRY(self, myInitMacAddress=None, myTermMacAddress=None, myTei=None, myLlidF=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None, myNumF=None, myEndTimeF=None, myIntBleF=None, myNumR=None, myEndTimeR=None, myIntBleR=None):
+ print "CC_LINK_NEW.REQ ="
+ #CC_LINK_NEW_REQ_MMENTRY is composed by 6 fields :
+ # - Init MAC Address
+ # - Term MAC Address
+ # - CID
+ # - CSPEC
+ # - Forward Link Bit Loading Estimates
+ # - Reverse Link Bit Loading Estimates
+ self.mmentryFields.createInitMacAddress(myInitMacAddress)
+ self.mmentryFields.createTermMacAddress(myTermMacAddress)
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentryFields.createForwardLinkBle(myNumF, myEndTimeF, myIntBleF)
+ self.mmentryFields.createReverseLinkBle(myNumR, myEndTimeR, myIntBleR)
+ self.mmentry.CC_LINK_NEW_REQ = self.mmentryFields.initMacAddressField + self.mmentryFields.termMacAddressField + self.mmentryFields.cidField + self.mmentryFields.cspecField + self.mmentryFields.forwardLinkBle.ble + self.mmentryFields.reverseLinkBle.ble
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_NEW_REQ
+ self.mmentryFields.mmtype = CC_LINK_NEW_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_NEW_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_NEW.CNF MME
+ def createCC_LINK_NEW_CNF_MMENTRY(self, myTei=None, myLlidF=None, myGlidF=None, myGlidR=None, myResult=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CC_LINK_NEW.CNF ="
+ #CC_LINK_NEW_CNF_MMENTRY is composed by 5 fields :
+ # - CID
+ # - GLID-F
+ # - GLID-R
+ # - Result
+ # - Proposed CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createGlidF(myGlidF=None)
+ self.mmentryFields.createGlidR(myGlidR=None)
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CC_LINK_NEW_CNF = self.mmentryFields.cidField + self.mmentryFields.glidFField + self.mmentryFields.glidRField + self.mmentryFields.resultField
+ if self.mmentryFields.result == 1 :
+ self.mmentryFields.createProposedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CC_LINK_NEW_CNF = self.mmentry.CC_LINK_NEW_CNF + self.mmentryFields.proposedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_NEW_CNF
+ self.mmentryFields.mmtype = CC_LINK_NEW_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_MOD_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_MOD.REQ MME
+ def createCC_LINK_MOD_REQ_MMENTRY(self, myTei=None, myLlidF=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None, myNumF=None, myEndTimeF=None, myIntBleF=None, myNumR=None, myEndTimesR=None, myIntBleR=None):
+ print "CC_LINK_MOD.REQ ="
+ #CC_LINK_MOD_REQ_MMENTRY is composed by 4 fields :
+ # - CID
+ # - Modified CSPEC
+ # - Forward Link Bit Loading Estimates
+ # - Reverse Link Bit Loading Estimates
+ #CAREFUL : this MME requires the GLID-F and the GLID-R to be fulfilled
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createModifiedCspec(self, myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CC_LINK_MOD_REQ = self.mmentryFields.cidField + self.mmentryFields.modifiedCspecField
+ if self.mmentryFields.glidF in globalId:
+ self.mmentryFields.createForwardLinkBle(myNumF, myEndTimeF, myIntBleF)
+ self.mmentry.CC_LINK_MOD_REQ = self.mmentry.CC_LINK_MOD_REQ + self.mmentryFields.forwardLinkBleField
+ if self.mmentryFields.glidR in globalId:
+ self.mmentryFields.createReverseLinkBle(myNumR, myEndTimeR, myIntBleR)
+ self.mmentry.CC_LINK_MOD_REQ = self.mmentry.CC_LINK_MOD_REQ + self.mmentryFields.reverseLinkBleField
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_MOD_REQ
+ self.mmentryFields.mmtype = CC_LINK_MOD_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_MOD_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_MOD.CNF MME
+ def createCC_LINK_MOD_CNF_MMENTRY(self, myTei=None, myLlidF=None, myResult=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CC_LINK_MOD.CNF ="
+ #CC_LINK_MOD_CNF_MMENTRY is composed by 3 fields :
+ # - CID
+ # - Result
+ # - Proposed CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CC_LINK_MOD_CNF = self.mmentryFields.cidField + self.mmentryFields.resultField
+ if self.mmentryFields.result == 1 :
+ self.mmentryFields.createProposedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CC_LINK_MOD_CNF = self.mmentry.CC_LINK_MOD_CNF + self.mmentryFields.proposedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_MOD_CNF
+ self.mmentryFields.mmtype = CC_LINK_MOD_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_SQZ_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_SQZ.REQ MME
+ def createCC_LINK_SQZ_REQ_MMENTRY(self, myTei=None, myLlidF=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CC_LINK_SQZ.REQ ="
+ #CC_LINK_SQZ_REQ_MMENTRY is composed by 2 fields :
+ # - CID
+ # - Modified CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createModifiedCspec(self, myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CC_LINK_SQZ_REQ = self.mmentryFields.cidField + self.mmentryFields.modifiedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_SQZ_REQ
+ self.mmentryFields.mmtype = CC_LINK_SQZ_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_SQZ_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_SQZ.CNF MME
+ def createCC_LINK_SQZ_CNF_MMENTRY(self, myTei=None, myLlidF=None, myResult=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CC_LINK_SQZ.CNF ="
+ #CC_LINK_SQZ_CNF_MMENTRY is composed by 3 fields :
+ # - CID
+ # - Result
+ # - Proposed CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CC_LINK_SQZ_CNF = self.mmentryFields.cidField + self.mmentryFields.resultField
+ if self.mmentryFields.result == 1 :
+ self.mmentryFields.createProposedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CC_LINK_SQZ_CNF = self.mmentry.CC_LINK_SQZ_CNF + self.mmentryFields.proposedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_SQZ_CNF
+ self.mmentryFields.mmtype = CC_LINK_SQZ_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_REL_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_REL.REQ MME
+ def createCC_LINK_REL_REQ_MMENTRY(self, myCidTei=None, myLlidF=None, myTei=None, myRsc=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CC_LINK_REL.REQ ="
+ #CC_LINK_REL_REQ_MMENTRY is composed by 4 fields :
+ # - CID
+ # - TEI
+ # - Reason Code
+ # - Violated CSPEC
+ self.mmentryFields.createCid(myCidTei, myLlidF)
+ self.mmentryFields.createTei(myTei)
+ self.mmentryFields.createRsc(myRsc)
+ self.mmentry.CC_LINK_REL_REQ = self.mmentryFields.cidField + self.mmentryFields.teiField + self.mmentryFields.rscField
+ if self.mmentryFields.rsc == 1 :
+ self.mmentryFields.createViolatedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CC_LINK_REL_REQ = self.mmentry.CC_LINK_REL_REQ + self.mmentryFields.violatedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_REL_REQ
+ self.mmentryFields.mmtype = CC_LINK_REL_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LINK_REL_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_LINK_REL.IND MME
+ def createCC_LINK_REL_IND_MMENTRY(self, myTei=None, myLlidF=None, myReleasingStationMacAddress=None, myRsc=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CC_LINK_REL.IND ="
+ #CC_LINK_REL_IND_MMENTRY is composed by 4 fields :
+ # - CID
+ # - Releasing Station Mac Address
+ # - Reason Code
+ # - Proposed CSPEC or Violated CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createReleasingStationMacAddress(myReleasingStationMacAddress)
+ self.mmentryFields.createRsc(myRsc)
+ self.mmentry.CC_LINK_REL_IND = self.mmentryFields.cidField + self.mmentryFields.releasingStationMacAddressField + self.mmentryFields.rscField
+ if self.mmentryFields.rsc == 1 :
+ self.mmentryFields.createProposedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CC_LINK_REL_IND = self.mmentry.CC_LINK_REL_IND + self.mmentryFields.proposedCspecField
+ elif self.mmentryFields.rsc == 2 :
+ self.mmentryFields.createViolatedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CC_LINK_REL_IND = self.mmentry.CC_LINK_REL_IND + self.mmentryFields.violatedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_REL_IND
+ self.mmentryFields.mmtype = CC_LINK_REL_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_DETECT_REPORT_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_DETECT_REPORT.REQ MME
+ def createCC_DETECT_REPORT_REQ_MMENTRY(self, myDuration=None, myNumGlid=0, myGlids=None):
+ print "CC_DETECT_REPORT.REQ ="
+ #CC_DETECT_REPORT_REQ_MMENTRY is composed by 3 fields :
+ # - Duration
+ # - Number of GLID
+ # - GLID -* NumGlid-
+ self.mmentryFields.createDuration(myDuration)
+ self.mmentryFields.createNumGlid(myNumGlid)
+ self.mmentry.CC_DETECT_REPORT_REQ = self.mmentryFields.durationField + self.mmentryFields.numGlidField
+ self.mmentryFields.createGlids(self.mmentryFields.numGlid, myGlids)
+ self.i=0
+ while self.i<self.mmentryFields.numGlid:
+ self.mmentry.CC_DETECT_REPORT_REQ = self.mmentry.CC_DETECT_REPORT_REQ + self.mmentryFields.glids.glidsField[self.i]
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CC_DETECT_REPORT_REQ
+ self.mmentryFields.mmtype = CC_DETECT_REPORT_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_DETECT_REPORT_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_DETECT_REPORT.CNF MME
+ def createCC_DETECT_REPORT_CNF_MMENTRY(self, myNumGlid=0, myCfDetecteds=None, myCsmaDetecteds=None, myHp1Detecteds=None, myOthersDetecteds=None, mySignalLevels=None, myEndTime=None, myIntBle=None):
+ print "CC_DETECT_REPORT.CNF ="
+ #CC_DETECT_REPORT_CNF_MMENTRY is composed by 2 fields :
+ # - Number of GLID
+ # - GLID Info -* NumGlid-
+ self.mmentryFields.createNumGlid(myNumGlid)
+ self.mmentry.CC_DETECT_REPORT_CNF = self.mmentryFields.numGlidField
+ self.mmentryFields.createGlidsInfo(self.mmentryFields.numGlid, myCfDetecteds, myCsmaDetecteds, myHp1Detecteds, myOthersDetecteds, mySignalLevels, myEndTime, myIntBle)
+ self.i=0
+ while self.i<self.mmentryFields.numGlid:
+ self.mmentry.CC_DETECT_REPORT_CNF = self.mmentry.CC_DETECT_REPORT_CNF + self.mmentryFields.glidsInfo.glidsInfo[self.i]
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CC_DETECT_REPORT_CNF
+ self.mmentryFields.mmtype = CC_DETECT_REPORT_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_WHO_RU_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_WHO_RU.REQ MME
+ def createCC_WHO_RU_REQ_MMENTRY(self, mySecurityLevel=None, myNidOffset=None, myNid=None):
+ print "CC_WHO_RU.REQ ="
+ #CC_WHO_RU_REQ_MMENTRY is composed by 1 fields :
+ # - NID
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentry.CC_WHO_RU_REQ = self.mmentryFields.nidField
+ self.mmentryFields.mmentry = self.mmentry.CC_WHO_RU_REQ
+ self.mmentryFields.mmtype = CC_WHO_RU_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_WHO_RU_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_WHO_RU.CNF MME
+ def createCC_WHO_RU_CNF_MMENTRY(self, mySecurityLevel=None, myNidOffset=None, myNid=None, myCmac=None, myHfid=None):
+ print "CC_WHO_RU.CNF ="
+ #CC_WHO_RU_CNF_MMENTRY is composed by 3 fields :
+ # - NID
+ # - CMAC
+ # - HFID
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createCmac(myCmac)
+ self.mmentryFields.createHfid(myHfid)
+ self.mmentry.CC_WHO_RU_CNF = self.mmentryFields.nidField + self.mmentryFields.cmacField + self.mmentryFields.hfidField
+ self.mmentryFields.mmentry = self.mmentry.CC_WHO_RU_CNF
+ self.mmentryFields.mmtype = CC_WHO_RU_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ASSOC_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_ASSOC.REQ MME
+ def createCC_ASSOC_REQ_MMENTRY(self, myReqType=None, mySecurityLevel=None, myNidOffset=None, myNid=None, myCcoCapability=None, myProxyNetworkingCapability=None, myMmentry=None):
+ print "CC_ASSOC.REQ ="
+ #CC_ASSOC_REQ_MMENTRY is composed by 4 fields :
+ # - ReqType
+ # - NID
+ # - CCo Capability
+ # - Proxy Networking Capability
+ if myMmentry==None:
+ self.mmentryFields.createReqType(myReqType)
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createCcoCapability(myCcoCapability)
+ self.mmentryFields.createProxyNetworkingCapability(myProxyNetworkingCapability)
+ self.mmentry.CC_ASSOC_REQ = self.mmentryFields.reqTypeField + self.mmentryFields.nidField + self.mmentryFields.ccoCapabilityField + self.mmentryFields.proxyNetworkingCapabilityField
+ self.mmentryFields.mmentry = self.mmentry.CC_ASSOC_REQ
+ self.mmentryFields.mmtype = CC_ASSOC_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createReqType(myReqType=myMmentry[0])
+ self.mmentryFields.createNid(myNid=myMmentry[1:8])
+ self.mmentryFields.createCcoCapability(myCcoCapability=myMmentry[8])
+ self.mmentryFields.createProxyNetworkingCapability(myProxyNetworkingCapability=myMmentry[9:])
+
+
+ #createCC_ASSOC_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_ASSOC.CNF MME
+ def createCC_ASSOC_CNF_MMENTRY(self, myResult=None, mySecurityLevel=None, myNidOffset=None, myNid=None, mySnid=None, myAccess=None, mySnidAccess=None, myStaTei=None, myLeaseTime=None, myMmentry=None):
+ print "CC_ASSOC.CNF ="
+ #CC_ASSOC_CNF_MMENTRY is composed by 5 fields :
+ # - Result
+ # - NID
+ # - SNID
+ # - STA TEI
+ # - Lease Time
+ if myMmentry==None:
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createSnidAccess(mySnid, myAccess, mySnidAccess)
+ self.mmentryFields.createStaTei(myStaTei)
+ self.mmentryFields.createLeaseTime(myLeaseTime)
+ self.mmentry.CC_ASSOC_CNF = self.mmentryFields.resultField + self.mmentryFields.nidField + self.mmentryFields.snidAccessField + self.mmentryFields.staTeiField + self.mmentryFields.leaseTimeField
+ self.mmentryFields.mmentry = self.mmentry.CC_ASSOC_CNF
+ self.mmentryFields.mmtype = CC_ASSOC_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createResult(myResult=myMmentry[0])
+ self.mmentryFields.createNid(myNid=myMmentry[1:8])
+ self.mmentryFields.createSnidAccess(mySnidAccess=myMmentry[8])
+ self.mmentryFields.createStaTei(myStaTei=myMmentry[9])
+ self.mmentryFields.createLeaseTime(myLeaseTime=myMmentry[10:])
+
+
+ #createCC_LEAVE_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_LEAVE.REQ MME
+ def createCC_LEAVE_REQ_MMENTRY(self, myReason=None):
+ print "CC_LEAVE.REQ ="
+ #CC_LEAVE_REQ_MMENTRY is composed by 1 fields :
+ # - Reason
+ self.mmentryFields.createReason(myReason)
+ self.mmentry.CC_LEAVE_REQ = self.mmentryFields.reasonField
+ self.mmentryFields.mmentry = self.mmentry.CC_LEAVE_REQ
+ self.mmentryFields.mmtype = CC_LEAVE_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_LEAVE.CNF has no MMENTRY
+ def createCC_LEAVE_CNF_MMENTRY(self):
+ print "CC_LEAVE.CNF ="
+ #CC_LEAVE_CNF_MMENTRY is composed by 0 field :
+ self.mmentry.CC_LEAVE_CNF = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_LEAVE_CNF
+ self.mmentryFields.mmtype = CC_LEAVE_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_LEAVE_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_LEAVE.IND MME
+ def createCC_LEAVE_IND_MMENTRY(self, myReason=None, mySecurityLevel=None, myNidOffset=None, myNid=None):
+ print "CC_LEAVE.IND ="
+ #CC_LEAVE_IND_MMENTRY is composed by 2 fields :
+ # - Reason
+ # - NID
+ self.mmentryFields.createReason(myReason)
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentry.CC_LEAVE_IND = self.mmentryFields.reasonField + self.mmentryFields.nidField
+ self.mmentryFields.mmentry = self.mmentry.CC_LEAVE_IND
+ self.mmentryFields.mmtype = CC_LEAVE_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_LEAVE.RSP has no MMENTRY
+ def createCC_LEAVE_RSP_MMENTRY(self):
+ print "CC_LEAVE.RSP ="
+ #CC_LEAVE_RSP_MMENTRY is composed by 0 field :
+ self.mmentry.CC_LEAVE_RSP = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_LEAVE_RSP
+ self.mmentryFields.mmtype = CC_LEAVE_RSP
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_SET_TEI_MAP.REQ has no MMENTRY
+ def createCC_SET_TEI_REQ_MMENTRY(self):
+ print "CC_SET_TEI.REQ ="
+ #CC_SET_TEI_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CC_SET_TEI_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_SET_TEI_REQ
+ self.mmentryFields.mmtype = CC_SET_TEI_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_SET_TEI_MAP_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_SET_TEI_MAP.IND MME
+ def createCC_SET_TEI_MAP_IND_MMENTRY(self, myMode=None, myNum=0, myTei=None, myAddr=None, myStatus=None, myMmentry=None):
+ print "CC_SET_TEI_MAP.IND ="
+ #CC_SET_TEI_MAP_IND_MMENTRY is composed by 3 fields :
+ # - Mode
+ # - Num
+ # - TEI + MAC Address + Status -*Num-
+ if myMmentry==None:
+ self.mmentryFields.createMode(myMode)
+ self.mmentryFields.createTeisAddrsStatuses(myNum, myTei, myAddr, myStatus)
+ self.mmentry.CC_SET_TEI_MAP_IND = self.mmentryFields.modeField + self.mmentryFields.numField
+ self.i=0
+ while self.i<self.mmentryFields.num:
+ self.mmentry.CC_SET_TEI_MAP_IND = self.mmentry.CC_SET_TEI_MAP_IND + self.mmentryFields.teisAddrsStatuses[self.i]
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CC_SET_TEI_MAP_IND
+ self.mmentryFields.mmtype = CC_SET_TEI_MAP_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createMode(myMode=myMmentry[0])
+ self.mmentryFields.createTeisAddrsStatuses(myNum=myMmentry[1], myTei=myMmentry[2:], myAddr=myMmentry[3:], myStatus=myMmentry[9:])
+
+
+ #createCC_RELAY_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_RELAY.REQ MME
+ def createCC_RELAY_REQ_MMENTRY(self, myFda=None, myFTei=None, myPayload=None):
+ print "CC_RELAY.REQ ="
+ #CC_RELAY_REQ_MMENTRY is composed by 4 fields :
+ # - FDA
+ # - FTEI
+ # - Length
+ # - Payload
+ self.mmentryFields.createFda(myFda)
+ self.mmentryFields.createFTei(myFTei)
+ self.mmentryFields.createPayload(myPayload)
+ self.mmentryFields.createLength()
+ self.mmentry.CC_RELAY_REQ = self.mmentryFields.fdaField + self.mmentryFields.fTeiField + self.mmentryFields.lengthField + self.mmentryFields.payload
+ self.mmentryFields.mmentry = self.mmentry.CC_RELAY_REQ
+ self.mmentryFields.mmtype = CC_RELAY_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_RELAY_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_RELAY.IND MME
+ def createCC_RELAY_IND_MMENTRY(self, myOda=None, myOTei=None, myPayload=None):
+ print "CC_RELAY.IND ="
+ #CC_RELAY_IND_MMENTRY is composed by 4 fields :
+ # - ODA
+ # - OTEI
+ # - Length
+ # - Payload
+ self.mmentryFields.createOda(myOda)
+ self.mmentryFields.createOTei(myOTei)
+ self.mmentryFields.createPayload(myPayload)
+ self.mmentryFields.createLength()
+ self.mmentry.CC_RELAY_IND = self.mmentryFields.odaField + self.mmentryFields.oTeiField + self.mmentryFields.lengthField + self.mmentryFields.payload
+ self.mmentryFields.mmentry = self.mmentry.CC_RELAY_IND
+ self.mmentryFields.mmtype = CC_RELAY_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_BEACON_RELIABILITY.REQ has no MMENTRY
+ def createCC_BEACON_RELIABILITY_REQ_MMENTRY(self):
+ print "CC_BEACON_RELIABILITY.REQ ="
+ #CC_BEACON_RELIABILITY_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CC_BEACON_RELIABILITY_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_BEACON_RELIABILITY_REQ
+ self.mmentryFields.mmtype = CC_BEACON_RELIABILITY_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_BEACON_RELIABILITY_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_BEACON_RELIABILITY.CNF MME
+ def createCC_BEACON_RELIABILITY_CNF_MMENTRY(self, myNbp=None, myNmb=None):
+ print "CC_BEACON_RELIABILITY.CNF ="
+ #CC_BEACON_RELIABILITY_CNF_MMENTRY is composed by 2 fields :
+ # - Number of beacon periods
+ # - Number of missed beacons
+ self.mmentryFields.createNbp(myNbp)
+ self.mmentryFields.createNmb(myNmb)
+ self.mmentry.CC_BEACON_RELIABILITY_CNF = self.mmentryFields.nbpField + self.mmentryFields.nmbField
+ self.mmentryFields.mmentry = self.mmentry.CC_BEACON_RELIABILITY_CNF
+ self.mmentryFields.mmtype = CC_BEACON_RELIABILITY_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ALLOC_MOVE_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_ALLOC_MOVE.REQ MME
+ def createCC_ALLOC_MOVE_REQ_MMENTRY(self, myTei=None, myLlidF=None, myGlidF=None, myGlidR=None, myNumF=None, myEndTimeF=None, myIntBleF=None, myNumR=None, myEndTimeR=None, myIntBleR=None):
+ print "CC_ALLOC_MOVE.REQ ="
+ #CC_ALLOC_MOVE_REQ_MMENTRY is composed by 5 fields :
+ # - CID
+ # - GLID-F
+ # - GLID-R
+ # - Forward Link Bit Loading Estimates
+ # - Reverse Link Bit Loading Estimates
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createGlidF(myGlidF=None)
+ self.mmentryFields.createGlidR(myGlidR=None)
+ self.mmentry.CC_ALLOC_MOVE_REQ = self.mmentryFields.cidField + self.mmentryFields.glidFField + self.mmentryFields.glidRField
+ if self.mmentryFields.glidF in globalId:
+ self.mmentryFields.createForwardLinkBle(myNumF, myEndTimeF, myIntBleF)
+ self.mmentry.CC_ALLOC_MOVE_REQ = self.mmentry.CC_ALLOC_MOVE_REQ + self.mmentryFields.forwardLinkBle.ble
+ if self.mmentryFields.glidR in globalId:
+ self.mmentryFields.createReverseLinkBle(myNumR, myEndTimeR, myIntBleR)
+ self.mmentry.CC_ALLOC_MOVE_REQ = self.mmentry.CC_ALLOC_MOVE_REQ + self.mmentryFields.reverseLinkBle.ble
+ self.mmentryFields.mmentry = self.mmentry.CC_ALLOC_MOVE_REQ
+ self.mmentryFields.mmtype = CC_ALLOC_MOVE_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC__ALLOC_MOVE_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC__ALLOC_MOVE.CNF MME
+ def createCC_ALLOC_MOVE_CNF_MMENTRY(self, myTei=None, myLlidF=None, myResult=None):
+ print "CC__ALLOC_MOVE.CNF ="
+ #CC__ALLOC_MOVE_CNF_MMENTRY is composed by 2 fields :
+ # - CID
+ # - Result
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CC_LINK_SQZ_CNF = self.mmentryFields.cidField + self.mmentryFields.resultField
+ self.mmentryFields.mmentry = self.mmentry.CC_LINK_SQZ_CNF
+ self.mmentryFields.mmtype = CC_LINK_SQZ_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ACCESS_NEW_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_ACCESS_NEW.REQ MME
+ def createCC_ACCESS_NEW_REQ_MMENTRY(self, myStei=None, myDtei=None, myDAddr=None, myLlid=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None, myNum=None, myEndTime=None, myIntBle=None):
+ print "CC_ACCESS_NEW.REQ ="
+ #CC_ACCESS_NEW_REQ_MMENTRY is composed by 6 fields :
+ # - STEI
+ # - DTEI
+ # - DAddr
+ # - LLID
+ # - CSPEC
+ # - Bit Loading Estimates
+ self.mmentryFields.createStei(myStei)
+ self.mmentryFields.createDtei(myDtei)
+ self.mmentryFields.createDAddr(myDAddr)
+ self.mmentryFields.createLlid(myLlid)
+ self.mmentryFields.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentryFields.createBle(myNum, myEndTime, myIntBle)
+ self.mmentry.CC_ACCESS_NEW_REQ = self.mmentryFields.steiField + self.mmentryFields.dteiField + self.mmentryFields.dAddrField + self.mmentryFields.llidField + self.mmentryFields.cspecField + self.mmentryFields.bleField
+ self.mmentryFields.mmentry = self.mmentry.CC_ACCESS_NEW_REQ
+ self.mmentryFields.mmtype = CC_ACCESS_NEW_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+ #createCC_ACCESS_NEW_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_ACCESS_NEW.CNF MME
+ def createCC_ACCESS_NEW_CNF_MMENTRY(self, myResult=None, myLlid=None, myGcidF=None, myChanEstF=None, myGcidR=None, myChanEstR=None):
+ print "CC_ACCESS_NEW.CNF ="
+ #CC_ACCESS_NEW_CNF_MMENTRY is composed by 6 fields :
+ # - Result
+ # - LLID
+ # - GCID-F
+ # - ChanEstF
+ # - GCID-R
+ # - ChanEstR
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createLlid(myLlid)
+ self.mmentryFields.createGcidF(myGcidF)
+ self.mmentryFields.createChanEstF(myChanEstF)
+ self.mmentryFields.createGcidR(myGcidR)
+ self.mmentryFields.createChanEstR(myChanEstR)
+ self.mmentry.CC_ACCESS_NEW_CNF = self.mmentryFields.resultField + self.mmentryFields.llidField + self.mmentryFields.gcidFField + self.mmentryFields.chanEstFField + self.mmentryFields.gcidRField + self.mmentryFields.chanEstRField
+ self.mmentryFields.mmentry = self.mmentry.CC_ACCESS_NEW_CNF
+ self.mmentryFields.mmtype = CC_ACCESS_NEW_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ACCESS_NEW_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_ACCESS_NEW.IND MME
+ def createCC_ACCESS_NEW_IND_MMENTRY(self, myResult=None, myLlid=None, myGcidF=None, myChanEstF=None, myGcidR=None, myChanEstR=None, mySecurityLevel=None, myNidOffset=None, myNid=None):
+ print "CC_ACCESS_NEW.IND ="
+ #CC_ACCESS_NEW_IND_MMENTRY is composed by 6 fields :
+ # - Result
+ # - LLID
+ # - GCID-F
+ # - ChanEstF
+ # - GCID-R
+ # - ChanEstR
+ # - NID
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createLlid(myLlid)
+ self.mmentryFields.createGcidF(myGcidF)
+ self.mmentryFields.createChanEstF(myChanEstF)
+ self.mmentryFields.createGcidR(myGcidR)
+ self.mmentryFields.createChanEstR(myChanEstR)
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentry.CC_ACCESS_NEW_IND = self.mmentryFields.resultField + self.mmentryFields.llidField + self.mmentryFields.gcidFField + self.mmentryFields.chanEstFField + self.mmentryFields.gcidRField + self.mmentryFields.chanEstRField + self.mmentryFields.nidField
+ self.mmentryFields.mmentry = self.mmentry.CC_ACCESS_NEW_IND
+ self.mmentryFields.mmtype = CC_ACCESS_NEW_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ACCESS_NEW_RSP_MMENTRY creates
+ # the MMENTRY Field of the CC_ACCESS_NEW.RSP MME
+ def createCC_ACCESS_NEW_RSP_MMENTRY(self, myResult=None, myLlid=None, myGcidF=None, myGcidR=None, myNumF=None, myEndTimeF=None, myIntBleF=None, myNumR=None, myEndTimeR=None, myIntBleR=None):
+ print "CC_ACCESS_NEW.RSP ="
+ #CC_ACCESS_NEW_RSP_MMENTRY is composed by 6 fields :
+ # - Result
+ # - LLID
+ # - GCID-F
+ # - GCID-R
+ # - BLE-F
+ # - BLE-R
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createLlid(myLlid)
+ self.mmentryFields.createGcidF(myGcidF)
+ self.mmentryFields.createGcidR(myGcidR)
+ self.mmentryFields.createBleF(myNumF, myEndTimeF, myIntBleF)
+ self.mmentryFields.createBleR(myNumR, myEndTimeR, myIntBleR)
+ self.mmentry.CC_ACCESS_NEW_RSP = self.mmentryFields.resultField + self.mmentryFields.llidField + self.mmentryFields.gcidFField + self.mmentryFields.gcidRField + self.mmentryFields.bleFField + self.mmentryFields.bleRField
+ self.mmentryFields.mmentry = self.mmentry.CC_ACCESS_NEW_RSP
+ self.mmentryFields.mmtype = CC_ACCESS_NEW_RSP
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ACCESS_REL_REQ_MMENTRY creates
+ # the MMENTRY Field of the CC_ACCESS_REL.REQ MME
+ def createCC_ACCESS_REL_REQ_MMENTRY(self, myGcidF=None, myGcidR=None):
+ print "CC_ACCESS_REL.REQ ="
+ #CC_ACCESS_REL_REQ_MMENTRY is composed by 3 fields :
+ # - Cause
+ # - GCID-F
+ # - GCID-R
+ self.mmentryFields.createCause()
+ self.mmentryFields.createGcidF(myGcidF)
+ self.mmentryFields.createGcidR(myGcidR)
+ self.mmentry.CC_ACCESS_REL_REQ = self.mmentryFields.causeField + self.mmentryFields.gcidFField + self.mmentryFields.gcidRField
+ self.mmentryFields.mmentry = self.mmentry.CC_ACCESS_REL_REQ
+ self.mmentryFields.mmtype = CC_ACCESS_REL_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ACCESS_REL_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_ACCESS_REL.CNF MME
+ def createCC_ACCESS_REL_CNF_MMENTRY(self, myResult=None, myGcidF=None, myGcidR=None):
+ print "CC_ACCESS_REL.CNF ="
+ #CC_ACCESS_REL_CNF_MMENTRY is composed by 3 fields :
+ # - Result
+ # - GCID-F
+ # - GCID-R
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createGcidF(myGcidF)
+ self.mmentryFields.createGcidR(myGcidR)
+ self.mmentry.CC_ACCESS_REL_CNF = self.mmentryFields.resultField + self.mmentryFields.gcidFField + self.mmentryFields.gcidRField
+ self.mmentryFields.mmentry = self.mmentry.CC_ACCESS_REL_CNF
+ self.mmentryFields.mmtype = CC_ACCESS_REL_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ACCESS_REL_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_ACCESS_REL.IND MME
+ def createCC_ACCESS_REL_IND_MMENTRY(self, myGcidF=None, myGcidR=None):
+ print "CC_ACCESS_REL.IND ="
+ #CC_ACCESS_REL_IND_MMENTRY is composed by 3 fields :
+ # - Cause
+ # - GCID-F
+ # - GCID-R
+ self.mmentryFields.createCause()
+ self.mmentryFields.createGcidF(myGcidF)
+ self.mmentryFields.createGcidR(myGcidR)
+ self.mmentry.CC_ACCESS_REL_IND = self.mmentryFields.causeField + self.mmentryFields.gcidFField + self.mmentryFields.gcidRField
+ self.mmentryFields.mmentry = self.mmentry.CC_ACCESS_REL_IND
+ self.mmentryFields.mmtype = CC_ACCESS_REL_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_ACCESS_REL_RSP_MMENTRY creates
+ # the MMENTRY Field of the CC_ACCESS_REL.RSP MME
+ def createCC_ACCESS_REL_RSP_MMENTRY(self, myResult=None, myGcidF=None, myGcidR=None):
+ print "CC_ACCESS_REL.RSP ="
+ #CC_ACCESS_REL_RSP_MMENTRY is composed by 3 fields :
+ # - Result
+ # - GCID-F
+ # - GCID-R
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createGcidF(myGcidF)
+ self.mmentryFields.createGcidR(myGcidR)
+ self.mmentry.CC_ACCESS_REL_RSP = self.mmentryFields.resultField + self.mmentryFields.gcidFField + self.mmentryFields.gcidRField
+ self.mmentryFields.mmentry = self.mmentry.CC_ACCESS_REL_RSP
+ self.mmentryFields.mmtype = CC_ACCESS_REL_RSP
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_DCPPC_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_DCPPC.IND MME
+ def createCC_DCPPC_IND_MMENTRY(self, myDcppc=None):
+ print "CC_DCPPC.IND ="
+ #CC_DCPPC_IND_MMENTRY is composed by 1 fields :
+ # - DCPPC
+ self.mmentryFields.createDcppc(myDcppc)
+ self.mmentry.CC_DCPPC_IND = self.mmentryFields.dcppcField
+ self.mmentryFields.mmentry = self.mmentry.CC_DCPPC_IND
+ self.mmentryFields.mmtype = CC_DCPPC_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_DCPPC.RSP has no MMENTRY
+ def createCC_DCPPC_RSP_MMENTRY(self):
+ print "CC_DCPPC.RSP ="
+ #CC_DCPPC_RSP_MMENTRY is composed by 0 field :
+ self.mmentry.CC_DCPPC_RSP = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_DCPPC_RSP
+ self.mmentryFields.mmtype = CC_DCPPC_RSP
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CC_HP1_DET.REQ has no MMENTRY
+ def createCC_HP1_DET_REQ_MMENTRY(self):
+ print "CC_HP1_DET.REQ ="
+ #CC_HP1_DET_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CC_HP1_DET_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CC_HP1_DET_REQ
+ self.mmentryFields.mmtype = CC_HP1_DET_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_HP1_DET_CNF_MMENTRY creates
+ # the MMENTRY Field of the CC_HP1_DET.CNF MME
+ def createCC_HP1_DET_CNF_MMENTRY(self, myNbp=None, myNhp10=None, myNhp11=None):
+ print "CC_HP1_DET.CNF ="
+ #CC_HP1_DET_CNF_MMENTRY is composed by 3 fields :
+ # - NBP
+ # - NHP1.0
+ # - NHP1.1
+ self.mmentryFields.createNbp(myNbp)
+ self.mmentryFields.createNhp10(myNhp10)
+ self.mmentryFields.createNhp11(myNhp11)
+ self.mmentry.CC_HP1_DET_CNF = self.mmentryFields.nbpField + self.mmentryFields.nhp10Field + self.mmentryFields.nhp11Field
+ self.mmentryFields.mmentry = self.mmentry.CC_HP1_DET_CNF
+ self.mmentryFields.mmtype = CC_HP1_DET_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCC_BLE_UPDATE_IND_MMENTRY creates
+ # the MMENTRY Field of the CC_BLE_UPDATE.IND MME
+ def createCC_BLE_UPDATE_IND_MMENTRY(self, myGlids=None, myNum=None, myEndTime=None, myIntBle=None):
+ print "CC_BLE_UPDATE.IND ="
+ #CC_BLE_UPDATE_IND_MMENTRY is composed by 2 fields :
+ # - GLID
+ # - Bit Loading Estimates
+ myNumGlid=1
+ self.mmentryFields.createGlids(myNumGlid, myGlids)
+ self.mmentryFields.createBle(self, myNum, myEndTime, myIntBle)
+ self.mmentry.CC_BLE_UPDATE_IND = self.mmentryFields.glids.glidsField[0] + self.mmentryFields.bleField
+ self.mmentryFields.mmentry = self.mmentry.CC_BLE_UPDATE_IND
+ self.mmentryFields.mmtype = CC_BLE_UPDATE_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+
+ #----- Station - Station -----
+
+
+
+ #createCM_UNASSOCIATED_STA_IND_MMENTRY creates
+ # the MMENTRY Field of the CM_UNASSOCIATED_STA.IND MME
+ def createCM_UNASSOCIATED_STA_IND_MMENTRY(self, mySecurityLevel=None, myNidOffset=None, myNid=None, myCcoCapability=None, myMmentry=None):
+ print "CM_UNASSOCIATED_STA.IND ="
+ #CM_UNASSOCIATED_STA_IND_MMENTRY is composed by 2 fields :
+ # - NID
+ # - CCo Capability
+ if myMmentry==None:
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createCcoCapability(myCcoCapability)
+ self.mmentry.CM_UNASSOCIATED_STA_IND = self.mmentryFields.nidField + self.mmentryFields.ccoCapabilityField
+ self.mmentryFields.mmentry = self.mmentry.CM_UNASSOCIATED_STA_IND
+ self.mmentryFields.mmtype = CM_UNASSOCIATED_STA_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createNid(myNid = myMmentry[0:7])
+ self.mmentryFields.createCcoCapability(myCcoCapability = myMmentry[7:])
+
+
+ #createCM_ENCRYPTED_PAYLOAD_RSP_MMENTRY creates
+ # the MMENTRY Field of the CM_ENCRYPTED_PAYLOAD.RSP MME
+ def createCM_ENCRYPTED_PAYLOAD_RSP_MMENTRY(self, myResult=None, myPid=None, myPrn=None, myMmentry=None):
+ print "CM_ENCRYPTED_PAYLOAD.RSP ="
+ #CM_ENCRYPTED_PAYLOAD_RSP_MMENTRY is composed by 3 fields :
+ # - Result
+ # - PID
+ # - PRN
+ if myMmentry==None:
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createPid(myPid)
+ self.mmentryFields.createPrn(myPrn)
+ self.mmentry.CM_ENCRYPTED_PAYLOAD_RSP = self.mmentryFields.resultField + self.mmentryFields.pidField + self.mmentryFields.prnField
+ self.mmentryFields.mmentry = self.mmentry.CM_ENCRYPTED_PAYLOAD_RSP
+ self.mmentryFields.mmtype = CM_ENCRYPTED_PAYLOAD_RSP
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createResult(myResult=myMmentry[0])
+ self.mmentryFields.createPid(myPid=myMmentry[1])
+ self.mmentryFields.createPrn(myPrn=myMmentry[2:])
+
+ #createCM_SET_KEY_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_SET_KEY.REQ MME
+ def createCM_SET_KEY_REQ_MMENTRY(self, myKeyType=None, myMyNonce=None, myYourNonce=None, myPid=None, myPrn=None, myPmn=None, myPmnReset=False, myCcoCapability=None, mySecurityLevel=None, myNidOffset=None, myNid=None, myNewEks=None, myNewKey=None, myMmentry=None):
+ print "CM_SET_KEY.REQ ="
+ #CM_SET_KEY_REQ_MMENTRY is composed by 10 fields :
+ # - Key Type
+ # - My Nonce
+ # - Your Nonce
+ # - PID
+ # - PRN
+ # - PMN
+ # - CCo Capability
+ # - NID
+ # - New EKS
+ # - New KEY
+ if myMmentry==None:
+ self.mmentryFields.createKeyType(myKeyType)
+ self.mmentryFields.createMyNonce(myMyNonce)
+ self.mmentryFields.createYourNonce(myYourNonce)
+ self.mmentryFields.createPid(myPid)
+ self.mmentryFields.createPrn(myPrn)
+ self.mmentryFields.createPmn(myPmn, myPmnReset)
+ self.mmentryFields.createCcoCapability(myCcoCapability)
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createNewEks(myNewEks)
+ self.mmentryFields.createNewKey(myNewKey)
+ self.mmentry.CM_SET_KEY_REQ = self.mmentryFields.keyTypeField + self.mmentryFields.myNonceField + self.mmentryFields.yourNonceField + self.mmentryFields.pidField + self.mmentryFields.prnField + self.mmentryFields.pmnField + self.mmentryFields.ccoCapabilityField + self.mmentryFields.nidField + self.mmentryFields.newEksField + self.mmentryFields.newKeyField
+ self.mmentryFields.mmentry = self.mmentry.CM_SET_KEY_REQ
+ self.mmentryFields.mmtype = CM_SET_KEY_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createKeyType(myKeyType=myMmentry[0])
+ self.mmentryFields.createMyNonce(myMyNonce=myMmentry[1:5])
+ self.mmentryFields.createYourNonce(myYourNonce=myMmentry[5:9])
+ self.mmentryFields.createPid(myPid=myMmentry[9])
+ self.mmentryFields.createPrn(myPrn=myMmentry[10:12])
+ self.mmentryFields.createPmn(myPmn=myMmentry[12])
+ self.mmentryFields.createCcoCapability(myCcoCapability=myMmentry[13])
+ self.mmentryFields.createNid(myNid=myMmentry[14:21])
+ self.mmentryFields.createNewEks(myNewEks=myMmentry[21])
+ self.mmentryFields.createNewKey(myNewKey=myMmentry[22:])
+
+
+ #createCM_SET_KEY_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_SET_KEY.CNF MME
+ def createCM_SET_KEY_CNF_MMENTRY(self, myResult=None, myMyNonce=None, myYourNonce=None, myPid=None, myPrn=None, myPmn=None, myPmnReset=False, myCcoCapability=None, myMmentry=None):
+ print "CM_SET_KEY.CNF ="
+ #CM_SET_KEY_CNF_MMENTRY is composed by 7 fields :
+ # - Result
+ # - My Nonce
+ # - Your Nonce
+ # - PID
+ # - PRN
+ # - PMN
+ # - CCo Capability
+ if myMmentry==None:
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createMyNonce(myMyNonce)
+ self.mmentryFields.createYourNonce(myYourNonce)
+ self.mmentryFields.createPid(myPid)
+ self.mmentryFields.createPrn(myPrn)
+ self.mmentryFields.createPmn(myPmn, myPmnReset)
+ self.mmentryFields.createCcoCapability(myCcoCapability)
+ self.mmentry.CM_SET_KEY_CNF = self.mmentryFields.resultField + self.mmentryFields.myNonceField + self.mmentryFields.yourNonceField + self.mmentryFields.pidField + self.mmentryFields.prnField + self.mmentryFields.pmnField + self.mmentryFields.ccoCapabilityField
+ self.mmentryFields.mmentry = self.mmentry.CM_SET_KEY_CNF
+ self.mmentryFields.mmtype = CM_SET_KEY_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createResult(myResult=myMmentry[0])
+ self.mmentryFields.createMyNonce(myMyNonce=myMmentry[1:5])
+ self.mmentryFields.createYourNonce(myYourNonce=myMmentry[5:9])
+ self.mmentryFields.createPid(myPid=myMmentry[9])
+ self.mmentryFields.createPrn(myPrn=myMmentry[10:12])
+ self.mmentryFields.createPmn(myPmn=myMmentry[12])
+ self.mmentryFields.createCcoCapability(myCcoCapability=myMmentry[13:])
+
+
+ #createCM_GET_KEY_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_GET_KEY.REQ MME
+ def createCM_GET_KEY_REQ_MMENTRY(self, myRequestType=None, myRequestedKeyType=None, mySecurityLevel=None, myNidOffset=None, myNid=None, myMyNonce=None, myPid=None, myPrn=None, myPmn=None, myPmnReset=False, myHashKey=None, myMmentry=None):
+ print "CM_GET_KEY.REQ ="
+ #CM_GET_KEY_REQ_MMENTRY is composed by 8 fields :
+ # - Request Type
+ # - Requested Key Type
+ # - NID
+ # - My Nonce
+ # - PID
+ # - PRN
+ # - PMN
+ # - HASH KEY
+ if myMmentry==None:
+ self.mmentryFields.createRequestType(myRequestType)
+ self.mmentryFields.createRequestedKeyType(myRequestedKeyType)
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createMyNonce(myMyNonce)
+ self.mmentryFields.createPid(myPid)
+ self.mmentryFields.createPrn(myPrn)
+ self.mmentryFields.createPmn(myPmn, myPmnReset)
+ self.mmentry.CM_GET_KEY_REQ = self.mmentryFields.requestTypeField + self.mmentryFields.requestedKeyTypeField + self.mmentryFields.nidField + self.mmentryFields.myNonceField + self.mmentryFields.pidField + self.mmentryFields.prnField + self.mmentryFields.pmnField
+ if self.mmentryFields.requestedKeyType == 4:
+ self.mmentryFields.createHashKey(myHashKey)
+ self.mmentry.CM_GET_KEY_REQ = self.mmentry.CM_GET_KEY_REQ + self.mmentryFields.hashKeyField
+ self.mmentryFields.mmentry = self.mmentry.CM_GET_KEY_REQ
+ self.mmentryFields.mmtype = CM_GET_KEY_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createRequestType(myRequestType=myMmentry[0])
+ self.mmentryFields.createRequestedKeyType(myRequestedKeyType=myMmentry[1])
+ self.mmentryFields.createNid(myNid=myMmentry[2:9])
+ self.mmentryFields.createMyNonce(myMyNonce=myMmentry[9:13])
+ self.mmentryFields.createPid(myPid=myMmentry[13])
+ self.mmentryFields.createPrn(myPrn=myMmentry[14:16])
+ self.mmentryFields.createPmn(myPmn=myMmentry[16])
+ if self.mmentryFields.requestedKeyType == 4:
+ self.mmentryFields.createHashKey(myHashKey=myMmentry[17:])
+
+
+ #createCM_GET_KEY_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_GET_KEY.CNF MME
+ def createCM_GET_KEY_CNF_MMENTRY(self, myResult=None, myRequestedKeyType=None, myMyNonce=None, myYourNonce=None, mySecurityLevel=None, myNidOffset=None, myNid=None, myEks=None, myPid=None, myPrn=None, myPmn=None, myPmnReset=False, myKey=None, myHashKey=None, myMmentry=None):
+ print "CM_GET_KEY.CNF ="
+ #CM_GET_KEY_CNF_MMENTRY is composed by 10 fields :
+ # - Result
+ # - Requested Key Type
+ # - My Nonce
+ # - Your Nonce
+ # - NID
+ # - EKS
+ # - PID
+ # - PRN
+ # - PMN
+ # - Key
+ if myMmentry==None:
+ self.mmentryFields.createResult(myResult)
+ self.mmentryFields.createRequestedKeyType(myRequestedKeyType)
+ self.mmentryFields.createMyNonce(myMyNonce)
+ self.mmentryFields.createYourNonce(myYourNonce)
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createEks(myEks)
+ self.mmentryFields.createPid(myPid)
+ self.mmentryFields.createPrn(myPrn)
+ self.mmentryFields.createPmn(myPmn, myPmnReset)
+ self.mmentry.CM_GET_KEY_CNF = self.mmentryFields.resultField + self.mmentryFields.requestedKeyTypeField + self.mmentryFields.myNonceField + self.mmentryFields.yourNonceField + self.mmentryFields.nidField + self.mmentryFields.eksField + self.mmentryFields.pidField + self.mmentryFields.prnField + self.mmentryFields.pmnField
+ if self.mmentryFields.requestedKeyType == 4:
+ self.mmentryFields.createHashKey(myHashKey)
+ self.mmentry.CM_GET_KEY_CNF = self.mmentry.CM_GET_KEY_CNF + self.mmentryFields.hashKeyField
+ elif self.mmentryFields.requestedKeyType < 4:
+ self.mmentryFields.createKey(myKey)
+ self.mmentry.CM_GET_KEY_CNF = self.mmentry.CM_GET_KEY_CNF + self.mmentryFields.keyField
+ self.mmentryFields.mmentry = self.mmentry.CM_GET_KEY_CNF
+ self.mmentryFields.mmtype = CM_GET_KEY_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createResult(myResult=myMmentry[0])
+ self.mmentryFields.createRequestedKeyType(myRequestedKeyType=myMmentry[1])
+ self.mmentryFields.createMyNonce(myMyNonce=myMmentry[2:6])
+ self.mmentryFields.createYourNonce(myYourNonce=myMmentry[6:10])
+ self.mmentryFields.createNid(myNid=myMmentry[10:17])
+ self.mmentryFields.createEks(myEks=myMmentry[17])
+ self.mmentryFields.createPid(myPid=myMmentry[18])
+ self.mmentryFields.createPrn(myPrn=myMmentry[19:21])
+ self.mmentryFields.createPmn(myPmn=myMmentry[21])
+ if self.mmentryFields.requestedKeyType == 4:
+ self.mmentryFields.createHashKey(myHashKey=myMmentry[22:])
+ elif self.mmentryFields.requestedKeyType < 4:
+ self.mmentryFields.createKey(myKey=myMmentry[22:])
+
+
+ #createCM_SC_JOIN_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_SC_JOIN.REQ MME
+ def createCM_SC_JOIN_REQ_MMENTRY(self, myCcoCapability=None, myMmentry=None):
+ print "CM_SC_JOIN.REQ ="
+ #CM_SC_JOIN_REQ_MMENTRY is composed by 1 fields :
+ # - CCo Capability
+ if myMmentry==None:
+ self.mmentryFields.createCcoCapability(myCcoCapability)
+ self.mmentry.CM_SC_JOIN_REQ = self.mmentryFields.ccoCapabilityField
+ self.mmentryFields.mmentry = self.mmentry.CM_SC_JOIN_REQ
+ self.mmentryFields.mmtype = CM_SC_JOIN_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createCcoCapability(myCcoCapability=myMmentry)
+
+
+ #createCM_SC_JOIN_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_SC_JOIN.CNF MME
+ def createCM_SC_JOIN_CNF_MMENTRY(self, mySecurityLevel=None, myNidOffset=None, myNid=None, myAvlnStatus=None, myCcoCapability=None, myProxyNetworkCapability=None, myBackupCcoCapability=None, myCcoStatus=None, myPcoStatus=None, myBackupCcoStatus=None, myStatusesNCapabilities=None):
+ print "CM_SC_JOIN.CNF ="
+ #CM_SC_JOIN_CNF_MMENTRY is composed by 2 fields :
+ # - NID
+ # - Statuses and Capabilities
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createStatusesNCapabilities(myAvlnStatus, myCcoCapability, myProxyNetworkCapability, myBackupCcoCapability, myCcoStatus, myPcoStatus, myBackupCcoStatus, myStatusesNCapabilities)
+ self.mmentry.CM_SC_JOIN_CNF = self.mmentryFields.nidField + self.mmentryFields.statusesNCapabilitiesField
+ self.mmentryFields.mmentry = self.mmentry.CM_SC_JOIN_CNF
+ self.mmentryFields.mmtype = CM_SC_JOIN_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_AMP_MAP_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_AMP_MAP.CNF MME
+ def createCM_AMP_MAP_CNF_MMENTRY(self, myResType=None):
+ print "CM_AMP_MAP.CNF ="
+ #CM_AMP_MAP_CNF_MMENTRY is composed by 1 field :
+ # - ResType
+ self.mmentryFields.createResType(myResType)
+ self.mmentry.CM_AMP_MAP_CNF = self.mmentryFields.resTypeField
+ self.mmentryFields.mmentry = self.mmentry.CM_AMP_MAP_CNF
+ self.mmentryFields.mmtype = CM_AMP_MAP_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CM_BRG_INFO.REQ has no MMENTRY
+ def createCM_BRG_INFO_REQ_MMENTRY(self):
+ print "CM_BRG_INFO.REQ ="
+ #CM_BRG_INFO_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CM_BRG_INFO_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CM_BRG_INFO_REQ
+ self.mmentryFields.mmtype = CM_BRG_INFO_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_BRG_INFO_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_BRG_INFO.CNF MME
+ def createCM_BRG_INFO_CNF_MMENTRY(self, myBsf=None, myBtei=None, myNbda=0, myBda=None):
+ print "CM_BRG_INFO.CNF ="
+ #CM_BRG_INFO_CNF_MMENTRY is composed by 4 fields :
+ # - BSF
+ # - BIVF :
+ # - BTEI
+ # - NBDA
+ # - BAD -*NBDA-
+ self.mmentryFields.createBsf(myBsf)
+ self.mmentryFields.createBtei(myBtei)
+ self.mmentryFields.createNbda(myNbda)
+ self.mmentry.CM_BRG_INFO_CNF = self.mmentryFields.bsfField + self.mmentryFields.bteiField + self.mmentryFields.nbdaField
+ self.mmentryFields.createBdas(self.mmentryFields.nbda, myBda)
+ self.i=0
+ while self.i<self.mmentryFields.nbda:
+ self.mmentry.CM_BRG_INFO_CNF = self.mmentry.CM_BRG_INFO_CNF + self.mmentryFields.bdasField[self.i]
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CM_BRG_INFO_CNF
+ self.mmentryFields.mmtype = CM_BRG_INFO_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_CONN_NEW_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_CONN_NEW.REQ MME
+ def createCM_CONN_NEW_REQ_MMENTRY(self, myTei=None, myLlidF=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None, myClassifierRuleSetVersion=None, myNumberofClassifierRules=None, myClassifierRuleIdentifier=None, myClassifierRules=None):
+ print "CM_CONN_NEW.REQ ="
+ #CM_CONN_NEW_REQ_MMENTRY is composed by 6 fields :
+ # - CID
+ # - CSPEC
+ # - Classifier Rule Set
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentryFields.createClassifierRuleSetField(myClassifierRuleSetVersion, myNumberofClassifierRules, myClassifierRuleIdentifier, myClassifierRules)
+ self.mmentry.CM_CONN_NEW_REQ = self.mmentryFields.cidField + self.mmentryFields.cspecField + self.mmentryFields.classifierRuleSetField
+ self.mmentryFields.mmentry = self.mmentry.CM_CONN_NEW_REQ
+ self.mmentryFields.mmtype = CM_CONN_NEW_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_CHAN_EST_IND_MMENTRY creates
+ # the MMENTRY Field of the CM_CHAN_EST.IND MME
+ def createCM_CHAN_EST_IND_MMENTRY(self, myMaxFL_AV=None, myRifs_AV_OneSym=None, myRifs_AV_TwoSym=None, myRifs_AV_G2Sym=None, myRespt=None, myMaxtm=None, myCp_TMI_AV=None, myScl_CP=None, myScl_CFP=None, myNtmi_AV=None, myTmi_AV=None, myNint=None, myRandomEt=False, myInt_TMI_AV=None, myRandomInt_TMI_AV=False, myNewTMI_AV=None, myCpf=None, myFecType=None, myGil=None, myCbd_Enc=None, myCbd_Len=None, myCbd=None):
+ print "CM_CHAN_EST.IND ="
+ #CM_CHAN_EST_IND_MMENTRY is composed by 22 fields :
+ # - MaxFL_AV
+ # - Rifs_AV_OneSym
+ # - Rifs_AV_TwoSym
+ # - Rifs_AV_G2Sym
+ # - Respt
+ # - Maxtm
+ # - Cp_TMI_AV
+ # - Scl_CP
+ # - Scl_CFP
+ # - Ntmi_AV
+ # - Tmi_AV - *Ntmi_AV -
+ # - Nint
+ # - Et - Int_TMI_AV - *Nint -
+ # - NewTMI_AV
+ # - Cpf
+ # - FecType
+ # - Gil
+ # - Cbd_Enc
+ # - Cbd_Len
+ # - Cbd_Len
+ # - Cbd - *Cbd_Len -
+ self.mmentryFields.createMaxFL_AV(myMaxFL_AV)
+ self.mmentryFields.createRifs_AV_OneSym(myRifs_AV_OneSym)
+ self.mmentryFields.createRifs_AV_TwoSym(myRifs_AV_TwoSym)
+ self.mmentryFields.createRifs_AV_G2Sym(myRifs_AV_G2Sym)
+ self.mmentryFields.createRespt(myRespt)
+ self.mmentryFields.createMaxtm(myMaxtm)
+ self.mmentryFields.createCp_TMI_AV(myCp_TMI_AV)
+ self.mmentryFields.createScl_CP(myScl_CP)
+ self.mmentryFields.createScl_CFP(myScl_CFP)
+ self.mmentryFields.createTmi_AV(myNtmi_AV, myTmi_AV)
+ self.mmentryFields.createEtNInt_TMI_AV(myNint, myRandomEt, myInt_TMI_AV, myRandomInt_TMI_AV)
+ self.mmentryFields.createNewTMI_AV(myNewTMI_AV)
+ self.mmentryFields.createCpf(myCpf)
+ self.mmentryFields.createFecType(myFecType)
+ self.mmentryFields.createGil(myGil)
+ self.mmentryFields.createCbd_Enc(myCbd_Enc)
+ self.mmentryFields.createCbd(myCbd_Len, myCbd)
+ self.mmentry.CM_CHAN_EST_IND = self.mmentryFields.maxFL_AVField + self.mmentryFields.rifs_AV_OneSymField + self.mmentryFields.rifs_AV_TwoSymField + self.mmentryFields.rifs_AV_G2SymField + self.mmentryFields.resptField + self.mmentryFields.maxtmField + self.mmentryFields.cp_TMI_AVField + self.mmentryFields.scl_CPField + self.mmentryFields.scl_CFPField + self.mmentryFields.ntmi_AVField
+ self.i=0
+ while self.i<self.mmentryFields.ntmi_AV:
+ self.mmentry.CM_CHAN_EST_IND = self.mmentry.CM_CHAN_EST_IND + self.mmentryFields.tmi_AVsField[self.i]
+ self.i=self.i+1
+ self.mmentry.CM_CHAN_EST_IND = self.mmentry.CM_CHAN_EST_IND + self.mmentryFields.nintField
+ self.i=0
+ while self.i<self.mmentryFields.nint:
+ self.mmentry.CM_CHAN_EST_IND = self.mmentry.CM_CHAN_EST_IND + self.mmentryFields.etsField[self.i] + self.mmentryFields.int_TMI_AVsField[self.i]
+ self.i=self.i+1
+ self.mmentry.CM_CHAN_EST_IND = self.mmentry.CM_CHAN_EST_IND + self.mmentryFields.newTMI_AVField + self.mmentryFields.cpfField + self.mmentryFields.fecTypeField + self.mmentryFields.gilField + self.mmentryFields.cbd_EncField + self.mmentryFields.cbd_LenField
+ self.i=0
+ while self.i<(self.mmentryFields.cbd_Len + (self.mmentryFields.cbd_Len % 2))/2:
+ self.mmentry.CM_CHAN_EST_IND = self.mmentry.CM_CHAN_EST_IND + self.mmentryFields.cbdsField[self.i]
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CM_CHAN_EST_IND
+ self.mmentryFields.mmtype = CM_CHAN_EST_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+ #createCM_TM_UPDATE_IND_MMENTRY creates
+ # the MMENTRY Field of the CM_TM_UPDATE.IND MME
+ def createCM_TM_UPDATE_IND_MMENTRY(self, myCp_TMI_AV=None, myNtmi_AV=None, myTmi_AV=None, myNint=None, myRandomEt=False, myInt_TMI_AV=None, myRandomInt_TMI_AV=False, myOldTMI_AV=None, myNewTMI_AV=None, myCpf=None, myFecType=None, myGil=None, myCbud_Len=None, myCbudModulation=None):
+ print "CM_TM_UPDATE.IND ="
+ #CM_TM_UPDATE_IND_MMENTRY is composed by 13 fields :
+ # - Cp_TMI_AV
+ # - Ntmi_AV
+ # - Tmi_AV - *Ntmi_AV -
+ # - Nint
+ # - Et - Int_TMI_AV - *Nint -
+ # - OldTMI_AV
+ # - NewTMI_AV
+ # - Cpf
+ # - FecType
+ # - Gil
+ # - Cbud_Len
+ # - Cbud - *Cbud_Len -
+ self.mmentryFields.createCp_TMI_AV(myCp_TMI_AV)
+ self.mmentryFields.createTmi_AV(myNtmi_AV, myTmi_AV)
+ self.mmentryFields.createEtNInt_TMI_AV(myNint, myRandomEt, myInt_TMI_AV, myRandomInt_TMI_AV)
+ self.mmentryFields.createOldTMI_AV(myOldTMI_AV)
+ self.mmentryFields.createNewTMI_AV(myNewTMI_AV)
+ self.mmentryFields.createCpf(myCpf)
+ self.mmentryFields.createFecType(myFecType)
+ self.mmentryFields.createGil(myGil)
+ self.mmentryFields.createCbud(myCbud_Len, myCbudModulation)
+ self.mmentry.CM_TM_UPDATE_IND = self.mmentryFields.cp_TMI_AVField + self.mmentryFields.ntmi_AVField
+ self.i=0
+ while self.i<self.mmentryFields.ntmi_AV:
+ self.mmentry.CM_TM_UPDATE_IND = self.mmentry.CM_TM_UPDATE_IND + self.mmentryFields.tmi_AVsField[self.i]
+ self.i=self.i+1
+ self.mmentry.CM_TM_UPDATE_IND = self.mmentry.CM_TM_UPDATE_IND + self.mmentryFields.nintField
+ self.i=0
+ while self.i<self.mmentryFields.nint:
+ self.mmentry.CM_TM_UPDATE_IND = self.mmentry.CM_TM_UPDATE_IND + self.mmentryFields.etsField[self.i] + self.mmentryFields.int_TMI_AVsField[self.i]
+ self.i=self.i+1
+ self.mmentry.CM_TM_UPDATE_IND = self.mmentry.CM_TM_UPDATE_IND + self.mmentryFields.oldTMI_AVField + self.mmentryFields.newTMI_AVField + self.mmentryFields.cpfField + self.mmentryFields.fecTypeField + self.mmentryFields.gilField + self.mmentryFields.cbud_LenField
+ self.i=0
+ while self.i<self.mmentryFields.cbud_Len:
+ self.mmentry.CM_TM_UPDATE_IND = self.mmentry.CM_TM_UPDATE_IND + self.mmentryFields.cbudsField[self.i]
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CM_TM_UPDATE_IND
+ self.mmentryFields.mmtype = CM_TM_UPDATE_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY creates
+ # the MMENTRY Field of the CM_ENCRYPTED_PAYLOAD.IND MME
+ def createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(self, myPeks=None, myAvlnStatus=None, myPid=None, myPrn=None, myPmn=None, myIvOrUuid=None, myIvOrUuidRandom=False, myRandomFillerEncrypted=None, myOda=None, myOsa=None, myVlanTag=None, myMtype=None, myMmv=None, myMmtype=None, myNfmi=None, myFnMi=None, myFmsn=None, myMmentry=None, myEncapsulatedMmEntry="ToEncrypt", myMmOrHlePayloadEncrypted=None, myCrcEncrypted=None, myPidEncrypted=None, myPrnEncrypted=None, myRandomPrn=None, myPmnEncrypted=None, myPaddingEncrypted=None, myRfLenEncrypted=None, myKey=None, myEncryptedFields=None):
+ print "CM_ENCRYPTED_PAYLOAD.IND ="
+ #CM_ENCRYPTED_PAYLOAD_IND_MMENTRY is composed by 15 fields :
+ # - Peks
+ # - AvlnStatus
+ # - Pid
+ # - Prn
+ # - Pmn
+ # - IV or UUID
+ # - LengthForEncryption
+ # - RandomFillerEncrypted
+ # - MmOrHlePayloadEncrypted
+ # - CrcEncrypted
+ # - PidEncrypted
+ # - PrnEncrypted
+ # - PmnEncrypted
+ # - PaddingEncrypted
+ # - RfLenEncrypted
+ if myEncryptedFields == None:
+ self.mmentryFields.createPeks(myPeks)
+ self.mmentryFields.createAvlnStatus(myAvlnStatus)
+ self.mmentryFields.createPid(myPid)
+ self.mmentryFields.createPrn(myPrn)
+ self.mmentryFields.createPmn(myPmn)
+ self.mmentry.CM_ENCRYPTED_PAYLOAD_IND = self.mmentryFields.peksField + self.mmentryFields.avlnStatusField + self.mmentryFields.pidField + self.mmentryFields.prnField + self.mmentryFields.pmnField
+ if self.mmentryFields.pid==4:
+ self.mmentryFields.createUuid(myIvOrUuid, myIvOrUuidRandom)
+ self.mmentryFields.createMmOrHlePayloadEncrypted(self.mmentryFields.pid, myMmOrHlePayloadEncrypted)
+ self.mmentryFields.createLengthForEncryption()
+ self.mmentry.CM_ENCRYPTED_PAYLOAD_IND = self.mmentry.CM_ENCRYPTED_PAYLOAD_IND + self.mmentryFields.uuidField + self.mmentryFields.lengthForEncryptionField + self.mmentryFields.mmOrHlePayloadEncryptedField
+ else:
+ self.mmentry.CM_ENCRYPTED_PAYLOAD_IND = self.mmentry.CM_ENCRYPTED_PAYLOAD_IND + self.mmentryFields.createEncryptedFields(myIvOrUuid, myIvOrUuidRandom, myRandomFillerEncrypted, myOda, myOsa, myVlanTag, myMtype, myMmv, myMmtype, myNfmi, myFnMi, myFmsn, myMmentry, myEncapsulatedMmEntry, myMmOrHlePayloadEncrypted, myCrcEncrypted, myPidEncrypted, myPrnEncrypted, myRandomPrn, myPmnEncrypted, myPaddingEncrypted, myRfLenEncrypted, myKey, myEncryptedFields)
+ self.mmentryFields.mmentry = self.mmentry.CM_ENCRYPTED_PAYLOAD_IND
+ self.mmentryFields.mmtype = CM_ENCRYPTED_PAYLOAD_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createPeks(myEncryptedFields[0])
+ self.mmentryFields.createAvlnStatus(myEncryptedFields[1])
+ self.mmentryFields.createPid(myEncryptedFields[2])
+ self.mmentryFields.createPrn(myEncryptedFields[3:5])
+ self.mmentryFields.createPmn(myEncryptedFields[5])
+ if self.mmentryFields.pid==4:
+ self.mmentryFields.createUuid(myEncryptedFields[6:22])
+ self.mmentryFields.createLengthForEncryption(myEncryptedFields[22:24])
+ self.mmentryFields.createMmOrHlePayloadEncrypted(myEncryptedFields[24:])
+ else:
+ self.mmentryFields.createEncryptedFields(myKey=myKey,myEncryptedFields=myEncryptedFields[6:])
+
+
+ #createCM_MME_ERROR_IND_MMENTRY creates
+ # the MMENTRY Field of the CM_MME_ERROR.IND MME
+ def createCM_MME_ERROR_IND_MMENTRY(self, myReasonCode=None, myRx_MMV=None, myRx_MMTYPE=None, myInvalidByteOffset=None, myMmentry=None):
+ print "CM_MME_ERROR.IND ="
+ #CM_MME_ERROR_IND_MMENTRY is composed by 4 fields :
+ # - ReasonCode
+ # - Rx_MMV
+ # - Rx_MMTYPE
+ # - InvalidByteOffset
+ if myMmentry==None:
+ self.mmentryFields.createReasonCode(myReasonCode)
+ self.mmentryFields.createRx_MMV(myRx_MMV)
+ self.mmentryFields.createRx_MMTYPE(myRx_MMTYPE)
+ self.mmentryFields.createInvalidByteOffset(myInvalidByteOffset)
+ self.mmentry.CM_MME_ERROR_IND = self.mmentryFields.reasonCodeField + self.mmentryFields.rx_MMVField + self.mmentryFields.rx_MMTYPEField + self.mmentryFields.invalidByteOffsetField
+ self.mmentryFields.mmentry = self.mmentry.CM_MME_ERROR_IND
+ self.mmentryFields.mmtype = CM_MME_ERROR_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+ else:
+ self.mmentryFields.createReasonCode(myReasonCode=myMmentry[0])
+ self.mmentryFields.createRx_MMV(myRx_MMV=myMmentry[1])
+ self.mmentryFields.createRx_MMTYPE(myRx_MMTYPE=myMmentry[2:4])
+ self.mmentryFields.createInvalidByteOffset(myInvalidByteOffset=myMmentry[4:])
+
+
+ #createCM_CONN_NEW_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_CONN_NEW.CNF MME
+ def createCM_CONN_NEW_CNF_MMENTRY(self, myTei=None, myLlidF=None, myLlidR=None, myResult=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CM_CONN_NEW.CNF ="
+ #CM_CONN_NEW_CNF_MMENTRY is composed by 4 fields :
+ # - CID
+ # - LLID-R
+ # - Result
+ # - Proposed CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createLlidR(myLlidR)
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CM_CONN_NEW_CNF = self.mmentryFields.cidField + self.mmentryFields.llidRField + self.mmentryFields.resultField
+ if self.mmentryFields.result == 4 :
+ self.mmentryFields.createProposedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CM_CONN_NEW_CNF = self.mmentry.CM_CONN_NEW_CNF + self.mmentryFields.proposedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CM_CONN_NEW_CNF
+ self.mmentryFields.mmtype = CM_CONN_NEW_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_CONN_REL_IND_MMENTRY creates
+ # the MMENTRY Field of the CM_CONN_REL.IND MME
+ def createCM_CONN_REL_IND_MMENTRY(self, myTei=None, myLlidF=None, myReasonCode=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CM_CONN_REL.IND ="
+ #CM_CONN_REL_IND_MMENTRY is composed by 3 fields :
+ # - CID
+ # - Reason Code
+ # - Violated CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createReasonCode(myReasonCode)
+ self.mmentry.CM_CONN_REL_IND = self.mmentryFields.cidField + self.mmentryFields.reasonCodeField
+ if self.mmentryFields.reasonCode == 1 :
+ self.mmentryFields.createViolatedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CM_CONN_REL_IND = self.mmentry.CM_CONN_REL_IND + self.mmentryFields.violatedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CM_CONN_REL_IND
+ self.mmentryFields.mmtype = CM_CONN_REL_IND
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_CONN_REL_RSP_MMENTRY creates
+ # the MMENTRY Field of the CM_CONN_REL.RSP MME
+ def createCM_CONN_REL_RSP_MMENTRY(self, myTei=None, myLlidF=None):
+ print "CM_CONN_REL.RSP ="
+ #CM_CONN_REL_RSP_MMENTRY is composed by 1 fields :
+ # - CID
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentry.CM_CONN_REL_RSP = self.mmentryFields.cidField
+ self.mmentryFields.mmentry = self.mmentry.CM_CONN_REL_RSP
+ self.mmentryFields.mmtype = CM_CONN_REL_RSP
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_CONN_MOD_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_CONN_MOD.REQ MME
+ def createCM_CONN_MOD_REQ_MMENTRY(self, myTei=None, myLlidF=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CM_CONN_MOD.REQ ="
+ #CM_CONN_MOD_REQ_MMENTRY is composed by 2 fields :
+ # - CID
+ # - Modified CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createModifiedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CM_CONN_MOD_REQ = self.mmentryFields.cidField + self.mmentryFields.modifiedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CM_CONN_MOD_REQ
+ self.mmentryFields.mmtype = CM_CONN_MOD_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_CONN_MOD_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_CONN_MOD.CNF MME
+ def createCM_CONN_MOD_CNF_MMENTRY(self, myTei=None, myLlidF=None, myResult=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CM_CONN_MOD.CNF ="
+ #CM_CONN_MOD_CNF_MMENTRY is composed by 3 fields :
+ # - CID
+ # - Result
+ # - Proposed CSPEC
+ self.mmentryFields.createCid(myTei, myLlidF)
+ self.mmentryFields.createResult(myResult)
+ self.mmentry.CM_CONN_MOD_CNF = self.mmentryFields.cidField + self.mmentryFields.resultField
+ if self.mmentryFields.result == 1 :
+ self.mmentryFields.createProposedCspec(myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CM_CONN_MOD_CNF = self.mmentry.CM_CONN_MOD_CNF + self.mmentryFields.proposedCspecField
+ self.mmentryFields.mmentry = self.mmentry.CM_CONN_MOD_CNF
+ self.mmentryFields.mmtype = CM_CONN_MOD_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_CONN_INFO_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_CONN_INFO.REQ MME
+ def createCM_CONN_INFO_REQ_MMENTRY(self, myReqType=None, myTei=None, myLlidF=None, myGlids=None):
+ print "CM_CONN_INFO.REQ ="
+ #CM_CONN_INFO_REQ_MMENTRY is composed by 3 fields :
+ # - ReqType
+ # - CID
+ # - GLID
+ self.mmentryFields.createReqType(myReqType)
+ self.mmentryFields.createCid(myTei, myLlidF)
+ myNumGlid=1
+ self.mmentryFields.createGlids(myNumGlid, myGlids)
+ self.mmentry.CM_CONN_INFO_REQ = self.mmentryFields.reqTypeField + self.mmentryFields.cidField + self.mmentryFields.glids.glidsField[0]
+ self.mmentryFields.mmentry = self.mmentry.CM_CONN_INFO_REQ
+ self.mmentryFields.mmtype = CM_CONN_INFO_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_CONN_INFO_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_CONN_INFO.CNF MME
+ def createCM_CONN_INFO_CNF_MMENTRY(self, myNumConn=0, myTei=None, myLlidF=None, myStei=None, myDtei=None, myLidF=None, myLidR=None, myCsepcLen=None, myValidF=None, myMacServiceTypeF=None, myUserPriorityF=None, myAtsF=None, mySmoothingF=None, myValidR=None, myMacServiceTypeR=None, myUserPriorityR=None, myAtsR=None, mySmoothingR=None, myFRF=None, myFidF=None, qmpParam1F=None, qmpParam2F=None, qmpParam3F=None, qmpParam4F=None, qmpParam5F=None, qmpParam6F=None, myFRR=None, myFidR=None, qmpParam1R=None, qmpParam2R=None, qmpParam3R=None, qmpParam4R=None, qmpParam5R=None, qmpParam6R=None):
+ print "CM_CONN_INFO.CNF ="
+ #CM_CONN_INFO_CNF_MMENTRY is composed by 2 fields :
+ # - NumConn
+ # - Connection Informations -* NumConn-
+ self.mmentryFields.createConnInfos(myNumConn, myTei, myLlidF, myStei, myDtei, myLidF, myLidR, myCsepcLen, myValidF, myMacServiceTypeF, myUserPriorityF, myAtsF, mySmoothingF, myValidR, myMacServiceTypeR, myUserPriorityR, myAtsR, mySmoothingR, myFRF, myFidF, qmpParam1F, qmpParam2F, qmpParam3F, qmpParam4F, qmpParam5F, qmpParam6F, myFRR, myFidR, qmpParam1R, qmpParam2R, qmpParam3R, qmpParam4R, qmpParam5R, qmpParam6R)
+ self.mmentry.CM_CONN_INFO_CNF = self.mmentryFields.numConnField
+ self.i=0
+ while self.i<self.mmentryFields.numConn:
+ self.mmentry.CM_CONN_INFO_CNF = self.mmentry.CM_CONN_INFO_CNF + self.mmentryFields.connInfos[self.i].ConnInfo
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CM_CONN_INFO_CNF
+ self.mmentryFields.mmtype = CM_CONN_INFO_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CM_STA_CAP.REQ has no MMENTRY
+ def createCM_STA_CAP_REQ_MMENTRY(self):
+ print "CM_STA_CAP.REQ ="
+ #CM_STA_CAP_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CM_STA_CAP_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CM_STA_CAP_REQ
+ self.mmentryFields.mmtype = CM_STA_CAP_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_STA_CAP_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_STA_CAP.CNF MME
+ def createCM_STA_CAP_CNF_MMENTRY(self, myAvVersion=None, myMacAddress=None, myOui=None, myAutoConnect=None, mySmoothing=None, myCcoCapability=None, myProxyCapable=None, myBackupCcoCapable=None, mySoftHandOver=None, myTwoSymFc=None, myMaxFL_AV=None, myHomePlug11Cap=None, myHomePlug10Interop=None, myRegulatoryCap=None, myBidirectionalBursting=None, myImplementationVer=None):
+ print "CM_STA_CAP.CNF ="
+ #CM_STA_CAP_CNF_MMENTRY is composed by 4 fields :
+ # - avVersion
+ # - MacAddress
+ # - Oui
+ # - AutoConnect
+ # - Smoothing
+ self.mmentryFields.createAvVersion(myAvVersion)
+ self.mmentryFields.createMacAddress(myMacAddress)
+ self.mmentryFields.createOui(myOui)
+ self.mmentryFields.createAutoConnect(myAutoConnect)
+ self.mmentryFields.createSmoothing(mySmoothing)
+ self.mmentryFields.createCcoCapability(myCcoCapability)
+ self.mmentryFields.createProxyCapable(myProxyCapable)
+ self.mmentryFields.createBackupCcoCapable(myBackupCcoCapable)
+ self.mmentryFields.createSoftHandOver(mySoftHandOver)
+ self.mmentryFields.createTwoSymFc(myTwoSymFc)
+ self.mmentryFields.createMaxFL_AV(myMaxFL_AV)
+ self.mmentryFields.createHomePlug11Cap(myHomePlug11Cap)
+ self.mmentryFields.createHomePlug10Interop(myHomePlug10Interop)
+ self.mmentryFields.createRegulatoryCap(myRegulatoryCap)
+ self.mmentryFields.createBidirectionalBursting(myBidirectionalBursting)
+ self.mmentryFields.createImplementationVer(myImplementationVer)
+ self.mmentry.CM_STA_CAP_CNF = self.mmentryFields.reasonCodeField + self.mmentryFields.macAddressField + self.mmentryFields.ouiField + self.mmentryFields.autoConnectField + self.mmentryFields.smoothingField + self.mmentryFields.ccoCapabilityField + self.mmentryFields.proxyCapableField + self.mmentryFields.backupCcoCapableField + self.mmentryFields.softHandOverField + self.mmentryFields.twoSymFcField + self.mmentryFields.maxFL_AVField + self.mmentryFields.homePlug11CapField + self.mmentryFields.homePlug10InteropField + self.mmentryFields.regulatoryCapField + self.mmentryFields.bidirectionalBurstingField + self.mmentryFields.implementationVerField
+ self.mmentryFields.mmentry = self.mmentry.CM_STA_CAP_CNF
+ self.mmentryFields.mmtype = CM_STA_CAP_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CM_NW_INFO.REQ has no MMENTRY
+ def createCM_NW_INFO_REQ_MMENTRY(self):
+ print "CM_NW_INFO.REQ ="
+ #CM_NW_INFO_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CM_NW_INFO_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CM_NW_INFO_REQ
+ self.mmentryFields.mmtype = CM_NW_INFO_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_NW_INFO_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_NW_INFO.CNF MME
+ def createCM_NW_INFO_CNF_MMENTRY(self, myNumNws=None, mySecurityLevel=None, myNidOffset=None, myNid=None, mySnid=None, myTei=None, myStationRole=None, myCco_MacAddress=None, myAccess=None, myNumCordNws=None):
+ print "CM_NW_INFO.CNF ="
+ #CM_NW_INFO_CNF_MMENTRY is composed by 2 field :
+ # - NumNws
+ # - NwsInfo -*NumNws-
+ self.mmentryFields.createNwsInfo(myNumNws, mySecurityLevel, myNidOffset, myNid, mySnid, myTei, myStationRole, myCco_MacAddress, myAccess, myNumCordNws)
+ self.mmentry.CM_NW_INFO_CNF = self.mmentry.CM_NW_INFO_CNF + self.mmentryFields.numNwsField
+ self.i=0
+ while self.i<self.mmentryFields.numNws:
+ self.mmentry.CM_NW_INFO_CNF = self.mmentry.CM_NW_INFO_CNF + self.mmentryFields.nwsInfo[self.i].nwInfo
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CM_NW_INFO_CNF
+ self.mmentryFields.mmtype = CM_NW_INFO_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_GET_BEACON_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_GET_BEACON.REQ MME
+ def createCM_GET_BEACON_REQ_MMENTRY(self, mySecurityLevel=None, myNidOffset=None, myNid=None):
+ print "CM_GET_BEACON.REQ ="
+ #CM_GET_BEACON_REQ_MMENTRY is composed by 1 fields :
+ # - NID
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentry.CM_GET_BEACON_REQ = self.mmentryFields.nidField
+ self.mmentryFields.mmentry = self.mmentry.CM_GET_BEACON_REQ
+ self.mmentryFields.mmtype = CM_GET_BEACON_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_HFID_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_HFID.REQ MME
+ def createCM_HFID_REQ_MMENTRY(self, myReqType=None, mySecurityLevel=None, myNidOffset=None, myNid=None, myHfid=None):
+ print "CM_HFID.REQ ="
+ #CM_HFID_REQ_MMENTRY is composed by 3 fields :
+ # - ReqType
+ # - NID
+ # - HFID
+ self.mmentryFields.createReqType(myReqType)
+ self.mmentry.CM_HFID_REQ = self.mmentryFields.reqTypeField
+ if self.mmentryFields.reqType == 2 :
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentry.CM_HFID_REQ = self.mmentry.CM_HFID_REQ + self.mmentryFields.nidField
+ elif self.mmentryFields.reqType == 3 :
+ self.mmentryFields.createHfid(myHfid)
+ self.mmentry.CM_HFID_REQ = self.mmentry.CM_HFID_REQ + self.mmentryFields.hfidField
+ elif self.mmentryFields.reqType == 4 :
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createHfid(myHfid)
+ self.mmentry.CM_HFID_REQ = self.mmentry.CM_HFID_REQ + self.mmentryFields.nidField + self.mmentryFields.hfidField
+ self.mmentryFields.mmentry = self.mmentry.CM_HFID_REQ
+ self.mmentryFields.mmtype = CM_HFID_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_HFID_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_HFID.CNF MME
+ def createCM_HFID_CNF_MMENTRY(self, myResType=None, myHfid=None):
+ print "CM_HFID.CNF ="
+ #CM_HFID_CNF_MMENTRY is composed by 2 fields :
+ # - ResType
+ # - HFID
+ self.mmentryFields.createResType(myResType)
+ self.mmentryFields.createHfid(myHfid)
+ self.mmentry.CM_HFID_CNF = self.mmentryFields.resTypeField + self.mmentryFields.hfidField
+ self.mmentryFields.mmentry = self.mmentry.CM_HFID_CNF
+ self.mmentryFields.mmtype = CM_HFID_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #CM_NW_STATS.REQ has no MMENTRY
+ def createCM_NW_STATS_REQ_MMENTRY(self):
+ print "CM_NW_STATS.REQ ="
+ #CM_NW_STATS_REQ_MMENTRY is composed by 0 field :
+ self.mmentry.CM_NW_STATS_REQ = ""
+ self.mmentryFields.mmentry = self.mmentry.CM_NW_STATS_REQ
+ self.mmentryFields.mmtype = CM_NW_STATS_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_NW_STATS_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_NW_STATS.CNF MME
+ def createCM_NW_STATS_CNF_MMENTRY(self, myNumSta=0, myDa=None, myAvgPhyDR_Tx=None, myAvgPhyDR_Rx=None):
+ print "CM_NW_STATS.CNF ="
+ #CM_NW_STATS_CNF_MMENTRY is composed by 2 fields :
+ # - NumSta
+ # - TEI + AvgPhyDR_Tx + AvgPhyDR_Rx -*NumSta-
+ #self.mmentryFields.createNumSta(myNumSta)
+ self.mmentryFields.createDasAvgPhyDR_TxAvgPhyDR_Rx(myNumSta, myDa, myAvgPhyDR_Tx, myAvgPhyDR_Rx)
+ self.mmentry.CM_NW_STATS_CNF = self.mmentryFields.numStaField
+ self.i=0
+ while self.i<self.mmentryFields.numSta:
+ self.mmentry.CM_NW_STATS_CNF = self.mmentry.CM_NW_STATS_CNF + self.mmentryFields.dasAvgPhyDR_TxAvgPhyDR_Rx[self.i]
+ self.i=self.i+1
+ self.mmentryFields.mmentry = self.mmentry.CM_NW_STATS_CNF
+ self.mmentryFields.mmtype = CM_NW_STATS_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_LINK_STATS_REQ_MMENTRY creates
+ # the MMENTRY Field of the CM_LINK_STATS.REQ MME
+ def createCM_LINK_STATS_REQ_MMENTRY(self, myReqType=None, myReqId=None, mySecurityLevel=None, myNidOffset=None, myNid=None, myLid=None, myTlFlag=None, myMgmt_Flag=None, myDaSa=None):
+ print "CM_LINK_STATS.REQ ="
+ #CM_LINK_STATS_REQ_MMENTRY is composed by 7 fields :
+ # - ReqType
+ # - ReqId
+ # - NID
+ # - LID
+ # - TlFlag
+ # - Mgmt_Flag
+ # - DaSa
+ self.mmentryFields.createReqType(myReqType)
+ self.mmentryFields.createReqId(myReqId)
+ self.mmentryFields.createNid(mySecurityLevel, myNidOffset, myNid)
+ self.mmentryFields.createLid(myLid)
+ self.mmentryFields.createTlFlag(myTlFlag)
+ self.mmentryFields.createMgmt_Flag(myMgmt_Flag)
+ self.mmentryFields.createDaSa(myDaSa)
+ self.mmentry.CM_LINK_STATS_REQ = self.mmentryFields.reqTypeField + self.mmentryFields.reqIdField + self.mmentryFields.nidField + self.mmentryFields.lidField + self.mmentryFields.tlFlagField + self.mmentryFields.mgmt_FlagField + self.mmentryFields.daSaField
+ self.mmentryFields.mmentry = self.mmentry.CM_LINK_STATS_REQ
+ self.mmentryFields.mmtype = CM_LINK_STATS_REQ
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_LINK_STATS_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_LINK_STATS.CNF MME
+ def createCM_LINK_STATS_CNF_MMENTRY(self, myReqId=None, myResType=None, myRxTx=False, myBeaconPeriodCnt=None, myNumMsdus=None, myOctets=None, myNumSegs=None, myNumSeg_Suc=None, myNumSeg_Dropped=None, myNumSeg_Missed=None, myNumPbs=None, myNumMpdus=None, myNumBursts=None, myNumSacks=None, myNumIcvFails=None, myNumLatBins=0, myLatBinGran=None, myLatBin=None, myRandomLatBin=False): #Tx by default
+ print "CM_LINK_STATS.CNF ="
+ #CM_LINK_STATS_CNF_MMENTRY is composed by 3 fields :
+ # - ReqId
+ # - ResType
+ # - Tx or Rx MFS LinkStats
+ self.mmentryFields.createReqId(myReqId)
+ self.mmentryFields.createResType(myResType)
+ self.mmentry.CM_LINK_STATS_CNF = self.mmentryFields.resTypeField + self.mmentryFields.reqIdField
+ if myRxTx: #Rx
+ self.mmentryFields.createReceiveMfsLinkStats(myBeaconPeriodCnt, myNumMsdus, myOctets, myNumSeg_Suc, myNumSeg_Missed, myNumPbs, myNumBursts, myNumMpdus, myNumIcvFails)
+ self.mmentry.CM_LINK_STATS_CNF = self.mmentry.CM_LINK_STATS_CNF + self.mmentryFields.receiveMfsLinkStats
+ else: #Tx
+ self.mmentryFields.createTransmitMfsLinkStats(myBeaconPeriodCnt, myNumMsdus, myOctets, myNumSegs, myNumSeg_Suc, myNumSeg_Dropped, myNumPbs, myNumMpdus, myNumBursts, myNumSacks, myNumLatBins, myLatBinGran, myLatBin, myRandomLatBin)
+ self.mmentry.CM_LINK_STATS_CNF = self.mmentry.CM_LINK_STATS_CNF + self.mmentryFields.transmitMfsLinkStats
+ self.mmentryFields.mmentry = self.mmentry.CM_LINK_STATS_CNF
+ self.mmentryFields.mmtype = CM_LINK_STATS_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+ #createCM_GET_BEACON_CNF_MMENTRY creates
+ # the MMENTRY Field of the CM_GET_BEACON.CNF MME
+ def createCM_GET_BEACON_CNF_MMENTRY(self, mySecurityLevel=None, myNidOffset=None, myNid=None, myHm=None, myStei=None, myBt=None, myNcnr=None, myNpsm=None, myNumSlot=None, mySlotUsage=None, mySlotId=None, myAclss=None, myHoip=None, myRtsbf=None, myNm=None, myCcoCap=None, myNbe=None, myRandomBehdr=False, myBmiNumber=None, myBehdr=None, param1=None, param2=None, param3=None, param4=None, param5=None, param6=None, param7=None, param8=None, param9=None, paramA=None, paramB=None):
+ print "CM_GET_BEACON.CNF ="
+ #CM_GET_BEACON_CNF_MMENTRY is composed by 15... fields :
+ # - Nid
+ # - SecurityLevel
+ # - NidOffset
+ # - Hm
+ # - Stei
+ # - Bt
+ # - Ncnr
+ # - Npsm
+ # - NumSlot
+ # - SlotUsage
+ # - SlotId
+ # - Aclss
+ # - Hoip
+ # - Rtsbf
+ # - Nm
+ # - CcoCap
+ # - BMI :
+ # - Nbe
+ # - Behdr - * Nbe -
+ # - Bentry - * Nbe -
+ self.mmentryFields.createNidHm(mySecurityLevel, myNidOffset, myNid, myHm, myNidHm=None)
+ self.mmentryFields.createStei(myStei)
+ self.mmentryFields.createBtNcnrNpsmNumSlot(myBt, myNcnr, myNpsm, myNumSlot, myBtNcnrNpsmNumSlot=None)
+ self.mmentryFields.createSlotUsage(mySlotUsage)
+ self.mmentryFields.createSlotIdAclssHoipRtsbf(mySlotId, myAclss, myHoip, myRtsbf, mySlotIdAclssHoipRtsbf=None)
+ self.mmentryFields.createNmCcoCaptsbf(myNm, myCcoCap, myNmCcoCapRsvd=None)
+ self.mmentryFields.createBmi(myNbe, myRandomBehdr, myBmiNumber, myBehdr, param1, param2, param3, param4, param5, param6, param7, param8, param9, paramA, paramB)
+ self.mmentry.CM_GET_BEACON_CNF = self.mmentryFields.nidHmField + self.mmentryFields.steiField + self.mmentryFields.btNcnrNpsmNumSlotField + self.mmentryFields.slotUsageField + self.mmentryFields.slotIdAclssHoipRtsbfField + self.mmentryFields.nmCcoCapRsvdField + self.mmentryFields.bmiField
+ self.mmentryFields.mmentry = self.mmentry.CM_GET_BEACON_CNF
+ self.mmentryFields.mmtype = CM_GET_BEACON_CNF
+ self.mmentryFields.createMmeMfl(self.mmentryFields.mmentry)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cesar/maximus/python/lib/proto/fcall.py b/cesar/maximus/python/lib/proto/fcall.py
new file mode 100644
index 0000000000..8b87c3d07d
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/fcall.py
@@ -0,0 +1,349 @@
+#! usr/bin/env python
+
+#print __name__
+
+SERIAL = 'PYSERIAL'
+#SERIAL = 'USPP'
+
+import sys
+base = '../../../../'
+utils = 'maximus/python/maximus/utils'
+path = __file__[:__file__.find(".py") - len(__name__)] + base + utils
+sys.path.append(path)
+if SERIAL == 'PYSERIAL':
+ serial = 'maximus/python/lib/proto/pyserial'
+elif SERIAL == 'USPP':
+ serial = 'maximus/python/lib/proto/uspp'
+path = __file__[:__file__.find(".py") - len(__name__)] + base + serial
+sys.path.append(path)
+
+from exception import *
+from format import *
+if SERIAL == 'PYSERIAL':
+ import serial
+elif SERIAL == 'USPP':
+ from uspp import *
+
+# Constants from 'maximus/common/types/sci_types.h'
+SCI_MSG_MAGIC = 'MAXI'
+SCI_MSG_VERSION = 0x03
+SCI_MSG_ID_STATION = 0x8000
+SCI_MSG_TYPE_FUNCTION_CALL = 0x02
+SCI_MSG_TYPE_STATION_LOG = 0x06
+SCI_MSG_FLAG_RESP = 0x0001
+SIZE_OF_SCI_MSG_HEADER = 24 # in octets
+
+# Constants from 'maximus/common/types/functioncall_types.h'
+FUNCTION_CALL_VERSION = 0x03
+FUNCTION_CALL_FLAG_FAILED = 0x01
+FUNCTION_CALL_TYPE_REQ = 0x01
+FUNCTION_CALL_TYPE_RSP = 0x02
+SIZE_OF_FUNCTION_CALL_HEADER = 8 # in octets
+
+class Param:
+
+ def __init__(self, name, length, value):
+ self.__name = name
+ self.__length = hton16(length)
+ self.__value = value
+
+ def get_name(self):
+ return self.__name
+
+ def get_value(self):
+ return self.__value
+
+ def get(self):
+ return self.__name + '\0' + self.__length + self.__value
+
+class Fcall:
+ __msg_id = 1
+
+ tty = None
+ for i in range (1, len(sys.argv)):
+ if sys.argv[i] == '-r' or sys.argv[i] == '--rs-232':
+ if i+1 < len(sys.argv):
+ tty = sys.argv[i+1]
+ break
+
+ if SERIAL == 'PYSERIAL':
+ if tty is None:
+ # Open port 0 at "9600,8,N,1", 1s timeout
+ __tty = serial.Serial(0, timeout=1) # open first serial port
+ # Check which port was really used
+ print "Using port:", __tty.portstr
+ else:
+ # Open named port at "9600,8,N,1", 1s timeout
+ __tty = serial.Serial(tty, timeout=1)
+ if not __tty.isOpen():
+ raise Error("Cannot open serial port!")
+ elif SERIAL == 'USPP':
+ if tty is None:
+ tty = '/dev/ttyS0'
+ # Opens RS-232 at 9600 bps and with a read timeout of 1 second
+ __tty = SerialPort(tty, 1000, 9600)
+
+ def __init__(self, name):
+ self.__name = name
+ self.__param_list = []
+ self.__user_cb = None
+
+ def add_param(self, name, value=None):
+ if value is None:
+ value = ''
+ self.__param_list.append(Param(name, len(value), value))
+ return self
+
+ def add_param_bool(self, name, value):
+ self.__param_list.append(Param(name, SIZE_OF_U8, hton8(value)))
+ return self
+
+ def add_param_uchar(self, name, value):
+ self.__param_list.append(Param(name, SIZE_OF_U8, hton8(value)))
+ return self
+
+ def add_param_ushort(self, name, value):
+ self.__param_list.append(Param(name, SIZE_OF_U16, hton16(value)))
+ return self
+
+ def add_param_ulong(self, name, value):
+ self.__param_list.append(Param(name, SIZE_OF_U32, hton32(value)))
+ return self
+
+ def add_param_n_u8(self, name, tuple):
+ value = ''
+ for t in tuple:
+ value += hton8(t)
+ self.__param_list.append(Param(name, SIZE_OF_U8 * len(value), value))
+ return self
+
+ def add_param_n_u16(self, name, tuple):
+ value = ''
+ for t in tuple:
+ value += hton16(t)
+ self.__param_list.append(Param(name, SIZE_OF_U16 * len(value), value))
+ return self
+
+ def add_param_n_u32(self, name, tuple):
+ value = ''
+ for t in tuple:
+ value += hton32(t)
+ self.__param_list.append(Param(name, SIZE_OF_U32 * len(value), value))
+ return self
+
+ def remove_param(self, name):
+ for i in range (0, len(self.__param_list)):
+ if self.__param_list[i].get_name() == name:
+ self.__param_list.pop(i)
+ break
+ return self
+
+ def set_cb(self, user_cb):
+ self.__user_cb = user_cb
+ return self
+
+ def remove_cb(self):
+ self.__user_cb = None
+ return self
+
+ def set_sta(self, sta):
+ return self
+
+ def send_async(self, sta=None):
+ self.__write()
+ self.__read()
+ if self.__user_cb is not None:
+ self.__user_cb(self)
+
+ def send(self, sta=None):
+ self.__write()
+ return self.__read()
+
+ def is_param(self, name):
+ found = False
+ for l in self.__param_list:
+ if l.get_name() == name:
+ found = True
+ return found
+
+ def bind_param(self, name):
+ param = None
+ for l in self.__param_list:
+ if l.get_name() == name:
+ param = l.get_value()
+ break
+ return param
+
+ def bind_param_string(self, name):
+ param = None
+ for l in self.__param_list:
+ if l.get_name() == name:
+ param = l.get_value()
+ if param[len(param)-1] == '\0':
+ param = param[:-1]
+ break
+ return param
+
+ def bind_param_bool(self, name):
+ param = None
+ for l in self.__param_list:
+ if l.get_name() == name:
+ param = ntoh8(l.get_value())
+ break
+ return param
+
+ def bind_param_ushort(self, name):
+ param = None
+ for l in self.__param_list:
+ if l.get_name() == name:
+ param = ntoh16(l.get_value())
+ break
+ return param
+
+ def bind_param_ulong(self, name):
+ param = None
+ for l in self.__param_list:
+ if l.get_name() == name:
+ param = ntoh32(l.get_value())
+ break
+ return param
+
+ def __get(self):
+ if self.__class__.__msg_id < 0x7FFF:
+ self.__class__.__msg_id += 1
+ else:
+ self.__class__.__msg_id = 0x0001
+
+ # FCALL data
+ fcall_data = self.__name + '\0'
+ for l in self.__param_list:
+ fcall_data += l.get()
+
+ # FCALL header
+ # uint8_t version
+ # uint8_t type
+ # uint16_t msg_id
+ # uint8_t param_nb
+ # uint8_t flags
+ # uint16_t reserved
+ fcall_hdr = hton8(FUNCTION_CALL_VERSION)\
+ + hton8(FUNCTION_CALL_TYPE_REQ)\
+ + hton16(self.__class__.__msg_id)\
+ + hton8(len(self.__param_list))\
+ + hton8(0)\
+ + hton16(0)
+
+ # SCI header
+ # uint32_t magic_id
+ # uint8_t version
+ # uint8_t type
+ # uint16_t length
+ # uint16_t station_id
+ # uint16_t msg_id
+ # uint32_t netclock_high
+ # uint32_t netclock_low
+ # uint16_t flags
+ # uint16_t reserved
+ sci_hdr = SCI_MSG_MAGIC\
+ + hton8(SCI_MSG_VERSION)\
+ + hton8(SCI_MSG_TYPE_FUNCTION_CALL)\
+ + hton16(len(fcall_hdr + fcall_data))\
+ + hton16(0)\
+ + hton16(self.__class__.__msg_id)\
+ + hton32(0)\
+ + hton32(0)\
+ + hton16(0)\
+ + hton16(0)
+
+ return sci_hdr + fcall_hdr + fcall_data
+
+ def __write(self):
+ # Writes a string to the RS-232 port
+ self.__class__.__tty.write(self.__get())
+
+ def __read(self):
+ fcall = None
+
+ # SCI header
+ sci_hdr = self.__class__.__tty.read(SIZE_OF_SCI_MSG_HEADER) # read up to 24 bytes (timeout)
+ if sci_hdr[0:4] != SCI_MSG_MAGIC: # uint32_t magic_id
+ print "SCI header:"
+ print "magic id =", hex(ntoh32(sci_hdr[0:4]))
+ print "version =", hex(ntoh8(sci_hdr[4]))
+ print "type =", hex(ntoh8(sci_hdr[5]))
+ print "length =", hex(ntoh16(sci_hdr[6:8]))
+ print "station id =", hex(ntoh16(sci_hdr[8:10]))
+ print "msg id =", hex(ntoh16(sci_hdr[10:12]))
+ print "netclock high =", hex(ntoh32(sci_hdr[12:16]))
+ print "netclock low =", hex(ntoh32(sci_hdr[16:20]))
+ print "flags =", hex(ntoh16(sci_hdr[20:22]))
+ print "reserved =", hex(ntoh16(sci_hdr[22:24]))
+ raise Error("SCI header: bad magic id! (" + sci_hdr[0:4] + ")")
+ if ntoh8(sci_hdr[4]) != SCI_MSG_VERSION: # uint8_t version
+ raise Error("SCI header: bad version! (" + hex(ntoh8(sci_hdr[4])) + ")")
+ if ntoh8(sci_hdr[5]) == SCI_MSG_TYPE_FUNCTION_CALL: # uint8_t type
+ length = ntoh16(sci_hdr[6:8]) # uint16_t length
+
+ # FCALL header
+ fcall_hdr = self.__class__.__tty.read(SIZE_OF_FUNCTION_CALL_HEADER) # read up to 8 bytes (timeout)
+ if ntoh8(fcall_hdr[0]) != FUNCTION_CALL_VERSION: # uint8_t version
+ raise Error("FCALL header: bad version! (" + hex(ntoh8(fcall_hdr[0])) + ")")
+ if ntoh8(fcall_hdr[1]) != FUNCTION_CALL_TYPE_RSP: # uint8_t type
+ raise Error("FCALL header: bad type! (" + hex(ntoh8(fcall_hdr[1])) + ")")
+ ntoh16(fcall_hdr[2:4]) # uint16_t msg_id
+ param_nb = ntoh8(fcall_hdr[4]) # uint8_t param_nb
+ if ntoh8(fcall_hdr[5]) >= FUNCTION_CALL_FLAG_FAILED: # uint8_t flags
+ raise Error("FCALL header: flag failed! (" + hex(ntoh8(fcall_hdr[5])) + ")")
+ length -= SIZE_OF_FUNCTION_CALL_HEADER
+
+ # FCALL data
+ name = self.__read_name()
+ fcall = Fcall(name)
+ length -= len(name) + 1
+ for n in range(0, param_nb):
+ param_name = self.__read_param_name()
+ param_length = self.__read_param_length()
+ param_value = self.__read_param_value(param_length)
+ fcall.__param_list.append(Param(param_name, param_length, param_value))
+ length -= len(param_name) + 1 + SIZE_OF_U16 + param_length
+
+ if length != 0:
+ raise Error("length = " + str(length))
+
+ elif ntoh8(sci_hdr[5]) == SCI_MSG_TYPE_STATION_LOG: # uint8_t type
+ print self.__class__.__tty.readline() # read a '\n' terminated line
+ else:
+ raise Error("SCI header: bad type! (" + hex(ntoh8(sci_hdr[5])) + ")")
+
+ ntoh16(sci_hdr[8:10]) # uint16_t station_id
+ if ntoh16(sci_hdr[10:12]) < SCI_MSG_ID_STATION: # uint16_t msg_id
+ raise Error("SCI header: bad msg id! (" + hex(ntoh16(sci_hdr[10:12])) + ")")
+ ntoh32(sci_hdr[12:16]) # uint32_t netclock_high
+ ntoh32(sci_hdr[16:20]) # uint32_t netclock_low
+ if ntoh16(sci_hdr[20:22]) != SCI_MSG_FLAG_RESP: # uint16_t flags
+ raise Error("SCI header: bad flags! (" + hex(ntoh16(sci_hdr[20:22])) + ")")
+
+ return fcall
+
+ def __read_name(self):
+ name = ''
+ c = self.__class__.__tty.read() # read one byte
+ while c != '\0':
+ name += c
+ c = self.__class__.__tty.read() # read one byte
+ return name
+
+ def __read_param_name(self):
+ return self.__read_name()
+
+ def __read_param_length(self):
+ return ntoh16(self.__class__.__tty.read(2))
+
+ def __read_param_value(self, length):
+ return self.__class__.__tty.read(length)
+
+def create_fcall(name):
+ return Fcall(name)
+
+def create_probe():
+ return Fcall('probe')
diff --git a/cesar/maximus/python/lib/proto/pyserial/CHANGES.txt b/cesar/maximus/python/lib/proto/pyserial/CHANGES.txt
new file mode 100644
index 0000000000..cc2c0faace
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/CHANGES.txt
@@ -0,0 +1,171 @@
+Version 1.0 13 Feb 2002
+ First public release.
+ Split from the pybsl application (see mspgcc.sourceforge.net)
+
+ New Features:
+ - Added Jython support
+
+Version 1.1 14 Feb 2002
+ Bugfixes:
+ - Win32, when not specifying a timeout
+ - Typos in the Docs
+
+ New Features:
+ - added serialutil which provides a base class for the Serial
+ objects.
+
+ - readline, readlines, writelines and flush are now supported
+ see README.txt for deatils.
+
+Version 1.11 14 Feb 2002
+ Same as 1.1 but added missing files.
+
+Version 1.12 18 Feb 2002
+ Removed unneded constants to fix RH7.x problems.
+
+Version 1.13 09 Apr 2002
+ Added alternate way for enabling rtscts (CNEW_RTSCTS is tried too)
+ If port opening fails, a SerialException is raised on all platforms
+
+Version 1.14 29 May 2002
+ Added examples to archive
+ Added non-blocking mode for timeout=0 (tnx Mat Martineau)
+
+ Bugfixes:
+ - win32 does now return the remaining characters on timeout
+
+Version 1.15 04 Jun 2002
+ Bugfixes (win32):
+ - removed debug messages
+ - compatibility to win9x improved
+
+Version 1.16 02 Jul 2002
+ Added implementation of RI and corrected RTS/CTS on Win32
+
+Version 1.17 03 Jul 2002
+ Silly mix of two versions in win32 code corrected
+
+Version 1.18 06 Dec 2002
+ Bugfixes (general):
+ - remove the mapping of flush to the destructive flushOutput as
+ this is not the expected behaviour.
+ - readline: EOL character for lines can be chosen idea by
+ John Florian.
+ Bugfixes (posix):
+ - cygwin port numbering fixed
+ - test each and every constant for it's existence in termios module,
+ use default if not existent (fix for Bug item #640214)
+ - wrong exception on nonexitstent ports with /dev file. bug report
+ by Louis Cordier
+ Bugfixes (win32):
+ - RTS/CTS handling as sugested in Bug #635072
+ - bugfix of timeouts brought up by Markus Hoffrogge
+
+Version 1.19 19 Mar 2003
+ Bugfixes (posix):
+ - removed dgux entry which actualy had a wrong comment and is
+ probably not in use anywhere.
+ Bugfixes (win32):
+ - added int() conversion, [Bug 702120]
+ - remove code to set control lines in close methond of win32
+ version. [Bug 669625]
+
+Version 1.20 28 Aug 2003
+ Added serial.device() for all platforms
+ Bugfixes (win32):
+ - don't recreate opverlaped structures and events on each
+ read/write.
+ - don't set unneded event masks.
+ - dont use DOS device names for ports > 9.
+ - remove send timeout (its not used in the linux impl. anyway).
+
+
+Version 1.21 30 sep 2003
+ Bugfixes (win32):
+ - name for COM10 was not built correctly, found by Norm Davis.
+ Bugfixes (examples):
+ - small change in miniterm.py that should mage it run on cygwin,
+ [Bug 809904] submitted by Rolf Campbell.
+
+Version 2.0b1 1 Oct 2003
+ Transition to the 2.0 series:
+ - New implementation only supports Python 2.2+, backwards compatibility
+ should be maintained almost everywhere.
+ The OS handles (like the hComPort or fd attribute) were prefixed with an
+ underscore. The different names stay, as anyone that uses one of these
+ has to write platform specific code anyway.
+ - Common base class serialutil.SerialBase for all implementations.
+ - PARITY_NONE, PARITY_EVEN, PARITY_ODD constants changed and all these
+ constants moved to serialutil.py (still available as serial.PARITY_NONE
+ etc. and they should be used that way)
+ - Added serial.PARITY_NAMES (implemented in serialutil.PARITY_NAMES).
+ This dictionary can be used to convert parity constants to meaningful
+ strings.
+ - Each Serial class and instance has a list of supported values:
+ BAUDRATES, BYTESIZES, PARITIES, STOPBITS
+ (i.e. serial.Serial.BAUDRATES or s = serial.Serial; s.BAUDRATES)
+ these values can be used to fill in value sin GUI dialogs etc.
+ - Creating a Serial() object without port spec returns an unconfigured,
+ closed port. Useful if a GUI dialog should take a port and configure
+ it.
+ - New methods for serial.Serial instances: open(), isOpen()
+ - A port can be opened and closed as many times as desired.
+ - Instances of serial.Serial have baudrate, bytesize, timeout etc.
+ attributes implemented as properties, all can be set while the port is
+ opened. It will then be reconfigured.
+ - Improved __doc__'s.
+ - New test_advanced.py for the property setting/getting testing.
+ - Small bugfix on posix with get* methods (return value should be true a
+ boolean).
+ - added a __repr__ that returns a meaningful string will all the serial
+ setting, easy for debugging.
+ - The serialposix module does not throw an exception on unsupported
+ platforms, the message is still printed. The idea that it may still
+ work even if the platform itself s not known, it simply tries to do
+ the posix stuff anyway (It's likely that opening ports by number
+ fails, but by name it should work).
+
+Version 2.0b2 4 Oct 2003
+ - Added serial port configuration dialog for wxPython to the examples.
+ - Added terminal application for wxPython with wxGlade design file
+ to the examples.
+ - Jython support is currenty broken as Jython does not have a Python 2.2
+ compatible release out yet
+
+Version 2.0 6 Nov 2003
+ - Fixes setup.py for older distutils
+
+Version 2.1 28 Jul 2004
+ Bugfixes:
+ - Fix XON/XOFF values [Bug 975250]
+ Bugfixes (posix):
+ - fd == 0 fix from Vsevolod Lobko
+ - netbsd fixes from Erik Lindgren
+ - Dynamicaly lookup baudrates and some cleanups
+ Bugfixes (examples):
+ - CRLF handling of miniterm.py should be more consistent on Win32
+ and others. Added LF only command line option
+ - Mutithreading fixes to wxTerminal.py (helps with wxGTK)
+ - Small change for wxPython 2.5 in wxSerialConfigDialog.py [Bug 994856]
+
+ New Features:
+ - Implement write timeouts ('writeTimeout' parameter)
+
+
+Version 2.2 31 Jul 2005
+ Bugfixes:
+ - [Bug 1014227]: property <del> broken
+ - [Bug 1105687]: serial_tcp_example.py: --localport option
+ - [Bug 1106313]: device (port) strings cannot be unicode
+ Bugfixes (posix):
+ - [Patch 1043436] Fix for [Bug 1043420] (OSError: EAGAIN)
+ - [Patch 1102700] fileno() added
+ - ensure disbaled PARMRK
+ Bugfixes (win32):
+ - [Patch 983106]: keep RTS/CTS state on port setting changes
+
+ New Features:
+ - dsrdtr setting to enable/disable DSR/DTR flow control independently
+ from the rtscts setting. (Currenly Win32 only, ignored on other
+ platforms)
+
diff --git a/cesar/maximus/python/lib/proto/pyserial/LICENSE.txt b/cesar/maximus/python/lib/proto/pyserial/LICENSE.txt
new file mode 100644
index 0000000000..694e98a79d
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/LICENSE.txt
@@ -0,0 +1,61 @@
+Copyright (c) 2001-2004 Chris Liechti <cliechti@gmx.net>;
+All Rights Reserved.
+
+This is the Python license. In short, you can use this product in
+commercial and non-commercial applications, modify it, redistribute it.
+A notification to the author when you use and/or modify it is welcome.
+
+
+TERMS AND CONDITIONS FOR ACCESSING OR OTHERWISE USING THIS SOFTWARE
+===================================================================
+
+LICENSE AGREEMENT
+-----------------
+
+1. This LICENSE AGREEMENT is between the copyright holder of this
+product, and the Individual or Organization ("Licensee") accessing
+and otherwise using this product in source or binary form and its
+associated documentation.
+
+2. Subject to the terms and conditions of this License Agreement,
+the copyright holder hereby grants Licensee a nonexclusive,
+royalty-free, world-wide license to reproduce, analyze, test,
+perform and/or display publicly, prepare derivative works, distribute,
+and otherwise use this product alone or in any derivative version,
+provided, however, that copyright holders License Agreement and
+copyright holders notice of copyright are retained in this product
+alone or in any derivative version prepared by Licensee.
+
+3. In the event Licensee prepares a derivative work that is based on
+or incorporates this product or any part thereof, and wants to make
+the derivative work available to others as provided herein, then
+Licensee hereby agrees to include in any such work a brief summary of
+the changes made to this product.
+
+4. The copyright holder is making this product available to Licensee on
+an "AS IS" basis. THE COPYRIGHT HOLDER MAKES NO REPRESENTATIONS OR
+WARRANTIES, EXPRESS OR IMPLIED. BY WAY OF EXAMPLE, BUT NOT LIMITATION,
+THE COPYRIGHT HOLDER MAKES NO AND DISCLAIMS ANY REPRESENTATION OR
+WARRANTY OF MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR
+THAT THE USE OF THIS PRODUCT WILL NOT INFRINGE ANY THIRD PARTY RIGHTS.
+
+5. THE COPYRIGHT HOLDER SHALL NOT BE LIABLE TO LICENSEE OR ANY OTHER
+USERS OF THIS PRODUCT FOR ANY INCIDENTAL, SPECIAL, OR CONSEQUENTIAL
+DAMAGES OR LOSS AS A RESULT OF MODIFYING, DISTRIBUTING, OR OTHERWISE
+USING THIS PRODUCT, OR ANY DERIVATIVE THEREOF, EVEN IF ADVISED OF THE
+POSSIBILITY THEREOF.
+
+6. This License Agreement will automatically terminate upon a material
+breach of its terms and conditions.
+
+7. Nothing in this License Agreement shall be deemed to create any
+relationship of agency, partnership, or joint venture between the
+copyright holder and Licensee. This License Agreement does not grant
+permission to use trademarks or trade names from the copyright holder
+in a trademark sense to endorse or promote products or services of
+Licensee, or any third party.
+
+8. By copying, installing or otherwise using this product, Licensee
+agrees to be bound by the terms and conditions of this License
+Agreement.
+
diff --git a/cesar/maximus/python/lib/proto/pyserial/PKG-INFO b/cesar/maximus/python/lib/proto/pyserial/PKG-INFO
new file mode 100644
index 0000000000..575389e3e7
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/PKG-INFO
@@ -0,0 +1,21 @@
+Metadata-Version: 1.0
+Name: pyserial
+Version: 2.2
+Summary: Python Serial Port Extension
+Home-page: http://pyserial.sourceforge.net/
+Author: Chris Liechti
+Author-email: cliechti@gmx.net
+License: Python
+Description: Python Serial Port Extension for Win32, Linux, BSD, Jython
+Platform: UNKNOWN
+Classifier: Development Status :: 5 - Production/Stable
+Classifier: Intended Audience :: Developers
+Classifier: Intended Audience :: End Users/Desktop
+Classifier: License :: OSI Approved :: Python Software Foundation License
+Classifier: Natural Language :: English
+Classifier: Operating System :: POSIX
+Classifier: Operating System :: Microsoft :: Windows
+Classifier: Programming Language :: Python
+Classifier: Topic :: Communications
+Classifier: Topic :: Software Development :: Libraries
+Classifier: Topic :: Terminals :: Serial
diff --git a/cesar/maximus/python/lib/proto/pyserial/README.txt b/cesar/maximus/python/lib/proto/pyserial/README.txt
new file mode 100644
index 0000000000..2dfa443ba7
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/README.txt
@@ -0,0 +1,244 @@
+pySerial
+--------
+This module capsulates the access for the serial port. It provides backends
+for standard Python running on Windows, Linux, BSD (possibly any POSIX
+compilant system) and Jython. The module named "serial" automaticaly selects
+the appropriate backend.
+
+It is released under a free software license, see LICENSE.txt for more
+details.
+
+Project Homepage: pyserial.sourceforge.net
+(C) 2001-2004 Chris Liechti <cliechti@gmx.net>
+
+
+Features
+--------
+- same class based interface on all supported platforms
+- access to the port settings trough Python 2.2 properties
+- port numbering starts at zero, no need to know the platform dependant port
+ name in the user program
+- port name can be specified if access through numbering is inappropriate
+- support for different bytesizes, stopbits, parity and flow control
+ with RTS/CTS and/or Xon/Xoff
+- working with or without receive timeout, blocking or non-blocking
+- file like API with "read" and "write" ("readline" etc. also supported)
+- The files in this package are 100% pure Python.
+ They depend on non standard but common packages on Windows (win32all) and
+ Jython (JavaComm). POSIX (Linux, BSD) uses only modules from the standard
+ Python distribution)
+- The port is set up for binary transmission. No NULL byte stripping, CR-LF
+ translation etc. (which are many times enabled for POSIX.) This makes this
+ module universally useful.
+
+
+Requirements
+------------
+- Python 2.2 or newer
+- win32all extensions on Windows
+- "Java Communications" (JavaComm) extension for Java/Jython
+
+
+Installation
+------------
+Extract files from the archive, open a shell/console in that directory and
+let Distutils do the rest: "python setup.py install"
+
+The files get installed in the "Lib/site-packages" directory.
+
+There is also a Windows installer, but for developers it may be interesting
+to get the source archive anyway, because it contains examples and the readme.
+
+Do also have a look at the example files in the examples directory in the
+source distribution or online in CVS repository.
+
+Serial to USB adapters
+----------------------
+Such adapters are reported to work under Mac OSX and Windows. They are
+mapped to a normal COM port under Windows, but on Mac OSX and other platforms
+they have special device names.
+
+Mac OSX: "/dev/[cu|tty].USA<adaptername><USB-part>P<serial-port>.1"
+ e.g. "/dev/cu.USA19QW11P1.1"
+
+Linux: "/dev/usb/ttyUSB[n]" or "/dev/ttyUSB[n]"
+ first for for RedHat, second form for Debian.
+ e.g. "/dev/usb/ttyUSB0"
+
+Either use these names for the serial ports or create a link to the common device
+names like "ln -s /dev/cu.USA19QW11P1.1 /dev/cuaa0" or "ln -s /dev/usb/ttyUSB0
+/dev/ttyS4" etc.
+
+But be aware that the (USB) device file disappears as soon as you unplug the USB
+adapter.
+
+
+Short introduction
+------------------
+Open port 0 at "9600,8,N,1", no timeout
+>>> import serial
+>>> ser = serial.Serial(0) #open first serial port
+>>> print ser.portstr #check which port was realy used
+>>> ser.write("hello") #write a string
+>>> ser.close() #close port
+
+Open named port at "19200,8,N,1", 1s timeout
+>>> ser = serial.Serial('/dev/ttyS1', 19200, timeout=1)
+>>> x = ser.read() #read one byte
+>>> s = ser.read(10) #read up to ten bytes (timeout)
+>>> line = ser.readline() #read a '\n' terminated line
+>>> ser.close()
+
+Open second port at "38400,8,E,1", non blocking HW handshaking
+>>> ser = serial.Serial(1, 38400, timeout=0,
+... parity=serial.PARITY_EVEN, rtscts=1)
+>>> s = ser.read(100) #read up to one hunded bytes
+... #or as much is in the buffer
+
+Get a Serial instance and configure/open it later
+>>> ser = serial.Serial()
+>>> ser.baudrate = 19200
+>>> ser.port = 0
+>>> ser
+Serial<id=0xa81c10, open=False>(port='COM1', baudrate=19200, bytesize=8,
+parity='N', stopbits=1, timeout=None, xonxoff=0, rtscts=0)
+>>> ser.open()
+>>> ser.isOpen()
+True
+>>> ser.close()
+>>> ser.isOpen()
+False
+
+Be carefully when using "readline". Do specify a timeout when
+opening the serial port otherwise it could block forever if
+no newline character is received. Also note that "readlines" only
+works with a timeout. "readlines" depends on having a timeout
+and interprets that as EOF (end of file). It raises an exception
+if the port is not opened correctly.
+
+
+Parameters for the Serial class
+-------------------------------
+ser = serial.Serial(
+ port=None, #number of device, numbering starts at
+ #zero. if everything fails, the user
+ #can specify a device string, note
+ #that this isn't portable anymore
+ #if no port is specified an unconfigured
+ #an closed serial port object is created
+ baudrate=9600, #baudrate
+ bytesize=EIGHTBITS, #number of databits
+ parity=PARITY_NONE, #enable parity checking
+ stopbits=STOPBITS_ONE, #number of stopbits
+ timeout=None, #set a timeout value, None to wait forever
+ xonxoff=0, #enable software flow control
+ rtscts=0, #enable RTS/CTS flow control
+ writeTimeout=None, #set a timeout for writes
+)
+
+The port is immediately opened on object creation, if a port is given.
+It is not opened if port is None.
+
+Options for read timeout:
+timeout=None #wait forever
+timeout=0 #non-blocking mode (return immediately on read)
+timeout=x #set timeout to x seconds (float allowed)
+
+Options for write timeout:
+writeTimeout=x #will rise a SerialTimeoutException if the data
+ #cannot be sent in x seconds
+
+Methods of Serial instances
+---------------------------
+open() #open port
+close() #close port immediately
+setBaudrate(baudrate) #change baudarte on an open port
+inWaiting() #return the number of chars in the receive buffer
+read(size=1) #read "size" characters
+write(s) #write the string s to the port
+flushInput() #flush input buffer, discarding all it's contents
+flushOutput() #flush output buffer, abort output
+sendBreak() #send break condition
+setRTS(level=1) #set RTS line to specified logic level
+setDTR(level=1) #set DTR line to specified logic level
+getCTS() #return the state of the CTS line
+getDSR() #return the state of the DSR line
+getRI() #return the state of the RI line
+getCD() #return the state of the CD line
+
+Attributes of Serial instances
+------------------------------
+Read Only:
+portstr #device name
+BAUDRATES #list of valid baudrates
+BYTESIZES #list of valid byte sizes
+PARITIES #list of valid parities
+STOPBITS #list of valid stop bit widths
+
+New values can be assigned to the following attribues, the port
+will be reconfigured, even if it's opened at that time (port will be
+closed and reopened to apply the changes):
+port #port name/number as set by the user
+baudrate #current baudrate setting
+bytesize #bytesize in bits
+parity #parity setting
+stopbits #stop bit with (1,2)
+timeout #read timeout setting
+xonxoff #if Xon/Xoff flow control is enabled
+rtscts #if hardware flow control is enabled
+writeTimeout #write timeout setting
+
+These attribues also have corresponding getX and setXX methods.
+
+Exceptions
+----------
+serial.SerialException
+
+Constants
+---------
+parity:
+ serial.PARITY_NONE
+ serial.PARITY_EVEN
+ serial.PARITY_ODD
+stopbits:
+ serial.STOPBITS_ONE
+ serial.STOPBITS_TWO
+bytesize:
+ serial.FIVEBITS
+ serial.SIXBITS
+ serial.SEVENBITS
+ serial.EIGHTBITS
+
+Xon/Xoff characters:
+ serial.XON
+ serial.XOFF
+
+Tips & Tricks
+-------------
+- Some protocols need CR LF ("\r\n") as line terminator, not just LF ("\n").
+ Telephone modems with the AT command set are an example of this behaviour.
+
+- Scanning for available serial ports is possible with more or less success on
+ some platforms. Look at the tools from Roger Binns:
+ http://cvs.sourceforge.net/cgi-bin/viewcvs.cgi/bitpim/comscan/
+
+- When packaging a project with py2exe, it will likely print a warning about
+ missing modules 'javax.comm'. This warning is uncritical as the module is
+ used in the Jython implementation that is not used but packaged.
+
+ It can be avoided with:
+ setup(...
+ options = {'py2exe': {'excludes': ['javax.comm']}})
+
+ See also setup_demo.py in the examples.
+
+
+References
+----------
+- Python: http://www.python.org
+- Jython: http://www.jython.org
+- win32all: http://starship.python.net/crew/mhammond/
+ and http://www.activestate.com/Products/ActivePython/win32all.html
+- Java@IBM http://www-106.ibm.com/developerworks/java/jdk/
+ (JavaComm links are on the download page for the respective platform jdk)
+- Java@SUN http://java.sun.com/products/
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/enhancedserial.py b/cesar/maximus/python/lib/proto/pyserial/examples/enhancedserial.py
new file mode 100644
index 0000000000..7ca8b6f40e
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/enhancedserial.py
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+"""Enhanced Serial Port class
+part of pyserial (http://pyserial.sf.net) (C)2002 cliechti@gmx.net
+
+another implementation of the readline and readlines method.
+this one should be more efficient because a bunch of characters are read
+on each access, but the drawback is that a timeout must be specified to
+make it work (enforced by the class __init__).
+
+this class could be enhanced with a read_until() method and more
+like found in the telnetlib.
+"""
+
+from serial import Serial
+
+class EnhancedSerial(Serial):
+ def __init__(self, *args, **kwargs):
+ #ensure that a reasonable timeout is set
+ timeout = kwargs.get('timeout',0.1)
+ if timeout < 0.01: timeout = 0.1
+ kwargs['timeout'] = timeout
+ Serial.__init__(self, *args, **kwargs)
+ self.buf = ''
+
+ def readline(self, maxsize=None, timeout=1):
+ """maxsize is ignored, timeout in seconds is the max time that is way for a complete line"""
+ tries = 0
+ while 1:
+ self.buf += self.read(512)
+ pos = self.buf.find('\n')
+ if pos >= 0:
+ line, self.buf = self.buf[:pos+1], self.buf[pos+1:]
+ return line
+ tries += 1
+ if tries * self.timeout > timeout:
+ break
+ line, self.buf = self.buf, ''
+ return line
+
+ def readlines(self, sizehint=None, timeout=1):
+ """read all lines that are available. abort after timout
+ when no more data arrives."""
+ lines = []
+ while 1:
+ line = self.readline(timeout=timeout)
+ if line:
+ lines.append(line)
+ if not line or line[-1:] != '\n':
+ break
+ return lines
+
+if __name__=='__main__':
+ #do some simple tests with a Loopback HW (see test.py for details)
+ PORT = 0
+ #test, only with Loopback HW (shortcut RX/TX pins (3+4 on DSUB 9 and 25) )
+ s = EnhancedSerial(PORT)
+ #write out some test data lines
+ s.write('\n'.join("hello how are you".split()))
+ #and read them back
+ print s.readlines()
+ #this one should print an empty list
+ print s.readlines(timeout=0.4)
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/miniterm.py b/cesar/maximus/python/lib/proto/pyserial/examples/miniterm.py
new file mode 100644
index 0000000000..345c0c42e3
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/miniterm.py
@@ -0,0 +1,165 @@
+#!/usr/bin/env python
+
+# Very simple serial terminal
+# (C)2002-2004 Chris Liechti <cliecht@gmx.net>
+
+# Input characters are sent directly (only LF -> CR/LF/CRLF translation is
+# done), received characters are displayed as is (or as trough pythons
+# repr, useful for debug purposes)
+# Baudrate and echo configuartion is done through globals
+
+
+import sys, os, serial, threading, getopt
+
+EXITCHARCTER = '\x04' #ctrl+D
+
+#first choose a platform dependant way to read single characters from the console
+if os.name == 'nt':
+ import msvcrt
+ def getkey():
+ while 1:
+ if echo:
+ z = msvcrt.getche()
+ else:
+ z = msvcrt.getch()
+ if z == '\0' or z == '\xe0': #functions keys
+ msvcrt.getch()
+ else:
+ if z == '\r':
+ return '\n'
+ return z
+
+elif os.name == 'posix':
+ import termios, sys, os
+ fd = sys.stdin.fileno()
+ old = termios.tcgetattr(fd)
+ new = termios.tcgetattr(fd)
+ new[3] = new[3] & ~termios.ICANON & ~termios.ECHO
+ new[6][termios.VMIN] = 1
+ new[6][termios.VTIME] = 0
+ termios.tcsetattr(fd, termios.TCSANOW, new)
+ s = '' # We'll save the characters typed and add them to the pool.
+ def getkey():
+ c = os.read(fd, 1)
+ #~ c = sys.stdin.read(1)
+ if echo: sys.stdout.write(c); sys.stdout.flush()
+ return c
+ def clenaup_console():
+ termios.tcsetattr(fd, termios.TCSAFLUSH, old)
+ sys.exitfunc = clenaup_console #terminal modes have to be restored on exit...
+
+else:
+ raise "Sorry no implementation for your platform (%s) available." % sys.platform
+
+CONVERT_CRLF = 2
+CONVERT_CR = 1
+CONVERT_LF = 0
+
+def reader():
+ """loop forever and copy serial->console"""
+ while 1:
+ data = s.read()
+ if repr_mode:
+ sys.stdout.write(repr(data)[1:-1])
+ else:
+ sys.stdout.write(data)
+ sys.stdout.flush()
+
+def writer():
+ """loop and copy console->serial until EOF character is found"""
+ while 1:
+ c = getkey()
+ if c == EXITCHARCTER:
+ break #exit app
+ elif c == '\n':
+ if convert_outgoing == CONVERT_CRLF:
+ s.write('\r\n') #make it a CR+LF
+ elif convert_outgoing == CONVERT_CR:
+ s.write('\r') #make it a CR
+ elif convert_outgoing == CONVERT_LF:
+ s.write('\n') #make it a LF
+ else:
+ s.write(c) #send character
+
+
+#print a short help message
+def usage():
+ sys.stderr.write("""USAGE: %s [options]
+ Miniterm - A simple terminal program for the serial port.
+
+ options:
+ -p, --port=PORT: port, a number, default = 0 or a device name
+ -b, --baud=BAUD: baudrate, default 9600
+ -r, --rtscts: enable RTS/CTS flow control (default off)
+ -x, --xonxoff: enable software flow control (default off)
+ -e, --echo: enable local echo (default off)
+ -c, --cr: do not send CR+LF, send CR only
+ -n, --newline: do not send CR+LF, send LF only
+ -D, --debug: debug received data (escape nonprintable chars)
+
+""" % (sys.argv[0], ))
+
+if __name__ == '__main__':
+ #initialize with defaults
+ port = 0
+ baudrate = 9600
+ echo = 0
+ convert_outgoing = CONVERT_CRLF
+ rtscts = 0
+ xonxoff = 0
+ repr_mode = 0
+
+ #parse command line options
+ try:
+ opts, args = getopt.getopt(sys.argv[1:],
+ "hp:b:rxecnD",
+ ["help", "port=", "baud=", "rtscts", "xonxoff", "echo",
+ "cr", "newline", "debug"]
+ )
+ except getopt.GetoptError:
+ # print help information and exit:
+ usage()
+ sys.exit(2)
+
+ for o, a in opts:
+ if o in ("-h", "--help"): #help text
+ usage()
+ sys.exit()
+ elif o in ("-p", "--port"): #specified port
+ try:
+ port = int(a)
+ except ValueError:
+ port = a
+ elif o in ("-b", "--baud"): #specified baudrate
+ try:
+ baudrate = int(a)
+ except ValueError:
+ raise ValueError, "Baudrate must be a integer number, not %r" % a
+ elif o in ("-r", "--rtscts"):
+ rtscts = 1
+ elif o in ("-x", "--xonxoff"):
+ xonxoff = 1
+ elif o in ("-e", "--echo"):
+ echo = 1
+ elif o in ("-c", "--cr"):
+ convert_outgoing = CONVERT_CR
+ elif o in ("-n", "--newline"):
+ convert_outgoing = CONVERT_LF
+ elif o in ("-D", "--debug"):
+ repr_mode = 1
+
+ #open the port
+ try:
+ s = serial.Serial(port, baudrate, rtscts=rtscts, xonxoff=xonxoff)
+ except:
+ sys.stderr.write("Could not open port\n")
+ sys.exit(1)
+ sys.stderr.write("--- Miniterm --- type Ctrl-D to quit\n")
+ #start serial->console thread
+ r = threading.Thread(target=reader)
+ r.setDaemon(1)
+ r.start()
+ #and enter console->serial loop
+ writer()
+
+ sys.stderr.write("\n--- exit ---\n")
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/scan.py b/cesar/maximus/python/lib/proto/pyserial/examples/scan.py
new file mode 100644
index 0000000000..ee0b92a337
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/scan.py
@@ -0,0 +1,27 @@
+#!/usr/bin/env python
+"""Scan for serial ports.
+Part of pySerial (http://pyserial.sf.net) (C)2002-2003 <cliechti@gmx.net>
+
+The scan function of this module tries to open each port number
+from 0 to 255 and it builds a list of those ports where this was
+successful.
+"""
+
+import serial
+
+def scan():
+ """scan for available ports. return a list of tuples (num, name)"""
+ available = []
+ for i in range(256):
+ try:
+ s = serial.Serial(i)
+ available.append( (i, s.portstr))
+ s.close() #explicit close 'cause of delayed GC in java
+ except serial.SerialException:
+ pass
+ return available
+
+if __name__=='__main__':
+ print "Found ports:"
+ for n,s in scan():
+ print "(%d) %s" % (n,s)
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/setup_demo.py b/cesar/maximus/python/lib/proto/pyserial/examples/setup_demo.py
new file mode 100644
index 0000000000..34c8c122e0
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/setup_demo.py
@@ -0,0 +1,35 @@
+# This is a setup.py example script for the use with py2exe
+from distutils.core import setup
+import py2exe
+import sys, os
+
+#this script is only useful for py2exe so just run that distutils command.
+#that allows to run it with a simple double click.
+sys.argv.append('py2exe')
+
+#get an icon from somewhere.. the python installation should have one:
+icon = os.path.join(os.path.dirname(sys.executable), 'py.ico')
+
+setup(
+ options = {'py2exe': {
+ 'excludes': ['javax.comm'],
+ 'optimize': 2,
+ 'dist_dir': 'dist',
+ }
+ },
+
+ name = "wxTerminal",
+ windows = [
+ {
+ 'script': "wxTerminal.py",
+ 'icon_resources': [(0x0004, icon)]
+ },
+ ],
+ zipfile = "stuff.lib",
+
+ description = "Simple serial terminal application",
+ version = "0.1",
+ author = "Chris Liechti",
+ author_email = "cliechti@gmx.net",
+ url = "http://pyserial.sf.net",
+)
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/tcp_serial_redirect.py b/cesar/maximus/python/lib/proto/pyserial/examples/tcp_serial_redirect.py
new file mode 100644
index 0000000000..771f3c268e
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/tcp_serial_redirect.py
@@ -0,0 +1,150 @@
+#!/usr/bin/env python
+
+#(C)2002-2003 Chris Liechti <cliechti@gmx.net>
+#redirect data from a TCP/IP connection to a serial port and vice versa
+#requires Python 2.2 'cause socket.sendall is used
+
+"""USAGE: tcp_serial_redirect.py [options]
+Simple Serial to Network (TCP/IP) redirector.
+
+Options:
+ -p, --port=PORT serial port, a number, defualt = 0 or a device name
+ -b, --baud=BAUD baudrate, default 9600
+ -r, --rtscts enable RTS/CTS flow control (default off)
+ -x, --xonxoff enable software flow control (default off)
+ -P, --localport TCP/IP port on which to run the server (default 7777)
+
+Note: no security measures are implemeted. Anyone can remotely connect
+to this service over the network.
+Only one connection at once is supported. If the connection is terminaed
+it waits for the next connect.
+"""
+
+import sys, os, serial, threading, getopt, socket
+
+try:
+ True
+except NameError:
+ True = 1
+ False = 0
+
+class Redirector:
+ def __init__(self, serial, socket):
+ self.serial = serial
+ self.socket = socket
+
+ def shortcut(self):
+ """connect the serial port to the tcp port by copying everything
+ from one side to the other"""
+ self.alive = True
+ self.thread_read = threading.Thread(target=self.reader)
+ self.thread_read.setDaemon(1)
+ self.thread_read.start()
+ self.writer()
+
+ def reader(self):
+ """loop forever and copy serial->socket"""
+ while self.alive:
+ try:
+ data = self.serial.read(1) #read one, blocking
+ n = self.serial.inWaiting() #look if there is more
+ if n:
+ data = data + self.serial.read(n) #and get as much as possible
+ if data:
+ self.socket.sendall(data) #send it over TCP
+ except socket.error, msg:
+ print msg
+ #probably got disconnected
+ break
+ self.alive = False
+
+ def writer(self):
+ """loop forever and copy socket->serial"""
+ while self.alive:
+ try:
+ data = self.socket.recv(1024)
+ if not data:
+ break
+ self.serial.write(data) #get a bunch of bytes and send them
+ except socket.error, msg:
+ print msg
+ #probably got disconnected
+ break
+ self.alive = False
+ self.thread_read.join()
+
+ def stop(self):
+ """Stop copying"""
+ if self.alive:
+ self.alive = False
+ self.thread_read.join()
+
+if __name__ == '__main__':
+ ser = serial.Serial()
+
+ #parse command line options
+ try:
+ opts, args = getopt.getopt(sys.argv[1:],
+ "hp:b:rxP",
+ ["help", "port=", "baud=", "rtscts", "xonxoff", "localport="])
+ except getopt.GetoptError:
+ # print help information and exit:
+ print >>sys.stderr, __doc__
+ sys.exit(2)
+
+ ser.port = 0
+ ser.baudrate = 9600
+ ser.rtscts = False
+ ser.xonxoff = False
+ ser.timeout = 1 #required so that the reader thread can exit
+
+ localport = 7777
+ for o, a in opts:
+ if o in ("-h", "--help"): #help text
+ usage()
+ sys.exit()
+ elif o in ("-p", "--port"): #specified port
+ try:
+ ser.port = int(a)
+ except ValueError:
+ ser.port = a
+ elif o in ("-b", "--baud"): #specified baudrate
+ try:
+ ser.baudrate = int(a)
+ except ValueError:
+ raise ValueError, "Baudrate must be a integer number"
+ elif o in ("-r", "--rtscts"):
+ ser.rtscts = True
+ elif o in ("-x", "--xonxoff"):
+ ser.xonxoff = True
+ elif o in ("-P", "--localport"):
+ try:
+ localport = int(a)
+ except ValueError:
+ raise ValueError, "Local port must be an integer number"
+
+ print "--- TCP/IP to Serial redirector --- type Ctrl-C / BREAK to quit"
+
+ try:
+ ser.open()
+ except serial.SerialException, e:
+ print "Could not open serial port %s: %s" % (ser.portstr, e)
+ sys.exit(1)
+
+ srv = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ srv.bind( ('', localport) )
+ srv.listen(1)
+ while 1:
+ try:
+ print "Waiting for connection..."
+ connection, addr = srv.accept()
+ print 'Connected by', addr
+ #enter console->serial loop
+ r = Redirector(ser, connection)
+ r.shortcut()
+ print 'Disconnected'
+ connection.close()
+ except socket.error, msg:
+ print msg
+
+ print "\n--- exit ---"
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/test.py b/cesar/maximus/python/lib/proto/pyserial/examples/test.py
new file mode 100644
index 0000000000..ab3f830b52
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/test.py
@@ -0,0 +1,186 @@
+#!/usr/bin/env python
+#Python Serial Port Extension for Win32, Linux, BSD, Jython
+#see __init__.py
+#
+#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
+# this is distributed under a free software license, see license.txt
+
+"""Some tests for the serial module.
+Part of pyserial (http://pyserial.sf.net) (C)2002-2003 cliechti@gmx.net
+
+Intended to be run on different platforms, to ensure portability of
+the code.
+
+For all these tests a simple hardware is required.
+Loopback HW adapter:
+Shortcut these pin pairs:
+ TX <-> RX
+ RTS <-> CTS
+ DTR <-> DSR
+
+On a 9 pole DSUB these are the pins (2-3) (4-6) (7-8)
+"""
+
+import unittest, threading, time
+import serial
+
+#on which port should the tests be performed:
+PORT=0
+
+
+class Test4_Nonblocking(unittest.TestCase):
+ """Test with timeouts"""
+ timeout=0
+ def setUp(self):
+ self.s = serial.Serial(PORT,timeout=self.timeout)
+ def tearDown(self):
+ self.s.close()
+
+ def test0_Messy(self):
+ """NonBlocking (timeout=0)"""
+ #this is only here to write out the message in verbose mode
+ #because Test3 and Test4 print the same messages
+
+ def test1_ReadEmpty(self):
+ """timeout: After port open, the input buffer must be empty"""
+ self.failUnless(self.s.read(1)=='', "expected empty buffer")
+ def test2_Loopback(self):
+ """timeout: each sent character should return (binary test).
+ this is also a test for the binary capability of a port."""
+ for c in map(chr,range(256)):
+ self.s.write(c)
+ time.sleep(0.02) #there might be a small delay until the character is ready (especialy on win32)
+ self.failUnless(self.s.inWaiting()==1, "expected exactly one character for inWainting()")
+ self.failUnless(self.s.read(1)==c, "expected a '%s' which was written before" % c)
+ self.failUnless(self.s.read(1)=='', "expected empty buffer after all sent chars are read")
+ def test2_LoopbackTimeout(self):
+ """timeout: test the timeout/immediate return.
+ partial results should be returned."""
+ self.s.write("HELLO")
+ time.sleep(0.02) #there might be a small delay until the character is ready (especialy on win32)
+ #read more characters as are available to run in the timeout
+ self.failUnless(self.s.read(10)=='HELLO', "expected an 'HELLO' which was written before")
+ self.failUnless(self.s.read(1)=='', "expected empty buffer after all sent chars are read")
+
+
+class Test3_Timeout(Test4_Nonblocking):
+ """Same tests as the NonBlocking ones but this time with timeout"""
+ timeout=1
+ def test0_Messy(self):
+ """Blocking (timeout=1)"""
+ #this is only here to write out the message in verbose mode
+ #because Test3 and Test4 print the same messages
+
+class SendEvent(threading.Thread):
+ def __init__(self, serial, delay=1):
+ threading.Thread.__init__(self)
+ self.serial = serial
+ self.delay = delay
+ self.x = threading.Event()
+ self.stopped = 0
+ self.start()
+ def run(self):
+ time.sleep(self.delay)
+ if not self.stopped:
+ self.serial.write("E")
+ self.x.set()
+ def isSet(self):
+ return self.x.isSet()
+ def stop(self):
+ self.stopped = 1
+ self.x.wait()
+
+class Test1_Forever(unittest.TestCase):
+ """Tests a port with no timeout. These tests require that a
+ character is sent after some time to stop the test, this is done
+ through the SendEvent class and the Loopback HW."""
+ def setUp(self):
+ self.s = serial.Serial(PORT, timeout=None)
+ self.event = SendEvent(self.s)
+ def tearDown(self):
+ self.event.stop()
+ self.s.close()
+
+ def test2_ReadEmpty(self):
+ """no timeout: after port open, the input buffer must be empty (read).
+ a character is sent after some time to terminate the test (SendEvent)."""
+ c = self.s.read(1)
+ if not (self.event.isSet() and c == 'E'):
+ self.fail("expected marker")
+
+class Test2_Forever(unittest.TestCase):
+ """Tests a port with no timeout"""
+ def setUp(self):
+ self.s = serial.Serial(PORT,timeout=None)
+ def tearDown(self):
+ self.s.close()
+
+ def test1_inWaitingEmpty(self):
+ """no timeout: after port open, the input buffer must be empty (inWaiting)"""
+ self.failUnless(self.s.inWaiting()==0, "expected empty buffer")
+
+ def test2_Loopback(self):
+ """no timeout: each sent character should return (binary test).
+ this is also a test for the binary capability of a port."""
+ for c in map(chr,range(256)):
+ self.s.write(c)
+ time.sleep(0.02) #there might be a small delay until the character is ready (especialy on win32)
+ self.failUnless(self.s.inWaiting()==1, "expected exactly one character for inWainting()")
+ self.failUnless(self.s.read(1)==c, "expected an '%s' which was written before" % c)
+ self.failUnless(self.s.inWaiting()==0, "expected empty buffer after all sent chars are read")
+
+
+class Test0_DataWires(unittest.TestCase):
+ """Test modem control lines"""
+ def setUp(self):
+ self.s = serial.Serial(PORT)
+ def tearDown(self):
+ self.s.close()
+
+ def test1_RTS(self):
+ """Test RTS/CTS"""
+ self.s.setRTS(0)
+ self.failUnless(self.s.getCTS()==0, "CTS -> 0")
+ self.s.setRTS(1)
+ self.failUnless(self.s.getCTS()==1, "CTS -> 1")
+
+ def test2_DTR(self):
+ """Test DTR/DSR"""
+ self.s.setDTR(0)
+ self.failUnless(self.s.getDSR()==0, "DSR -> 0")
+ self.s.setDTR(1)
+ self.failUnless(self.s.getDSR()==1, "DSR -> 1")
+
+ def test3_RI(self):
+ """Test RI"""
+ self.failUnless(self.s.getRI()==0, "RI -> 0")
+
+class Test_MoreTimeouts(unittest.TestCase):
+ """Test with timeouts"""
+ def setUp(self):
+ self.s = serial.Serial() #create an closed serial port
+
+ def tearDown(self):
+ self.s.close()
+
+ def test_WriteTimeout(self):
+ """Test write() timeout."""
+ #use xonxoff setting and the loopback adapter to switch traffic on hold
+ self.s.port = PORT
+ self.s.writeTimeout = 1
+ self.s.xonxoff = 1
+ self.s.open()
+ self.s.write(serial.XOFF)
+ time.sleep(0.1) #some systems need a little delay so that they can react on XOFF
+ t1 = time.time()
+ self.failUnlessRaises(serial.SerialTimeoutException, self.s.write, "timeout please"*100)
+ t2 = time.time()
+ self.failUnless( 1 <= (t2-t1) < 2, "Timeout not in the given intervall (%s)" % (t2-t1))
+
+if __name__ == '__main__':
+ import sys
+ print __doc__
+ print "Testing port", PORT
+ sys.argv.append('-v')
+ # When this module is executed from the command-line, it runs all its tests
+ unittest.main()
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/test_advanced.py b/cesar/maximus/python/lib/proto/pyserial/examples/test_advanced.py
new file mode 100644
index 0000000000..980d29005f
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/test_advanced.py
@@ -0,0 +1,164 @@
+#!/usr/bin/env python
+#needs at least python 2.2.3
+
+#Python Serial Port Extension for Win32, Linux, BSD, Jython
+#see __init__.py
+#
+#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
+# this is distributed under a free software license, see license.txt
+
+"""Some tests for the serial module.
+Part of pyserial (http://pyserial.sf.net) (C)2002 cliechti@gmx.net
+
+Intended to be run on different platforms, to ensure portability of
+the code.
+
+These tests open a serial port and change all the settings on the fly.
+If the port is realy correctly configured cannot be determined - that
+would require external hardware or a nullmodem cable and an other
+serial port library... Thus it mainly tests that all features are
+correctly implemented and that the interface does what it should.
+"""
+
+import unittest
+import serial
+
+#on which port should the tests be performed:
+PORT=0
+
+class Test_ChangeAttributes(unittest.TestCase):
+ """Test with timeouts"""
+
+ def setUp(self):
+ self.s = serial.Serial() #create an closed serial port
+
+ def tearDown(self):
+ self.s.close()
+
+ def test_PortSetting(self):
+ self.s.port = PORT
+ #portstr has to be set
+ self.failUnlessEqual(self.s.portstr, serial.device(PORT))
+ #test internals
+ self.failUnlessEqual(self.s._port, PORT)
+ #test on the fly change
+ self.s.open()
+ self.failUnless(self.s.isOpen())
+ self.s.port = 0
+ self.failUnless(self.s.isOpen())
+ self.failUnlessEqual(self.s.port, 0)
+ self.failUnlessEqual(self.s.portstr, serial.device(0))
+ try:
+ self.s.port = 1
+ except serial.SerialException: #port not available on system
+ pass #cant test on this machine...
+ else:
+ self.failUnless(self.s.isOpen())
+ self.failUnlessEqual(self.s.port, 1)
+ self.failUnlessEqual(self.s.portstr, serial.device(1))
+
+ def test_BaudrateSetting(self):
+ self.s.port = PORT
+ self.s.open()
+ for baudrate in (300, 9600, 19200, 115200):
+ self.s.baudrate = baudrate
+ #test get method
+ self.failUnlessEqual(self.s.baudrate, baudrate)
+ #test internals
+ self.failUnlessEqual(self.s._baudrate, baudrate)
+ #test illegal values
+ for illegal_value in (-300, -1, 'a', None):
+ self.failUnlessRaises(ValueError, self.s.setBaudrate, illegal_value)
+
+ def test_BaudrateSetting2(self):
+ #test illegal values, depending on machine/port some of these may be valid...
+ self.s.port = PORT
+ self.s.open()
+ for illegal_value in (500000,576000,921600,92160):
+ self.failUnlessRaises(ValueError, self.s.setBaudrate, illegal_value)
+
+ def test_BytesizeSetting(self):
+ for bytesize in (5,6,7,8):
+ self.s.bytesize = bytesize
+ #test get method
+ self.failUnlessEqual(self.s.bytesize, bytesize)
+ #test internals
+ self.failUnlessEqual(self.s._bytesize, bytesize)
+ #test illegal values
+ for illegal_value in (0, 1, 3, 4, 9, 10, 'a', None):
+ self.failUnlessRaises(ValueError, self.s.setByteSize, illegal_value)
+
+ def test_ParitySetting(self):
+ for parity in (serial.PARITY_NONE, serial.PARITY_EVEN, serial.PARITY_ODD):
+ self.s.parity = parity
+ #test get method
+ self.failUnlessEqual(self.s.parity, parity)
+ #test internals
+ self.failUnlessEqual(self.s._parity, parity)
+ #test illegal values
+ for illegal_value in (0, 57, 'a', None):
+ self.failUnlessRaises(ValueError, self.s.setParity, illegal_value)
+
+ def test_StopbitsSetting(self):
+ for stopbits in (1, 2):
+ self.s.stopbits = stopbits
+ #test get method
+ self.failUnlessEqual(self.s.stopbits, stopbits)
+ #test internals
+ self.failUnlessEqual(self.s._stopbits, stopbits)
+ #test illegal values
+ for illegal_value in (0, 3, 1.5, 57, 'a', None):
+ self.failUnlessRaises(ValueError, self.s.setStopbits, illegal_value)
+
+ def test_TimeoutSetting(self):
+ for timeout in (None, 0, 1, 3.14159, 10, 1000, 3600):
+ self.s.timeout = timeout
+ #test get method
+ self.failUnlessEqual(self.s.timeout, timeout)
+ #test internals
+ self.failUnlessEqual(self.s._timeout, timeout)
+ #test illegal values
+ for illegal_value in (-1, 'a'):
+ self.failUnlessRaises(ValueError, self.s.setTimeout, illegal_value)
+
+ def test_XonXoffSetting(self):
+ for xonxoff in (True, False):
+ self.s.xonxoff = xonxoff
+ #test get method
+ self.failUnlessEqual(self.s.xonxoff, xonxoff)
+ #test internals
+ self.failUnlessEqual(self.s._xonxoff, xonxoff)
+ #no illegal values here, normal rules for the boolean value of an
+ #object are used thus all objects have a truth value.
+
+ def test_RtsCtsSetting(self):
+ for rtscts in (True, False):
+ self.s.rtscts = rtscts
+ #test get method
+ self.failUnlessEqual(self.s.rtscts, rtscts)
+ #test internals
+ self.failUnlessEqual(self.s._rtscts, rtscts)
+ #no illegal values here, normal rules for the boolean value of an
+ #object are used thus all objects have a truth value.
+
+ def test_UnconfiguredPort(self):
+ #an unconfigured port cannot be opened
+ self.failUnlessRaises(serial.SerialException, self.s.open)
+
+ def test_PortOpenClose(self):
+ self.s.port = PORT
+ for i in range(3):
+ #open the port and check flag
+ self.failUnless(not self.s.isOpen())
+ self.s.open()
+ self.failUnless(self.s.isOpen())
+ self.s.close()
+ self.failUnless(not self.s.isOpen())
+
+if __name__ == '__main__':
+ import sys
+ print __doc__
+ print "Testing port", PORT
+ sys.argv.append('-v')
+ # When this module is executed from the command-line, it runs all its tests
+ unittest.main()
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/test_high_load.py b/cesar/maximus/python/lib/proto/pyserial/examples/test_high_load.py
new file mode 100644
index 0000000000..ce884b32b3
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/test_high_load.py
@@ -0,0 +1,67 @@
+#!/usr/bin/env python
+#Python Serial Port Extension for Win32, Linux, BSD, Jython
+#see __init__.py
+#
+#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
+# this is distributed under a free software license, see license.txt
+
+"""Some tests for the serial module.
+Part of pyserial (http://pyserial.sf.net) (C)2002-2003 cliechti@gmx.net
+
+Intended to be run on different platforms, to ensure portability of
+the code.
+
+For all these tests a simple hardware is required.
+Loopback HW adapter:
+Shortcut these pin pairs:
+ TX <-> RX
+ RTS <-> CTS
+ DTR <-> DSR
+
+On a 9 pole DSUB these are the pins (2-3) (4-6) (7-8)
+"""
+
+import unittest, threading, time
+import serial
+
+#on which port should the tests be performed:
+PORT=0
+BAUDRATE=115200
+#~ BAUDRATE=9600
+
+
+class TestHighLoad(unittest.TestCase):
+ """Test sending and receiving large amount of data"""
+
+ N = 16
+ #~ N = 1
+
+ def setUp(self):
+ self.s = serial.Serial(PORT,BAUDRATE, timeout=10)
+ def tearDown(self):
+ self.s.close()
+
+ def test0_WriteReadLoopback(self):
+ """Send big strings, write/read order."""
+ for i in range(self.N):
+ q = ''.join(map(chr,range(256)))
+ self.s.write(q)
+ self.failUnless(self.s.read(len(q))==q, "expected a '%s' which was written before" % q)
+ self.failUnless(self.s.inWaiting()==0, "expected empty buffer after all sent chars are read")
+
+ def test1_WriteWriteReadLoopback(self):
+ """Send big strings, multiple write one read."""
+ q = ''.join(map(chr,range(256)))
+ for i in range(self.N):
+ self.s.write(q)
+ read = self.s.read(len(q)*self.N)
+ self.failUnless(read==q*self.N, "expected what was written before. got %d bytes, expected %d" % (len(read), self.N*len(q)))
+ self.failUnless(self.s.inWaiting()==0, "expected empty buffer after all sent chars are read")
+
+if __name__ == '__main__':
+ import sys
+ print __doc__
+ print "Testing port", PORT
+ sys.argv.append('-v')
+ # When this module is executed from the command-line, it runs all its tests
+ unittest.main()
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/wxSerialConfigDialog.py b/cesar/maximus/python/lib/proto/pyserial/examples/wxSerialConfigDialog.py
new file mode 100644
index 0000000000..57436ceae2
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/wxSerialConfigDialog.py
@@ -0,0 +1,259 @@
+#!/usr/bin/env python
+# generated by wxGlade 0.3.1 on Thu Oct 02 23:25:44 2003
+
+from wxPython.wx import *
+import serial
+
+SHOW_BAUDRATE = 1<<0
+SHOW_FORMAT = 1<<1
+SHOW_FLOW = 1<<2
+SHOW_TIMEOUT = 1<<3
+SHOW_ALL = SHOW_BAUDRATE|SHOW_FORMAT|SHOW_FLOW|SHOW_TIMEOUT
+
+try:
+ enumerate
+except NameError:
+ def enumerate(sequence):
+ return zip(range(len(sequence)), sequence)
+
+class SerialConfigDialog(wxDialog):
+ """Serial Port confiuration dialog, to be used with pyserial 2.0+
+ When instantiating a class of this dialog, then the "serial" keyword
+ argument is mandatory. It is a reference to a serial.Serial instance.
+ the optional "show" keyword argument can be used to show/hide different
+ settings. The default is SHOW_ALL which coresponds to
+ SHOW_BAUDRATE|SHOW_FORMAT|SHOW_FLOW|SHOW_TIMEOUT. All constants can be
+ found in ths module (not the class)."""
+
+ def __init__(self, *args, **kwds):
+ #grab the serial keyword and remove it from the dict
+ self.serial = kwds['serial']
+ del kwds['serial']
+ self.show = SHOW_ALL
+ if kwds.has_key('show'):
+ self.show = kwds['show']
+ del kwds['show']
+ # begin wxGlade: SerialConfigDialog.__init__
+ # end wxGlade
+ kwds["style"] = wxDEFAULT_DIALOG_STYLE
+ wxDialog.__init__(self, *args, **kwds)
+ self.label_2 = wxStaticText(self, -1, "Port")
+ self.combo_box_port = wxComboBox(self, -1, choices=["dummy1", "dummy2", "dummy3", "dummy4", "dummy5"], style=wxCB_DROPDOWN)
+ if self.show & SHOW_BAUDRATE:
+ self.label_1 = wxStaticText(self, -1, "Baudrate")
+ self.choice_baudrate = wxChoice(self, -1, choices=["choice 1"])
+ if self.show & SHOW_FORMAT:
+ self.label_3 = wxStaticText(self, -1, "Data Bits")
+ self.choice_databits = wxChoice(self, -1, choices=["choice 1"])
+ self.label_4 = wxStaticText(self, -1, "Stop Bits")
+ self.choice_stopbits = wxChoice(self, -1, choices=["choice 1"])
+ self.label_5 = wxStaticText(self, -1, "Parity")
+ self.choice_parity = wxChoice(self, -1, choices=["choice 1"])
+ if self.show & SHOW_TIMEOUT:
+ self.checkbox_timeout = wxCheckBox(self, -1, "Use Timeout")
+ self.text_ctrl_timeout = wxTextCtrl(self, -1, "")
+ self.label_6 = wxStaticText(self, -1, "seconds")
+ if self.show & SHOW_FLOW:
+ self.checkbox_rtscts = wxCheckBox(self, -1, "RTS/CTS")
+ self.checkbox_xonxoff = wxCheckBox(self, -1, "Xon/Xoff")
+ self.button_ok = wxButton(self, -1, "OK")
+ self.button_cancel = wxButton(self, -1, "Cancel")
+
+ self.__set_properties()
+ self.__do_layout()
+ #fill in ports and select current setting
+ index = 0
+ self.combo_box_port.Clear()
+ for n in range(4):
+ portname = serial.device(n)
+ self.combo_box_port.Append(portname)
+ if self.serial.portstr == portname:
+ index = n
+ if self.serial.portstr is not None:
+ self.combo_box_port.SetValue(str(self.serial.portstr))
+ else:
+ self.combo_box_port.SetSelection(index)
+ if self.show & SHOW_BAUDRATE:
+ #fill in badrates and select current setting
+ self.choice_baudrate.Clear()
+ for n, baudrate in enumerate(self.serial.BAUDRATES):
+ self.choice_baudrate.Append(str(baudrate))
+ if self.serial.baudrate == baudrate:
+ index = n
+ self.choice_baudrate.SetSelection(index)
+ if self.show & SHOW_FORMAT:
+ #fill in databits and select current setting
+ self.choice_databits.Clear()
+ for n, bytesize in enumerate(self.serial.BYTESIZES):
+ self.choice_databits.Append(str(bytesize))
+ if self.serial.bytesize == bytesize:
+ index = n
+ self.choice_databits.SetSelection(index)
+ #fill in stopbits and select current setting
+ self.choice_stopbits.Clear()
+ for n, stopbits in enumerate(self.serial.STOPBITS):
+ self.choice_stopbits.Append(str(stopbits))
+ if self.serial.stopbits == stopbits:
+ index = n
+ self.choice_stopbits.SetSelection(index)
+ #fill in parities and select current setting
+ self.choice_parity.Clear()
+ for n, parity in enumerate(self.serial.PARITIES):
+ self.choice_parity.Append(str(serial.PARITY_NAMES[parity]))
+ if self.serial.parity == parity:
+ index = n
+ self.choice_parity.SetSelection(index)
+ if self.show & SHOW_TIMEOUT:
+ #set the timeout mode and value
+ if self.serial.timeout is None:
+ self.checkbox_timeout.SetValue(False)
+ self.text_ctrl_timeout.Enable(False)
+ else:
+ self.checkbox_timeout.SetValue(True)
+ self.text_ctrl_timeout.Enable(True)
+ self.text_ctrl_timeout.SetValue(str(self.serial.timeout))
+ if self.show & SHOW_FLOW:
+ #set the rtscts mode
+ self.checkbox_rtscts.SetValue(self.serial.rtscts)
+ #set the rtscts mode
+ self.checkbox_xonxoff.SetValue(self.serial.xonxoff)
+ #attach the event handlers
+ self.__attach_events()
+
+ def __set_properties(self):
+ # begin wxGlade: SerialConfigDialog.__set_properties
+ # end wxGlade
+ self.SetTitle("Serial Port Configuration")
+ if self.show & SHOW_TIMEOUT:
+ self.text_ctrl_timeout.Enable(0)
+ self.button_ok.SetDefault()
+
+ def __do_layout(self):
+ # begin wxGlade: SerialConfigDialog.__do_layout
+ # end wxGlade
+ sizer_2 = wxBoxSizer(wxVERTICAL)
+ sizer_3 = wxBoxSizer(wxHORIZONTAL)
+ sizer_basics = wxStaticBoxSizer(wxStaticBox(self, -1, "Basics"), wxVERTICAL)
+ sizer_5 = wxBoxSizer(wxHORIZONTAL)
+ sizer_5.Add(self.label_2, 1, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_5.Add(self.combo_box_port, 1, 0, 0)
+ sizer_basics.Add(sizer_5, 0, wxRIGHT|wxEXPAND, 0)
+ if self.show & SHOW_BAUDRATE:
+ sizer_baudrate = wxBoxSizer(wxHORIZONTAL)
+ sizer_baudrate.Add(self.label_1, 1, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_baudrate.Add(self.choice_baudrate, 1, wxALIGN_RIGHT, 0)
+ sizer_basics.Add(sizer_baudrate, 0, wxEXPAND, 0)
+ sizer_2.Add(sizer_basics, 0, wxEXPAND, 0)
+ if self.show & SHOW_FORMAT:
+ sizer_8 = wxBoxSizer(wxHORIZONTAL)
+ sizer_7 = wxBoxSizer(wxHORIZONTAL)
+ sizer_6 = wxBoxSizer(wxHORIZONTAL)
+ sizer_format = wxStaticBoxSizer(wxStaticBox(self, -1, "Data Format"), wxVERTICAL)
+ sizer_6.Add(self.label_3, 1, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_6.Add(self.choice_databits, 1, wxALIGN_RIGHT, 0)
+ sizer_format.Add(sizer_6, 0, wxEXPAND, 0)
+ sizer_7.Add(self.label_4, 1, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_7.Add(self.choice_stopbits, 1, wxALIGN_RIGHT, 0)
+ sizer_format.Add(sizer_7, 0, wxEXPAND, 0)
+ sizer_8.Add(self.label_5, 1, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_8.Add(self.choice_parity, 1, wxALIGN_RIGHT, 0)
+ sizer_format.Add(sizer_8, 0, wxEXPAND, 0)
+ sizer_2.Add(sizer_format, 0, wxEXPAND, 0)
+ if self.show & SHOW_TIMEOUT:
+ sizer_timeout = wxStaticBoxSizer(wxStaticBox(self, -1, "Timeout"), wxHORIZONTAL)
+ sizer_timeout.Add(self.checkbox_timeout, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_timeout.Add(self.text_ctrl_timeout, 0, 0, 0)
+ sizer_timeout.Add(self.label_6, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_2.Add(sizer_timeout, 0, 0, 0)
+ if self.show & SHOW_FLOW:
+ sizer_flow = wxStaticBoxSizer(wxStaticBox(self, -1, "Flow Control"), wxHORIZONTAL)
+ sizer_flow.Add(self.checkbox_rtscts, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_flow.Add(self.checkbox_xonxoff, 0, wxALL|wxALIGN_CENTER_VERTICAL, 4)
+ sizer_flow.Add((10,10), 1, wxEXPAND, 0)
+ sizer_2.Add(sizer_flow, 0, wxEXPAND, 0)
+ sizer_3.Add(self.button_ok, 0, 0, 0)
+ sizer_3.Add(self.button_cancel, 0, 0, 0)
+ sizer_2.Add(sizer_3, 0, wxALL|wxALIGN_RIGHT, 4)
+ self.SetAutoLayout(1)
+ self.SetSizer(sizer_2)
+ sizer_2.Fit(self)
+ sizer_2.SetSizeHints(self)
+ self.Layout()
+
+ def __attach_events(self):
+ EVT_BUTTON(self, self.button_ok.GetId(), self.OnOK)
+ EVT_BUTTON(self, self.button_cancel.GetId(), self.OnCancel)
+ if self.show & SHOW_TIMEOUT:
+ EVT_CHECKBOX(self, self.checkbox_timeout.GetId(), self.OnTimeout)
+
+ def OnOK(self, events):
+ success = True
+ self.serial.port = str(self.combo_box_port.GetValue())
+ if self.show & SHOW_BAUDRATE:
+ self.serial.baudrate = self.serial.BAUDRATES[self.choice_baudrate.GetSelection()]
+ if self.show & SHOW_FORMAT:
+ self.serial.bytesize = self.serial.BYTESIZES[self.choice_databits.GetSelection()]
+ self.serial.stopbits = self.serial.STOPBITS[self.choice_stopbits.GetSelection()]
+ self.serial.parity = self.serial.PARITIES[self.choice_parity.GetSelection()]
+ if self.show & SHOW_FLOW:
+ self.serial.rtscts = self.checkbox_rtscts.GetValue()
+ self.serial.xonxoff = self.checkbox_xonxoff.GetValue()
+ if self.show & SHOW_TIMEOUT:
+ if self.checkbox_timeout.GetValue():
+ try:
+ self.serial.timeout = float(self.text_ctrl_timeout.GetValue())
+ except ValueError:
+ dlg = wxMessageDialog(self, 'Timeout must be a numeric value',
+ 'Value Error', wxOK | wxICON_ERROR)
+ dlg.ShowModal()
+ dlg.Destroy()
+ success = False
+ else:
+ self.serial.timeout = None
+ if success:
+ self.EndModal(wxID_OK)
+
+ def OnCancel(self, events):
+ self.EndModal(wxID_CANCEL)
+
+ def OnTimeout(self, events):
+ if self.checkbox_timeout.GetValue():
+ self.text_ctrl_timeout.Enable(True)
+ else:
+ self.text_ctrl_timeout.Enable(False)
+
+# end of class SerialConfigDialog
+
+
+class MyApp(wxApp):
+ """Test code"""
+ def OnInit(self):
+ wxInitAllImageHandlers()
+
+ ser = serial.Serial()
+ print ser
+ #loop until cancel is pressed, old values are used as start for the next run
+ #show the different views, one after the other
+ #value are kept.
+ for flags in (SHOW_BAUDRATE, SHOW_FLOW, SHOW_FORMAT, SHOW_TIMEOUT, SHOW_ALL):
+ dialog_serial_cfg = SerialConfigDialog(None, -1, "", serial=ser, show=flags)
+ self.SetTopWindow(dialog_serial_cfg)
+ result = dialog_serial_cfg.ShowModal()
+ print ser
+ if result != wxID_OK:
+ break
+ #the user can play around with the values, CANCEL aborts the loop
+ while 1:
+ dialog_serial_cfg = SerialConfigDialog(None, -1, "", serial=ser)
+ self.SetTopWindow(dialog_serial_cfg)
+ result = dialog_serial_cfg.ShowModal()
+ print ser
+ if result != wxID_OK:
+ break
+ return 0
+
+# end of class MyApp
+
+if __name__ == "__main__":
+ app = MyApp(0)
+ app.MainLoop()
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/wxSerialConfigDialog.wxg b/cesar/maximus/python/lib/proto/pyserial/examples/wxSerialConfigDialog.wxg
new file mode 100644
index 0000000000..8888611195
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/wxSerialConfigDialog.wxg
@@ -0,0 +1,262 @@
+<?xml version="1.0"?>
+<!-- generated by wxGlade 0.3.1 on Fri Oct 03 01:53:04 2003 -->
+
+<application path="D:\prog\python\pyserial_sf\pyserial\examples\wxSerialConfigDialog.py" name="app" class="MyApp" option="0" language="python" top_window="dialog_serial_cfg" encoding="ISO-8859-1" use_gettext="0" overwrite="0">
+ <object class="SerialConfigDialog" name="dialog_serial_cfg" base="EditDialog">
+ <style>wxDEFAULT_DIALOG_STYLE</style>
+ <title>Serial Port Configuration</title>
+ <object class="wxBoxSizer" name="sizer_2" base="EditBoxSizer">
+ <orient>wxVERTICAL</orient>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxStaticBoxSizer" name="sizer_basics" base="EditStaticBoxSizer">
+ <orient>wxVERTICAL</orient>
+ <label>Basics</label>
+ <object class="sizeritem">
+ <flag>wxRIGHT|wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_5" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>1</option>
+ <object class="wxStaticText" name="label_2" base="EditStaticText">
+ <attribute>1</attribute>
+ <label>Port</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>1</option>
+ <object class="wxComboBox" name="combo_box_port" base="EditComboBox">
+ <selection>0</selection>
+ <choices>
+ <choice>dummy1</choice>
+ <choice>dummy2</choice>
+ <choice>dummy3</choice>
+ <choice>dummy4</choice>
+ <choice>dummy5</choice>
+ </choices>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_baudrate" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>1</option>
+ <object class="wxStaticText" name="label_1" base="EditStaticText">
+ <attribute>1</attribute>
+ <label>Baudrate</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_RIGHT</flag>
+ <border>0</border>
+ <option>1</option>
+ <object class="wxChoice" name="choice_baudrate" base="EditChoice">
+ <selection>0</selection>
+ <choices>
+ <choice>choice 1</choice>
+ </choices>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxStaticBoxSizer" name="sizer_format" base="EditStaticBoxSizer">
+ <orient>wxVERTICAL</orient>
+ <label>Data Format</label>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_6" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>1</option>
+ <object class="wxStaticText" name="label_3" base="EditStaticText">
+ <attribute>1</attribute>
+ <label>Data Bits</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_RIGHT</flag>
+ <border>0</border>
+ <option>1</option>
+ <object class="wxChoice" name="choice_databits" base="EditChoice">
+ <selection>0</selection>
+ <choices>
+ <choice>choice 1</choice>
+ </choices>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_7" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>1</option>
+ <object class="wxStaticText" name="label_4" base="EditStaticText">
+ <attribute>1</attribute>
+ <label>Stop Bits</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_RIGHT</flag>
+ <border>0</border>
+ <option>1</option>
+ <object class="wxChoice" name="choice_stopbits" base="EditChoice">
+ <selection>0</selection>
+ <choices>
+ <choice>choice 1</choice>
+ </choices>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_8" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>1</option>
+ <object class="wxStaticText" name="label_5" base="EditStaticText">
+ <attribute>1</attribute>
+ <label>Parity</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALIGN_RIGHT</flag>
+ <border>0</border>
+ <option>1</option>
+ <object class="wxChoice" name="choice_parity" base="EditChoice">
+ <selection>0</selection>
+ <choices>
+ <choice>choice 1</choice>
+ </choices>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxStaticBoxSizer" name="sizer_timeout" base="EditStaticBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <label>Timeout</label>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>0</option>
+ <object class="wxCheckBox" name="checkbox_timeout" base="EditCheckBox">
+ <label>Use Timeout</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxTextCtrl" name="text_ctrl_timeout" base="EditTextCtrl">
+ <disabled>1</disabled>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>0</option>
+ <object class="wxStaticText" name="label_6" base="EditStaticText">
+ <attribute>1</attribute>
+ <label>seconds</label>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxStaticBoxSizer" name="sizer_flow" base="EditStaticBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <label>Flow Control</label>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>0</option>
+ <object class="wxCheckBox" name="checkbox_rtscts" base="EditCheckBox">
+ <label>RTS/CTS</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_CENTER_VERTICAL</flag>
+ <border>4</border>
+ <option>0</option>
+ <object class="wxCheckBox" name="checkbox_xonxoff" base="EditCheckBox">
+ <label>Xon/Xoff</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>1</option>
+ <object class="spacer" name="spacer" base="EditSpacer">
+ <height>10</height>
+ <width>10</width>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_RIGHT</flag>
+ <border>4</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_3" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxButton" name="button_ok" base="EditButton">
+ <default>1</default>
+ <label>OK</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxButton" name="button_cancel" base="EditButton">
+ <label>Cancel</label>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+</application>
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/wxTerminal.py b/cesar/maximus/python/lib/proto/pyserial/examples/wxTerminal.py
new file mode 100644
index 0000000000..fcac57195a
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/wxTerminal.py
@@ -0,0 +1,332 @@
+#!/usr/bin/env python
+# generated by wxGlade 0.3.1 on Fri Oct 03 23:23:45 2003
+
+from wxPython.wx import *
+import wxSerialConfigDialog
+import serial
+import threading
+
+#----------------------------------------------------------------------
+# Create an own event type, so that GUI updates can be delegated
+# this is required as on some platforms only the main thread can
+# access the GUI without crashing. wxMutexGuiEnter/wxMutexGuiLeave
+# could be used too, but an event is more elegant.
+
+SERIALRX = wxNewEventType()
+# bind to serial data receive events
+EVT_SERIALRX = wxPyEventBinder(SERIALRX, 0)
+
+class SerialRxEvent(wxPyCommandEvent):
+ eventType = SERIALRX
+ def __init__(self, windowID, data):
+ wxPyCommandEvent.__init__(self, self.eventType, windowID)
+ self.data = data
+
+ def Clone(self):
+ self.__class__(self.GetId(), self.data)
+
+#----------------------------------------------------------------------
+
+ID_CLEAR = wxNewId()
+ID_SAVEAS = wxNewId()
+ID_SETTINGS = wxNewId()
+ID_TERM = wxNewId()
+ID_EXIT = wxNewId()
+
+NEWLINE_CR = 0
+NEWLINE_LF = 1
+NEWLINE_CRLF = 2
+
+class TerminalSetup:
+ """Placeholder for various terminal settings. Used to pass the
+ options to the TerminalSettingsDialog."""
+ def __init__(self):
+ self.echo = False
+ self.unprintable = False
+ self.newline = NEWLINE_CRLF
+
+class TerminalSettingsDialog(wxDialog):
+ """Simple dialog with common terminal settings like echo, newline mode."""
+
+ def __init__(self, *args, **kwds):
+ self.settings = kwds['settings']
+ del kwds['settings']
+ # begin wxGlade: TerminalSettingsDialog.__init__
+ kwds["style"] = wxDEFAULT_DIALOG_STYLE
+ wxDialog.__init__(self, *args, **kwds)
+ self.checkbox_echo = wxCheckBox(self, -1, "Local Echo")
+ self.checkbox_unprintable = wxCheckBox(self, -1, "Show unprintable characters")
+ self.radio_box_newline = wxRadioBox(self, -1, "Newline Handling", choices=["CR only", "LF only", "CR+LF"], majorDimension=0, style=wxRA_SPECIFY_ROWS)
+ self.button_ok = wxButton(self, -1, "OK")
+ self.button_cancel = wxButton(self, -1, "Cancel")
+
+ self.__set_properties()
+ self.__do_layout()
+ # end wxGlade
+ self.__attach_events()
+ self.checkbox_echo.SetValue(self.settings.echo)
+ self.checkbox_unprintable.SetValue(self.settings.unprintable)
+ self.radio_box_newline.SetSelection(self.settings.newline)
+
+ def __set_properties(self):
+ # begin wxGlade: TerminalSettingsDialog.__set_properties
+ self.SetTitle("Terminal Settings")
+ self.radio_box_newline.SetSelection(0)
+ self.button_ok.SetDefault()
+ # end wxGlade
+
+ def __do_layout(self):
+ # begin wxGlade: TerminalSettingsDialog.__do_layout
+ sizer_2 = wxBoxSizer(wxVERTICAL)
+ sizer_3 = wxBoxSizer(wxHORIZONTAL)
+ sizer_4 = wxStaticBoxSizer(wxStaticBox(self, -1, "Input/Output"), wxVERTICAL)
+ sizer_4.Add(self.checkbox_echo, 0, wxALL, 4)
+ sizer_4.Add(self.checkbox_unprintable, 0, wxALL, 4)
+ sizer_4.Add(self.radio_box_newline, 0, 0, 0)
+ sizer_2.Add(sizer_4, 0, wxEXPAND, 0)
+ sizer_3.Add(self.button_ok, 0, 0, 0)
+ sizer_3.Add(self.button_cancel, 0, 0, 0)
+ sizer_2.Add(sizer_3, 0, wxALL|wxALIGN_RIGHT, 4)
+ self.SetAutoLayout(1)
+ self.SetSizer(sizer_2)
+ sizer_2.Fit(self)
+ sizer_2.SetSizeHints(self)
+ self.Layout()
+ # end wxGlade
+
+ def __attach_events(self):
+ self.Bind(EVT_BUTTON, self.OnOK, id = self.button_ok.GetId())
+ self.Bind(EVT_BUTTON, self.OnCancel, id = self.button_cancel.GetId())
+
+ def OnOK(self, events):
+ """Update data wil new values and close dialog."""
+ self.settings.echo = self.checkbox_echo.GetValue()
+ self.settings.unprintable = self.checkbox_unprintable.GetValue()
+ self.settings.newline = self.radio_box_newline.GetSelection()
+ self.EndModal(wxID_OK)
+
+ def OnCancel(self, events):
+ """Do not update data but close dialog."""
+ self.EndModal(wxID_CANCEL)
+
+# end of class TerminalSettingsDialog
+
+
+class TerminalFrame(wxFrame):
+ """Simple terminal program for wxPython"""
+
+ def __init__(self, *args, **kwds):
+ self.serial = serial.Serial()
+ self.serial.timeout = 0.5 #make sure that the alive event can be checked from time to time
+ self.settings = TerminalSetup() #placeholder for the settings
+ self.thread = None
+ self.alive = threading.Event()
+ # begin wxGlade: TerminalFrame.__init__
+ kwds["style"] = wxDEFAULT_FRAME_STYLE
+ wxFrame.__init__(self, *args, **kwds)
+ self.text_ctrl_output = wxTextCtrl(self, -1, "", style=wxTE_MULTILINE|wxTE_READONLY)
+
+ # Menu Bar
+ self.frame_terminal_menubar = wxMenuBar()
+ self.SetMenuBar(self.frame_terminal_menubar)
+ wxglade_tmp_menu = wxMenu()
+ wxglade_tmp_menu.Append(ID_CLEAR, "&Clear", "", wxITEM_NORMAL)
+ wxglade_tmp_menu.Append(ID_SAVEAS, "&Save Text As...", "", wxITEM_NORMAL)
+ wxglade_tmp_menu.AppendSeparator()
+ wxglade_tmp_menu.Append(ID_SETTINGS, "&Port Settings...", "", wxITEM_NORMAL)
+ wxglade_tmp_menu.Append(ID_TERM, "&Terminal Settings...", "", wxITEM_NORMAL)
+ wxglade_tmp_menu.AppendSeparator()
+ wxglade_tmp_menu.Append(ID_EXIT, "&Exit", "", wxITEM_NORMAL)
+ self.frame_terminal_menubar.Append(wxglade_tmp_menu, "&File")
+ # Menu Bar end
+
+ self.__set_properties()
+ self.__do_layout()
+ # end wxGlade
+ self.__attach_events() #register events
+ self.OnPortSettings(None) #call setup dialog on startup, opens port
+ if not self.alive.isSet():
+ self.Close()
+
+ def StartThread(self):
+ """Start the receiver thread"""
+ self.thread = threading.Thread(target=self.ComPortThread)
+ self.thread.setDaemon(1)
+ self.thread.start()
+ self.alive.set()
+
+ def StopThread(self):
+ """Stop the receiver thread, wait util it's finished."""
+ if self.thread is not None:
+ self.alive.clear() #clear alive event for thread
+ self.thread.join() #wait until thread has finished
+ self.thread = None
+
+ def __set_properties(self):
+ # begin wxGlade: TerminalFrame.__set_properties
+ self.SetTitle("Serial Terminal")
+ self.SetSize((546, 383))
+ # end wxGlade
+
+ def __do_layout(self):
+ # begin wxGlade: TerminalFrame.__do_layout
+ sizer_1 = wxBoxSizer(wxVERTICAL)
+ sizer_1.Add(self.text_ctrl_output, 1, wxEXPAND, 0)
+ self.SetAutoLayout(1)
+ self.SetSizer(sizer_1)
+ self.Layout()
+ # end wxGlade
+
+ def __attach_events(self):
+ #register events at the controls
+ self.Bind(EVT_MENU, self.OnClear, id = ID_CLEAR)
+ self.Bind(EVT_MENU, self.OnSaveAs, id = ID_SAVEAS)
+ self.Bind(EVT_MENU, self.OnExit, id = ID_EXIT)
+ self.Bind(EVT_MENU, self.OnPortSettings, id = ID_SETTINGS)
+ self.Bind(EVT_MENU, self.OnTermSettings, id = ID_TERM)
+ self.text_ctrl_output.Bind(EVT_CHAR, self.OnKey)
+ self.Bind(EVT_SERIALRX, self.OnSerialRead)
+ self.Bind(EVT_CLOSE, self.OnClose)
+
+ def OnExit(self, event):
+ """Menu point Exit"""
+ self.Close()
+
+ def OnClose(self, event):
+ """Called on application shutdown."""
+ self.StopThread() #stop reader thread
+ self.serial.close() #cleanup
+ self.Destroy() #close windows, exit app
+
+ def OnSaveAs(self, event):
+ """Save contents of output window."""
+ filename = None
+ dlg = wxFileDialog(None, "Save Text As...", ".", "", "Text File|*.txt|All Files|*", wxSAVE)
+ if dlg.ShowModal() == wxID_OK:
+ filename = dlg.GetPath()
+ dlg.Destroy()
+
+ if filename is not None:
+ f = file(filename, 'w')
+ text = self.text_ctrl_output.GetValue()
+ if type(text) == unicode:
+ text = text.encode("latin1") #hm, is that a good asumption?
+ f.write(text)
+ f.close()
+
+ def OnClear(self, event):
+ """Clear contents of output window."""
+ self.text_ctrl_output.Clear()
+
+ def OnPortSettings(self, event=None):
+ """Show the portsettings dialog. The reader thread is stopped for the
+ settings change."""
+ if event is not None: #will be none when called on startup
+ self.StopThread()
+ self.serial.close()
+ ok = False
+ while not ok:
+ dialog_serial_cfg = wxSerialConfigDialog.SerialConfigDialog(None, -1, "",
+ show=wxSerialConfigDialog.SHOW_BAUDRATE|wxSerialConfigDialog.SHOW_FORMAT|wxSerialConfigDialog.SHOW_FLOW,
+ serial=self.serial
+ )
+ result = dialog_serial_cfg.ShowModal()
+ dialog_serial_cfg.Destroy()
+ #open port if not called on startup, open it on startup and OK too
+ if result == wxID_OK or event is not None:
+ try:
+ self.serial.open()
+ except serial.SerialException, e:
+ dlg = wxMessageDialog(None, str(e), "Serial Port Error", wxOK | wxICON_ERROR)
+ dlg.ShowModal()
+ dlg.Destroy()
+ else:
+ self.StartThread()
+ self.SetTitle("Serial Terminal on %s [%s, %s%s%s%s%s]" % (
+ self.serial.portstr,
+ self.serial.baudrate,
+ self.serial.bytesize,
+ self.serial.parity,
+ self.serial.stopbits,
+ self.serial.rtscts and ' RTS/CTS' or '',
+ self.serial.xonxoff and ' Xon/Xoff' or '',
+ )
+ )
+ ok = True
+ else:
+ #on startup, dialog aborted
+ self.alive.clear()
+ ok = True
+
+ def OnTermSettings(self, event):
+ """Menu point Terminal Settings. Show the settings dialog
+ with the current terminal settings"""
+ dialog = TerminalSettingsDialog(None, -1, "", settings=self.settings)
+ result = dialog.ShowModal()
+ dialog.Destroy()
+
+ def OnKey(self, event):
+ """Key event handler. if the key is in the ASCII range, write it to the serial port.
+ Newline handling and local echo is also done here."""
+ code = event.GetKeyCode()
+ if code < 256: #is it printable?
+ if code == 13: #is it a newline? (check for CR which is the RETURN key)
+ if self.settings.echo: #do echo if needed
+ self.text_ctrl_output.AppendText('\n')
+ if self.settings.newline == NEWLINE_CR:
+ self.serial.write('\r') #send CR
+ elif self.settings.newline == NEWLINE_LF:
+ self.serial.write('\n') #send LF
+ elif self.settings.newline == NEWLINE_CRLF:
+ self.serial.write('\r\n') #send CR+LF
+ else:
+ char = chr(code)
+ if self.settings.echo: #do echo if needed
+ self.text_ctrl_output.WriteText(char)
+ self.serial.write(char) #send the charcater
+ else:
+ print "Extra Key:", code
+
+ def OnSerialRead(self, event):
+ """Handle input from the serial port."""
+ text = event.data
+ if self.settings.unprintable:
+ text = ''.join([(c >= ' ') and c or '<%d>' % ord(c) for c in text])
+ self.text_ctrl_output.AppendText(text)
+
+ def ComPortThread(self):
+ """Thread that handles the incomming traffic. Does the basic input
+ transformation (newlines) and generates an SerialRxEvent"""
+ while self.alive.isSet(): #loop while alive event is true
+ text = self.serial.read(1) #read one, with timout
+ if text: #check if not timeout
+ n = self.serial.inWaiting() #look if there is more to read
+ if n:
+ text = text + self.serial.read(n) #get it
+ #newline transformation
+ if self.settings.newline == NEWLINE_CR:
+ text = text.replace('\r', '\n')
+ elif self.settings.newline == NEWLINE_LF:
+ pass
+ elif self.settings.newline == NEWLINE_CRLF:
+ text = text.replace('\r\n', '\n')
+ event = SerialRxEvent(self.GetId(), text)
+ self.GetEventHandler().AddPendingEvent(event)
+ #~ self.OnSerialRead(text) #output text in window
+
+# end of class TerminalFrame
+
+
+class MyApp(wxApp):
+ def OnInit(self):
+ wxInitAllImageHandlers()
+ frame_terminal = TerminalFrame(None, -1, "")
+ self.SetTopWindow(frame_terminal)
+ frame_terminal.Show(1)
+ return 1
+
+# end of class MyApp
+
+if __name__ == "__main__":
+ app = MyApp(0)
+ app.MainLoop()
diff --git a/cesar/maximus/python/lib/proto/pyserial/examples/wxTerminal.wxg b/cesar/maximus/python/lib/proto/pyserial/examples/wxTerminal.wxg
new file mode 100644
index 0000000000..1f20511f6b
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/examples/wxTerminal.wxg
@@ -0,0 +1,127 @@
+<?xml version="1.0"?>
+<!-- generated by wxGlade 0.3.1 on Sat Oct 04 02:41:48 2003 -->
+
+<application path="D:\prog\python\pyserial_sf\pyserial\examples\wxTerminal.py" name="app" class="MyApp" option="0" language="python" top_window="frame_terminal" encoding="ISO-8859-1" use_gettext="0" overwrite="0">
+ <object class="TerminalFrame" name="frame_terminal" base="EditFrame">
+ <style>wxDEFAULT_FRAME_STYLE</style>
+ <title>Serial Terminal</title>
+ <menubar>1</menubar>
+ <size>546, 383</size>
+ <object class="wxBoxSizer" name="sizer_1" base="EditBoxSizer">
+ <orient>wxVERTICAL</orient>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>1</option>
+ <object class="wxTextCtrl" name="text_ctrl_output" base="EditTextCtrl">
+ <style>wxTE_MULTILINE|wxTE_READONLY</style>
+ </object>
+ </object>
+ </object>
+ <object class="wxMenuBar" name="frame_terminal_menubar" base="EditMenuBar">
+ <menus>
+ <menu name="" label="&amp;File">
+ <item>
+ <label>&amp;Clear</label>
+ <id>ID_CLEAR</id>
+ </item>
+ <item>
+ <label>&amp;Save Text As...</label>
+ <id>ID_SAVEAS</id>
+ </item>
+ <item>
+ <label>---</label>
+ <id>---</id>
+ <name>---</name>
+ </item>
+ <item>
+ <label>&amp;Port Settings...</label>
+ <id>ID_SETTINGS</id>
+ </item>
+ <item>
+ <label>&amp;Terminal Settings...</label>
+ <id>ID_TERM</id>
+ </item>
+ <item>
+ <label>---</label>
+ <name>---</name>
+ </item>
+ <item>
+ <label>&amp;Exit</label>
+ <id>ID_EXIT</id>
+ </item>
+ </menu>
+ </menus>
+ </object>
+ </object>
+ <object class="TerminalSettingsDialog" name="dialog_terminal_Settings" base="EditDialog">
+ <style>wxDEFAULT_DIALOG_STYLE</style>
+ <title>Terminal Settings</title>
+ <object class="wxBoxSizer" name="sizer_2" base="EditBoxSizer">
+ <orient>wxVERTICAL</orient>
+ <object class="sizeritem">
+ <flag>wxEXPAND</flag>
+ <border>0</border>
+ <option>0</option>
+ <object class="wxStaticBoxSizer" name="sizer_4" base="EditStaticBoxSizer">
+ <orient>wxVERTICAL</orient>
+ <label>Input/Output</label>
+ <object class="sizeritem">
+ <flag>wxALL</flag>
+ <border>4</border>
+ <option>0</option>
+ <object class="wxCheckBox" name="checkbox_echo" base="EditCheckBox">
+ <label>Local Echo</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALL</flag>
+ <border>4</border>
+ <option>0</option>
+ <object class="wxCheckBox" name="checkbox_unprintable" base="EditCheckBox">
+ <label>Show unprintable characters</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxRadioBox" name="radio_box_newline" base="EditRadioBox">
+ <style>wxRA_SPECIFY_ROWS</style>
+ <selection>0</selection>
+ <dimension>0</dimension>
+ <label>Newline Handling</label>
+ <choices>
+ <choice>CR only</choice>
+ <choice>LF only</choice>
+ <choice>CR+LF</choice>
+ </choices>
+ </object>
+ </object>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <flag>wxALL|wxALIGN_RIGHT</flag>
+ <border>4</border>
+ <option>0</option>
+ <object class="wxBoxSizer" name="sizer_3" base="EditBoxSizer">
+ <orient>wxHORIZONTAL</orient>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxButton" name="button_ok" base="EditButton">
+ <default>1</default>
+ <label>OK</label>
+ </object>
+ </object>
+ <object class="sizeritem">
+ <border>0</border>
+ <option>0</option>
+ <object class="wxButton" name="button_cancel" base="EditButton">
+ <label>Cancel</label>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+ </object>
+</application>
diff --git a/cesar/maximus/python/lib/proto/pyserial/serial/__init__.py b/cesar/maximus/python/lib/proto/pyserial/serial/__init__.py
new file mode 100644
index 0000000000..2894b30055
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/serial/__init__.py
@@ -0,0 +1,20 @@
+#!/usr/bin/env python
+#portable serial port access with python
+#this is a wrapper module for different platform implementations
+#
+# (C)2001-2002 Chris Liechti <cliechti@gmx.net>
+# this is distributed under a free software license, see license.txt
+
+import sys, os, string
+VERSION = string.split("$Revision: 1.3 $")[1] #extract CVS version
+
+#chose an implementation, depending on os
+if os.name == 'nt': #sys.platform == 'win32':
+ from serialwin32 import *
+elif os.name == 'posix':
+ from serialposix import *
+elif os.name == 'java':
+ from serialjava import *
+else:
+ raise Exception("Sorry: no implementation for your platform ('%s') available" % os.name)
+
diff --git a/cesar/maximus/python/lib/proto/pyserial/serial/serialjava.py b/cesar/maximus/python/lib/proto/pyserial/serial/serialjava.py
new file mode 100644
index 0000000000..f5c84fb99b
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/serial/serialjava.py
@@ -0,0 +1,212 @@
+#!jython
+#Python Serial Port Extension for Win32, Linux, BSD, Jython
+#module for serial IO for Jython and JavaComm
+#see __init__.py
+#
+#(C) 2002-2003 Chris Liechti <cliechti@gmx.net>
+# this is distributed under a free software license, see license.txt
+
+import javax.comm
+from serialutil import *
+
+VERSION = "$Revision: 1.8 $".split()[1] #extract CVS version
+
+
+def device(portnumber):
+ """Turn a port number into a device name"""
+ enum = javax.comm.CommPortIdentifier.getPortIdentifiers()
+ ports = []
+ while enum.hasMoreElements():
+ el = enum.nextElement()
+ if el.getPortType() == javax.comm.CommPortIdentifier.PORT_SERIAL:
+ ports.append(el)
+ return ports[portnumber].getName()
+
+class Serial(SerialBase):
+ """Serial port class, implemented with javax.comm and thus usable with
+ jython and the appropriate java extension."""
+
+ def open(self):
+ """Open port with current settings. This may throw a SerialException
+ if the port cannot be opened."""
+ if self._port is None:
+ raise SerialException("Port must be configured before it can be used.")
+ if type(self._port) == type(''): #strings are taken directly
+ portId = javax.comm.CommPortIdentifier.getPortIdentifier(self._port)
+ else:
+ portId = javax.comm.CommPortIdentifier.getPortIdentifier(device(self._port)) #numbers are transformed to a comportid obj
+ try:
+ self.sPort = portId.open("python serial module", 10)
+ except Exception, msg:
+ self.sPort = None
+ raise SerialException("Could not open port: %s" % msg)
+ self._reconfigurePort()
+ self._instream = self.sPort.getInputStream()
+ self._outstream = self.sPort.getOutputStream()
+ self._isOpen = True
+
+ def _reconfigurePort(self):
+ """Set commuication parameters on opened port."""
+ if not self.sPort:
+ raise SerialException("Can only operate on a valid port handle")
+
+ self.sPort.enableReceiveTimeout(30)
+ if self._bytesize == FIVEBITS:
+ jdatabits = javax.comm.SerialPort.DATABITS_5
+ elif self._bytesize == SIXBITS:
+ jdatabits = javax.comm.SerialPort.DATABITS_6
+ elif self._bytesize == SEVENBITS:
+ jdatabits = javax.comm.SerialPort.DATABITS_7
+ elif self._bytesize == EIGHTBITS:
+ jdatabits = javax.comm.SerialPort.DATABITS_8
+ else:
+ raise ValueError("unsupported bytesize: %r" % self._bytesize)
+
+ if self._stopbits == STOPBITS_ONE:
+ jstopbits = javax.comm.SerialPort.STOPBITS_1
+ elif stopbits == STOPBITS_ONE_HALVE:
+ self._jstopbits = javax.comm.SerialPort.STOPBITS_1_5
+ elif self._stopbits == STOPBITS_TWO:
+ jstopbits = javax.comm.SerialPort.STOPBITS_2
+ else:
+ raise ValueError("unsupported number of stopbits: %r" % self._stopbits)
+
+ if self._parity == PARITY_NONE:
+ jparity = javax.comm.SerialPort.PARITY_NONE
+ elif self._parity == PARITY_EVEN:
+ jparity = javax.comm.SerialPort.PARITY_EVEN
+ elif self._parity == PARITY_ODD:
+ jparity = javax.comm.SerialPort.PARITY_ODD
+ #~ elif self._parity == PARITY_MARK:
+ #~ jparity = javax.comm.SerialPort.PARITY_MARK
+ #~ elif self._parity == PARITY_SPACE:
+ #~ jparity = javax.comm.SerialPort.PARITY_SPACE
+ else:
+ raise ValueError("unsupported parity type: %r" % self._parity)
+
+ jflowin = jflowout = 0
+ if self._rtscts:
+ jflowin |= javax.comm.SerialPort.FLOWCONTROL_RTSCTS_IN
+ jflowout |= javax.comm.SerialPort.FLOWCONTROL_RTSCTS_OUT
+ if self._xonxoff:
+ jflowin |= javax.comm.SerialPort.FLOWCONTROL_XONXOFF_IN
+ jflowout |= javax.comm.SerialPort.FLOWCONTROL_XONXOFF_OUT
+
+ self.sPort.setSerialPortParams(baudrate, jdatabits, jstopbits, jparity)
+ self.sPort.setFlowControlMode(jflowin | jflowout)
+
+ if self._timeout >= 0:
+ self.sPort.enableReceiveTimeout(self._timeout*1000)
+ else:
+ self.sPort.disableReceiveTimeout()
+
+ def close(self):
+ """Close port"""
+ if self._isOpen:
+ if self.sPort:
+ self._instream.close()
+ self._outstream.close()
+ self.sPort.close()
+ self.sPort = None
+ self._isOpen = False
+
+ def makeDeviceName(self, port):
+ return device(port)
+
+ # - - - - - - - - - - - - - - - - - - - - - - - -
+
+ def inWaiting(self):
+ """Return the number of characters currently in the input buffer."""
+ if not self.sPort: raise portNotOpenError
+ return self._instream.available()
+
+ def read(self, size=1):
+ """Read size bytes from the serial port. If a timeout is set it may
+ return less characters as requested. With no timeout it will block
+ until the requested number of bytes is read."""
+ if not self.sPort: raise portNotOpenError
+ read = ''
+ if size > 0:
+ while len(read) < size:
+ x = self._instream.read()
+ if x == -1:
+ if self.timeout >= 0:
+ break
+ else:
+ read = read + chr(x)
+ return read
+
+ def write(self, data):
+ """Output the given string over the serial port."""
+ if not self.sPort: raise portNotOpenError
+ self._outstream.write(data)
+
+ def flushInput(self):
+ """Clear input buffer, discarding all that is in the buffer."""
+ if not self.sPort: raise portNotOpenError
+ self._instream.skip(self._instream.available())
+
+ def flushOutput(self):
+ """Clear output buffer, aborting the current output and
+ discarding all that is in the buffer."""
+ if not self.sPort: raise portNotOpenError
+ self._outstream.flush()
+
+ def sendBreak(self):
+ """Send break condition."""
+ if not self.sPort: raise portNotOpenError
+ self.sPort.sendBreak()
+
+ def setRTS(self,on=1):
+ """Set terminal status line: Request To Send"""
+ if not self.sPort: raise portNotOpenError
+ self.sPort.setRTS(on)
+
+ def setDTR(self,on=1):
+ """Set terminal status line: Data Terminal Ready"""
+ if not self.sPort: raise portNotOpenError
+ self.sPort.setDTR(on)
+
+ def getCTS(self):
+ """Read terminal status line: Clear To Send"""
+ if not self.sPort: raise portNotOpenError
+ self.sPort.isCTS()
+
+ def getDSR(self):
+ """Read terminal status line: Data Set Ready"""
+ if not self.sPort: raise portNotOpenError
+ self.sPort.isDSR()
+
+ def getRI(self):
+ """Read terminal status line: Ring Indicator"""
+ if not self.sPort: raise portNotOpenError
+ self.sPort.isRI()
+
+ def getCD(self):
+ """Read terminal status line: Carrier Detect"""
+ if not self.sPort: raise portNotOpenError
+ self.sPort.isCD()
+
+
+
+if __name__ == '__main__':
+ s = Serial(0,
+ baudrate=19200, #baudrate
+ bytesize=EIGHTBITS, #number of databits
+ parity=PARITY_EVEN, #enable parity checking
+ stopbits=STOPBITS_ONE, #number of stopbits
+ timeout=3, #set a timeout value, None for waiting forever
+ xonxoff=0, #enable software flow control
+ rtscts=0, #enable RTS/CTS flow control
+ )
+ s.setRTS(1)
+ s.setDTR(1)
+ s.flushInput()
+ s.flushOutput()
+ s.write('hello')
+ print repr(s.read(5))
+ print s.inWaiting()
+ del s
+
+
+
diff --git a/cesar/maximus/python/lib/proto/pyserial/serial/serialposix.py b/cesar/maximus/python/lib/proto/pyserial/serial/serialposix.py
new file mode 100644
index 0000000000..09aef6ca9c
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/serial/serialposix.py
@@ -0,0 +1,406 @@
+#!/usr/bin/env python
+#Python Serial Port Extension for Win32, Linux, BSD, Jython
+#module for serial IO for POSIX compatible systems, like Linux
+#see __init__.py
+#
+#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
+# this is distributed under a free software license, see license.txt
+#
+#parts based on code from Grant B. Edwards <grante@visi.com>:
+# ftp://ftp.visi.com/users/grante/python/PosixSerial.py
+# references: http://www.easysw.com/~mike/serial/serial.html
+
+import sys, os, fcntl, termios, struct, select, errno
+from serialutil import *
+
+VERSION = "$Revision: 1.27 $".split()[1] #extract CVS version
+
+#Do check the Python version as some constants have moved.
+if (sys.hexversion < 0x020100f0):
+ import TERMIOS
+else:
+ TERMIOS = termios
+
+if (sys.hexversion < 0x020200f0):
+ import FCNTL
+else:
+ FCNTL = fcntl
+
+#try to detect the os so that a device can be selected...
+plat = sys.platform.lower()
+
+if plat[:5] == 'linux': #Linux (confirmed)
+ def device(port):
+ return '/dev/ttyS%d' % port
+
+elif plat == 'cygwin': #cywin/win32 (confirmed)
+ def device(port):
+ return '/dev/com%d' % (port + 1)
+
+elif plat == 'openbsd3': #BSD (confirmed)
+ def device(port):
+ return '/dev/ttyp%d' % port
+
+elif plat[:3] == 'bsd' or \
+ plat[:7] == 'freebsd' or \
+ plat[:7] == 'openbsd' or \
+ plat[:6] == 'darwin': #BSD (confirmed for freebsd4: cuaa%d)
+ def device(port):
+ return '/dev/cuaa%d' % port
+
+elif plat[:6] == 'netbsd': #NetBSD 1.6 testing by Erk
+ def device(port):
+ return '/dev/dty%02d' % port
+
+elif plat[:4] == 'irix': #IRIX (not tested)
+ def device(port):
+ return '/dev/ttyf%d' % port
+
+elif plat[:2] == 'hp': #HP-UX (not tested)
+ def device(port):
+ return '/dev/tty%dp0' % (port+1)
+
+elif plat[:5] == 'sunos': #Solaris/SunOS (confirmed)
+ def device(port):
+ return '/dev/tty%c' % (ord('a')+port)
+
+elif plat[:3] == 'aix': #aix
+ def device(port):
+ return '/dev/tty%d' % (port)
+
+else:
+ #platform detection has failed...
+ print """don't know how to number ttys on this system.
+! Use an explicit path (eg /dev/ttyS1) or send this information to
+! the author of this module:
+
+sys.platform = %r
+os.name = %r
+serialposix.py version = %s
+
+also add the device name of the serial port and where the
+counting starts for the first serial port.
+e.g. 'first serial port: /dev/ttyS0'
+and with a bit luck you can get this module running...
+""" % (sys.platform, os.name, VERSION)
+ #no exception, just continue with a brave attempt to build a device name
+ #even if the device name is not correct for the platform it has chances
+ #to work using a string with the real device name as port paramter.
+ def device(portum):
+ return '/dev/ttyS%d' % portnum
+ #~ raise Exception, "this module does not run on this platform, sorry."
+
+#whats up with "aix", "beos", ....
+#they should work, just need to know the device names.
+
+
+#load some constants for later use.
+#try to use values from TERMIOS, use defaults from linux otherwise
+TIOCMGET = hasattr(TERMIOS, 'TIOCMGET') and TERMIOS.TIOCMGET or 0x5415
+TIOCMBIS = hasattr(TERMIOS, 'TIOCMBIS') and TERMIOS.TIOCMBIS or 0x5416
+TIOCMBIC = hasattr(TERMIOS, 'TIOCMBIC') and TERMIOS.TIOCMBIC or 0x5417
+TIOCMSET = hasattr(TERMIOS, 'TIOCMSET') and TERMIOS.TIOCMSET or 0x5418
+
+#TIOCM_LE = hasattr(TERMIOS, 'TIOCM_LE') and TERMIOS.TIOCM_LE or 0x001
+TIOCM_DTR = hasattr(TERMIOS, 'TIOCM_DTR') and TERMIOS.TIOCM_DTR or 0x002
+TIOCM_RTS = hasattr(TERMIOS, 'TIOCM_RTS') and TERMIOS.TIOCM_RTS or 0x004
+#TIOCM_ST = hasattr(TERMIOS, 'TIOCM_ST') and TERMIOS.TIOCM_ST or 0x008
+#TIOCM_SR = hasattr(TERMIOS, 'TIOCM_SR') and TERMIOS.TIOCM_SR or 0x010
+
+TIOCM_CTS = hasattr(TERMIOS, 'TIOCM_CTS') and TERMIOS.TIOCM_CTS or 0x020
+TIOCM_CAR = hasattr(TERMIOS, 'TIOCM_CAR') and TERMIOS.TIOCM_CAR or 0x040
+TIOCM_RNG = hasattr(TERMIOS, 'TIOCM_RNG') and TERMIOS.TIOCM_RNG or 0x080
+TIOCM_DSR = hasattr(TERMIOS, 'TIOCM_DSR') and TERMIOS.TIOCM_DSR or 0x100
+TIOCM_CD = hasattr(TERMIOS, 'TIOCM_CD') and TERMIOS.TIOCM_CD or TIOCM_CAR
+TIOCM_RI = hasattr(TERMIOS, 'TIOCM_RI') and TERMIOS.TIOCM_RI or TIOCM_RNG
+#TIOCM_OUT1 = hasattr(TERMIOS, 'TIOCM_OUT1') and TERMIOS.TIOCM_OUT1 or 0x2000
+#TIOCM_OUT2 = hasattr(TERMIOS, 'TIOCM_OUT2') and TERMIOS.TIOCM_OUT2 or 0x4000
+TIOCINQ = hasattr(TERMIOS, 'FIONREAD') and TERMIOS.FIONREAD or 0x541B
+
+TIOCM_zero_str = struct.pack('I', 0)
+TIOCM_RTS_str = struct.pack('I', TIOCM_RTS)
+TIOCM_DTR_str = struct.pack('I', TIOCM_DTR)
+
+
+class Serial(SerialBase):
+ """Serial port class POSIX implementation. Serial port configuration is
+ done with termios and fcntl. Runs on Linux and many other Un*x like
+ systems."""
+
+ def open(self):
+ """Open port with current settings. This may throw a SerialException
+ if the port cannot be opened."""
+ if self._port is None:
+ raise SerialException("Port must be configured before it can be used.")
+ self.fd = None
+ #open
+ try:
+ self.fd = os.open(self.portstr, os.O_RDWR|os.O_NOCTTY|os.O_NONBLOCK)
+ except Exception, msg:
+ self.fd = None
+ raise SerialException("Could not open port: %s" % msg)
+ #~ fcntl.fcntl(self.fd, FCNTL.F_SETFL, 0) #set blocking
+
+ self._reconfigurePort()
+ self._isOpen = True
+ #~ self.flushInput()
+
+
+ def _reconfigurePort(self):
+ """Set commuication parameters on opened port."""
+ if self.fd is None:
+ raise SerialException("Can only operate on a valid port handle")
+
+ vmin = vtime = 0 #timeout is done via select
+ try:
+ iflag, oflag, cflag, lflag, ispeed, ospeed, cc = termios.tcgetattr(self.fd)
+ except termios.error, msg: #if a port is nonexistent but has a /dev file, it'll fail here
+ raise SerialException("Could not configure port: %s" % msg)
+ #set up raw mode / no echo / binary
+ cflag |= (TERMIOS.CLOCAL|TERMIOS.CREAD)
+ lflag &= ~(TERMIOS.ICANON|TERMIOS.ECHO|TERMIOS.ECHOE|TERMIOS.ECHOK|TERMIOS.ECHONL|
+ TERMIOS.ISIG|TERMIOS.IEXTEN) #|TERMIOS.ECHOPRT
+ for flag in ('ECHOCTL', 'ECHOKE'): #netbsd workaround for Erk
+ if hasattr(TERMIOS, flag):
+ lflag &= ~getattr(TERMIOS, flag)
+
+ oflag &= ~(TERMIOS.OPOST)
+ iflag &= ~(TERMIOS.INLCR|TERMIOS.IGNCR|TERMIOS.ICRNL|TERMIOS.IGNBRK)
+ if hasattr(TERMIOS, 'IUCLC'):
+ iflag &= ~TERMIOS.IUCLC
+ if hasattr(TERMIOS, 'PARMRK'):
+ iflag &= ~TERMIOS.PARMRK
+
+ #setup baudrate
+ try:
+ ispeed = ospeed = getattr(TERMIOS,'B%s' % (self._baudrate))
+ except AttributeError:
+ raise ValueError('Invalid baud rate: %r' % self._baudrate)
+ #setup char len
+ cflag &= ~TERMIOS.CSIZE
+ if self._bytesize == 8:
+ cflag |= TERMIOS.CS8
+ elif self._bytesize == 7:
+ cflag |= TERMIOS.CS7
+ elif self._bytesize == 6:
+ cflag |= TERMIOS.CS6
+ elif self._bytesize == 5:
+ cflag |= TERMIOS.CS5
+ else:
+ raise ValueError('Invalid char len: %r' % self._bytesize)
+ #setup stopbits
+ if self._stopbits == STOPBITS_ONE:
+ cflag &= ~(TERMIOS.CSTOPB)
+ elif self._stopbits == STOPBITS_TWO:
+ cflag |= (TERMIOS.CSTOPB)
+ else:
+ raise ValueError('Invalid stopit specification: %r' % self._stopbits)
+ #setup parity
+ iflag &= ~(TERMIOS.INPCK|TERMIOS.ISTRIP)
+ if self._parity == PARITY_NONE:
+ cflag &= ~(TERMIOS.PARENB|TERMIOS.PARODD)
+ elif self._parity == PARITY_EVEN:
+ cflag &= ~(TERMIOS.PARODD)
+ cflag |= (TERMIOS.PARENB)
+ elif self._parity == PARITY_ODD:
+ cflag |= (TERMIOS.PARENB|TERMIOS.PARODD)
+ else:
+ raise ValueError('Invalid parity: %r' % self._parity)
+ #setup flow control
+ #xonxoff
+ if hasattr(TERMIOS, 'IXANY'):
+ if self._xonxoff:
+ iflag |= (TERMIOS.IXON|TERMIOS.IXOFF) #|TERMIOS.IXANY)
+ else:
+ iflag &= ~(TERMIOS.IXON|TERMIOS.IXOFF|TERMIOS.IXANY)
+ else:
+ if self._xonxoff:
+ iflag |= (TERMIOS.IXON|TERMIOS.IXOFF)
+ else:
+ iflag &= ~(TERMIOS.IXON|TERMIOS.IXOFF)
+ #rtscts
+ if hasattr(TERMIOS, 'CRTSCTS'):
+ if self._rtscts:
+ cflag |= (TERMIOS.CRTSCTS)
+ else:
+ cflag &= ~(TERMIOS.CRTSCTS)
+ elif hasattr(TERMIOS, 'CNEW_RTSCTS'): #try it with alternate constant name
+ if self._rtscts:
+ cflag |= (TERMIOS.CNEW_RTSCTS)
+ else:
+ cflag &= ~(TERMIOS.CNEW_RTSCTS)
+ #XXX should there be a warning if setting up rtscts (and xonxoff etc) fails??
+
+ #buffer
+ #vmin "minimal number of characters to be read. = for non blocking"
+ if vmin < 0 or vmin > 255:
+ raise ValueError('Invalid vmin: %r ' % vmin)
+ cc[TERMIOS.VMIN] = vmin
+ #vtime
+ if vtime < 0 or vtime > 255:
+ raise ValueError('Invalid vtime: %r' % vtime)
+ cc[TERMIOS.VTIME] = vtime
+ #activate settings
+ termios.tcsetattr(self.fd, TERMIOS.TCSANOW, [iflag, oflag, cflag, lflag, ispeed, ospeed, cc])
+
+ def close(self):
+ """Close port"""
+ if self._isOpen:
+ if self.fd is not None:
+ os.close(self.fd)
+ self.fd = None
+ self._isOpen = False
+
+ def makeDeviceName(self, port):
+ return device(port)
+
+ # - - - - - - - - - - - - - - - - - - - - - - - -
+
+ def inWaiting(self):
+ """Return the number of characters currently in the input buffer."""
+ #~ s = fcntl.ioctl(self.fd, TERMIOS.FIONREAD, TIOCM_zero_str)
+ s = fcntl.ioctl(self.fd, TIOCINQ, TIOCM_zero_str)
+ return struct.unpack('I',s)[0]
+
+ def read(self, size=1):
+ """Read size bytes from the serial port. If a timeout is set it may
+ return less characters as requested. With no timeout it will block
+ until the requested number of bytes is read."""
+ if self.fd is None: raise portNotOpenError
+ read = ''
+ inp = None
+ if size > 0:
+ while len(read) < size:
+ #print "\tread(): size",size, "have", len(read) #debug
+ ready,_,_ = select.select([self.fd],[],[], self._timeout)
+ if not ready:
+ break #timeout
+ buf = os.read(self.fd, size-len(read))
+ read = read + buf
+ if self._timeout >= 0 and not buf:
+ break #early abort on timeout
+ return read
+
+ def write(self, data):
+ """Output the given string over the serial port."""
+ if self.fd is None: raise portNotOpenError
+ t = len(data)
+ d = data
+ while t > 0:
+ try:
+ if self._writeTimeout is not None and self._writeTimeout > 0:
+ _,ready,_ = select.select([],[self.fd],[], self._writeTimeout)
+ if not ready:
+ raise writeTimeoutError
+ n = os.write(self.fd, d)
+ if self._writeTimeout is not None and self._writeTimeout > 0:
+ _,ready,_ = select.select([],[self.fd],[], self._writeTimeout)
+ if not ready:
+ raise writeTimeoutError
+ d = d[n:]
+ t = t - n
+ except OSError,v:
+ if v.errno != errno.EAGAIN:
+ raise
+
+ def flush(self):
+ """Flush of file like objects. In this case, wait until all data
+ is written."""
+ self.drainOutput()
+
+ def flushInput(self):
+ """Clear input buffer, discarding all that is in the buffer."""
+ if self.fd is None:
+ raise portNotOpenError
+ termios.tcflush(self.fd, TERMIOS.TCIFLUSH)
+
+ def flushOutput(self):
+ """Clear output buffer, aborting the current output and
+ discarding all that is in the buffer."""
+ if self.fd is None:
+ raise portNotOpenError
+ termios.tcflush(self.fd, TERMIOS.TCOFLUSH)
+
+ def sendBreak(self):
+ """Send break condition."""
+ if self.fd is None:
+ raise portNotOpenError
+ termios.tcsendbreak(self.fd, 0)
+
+ def setRTS(self,on=1):
+ """Set terminal status line: Request To Send"""
+ if self.fd is None: raise portNotOpenError
+ if on:
+ fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_RTS_str)
+ else:
+ fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_RTS_str)
+
+ def setDTR(self,on=1):
+ """Set terminal status line: Data Terminal Ready"""
+ if self.fd is None: raise portNotOpenError
+ if on:
+ fcntl.ioctl(self.fd, TIOCMBIS, TIOCM_DTR_str)
+ else:
+ fcntl.ioctl(self.fd, TIOCMBIC, TIOCM_DTR_str)
+
+ def getCTS(self):
+ """Read terminal status line: Clear To Send"""
+ if self.fd is None: raise portNotOpenError
+ s = fcntl.ioctl(self.fd, TIOCMGET, TIOCM_zero_str)
+ return struct.unpack('I',s)[0] & TIOCM_CTS != 0
+
+ def getDSR(self):
+ """Read terminal status line: Data Set Ready"""
+ if self.fd is None: raise portNotOpenError
+ s = fcntl.ioctl(self.fd, TIOCMGET, TIOCM_zero_str)
+ return struct.unpack('I',s)[0] & TIOCM_DSR != 0
+
+ def getRI(self):
+ """Read terminal status line: Ring Indicator"""
+ if self.fd is None: raise portNotOpenError
+ s = fcntl.ioctl(self.fd, TIOCMGET, TIOCM_zero_str)
+ return struct.unpack('I',s)[0] & TIOCM_RI != 0
+
+ def getCD(self):
+ """Read terminal status line: Carrier Detect"""
+ if self.fd is None: raise portNotOpenError
+ s = fcntl.ioctl(self.fd, TIOCMGET, TIOCM_zero_str)
+ return struct.unpack('I',s)[0] & TIOCM_CD != 0
+
+ # - - platform specific - - - -
+
+ def drainOutput(self):
+ """internal - not portable!"""
+ if self.fd is None: raise portNotOpenError
+ termios.tcdrain(self.fd)
+
+ def nonblocking(self):
+ """internal - not portable!"""
+ if self.fd is None:
+ raise portNotOpenError
+ fcntl.fcntl(self.fd, FCNTL.F_SETFL, FCNTL.O_NONBLOCK)
+
+ def fileno(self):
+ """For easier of the serial port instance with select.
+ WARNING: this function is not portable to different platforms!"""
+ if self.fd is None: raise portNotOpenError
+ return self.fd
+
+if __name__ == '__main__':
+ s = Serial(0,
+ baudrate=19200, #baudrate
+ bytesize=EIGHTBITS, #number of databits
+ parity=PARITY_EVEN, #enable parity checking
+ stopbits=STOPBITS_ONE, #number of stopbits
+ timeout=3, #set a timeout value, None for waiting forever
+ xonxoff=0, #enable software flow control
+ rtscts=0, #enable RTS/CTS flow control
+ )
+ s.setRTS(1)
+ s.setDTR(1)
+ s.flushInput()
+ s.flushOutput()
+ s.write('hello')
+ print repr(s.read(5))
+ print s.inWaiting()
+ del s
diff --git a/cesar/maximus/python/lib/proto/pyserial/serial/serialutil.py b/cesar/maximus/python/lib/proto/pyserial/serial/serialutil.py
new file mode 100644
index 0000000000..d58cc53caf
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/serial/serialutil.py
@@ -0,0 +1,366 @@
+#! python
+#Python Serial Port Extension for Win32, Linux, BSD, Jython
+#see __init__.py
+#
+#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
+# this is distributed under a free software license, see license.txt
+
+PARITY_NONE, PARITY_EVEN, PARITY_ODD = 'N', 'E', 'O'
+STOPBITS_ONE, STOPBITS_TWO = (1, 2)
+FIVEBITS, SIXBITS, SEVENBITS, EIGHTBITS = (5,6,7,8)
+
+PARITY_NAMES = {
+ PARITY_NONE: 'None',
+ PARITY_EVEN: 'Even',
+ PARITY_ODD: 'Odd',
+}
+
+XON = chr(17)
+XOFF = chr(19)
+
+#Python < 2.2.3 compatibility
+try:
+ True
+except:
+ True = 1
+ False = not True
+
+class SerialException(Exception):
+ """Base class for serial port related exceptions."""
+
+portNotOpenError = SerialException('Port not open')
+
+class SerialTimeoutException(SerialException):
+ """Write timeouts give an exception"""
+
+writeTimeoutError = SerialTimeoutException("Write timeout")
+
+class FileLike(object):
+ """An abstract file like class.
+
+ This class implements readline and readlines based on read and
+ writelines based on write.
+ This class is used to provide the above functions for to Serial
+ port objects.
+
+ Note that when the serial port was opened with _NO_ timeout that
+ readline blocks until it sees a newline (or the specified size is
+ reached) and that readlines would never return and therefore
+ refuses to work (it raises an exception in this case)!
+ """
+
+ def read(self, size): raise NotImplementedError
+ def write(self, s): raise NotImplementedError
+
+ def readline(self, size=None, eol='\n'):
+ """read a line which is terminated with end-of-line (eol) character
+ ('\n' by default) or until timeout"""
+ line = ''
+ while 1:
+ c = self.read(1)
+ if c:
+ line += c #not very efficient but lines are usually not that long
+ if c == eol:
+ break
+ if size is not None and len(line) >= size:
+ break
+ else:
+ break
+ return line
+
+ def readlines(self, sizehint=None, eol='\n'):
+ """read a list of lines, until timeout
+ sizehint is ignored"""
+ if self.timeout is None:
+ raise ValueError, "Serial port MUST have enabled timeout for this function!"
+ lines = []
+ while 1:
+ line = self.readline(eol=eol)
+ if line:
+ lines.append(line)
+ if line[-1] != eol: #was the line received with a timeout?
+ break
+ else:
+ break
+ return lines
+
+ def xreadlines(self, sizehint=None):
+ """just call readlines - here for compatibility"""
+ return self.readlines()
+
+ def writelines(self, sequence):
+ for line in sequence:
+ self.write(line)
+
+ def flush(self):
+ """flush of file like objects"""
+ pass
+
+class SerialBase(FileLike):
+ """Serial port base class. Provides __init__ function and properties to
+ get/set port settings."""
+
+ #default values, may be overriden in subclasses that do not support all values
+ BAUDRATES = (50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,
+ 19200,38400,57600,115200,230400,460800,500000,576000,921600,
+ 1000000,1152000,1500000,2000000,2500000,3000000,3500000,4000000)
+ BYTESIZES = (FIVEBITS, SIXBITS, SEVENBITS, EIGHTBITS)
+ PARITIES = (PARITY_NONE, PARITY_EVEN, PARITY_ODD)
+ STOPBITS = (STOPBITS_ONE, STOPBITS_TWO)
+
+ def __init__(self,
+ port = None, #number of device, numbering starts at
+ #zero. if everything fails, the user
+ #can specify a device string, note
+ #that this isn't portable anymore
+ #port will be opened if one is specified
+ baudrate=9600, #baudrate
+ bytesize=EIGHTBITS, #number of databits
+ parity=PARITY_NONE, #enable parity checking
+ stopbits=STOPBITS_ONE, #number of stopbits
+ timeout=None, #set a timeout value, None to wait forever
+ xonxoff=0, #enable software flow control
+ rtscts=0, #enable RTS/CTS flow control
+ writeTimeout=None, #set a timeout for writes
+ dsrdtr=None, #None: use rtscts setting, dsrdtr override if true or false
+ ):
+ """Initialize comm port object. If a port is given, then the port will be
+ opened immediately. Otherwise a Serial port object in closed state
+ is returned."""
+
+ self._isOpen = False
+ self._port = None #correct value is assigned below trough properties
+ self._baudrate = None #correct value is assigned below trough properties
+ self._bytesize = None #correct value is assigned below trough properties
+ self._parity = None #correct value is assigned below trough properties
+ self._stopbits = None #correct value is assigned below trough properties
+ self._timeout = None #correct value is assigned below trough properties
+ self._writeTimeout = None #correct value is assigned below trough properties
+ self._xonxoff = None #correct value is assigned below trough properties
+ self._rtscts = None #correct value is assigned below trough properties
+ self._dsrdtr = None #correct value is assigned below trough properties
+
+ #assign values using get/set methods using the properties feature
+ self.port = port
+ self.baudrate = baudrate
+ self.bytesize = bytesize
+ self.parity = parity
+ self.stopbits = stopbits
+ self.timeout = timeout
+ self.writeTimeout = writeTimeout
+ self.xonxoff = xonxoff
+ self.rtscts = rtscts
+ self.dsrdtr = dsrdtr
+
+ if port is not None:
+ self.open()
+
+ def isOpen(self):
+ """Check if the port is opened."""
+ return self._isOpen
+
+ # - - - - - - - - - - - - - - - - - - - - - - - -
+
+ #TODO: these are not realy needed as the is the BAUDRATES etc attribute...
+ #maybe i remove them before the final release...
+
+ def getSupportedBaudrates(self):
+ return [(str(b), b) for b in self.BAUDRATES]
+
+ def getSupportedByteSizes(self):
+ return [(str(b), b) for b in self.BYTESIZES]
+
+ def getSupportedStopbits(self):
+ return [(str(b), b) for b in self.STOPBITS]
+
+ def getSupportedParities(self):
+ return [(PARITY_NAMES[b], b) for b in self.PARITIES]
+
+ # - - - - - - - - - - - - - - - - - - - - - - - -
+
+ def setPort(self, port):
+ """Change the port. The attribute portstr is set to a string that
+ contains the name of the port."""
+
+ was_open = self._isOpen
+ if was_open: self.close()
+ if port is not None:
+ if type(port) in [type(''), type(u'')]: #strings are taken directly
+ self.portstr = port
+ else:
+ self.portstr = self.makeDeviceName(port)
+ else:
+ self.portstr = None
+ self._port = port
+ if was_open: self.open()
+
+ def getPort(self):
+ """Get the current port setting. The value that was passed on init or using
+ setPort() is passed back. See also the attribute portstr which contains
+ the name of the port as a string."""
+ return self._port
+
+ port = property(getPort, setPort, doc="Port setting")
+
+
+ def setBaudrate(self, baudrate):
+ """Change baudrate. It raises a ValueError if the port is open and the
+ baudrate is not possible. If the port is closed, then tha value is
+ accepted and the exception is raised when the port is opened."""
+ #~ if baudrate not in self.BAUDRATES: raise ValueError("Not a valid baudrate: %r" % baudrate)
+ try:
+ self._baudrate = int(baudrate)
+ except TypeError:
+ raise ValueError("Not a valid baudrate: %r" % baudrate)
+ else:
+ if self._isOpen: self._reconfigurePort()
+
+ def getBaudrate(self):
+ """Get the current baudrate setting."""
+ return self._baudrate
+
+ baudrate = property(getBaudrate, setBaudrate, doc="Baudrate setting")
+
+
+ def setByteSize(self, bytesize):
+ """Change byte size."""
+ if bytesize not in self.BYTESIZES: raise ValueError("Not a valid byte size: %r" % bytesize)
+ self._bytesize = bytesize
+ if self._isOpen: self._reconfigurePort()
+
+ def getByteSize(self):
+ """Get the current byte size setting."""
+ return self._bytesize
+
+ bytesize = property(getByteSize, setByteSize, doc="Byte size setting")
+
+
+ def setParity(self, parity):
+ """Change parity setting."""
+ if parity not in self.PARITIES: raise ValueError("Not a valid parity: %r" % parity)
+ self._parity = parity
+ if self._isOpen: self._reconfigurePort()
+
+ def getParity(self):
+ """Get the current parity setting."""
+ return self._parity
+
+ parity = property(getParity, setParity, doc="Parity setting")
+
+
+ def setStopbits(self, stopbits):
+ """Change stopbits size."""
+ if stopbits not in self.STOPBITS: raise ValueError("Not a valid stopbit size: %r" % stopbits)
+ self._stopbits = stopbits
+ if self._isOpen: self._reconfigurePort()
+
+ def getStopbits(self):
+ """Get the current stopbits setting."""
+ return self._stopbits
+
+ stopbits = property(getStopbits, setStopbits, doc="Stopbits setting")
+
+
+ def setTimeout(self, timeout):
+ """Change timeout setting."""
+ if timeout is not None:
+ if timeout < 0: raise ValueError("Not a valid timeout: %r" % timeout)
+ try:
+ timeout + 1 #test if it's a number, will throw a TypeError if not...
+ except TypeError:
+ raise ValueError("Not a valid timeout: %r" % timeout)
+
+ self._timeout = timeout
+ if self._isOpen: self._reconfigurePort()
+
+ def getTimeout(self):
+ """Get the current timeout setting."""
+ return self._timeout
+
+ timeout = property(getTimeout, setTimeout, doc="Timeout setting for read()")
+
+
+ def setWriteTimeout(self, timeout):
+ """Change timeout setting."""
+ if timeout is not None:
+ if timeout < 0: raise ValueError("Not a valid timeout: %r" % timeout)
+ try:
+ timeout + 1 #test if it's a number, will throw a TypeError if not...
+ except TypeError:
+ raise ValueError("Not a valid timeout: %r" % timeout)
+
+ self._writeTimeout = timeout
+ if self._isOpen: self._reconfigurePort()
+
+ def getWriteTimeout(self):
+ """Get the current timeout setting."""
+ return self._writeTimeout
+
+ writeTimeout = property(getWriteTimeout, setWriteTimeout, doc="Timeout setting for write()")
+
+
+ def setXonXoff(self, xonxoff):
+ """Change XonXoff setting."""
+ self._xonxoff = xonxoff
+ if self._isOpen: self._reconfigurePort()
+
+ def getXonXoff(self):
+ """Get the current XonXoff setting."""
+ return self._xonxoff
+
+ xonxoff = property(getXonXoff, setXonXoff, doc="Xon/Xoff setting")
+
+ def setRtsCts(self, rtscts):
+ """Change RtsCts flow control setting."""
+ self._rtscts = rtscts
+ if self._isOpen: self._reconfigurePort()
+
+ def getRtsCts(self):
+ """Get the current RtsCts flow control setting."""
+ return self._rtscts
+
+ rtscts = property(getRtsCts, setRtsCts, doc="RTS/CTS flow control setting")
+
+ def setDsrDtr(self, dsrdtr=None):
+ """Change DsrDtr flow control setting."""
+ if dsrdtr is None:
+ #if not set, keep backwards compatibility and follow rtscts setting
+ self._dsrdtr = self._rtscts
+ else:
+ #if defined independently, follow its value
+ self._dsrdtr = dsrdtr
+ if self._isOpen: self._reconfigurePort()
+
+ def getDsrDtr(self):
+ """Get the current DsrDtr flow control setting."""
+ return self._dsrdtr
+
+ dsrdtr = property(getDsrDtr, setDsrDtr, "DSR/DTR flow control setting")
+
+ # - - - - - - - - - - - - - - - - - - - - - - - -
+
+ def __repr__(self):
+ """String representation of the current port settings and its state."""
+ return "%s<id=0x%x, open=%s>(port=%r, baudrate=%r, bytesize=%r, parity=%r, stopbits=%r, timeout=%r, xonxoff=%r, rtscts=%r, dsrdtr=%r)" % (
+ self.__class__.__name__,
+ id(self),
+ self._isOpen,
+ self.portstr,
+ self.baudrate,
+ self.bytesize,
+ self.parity,
+ self.stopbits,
+ self.timeout,
+ self.xonxoff,
+ self.rtscts,
+ self.dsrdtr,
+ )
+
+if __name__ == '__main__':
+ s = SerialBase()
+ print s.portstr
+ print s.getSupportedBaudrates()
+ print s.getSupportedByteSizes()
+ print s.getSupportedParities()
+ print s.getSupportedStopbits()
+ print s
diff --git a/cesar/maximus/python/lib/proto/pyserial/serial/serialwin32.py b/cesar/maximus/python/lib/proto/pyserial/serial/serialwin32.py
new file mode 100644
index 0000000000..1c08c42782
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/serial/serialwin32.py
@@ -0,0 +1,314 @@
+#! python
+#Python Serial Port Extension for Win32, Linux, BSD, Jython
+#serial driver for win32
+#see __init__.py
+#
+#(C) 2001-2003 Chris Liechti <cliechti@gmx.net>
+# this is distributed under a free software license, see license.txt
+
+import win32file # The base COM port and file IO functions.
+import win32event # We use events and the WaitFor[Single|Multiple]Objects functions.
+import win32con # constants.
+from serialutil import *
+
+VERSION = "$Revision: 1.31 $".split()[1] #extract CVS version
+
+#from winbase.h. these should realy be in win32con
+MS_CTS_ON = 16
+MS_DSR_ON = 32
+MS_RING_ON = 64
+MS_RLSD_ON = 128
+
+def device(portnum):
+ """Turn a port number into a device name"""
+ #the "//./COMx" format is required for devices >= 9
+ #not all versions of windows seem to support this propperly
+ #so that the first few ports are used with the DOS device name
+ if portnum < 9:
+ return 'COM%d' % (portnum+1) #numbers are transformed to a string
+ else:
+ return r'\\.\COM%d' % (portnum+1)
+
+class Serial(SerialBase):
+ """Serial port implemenation for Win32. This implemenatation requires a
+ win32all installation."""
+
+ BAUDRATES = (50,75,110,134,150,200,300,600,1200,1800,2400,4800,9600,
+ 19200,38400,57600,115200)
+
+ def open(self):
+ """Open port with current settings. This may throw a SerialException
+ if the port cannot be opened."""
+ if self._port is None:
+ raise SerialException("Port must be configured before it can be used.")
+ self.hComPort = None
+ try:
+ self.hComPort = win32file.CreateFile(self.portstr,
+ win32con.GENERIC_READ | win32con.GENERIC_WRITE,
+ 0, # exclusive access
+ None, # no security
+ win32con.OPEN_EXISTING,
+ win32con.FILE_ATTRIBUTE_NORMAL | win32con.FILE_FLAG_OVERLAPPED,
+ None)
+ except Exception, msg:
+ self.hComPort = None #'cause __del__ is called anyway
+ raise SerialException("could not open port: %s" % msg)
+ # Setup a 4k buffer
+ win32file.SetupComm(self.hComPort, 4096, 4096)
+
+ #Save original timeout values:
+ self._orgTimeouts = win32file.GetCommTimeouts(self.hComPort)
+
+ self._rtsState = win32file.RTS_CONTROL_ENABLE
+ self._dtrState = win32file.RTS_CONTROL_ENABLE
+
+ self._reconfigurePort()
+
+ # Clear buffers:
+ # Remove anything that was there
+ win32file.PurgeComm(self.hComPort,
+ win32file.PURGE_TXCLEAR | win32file.PURGE_TXABORT |
+ win32file.PURGE_RXCLEAR | win32file.PURGE_RXABORT)
+
+ self._overlappedRead = win32file.OVERLAPPED()
+ self._overlappedRead.hEvent = win32event.CreateEvent(None, 1, 0, None)
+ self._overlappedWrite = win32file.OVERLAPPED()
+ #~ self._overlappedWrite.hEvent = win32event.CreateEvent(None, 1, 0, None)
+ self._overlappedWrite.hEvent = win32event.CreateEvent(None, 0, 0, None)
+ self._isOpen = True
+
+ def _reconfigurePort(self):
+ """Set commuication parameters on opened port."""
+ if not self.hComPort:
+ raise SerialException("Can only operate on a valid port handle")
+
+ #Set Windows timeout values
+ #timeouts is a tuple with the following items:
+ #(ReadIntervalTimeout,ReadTotalTimeoutMultiplier,
+ # ReadTotalTimeoutConstant,WriteTotalTimeoutMultiplier,
+ # WriteTotalTimeoutConstant)
+ if self._timeout is None:
+ timeouts = (0, 0, 0, 0, 0)
+ elif self._timeout == 0:
+ timeouts = (win32con.MAXDWORD, 0, 0, 0, 0)
+ else:
+ timeouts = (0, 0, int(self._timeout*1000), 0, 0)
+ if self._writeTimeout is None:
+ pass
+ elif self._writeTimeout == 0:
+ timeouts = timeouts[:-2] + (0, win32con.MAXDWORD)
+ else:
+ timeouts = timeouts[:-2] + (0, int(self._writeTimeout*1000))
+ win32file.SetCommTimeouts(self.hComPort, timeouts)
+
+ win32file.SetCommMask(self.hComPort, win32file.EV_ERR)
+
+ # Setup the connection info.
+ # Get state and modify it:
+ comDCB = win32file.GetCommState(self.hComPort)
+ comDCB.BaudRate = self._baudrate
+
+ if self._bytesize == FIVEBITS:
+ comDCB.ByteSize = 5
+ elif self._bytesize == SIXBITS:
+ comDCB.ByteSize = 6
+ elif self._bytesize == SEVENBITS:
+ comDCB.ByteSize = 7
+ elif self._bytesize == EIGHTBITS:
+ comDCB.ByteSize = 8
+ else:
+ raise ValueError("Unsupported number of data bits: %r" % self._bytesize)
+
+ if self._parity == PARITY_NONE:
+ comDCB.Parity = win32file.NOPARITY
+ comDCB.fParity = 0 # Dis/Enable Parity Check
+ elif self._parity == PARITY_EVEN:
+ comDCB.Parity = win32file.EVENPARITY
+ comDCB.fParity = 1 # Dis/Enable Parity Check
+ elif self._parity == PARITY_ODD:
+ comDCB.Parity = win32file.ODDPARITY
+ comDCB.fParity = 1 # Dis/Enable Parity Check
+ else:
+ raise ValueError("Unsupported parity mode: %r" % self._parity)
+
+ if self._stopbits == STOPBITS_ONE:
+ comDCB.StopBits = win32file.ONESTOPBIT
+ elif self._stopbits == STOPBITS_TWO:
+ comDCB.StopBits = win32file.TWOSTOPBITS
+ else:
+ raise ValueError("Unsupported number of stop bits: %r" % self._stopbits)
+
+ comDCB.fBinary = 1 # Enable Binary Transmission
+ # Char. w/ Parity-Err are replaced with 0xff (if fErrorChar is set to TRUE)
+ if self._rtscts:
+ comDCB.fRtsControl = win32file.RTS_CONTROL_HANDSHAKE
+ else:
+ comDCB.fRtsControl = self._rtsState
+ if self._dsrdtr:
+ comDCB.fDtrControl = win32file.DTR_CONTROL_HANDSHAKE
+ else:
+ comDCB.fDtrControl = self._dtrState
+ comDCB.fOutxCtsFlow = self._rtscts
+ comDCB.fOutxDsrFlow = self._dsrdtr
+ comDCB.fOutX = self._xonxoff
+ comDCB.fInX = self._xonxoff
+ comDCB.fNull = 0
+ comDCB.fErrorChar = 0
+ comDCB.fAbortOnError = 0
+ comDCB.XonChar = XON
+ comDCB.XoffChar = XOFF
+
+ try:
+ win32file.SetCommState(self.hComPort, comDCB)
+ except win32file.error, e:
+ raise ValueError("Cannot configure port, some setting was wrong. Original message: %s" % e)
+
+ #~ def __del__(self):
+ #~ self.close()
+
+ def close(self):
+ """Close port"""
+ if self._isOpen:
+ if self.hComPort:
+ #Restore original timeout values:
+ win32file.SetCommTimeouts(self.hComPort, self._orgTimeouts)
+ #Close COM-Port:
+ win32file.CloseHandle(self.hComPort)
+ self.hComPort = None
+ self._isOpen = False
+
+ def makeDeviceName(self, port):
+ return device(port)
+
+ # - - - - - - - - - - - - - - - - - - - - - - - -
+
+ def inWaiting(self):
+ """Return the number of characters currently in the input buffer."""
+ flags, comstat = win32file.ClearCommError(self.hComPort)
+ return comstat.cbInQue
+
+ def read(self, size=1):
+ """Read size bytes from the serial port. If a timeout is set it may
+ return less characters as requested. With no timeout it will block
+ until the requested number of bytes is read."""
+ if not self.hComPort: raise portNotOpenError
+ if size > 0:
+ win32event.ResetEvent(self._overlappedRead.hEvent)
+ flags, comstat = win32file.ClearCommError(self.hComPort)
+ if self.timeout == 0:
+ n = min(comstat.cbInQue, size)
+ if n > 0:
+ rc, buf = win32file.ReadFile(self.hComPort, win32file.AllocateReadBuffer(n), self._overlappedRead)
+ win32event.WaitForSingleObject(self._overlappedRead.hEvent, win32event.INFINITE)
+ read = str(buf)
+ else:
+ read = ''
+ else:
+ rc, buf = win32file.ReadFile(self.hComPort, win32file.AllocateReadBuffer(size), self._overlappedRead)
+ n = win32file.GetOverlappedResult(self.hComPort, self._overlappedRead, 1)
+ read = str(buf[:n])
+ else:
+ read = ''
+ return read
+
+ def write(self, s):
+ """Output the given string over the serial port."""
+ if not self.hComPort: raise portNotOpenError
+ #print repr(s),
+ if s:
+ #~ win32event.ResetEvent(self._overlappedWrite.hEvent)
+ err, n = win32file.WriteFile(self.hComPort, s, self._overlappedWrite)
+ if err: #will be ERROR_IO_PENDING:
+ # Wait for the write to complete.
+ #~ win32event.WaitForSingleObject(self._overlappedWrite.hEvent, win32event.INFINITE)
+ n = win32file.GetOverlappedResult(self.hComPort, self._overlappedWrite, 1)
+ if n != len(s):
+ raise writeTimeoutError
+
+
+ def flushInput(self):
+ """Clear input buffer, discarding all that is in the buffer."""
+ if not self.hComPort: raise portNotOpenError
+ win32file.PurgeComm(self.hComPort, win32file.PURGE_RXCLEAR | win32file.PURGE_RXABORT)
+
+ def flushOutput(self):
+ """Clear output buffer, aborting the current output and
+ discarding all that is in the buffer."""
+ if not self.hComPort: raise portNotOpenError
+ win32file.PurgeComm(self.hComPort, win32file.PURGE_TXCLEAR | win32file.PURGE_TXABORT)
+
+ def sendBreak(self):
+ """Send break condition."""
+ if not self.hComPort: raise portNotOpenError
+ import time
+ win32file.SetCommBreak(self.hComPort)
+ #TODO: how to set the correct duration??
+ time.sleep(0.020)
+ win32file.ClearCommBreak(self.hComPort)
+
+ def setRTS(self,level=1):
+ """Set terminal status line: Request To Send"""
+ if not self.hComPort: raise portNotOpenError
+ if level:
+ self._rtsState = win32file.RTS_CONTROL_ENABLE
+ win32file.EscapeCommFunction(self.hComPort, win32file.SETRTS)
+ else:
+ self._rtsState = win32file.RTS_CONTROL_DISABLE
+ win32file.EscapeCommFunction(self.hComPort, win32file.CLRRTS)
+
+ def setDTR(self,level=1):
+ """Set terminal status line: Data Terminal Ready"""
+ if not self.hComPort: raise portNotOpenError
+ if level:
+ self._dtrState = win32file.DTR_CONTROL_ENABLE
+ win32file.EscapeCommFunction(self.hComPort, win32file.SETDTR)
+ else:
+ self._dtrState = win32file.DTR_CONTROL_DISABLE
+ win32file.EscapeCommFunction(self.hComPort, win32file.CLRDTR)
+
+ def getCTS(self):
+ """Read terminal status line: Clear To Send"""
+ if not self.hComPort: raise portNotOpenError
+ return MS_CTS_ON & win32file.GetCommModemStatus(self.hComPort) != 0
+
+ def getDSR(self):
+ """Read terminal status line: Data Set Ready"""
+ if not self.hComPort: raise portNotOpenError
+ return MS_DSR_ON & win32file.GetCommModemStatus(self.hComPort) != 0
+
+ def getRI(self):
+ """Read terminal status line: Ring Indicator"""
+ if not self.hComPort: raise portNotOpenError
+ return MS_RING_ON & win32file.GetCommModemStatus(self.hComPort) != 0
+
+ def getCD(self):
+ """Read terminal status line: Carrier Detect"""
+ if not self.hComPort: raise portNotOpenError
+ return MS_RLSD_ON & win32file.GetCommModemStatus(self.hComPort) != 0
+
+ # - - platform specific - - - -
+
+ def setXON(self, level=True):
+ """Platform specific - set flow state."""
+ if not self.hComPort: raise portNotOpenError
+ if level:
+ win32file.EscapeCommFunction(self.hComPort, win32file.SETXON)
+ else:
+ win32file.EscapeCommFunction(self.hComPort, win32file.SETXOFF)
+
+#Nur Testfunktion!!
+if __name__ == '__main__':
+ print __name__
+ s = Serial()
+ print s
+
+ s = Serial(0)
+ print s
+
+ s.baudrate = 19200
+ s.databits = 7
+ s.close()
+ s.port = 3
+ s.open()
+ print s
+
diff --git a/cesar/maximus/python/lib/proto/pyserial/setup.py b/cesar/maximus/python/lib/proto/pyserial/setup.py
new file mode 100644
index 0000000000..b3412f6ff5
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/pyserial/setup.py
@@ -0,0 +1,38 @@
+# setup.py
+from distutils.core import setup
+import sys
+
+#windows installer:
+# python setup.py bdist_wininst
+
+# patch distutils if it can't cope with the "classifiers" or
+# "download_url" keywords
+if sys.version < '2.2.3':
+ from distutils.dist import DistributionMetadata
+ DistributionMetadata.classifiers = None
+ DistributionMetadata.download_url = None
+
+setup(
+ name="pyserial",
+ description="Python Serial Port Extension",
+ version="2.2",
+ author="Chris Liechti",
+ author_email="cliechti@gmx.net",
+ url="http://pyserial.sourceforge.net/",
+ packages=['serial'],
+ license="Python",
+ long_description="Python Serial Port Extension for Win32, Linux, BSD, Jython",
+ classifiers = [
+ 'Development Status :: 5 - Production/Stable',
+ 'Intended Audience :: Developers',
+ 'Intended Audience :: End Users/Desktop',
+ 'License :: OSI Approved :: Python Software Foundation License',
+ 'Natural Language :: English',
+ 'Operating System :: POSIX',
+ 'Operating System :: Microsoft :: Windows',
+ 'Programming Language :: Python',
+ 'Topic :: Communications',
+ 'Topic :: Software Development :: Libraries',
+ 'Topic :: Terminals :: Serial',
+ ],
+)
diff --git a/cesar/maximus/python/lib/proto/uspp/AUTHORS b/cesar/maximus/python/lib/proto/uspp/AUTHORS
new file mode 100644
index 0000000000..f21051cb3a
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/AUTHORS
@@ -0,0 +1,4 @@
+Isaac Barona Martínez <ibarona@tid.es> Madrid (SPAIN)
+Damien Géranton <dgeranton@voila.fr>
+Douglas Jones <dfj23@drexel.edu>
+J.Grauheding <juergen.grauheding@a-city.de>
diff --git a/cesar/maximus/python/lib/proto/uspp/Copyright b/cesar/maximus/python/lib/proto/uspp/Copyright
new file mode 100644
index 0000000000..a9ed744a19
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/Copyright
@@ -0,0 +1,21 @@
+USPP Library (Universal Serial Port Python Library)
+
+Copyright (C) 2006 Isaac Barona Martínez <ibarona@tid.es>
+
+This library is free software; you can redistribute it and/or
+modify it under the terms of the GNU Lesser General Public
+License as published by the Free Software Foundation; either
+version 2.1 of the License, or (at your option) any later version.
+
+This library 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
+Lesser General Public License for more details.
+
+You should have received a copy of the GNU Lesser General Public
+License along with this library; if not, write to the Free Software
+Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+
+The complete text of the GNU Lesser General Public License can be found in
+the file 'lesser.txt'.
diff --git a/cesar/maximus/python/lib/proto/uspp/Readme b/cesar/maximus/python/lib/proto/uspp/Readme
new file mode 100644
index 0000000000..623cc2b9b6
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/Readme
@@ -0,0 +1,190 @@
+ USPP Library
+
+ Universal Serial Port Python Library
+
+ Copyright 2006 Isaac Barona <ibarona@gmail.com>
+
+
+Contents
+--------
+ 1. Introduction
+ 2. Motivation
+ 3. Where can I find it
+ 4. Features
+ 5. Pre-requisites
+ 6. Usage and documentation
+ 7. Where does it work
+ 8. Known problems
+ 9. To-do list
+10. Porting to other platforms
+11. Licence
+12. Author
+13. Version
+
+
+1. Introduction
+---------------
+
+USPP Library is a multi-platform Python module to access serial ports. At the
+moment, it only works in Windows, Linux and MacOS but as it is written entirely
+in Python (doesn't wrap any C/C++ library) I hope you can extend it to support
+any other platforms.
+
+
+2. Motivation
+-------------
+
+I like very much to make electronic widgets with microcontrollers, specially
+those that can be connected to the computer to send and receive data.
+Some months ago, I discovered Python and inmediatelly liked it a lot.
+I started playing with it and saw that I could use it to make prototypes of
+comunication protocols between computer and microcontrollers really
+fast and easily than using C. At the same time, I was interested in
+working over different platforms.
+I started looking for Python modules to access serial port and I found
+the following projects:
+
+ * win32comport_demo from the win32 extension module
+ * win32comm module of wheineman@uconect.net
+ * Sio Module of Roger Rurnham (rburnham@cri-inc.com)
+ * pyxal (Python X10 Abstraction Layer) of Les Smithson
+ (lsmithson@open-networks.co.uk)
+
+but they were not multi-platform, were just a wrap of propietary libraries or
+were just simple examples of serial port access.
+For these reasons and also for learning more Python, I decided to start
+this project. Of course, I have used all this projects as reference to
+my module and so, I want to thanks the authors for their excellent work and
+for allowing us to study the code.
+I hope you enjoy using the uspp module as much as I am enjoying doing it.
+
+
+3. Where can I find it
+----------------------
+
+You may find it at:
+ * http://ibarona.googlepages.com/uspp
+ * http://www.telefonica.net/web/babur
+
+as a tar.gz package or as a winzip file.
+
+
+4. Features
+-----------
+
+This module has the following features:
+
+ - hight level access to serial port under several platforms.
+ - autodetects the platform in which it is working and exports
+ the correct classes for that platform.
+ - object oriented approach.
+ - file object semantic operations over the ports.
+ - allows using the serial port with different speeds and
+ characteristics.
+ - RS-232 and RS-485 modes (now only RS-232). In RS-485 mode
+ the communication is half-duplex and uses the RTS line
+ to control the direction of the transference.
+ - blocking, non-blocking or configurable timeout reads.
+
+
+5. Prerequisites
+----------------
+
+You need the following to use the library:
+
+ - Python 2.1 or better
+ - In windows you need the win32 extension modules
+
+
+6. Usage and documentation
+--------------------------
+
+You only have to import in your program the uspp module and automatically
+it loads the correct classes for the platform in which you are running
+the program.
+
+First of all you have to create a SerialPort object with the settings you
+want. If a SerialPortException is not generated then you just can
+use the read and write methods of the object to read and write to
+the serial port.
+
+Example:
+
+>>> from uspp import *
+>>> tty=SerialPort("COM2", 1000, 9600)
+>>> # Opens COM2 at 9600 bps and with a read timeout of 1 second.
+>>> tty.write("a") # Writes a character to the COM2 port
+>>> # Now suppose we receive the string "abc"
+>>> tty.inWaiting()
+3
+>>> tty.read()
+'a'
+>>> tty.inWaiting()
+2
+>>> tty.read(2)
+'bc'
+
+
+Documentation of the different classes and methods can be found on
+uspp module docstring.
+
+
+7. Where does it work
+---------------------
+
+The library has been tested in Windows 95, Windows XP and Windows 2000
+machines with Python 2.1+ and in a Linux (2.0.34 kernel) machine with
+Python 2.1+.
+
+
+8. Known problems
+-----------------
+
+
+
+
+9. To-do list
+-------------
+
+This is the to-do list:
+
+ - implement RS-485 mode.
+ - port the library to other platforms so that it can be really
+ multi-platform.
+
+
+10. Porting to other platforms
+-----------------------------
+
+If you want to port the library to other platforms you only have to follow
+these steps:
+
+* Create a new python file called SerialPort_XXXX.py in which you
+implement the same public classes and methods found in the SerialPort_win
+and SerialPort_linux modules.
+* Append the new platform to the uspp.py file.
+
+
+11. Licence
+----------
+
+This code is released under the "LGPL" that can be found in
+http://www.gnu.org/copyleft/lesser.html or in the lesser.txt file that
+is with the library.
+If you use this software, I'd like to know about it.
+
+
+12. Author
+---------
+
+This library has been created by Isaac Barona Martinez <ibarona@gmail.com>.
+
+
+13. Version
+----------
+
+0.1 - 09/01/2001 (September 2001)
+0.2 - 05/13/2003
+1.0 - 02/24/2006
+
+
diff --git a/cesar/maximus/python/lib/proto/uspp/Readme_es b/cesar/maximus/python/lib/proto/uspp/Readme_es
new file mode 100644
index 0000000000..08e1a9a7aa
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/Readme_es
@@ -0,0 +1,199 @@
+ USPP Library
+
+ Universal Serial Port Python Library
+ (Librería en Python para el acceso universal al puerto serie)
+
+ Copyright 2006 Isaac Barona <ibarona@gmail.com>
+
+
+Contenidos
+----------
+ 1. Introducción
+ 2. Motivación
+ 3. Dónde encontrar la librería
+ 4. Características
+ 5. Pre-requisitos
+ 6. Utilización y documentación
+ 7. Dónde funciona
+ 8. Problemas pendientes
+ 9. Tareas pendientes
+10. Portado a otras plataformas
+11. Licencia
+12. Autor
+13. Versión
+
+
+1. Introducción
+---------------
+
+La librería USPP es un módulo desarrollado en Python para el acceso
+multiplataforma al puerto serie. En el momento, sólo funciona en Linux
+Windows y MacOS, pero como está escrita completamente en Python
+(no es únicamente un recubrimiento en Python de una librería desarrollada
+en C/C++) espero que pueda ser ampliada para que soporte otras plataformas.
+
+
+2. Motivación
+-------------
+
+A mí me gusta mucho hacer pequeños cacharros electrónicos con
+microcontroladores, especialmente aquellos que pueden ser conectados a
+un ordenador para enviar y recibir datos.
+Hace un par de meses descubrí Python y realmente me encantó.
+Empezé a jugar con él y ví que podía utilizarlo para hacer prototipos
+de protocolos de comunicación entre el ordenador y los microcontroladores
+de manera mucho más fácil y rápida que utilizando C (que era el lenguaje
+que solía utilizar). Al mismo tiempo, estaba interesado en poder utilizar
+los desarrollos bajo diferentes arquitecturas.
+Empezé a buscar en la red módulos de Python que accedieran al puerto serie
+y encontré los siguientes:
+
+ * win32comport_demo que viene junto a la extensión win32.
+ * Módulo win32comm de wheineman@uconect.net.
+ * Sio Module de Roger Rurnham (rburnham@cri-inc.com)
+ * pyxal (Python X10 Abstraction Layer) de Les Smithson
+ (lsmithson@open-networks.co.uk)
+
+pero no eran multiplataforma, eran únicamente un recubrimiento de una librería
+propietaria o eran simples ejemplos de acceso al puerto serie bajo una
+determinada plataforma.
+Por estas razones, y también por supuesto, por aprender más Python, decidí
+empezar este proyecto. Por supuesto, he utilizado los módulos indicados
+anteriormente como referencia para realizar mi librería y por tanto, me
+creo en la obligación de felicitar a sus autores por su excelente trabajo y
+por haberlo compartido con los demás.
+
+Espero que disfrutes utilizándo el módulo uspp tanto como yo lo
+he hecho haciéndolo.
+
+
+3. Dónde encontrar la librería
+------------------------------
+
+Puedes encontrarla en:
+ * http://ibarona.googlepages.com/uspp
+ * http://www.telefonica.net/web/babur
+
+como un fichero tar.gz o como un fichero .zip.
+
+
+4. Características
+------------------
+
+Este módulo tiene las siguientes características destacadas:
+
+ - acceso de alto nivel al puerto serie bajo diversas plataformas.
+ - autodetecta la plataforma en la que se está ejecutando y
+ carga las clases adecuadas para esa plataforma.
+ - Orientado a objetos.
+ - Las operaciones sobre el puerto serie tienen la misma semántica
+ que las operaciones sobre objetos de tipo fichero.
+ - permite utilizar el puerto serie con diferentes velocidades y
+ características.
+ - permite la utilización del puerto bajo dos modos de funcionamiento:
+ RS-232 y RS-485 (de momento, sólo RS-232). En modo 485 la
+ comunicación es half-duplex y se utiliza la línea RTS para controlar
+ la dirección de la transferencia.
+ - lecturas en modo bloqueante, no bloqueante o con timeout.
+
+
+5. Pre-requisitos
+----------------
+
+Se necesita los siguiente para utilizar la librería:
+
+ - Python 2.1 o superior
+ - En windows los módulos win32
+
+
+6. Utilización y documentación
+------------------------------
+
+Únicamente tienes que importar en tu programa el módulo uspp y automáticamente
+él se encarga de cargar las clases adecuadas para la plataforma en la que
+se está ejecutando el programa.
+
+Lo primero de todo, tendrás que crear un objeto de tipo SerialPort con las
+características que desees. Si no se genera ninguna excepción del tipo
+SerialPortException, puedes utilizar los métodos de lectura y escritura
+del objeto para leer y escribir en el puerto serie.
+
+Ejemplo:
+
+>>> from uspp import *
+>>> tty=SerialPort("COM2", 1000, 9600)
+>>> # Abre el puerto serie COM2 a 9600 bps y con un timeout de 1 segundo.
+>>> tty.write("a") # Envía el carácter 'a' al puerto serie.
+>>> # Ahora suponemos que recibimos el string 'abc'
+>>> tty.inWaiting()
+3
+>>> tty.read()
+'a'
+>>> tty.inWaiting()
+2
+>>> tty.read(2)
+'bc'
+
+
+La documentación de las diferentes clases y métodos que componen el módulo
+puede encontrarse en el string de documentación del módulo uspp.
+
+
+7. Dónde funciona
+-----------------
+
+La librería ha sido probada en una máquina con Windows 95, Windows XP y
+Windows 2000 con Python 2.1+ y en un Linux (con el kernel 2.0.34) con Python
+2.1+.
+
+
+8. Problemas pendientes
+-----------------------
+
+
+
+
+9. Tareas pendientes
+--------------------
+
+Esta es la lista de tareas pendientes:
+
+ - implementar el modo RS-485.
+ - portar la librería a otras plataformas de forma que sea
+ realmente multiplataforma.
+
+
+10. Portado a otras plataformas
+-------------------------------
+
+Si quieres portar la librería a otras plataformas sólo tienes que seguir
+los siguientes pasos:
+
+* Crear un nuevo fichero en python llamado SerialPort_XXX.py en el que
+implementes las mismas clases y métodos públicos que aparecen en los
+módulos SerialPort_win y SerialPort_linux.
+* Añadir la nueva plataforma en el fichero uspp.py.
+
+
+11. Licencia
+------------
+
+Este código se libera bajo la licencia "LGPL" que puedes encontrar en
+http://www.gnu.org/copyleft/lesser.html o en el fichero lesser.txt que
+acompaña a la librería.
+Si utilizas este software estaría muy agradecido de saberlo.
+
+
+12. Autor
+---------
+
+Esta librería ha sido creada por Isaac Barona Martínez <ibarona@gmail.com>.
+
+
+13. Versión
+----------
+
+0.1 - 01/09/2001
+0.2 - 13/05/2003
+1.0 - 24/02/2006
+
diff --git a/cesar/maximus/python/lib/proto/uspp/SerialPort_darwin.py b/cesar/maximus/python/lib/proto/uspp/SerialPort_darwin.py
new file mode 100644
index 0000000000..ff478b511f
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/SerialPort_darwin.py
@@ -0,0 +1,326 @@
+##########################################################################
+# USPP Library (Universal Serial Port Python Library)
+#
+# Copyright (C) 2006 Isaac Barona <ibarona@gmail.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##########################################################################
+
+#-------------------------------------------------------------------------
+# Project: USPP Library (Universal Serial Port Python Library)
+# Name: SerialPort_darwin.py
+# Purpose: Handle low level access to serial port in MacOS.
+#
+# Author: Isaac Barona Martinez <ibarona@gmail.com>
+# Copyright: (c) 2001 by Isaac Barona Martínez
+# Licence: LGPL
+#
+# Created: 26 June 2001
+# History: 06.02.2003 Modified and extended by J.Grauheding
+# <juergen.grauheding@a-city.de>
+# adapt it for Python 2.2 on Mac OS X
+# Douglas Jones (dfj23@drexel.edu)
+# - readline method.
+#
+#-------------------------------------------------------------------------
+
+"""
+SerialPort_darwin.py - Handle low level access to serial port in Mac OS X.
+
+See also uspp module docstring.
+
+
+"""
+
+import os
+import tty
+import termios
+import array
+import fcntl
+import exceptions
+import string
+
+class SerialPortException(exceptions.Exception):
+ """Exception raise in the SerialPort methods"""
+ def __init__(self, args=None):
+ self.args=args
+
+
+class SerialPort:
+ """Encapsulate methods for accesing to a serial port."""
+
+ BaudRatesDic={
+ 50: termios.B50,
+ 75: termios.B75,
+ 110: termios.B110,
+ 134: termios.B134,
+ 150: termios.B150,
+ 200: termios.B200,
+ 300: termios.B300,
+ 600: termios.B600,
+ 1200: termios.B1200,
+ 1800: termios.B1800,
+ 2400: termios.B2400,
+ 4800: termios.B4800,
+ 9600: termios.B9600,
+ 19200: termios.B19200,
+ 38400: termios.B38400,
+ 57600: termios.B57600,
+ 115200: termios.B115200,
+ 230400: termios.B230400
+ }
+ buf = array.array('h', '\000'*4)
+
+ def __init__(self, dev, timeout=None, speed=None, mode='232', params=None):
+ """Open the serial port named by the string 'dev'
+
+ 'dev' can be any of the following strings: '/dev/ttyS0', '/dev/ttyS1',
+ ..., '/dev/ttySX' or '/dev/cua0', '/dev/cua1', ..., '/dev/cuaX'.
+
+ 'timeout' specifies the inter-byte timeout or first byte timeout
+ (in miliseconds) for all subsequent reads on SerialPort.
+ If we specify None time-outs are not used for reading operations
+ (blocking reading).
+ If 'timeout' is 0 then reading operations are non-blocking. It
+ specifies that the reading operation is to return inmediately
+ with the bytes that have already been received, even if
+ no bytes have been received.
+
+ 'speed' is an integer that specifies the input and output baud rate to
+ use. Possible values are: 110, 300, 600, 1200, 2400, 4800, 9600,
+ 19200, 38400, 57600 and 115200.
+ If None a default speed of 9600 bps is selected.
+
+ 'mode' specifies if we are using RS-232 or RS-485. The RS-485 mode
+ is half duplex and use the RTS signal to indicate the
+ direction of the communication (transmit or recive).
+ Default to RS232 mode (at moment, only the RS-232 mode is
+ implemented).
+
+ 'params' is a list that specifies properties of the serial
+ communication.
+ If params=None it uses default values for the number of bits
+ per byte (8), the parity (NOPARITY) and the number of stop bits (1)
+ else params is the termios package mode array to use for
+ initialization.
+
+ """
+ self.__devName, self.__timeout, self.__speed=dev, timeout, speed
+ self.__mode=mode
+ self.__params=params
+ try:
+ self.__handle=os.open(dev, os.O_RDWR)
+ except:
+ raise SerialPortException('Unable to open port')
+
+ self.__configure()
+
+ def __del__(self):
+ """Close the serial port and restore its initial configuration
+
+ To close the serial port we have to do explicity: del s
+ (where s is an instance of SerialPort)
+ """
+
+ termios.tcsetattr(self.__handle, termios.TCSANOW, self.__oldmode)
+
+ try:
+ os.close(self.__handle)
+ except IOError:
+ raise SerialPortException('Unable to close port')
+
+
+ def __configure(self):
+ """Configure the serial port.
+
+ Private method called in the class constructor that configure the
+ serial port with the characteristics given in the constructor.
+ """
+ if not self.__speed:
+ self.__speed=9600
+
+ # Save the initial port configuration
+ self.__oldmode=termios.tcgetattr(self.__handle)
+ if not self.__params:
+ # self.__params is a list of attributes of the file descriptor
+ # self.__handle as follows:
+ # [c_iflag, c_oflag, c_cflag, c_lflag, c_ispeed, c_ospeed, cc]
+ # where cc is a list of the tty special characters.
+ self.__params=[]
+ # c_iflag
+ self.__params.append(termios.IGNPAR)
+ # c_oflag
+ self.__params.append(0)
+ # c_cflag
+ self.__params.append(termios.CS8|termios.CLOCAL|termios.CREAD)
+ # c_lflag
+ self.__params.append(0)
+ # c_ispeed
+ self.__params.append(SerialPort.BaudRatesDic[self.__speed])
+ # c_ospeed
+ self.__params.append(SerialPort.BaudRatesDic[self.__speed])
+ # XXX FIX: Theorically, it should be better to put:
+ # cc=[0]*termios.NCCS
+ # but it doesn't work because NCCS is 19 and self.__oldmode[6]
+ # is 32 ¿¿¿¿¿¿¿¿¿¿¿ Any help ??????????????
+ cc=[0]*len(self.__oldmode[6])
+ if self.__timeout==None:
+ # A reading is only complete when VMIN characters have
+ # been received (blocking reading)
+ cc[termios.VMIN]=1
+ cc[termios.VTIME]=0
+ elif self.__timeout==0:
+ # Non-blocking reading. The reading operation returns
+ # inmeditately, returning the characters waiting to
+ # be read.
+ cc[termios.VMIN]=0
+ cc[termios.VTIME]=0
+ else:
+ # Time-out reading. For a reading to be correct
+ # a character must be recieved in VTIME*100 seconds.
+ cc[termios.VMIN]=0
+ cc[termios.VTIME]=self.__timeout/100
+ self.__params.append(cc) # c_cc
+
+ termios.tcsetattr(self.__handle, termios.TCSANOW, self.__params)
+
+
+ def fileno(self):
+ """Return the file descriptor for opened device.
+
+ This information can be used for example with the
+ select funcion.
+ """
+ return self.__handle
+
+
+ def setraw(self):
+ tty.setraw(self.__handle)
+
+ def setcbreak(self):
+ tty.setcbreak(self.__handle)
+
+ def __read1(self):
+ """Read 1 byte from the serial port.
+
+ Generate an exception if no byte is read and self.timeout!=0
+ because a timeout has expired.
+ """
+ byte = os.read(self.__handle, 1)
+ if len(byte)==0 and self.__timeout!=0: # Time-out
+ raise SerialPortException('Timeout')
+ else:
+ return byte
+
+
+ def read(self, num=1):
+ """Read num bytes from the serial port.
+
+ Uses the private method __read1 to read num bytes. If an exception
+ is generated in any of the calls to __read1 the exception is reraised.
+ """
+ s=''
+ for i in range(num):
+ s=s+SerialPort.__read1(self)
+
+ return s
+
+
+ def readline(self):
+ """Read a line from the serial port. Returns input once a '\n'
+ character is found.
+ Douglas Jones (dfj23@drexel.edu) 09/09/2005.
+ """
+
+ s = ''
+ while not '\n' in s:
+ s = s+SerialPort.__read1(self)
+
+ return s
+
+
+ def write(self, s):
+ """Write the string s to the serial port"""
+
+ os.write(self.__handle, s)
+
+ def inWaiting(self):
+ """Returns the number of bytes waiting to be read
+ mod. by J.Grauheding
+ """
+ rbuf=fcntl.ioctl(self.__handle, termios.TIOCINQ, self.buf)
+ return rbuf
+
+ def outWaiting(self):
+ """Returns the number of bytes waiting to be write
+ mod. by J.Grauheding
+ """
+ rbuf=fcntl.ioctl(self.__handle, termios.TIOCOUTQ, self.buf)
+ return rbuf
+
+
+ def flush(self):
+ """Discards all bytes from the output or input buffer"""
+ termios.tcflush(self.__handle, termios.TCIOFLUSH)
+
+ def rts_on(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMGET, SerialPort.buf)
+ SerialPort.buf[1] = ord(rbuf[3]) | termios.TIOCM_RTS
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMSET, SerialPort.buf)
+ return rbuf
+
+ def rts_off(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMGET, self.buf)
+ self.buf[1]=ord(rbuf[3]) & ~termios.TIOCM_RTS
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMSET, self.buf)
+ return rbuf
+
+ def dtr_on(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMGET, SerialPort.buf)
+ SerialPort.buf[1] = ord(rbuf[3]) | termios.TIOCM_DTR
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMSET, SerialPort.buf)
+ return rbuf
+
+ def dtr_off(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMGET, self.buf)
+ self.buf[1]=ord(rbuf[3]) & ~termios.TIOCM_DTR
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMSET, self.buf)
+ return rbuf
+
+ def cts(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMGET, self.buf)
+ return ord(rbuf[3]) & termios.TIOCM_CTS
+
+ def cd(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMGET, self.buf)
+ return ord(rbuf[3]) & termios.TIOCM_CAR
+
+ def dsr(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMGET, self.buf)
+ return ord(rbuf[2]) & (termios.TIOCM_DSR>>8)
+
+ def ri(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, termios.TIOCMGET, self.buf)
+ return ord(rbuf[3]) & termios.TIOCM_RNG
+
+
diff --git a/cesar/maximus/python/lib/proto/uspp/SerialPort_linux.py b/cesar/maximus/python/lib/proto/uspp/SerialPort_linux.py
new file mode 100644
index 0000000000..de8d69714e
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/SerialPort_linux.py
@@ -0,0 +1,329 @@
+# -*- coding: iso-8859-1 -*-
+
+##########################################################################
+# USPP Library (Universal Serial Port Python Library)
+#
+# Copyright (C) 2006 Isaac Barona <ibarona@gmail.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##########################################################################
+
+#------------------------------------------------------------------------
+# Project: USPP Library (Universal Serial Port Python Library)
+# Name: SerialPort_linux.py
+# Purpose: Handle low level access to serial port in linux.
+#
+# Author: Isaac Barona Martinez <ibarona@gmail.com>
+# Copyright: (c) 2006 by Isaac Barona Martínez
+# Licence: LGPL
+#
+# Created: 26 June 2001
+# History:
+# 20 January 2002 : Damien Geranton <dgeranton@voila.fr>
+# - NCCS worry fixed. We must not use TERMIOS
+# - inWaiting call fixed.
+# 09 Sept 2005: Douglas Jones <dfj23@drexel.edu>
+# - readline method.
+#
+#-------------------------------------------------------------------------
+
+"""
+SerialPort_linux.py - Handle low level access to serial port in linux.
+
+See also uspp module docstring.
+
+
+"""
+
+import os
+from termios import *
+import fcntl
+import exceptions
+import struct
+import array
+
+
+class SerialPortException(exceptions.Exception):
+ """Exception raise in the SerialPort methods"""
+ def __init__(self, args=None):
+ self.args=args
+
+
+class SerialPort:
+ """Encapsulate methods for accesing to a serial port."""
+
+ BaudRatesDic={
+ 110: B110,
+ 300: B300,
+ 600: B600,
+ 1200: B1200,
+ 2400: B2400,
+ 4800: B4800,
+ 9600: B9600,
+ 19200: B19200,
+ 38400: B38400,
+ 57600: B57600,
+ 115200: B115200
+ }
+ buf = array.array('h', '\000'*4)
+
+ def __init__(self, dev, timeout=None, speed=None, mode='232', params=None):
+ """Open the serial port named by the string 'dev'
+
+ 'dev' can be any of the following strings: '/dev/ttyS0', '/dev/ttyS1',
+ ..., '/dev/ttySX' or '/dev/cua0', '/dev/cua1', ..., '/dev/cuaX'.
+
+ 'timeout' specifies the inter-byte timeout or first byte timeout
+ (in miliseconds) for all subsequent reads on SerialPort.
+ If we specify None time-outs are not used for reading operations
+ (blocking reading).
+ If 'timeout' is 0 then reading operations are non-blocking. It
+ specifies that the reading operation is to return inmediately
+ with the bytes that have already been received, even if
+ no bytes have been received.
+
+ 'speed' is an integer that specifies the input and output baud rate to
+ use. Possible values are: 110, 300, 600, 1200, 2400, 4800, 9600,
+ 19200, 38400, 57600 and 115200.
+ If None a default speed of 9600 bps is selected.
+
+ 'mode' specifies if we are using RS-232 or RS-485. The RS-485 mode
+ is half duplex and use the RTS signal to indicate the
+ direction of the communication (transmit or recive).
+ Default to RS232 mode (at moment, only the RS-232 mode is
+ implemented).
+
+ 'params' is a list that specifies properties of the serial
+ communication.
+ If params=None it uses default values for the number of bits
+ per byte (8), the parity (NOPARITY) and the number of stop bits (1)
+ else params is the termios package mode array to use for
+ initialization.
+
+ """
+ self.__devName, self.__timeout, self.__speed=dev, timeout, speed
+ self.__mode=mode
+ self.__params=params
+ try:
+ self.__handle=os.open(dev, os.O_RDWR)
+ except:
+ raise SerialPortException('Unable to open port')
+
+ self.__configure()
+
+ def __del__(self):
+ """Close the serial port and restore its initial configuration
+
+ To close the serial port we have to do explicity: del s
+ (where s is an instance of SerialPort)
+ """
+
+ tcsetattr(self.__handle, TCSANOW, self.__oldmode)
+
+ try:
+ os.close(self.__handle)
+ except IOError:
+ raise SerialPortException('Unable to close port')
+
+
+ def __configure(self):
+ """Configure the serial port.
+
+ Private method called in the class constructor that configure the
+ serial port with the characteristics given in the constructor.
+ """
+ if not self.__speed:
+ self.__speed=9600
+
+ # Save the initial port configuration
+ self.__oldmode=tcgetattr(self.__handle)
+ if not self.__params:
+ # self.__params is a list of attributes of the file descriptor
+ # self.__handle as follows:
+ # [c_iflag, c_oflag, c_cflag, c_lflag, c_ispeed, c_ospeed, cc]
+ # where cc is a list of the tty special characters.
+ self.__params=[]
+ # c_iflag
+ self.__params.append(IGNPAR)
+ # c_oflag
+ self.__params.append(0)
+ # c_cflag
+ self.__params.append(CS8|CLOCAL|CREAD)
+ # c_lflag
+ self.__params.append(0)
+ # c_ispeed
+ self.__params.append(SerialPort.BaudRatesDic[self.__speed])
+ # c_ospeed
+ self.__params.append(SerialPort.BaudRatesDic[self.__speed])
+ cc=[0]*NCCS
+ if self.__timeout==None:
+ # A reading is only complete when VMIN characters have
+ # been received (blocking reading)
+ cc[VMIN]=1
+ cc[VTIME]=0
+ elif self.__timeout==0:
+ # Non-blocking reading. The reading operation returns
+ # inmeditately, returning the characters waiting to
+ # be read.
+ cc[VMIN]=0
+ cc[VTIME]=0
+ else:
+ # Time-out reading. For a reading to be correct
+ # a character must be recieved in VTIME*100 seconds.
+ cc[VMIN]=0
+ cc[VTIME]=self.__timeout/100
+ self.__params.append(cc) # c_cc
+
+ tcsetattr(self.__handle, TCSANOW, self.__params)
+
+
+ def fileno(self):
+ """Return the file descriptor for opened device.
+
+ This information can be used for example with the
+ select funcion.
+ """
+ return self.__handle
+
+
+ def __read1(self):
+ """Read 1 byte from the serial port.
+
+ Generate an exception if no byte is read and self.timeout!=0
+ because a timeout has expired.
+ """
+ byte = os.read(self.__handle, 1)
+ if len(byte)==0 and self.__timeout!=0: # Time-out
+ raise SerialPortException('Timeout')
+ else:
+ return byte
+
+
+ def read(self, num=1):
+ """Read num bytes from the serial port.
+
+ Uses the private method __read1 to read num bytes. If an exception
+ is generated in any of the calls to __read1 the exception is reraised.
+ """
+ s=''
+ for i in range(num):
+ s=s+SerialPort.__read1(self)
+
+ return s
+
+
+ def readline(self):
+ """Read a line from the serial port. Returns input once a '\n'
+ character is found.
+ Douglas Jones (dfj23@drexel.edu) 09/09/2005.
+ """
+
+ s = ''
+ while not '\n' in s:
+ s = s+SerialPort.__read1(self)
+
+ return s
+
+
+ def write(self, s):
+ """Write the string s to the serial port"""
+
+ os.write(self.__handle, s)
+
+
+ def inWaiting(self):
+ """Returns the number of bytes waiting to be read"""
+ data = struct.pack("L", 0)
+ data=fcntl.ioctl(self.__handle, TIOCINQ, data)
+ return struct.unpack("L", data)[0]
+
+ def outWaiting(self):
+ """Returns the number of bytes waiting to be write
+ mod. by J.Grauheding
+ result needs some finetunning
+ """
+ rbuf=fcntl.ioctl(self.__handle, TIOCOUTQ, self.buf)
+ return rbuf
+
+ def getlsr(self):
+ """Returns the status of the UART LSR Register
+ J.Grauheding
+ """
+ rbuf=fcntl.ioctl(self.__handle, TIOCSERGETLSR, self.buf)
+ return ord(rbuf[0])
+
+ def get_temt(self):
+ """Returns the Tranmitterbuffer Empty Bit of LSR Register
+ J.Grauheding
+ test result against TIOCSER_TEMT
+ """
+ rbuf=fcntl.ioctl(self.__handle, TIOCSERGETLSR, self.buf)
+ return ord(rbuf[0]) & TIOSER_TEMT
+
+
+ def flush(self):
+ """Discards all bytes from the output or input buffer"""
+ tcflush(self.__handle, TCIOFLUSH)
+
+ def rts_on(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, TIOCMGET, SerialPort.buf)
+ SerialPort.buf[1] = ord(rbuf[3]) | TIOCM_RTS
+ rbuf = fcntl.ioctl(self.__handle, TIOCMSET, SerialPort.buf)
+ return rbuf
+
+ def rts_off(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, TIOCMGET, self.buf)
+ self.buf[1]=ord(rbuf[3]) & ~TIOCM_RTS
+ rbuf = fcntl.ioctl(self.__handle, TIOCMSET, self.buf)
+ return rbuf
+
+ def dtr_on(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, TIOCMGET, SerialPort.buf)
+ SerialPort.buf[1] = ord(rbuf[3]) | TIOCM_DTR
+ rbuf = fcntl.ioctl(self.__handle, TIOCMSET, SerialPort.buf)
+ return rbuf
+
+ def dtr_off(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, TIOCMGET, self.buf)
+ self.buf[1]=ord(rbuf[3]) & ~TIOCM_DTR
+ rbuf = fcntl.ioctl(self.__handle, TIOCMSET, self.buf)
+ return rbuf
+
+ def cts(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, TIOCMGET, self.buf)
+ return ord(rbuf[3]) & TIOCM_CTS
+
+ def cd(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, TIOCMGET, self.buf)
+ return ord(rbuf[3]) & TIOCM_CAR
+
+ def dsr(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, TIOCMGET, self.buf)
+ return ord(rbuf[2]) & (TIOCM_DSR>>8)
+
+ def ri(self):
+ """ J.Grauheding """
+ rbuf = fcntl.ioctl(self.__handle, TIOCMGET, self.buf)
+ return ord(rbuf[3]) & TIOCM_RNG
+
+
+
diff --git a/cesar/maximus/python/lib/proto/uspp/SerialPort_win.py b/cesar/maximus/python/lib/proto/uspp/SerialPort_win.py
new file mode 100644
index 0000000000..80410b9f40
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/SerialPort_win.py
@@ -0,0 +1,239 @@
+# -*- coding: iso-8859-1 -*-
+
+##########################################################################
+# USPP Library (Universal Serial Port Python Library)
+#
+# Copyright (C) 2006 Isaac Barona <ibarona@gmail.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##########################################################################
+
+#-------------------------------------------------------------------------
+# Project: USPP Library (Universal Serial Port Python Library)
+# Name: SerialPort_win.py
+# Purpose: Handle low level access to serial port in windows.
+#
+# Author: Isaac Barona Martinez <ibarona@gmail.com>
+# Copyright: (c) 2001 by Isaac Barona Martínez
+# Licence: LGPL
+#
+# Created: 26 June 2001
+# History:
+# 20 January 2002 : Damien Géranton <dgeranton@voila.fr>
+# Bug fix for Win2000, the file must not be open with
+# FILE_FLAG_OVERLAPPED
+#
+#-------------------------------------------------------------------------
+
+"""
+SerialPort_win.py - Handle low level access to serial port in windows.
+
+See also uspp module docstring.
+
+"""
+
+
+from win32file import *
+from win32event import *
+import win32con
+import exceptions
+
+class SerialPortException(exceptions.Exception):
+ """Exception raise in the SerialPort methods"""
+ def __init__(self, args=None):
+ self.args=args
+
+
+class SerialPort:
+ """Encapsulate methods for accesing to a serial port."""
+
+ BaudRatesDic={110: CBR_110,
+ 300: CBR_300,
+ 600: CBR_600,
+ 1200: CBR_1200,
+ 2400: CBR_2400,
+ 4800: CBR_4800,
+ 9600: CBR_9600,
+ 19200: CBR_19200,
+ 38400: CBR_38400,
+ 57600: CBR_57600,
+ 115200: CBR_115200,
+ }
+
+ def __init__(self, dev, timeout=None, speed=None, mode='232', params=None):
+ """Open the serial port named by the string 'dev'
+
+ 'dev' can be any of the following strings: 'COM1', 'COM2', ... 'COMX'
+
+ 'timeout' specifies the inter-byte timeout or first byte timeout
+ (in miliseconds) for all subsequent reads on SerialPort.
+ If we specify None time-outs are not used for reading operations
+ (blocking reading).
+ If 'timeout' is 0 then reading operations are non-blocking. It
+ specifies that the reading operation is to return inmediately
+ with the bytes that have already been received, even if
+ no bytes have been received.
+
+ 'speed' is an integer that specifies the input and output baud rate to
+ use. Possible values are: 110, 300, 600, 1200, 2400, 4800, 9600,
+ 19200, 38400, 57600 and 115200.
+ If None a default speed of 9600 bps is selected.
+
+ 'mode' specifies if we are using RS-232 or RS-485. The RS-485 mode
+ is half duplex and use the RTS signal to indicate the
+ direction of the communication (transmit or recive).
+ Default to RS232 mode (at moment, only the RS-232 mode is
+ implemented).
+
+ 'params' is a list that specifies properties of the serial
+ communication.
+ If params=None it uses default values for the number of bits
+ per byte (8), the parity (NOPARITY) and the number of stop bits (1)
+ else params must be a list with three items setting up the
+ these values in this order.
+
+ """
+ self.__devName, self.__timeout, self.__speed=dev, timeout, speed
+ self.__mode=mode
+ self.__params=params
+ try:
+ self.__handle=CreateFile (dev,
+ win32con.GENERIC_READ|win32con.GENERIC_WRITE,
+ 0, # exclusive access
+ None, # no security
+ win32con.OPEN_EXISTING,
+ win32con.FILE_ATTRIBUTE_NORMAL,
+ None)
+ except:
+ raise SerialPortException('Unable to open port')
+
+ self.__configure()
+
+ def __del__(self):
+ """Close the serial port
+
+ To close the serial port we have to do explicity: del s
+ (where s is an instance of SerialPort)
+ """
+ try:
+ CloseHandle(self.__handle)
+ except IOError:
+ raise SerialPortException('Unable to close port')
+
+
+ def __configure(self):
+ """Configure the serial port.
+
+ Private method called in the class constructor that configure the
+ serial port with the characteristics given in the constructor.
+ """
+ if not self.__speed:
+ self.__speed=9600
+ # Tell the port we want a notification on each char
+ SetCommMask(self.__handle, EV_RXCHAR)
+ # Setup a 4k buffer
+ SetupComm(self.__handle, 4096, 4096)
+ # Remove anything that was there
+ PurgeComm(self.__handle, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|
+ PURGE_RXCLEAR)
+
+ # Setup the timeouts parameters for the port
+ # timeouts is a tuple with the following items:
+ # [0] int : ReadIntervalTimeout
+ # [1] int : ReadTotalTimeoutMultiplier
+ # [2] int : ReadTotalTimeoutConstant
+ # [3] int : WriteTotalTimeoutMultiplier
+ # [4] int : WriteTotalTimeoutConstant
+
+ if self.__timeout==None:
+ timeouts= 0, 0, 0, 0, 0
+ elif self.__timeout==0:
+ timeouts = win32con.MAXDWORD, 0, 0, 0, 1000
+ else:
+ timeouts= self.__timeout, 0, self.__timeout, 0 , 1000
+ SetCommTimeouts(self.__handle, timeouts)
+
+ # Setup the connection info
+ dcb=GetCommState(self.__handle)
+ dcb.BaudRate=SerialPort.BaudRatesDic[self.__speed]
+ if not self.__params:
+ dcb.ByteSize=8
+ dcb.Parity=NOPARITY
+ dcb.StopBits=ONESTOPBIT
+ else:
+ dcb.ByteSize, dcb.Parity, dcb.StopBits=self.__params
+ SetCommState(self.__handle, dcb)
+
+
+ def fileno(self):
+ """Return the file descriptor for opened device.
+
+ This information can be used for example with the
+ select function.
+ """
+ return self.__handle
+
+
+ def read(self, num=1):
+ """Read num bytes from the serial port.
+
+ If self.__timeout!=0 and != None and the number of read bytes is less
+ than num an exception is generated because a timeout has expired.
+ If self.__timeout==0 read is non-blocking and inmediately returns
+ up to num bytes that have previously been received.
+ """
+
+ (hr, buff) = ReadFile(self.__handle, num)
+ if len(buff)<>num and self.__timeout!=0: # Time-out
+ raise SerialPortException('Timeout')
+ else:
+ return buff
+
+
+ def readline(self):
+ """Read a line from the serial port. Returns input once a '\n'
+ character is found.
+
+ """
+
+ s = ''
+ while not '\n' in s:
+ s = s+SerialPort.read1(self,1)
+
+ return s
+
+
+ def write(self, s):
+ """Write the string s to the serial port"""
+ overlapped=OVERLAPPED()
+ overlapped.hEvent=CreateEvent(None, 0,0, None)
+ WriteFile(self.__handle, s, overlapped)
+ # Wait for the write to complete
+ WaitForSingleObject(overlapped.hEvent, INFINITE)
+
+ def inWaiting(self):
+ """Returns the number of bytes waiting to be read"""
+ flags, comstat = ClearCommError(self.__handle)
+ return comstat.cbInQue
+
+ def flush(self):
+ """Discards all bytes from the output or input buffer"""
+ PurgeComm(self.__handle, PURGE_TXABORT|PURGE_RXABORT|PURGE_TXCLEAR|
+ PURGE_RXCLEAR)
+
+
+
+
+
diff --git a/cesar/maximus/python/lib/proto/uspp/lesser.txt b/cesar/maximus/python/lib/proto/uspp/lesser.txt
new file mode 100644
index 0000000000..54905a6050
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/lesser.txt
@@ -0,0 +1,504 @@
+ GNU LESSER GENERAL PUBLIC LICENSE
+ Version 2.1, February 1999
+
+ Copyright (C) 1991, 1999 Free Software Foundation, Inc.
+ 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+ Everyone is permitted to copy and distribute verbatim copies
+ of this license document, but changing it is not allowed.
+
+[This is the first released version of the Lesser GPL. It also counts
+ as the successor of the GNU Library Public License, version 2, hence
+ the version number 2.1.]
+
+ Preamble
+
+ The licenses for most software are designed to take away your
+freedom to share and change it. By contrast, the GNU General Public
+Licenses are intended to guarantee your freedom to share and change
+free software--to make sure the software is free for all its users.
+
+ This license, the Lesser General Public License, applies to some
+specially designated software packages--typically libraries--of the
+Free Software Foundation and other authors who decide to use it. You
+can use it too, but we suggest you first think carefully about whether
+this license or the ordinary General Public License is the better
+strategy to use in any particular case, based on the explanations below.
+
+ When we speak of free software, we are referring to freedom of use,
+not price. Our General Public Licenses are designed to make sure that
+you have the freedom to distribute copies of free software (and charge
+for this service if you wish); that you receive source code or can get
+it if you want it; that you can change the software and use pieces of
+it in new free programs; and that you are informed that you can do
+these things.
+
+ To protect your rights, we need to make restrictions that forbid
+distributors to deny you these rights or to ask you to surrender these
+rights. These restrictions translate to certain responsibilities for
+you if you distribute copies of the library or if you modify it.
+
+ For example, if you distribute copies of the library, whether gratis
+or for a fee, you must give the recipients all the rights that we gave
+you. You must make sure that they, too, receive or can get the source
+code. If you link other code with the library, you must provide
+complete object files to the recipients, so that they can relink them
+with the library after making changes to the library and recompiling
+it. And you must show them these terms so they know their rights.
+
+ We protect your rights with a two-step method: (1) we copyright the
+library, and (2) we offer you this license, which gives you legal
+permission to copy, distribute and/or modify the library.
+
+ To protect each distributor, we want to make it very clear that
+there is no warranty for the free library. Also, if the library is
+modified by someone else and passed on, the recipients should know
+that what they have is not the original version, so that the original
+author's reputation will not be affected by problems that might be
+introduced by others.
+
+ Finally, software patents pose a constant threat to the existence of
+any free program. We wish to make sure that a company cannot
+effectively restrict the users of a free program by obtaining a
+restrictive license from a patent holder. Therefore, we insist that
+any patent license obtained for a version of the library must be
+consistent with the full freedom of use specified in this license.
+
+ Most GNU software, including some libraries, is covered by the
+ordinary GNU General Public License. This license, the GNU Lesser
+General Public License, applies to certain designated libraries, and
+is quite different from the ordinary General Public License. We use
+this license for certain libraries in order to permit linking those
+libraries into non-free programs.
+
+ When a program is linked with a library, whether statically or using
+a shared library, the combination of the two is legally speaking a
+combined work, a derivative of the original library. The ordinary
+General Public License therefore permits such linking only if the
+entire combination fits its criteria of freedom. The Lesser General
+Public License permits more lax criteria for linking other code with
+the library.
+
+ We call this license the "Lesser" General Public License because it
+does Less to protect the user's freedom than the ordinary General
+Public License. It also provides other free software developers Less
+of an advantage over competing non-free programs. These disadvantages
+are the reason we use the ordinary General Public License for many
+libraries. However, the Lesser license provides advantages in certain
+special circumstances.
+
+ For example, on rare occasions, there may be a special need to
+encourage the widest possible use of a certain library, so that it becomes
+a de-facto standard. To achieve this, non-free programs must be
+allowed to use the library. A more frequent case is that a free
+library does the same job as widely used non-free libraries. In this
+case, there is little to gain by limiting the free library to free
+software only, so we use the Lesser General Public License.
+
+ In other cases, permission to use a particular library in non-free
+programs enables a greater number of people to use a large body of
+free software. For example, permission to use the GNU C Library in
+non-free programs enables many more people to use the whole GNU
+operating system, as well as its variant, the GNU/Linux operating
+system.
+
+ Although the Lesser General Public License is Less protective of the
+users' freedom, it does ensure that the user of a program that is
+linked with the Library has the freedom and the wherewithal to run
+that program using a modified version of the Library.
+
+ The precise terms and conditions for copying, distribution and
+modification follow. Pay close attention to the difference between a
+"work based on the library" and a "work that uses the library". The
+former contains code derived from the library, whereas the latter must
+be combined with the library in order to run.
+
+ GNU LESSER GENERAL PUBLIC LICENSE
+ TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
+
+ 0. This License Agreement applies to any software library or other
+program which contains a notice placed by the copyright holder or
+other authorized party saying it may be distributed under the terms of
+this Lesser General Public License (also called "this License").
+Each licensee is addressed as "you".
+
+ A "library" means a collection of software functions and/or data
+prepared so as to be conveniently linked with application programs
+(which use some of those functions and data) to form executables.
+
+ The "Library", below, refers to any such software library or work
+which has been distributed under these terms. A "work based on the
+Library" means either the Library or any derivative work under
+copyright law: that is to say, a work containing the Library or a
+portion of it, either verbatim or with modifications and/or translated
+straightforwardly into another language. (Hereinafter, translation is
+included without limitation in the term "modification".)
+
+ "Source code" for a work means the preferred form of the work for
+making modifications to it. For a library, complete source code means
+all the source code for all modules it contains, plus any associated
+interface definition files, plus the scripts used to control compilation
+and installation of the library.
+
+ Activities other than copying, distribution and modification are not
+covered by this License; they are outside its scope. The act of
+running a program using the Library is not restricted, and output from
+such a program is covered only if its contents constitute a work based
+on the Library (independent of the use of the Library in a tool for
+writing it). Whether that is true depends on what the Library does
+and what the program that uses the Library does.
+
+ 1. You may copy and distribute verbatim copies of the Library's
+complete source code as you receive it, in any medium, provided that
+you conspicuously and appropriately publish on each copy an
+appropriate copyright notice and disclaimer of warranty; keep intact
+all the notices that refer to this License and to the absence of any
+warranty; and distribute a copy of this License along with the
+Library.
+
+ You may charge a fee for the physical act of transferring a copy,
+and you may at your option offer warranty protection in exchange for a
+fee.
+
+ 2. You may modify your copy or copies of the Library or any portion
+of it, thus forming a work based on the Library, and copy and
+distribute such modifications or work under the terms of Section 1
+above, provided that you also meet all of these conditions:
+
+ a) The modified work must itself be a software library.
+
+ b) You must cause the files modified to carry prominent notices
+ stating that you changed the files and the date of any change.
+
+ c) You must cause the whole of the work to be licensed at no
+ charge to all third parties under the terms of this License.
+
+ d) If a facility in the modified Library refers to a function or a
+ table of data to be supplied by an application program that uses
+ the facility, other than as an argument passed when the facility
+ is invoked, then you must make a good faith effort to ensure that,
+ in the event an application does not supply such function or
+ table, the facility still operates, and performs whatever part of
+ its purpose remains meaningful.
+
+ (For example, a function in a library to compute square roots has
+ a purpose that is entirely well-defined independent of the
+ application. Therefore, Subsection 2d requires that any
+ application-supplied function or table used by this function must
+ be optional: if the application does not supply it, the square
+ root function must still compute square roots.)
+
+These requirements apply to the modified work as a whole. If
+identifiable sections of that work are not derived from the Library,
+and can be reasonably considered independent and separate works in
+themselves, then this License, and its terms, do not apply to those
+sections when you distribute them as separate works. But when you
+distribute the same sections as part of a whole which is a work based
+on the Library, the distribution of the whole must be on the terms of
+this License, whose permissions for other licensees extend to the
+entire whole, and thus to each and every part regardless of who wrote
+it.
+
+Thus, it is not the intent of this section to claim rights or contest
+your rights to work written entirely by you; rather, the intent is to
+exercise the right to control the distribution of derivative or
+collective works based on the Library.
+
+In addition, mere aggregation of another work not based on the Library
+with the Library (or with a work based on the Library) on a volume of
+a storage or distribution medium does not bring the other work under
+the scope of this License.
+
+ 3. You may opt to apply the terms of the ordinary GNU General Public
+License instead of this License to a given copy of the Library. To do
+this, you must alter all the notices that refer to this License, so
+that they refer to the ordinary GNU General Public License, version 2,
+instead of to this License. (If a newer version than version 2 of the
+ordinary GNU General Public License has appeared, then you can specify
+that version instead if you wish.) Do not make any other change in
+these notices.
+
+ Once this change is made in a given copy, it is irreversible for
+that copy, so the ordinary GNU General Public License applies to all
+subsequent copies and derivative works made from that copy.
+
+ This option is useful when you wish to copy part of the code of
+the Library into a program that is not a library.
+
+ 4. You may copy and distribute the Library (or a portion or
+derivative of it, under Section 2) in object code or executable form
+under the terms of Sections 1 and 2 above provided that you accompany
+it with the complete corresponding machine-readable source code, which
+must be distributed under the terms of Sections 1 and 2 above on a
+medium customarily used for software interchange.
+
+ If distribution of object code is made by offering access to copy
+from a designated place, then offering equivalent access to copy the
+source code from the same place satisfies the requirement to
+distribute the source code, even though third parties are not
+compelled to copy the source along with the object code.
+
+ 5. A program that contains no derivative of any portion of the
+Library, but is designed to work with the Library by being compiled or
+linked with it, is called a "work that uses the Library". Such a
+work, in isolation, is not a derivative work of the Library, and
+therefore falls outside the scope of this License.
+
+ However, linking a "work that uses the Library" with the Library
+creates an executable that is a derivative of the Library (because it
+contains portions of the Library), rather than a "work that uses the
+library". The executable is therefore covered by this License.
+Section 6 states terms for distribution of such executables.
+
+ When a "work that uses the Library" uses material from a header file
+that is part of the Library, the object code for the work may be a
+derivative work of the Library even though the source code is not.
+Whether this is true is especially significant if the work can be
+linked without the Library, or if the work is itself a library. The
+threshold for this to be true is not precisely defined by law.
+
+ If such an object file uses only numerical parameters, data
+structure layouts and accessors, and small macros and small inline
+functions (ten lines or less in length), then the use of the object
+file is unrestricted, regardless of whether it is legally a derivative
+work. (Executables containing this object code plus portions of the
+Library will still fall under Section 6.)
+
+ Otherwise, if the work is a derivative of the Library, you may
+distribute the object code for the work under the terms of Section 6.
+Any executables containing that work also fall under Section 6,
+whether or not they are linked directly with the Library itself.
+
+ 6. As an exception to the Sections above, you may also combine or
+link a "work that uses the Library" with the Library to produce a
+work containing portions of the Library, and distribute that work
+under terms of your choice, provided that the terms permit
+modification of the work for the customer's own use and reverse
+engineering for debugging such modifications.
+
+ You must give prominent notice with each copy of the work that the
+Library is used in it and that the Library and its use are covered by
+this License. You must supply a copy of this License. If the work
+during execution displays copyright notices, you must include the
+copyright notice for the Library among them, as well as a reference
+directing the user to the copy of this License. Also, you must do one
+of these things:
+
+ a) Accompany the work with the complete corresponding
+ machine-readable source code for the Library including whatever
+ changes were used in the work (which must be distributed under
+ Sections 1 and 2 above); and, if the work is an executable linked
+ with the Library, with the complete machine-readable "work that
+ uses the Library", as object code and/or source code, so that the
+ user can modify the Library and then relink to produce a modified
+ executable containing the modified Library. (It is understood
+ that the user who changes the contents of definitions files in the
+ Library will not necessarily be able to recompile the application
+ to use the modified definitions.)
+
+ b) Use a suitable shared library mechanism for linking with the
+ Library. A suitable mechanism is one that (1) uses at run time a
+ copy of the library already present on the user's computer system,
+ rather than copying library functions into the executable, and (2)
+ will operate properly with a modified version of the library, if
+ the user installs one, as long as the modified version is
+ interface-compatible with the version that the work was made with.
+
+ c) Accompany the work with a written offer, valid for at
+ least three years, to give the same user the materials
+ specified in Subsection 6a, above, for a charge no more
+ than the cost of performing this distribution.
+
+ d) If distribution of the work is made by offering access to copy
+ from a designated place, offer equivalent access to copy the above
+ specified materials from the same place.
+
+ e) Verify that the user has already received a copy of these
+ materials or that you have already sent this user a copy.
+
+ For an executable, the required form of the "work that uses the
+Library" must include any data and utility programs needed for
+reproducing the executable from it. However, as a special exception,
+the materials to be distributed need not include anything that is
+normally distributed (in either source or binary form) with the major
+components (compiler, kernel, and so on) of the operating system on
+which the executable runs, unless that component itself accompanies
+the executable.
+
+ It may happen that this requirement contradicts the license
+restrictions of other proprietary libraries that do not normally
+accompany the operating system. Such a contradiction means you cannot
+use both them and the Library together in an executable that you
+distribute.
+
+ 7. You may place library facilities that are a work based on the
+Library side-by-side in a single library together with other library
+facilities not covered by this License, and distribute such a combined
+library, provided that the separate distribution of the work based on
+the Library and of the other library facilities is otherwise
+permitted, and provided that you do these two things:
+
+ a) Accompany the combined library with a copy of the same work
+ based on the Library, uncombined with any other library
+ facilities. This must be distributed under the terms of the
+ Sections above.
+
+ b) Give prominent notice with the combined library of the fact
+ that part of it is a work based on the Library, and explaining
+ where to find the accompanying uncombined form of the same work.
+
+ 8. You may not copy, modify, sublicense, link with, or distribute
+the Library except as expressly provided under this License. Any
+attempt otherwise to copy, modify, sublicense, link with, or
+distribute the Library is void, and will automatically terminate your
+rights under this License. However, parties who have received copies,
+or rights, from you under this License will not have their licenses
+terminated so long as such parties remain in full compliance.
+
+ 9. You are not required to accept this License, since you have not
+signed it. However, nothing else grants you permission to modify or
+distribute the Library or its derivative works. These actions are
+prohibited by law if you do not accept this License. Therefore, by
+modifying or distributing the Library (or any work based on the
+Library), you indicate your acceptance of this License to do so, and
+all its terms and conditions for copying, distributing or modifying
+the Library or works based on it.
+
+ 10. Each time you redistribute the Library (or any work based on the
+Library), the recipient automatically receives a license from the
+original licensor to copy, distribute, link with or modify the Library
+subject to these terms and conditions. You may not impose any further
+restrictions on the recipients' exercise of the rights granted herein.
+You are not responsible for enforcing compliance by third parties with
+this License.
+
+ 11. If, as a consequence of a court judgment or allegation of patent
+infringement or for any other reason (not limited to patent issues),
+conditions are imposed on you (whether by court order, agreement or
+otherwise) that contradict the conditions of this License, they do not
+excuse you from the conditions of this License. If you cannot
+distribute so as to satisfy simultaneously your obligations under this
+License and any other pertinent obligations, then as a consequence you
+may not distribute the Library at all. For example, if a patent
+license would not permit royalty-free redistribution of the Library by
+all those who receive copies directly or indirectly through you, then
+the only way you could satisfy both it and this License would be to
+refrain entirely from distribution of the Library.
+
+If any portion of this section is held invalid or unenforceable under any
+particular circumstance, the balance of the section is intended to apply,
+and the section as a whole is intended to apply in other circumstances.
+
+It is not the purpose of this section to induce you to infringe any
+patents or other property right claims or to contest validity of any
+such claims; this section has the sole purpose of protecting the
+integrity of the free software distribution system which is
+implemented by public license practices. Many people have made
+generous contributions to the wide range of software distributed
+through that system in reliance on consistent application of that
+system; it is up to the author/donor to decide if he or she is willing
+to distribute software through any other system and a licensee cannot
+impose that choice.
+
+This section is intended to make thoroughly clear what is believed to
+be a consequence of the rest of this License.
+
+ 12. If the distribution and/or use of the Library is restricted in
+certain countries either by patents or by copyrighted interfaces, the
+original copyright holder who places the Library under this License may add
+an explicit geographical distribution limitation excluding those countries,
+so that distribution is permitted only in or among countries not thus
+excluded. In such case, this License incorporates the limitation as if
+written in the body of this License.
+
+ 13. The Free Software Foundation may publish revised and/or new
+versions of the Lesser General Public License from time to time.
+Such new versions will be similar in spirit to the present version,
+but may differ in detail to address new problems or concerns.
+
+Each version is given a distinguishing version number. If the Library
+specifies a version number of this License which applies to it and
+"any later version", you have the option of following the terms and
+conditions either of that version or of any later version published by
+the Free Software Foundation. If the Library does not specify a
+license version number, you may choose any version ever published by
+the Free Software Foundation.
+
+ 14. If you wish to incorporate parts of the Library into other free
+programs whose distribution conditions are incompatible with these,
+write to the author to ask for permission. For software which is
+copyrighted by the Free Software Foundation, write to the Free
+Software Foundation; we sometimes make exceptions for this. Our
+decision will be guided by the two goals of preserving the free status
+of all derivatives of our free software and of promoting the sharing
+and reuse of software generally.
+
+ NO WARRANTY
+
+ 15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
+WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
+EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
+OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
+KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
+IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
+LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
+THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
+
+ 16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
+WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
+AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
+FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
+CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
+LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
+RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
+FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
+SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
+DAMAGES.
+
+ END OF TERMS AND CONDITIONS
+
+ How to Apply These Terms to Your New Libraries
+
+ If you develop a new library, and you want it to be of the greatest
+possible use to the public, we recommend making it free software that
+everyone can redistribute and change. You can do so by permitting
+redistribution under these terms (or, alternatively, under the terms of the
+ordinary General Public License).
+
+ To apply these terms, attach the following notices to the library. It is
+safest to attach them to the start of each source file to most effectively
+convey the exclusion of warranty; and each file should have at least the
+"copyright" line and a pointer to where the full notice is found.
+
+ <one line to give the library's name and a brief idea of what it does.>
+ Copyright (C) <year> <name of author>
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+
+Also add information on how to contact you by electronic and paper mail.
+
+You should also get your employer (if you work as a programmer) or your
+school, if any, to sign a "copyright disclaimer" for the library, if
+necessary. Here is a sample; alter the names:
+
+ Yoyodyne, Inc., hereby disclaims all copyright interest in the
+ library `Frob' (a library for tweaking knobs) written by James Random Hacker.
+
+ <signature of Ty Coon>, 1 April 1990
+ Ty Coon, President of Vice
+
+That's all there is to it!
+
+
diff --git a/cesar/maximus/python/lib/proto/uspp/uspp.htm b/cesar/maximus/python/lib/proto/uspp/uspp.htm
new file mode 100644
index 0000000000..d3bffac7c7
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/uspp.htm
@@ -0,0 +1,635 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>ibarona - USPP(Universal Serial Port Python Library)</title>
+
+
+
+
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+ <style type="text/css">
+ #g_title p, #g_footer p, #g_description p {
+ margin: 0;
+ }
+ /*
+
+ -- -- -- -- -- -- --
+ Browser Fixes
+ -- -- -- -- -- -- --
+
+ This file uses CSS filtering methods to fix various
+ layout bugs.
+
+ Each of the following three imported files is a
+ separate, browser-specific CSS file that keeps all
+ hacks out of the main style sheet.
+
+ Over time, as supporting these browsers no longer
+ remains a priority, cleaning up the hacks is as
+ easy as deleting the @import statement below, or
+ simply no longer linking this file from the HTML.
+
+ */
+
+ /*
+ fix ie6 "peekaboo bug" using the "holly hack".
+ Note, this style only gets applied to ie6
+ */
+ * html .wrapper {
+ height: 0.1%;
+ }
+
+ /*
+ * IE5 mac - overrides the IE/Win hack
+ */
+
+ /*\*//*/
+
+ * html #threecolumn div {
+ height: auto;
+ }
+
+ /**/
+
+
+ /*
+ * IE5/Win-specific CSS -ensures #container wraps all content on window resize
+ */
+
+ @media tty {
+ i{content:"\";/*" "*/}} * html #container { height: 1%; } /*";}
+ }/* */
+ /* Styling for editable elements. Eventually, this will be part of the style. */
+ .editable {
+ border: 1px dashed blue;
+ }
+
+ #footer {
+ clear: both;
+ }
+
+ /* Extra divs hidden by default. The custom CSS can override this though */
+ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {
+ display: none;
+ }
+
+ /*
+ -- -- -- -- -- -- --
+ 1 Column Layout
+ -- -- -- -- -- -- --
+ */
+
+ /* Center #container, constrain to 718px width
+ ----------------------------------------------- */
+ body {
+ text-align: center;
+ }
+ #container {
+ width: 718px;
+ text-align: left;
+ margin: 0 auto;
+ }
+
+ #main-content {
+ overflow: hidden;
+ }
+
+ /** BEGIN CUSTOM SKIN **/
+ /*
+
+ -- -- -- -- -- -- --
+ Base CSS
+ -- -- -- -- -- -- --
+
+ This file simply removes default styling on most HTML elements in
+ order to reduce the need to later override them.
+
+ */
+
+ h1,h2,h3,h4,h5,h6,pre,code,p {font-size: 1em;}
+ dl,li,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input {margin: 0; padding: 0;}
+ a img,:link img,:visited img {border: none;}
+ address {font-style: normal;}/*
+
+ -- -- -- -- -- -- --
+ Type Scheme: Deco
+ -- -- -- -- -- -- --
+
+ */
+
+ body {
+ font: 76% Verdana, sans-serif;
+ }
+
+ h1, h2, h3, h4, h5, h6, p.description {
+ font-family: "Trebuchet MS", Trebuchet, sans-serif;
+ }
+ h1 {
+ font-size: 3em;
+ font-weight: bold;
+ letter-spacing: 2px;
+ }
+ h2 {
+ font-size: 2em;
+ font-weight: normal;
+ }
+ h3 {
+ font-size: 1.5em;
+ }
+ h4 {
+ font-size: 1.2em;
+ letter-spacing: 0.2em;
+ }
+ h5 {
+ font-size: 1.2em;
+ }
+ h6 {
+ font-size: 1em;
+ font-weight: bold;
+ }
+
+ p, td {
+ line-height: 1.8em;
+ }
+ code, kbd {
+ font-size: 1.25em;
+ }/*
+
+ -- -- -- -- -- -- --
+ STYLE: Micro
+ -- -- -- -- -- -- --
+
+ */
+
+
+
+
+ /* ie6win */
+
+ /* IE/Win fixes for various layouts
+ ----------------------------------------------- */
+ * html #onecolumn #header {
+ margin-right: -3px;
+ }
+ * html #onecolumn #header,
+ * html #twocolumn-left #header, * html #twocolumn-right #header,
+ * html #twocolumn-liquid-left #header, * html #twocolumn-liquid-right #header {
+ padding-bottom: 1px;
+ }
+ * html #twocolumn-left #main-content, * html #twocolumn-right #main-content {
+ width: 459px;
+ }
+ * html #threecolumn #main-content {
+ width: 409px;
+ }
+
+ /* ie5mac */
+
+ /*\*//*/
+ /* Undoing IE/Win fixes
+ ----------------------------------------------- */
+ * html #onecolumn #header {
+ margin-right: 0;
+ }
+ * html #twocolumn-left #header, * html #twocolumn-right #header,
+ * html #twocolumn-liquid-left #header, * html #twocolumn-liquid-right #header {
+ padding-bottom: 0;
+ }
+ * html #twocolumn-left #main-content, * html #twocolumn-right #main-content {
+ width: 479px;
+ }
+ * html #threecolumn #main-content {
+ width: 429px;
+ }
+ /**/
+
+ @media tty {
+ i{content:"\";/*" "*/}} td { font-size: 0.8em; } /*";}
+ }/* */
+
+
+
+ /* Basic HTML style
+ ----------------------------------------------- */
+ body {
+ font: 76% "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
+ color: #000;
+ background: #fff;
+ margin: 0;
+ padding: 0;
+ }
+ blockquote {
+ margin: 1em 2em;
+ font-style: italic;
+ }
+ caption {
+ font-weight: bold;
+ color: #444;
+ background: #ccc;
+ border-bottom: 0;
+ padding: 0.3em 1em;
+ }
+ dd {
+ margin: 1em 2em;
+ }
+ dl {
+ margin: 2em 0;
+ }
+ dt {
+ font-weight: bold;
+ }
+ hr {
+ margin: 2em 0;
+ color: #C7C7C7;
+ background: #C7C7C7;
+ border-color: #C7C7C7;
+ border-style: none;
+ height: 1px;
+ }
+ li {
+ margin: 1em 0;
+ }
+ table {
+ border: solid 1px #ccc;
+ }
+ td {
+ vertical-align: top;
+ padding: 0.5em;
+ }
+ th {
+ text-align: left;
+ color: #fff;
+ background: #777;
+ padding: 0.5em;
+ }
+ ol, ul {
+ margin: 2em 0;
+ padding-left: 1em;
+ }
+
+
+
+ /* Nested HTML elements, and basic classes
+ ----------------------------------------------- */
+ ol li {
+ list-style-type: decimal;
+ margin-left: 2em;
+ }
+ ul li {
+ margin-left: 2em;
+ list-style-type: square;
+ }
+ td p {
+ margin-top: 0;
+ }
+
+
+
+ /* Set the stage with main layout tweaks
+ ----------------------------------------------- */
+ #container {
+ border: solid 7px #999;
+ border-left: 0;
+ border-right: 0;
+ padding-top: 1px;
+ }
+ #header {
+ color: #04172D;
+ border-top: solid 3px #777;
+ padding: 0;
+ margin: 0 0 1.5em 0;
+ }
+ #main-content .wrapper {
+ margin: 0;
+ }
+ .description {
+ font: normal 1em "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
+ color: #444;
+ background: #C7C7C7;
+ padding: 3px 25px 2.2em 25px;
+ margin: 0;
+ line-height: 1;
+ }
+ #footer {
+ clear: both;
+ color: #999;
+ padding: 0 1em 1em 1em;
+ border-bottom: solid 3px #777;
+ margin-bottom: 1px;
+ }
+
+
+ /* Content area offset
+ ----------------------------------------------- */
+ #main-content .wrapper {
+ padding: 0 25px;
+ }
+
+ #main-content td p {
+ margin: 0 0 1em 0;
+ }
+
+
+
+ /* Custom font definitions
+ ----------------------------------------------- */
+ p {
+ margin: 1em 0;
+ line-height: 1.5;
+ }
+ h1,h2,h3,h4,h5,h6 {
+ font-family: "Trebuchet MS", arial, sans-serif;
+ }
+ h1 {
+ color: #B2B2B2;
+ font-size: 2.4em;
+ letter-spacing: 0.2em;
+ font-weight: normal;
+ padding: 1em 25px 0 25px;
+ }
+ h2 {
+ margin: 0 0 0.5em 0;
+ color: #777;
+ font-size: 1.4em;
+ font-weight: normal;
+ border-bottom: double 3px #C7C7C7;
+ padding: 0 0 0.4em 0;
+ }
+ h3 {
+ font-size: 1.2em;
+ background: #eee;
+ border: dotted 1px #C7C7C7;
+ padding: 0.2em;
+ }
+ h4 {
+ font-size: 1.2em;
+ padding: 0 0 0.2em 0;
+ margin: 0.6em 0 0 0.4em;
+ color: #777;
+ }
+ h5 {
+ border-bottom: dotted 1px #C7C7C7;
+ }
+ h6 {
+ color: #777;
+ border-left: solid 1.2em #777;
+ padding-left: 0.6em;
+ }
+
+ a:link {
+ color: #9db2df;
+ }
+ a:hover {
+ text-decoration: none;
+ border-bottom: 1px dotted #bb242d;
+ background-color: #e0e0e0;
+ }
+
+
+ /* Sidebar
+ ----------------------------------------------- */
+ #sidebar h3, #sidebar-alternate h3 {
+ margin: 0;
+ color: #777;
+ background: none;
+ font-size: 1.4em;
+ font-weight: normal;
+ border: none;
+ padding: 0;
+ }
+
+ #sidebar blockquote, #sidebar blockquote p,
+ #sidebar-alternate blockquote, #sidebar-alternate blockquote p {
+ margin-left: 0;
+ margin-right: 0;
+ }
+ #sidebar blockquote {
+ margin: 1em 0;
+ padding: 0;
+ }
+ #adsense {
+ text-align: center;
+ }
+
+
+
+ .editable {
+ border: dashed 1px #c33;
+ }
+
+
+
+
+ /* Tweaks for Two-column Right layout
+ ----------------------------------------------- */
+ #twocolumn-right #sidebar .wrapper {
+ margin: 0 10px;
+ }
+
+
+
+ /* Tweaks for Two-column Left layout
+ ----------------------------------------------- */
+ #twocolumn-left #sidebar .wrapper {
+ margin: 0 10px;
+ }
+
+
+ /* Tweaks for Three-column layout
+ ----------------------------------------------- */
+ #threecolumn #sidebar .wrapper {
+ margin: 0 10px;
+ }
+ #threecolumn #sidebar-alternate .wrapper {
+ margin: 0 10px;
+ }
+ /*
+
+ -- -- -- -- -- -- --
+ COLOR SCHEME: Blueprint
+ -- -- -- -- -- -- --
+
+ */
+
+
+ /* Basic HTML style
+ ----------------------------------------------- */
+ a:link {
+ color: #445AA9;
+ }
+ a:visited {
+ color: #283D88;
+ }
+ body {
+ color: #283769;
+ background: #ECEEF6;
+ }
+ caption {
+ color: inherit;
+ background: #ECEEF6;
+ }
+ hr {
+ color: #C7C7C7;
+ background: #C7C7C7;
+ border-color: #C7C7C7;
+ }
+ table {
+ background: #fff;
+ border-color: #B3BCDC;
+ }
+ th {
+ color: #fff;
+ background: #445AA9;
+ }
+
+
+
+ /* Set the stage with main layout tweaks
+ ----------------------------------------------- */
+ #container {
+ background-color: #F6F7FB;
+ border-color: #6678B8;
+ }
+ #header {
+ color: #445AA9;
+ border-top-color: #6678B8;
+ }
+ .description {
+ color: #445AA9;
+ background: #C9D0E6;
+ }
+ #footer {
+ color: #5064AE;
+ border-bottom-color: #6678B8;
+ }
+
+
+
+ /* Custom font definitions
+ ----------------------------------------------- */
+ h1 {
+ color: #445AA9;
+ }
+ h2 {
+ color: #5064AE;
+ border-bottom-color: #B3BCDC;
+ }
+ h3 {
+ background: #ECEEF6;
+ border-color: #C9D0E6;
+ }
+ h4 {
+ border-bottom-color: #B3BCDC;
+ color: #1A4292;
+ }
+ h5 {
+ border-bottom-color: #C7C7C7;
+ }
+ h6 {
+ color: #5064AE;
+ border-left-color: #B3BCDC;
+ }
+
+
+
+
+
+ /* Sidebar
+ ----------------------------------------------- */
+ #sidebar h3, #sidebar-alternate h3 {
+ color: #5064AE;
+ background: none;
+ }
+ /** END CUSTOM SKIN **/
+ </style><!-- Hack to avoid flash of unstyled content in IE -->
+
+
+ <script> </script></head><body id="onecolumn">
+ <div id="container">
+ <div class="wrapper">
+ <div id="header">
+ <div class="wrapper">
+ <h1 id="page-title"><div id="g_title">USPP(Universal Serial Port Python Library)<br></div></h1>
+ <div style="clear: both;"></div>
+ <p class="description"></p><div id="g_description"><p>Isaac Barona (ibarona@gmail.com)&nbsp;</p></div>
+ <div style="clear: both;"></div>
+ </div>
+ </div>
+
+ <div id="main-content">
+ <div class="wrapper">
+ <div class="content-item"><div id="g_body"><h2>Introduction</h2><p><i>USPP Library </i>is a multi-platform Python module to access serial ports.
+At the moment, it only works in Windows, Linux and MacOS but as it is written entirely in Python (doesn't wrap any C/C++
+library) I hope you can extend it to support any other platforms.&nbsp;</p><h2>Motivation</h2><p>
+I like very much to make electronic widgets with microcontrollers, specially
+those that can be connected to the computer to send and receive data.
+</p><p>Some months ago, I discovered Python and inmediatelly liked it a lot.
+I started playing with it and saw that I could use it to make prototypes of
+comunication protocols between computer and microcontrollers really
+fast and easily than using C. At the same time, I was interested in
+working over different platforms.
+</p><p>I started looking for Python modules to access serial port and I found
+the following projects:
+</p><ul><li><i>win32comport_demo</i> from the win32 extension module</li><li><i>win32comm</i> module of wheineman@uconect.net</li><li><i>Sio Module </i>of Roger Rurnham (rburnham@cri-inc.com)</li><li><i>pyxal (Python X10 Abstraction Layer) </i>of Les Smithson (lsmithson@open-networks.co.uk)</li></ul><p>but they were not multi-platform, were just a wrap of propietary libraries or
+were just simple examples of serial port access.
+</p><p>For these reasons and also for learning more Python, I decided to start
+this project. Of course, I have used all this projects as reference to
+my module and so, I want to thanks the authors for their excellent work and
+for allowing us to study the code.
+I hope you enjoy using the uspp module as much as I am enjoying doing it.</p><h2>Features</h2><p>
+This module has the following features:
+</p><ul><li>hight level access to serial port under several platforms.</li><li>autodetects the platform in which it is working and exports the correct
+classes for that platform.</li><li>object oriented approach.</li><li>file object semantic operations over the ports.</li><li>allows using the serial port with different speeds and
+characteristics.</li><li>RS-232 and RS-485 modes (now only RS-232). In RS-485 mode the communication
+is half-duplex and uses the RTS line to control the direction of the
+transference.</li><li>blocking, non-blocking or configurable timeout reads.</li></ul><h2>&nbsp;Prerequisites</h2><p>You need the following to use the library:
+</p><ul><li>Python 2.1 or better</li><li>In windows you need the win32 extension modules. You can get it from <a href="http://sourceforge.net/projects/pywin32/">here</a>.<br></li></ul><h2>Usage and documentation</h2><p>You only have to import in your program the <i>uspp</i> module and automatically
+it loads the correct classes for the platform in which you are running
+the program.
+
+</p><p>First of all you have to create a <i>SerialPort</i> object with the settings you
+want. If a <i>SerialPortException</i> is not generated then you just can
+use the read and write methods of the object to read and write to
+the serial port.
+
+</p><p>Example:
+
+</p><pre><tt><br>&gt;&gt;&gt; from uspp import *<br>&gt;&gt;&gt; tty=SerialPort("COM2", 1000, 9600) <br>&gt;&gt;&gt; # Opens COM2 at 9600 bps and with a read timeout of 1 second.<br>&gt;&gt;&gt; tty.write("a") # Writes a character to the COM2 port<br>&gt;&gt;&gt; # Now suppose we receive the string "abc"<br>&gt;&gt;&gt; tty.inWaiting()<br>3<br>&gt;&gt;&gt; tty.read()<br>'a'<br>&gt;&gt;&gt; tty.inWaiting()<br>2<br>&gt;&gt;&gt; tty.read(2)<br>'bc'<br></tt></pre>
+
+<p>Documentation of the different classes and methods can be found on
+uspp module docstring.</p><h2>Where does it works?&nbsp;</h2><p>&nbsp;
+The library has been tested in&nbsp; Windows 95, Windows XP and Windows 2000&nbsp; machines with Python 2.0+
+and in a Linux (2.0.34 and 2.4.20 kernels) machine with Python 2.1+.</p><h2>Porting to other frameworks</h2><p>
+If you want to port the library to other platforms you only have to follow
+these steps:
+</p><ul><li>Create a new python file called <i>SerialPort_XXXX.py </i>in which you
+implement the same public classes and methods found in the
+<i>SerialPort_win</i>
+and <i>SerialPort_linux</i> modules.</li><li>Append the new platform to the <i>uspp.py</i> file.</li></ul><h2>License&nbsp;</h2><p>&nbsp;
+This code is released under the "GPL" that can be found in
+<a href="http://www.gnu.org/copyleft/gpl.html%20">http://www.gnu.org/copyleft/gpl.html </a>or in the GPL.txt file that
+is with the library.
+</p><p>If you use this software, I'd like to know about it.</p><h2>&nbsp;Author</h2><p>
+This library has been created by Isaac Barona Martínez
+<a href="mailto:ibarona%20at%20gmail.com">(ibarona at gmail.com)</a>&nbsp;</p><h2>Versions <br></h2><h3>Version 1.0 - 02/24/2006 (February 2006) &nbsp;&nbsp;&nbsp;</h3><p>Lot
+to time after 0.1 version I have enouth time to publish the final
+version of the library. This version correct some bugs of 0.1 version,
+works in MacOS and have been extended.</p><p>The library contains more functions in Linux and MacOS platforms than in Windows platform.&nbsp;</p><p>I have to thanks a lot of people his contribution to the library, especially:</p><ul><li>Damien Geranton &lt;dgeranton at voila.fr&gt;&nbsp;</li><li>Douglas Jones &lt;dfj23 at drexel.edu&gt;</li><li>&nbsp;J.Grauheding &lt;juergen.grauheding at a-city.de&gt; </li></ul><p>&nbsp;Files:</p><ul><ul><li>Zip file: uspp-0_1.zip</li><li>tar.gz file: uspp-0_1.tar.gz</li></ul></ul><h4>&nbsp;</h4><h3>Version 0.1 - 09/01/2001 (September 2001)</h3><p></p></div></div>
+ <div style="clear: both;"></div>
+ </div>
+ </div>
+
+ <div id="footer"><div class="wrapper">
+ <hr>
+ <p></p><div id="g_footer">&nbsp;</div>
+ <div style="clear: both;"></div>
+ </div></div>
+
+ </div>
+ </div>
+
+
+<div id="extraDiv1"><span></span></div><div id="extraDiv2"><span></span></div>
+<div id="extraDiv3"><span></span></div><div id="extraDiv4"><span></span></div>
+<div id="extraDiv5"><span></span></div><div id="extraDiv6"><span></span></div>
+
+</body></html> \ No newline at end of file
diff --git a/cesar/maximus/python/lib/proto/uspp/uspp.py b/cesar/maximus/python/lib/proto/uspp/uspp.py
new file mode 100644
index 0000000000..1255613d62
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/uspp.py
@@ -0,0 +1,193 @@
+#! /usr/bin/env python
+
+# -*- coding: iso-8859-1 -*-
+
+##########################################################################
+# USPP Library (Universal Serial Port Python Library)
+#
+# Copyright (C) 2006 Isaac Barona <ibarona@gmail.com>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library 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
+# Lesser General Public License for more details.
+
+# You should have received a copy of the GNU Lesser General Public
+# License along with this library; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
+##########################################################################
+
+#-------------------------------------------------------------------------
+# Project: USPP Library (Universal Serial Port Python Library)
+# Name: uspp.py
+# Purpose: Main module. Imports the correct module for the platform
+# in which it is running.
+#
+# Author: Isaac Barona Martinez <ibarona@gmail.com>
+# Copyright: (c) 2006 by Isaac Barona Martinez
+# Licence: LGPL
+#
+# Created: 26 June 2001
+# History:
+# 05/08/2001: Release version 0.1.
+# 24/02/2006: Final version 1.0.
+#
+#-------------------------------------------------------------------------
+
+
+"""
+USPP - Universal Serial Port Python Library
+
+This module exports a SerialPort class to access serial ports in
+different platforms (currently W9X and Linux) with the same code.
+
+When the library user import the uspp module, it automatically
+loads the correct class implementation for the platform in which
+is running.
+
+The public classes, exceptions and methods are the following:
+
+SerialPortException
+===================
+Exception raised in the SerialPort methods.
+
+
+SerialPort
+==========
+Class that encapsulate methods to access serial ports. It has the
+following public methods:
+
+* __init__(self, dev, timeout=None, speed=None, mode='232', params=None)
+
+ Create an object to access serial port 'dev'
+
+ Arguments:
+
+ dev: String that indicate the name of the port. Possible values are:
+ In Linux: '/dev/ttyS0', '/dev/ttyS1', ..., '/dev/ttySX' or
+ '/dev/cua0', '/dev/cua1', ..., '/dev/cuaX'
+ In W9X: 'COM1', 'COM2', ..., 'COMX'
+
+ timeout: specifies in milliseconds the inter-byte timeout. Possible
+ values are:
+ * None: For blocking readings. Time-outs are not used for reading
+ operations.
+ * 0: For non-blocking readings. The reading operation is to return
+ inmediately with the characters that have already been received,
+ even if no characters have been received.
+ * >0: For time-out readings. A character must be read in less than
+ this value.
+
+ speed: integer that specifies the input and output baud rate to
+ use. Possible values are: 110, 300, 600, 1200, 2400, 4800, 9600,
+ 19200, 38400, 57600 and 115200.
+ If None a default speed of 9600 bps is selected.
+
+ mode: string that specifies RS-232 or RS-485 mode. The RS-485 mode
+ is half duplex and use the RTS signal to indicate the
+ direction of the communication (transmit or recive).
+ Posible values are: '232' or '485'. Default to RS232 mode (the
+ only implemented just now).
+
+ params: list that specifies properties of the serial communication.
+ If params=None it uses default values for the number of bits
+ per byte (8), the parity (NOPARITY) and the number of stop bits (1)
+ else:
+ * In W9X: params must be a list with three items setting up the
+ these values in this order.
+ * In Linux: params must is the termios package mode array to use
+ for initialization.
+
+
+
+* __del__(self):
+
+ Destroy the SerialPort object and close the serial port. It is a good
+ idea that when you finish working with the serial port you explicity
+ do: del tty (where tty is a SerialPort object).
+
+* fileno(self):
+
+ Returns the file descriptor of the serial port. This information is
+ sometimes necessary for example if you want to use the select function.
+
+* read(self, num=1):
+
+ Read num bytes from the serial port. Depending the timeout value used in
+ the inicialitation this operation can be:
+
+ - Blocking (if timeout=None): The operation blocks until num bytes
+ arrive the serial port.
+ - Non-blocking (if timeout=0): The operation returns inmediatelly
+ with as many as num bytes that were waiting in the serial port to be read.
+ - Time-out (if timeout>0): A byte must arrive in less milliseconds than
+ the specified. If the number of read bytes is less than num a
+ SerialPortException is raised because a time-out has happened.
+
+* write(self, s):
+
+ Write the string s to the serial port.
+
+* inWaiting(self):
+
+ Returns the number of bytes waiting to be read.
+
+
+* flush(self):
+
+ Discards all characters from the output or input buffer.
+
+
+
+NOTE ON CHARACTERS AND BYTES
+============================
+
+The write and read methods of the SerialPort class expect data
+in string buffers. Do not think this library only works for
+ASCII communications. To interpret string elements as bytes (integer number)
+you only have to use the built-in ord() function. To convert a byte
+into a string element, use chr().
+
+Example: Suppose you want to transmit the following three bytes:
+0x02, 0x10, 0x30. You only have to do:
+
+packet = ''
+packet = packet + chr(0x02) + chr(0x10) + chr(0x30)
+tty.write(packet)
+
+So, you can see the bytes you send or receive as integers or as characters
+depending the situation.
+
+
+
+"""
+
+
+
+__author__="Isaac Barona Martinez <ibarona@tid.es>"
+
+__copyright__="""
+Copyright (C) 2001 Isaac Barona Martinez <ibarona@tid.es>
+
+This library 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; version 2 dated
+June, 1991.
+"""
+
+__version__="0.1"
+
+
+import sys
+
+if sys.platform=='win32':
+ from SerialPort_win import *
+elif sys.platform=='linux2':
+ from SerialPort_linux import *
+else:
+ sys.exit('Sorry, no implemented for this platform yet')
diff --git a/cesar/maximus/python/lib/proto/uspp/uspp_es.htm b/cesar/maximus/python/lib/proto/uspp/uspp_es.htm
new file mode 100644
index 0000000000..337ee34dc5
--- /dev/null
+++ b/cesar/maximus/python/lib/proto/uspp/uspp_es.htm
@@ -0,0 +1,629 @@
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"><head><title>ibarona - USPP(Universal Serial Port Python Library)</title>
+
+
+
+
+ <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+
+ <style type="text/css">
+ #g_title p, #g_footer p, #g_description p {
+ margin: 0;
+ }
+ /*
+
+ -- -- -- -- -- -- --
+ Browser Fixes
+ -- -- -- -- -- -- --
+
+ This file uses CSS filtering methods to fix various
+ layout bugs.
+
+ Each of the following three imported files is a
+ separate, browser-specific CSS file that keeps all
+ hacks out of the main style sheet.
+
+ Over time, as supporting these browsers no longer
+ remains a priority, cleaning up the hacks is as
+ easy as deleting the @import statement below, or
+ simply no longer linking this file from the HTML.
+
+ */
+
+ /*
+ fix ie6 "peekaboo bug" using the "holly hack".
+ Note, this style only gets applied to ie6
+ */
+ * html .wrapper {
+ height: 0.1%;
+ }
+
+ /*
+ * IE5 mac - overrides the IE/Win hack
+ */
+
+ /*\*//*/
+
+ * html #threecolumn div {
+ height: auto;
+ }
+
+ /**/
+
+
+ /*
+ * IE5/Win-specific CSS -ensures #container wraps all content on window resize
+ */
+
+ @media tty {
+ i{content:"\";/*" "*/}} * html #container { height: 1%; } /*";}
+ }/* */
+ /* Styling for editable elements. Eventually, this will be part of the style. */
+ .editable {
+ border: 1px dashed blue;
+ }
+
+ #footer {
+ clear: both;
+ }
+
+ /* Extra divs hidden by default. The custom CSS can override this though */
+ #extraDiv1, #extraDiv2, #extraDiv3, #extraDiv4, #extraDiv5, #extraDiv6 {
+ display: none;
+ }
+
+ /*
+ -- -- -- -- -- -- --
+ 1 Column Layout
+ -- -- -- -- -- -- --
+ */
+
+ /* Center #container, constrain to 718px width
+ ----------------------------------------------- */
+ body {
+ text-align: center;
+ }
+ #container {
+ width: 718px;
+ text-align: left;
+ margin: 0 auto;
+ }
+
+ #main-content {
+ overflow: hidden;
+ }
+
+ /** BEGIN CUSTOM SKIN **/
+ /*
+
+ -- -- -- -- -- -- --
+ Base CSS
+ -- -- -- -- -- -- --
+
+ This file simply removes default styling on most HTML elements in
+ order to reduce the need to later override them.
+
+ */
+
+ h1,h2,h3,h4,h5,h6,pre,code,p {font-size: 1em;}
+ dl,li,dt,dd,h1,h2,h3,h4,h5,h6,pre,form,body,html,p,blockquote,fieldset,input {margin: 0; padding: 0;}
+ a img,:link img,:visited img {border: none;}
+ address {font-style: normal;}/*
+
+ -- -- -- -- -- -- --
+ Type Scheme: Deco
+ -- -- -- -- -- -- --
+
+ */
+
+ body {
+ font: 76% Verdana, sans-serif;
+ }
+
+ h1, h2, h3, h4, h5, h6, p.description {
+ font-family: "Trebuchet MS", Trebuchet, sans-serif;
+ }
+ h1 {
+ font-size: 3em;
+ font-weight: bold;
+ letter-spacing: 2px;
+ }
+ h2 {
+ font-size: 2em;
+ font-weight: normal;
+ }
+ h3 {
+ font-size: 1.5em;
+ }
+ h4 {
+ font-size: 1.2em;
+ letter-spacing: 0.2em;
+ }
+ h5 {
+ font-size: 1.2em;
+ }
+ h6 {
+ font-size: 1em;
+ font-weight: bold;
+ }
+
+ p, td {
+ line-height: 1.8em;
+ }
+ code, kbd {
+ font-size: 1.25em;
+ }/*
+
+ -- -- -- -- -- -- --
+ STYLE: Micro
+ -- -- -- -- -- -- --
+
+ */
+
+
+
+
+ /* ie6win */
+
+ /* IE/Win fixes for various layouts
+ ----------------------------------------------- */
+ * html #onecolumn #header {
+ margin-right: -3px;
+ }
+ * html #onecolumn #header,
+ * html #twocolumn-left #header, * html #twocolumn-right #header,
+ * html #twocolumn-liquid-left #header, * html #twocolumn-liquid-right #header {
+ padding-bottom: 1px;
+ }
+ * html #twocolumn-left #main-content, * html #twocolumn-right #main-content {
+ width: 459px;
+ }
+ * html #threecolumn #main-content {
+ width: 409px;
+ }
+
+ /* ie5mac */
+
+ /*\*//*/
+ /* Undoing IE/Win fixes
+ ----------------------------------------------- */
+ * html #onecolumn #header {
+ margin-right: 0;
+ }
+ * html #twocolumn-left #header, * html #twocolumn-right #header,
+ * html #twocolumn-liquid-left #header, * html #twocolumn-liquid-right #header {
+ padding-bottom: 0;
+ }
+ * html #twocolumn-left #main-content, * html #twocolumn-right #main-content {
+ width: 479px;
+ }
+ * html #threecolumn #main-content {
+ width: 429px;
+ }
+ /**/
+
+ @media tty {
+ i{content:"\";/*" "*/}} td { font-size: 0.8em; } /*";}
+ }/* */
+
+
+
+ /* Basic HTML style
+ ----------------------------------------------- */
+ body {
+ font: 76% "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
+ color: #000;
+ background: #fff;
+ margin: 0;
+ padding: 0;
+ }
+ blockquote {
+ margin: 1em 2em;
+ font-style: italic;
+ }
+ caption {
+ font-weight: bold;
+ color: #444;
+ background: #ccc;
+ border-bottom: 0;
+ padding: 0.3em 1em;
+ }
+ dd {
+ margin: 1em 2em;
+ }
+ dl {
+ margin: 2em 0;
+ }
+ dt {
+ font-weight: bold;
+ }
+ hr {
+ margin: 2em 0;
+ color: #C7C7C7;
+ background: #C7C7C7;
+ border-color: #C7C7C7;
+ border-style: none;
+ height: 1px;
+ }
+ li {
+ margin: 1em 0;
+ }
+ table {
+ border: solid 1px #ccc;
+ }
+ td {
+ vertical-align: top;
+ padding: 0.5em;
+ }
+ th {
+ text-align: left;
+ color: #fff;
+ background: #777;
+ padding: 0.5em;
+ }
+ ol, ul {
+ margin: 2em 0;
+ padding-left: 1em;
+ }
+
+
+
+ /* Nested HTML elements, and basic classes
+ ----------------------------------------------- */
+ ol li {
+ list-style-type: decimal;
+ margin-left: 2em;
+ }
+ ul li {
+ margin-left: 2em;
+ list-style-type: square;
+ }
+ td p {
+ margin-top: 0;
+ }
+
+
+
+ /* Set the stage with main layout tweaks
+ ----------------------------------------------- */
+ #container {
+ border: solid 7px #999;
+ border-left: 0;
+ border-right: 0;
+ padding-top: 1px;
+ }
+ #header {
+ color: #04172D;
+ border-top: solid 3px #777;
+ padding: 0;
+ margin: 0 0 1.5em 0;
+ }
+ #main-content .wrapper {
+ margin: 0;
+ }
+ .description {
+ font: normal 1em "Lucida Grande", "Lucida Sans Unicode", Arial, sans-serif;
+ color: #444;
+ background: #C7C7C7;
+ padding: 3px 25px 2.2em 25px;
+ margin: 0;
+ line-height: 1;
+ }
+ #footer {
+ clear: both;
+ color: #999;
+ padding: 0 1em 1em 1em;
+ border-bottom: solid 3px #777;
+ margin-bottom: 1px;
+ }
+
+
+ /* Content area offset
+ ----------------------------------------------- */
+ #main-content .wrapper {
+ padding: 0 25px;
+ }
+
+ #main-content td p {
+ margin: 0 0 1em 0;
+ }
+
+
+
+ /* Custom font definitions
+ ----------------------------------------------- */
+ p {
+ margin: 1em 0;
+ line-height: 1.5;
+ }
+ h1,h2,h3,h4,h5,h6 {
+ font-family: "Trebuchet MS", arial, sans-serif;
+ }
+ h1 {
+ color: #B2B2B2;
+ font-size: 2.4em;
+ letter-spacing: 0.2em;
+ font-weight: normal;
+ padding: 1em 25px 0 25px;
+ }
+ h2 {
+ margin: 0 0 0.5em 0;
+ color: #777;
+ font-size: 1.4em;
+ font-weight: normal;
+ border-bottom: double 3px #C7C7C7;
+ padding: 0 0 0.4em 0;
+ }
+ h3 {
+ font-size: 1.2em;
+ background: #eee;
+ border: dotted 1px #C7C7C7;
+ padding: 0.2em;
+ }
+ h4 {
+ font-size: 1.2em;
+ padding: 0 0 0.2em 0;
+ margin: 0.6em 0 0 0.4em;
+ color: #777;
+ }
+ h5 {
+ border-bottom: dotted 1px #C7C7C7;
+ }
+ h6 {
+ color: #777;
+ border-left: solid 1.2em #777;
+ padding-left: 0.6em;
+ }
+
+ a:link {
+ color: #9db2df;
+ }
+ a:hover {
+ text-decoration: none;
+ border-bottom: 1px dotted #bb242d;
+ background-color: #e0e0e0;
+ }
+
+
+ /* Sidebar
+ ----------------------------------------------- */
+ #sidebar h3, #sidebar-alternate h3 {
+ margin: 0;
+ color: #777;
+ background: none;
+ font-size: 1.4em;
+ font-weight: normal;
+ border: none;
+ padding: 0;
+ }
+
+ #sidebar blockquote, #sidebar blockquote p,
+ #sidebar-alternate blockquote, #sidebar-alternate blockquote p {
+ margin-left: 0;
+ margin-right: 0;
+ }
+ #sidebar blockquote {
+ margin: 1em 0;
+ padding: 0;
+ }
+ #adsense {
+ text-align: center;
+ }
+
+
+
+ .editable {
+ border: dashed 1px #c33;
+ }
+
+
+
+
+ /* Tweaks for Two-column Right layout
+ ----------------------------------------------- */
+ #twocolumn-right #sidebar .wrapper {
+ margin: 0 10px;
+ }
+
+
+
+ /* Tweaks for Two-column Left layout
+ ----------------------------------------------- */
+ #twocolumn-left #sidebar .wrapper {
+ margin: 0 10px;
+ }
+
+
+ /* Tweaks for Three-column layout
+ ----------------------------------------------- */
+ #threecolumn #sidebar .wrapper {
+ margin: 0 10px;
+ }
+ #threecolumn #sidebar-alternate .wrapper {
+ margin: 0 10px;
+ }
+ /*
+
+ -- -- -- -- -- -- --
+ COLOR SCHEME: Blueprint
+ -- -- -- -- -- -- --
+
+ */
+
+
+ /* Basic HTML style
+ ----------------------------------------------- */
+ a:link {
+ color: #445AA9;
+ }
+ a:visited {
+ color: #283D88;
+ }
+ body {
+ color: #283769;
+ background: #ECEEF6;
+ }
+ caption {
+ color: inherit;
+ background: #ECEEF6;
+ }
+ hr {
+ color: #C7C7C7;
+ background: #C7C7C7;
+ border-color: #C7C7C7;
+ }
+ table {
+ background: #fff;
+ border-color: #B3BCDC;
+ }
+ th {
+ color: #fff;
+ background: #445AA9;
+ }
+
+
+
+ /* Set the stage with main layout tweaks
+ ----------------------------------------------- */
+ #container {
+ background-color: #F6F7FB;
+ border-color: #6678B8;
+ }
+ #header {
+ color: #445AA9;
+ border-top-color: #6678B8;
+ }
+ .description {
+ color: #445AA9;
+ background: #C9D0E6;
+ }
+ #footer {
+ color: #5064AE;
+ border-bottom-color: #6678B8;
+ }
+
+
+
+ /* Custom font definitions
+ ----------------------------------------------- */
+ h1 {
+ color: #445AA9;
+ }
+ h2 {
+ color: #5064AE;
+ border-bottom-color: #B3BCDC;
+ }
+ h3 {
+ background: #ECEEF6;
+ border-color: #C9D0E6;
+ }
+ h4 {
+ border-bottom-color: #B3BCDC;
+ color: #1A4292;
+ }
+ h5 {
+ border-bottom-color: #C7C7C7;
+ }
+ h6 {
+ color: #5064AE;
+ border-left-color: #B3BCDC;
+ }
+
+
+
+
+
+ /* Sidebar
+ ----------------------------------------------- */
+ #sidebar h3, #sidebar-alternate h3 {
+ color: #5064AE;
+ background: none;
+ }
+ /** END CUSTOM SKIN **/
+ </style><!-- Hack to avoid flash of unstyled content in IE -->
+
+
+ <script> </script></head><body id="onecolumn">
+ <div id="container">
+ <div class="wrapper">
+ <div id="header">
+ <div class="wrapper">
+ <h1 id="page-title"><div id="g_title">USPP(Universal Serial Port Python Library)</div></h1>
+ <div style="clear: both;"></div>
+ <p class="description"></p><div id="g_description"><p>Isaac Barona (ibarona@gmail.com) <br></p></div>
+ <div style="clear: both;"></div>
+ </div>
+ </div>
+
+ <div id="main-content">
+ <div class="wrapper">
+ <div class="content-item"><div id="g_body"><h2>Introduccion</h2><p>La
+librería USPP es un módulo desarrollado en Python para el acceso
+multiplataforma al puerto serie. En el momento, sólo funciona en Linux,
+Windows y MacOS, pero como está escrita completamente en Python&nbsp;
+(no es únicamente un recubrimiento en Python de una librería
+desarrollada&nbsp; en C/C++) espero que pueda ser ampliada para que
+soporte otras plataformas.<i><br><br></i></p><h2>Motivacion</h2><p>&nbsp;A
+mí me gusta mucho hacer pequeños cacharros electrónicos con
+microcontroladores, especialmente aquellos que pueden ser conectados a
+un ordenador para enviar y recibir datos. Hace un par de meses descubrí
+Python y realmente me encantó. Empezé a jugar con él y ví que podía
+utilizarlo para hacer prototipos de protocolos de comunicación entre el
+ordenador y los microcontroladores&nbsp; de manera mucho más fácil y
+rápida que utilizando C (que era el lenguaje que solía utilizar). Al
+mismo tiempo, estaba interesado en poder utilizar los desarrollos bajo
+diferentes arquitecturas. Empezé a buscar en la red módulos de Python
+que accedieran al puerto serie<br>y encontré los siguientes:<br><br>&nbsp;&nbsp; &nbsp;* win32comport_demo que viene junto a la extensión win32.<br>&nbsp;&nbsp; &nbsp;* Módulo win32comm de wheineman@uconect.net.<br>&nbsp;&nbsp; &nbsp;* Sio Module de Roger Rurnham (rburnham@cri-inc.com)<br>&nbsp;&nbsp; &nbsp;* pyxal (Python X10 Abstraction Layer) de Les Smithson <br>&nbsp;&nbsp; &nbsp;&nbsp; (lsmithson@open-networks.co.uk)<br><br>pero
+no eran multiplataforma, eran únicamente un recubrimiento de una
+librería propietaria o eran simples ejemplos de acceso al puerto serie
+bajo una&nbsp; determinada plataforma.<br>Por estas razones, y también
+por supuesto, por aprender más Python, decidí empezar este proyecto.
+Por supuesto, he utilizado los módulos indicados anteriormente como
+referencia para realizar mi librería y por tanto, me creo en la
+obligación de felicitar a sus autores por su excelente trabajo y por
+haberlo compartido con los demás.<br><br>Espero que disfrutes utilizándo el módulo uspp tanto como yo lo&nbsp; he hecho haciéndolo.</p><h2>Características&nbsp;</h2><p>Este módulo tiene las siguientes características destacadas:<br>&nbsp;</p><ul><li>&nbsp;acceso de alto nivel al puerto serie bajo diversas plataformas.</li><li>autodetecta la plataforma en la que se está ejecutando y carga las clases adecuadas para esa plataforma.</li><li>Orientado a objetos.</li><li>Las operaciones sobre el puerto serie tienen la misma semántica que las operaciones sobre objetos de tipo fichero.</li><li>&nbsp;permite utilizar el puerto serie con diferentes velocidades y características.</li><li>permite
+la utilización del puerto bajo dos modos de funcionamiento: RS-232 y
+RS-485 (de momento, sólo RS-232). En modo 485 la comunicación es
+half-duplex y se utiliza la línea RTS para controlar la dirección de la
+transferencia.</li><li>lecturas en modo bloqueante, no bloqueante o con timeout.</li></ul><h2>Prerequisitos</h2><p>Se necesita los siguiente para utilizar la librería:</p><ul><li>Python 2.1 o superior</li><li>En windows los módulos win32</li></ul><h2>Utilización y documentación<br></h2><p>Únicamente
+tienes que importar en tu programa el módulo uspp y automáticamente él
+se encarga de cargar las clases adecuadas para la plataforma en la que
+se está ejecutando el programa.<br><br>Lo primero de todo, tendrás que
+crear un objeto de tipo SerialPort con las características que desees.
+Si no se genera ninguna excepción del tipo SerialPortException, puedes
+utilizar los métodos de lectura y escritura<br>del objeto para leer y escribir en el puerto serie.<br><br>Ejemplo:</p><pre><tt><tt>&gt;&gt;&gt; from uspp import *<br>&gt;&gt;&gt; tty=SerialPort("COM2", 1000, 9600) <br>&gt;&gt;&gt; # Opens COM2 at 9600 bps and with a read timeout of 1 second.<br>&gt;&gt;&gt; tty.write("a") # Writes a character to the COM2 port<br>&gt;&gt;&gt; # Now suppose we receive the string "abc"<br>&gt;&gt;&gt; tty.inWaiting()<br>3<br>&gt;&gt;&gt; tty.read()<br>'a'<br>&gt;&gt;&gt; tty.inWaiting()<br>2<br>&gt;&gt;&gt; tty.read(2)<br>'bc'</tt></tt></pre><pre><tt><tt>&nbsp;</tt></tt></pre><pre><br></pre><p><font face="arial,sans-serif" size="2">La
+documentación de las diferentes clases y métodos que componen el módulo
+puede encontrarse en el string de documentación del módulo uspp.</font></p><h2>Donde funciona<br></h2><p>La
+librería ha sido probada en una máquina con Windows 95, Windows XP y
+Windows 2000 con Python 2.1+ y en un Linux (con el kernel 2.0.34) con
+Python 2.1+.</p><h2>Portado a otras plataformas<br></h2><p></p><p>&nbsp;Si quieres portar la librería a otras plataformas sólo tienes que seguir los siguientes pasos:</p><ul><li>Crear
+un nuevo fichero en python llamado SerialPort_XXX.py en el que
+implementes las mismas clases y métodos públicos que aparecen en los
+módulos SerialPort_win y SerialPort_linux.</li><li>Añadir la nueva plataforma en el fichero uspp.py.<br></li></ul><h2>&nbsp;Licencia&nbsp;</h2><p>Este
+código se libera bajo la licencia "LGPL" que puedes encontrar en&nbsp;
+http://www.gnu.org/copyleft/lesser.html o en el fichero lesser.txt que
+acompaña a la librería. Si utilizas este software estaría muy
+agradecido de saberlo.&nbsp;</p><h2>Autor</h2><p>Esta librería ha sido creada por Isaac Barona Martínez &lt;ibarona@gmail.com&gt;.</p><h2>Versiones</h2><h3>Versión 1.0 - 24/02/2006&nbsp;</h3><p>Mucho
+tiempo después de la versión 0.1 he tenido el tiempo suficiente de
+liberar la versión definitiva de la librería. Esta versión corrige los
+errores encontrados en la versión anterior, funciona en MacOS y ha sido
+ampliada.</p><p>La libería contiene más funciones en las versiones para Linux y MacOS que para Windows.&nbsp;</p><p>Tengo que agradecer a muchas personas su contribución a esta librería, especialmente a:</p><ul><li>Damien Geranton &lt;dgeranton at voila.fr&gt;&nbsp;</li><li>Douglas Jones &lt;dfj23 at drexel.edu&gt;</li><li>J.Grauheding &lt;juergen.grauheding at a-city.de&gt;</li></ul><p>Puedes descargar los ficheros desde aqui:</p><ul><li>Zip file: uspp-0_1.zip</li><li>tar.gz file: uspp-0_1.tar.gz</li></ul><h3>&nbsp;Version 0.1 - 01/09/2001 (Septiembre 2001)</h3><p>&nbsp;</p><p>&nbsp;</p></div></div>
+ <div style="clear: both;"></div>
+ </div>
+ </div>
+
+ <div id="footer"><div class="wrapper">
+ <hr>
+ <p></p><div id="g_footer">&nbsp;</div>
+ <div style="clear: both;"></div>
+ </div></div>
+
+ </div>
+ </div>
+
+
+<div id="extraDiv1"><span></span></div><div id="extraDiv2"><span></span></div>
+<div id="extraDiv3"><span></span></div><div id="extraDiv4"><span></span></div>
+<div id="extraDiv5"><span></span></div><div id="extraDiv6"><span></span></div>
+
+</body></html> \ No newline at end of file
diff --git a/cesar/maximus/python/lib/script.py b/cesar/maximus/python/lib/script.py
new file mode 100644
index 0000000000..b7bb708405
--- /dev/null
+++ b/cesar/maximus/python/lib/script.py
@@ -0,0 +1,173 @@
+# -*- coding:Utf-8 -*-
+
+#import sys
+#sys.path.append('./test')
+#sys.path.append('../test')
+#import startup
+
+
+# MME SCRIPT EXAMPLE
+
+#from mmentryMethod import *
+from framing import *
+#from binascii import * #binascii library is used : crc32(),
+
+#from fcVfFields import *
+#myFcVfFields = FcVfFields()
+
+#myFcVfFields.createFc_AV(myDt_AV=1)
+
+#print "Create mac frame"
+#myMacFrame = MACFrame()
+
+
+mmentryMethod.createCC_CCO_APPOINT_REQ_MMENTRY(myReqType=0x0, myMacAddress=0x414243444546)
+#mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp1 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCC_ASSOC_REQ_MMENTRY(myReqType=0x0, myNid=0x01020304050607, myCcoCapability=0x02, myProxyNetworkingCapability=0x00)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp2 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCC_ASSOC_CNF_MMENTRY(myResult=0, myNid=0x00010203040506, mySnidAccess=0x09, myStaTei=0x81, myLeaseTime=0x000A)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp3 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_UNASSOCIATED_STA_IND_MMENTRY(myNid=0x070809101112, myCcoCapability=0x01)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp4 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_RSP_MMENTRY(myResult=1, myPid=2, myPrn=0x1234)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp5 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_SET_KEY_REQ_MMENTRY(myKeyType=1, myMyNonce=2, myYourNonce=3, myPid=2, myPrn=5, myPmn=6, myCcoCapability=1, myNid=7, myNewEks=8, myNewKey=9)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp6 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_SET_KEY_CNF_MMENTRY(myResult=9, myMyNonce=8, myYourNonce=7, myPid=6, myPrn=5, myPmn=4, myCcoCapability=9)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp7 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_GET_KEY_REQ_MMENTRY(myRequestType=1, myRequestedKeyType=2, myNid=0x1, myMyNonce=4, myPid=5, myPrn=6, myPmn=7, myHashKey=None)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp8 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_GET_KEY_REQ_MMENTRY(myRequestType=1, myRequestedKeyType=4, myNid=3, myMyNonce=4, myPid=5, myPrn=6, myPmn=7, myHashKey=None)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0, myOda=staAAddress, myOsa=maxAddress)
+rsp9 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_GET_KEY_CNF_MMENTRY(myResult=1, myRequestedKeyType=5, myMyNonce=2, myYourNonce=3, myNid=0x11121314151617, myEks=0x04, myPid=0, myPrn=0, myPmn=0, myKey=0x4142434445464748494A4B4C4D4E4F50)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0x0, myOda=staAAddress, myOsa=maxAddress)
+rsp0 = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_GET_KEY_CNF_MMENTRY(myResult=0, myRequestedKeyType=4, myMyNonce=1, myYourNonce=3, myNid=4, myEks=0x0f, myPid=5, myPrn=7, myPmn=6, myKey=0x31323334353637384847464544434241, myHashKey=None)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0x0f, myOda=staAAddress, myOsa=maxAddress)
+rspa = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_MME_ERROR_IND_MMENTRY(myReasonCode=1, myRx_MMV=2, myRx_MMTYPE=4, myInvalidByteOffset=5)
+#mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0x0f, myOda=staAAddress, myOsa=maxAddress)
+rspb = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCC_SET_TEI_MAP_IND_MMENTRY(myMode=1, myNum=0xff, myTei=0x10, myAddr=0x123400, myStatus=2)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0x0f, myOda=staAAddress, myOsa=maxAddress)
+rspc = myMacFields.createMacFrame()
+
+
+mmentryMethod.createCM_SC_JOIN_REQ_MMENTRY(myCcoCapability=0x00)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myPeks=0x0f, myOda=staAAddress, myOsa=maxAddress)
+rspd = myMacFields.createMacFrame()
+
+
+
+
+
+#INTERPRETATION
+
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp1[6:])
+#mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+#mmentryMethod.createCC_CCO_APPOINT_REQ_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+mmentryMethod.createCC_CCO_APPOINT_REQ_MMENTRY(myMmentry=mmEntryData)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp2[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCC_ASSOC_REQ_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp3[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCC_ASSOC_CNF_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp4[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_UNASSOCIATED_STA_IND_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp5[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_RSP_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp6[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_SET_KEY_REQ_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp7[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_SET_KEY_CNF_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp8[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_GET_KEY_REQ_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp9[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_GET_KEY_REQ_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rsp0[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x4142434445464748494A4B4C4D4E4F50, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_GET_KEY_CNF_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rspa[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x31323334353637384847464544434241, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_GET_KEY_CNF_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rspb[6:])
+#mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x31323334353637384847464544434241, myEncryptedFields=mmEntryData)
+#mmentryMethod.createCM_MME_ERROR_IND_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+mmentryMethod.createCM_MME_ERROR_IND_MMENTRY(myMmentry=mmEntryData)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rspc[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x31323334353637384847464544434241, myEncryptedFields=mmEntryData)
+mmentryMethod.createCC_SET_TEI_MAP_IND_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+mmEntryData = myEncapsulatedMme.createEncapsulatedMmEntry(myEncapsulatedMmEntry=rspd[6:])
+mmentryMethod.createCM_ENCRYPTED_PAYLOAD_IND_MMENTRY(myKey=0x31323334353637384847464544434241, myEncryptedFields=mmEntryData)
+mmentryMethod.createCM_SC_JOIN_REQ_MMENTRY(myMmentry=mmentryMethod.mmentryFields.mmOrHlePayloadEncryptedField)
+
+
+print "----- My Ended Coucou -----"
+
+myStaA.remove()
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/cesar/maximus/python/lib/station/test_tx_rx.elf b/cesar/maximus/python/lib/station/test_tx_rx.elf
new file mode 100755
index 0000000000..11b8cdc58f
--- /dev/null
+++ b/cesar/maximus/python/lib/station/test_tx_rx.elf
Binary files differ
diff --git a/cesar/maximus/python/maximus/__init__.py b/cesar/maximus/python/maximus/__init__.py
new file mode 100644
index 0000000000..fffd7b6d7a
--- /dev/null
+++ b/cesar/maximus/python/maximus/__init__.py
@@ -0,0 +1,16 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["channel", "cli", "ethernet", "fsm", "macframe", "mme", "result", "simu", "station", "utils"]
+
+from channel import *
+from cli import *
+from ethernet import *
+from fsm import *
+from macframe import *
+from mme import *
+from result import *
+from simu import *
+from station import *
+from utils import *
diff --git a/cesar/maximus/python/maximus/channel/__init__.py b/cesar/maximus/python/maximus/channel/__init__.py
new file mode 100644
index 0000000000..c7fbe1e2ad
--- /dev/null
+++ b/cesar/maximus/python/maximus/channel/__init__.py
@@ -0,0 +1,7 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["snr"]
+
+from snr import set_snr
diff --git a/cesar/maximus/python/maximus/channel/snr.py b/cesar/maximus/python/maximus/channel/snr.py
new file mode 100644
index 0000000000..4df7672c65
--- /dev/null
+++ b/cesar/maximus/python/maximus/channel/snr.py
@@ -0,0 +1,52 @@
+#! usr/bin/env python
+
+#print __name__
+
+def set_snr(maximus, value=16, file=None, src=None, dst=None, both_directions=False):
+ """Set the SNR.
+ If calling this function without arguments,
+ by default the SNR is set to 16 dB for all transmissions.
+ Non-optional argument:
+ maximus - the Maximus object, already initialized
+ Optional arguments:
+ value - the SNR value in dB
+ file - the SNR description file complete path and name
+ src - the transmitting station
+ dst - the destination station
+ both_directions - a boolean specifying if the SNR is the same in both directions (from src to dst and from dst to src)
+ """
+
+ # Source and destination stations can be Python STA objects or C++ Sta objects.
+ # In case of Python STA objects,
+ # the C++ Sta object has to be extracted using the get() method of the STA class.
+ try:
+ src = src.get()
+ except:
+ pass
+ try:
+ dst = dst.get()
+ except:
+ pass
+
+ # SNR can be set via a value in dB or via a description file.
+ if file is None:
+ snr = value
+ else:
+ snr = file
+
+ # Depending on function arguments, call the appropriate Maximus interface function:
+ # set_snr()
+ # set_snr_from_src()
+ # set_snr_to_dst()
+ # set_snr_from_src_to_dst()
+
+ if src is None:
+ if dst is None:
+ maximus.set_snr(snr)
+ else:
+ maximus.set_snr_to_dst(snr, dst, both_directions)
+ else:
+ if dst is None:
+ maximus.set_snr_from_src(snr, src, both_directions)
+ else:
+ maximus.set_snr_from_src_to_dst(snr, src, dst, both_directions)
diff --git a/cesar/maximus/python/maximus/cli/__init__.py b/cesar/maximus/python/maximus/cli/__init__.py
new file mode 100644
index 0000000000..730e8c685d
--- /dev/null
+++ b/cesar/maximus/python/maximus/cli/__init__.py
@@ -0,0 +1,5 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = []
diff --git a/cesar/maximus/python/maximus/ethernet/__init__.py b/cesar/maximus/python/maximus/ethernet/__init__.py
new file mode 100644
index 0000000000..fa21730e37
--- /dev/null
+++ b/cesar/maximus/python/maximus/ethernet/__init__.py
@@ -0,0 +1,10 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["buffer", "create", "eth", "scapy"]
+
+from buffer import alloc_data_buffer, alloc_mme_buffer, alloc_interface_buffer, realloc_buffer, get_buffer_dict
+from eth import Eth
+from scapy import *
+from maximus.macframe.msdu import MSDU_TYPES
diff --git a/cesar/maximus/python/maximus/ethernet/buffer.py b/cesar/maximus/python/maximus/ethernet/buffer.py
new file mode 100644
index 0000000000..a00b4c39e9
--- /dev/null
+++ b/cesar/maximus/python/maximus/ethernet/buffer.py
@@ -0,0 +1,189 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.macframe.msdu import MSDU_TYPES, MSDU
+from maximus.utils.exception import Error, OutOfRangeError
+from maximus.utils.format import *
+
+# Constants to check arguments validity
+MAX_VALUE_OF_BUFFER_NB = MAX_VALUE_OF_U32
+SIZE_OF_BUFFER_ID = SIZE_OF_U32
+
+class Buffer(MSDU):
+ """The Buffer object is composed of the 6 following fields:
+ buffer_id - the current buffer ID
+ buffer_dict - the list of current allocated buffers (ID and type)
+ buffer_realloc - indicates if buffer reallocation is automatic
+ maximus - the Maximus object
+ type - type of buffer
+ buffer_nb - number of buffers to allocate
+ """
+ # Static attributes of the class
+ buffer_id = 0
+ buffer_dict = {}
+ buffer_realloc = True
+ __maximus = None
+
+ def __init__(self, type, buffer_nb=1, maximus=None):
+ """Initialize the Buffer with following attributes:
+ type - a Python string
+ buffer_nb - a Python integer
+ maximus - the Maximus object
+ """
+ self.set_type(type)
+ self.set_buffer_nb(buffer_nb)
+ self.__set_maximus(maximus)
+
+ def set_type(self, type):
+ """This function sets the Buffer object type.
+ The Buffer type can be a Python integer (u8)
+ or a Python string equals to 'ETHERNET_TYPE_DATA_BUFFER_ADD',
+ 'ETHERNET_TYPE_MME_BUFFER_ADD',
+ 'ETHERNET_TYPE_INTERFACE_BUFFER_ADD',
+ or 'ETHERNET_TYPE_BUFFER_RELEASED'.
+ """
+ self.__type = 0
+ for i, j in enumerate(MSDU_TYPES):
+ if type == i or type == j:
+ self.__type = i
+ if self.__type is None:
+ raise OutOfRangeError("Buffer type")
+
+ def set_buffer_nb(self, buffer_nb):
+ """This function sets the number of buffers to allocate.
+ The number of buffers must be a Python integer (u32).
+ """
+ self.__buffer_nb = 0
+ if type(buffer_nb) is not int or buffer_nb <= 0 or buffer_nb > MAX_VALUE_OF_BUFFER_NB:
+ raise OutOfRangeError("Number of buffers")
+ else:
+ self.__buffer_nb = buffer_nb
+
+ def set_buffer_realloc(self, auto):
+ """This function enables or disables the automatic buffer allocation.
+ Auto must be a Python boolean.
+ """
+ if type(auto) is not bool:
+ raise TypeError("Auto")
+ else:
+ self.__class__.buffer_realloc = auto
+
+ def __set_maximus(self, maximus):
+ """This function sets the Maximus object.
+ """
+ if maximus is not None and self.__class__.__maximus is None:
+ self.__class__.__maximus = maximus
+
+ def __inc_buffer_id(self):
+ """This function increments the buffer ID (static attribute of the class).
+ """
+ self.__class__.buffer_id += 1
+
+ def __add_buffer(self, id, type):
+ """This function adds a buffer into the buffer dictionary (static attribute of the class).
+ """
+ self.__class__.buffer_dict[id] = type
+
+ def __remove_buffer(self, id):
+ """This function removes a buffer from the buffer dictionary (static attribute of the class).
+ """
+ del self.__class__.buffer_dict[id]
+
+ def realloc(self, station_id, payload):
+ """If requested by user, this function allocates a new buffer to replace released buffer.
+ """
+ from maximus.simu.rx import recv
+ if self.get_buffer_realloc():
+ if len(payload) != SIZE_OF_BUFFER_ID:
+ raise Error('Buffer ID length')
+ else:
+ buffer = Buffer(type=self.__class__.buffer_dict[hptoh32(payload)], maximus=self.__get_maximus())
+ # Request to Maximus to send the MSDU asynchronously
+ while not self.__get_maximus().is_station_idle(station_id):
+ self.__get_maximus().process()
+ self.__get_maximus().send_msdu(buffer, station_id)
+
+ def set_msdu_attr(self, payload):
+ """This function sets the MSDU attributes from the received Ethernet Frame.
+ """
+ if len(payload) != SIZE_OF_BUFFER_ID:
+ raise Error('Buffer ID length')
+ else:
+ self.__remove_buffer(hptoh32(payload))
+
+ def get(self):
+ """This function returns the Buffer object into a string composed of the 2 following fields:
+ number of buffers to allocate (u32)
+ ID of each buffer to allocate (u32)
+ """
+ buffer = htohp32(self.get_buffer_nb())
+ for n in range(0, self.get_buffer_nb()):
+ self.__inc_buffer_id()
+ buffer += htohp32(self.get_buffer_id())
+ for i, j in enumerate(MSDU_TYPES):
+ if self.get_ether_type() == i:
+ self.__add_buffer(self.get_buffer_id(), j)
+ return buffer
+
+ def get_ether_type(self):
+ """This function returns the Buffer object type into a Python integer (u8).
+ """
+ return self.__type # 3, 4, 5 or 6
+
+ def get_type(self):
+ """This function returns the Buffer object type into a Python string.
+ """
+ return MSDU_TYPES[self.get_ether_type()] # 'ETHERNET_TYPE_DATA_BUFFER_ADD',
+ # 'ETHERNET_TYPE_MME_BUFFER_ADD',
+ # 'ETHERNET_TYPE_INTERFACE_BUFFER_ADD',
+ # or 'ETHERNET_TYPE_BUFFER_RELEASED'
+
+ def get_buffer_nb(self):
+ """This function gets the number of buffers to allocate.
+ The number of buffers is a Python integer (u32).
+ """
+ return self.__buffer_nb
+
+ def get_buffer_id(self):
+ """This function returns the current buffer ID.
+ """
+ return self.__class__.buffer_id
+
+ def get_buffer_dict(self):
+ """This function returns the current buffer dictionary.
+ """
+ return self.__class__.buffer_dict
+
+ def get_buffer_realloc(self):
+ """This function gets if the current buffer reallocation is enabled or disabled.
+ """
+ return self.__class__.buffer_realloc
+
+ def __get_maximus(self):
+ """This function gets the Maximus object.
+ """
+ if self.__class__.__maximus is None:
+ raise Error("Maximus object not set")
+ return self.__class__.__maximus
+
+
+def alloc_data_buffer(maximus, station, buffer_nb=1):
+ buffer = Buffer(type='ETHERNET_TYPE_DATA_BUFFER_ADD', buffer_nb=buffer_nb, maximus=maximus)
+ buffer.sendnrecv(maximus, station, count=0) # recv(maximus, count=0) to set creation functions
+
+def alloc_mme_buffer(maximus, station, buffer_nb=1):
+ buffer = Buffer(type='ETHERNET_TYPE_MME_BUFFER_ADD', buffer_nb=buffer_nb, maximus=maximus)
+ buffer.sendnrecv(maximus, station, count=0) # recv(maximus, count=0) to set creation functions
+
+def alloc_interface_buffer(maximus, station, buffer_nb=1):
+ buffer = Buffer(type='ETHERNET_TYPE_INTERFACE_BUFFER_ADD', buffer_nb=buffer_nb, maximus=maximus)
+ buffer.sendnrecv(maximus, station, count=0) # recv(maximus, count=0) to set creation functions
+
+def realloc_buffer(auto):
+ buffer = Buffer('ETHERNET_TYPE_NONE')
+ buffer.set_buffer_realloc(auto)
+
+def get_buffer_dict():
+ buffer = Buffer('ETHERNET_TYPE_NONE')
+ return buffer.get_buffer_dict()
diff --git a/cesar/maximus/python/maximus/ethernet/create.py b/cesar/maximus/python/maximus/ethernet/create.py
new file mode 100644
index 0000000000..09c16d9152
--- /dev/null
+++ b/cesar/maximus/python/maximus/ethernet/create.py
@@ -0,0 +1,22 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.ethernet.buffer import Buffer
+from maximus.ethernet.eth import Eth
+from maximus.ethernet.sniffer import Sniffer
+
+def create_eth():
+ """This function creates and returns a new Eth object.
+ """
+ return Eth()
+
+def create_buffer():
+ """This function creates and returns a new Buffer object.
+ """
+ return Buffer('ETHERNET_TYPE_BUFFER_RELEASED')
+
+def create_sniffer(way, encryption, sniffer_type):
+ """This function creates and returns a new Sniffer object.
+ """
+ return Sniffer(way, encryption, sniffer_type)
diff --git a/cesar/maximus/python/maximus/ethernet/eth.py b/cesar/maximus/python/maximus/ethernet/eth.py
new file mode 100644
index 0000000000..5b06f64f26
--- /dev/null
+++ b/cesar/maximus/python/maximus/ethernet/eth.py
@@ -0,0 +1,109 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.ethernet.scapy import *
+from maximus.macframe.msdu import MIN_SIZE_OF_MSDU, MSDU_TYPES, MSDU
+from maximus.utils.exception import Error, OutOfRangeError
+from maximus.utils.format import *
+from struct import pack, unpack
+
+# Constants to check arguments validity
+SIZE_OF_DST = SIZE_OF_U48 # in octets
+SIZE_OF_SRC = SIZE_OF_DST # in octets
+SIZE_OF_VLANTAG = SIZE_OF_U32 # in octets
+MIN_VALUE_OF_VLANTAG = 0x81000000
+MAX_VALUE_OF_VLANTAG = 0x8100FFFF
+SIZE_OF_TYPE = SIZE_OF_U16 # in octets
+MIN_SIZE_OF_HEADER = SIZE_OF_DST + SIZE_OF_SRC + SIZE_OF_TYPE # in octets
+MAX_SIZE_OF_HEADER = MIN_SIZE_OF_HEADER + SIZE_OF_VLANTAG # in octets
+
+#class VLANTag(Field):
+# def __init__(self, name):
+# Field.__init__(self, name, 0x00000000, 'I')
+
+class Eth(MSDU, Packet):
+ name = "Eth"
+ aliastypes = [ Ether ]
+ #fields_desc = [DestMACField("dst"), SourceMACField("src"), VLANTag("vlantag"), XShortEnumField("type", 0x0000, ETHER_TYPES)]
+ fields_desc = [DestMACField("dst"), SourceMACField("src"), XShortEnumField("type", 0x0000, ETHER_TYPES)]
+
+ def set_msdu_attr(self, payload):
+ """Set the Eth attributes from the received Ethernet Frame.
+ """
+ if len(payload) < MIN_SIZE_OF_HEADER:
+ raise Error('Ethernet Frame length')
+
+ # Set Eth Header: dst, src, vlantag (optional), type
+ #
+
+ # Set dst
+ begin = 0
+ end = SIZE_OF_DST
+ address = hex(ntoh48(payload[begin:end])).strip('0x').strip('L')
+ dst = ''
+ for i in range (0, len(address), 2):
+ dst += address[i:i+2]
+ if i < len(address)-2:
+ dst += ':'
+ self.dst = dst.lower()
+
+ # Set src
+ begin = end
+ end += SIZE_OF_SRC
+ address = hex(ntoh48(payload[begin:end])).strip('0x').strip('L')
+ src = ''
+ for i in range (0, len(address), 2):
+ src += address[i:i+2]
+ if i < len(address)-2:
+ src += ':'
+ self.src = src.lower()
+
+ # Check vlantag
+ begin = end
+ if ntoh32(payload[begin:end + SIZE_OF_VLANTAG]) <= MAX_VALUE_OF_VLANTAG\
+ and ntoh32(payload[begin:end + SIZE_OF_VLANTAG]) >= MIN_VALUE_OF_VLANTAG:
+ # Set vlantag
+ end += SIZE_OF_VLANTAG
+ self.vlantag = ntoh32(payload[begin:end])
+
+ # Set type
+ begin = end
+ end += SIZE_OF_TYPE
+ self.type = ntoh16(payload[begin:end])
+
+ # Set Eth Payload
+ self.payload = payload[end:]
+
+ def get(self):
+ """This function returns the Ethernet frame into a string.
+ """
+ eth = str(self)
+
+ # Check vlantag
+ try:
+ if type(self.vlantag) is int or type(self.vlantag) is long:
+ if self.vlantag <= MAX_VALUE_OF_VLANTAG and self.vlantag >= MIN_VALUE_OF_VLANTAG:
+ eth = eth[:SIZE_OF_DST + SIZE_OF_SRC] + hton32(self.vlantag) + eth[SIZE_OF_DST + SIZE_OF_SRC:]
+ else:
+ raise OutOfRangeError("vlantag")
+ else:
+ raise TypeError("vlantag")
+ except AttributeError:
+ pass
+
+ return eth + self.pad(MIN_SIZE_OF_MSDU - len(eth))
+
+ def get_ether_type(self):
+ """This function returns the Ethernet Frame object type into a Python integer (uint8_t).
+ """
+ type = 0
+ for i, j in enumerate(MSDU_TYPES):
+ if j == self.get_type():
+ type = i
+ return type # 1
+
+ def get_type(self):
+ """This function returns the Ethernet Frame object type into a Python string.
+ """
+ return MSDU_TYPES[1] # 'ETHERNET_TYPE_DATA'
diff --git a/cesar/maximus/python/maximus/ethernet/scapy.py b/cesar/maximus/python/maximus/ethernet/scapy.py
new file mode 100644
index 0000000000..5c1641fde7
--- /dev/null
+++ b/cesar/maximus/python/maximus/ethernet/scapy.py
@@ -0,0 +1,13244 @@
+#! /usr/bin/env python
+
+#############################################################################
+## ##
+## scapy.py --- Interactive packet manipulation tool ##
+## see http://www.secdev.org/projects/scapy/ ##
+## for more informations ##
+## ##
+## Copyright (C) 2003 Philippe Biondi <phil@secdev.org> ##
+## ##
+## This program is free software; you can redistribute it and/or modify it ##
+## under the terms of the GNU General Public License version 2 as ##
+## published by the Free Software Foundation; version 2. ##
+## ##
+## 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. ##
+## ##
+#############################################################################
+
+
+from __future__ import generators
+import os
+
+BASE_VERSION = "1.1.1"
+
+HG_NODE = "$Node$"
+REVISION = "$Revision$"
+
+VERSION = "v%s / %s" % (BASE_VERSION, (REVISION+"--")[11:23])
+
+DEFAULT_CONFIG_FILE = os.path.join(os.environ["HOME"], ".scapy_startup.py")
+
+try:
+ os.stat(DEFAULT_CONFIG_FILE)
+except OSError:
+ DEFAULT_CONFIG_FILE = None
+
+def usage():
+ print """Usage: scapy.py [-s sessionfile] [-c new_startup_file] [-C]
+ -C: do not read startup file"""
+ sys.exit(0)
+
+
+#############################
+##### Logging subsystem #####
+#############################
+
+class Scapy_Exception(Exception):
+ pass
+
+import logging,traceback,time
+
+class ScapyFreqFilter(logging.Filter):
+ def __init__(self):
+ logging.Filter.__init__(self)
+ self.warning_table = {}
+ def filter(self, record):
+ wt = conf.warning_threshold
+ if wt > 0:
+ stk = traceback.extract_stack()
+ caller=None
+ for f,l,n,c in stk:
+ if n == 'warning':
+ break
+ caller = l
+ tm,nb = self.warning_table.get(caller, (0,0))
+ ltm = time.time()
+ if ltm-tm > wt:
+ tm = ltm
+ nb = 0
+ else:
+ if nb < 2:
+ nb += 1
+ if nb == 2:
+ record.msg = "more "+record.msg
+ else:
+ return 0
+ self.warning_table[caller] = (tm,nb)
+ return 1
+
+log_scapy = logging.getLogger("scapy")
+console_handler = logging.StreamHandler()
+console_handler.setFormatter(logging.Formatter("%(levelname)s: %(message)s"))
+log_scapy.addHandler(console_handler)
+log_runtime = logging.getLogger("scapy.runtime") # logs at runtime
+log_runtime.addFilter(ScapyFreqFilter())
+log_interactive = logging.getLogger("scapy.interactive") # logs in interactive functions
+log_loading = logging.getLogger("scapy.loading") # logs when loading scapy
+
+if __name__ == "__main__":
+ log_scapy.setLevel(1)
+
+
+##################
+##### Module #####
+##################
+
+import socket, sys, getopt, string, struct, random, code
+import cPickle, copy, types, gzip, base64, re, zlib, array
+from sets import Set
+from select import select
+from glob import glob
+from fcntl import ioctl
+import itertools
+import fcntl
+import warnings
+warnings.filterwarnings("ignore","tempnam",RuntimeWarning, __name__)
+
+
+try:
+ import Gnuplot
+ GNUPLOT=1
+except ImportError:
+ log_loading.info("did not find python gnuplot wrapper . Won't be able to plot")
+ GNUPLOT=0
+
+try:
+ import pyx
+ PYX=1
+except ImportError:
+ log_loading.info("Can't import PyX. Won't be able to use psdump() or pdfdump()")
+ PYX=0
+
+
+LINUX=sys.platform.startswith("linux")
+OPENBSD=sys.platform.startswith("openbsd")
+FREEBSD=sys.platform.startswith("freebsd")
+DARWIN=sys.platform.startswith("darwin")
+BIG_ENDIAN= struct.pack("H",1) == "\x00\x01"
+X86_64 = (os.uname()[4] == 'x86_64')
+SOLARIS=sys.platform.startswith("sunos")
+
+
+if LINUX:
+ DNET=PCAP=0
+else:
+ DNET=PCAP=1
+
+
+if PCAP:
+ try:
+ import pcap
+ PCAP = 1
+ except ImportError:
+ if LINUX:
+ log_loading.warning("did not find pcap module. Fallback to linux primitives")
+ PCAP = 0
+ else:
+ if __name__ == "__main__":
+ log_loading.error("did not find pcap module")
+ raise SystemExit
+ else:
+ raise
+
+if DNET:
+ try:
+ import dnet
+ DNET = 1
+ except ImportError:
+ if LINUX:
+ log_loading.warning("did not find dnet module. Fallback to linux primitives")
+ DNET = 0
+ else:
+ if __name__ == "__main__":
+ log_loading.error("did not find dnet module")
+ raise SystemExit
+ else:
+ raise
+
+if not PCAP:
+ f = os.popen("tcpdump -V 2> /dev/null")
+ if f.close() >> 8 == 0x7f:
+ log_loading.warning("Failed to execute tcpdump. Check it is installed and in the PATH")
+ TCPDUMP=0
+ else:
+ TCPDUMP=1
+ del(f)
+
+
+
+try:
+ from Crypto.Cipher import ARC4
+except ImportError:
+ log_loading.info("Can't find Crypto python lib. Won't be able to decrypt WEP")
+
+
+# Workarround bug 643005 : https://sourceforge.net/tracker/?func=detail&atid=105470&aid=643005&group_id=5470
+try:
+ socket.inet_aton("255.255.255.255")
+except socket.error:
+ def inet_aton(x):
+ if x == "255.255.255.255":
+ return "\xff"*4
+ else:
+ return socket.inet_aton(x)
+else:
+ inet_aton = socket.inet_aton
+
+inet_ntoa = socket.inet_ntoa
+try:
+ inet_ntop = socket.inet_ntop
+ inet_pton = socket.inet_pton
+except AttributeError:
+ log_loading.info("inet_ntop/pton functions not found. Python IPv6 support not present")
+
+
+if SOLARIS:
+ # GRE is missing on Solaris
+ socket.IPPROTO_GRE = 47
+
+###############################
+## Direct Access dictionnary ##
+###############################
+
+def fixname(x):
+ if x and x[0] in "0123456789":
+ x = "n_"+x
+ return x.translate("________________________________________________0123456789_______ABCDEFGHIJKLMNOPQRSTUVWXYZ______abcdefghijklmnopqrstuvwxyz_____________________________________________________________________________________________________________________________________")
+
+
+class DADict_Exception(Scapy_Exception):
+ pass
+
+class DADict:
+ def __init__(self, _name="DADict", **kargs):
+ self._name=_name
+ self.__dict__.update(kargs)
+ def fixname(self,val):
+ return fixname(val)
+ def __contains__(self, val):
+ return val in self.__dict__
+ def __getitem__(self, attr):
+ return getattr(self, attr)
+ def __setitem__(self, attr, val):
+ return setattr(self, self.fixname(attr), val)
+ def __iter__(self):
+ return iter(map(lambda (x,y):y,filter(lambda (x,y):x and x[0]!="_", self.__dict__.items())))
+ def _show(self):
+ for k in self.__dict__.keys():
+ if k and k[0] != "_":
+ print "%10s = %r" % (k,getattr(self,k))
+ def __repr__(self):
+ return "<%s/ %s>" % (self._name," ".join(filter(lambda x:x and x[0]!="_",self.__dict__.keys())))
+
+ def _branch(self, br, uniq=0):
+ if uniq and br._name in self:
+ raise DADict_Exception("DADict: [%s] already branched in [%s]" % (br._name, self._name))
+ self[br._name] = br
+
+ def _my_find(self, *args, **kargs):
+ if args and self._name not in args:
+ return False
+ for k in kargs:
+ if k not in self or self[k] != kargs[k]:
+ return False
+ return True
+
+ def _find(self, *args, **kargs):
+ return self._recurs_find((), *args, **kargs)
+ def _recurs_find(self, path, *args, **kargs):
+ if self in path:
+ return None
+ if self._my_find(*args, **kargs):
+ return self
+ for o in self:
+ if isinstance(o, DADict):
+ p = o._recurs_find(path+(self,), *args, **kargs)
+ if p is not None:
+ return p
+ return None
+ def _find_all(self, *args, **kargs):
+ return self._recurs_find_all((), *args, **kargs)
+ def _recurs_find_all(self, path, *args, **kargs):
+ r = []
+ if self in path:
+ return r
+ if self._my_find(*args, **kargs):
+ r.append(self)
+ for o in self:
+ if isinstance(o, DADict):
+ p = o._recurs_find_all(path+(self,), *args, **kargs)
+ r += p
+ return r
+ def keys(self):
+ return filter(lambda x:x and x[0]!="_", self.__dict__.keys())
+
+
+
+############
+## Consts ##
+############
+
+ETHER_ANY = "\x00"*6
+ETHER_BROADCAST = "\xff"*6
+
+ETH_P_ALL = 3
+ETH_P_IP = 0x800
+ETH_P_ARP = 0x806
+
+# From net/if_arp.h
+ARPHDR_ETHER = 1
+ARPHDR_METRICOM = 23
+ARPHDR_PPP = 512
+ARPHDR_LOOPBACK = 772
+ARPHDR_TUN = 65534
+
+# From bits/ioctls.h
+SIOCGIFHWADDR = 0x8927 # Get hardware address
+SIOCGIFADDR = 0x8915 # get PA address
+SIOCGIFNETMASK = 0x891b # get network PA mask
+SIOCGIFNAME = 0x8910 # get iface name
+SIOCSIFLINK = 0x8911 # set iface channel
+SIOCGIFCONF = 0x8912 # get iface list
+SIOCGIFFLAGS = 0x8913 # get flags
+SIOCSIFFLAGS = 0x8914 # set flags
+SIOCGIFINDEX = 0x8933 # name -> if_index mapping
+SIOCGIFCOUNT = 0x8938 # get number of devices
+
+
+# From if.h
+IFF_UP = 0x1 # Interface is up.
+IFF_BROADCAST = 0x2 # Broadcast address valid.
+IFF_DEBUG = 0x4 # Turn on debugging.
+IFF_LOOPBACK = 0x8 # Is a loopback net.
+IFF_POINTOPOINT = 0x10 # Interface is point-to-point link.
+IFF_NOTRAILERS = 0x20 # Avoid use of trailers.
+IFF_RUNNING = 0x40 # Resources allocated.
+IFF_NOARP = 0x80 # No address resolution protocol.
+IFF_PROMISC = 0x100 # Receive all packets.
+
+
+
+# From netpacket/packet.h
+PACKET_ADD_MEMBERSHIP = 1
+PACKET_DROP_MEMBERSHIP = 2
+PACKET_RECV_OUTPUT = 3
+PACKET_RX_RING = 5
+PACKET_STATISTICS = 6
+PACKET_MR_MULTICAST = 0
+PACKET_MR_PROMISC = 1
+PACKET_MR_ALLMULTI = 2
+
+
+# From bits/socket.h
+SOL_PACKET = 263
+# From asm/socket.h
+SO_ATTACH_FILTER = 26
+SOL_SOCKET = 1
+
+# From net/route.h
+RTF_UP = 0x0001 # Route usable
+RTF_REJECT = 0x0200
+
+# From BSD net/bpf.h
+#BIOCIMMEDIATE=0x80044270
+BIOCIMMEDIATE=-2147204496
+
+MTU = 1600
+
+
+# file parsing to get some values :
+
+def load_protocols(filename):
+ spaces = re.compile("[ \t]+|\n")
+ dct = DADict(_name=filename)
+ try:
+ for l in open(filename):
+ try:
+ shrp = l.find("#")
+ if shrp >= 0:
+ l = l[:shrp]
+ l = l.strip()
+ if not l:
+ continue
+ lt = tuple(re.split(spaces, l))
+ if len(lt) < 2 or not lt[0]:
+ continue
+ dct[lt[0]] = int(lt[1])
+ except Exception,e:
+ log_loading.info("Couldn't parse file [%s]: line [%r] (%s)" % (filename,l,e))
+ except IOError:
+ log_loading.info("Can't open /etc/protocols file")
+ return dct
+
+IP_PROTOS=load_protocols("/etc/protocols")
+
+def load_ethertypes(filename):
+ spaces = re.compile("[ \t]+|\n")
+ dct = DADict(_name=filename)
+ try:
+ f=open(filename)
+ for l in f:
+ try:
+ shrp = l.find("#")
+ if shrp >= 0:
+ l = l[:shrp]
+ l = l.strip()
+ if not l:
+ continue
+ lt = tuple(re.split(spaces, l))
+ if len(lt) < 2 or not lt[0]:
+ continue
+ dct[lt[0]] = int(lt[1], 16)
+ except Exception,e:
+ log_loading.info("Couldn't parse file [%s]: line [%r] (%s)" % (filename,l,e))
+ f.close()
+ except IOError,msg:
+ pass
+ return dct
+
+ETHER_TYPES=load_ethertypes("/etc/ethertypes")
+
+def load_services(filename):
+ spaces = re.compile("[ \t]+|\n")
+ tdct=DADict(_name="%s-tcp"%filename)
+ udct=DADict(_name="%s-udp"%filename)
+ try:
+ f=open(filename)
+ for l in f:
+ try:
+ shrp = l.find("#")
+ if shrp >= 0:
+ l = l[:shrp]
+ l = l.strip()
+ if not l:
+ continue
+ lt = tuple(re.split(spaces, l))
+ if len(lt) < 2 or not lt[0]:
+ continue
+ if lt[1].endswith("/tcp"):
+ tdct[lt[0]] = int(lt[1].split('/')[0])
+ elif lt[1].endswith("/udp"):
+ udct[lt[0]] = int(lt[1].split('/')[0])
+ except Exception,e:
+ log_loading.warning("Couldn't file [%s]: line [%r] (%s)" % (filename,l,e))
+ f.close()
+ except IOError:
+ log_loading.info("Can't open /etc/services file")
+ return tdct,udct
+
+TCP_SERVICES,UDP_SERVICES=load_services("/etc/services")
+
+class ManufDA(DADict):
+ def fixname(self, val):
+ return val
+ def _get_manuf_couple(self, mac):
+ oui = ":".join(mac.split(":")[:3]).upper()
+ return self.__dict__.get(oui,(mac,mac))
+ def _get_manuf(self, mac):
+ return self._get_manuf_couple(mac)[1]
+ def _get_short_manuf(self, mac):
+ return self._get_manuf_couple(mac)[0]
+ def _resolve_MAC(self, mac):
+ oui = ":".join(mac.split(":")[:3]).upper()
+ if oui in self:
+ return ":".join([self[oui][0]]+ mac.split(":")[3:])
+ return mac
+
+
+
+
+def load_manuf(filename):
+ try:
+ manufdb=ManufDA(_name=filename)
+ for l in open(filename):
+ try:
+ l = l.strip()
+ if not l or l.startswith("#"):
+ continue
+ oui,shrt=l.split()[:2]
+ i = l.find("#")
+ if i < 0:
+ lng=shrt
+ else:
+ lng = l[i+2:]
+ manufdb[oui] = shrt,lng
+ except Exception,e:
+ log_loading.warning("Couldn't parse one line from [%s] [%r] (%s)" % (filename, l, e))
+ except IOError:
+ #log_loading.warning("Couldn't open [%s] file" % filename)
+ pass
+ return manufdb
+
+MANUFDB = load_manuf("/usr/share/wireshark/wireshark/manuf")
+
+
+
+
+###########
+## Tools ##
+###########
+
+def sane_color(x):
+ r=""
+ for i in x:
+ j = ord(i)
+ if (j < 32) or (j >= 127):
+ r=r+conf.color_theme.not_printable(".")
+ else:
+ r=r+i
+ return r
+
+def sane(x):
+ r=""
+ for i in x:
+ j = ord(i)
+ if (j < 32) or (j >= 127):
+ r=r+"."
+ else:
+ r=r+i
+ return r
+
+def lhex(x):
+ if type(x) in (int,long):
+ return hex(x)
+ elif type(x) is tuple:
+ return "(%s)" % ", ".join(map(lhex, x))
+ elif type(x) is list:
+ return "[%s]" % ", ".join(map(lhex, x))
+ else:
+ return x
+
+def hexdump(x):
+ x=str(x)
+ l = len(x)
+ i = 0
+ while i < l:
+ print "%04x " % i,
+ for j in range(16):
+ if i+j < l:
+ print "%02X" % ord(x[i+j]),
+ else:
+ print " ",
+ if j%16 == 7:
+ print "",
+ print " ",
+ print sane_color(x[i:i+16])
+ i += 16
+
+def linehexdump(x, onlyasc=0, onlyhex=0):
+ x = str(x)
+ l = len(x)
+ if not onlyasc:
+ for i in range(l):
+ print "%02X" % ord(x[i]),
+ print "",
+ if not onlyhex:
+ print sane_color(x)
+
+def chexdump(x):
+ x=str(x)
+ print ", ".join(map(lambda x: "%#04x"%ord(x), x))
+
+def hexstr(x, onlyasc=0, onlyhex=0):
+ s = []
+ if not onlyasc:
+ s.append(" ".join(map(lambda x:"%02x"%ord(x), x)))
+ if not onlyhex:
+ s.append(sane(x))
+ return " ".join(s)
+
+
+def hexdiff(x,y):
+ x=str(x)[::-1]
+ y=str(y)[::-1]
+ SUBST=1
+ INSERT=1
+ d={}
+ d[-1,-1] = 0,(-1,-1)
+ for j in range(len(y)):
+ d[-1,j] = d[-1,j-1][0]+INSERT, (-1,j-1)
+ for i in range(len(x)):
+ d[i,-1] = d[i-1,-1][0]+INSERT, (i-1,-1)
+
+ for j in range(len(y)):
+ for i in range(len(x)):
+ d[i,j] = min( ( d[i-1,j-1][0]+SUBST*(x[i] != y[j]), (i-1,j-1) ),
+ ( d[i-1,j][0]+INSERT, (i-1,j) ),
+ ( d[i,j-1][0]+INSERT, (i,j-1) ) )
+
+
+ backtrackx = []
+ backtracky = []
+ i=len(x)-1
+ j=len(y)-1
+ while not (i == j == -1):
+ i2,j2 = d[i,j][1]
+ backtrackx.append(x[i2+1:i+1])
+ backtracky.append(y[j2+1:j+1])
+ i,j = i2,j2
+
+
+
+ x = y = i = 0
+ colorize = { 0: lambda x:x,
+ -1: conf.color_theme.left,
+ 1: conf.color_theme.right }
+
+ dox=1
+ doy=0
+ l = len(backtrackx)
+ while i < l:
+ separate=0
+ linex = backtrackx[i:i+16]
+ liney = backtracky[i:i+16]
+ xx = sum(len(k) for k in linex)
+ yy = sum(len(k) for k in liney)
+ if dox and not xx:
+ dox = 0
+ doy = 1
+ if dox and linex == liney:
+ doy=1
+
+ if dox:
+ xd = y
+ j = 0
+ while not linex[j]:
+ j += 1
+ xd -= 1
+ print colorize[doy-dox]("%04x" % xd),
+ x += xx
+ line=linex
+ else:
+ print " ",
+ if doy:
+ yd = y
+ j = 0
+ while not liney[j]:
+ j += 1
+ yd -= 1
+ print colorize[doy-dox]("%04x" % yd),
+ y += yy
+ line=liney
+ else:
+ print " ",
+
+ print " ",
+
+ cl = ""
+ for j in range(16):
+ if i+j < l:
+ if line[j]:
+ col = colorize[(linex[j]!=liney[j])*(doy-dox)]
+ print col("%02X" % ord(line[j])),
+ if linex[j]==liney[j]:
+ cl += sane_color(line[j])
+ else:
+ cl += col(sane(line[j]))
+ else:
+ print " ",
+ cl += " "
+ else:
+ print " ",
+ if j == 7:
+ print "",
+
+
+ print " ",cl
+
+ if doy or not yy:
+ doy=0
+ dox=1
+ i += 16
+ else:
+ if yy:
+ dox=0
+ doy=1
+ else:
+ i += 16
+
+
+crc32 = zlib.crc32
+
+if BIG_ENDIAN:
+ def checksum(pkt):
+ if len(pkt) % 2 == 1:
+ pkt += "\0"
+ s = sum(array.array("H", pkt))
+ s = (s >> 16) + (s & 0xffff)
+ s += s >> 16
+ s = ~s
+ return s & 0xffff
+else:
+ def checksum(pkt):
+ if len(pkt) % 2 == 1:
+ pkt += "\0"
+ s = sum(array.array("H", pkt))
+ s = (s >> 16) + (s & 0xffff)
+ s += s >> 16
+ s = ~s
+ return (((s>>8)&0xff)|s<<8) & 0xffff
+
+def warning(x):
+ log_runtime.warning(x)
+
+def mac2str(mac):
+ return "".join(map(lambda x: chr(int(x,16)), mac.split(":")))
+
+def str2mac(s):
+ return ("%02x:"*6)[:-1] % tuple(map(ord, s))
+
+def strxor(x,y):
+ return "".join(map(lambda x,y:chr(ord(x)^ord(y)),x,y))
+
+def atol(x):
+ try:
+ ip = inet_aton(x)
+ except socket.error:
+ ip = inet_aton(socket.gethostbyname(x))
+ return struct.unpack("!I", ip)[0]
+def ltoa(x):
+ return inet_ntoa(struct.pack("!I", x))
+
+def itom(x):
+ return (0xffffffff00000000L>>x)&0xffffffffL
+
+def do_graph(graph,prog=None,format="svg",target=None, type=None,string=None,options=None):
+ """do_graph(graph, prog=conf.prog.dot, format="svg",
+ target="| conf.prog.display", options=None, [string=1]):
+ string: if not None, simply return the graph string
+ graph: GraphViz graph description
+ format: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
+ target: filename or redirect. Defaults pipe to Imagemagick's display program
+ prog: which graphviz program to use
+ options: options to be passed to prog"""
+
+
+ if string:
+ return graph
+ if type is not None:
+ format=type
+ if prog is None:
+ prog = conf.prog.dot
+ if target is None:
+ target = "| %s" % conf.prog.display
+ if format is not None:
+ format = "-T %s" % format
+ w,r = os.popen2("%s %s %s %s" % (prog,options or "", format or "", target))
+ w.write(graph)
+ w.close()
+
+_TEX_TR = {
+ "{":"{\\tt\\char123}",
+ "}":"{\\tt\\char125}",
+ "\\":"{\\tt\\char92}",
+ "^":"\\^{}",
+ "$":"\\$",
+ "#":"\\#",
+ "~":"\\~",
+ "_":"\\_",
+ "&":"\\&",
+ "%":"\\%",
+ "|":"{\\tt\\char124}",
+ "~":"{\\tt\\char126}",
+ "<":"{\\tt\\char60}",
+ ">":"{\\tt\\char62}",
+ }
+
+def tex_escape(x):
+ s = ""
+ for c in x:
+ s += _TEX_TR.get(c,c)
+ return s
+
+def colgen(*lstcol,**kargs):
+ """Returns a generator that mixes provided quantities forever
+ trans: a function to convert the three arguments into a color. lambda x,y,z:(x,y,z) by default"""
+ if len(lstcol) < 2:
+ lstcol *= 2
+ trans = kargs.get("trans", lambda x,y,z: (x,y,z))
+ while 1:
+ for i in range(len(lstcol)):
+ for j in range(len(lstcol)):
+ for k in range(len(lstcol)):
+ if i != j or j != k or k != i:
+ yield trans(lstcol[(i+j)%len(lstcol)],lstcol[(j+k)%len(lstcol)],lstcol[(k+i)%len(lstcol)])
+
+def incremental_label(label="tag%05i", start=0):
+ while True:
+ yield label % start
+ start += 1
+
+#########################
+#### Enum management ####
+#########################
+
+class EnumElement:
+ _value=None
+ def __init__(self, key, value):
+ self._key = key
+ self._value = value
+ def __repr__(self):
+ return "<%s %s[%r]>" % (self.__dict__.get("_name", self.__class__.__name__), self._key, self._value)
+ def __getattr__(self, attr):
+ return getattr(self._value, attr)
+ def __str__(self):
+ return self._key
+ def __eq__(self, other):
+ return self._value == int(other)
+
+
+class Enum_metaclass(type):
+ element_class = EnumElement
+ def __new__(cls, name, bases, dct):
+ rdict={}
+ for k,v in dct.iteritems():
+ if type(v) is int:
+ v = cls.element_class(k,v)
+ dct[k] = v
+ rdict[v] = k
+ dct["__rdict__"] = rdict
+ return super(Enum_metaclass, cls).__new__(cls, name, bases, dct)
+ def __getitem__(self, attr):
+ return self.__rdict__[attr]
+ def __contains__(self, val):
+ return val in self.__rdict__
+ def get(self, attr, val=None):
+ return self._rdict__.get(attr, val)
+ def __repr__(self):
+ return "<%s>" % self.__dict__.get("name", self.__name__)
+
+
+
+
+##############################
+## Session saving/restoring ##
+##############################
+
+
+def save_session(fname, session=None, pickleProto=-1):
+ if session is None:
+ session = scapy_session
+
+ to_be_saved = session.copy()
+
+ if to_be_saved.has_key("__builtins__"):
+ del(to_be_saved["__builtins__"])
+
+ for k in to_be_saved.keys():
+ if type(to_be_saved[k]) in [types.TypeType, types.ClassType, types.ModuleType]:
+ log_interactive.error("[%s] (%s) can't be saved." % (k, type(to_be_saved[k])))
+ del(to_be_saved[k])
+
+ try:
+ os.rename(fname, fname+".bak")
+ except OSError:
+ pass
+ f=gzip.open(fname,"wb")
+ cPickle.dump(to_be_saved, f, pickleProto)
+ f.close()
+
+def load_session(fname):
+ try:
+ s = cPickle.load(gzip.open(fname,"rb"))
+ except IOError:
+ s = cPickle.load(open(fname,"rb"))
+ scapy_session.clear()
+ scapy_session.update(s)
+
+def update_session(fname):
+ try:
+ s = cPickle.load(gzip.open(fname,"rb"))
+ except IOError:
+ s = cPickle.load(open(fname,"rb"))
+ scapy_session.update(s)
+
+
+def export_object(obj):
+ print base64.encodestring(gzip.zlib.compress(cPickle.dumps(obj,2),9))
+
+def import_object(obj=None):
+ if obj is None:
+ obj = sys.stdin.read()
+ return cPickle.loads(gzip.zlib.decompress(base64.decodestring(obj.strip())))
+
+
+def save_object(fname, obj):
+ cPickle.dump(obj,gzip.open(fname,"wb"))
+
+def load_object(fname):
+ return cPickle.load(gzip.open(fname,"rb"))
+
+
+#################
+## Debug class ##
+#################
+
+class debug:
+ recv=[]
+ sent=[]
+ match=[]
+
+
+####################
+## IP Tools class ##
+####################
+
+class IPTools:
+ """Add more powers to a class that have a "src" attribute."""
+ def whois(self):
+ os.system("whois %s" % self.src)
+ def ottl(self):
+ t = [32,64,128,255]+[self.ttl]
+ t.sort()
+ return t[t.index(self.ttl)+1]
+ def hops(self):
+ return self.ottl()-self.ttl-1
+
+
+##############################
+## Routing/Interfaces stuff ##
+##############################
+
+class Route:
+ def __init__(self):
+ self.resync()
+ self.s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ self.cache = {}
+
+ def invalidate_cache(self):
+ self.cache = {}
+
+ def resync(self):
+ self.invalidate_cache()
+ self.routes = read_routes()
+
+ def __repr__(self):
+ rt = "Network Netmask Gateway Iface Output IP\n"
+ for net,msk,gw,iface,addr in self.routes:
+ rt += "%-15s %-15s %-15s %-15s %-15s\n" % (ltoa(net),
+ ltoa(msk),
+ gw,
+ iface,
+ addr)
+ return rt
+
+ def make_route(self, host=None, net=None, gw=None, dev=None):
+ if host is not None:
+ thenet,msk = host,32
+ elif net is not None:
+ thenet,msk = net.split("/")
+ msk = int(msk)
+ else:
+ raise Scapy_Exception("make_route: Incorrect parameters. You should specify a host or a net")
+ if gw is None:
+ gw="0.0.0.0"
+ if dev is None:
+ if gw:
+ nhop = gw
+ else:
+ nhop = thenet
+ dev,ifaddr,x = self.route(nhop)
+ else:
+ ifaddr = get_if_addr(dev)
+ return (atol(thenet), itom(msk), gw, dev, ifaddr)
+
+ def add(self, *args, **kargs):
+ """Ex:
+ add(net="192.168.1.0/24",gw="1.2.3.4")
+ """
+ self.invalidate_cache()
+ self.routes.append(self.make_route(*args,**kargs))
+
+
+ def delt(self, *args, **kargs):
+ """delt(host|net, gw|dev)"""
+ self.invalidate_cache()
+ route = self.make_route(*args,**kargs)
+ try:
+ i=self.routes.index(route)
+ del(self.routes[i])
+ except ValueError:
+ warning("no matching route found")
+
+ def ifchange(self, iff, addr):
+ self.invalidate_cache()
+ the_addr,the_msk = (addr.split("/")+["32"])[:2]
+ the_msk = itom(int(the_msk))
+ the_rawaddr = atol(the_addr)
+ the_net = the_rawaddr & the_msk
+
+
+ for i in range(len(self.routes)):
+ net,msk,gw,iface,addr = self.routes[i]
+ if iface != iff:
+ continue
+ if gw == '0.0.0.0':
+ self.routes[i] = (the_net,the_msk,gw,iface,the_addr)
+ else:
+ self.routes[i] = (net,msk,gw,iface,the_addr)
+ for i in arp_cache.keys():
+ del(arp_cache[i])
+
+
+
+ def ifdel(self, iff):
+ self.invalidate_cache()
+ new_routes=[]
+ for rt in self.routes:
+ if rt[3] != iff:
+ new_routes.append(rt)
+ self.routes=new_routes
+
+ def ifadd(self, iff, addr):
+ self.invalidate_cache()
+ the_addr,the_msk = (addr.split("/")+["32"])[:2]
+ the_msk = itom(int(the_msk))
+ the_rawaddr = atol(the_addr)
+ the_net = the_rawaddr & the_msk
+ self.routes.append((the_net,the_msk,'0.0.0.0',iff,the_addr))
+
+
+ def route(self,dest,verbose=None):
+ if dest in self.cache:
+ return self.cache[dest]
+ if verbose is None:
+ verbose=conf.verb
+ # Transform "192.168.*.1-5" to one IP of the set
+ dst = dest.split("/")[0]
+ dst = dst.replace("*","0")
+ while 1:
+ l = dst.find("-")
+ if l < 0:
+ break
+ m = (dst[l:]+".").find(".")
+ dst = dst[:l]+dst[l+m:]
+
+
+ dst = atol(dst)
+ pathes=[]
+ for d,m,gw,i,a in self.routes:
+ aa = atol(a)
+ if aa == dst:
+ pathes.append((0xffffffffL,("lo",a,"0.0.0.0")))
+ if (dst & m) == (d & m):
+ pathes.append((m,(i,a,gw)))
+ if not pathes:
+ if verbose:
+ warning("No route found (no default route?)")
+ return "lo","0.0.0.0","0.0.0.0" #XXX linux specific!
+ # Choose the more specific route (greatest netmask).
+ # XXX: we don't care about metrics
+ pathes.sort()
+ ret = pathes[-1][1]
+ self.cache[dest] = ret
+ return ret
+
+ def get_if_bcast(self, iff):
+ for net, msk, gw, iface, addr in self.routes:
+ if (iff == iface and net != 0L):
+ bcast = atol(addr)|(~msk&0xffffffffL); # FIXME: check error in atol()
+ return ltoa(bcast);
+ warning("No broadcast address found for iface %s\n" % iff);
+
+if DNET:
+ def get_if_raw_hwaddr(iff):
+ if iff[:2] == "lo":
+ return (772, '\x00'*6)
+ try:
+ l = dnet.intf().get(iff)
+ l = l["link_addr"]
+ except:
+ raise Scapy_Exception("Error in attempting to get hw address for interface [%s]" % iff)
+ return l.type,l.data
+ def get_if_raw_addr(ifname):
+ i = dnet.intf()
+ return i.get(ifname)["addr"].data
+else:
+ def get_if_raw_hwaddr(iff):
+ return struct.unpack("16xh6s8x",get_if(iff,SIOCGIFHWADDR))
+
+ def get_if_raw_addr(iff):
+ try:
+ return get_if(iff, SIOCGIFADDR)[20:24]
+ except IOError:
+ return "\0\0\0\0"
+
+
+if PCAP:
+ def get_if_list():
+ # remove 'any' interface
+ return map(lambda x:x[0],filter(lambda x:x[1] is None,pcap.findalldevs()))
+ def get_working_if():
+ try:
+ return pcap.lookupdev()
+ except pcap.pcapc.EXCEPTION:
+ return 'lo'
+
+ def attach_filter(s, filter):
+ warning("attach_filter() should not be called in PCAP mode")
+ def set_promisc(s,iff,val=1):
+ warning("set_promisc() should not be called in DNET/PCAP mode")
+
+else:
+ def get_if_list():
+ f=open("/proc/net/dev","r")
+ lst = []
+ f.readline()
+ f.readline()
+ for l in f:
+ lst.append(l.split(":")[0].strip())
+ return lst
+ def get_working_if():
+ for i in get_if_list():
+ if i == 'lo':
+ continue
+ ifflags = struct.unpack("16xH14x",get_if(i,SIOCGIFFLAGS))[0]
+ if ifflags & IFF_UP:
+ return i
+ return "lo"
+ def attach_filter(s, filter):
+ # XXX We generate the filter on the interface conf.iface
+ # because tcpdump open the "any" interface and ppp interfaces
+ # in cooked mode. As we use them in raw mode, the filter will not
+ # work... one solution could be to use "any" interface and translate
+ # the filter from cooked mode to raw mode
+ # mode
+ if not TCPDUMP:
+ return
+ try:
+ f = os.popen("%s -i %s -ddd -s 1600 '%s'" % (conf.prog.tcpdump,conf.iface,filter))
+ except OSError,msg:
+ log_interactive.warning("Failed to execute tcpdump: (%s)")
+ return
+ lines = f.readlines()
+ if f.close():
+ raise Scapy_Exception("Filter parse error")
+ nb = int(lines[0])
+ bpf = ""
+ for l in lines[1:]:
+ bpf += struct.pack("HBBI",*map(long,l.split()))
+
+ # XXX. Argl! We need to give the kernel a pointer on the BPF,
+ # python object header seems to be 20 bytes. 36 bytes for x86 64bits arch.
+ if X86_64:
+ bpfh = struct.pack("HL", nb, id(bpf)+36)
+ else:
+ bpfh = struct.pack("HI", nb, id(bpf)+20)
+ s.setsockopt(SOL_SOCKET, SO_ATTACH_FILTER, bpfh)
+
+ def set_promisc(s,iff,val=1):
+ mreq = struct.pack("IHH8s", get_if_index(iff), PACKET_MR_PROMISC, 0, "")
+ if val:
+ cmd = PACKET_ADD_MEMBERSHIP
+ else:
+ cmd = PACKET_DROP_MEMBERSHIP
+ s.setsockopt(SOL_PACKET, cmd, mreq)
+
+
+if not LINUX:
+
+ def new_read_routes():
+
+ rtlst = []
+ def addrt(rt,lst):
+ dst,gw = rt
+ lst.append(rt)
+
+ r = dnet.route()
+ print r.loop(addrt, rtlst)
+ return rtlst
+
+ def read_routes():
+ if SOLARIS:
+ f=os.popen("netstat -rvn") # -f inet
+ elif FREEBSD:
+ f=os.popen("netstat -rnW") # -W to handle long interface names
+ else:
+ f=os.popen("netstat -rn") # -f inet
+ ok = 0
+ mtu_present = False
+ routes = []
+ for l in f.readlines():
+ if not l:
+ break
+ l = l.strip()
+ if l.find("----") >= 0: # a separation line
+ continue
+ if l.find("Destination") >= 0:
+ ok = 1
+ if l.find("Mtu") >= 0:
+ mtu_present = True
+ continue
+ if ok == 0:
+ continue
+ if not l:
+ break
+ if SOLARIS:
+ dest,mask,gw,netif,mxfrg,rtt,ref,flg = l.split()[:8]
+ else:
+ if mtu_present:
+ dest,gw,flg,ref,use,mtu,netif = l.split()[:7]
+ else:
+ dest,gw,flg,ref,use,netif = l.split()[:6]
+ if flg.find("Lc") >= 0:
+ continue
+ if dest == "default":
+ dest = 0L
+ netmask = 0L
+ else:
+ if SOLARIS:
+ netmask = atol(mask)
+ elif "/" in dest:
+ dest,netmask = dest.split("/")
+ netmask = itom(int(netmask))
+ else:
+ netmask = itom((dest.count(".") + 1) * 8)
+ dest += ".0"*(3-dest.count("."))
+ dest = atol(dest)
+ if not "G" in flg:
+ gw = '0.0.0.0'
+ ifaddr = get_if_addr(netif)
+ routes.append((dest,netmask,gw,netif,ifaddr))
+ f.close()
+ return routes
+
+ def read_interfaces():
+ i = dnet.intf()
+ ifflist = {}
+ def addif(iff,lst):
+ if not iff.has_key("addr"):
+ return
+ if not iff.has_key("link_addr"):
+ return
+ rawip = iff["addr"].data
+ ip = inet_ntoa(rawip)
+ rawll = iff["link_addr"].data
+ ll = str2mac(rawll)
+ lst[iff["name"]] = (rawll,ll,rawip,ip)
+ i.loop(addif, ifflist)
+ return ifflist
+
+
+else:
+
+ def read_routes():
+ f=open("/proc/net/route","r")
+ routes = []
+ s=socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
+ ifreq = ioctl(s, SIOCGIFADDR,struct.pack("16s16x","lo"))
+ addrfamily = struct.unpack("h",ifreq[16:18])[0]
+ if addrfamily == socket.AF_INET:
+ ifreq2 = ioctl(s, SIOCGIFNETMASK,struct.pack("16s16x","lo"))
+ msk = socket.ntohl(struct.unpack("I",ifreq2[20:24])[0])
+ dst = socket.ntohl(struct.unpack("I",ifreq[20:24])[0]) & msk
+ ifaddr = inet_ntoa(ifreq[20:24])
+ routes.append((dst, msk, "0.0.0.0", "lo", ifaddr))
+ else:
+ warning("Interface lo: unkown address family (%i)"% addrfamily)
+
+ for l in f.readlines()[1:]:
+ iff,dst,gw,flags,x,x,x,msk,x,x,x = l.split()
+ flags = int(flags,16)
+ if flags & RTF_UP == 0:
+ continue
+ if flags & RTF_REJECT:
+ continue
+ try:
+ ifreq = ioctl(s, SIOCGIFADDR,struct.pack("16s16x",iff))
+ except IOError: # interface is present in routing tables but does not have any assigned IP
+ ifaddr="0.0.0.0"
+ else:
+ addrfamily = struct.unpack("h",ifreq[16:18])[0]
+ if addrfamily == socket.AF_INET:
+ ifaddr = inet_ntoa(ifreq[20:24])
+ else:
+ warning("Interface %s: unkown address family (%i)"%(iff, addrfamily))
+ continue
+ routes.append((socket.htonl(long(dst,16))&0xffffffffL,
+ socket.htonl(long(msk,16))&0xffffffffL,
+ inet_ntoa(struct.pack("I",long(gw,16))),
+ iff, ifaddr))
+
+ f.close()
+ return routes
+
+ def get_if(iff,cmd):
+ s=socket.socket()
+ ifreq = ioctl(s, cmd, struct.pack("16s16x",iff))
+ s.close()
+ return ifreq
+
+
+ def get_if_index(iff):
+ return int(struct.unpack("I",get_if(iff, SIOCGIFINDEX)[16:20])[0])
+
+
+
+def get_if_addr(iff):
+ return inet_ntoa(get_if_raw_addr(iff))
+
+def get_if_hwaddr(iff):
+ addrfamily, mac = get_if_raw_hwaddr(iff)
+ if addrfamily in [ARPHDR_ETHER,ARPHDR_LOOPBACK]:
+ return str2mac(mac)
+ else:
+ raise Scapy_Exception("Unsupported address family (%i) for interface [%s]" % (addrfamily,iff))
+
+
+
+#####################
+## ARP cache stuff ##
+#####################
+
+ARPTIMEOUT=120
+
+# XXX Fill arp_cache with /etc/ether and arp cache
+arp_cache={}
+
+if 0 and DNET: ## XXX Can't use this because it does not resolve IPs not in cache
+ dnet_arp_object = dnet.arp()
+ def getmacbyip(ip):
+ tmp = map(ord, inet_aton(ip))
+ if (tmp[0] & 0xf0) == 0xe0: # mcast @
+ return "01:00:5e:%.2x:%.2x:%.2x" % (tmp[1]&0x7f,tmp[2],tmp[3])
+ iff,a,gw = conf.route.route(ip)
+ if iff == "lo":
+ return "ff:ff:ff:ff:ff:ff"
+ if gw != "0.0.0.0":
+ ip = gw
+ res = dnet_arp_object.get(dnet.addr(ip))
+ if res is None:
+ return None
+ else:
+ return res.ntoa()
+else:
+ def getmacbyip(ip):
+ tmp = map(ord, inet_aton(ip))
+ if (tmp[0] & 0xf0) == 0xe0: # mcast @
+ return "01:00:5e:%.2x:%.2x:%.2x" % (tmp[1]&0x7f,tmp[2],tmp[3])
+ iff,a,gw = conf.route.route(ip)
+ if ( (iff == "lo") or (ip == conf.route.get_if_bcast(iff)) ):
+ return "ff:ff:ff:ff:ff:ff"
+ if gw != "0.0.0.0":
+ ip = gw
+
+ if arp_cache.has_key(ip):
+ mac, timeout = arp_cache[ip]
+ if not timeout or (time.time()-timeout < ARPTIMEOUT):
+ return mac
+
+ res = srp1(Ether(dst=ETHER_BROADCAST)/ARP(op="who-has", pdst=ip),
+ type=ETH_P_ARP,
+ iface = iff,
+ timeout=2,
+ verbose=0,
+ nofilter=1)
+ if res is not None:
+ mac = res.payload.hwsrc
+ arp_cache[ip] = (mac,time.time())
+ return mac
+ return None
+
+
+####################
+## Random numbers ##
+####################
+
+class VolatileValue:
+ def __repr__(self):
+ return "<%s>" % self.__class__.__name__
+ def __getattr__(self, attr):
+ if attr == "__setstate__":
+ raise AttributeError(attr)
+ return getattr(self._fix(),attr)
+ def _fix(self):
+ return None
+
+
+class RandField(VolatileValue):
+ pass
+
+
+class RandNum(RandField):
+ min = 0
+ max = 0
+ def __init__(self, min, max):
+ self.min = min
+ self.max = max
+ def _fix(self):
+ # XXX: replace with sth that guarantee unicity
+ return random.randrange(self.min, self.max)
+
+class RandNumGamma(RandField):
+ def __init__(self, alpha, beta):
+ self.alpha = alpha
+ self.beta = beta
+ def _fix(self):
+ return int(round(random.gammavariate(self.alpha, self.beta)))
+
+class RandNumGauss(RandField):
+ def __init__(self, mu, sigma):
+ self.mu = mu
+ self.sigma = sigma
+ def _fix(self):
+ return int(round(random.gauss(self.mu, self.sigma)))
+
+class RandNumExpo(RandField):
+ def __init__(self, lambd):
+ self.lambd = lambd
+ def _fix(self):
+ return int(round(random.expovariate(self.lambd)))
+
+class RandByte(RandNum):
+ def __init__(self):
+ RandNum.__init__(self, 0, 2L**8)
+
+class RandShort(RandNum):
+ def __init__(self):
+ RandNum.__init__(self, 0, 2L**16)
+
+class RandInt(RandNum):
+ def __init__(self):
+ RandNum.__init__(self, 0, 2L**32)
+
+class RandSInt(RandNum):
+ def __init__(self):
+ RandNum.__init__(self, -2L**31, 2L**31)
+
+class RandLong(RandNum):
+ def __init__(self):
+ RandNum.__init__(self, 0, 2L**64)
+
+class RandSLong(RandNum):
+ def __init__(self):
+ RandNum.__init__(self, -2L**63, 2L**63)
+
+class RandChoice(RandField):
+ def __init__(self, *args):
+ self._choice = args
+ def _fix(self):
+ return random.choice(self._choice)
+
+class RandString(RandField):
+ def __init__(self, size, chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"):
+ self.chars = chars
+ self.size = size
+ def _fix(self):
+ s = ""
+ for i in range(self.size):
+ s += random.choice(self.chars)
+ return s
+
+class RandBin(RandString):
+ def __init__(self, size):
+ RandString.__init__(self, size, "".join(map(chr,range(256))))
+
+
+class RandTermString(RandString):
+ def __init__(self, size, term):
+ RandString.__init__(self, size, "".join(map(chr,range(1,256))))
+ self.term = term
+ def _fix(self):
+ return RandString._fix(self)+self.term
+
+
+
+class RandIP(RandString):
+ def __init__(self, iptemplate="0.0.0.0/0"):
+ self.ip = Net(iptemplate)
+ def _fix(self):
+ return self.ip.choice()
+
+class RandMAC(RandString):
+ def __init__(self, template="*"):
+ template += ":*:*:*:*:*"
+ template = template.split(":")
+ self.mac = ()
+ for i in range(6):
+ if template[i] == "*":
+ v = RandByte()
+ elif "-" in template[i]:
+ x,y = template[i].split("-")
+ v = RandNum(int(x,16), int(y,16))
+ else:
+ v = int(template[i],16)
+ self.mac += (v,)
+ def _fix(self):
+ return "%02x:%02x:%02x:%02x:%02x:%02x" % self.mac
+
+
+class RandOID(RandString):
+ def __init__(self, fmt=None, depth=RandNumExpo(0.1), idnum=RandNumExpo(0.01)):
+ self.ori_fmt = fmt
+ if fmt is not None:
+ fmt = fmt.split(".")
+ for i in range(len(fmt)):
+ if "-" in fmt[i]:
+ fmt[i] = tuple(map(int, fmt[i].split("-")))
+ self.fmt = fmt
+ self.depth = depth
+ self.idnum = idnum
+ def __repr__(self):
+ if self.ori_fmt is None:
+ return "<%s>" % self.__class__.__name__
+ else:
+ return "<%s [%s]>" % (self.__class__.__name__, self.ori_fmt)
+ def _fix(self):
+ if self.fmt is None:
+ return ".".join(map(str, [self.idnum for i in xrange(1+self.depth)]))
+ else:
+ oid = []
+ for i in self.fmt:
+ if i == "*":
+ oid.append(str(self.idnum))
+ elif i == "**":
+ oid += map(str, [self.idnum for i in xrange(1+self.depth)])
+ elif type(i) is tuple:
+ oid.append(str(random.randrange(*i)))
+ else:
+ oid.append(i)
+ return ".".join(oid)
+
+
+
+class RandASN1Object(RandField):
+ def __init__(self, objlist=None):
+ if objlist is None:
+ objlist = map(lambda x:x._asn1_obj,
+ filter(lambda x:hasattr(x,"_asn1_obj"), ASN1_Class_UNIVERSAL.__rdict__.values()))
+ self.objlist = objlist
+ self.chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789"
+ def _fix(self, n=0):
+ o = random.choice(self.objlist)
+ if issubclass(o, ASN1_INTEGER):
+ return o(int(random.gauss(0,1000)))
+ elif issubclass(o, ASN1_STRING):
+ z = int(random.expovariate(0.05)+1)
+ return o("".join([random.choice(self.chars) for i in range(z)]))
+ elif issubclass(o, ASN1_SEQUENCE) and (n < 10):
+ z = int(random.expovariate(0.08)+1)
+ return o(map(lambda x:x._fix(n+1), [self.__class__(objlist=self.objlist)]*z))
+ return ASN1_INTEGER(int(random.gauss(0,1000)))
+
+
+# Automatic timestamp
+
+class AutoTime(VolatileValue):
+ def __init__(self, base=None):
+ if base == None:
+ self.diff = 0
+ else:
+ self.diff = time.time()-base
+ def _fix(self):
+ return time.time()-self.diff
+
+class IntAutoTime(AutoTime):
+ def _fix(self):
+ return int(time.time()-self.diff)
+
+
+
+class DelayedEval(VolatileValue):
+ """ Exemple of usage: DelayedEval("time.time()") """
+ def __init__(self, expr):
+ self.expr = expr
+ def _fix(self):
+ return eval(self.expr)
+
+
+class IncrementalValue(VolatileValue):
+ def __init__(self, start=0, step=1, restart=-1):
+ self.start = self.val = start
+ self.step = step
+ self.restart = restart
+ def _fix(self):
+ v = self.val
+ if self.val == self.restart :
+ self.val = self.start
+ else:
+ self.val += self.step
+ return v
+
+def corrupt_bytes(s, p=0.01, n=None):
+ s = array.array("B",str(s))
+ l = len(s)
+ if n is None:
+ n = max(1,int(l*p))
+ for i in random.sample(xrange(l), n):
+ s[i] = random.randint(0,255)
+ return s.tostring()
+
+def corrupt_bits(s, p=0.01, n=None):
+ s = array.array("B",str(s))
+ l = len(s)*8
+ if n is None:
+ n = max(1,int(l*p))
+ for i in random.sample(xrange(l), n):
+ s[i/8] ^= 1 << (i%8)
+ return s.tostring()
+
+
+class CorruptedBytes(VolatileValue):
+ def __init__(self, s, p=0.01, n=None):
+ self.s = s
+ self.p = p
+ self.n = n
+ def _fix(self):
+ return corrupt_bytes(self.s, self.p, self.n)
+
+class CorruptedBits(CorruptedBytes):
+ def _fix(self):
+ return corrupt_bits(self.s, self.p, self.n)
+
+##############
+#### ASN1 ####
+##############
+
+class ASN1_Error(Exception):
+ pass
+
+class ASN1_Encoding_Error(ASN1_Error):
+ pass
+
+class ASN1_Decoding_Error(ASN1_Error):
+ pass
+
+class ASN1_BadTag_Decoding_Error(ASN1_Decoding_Error):
+ pass
+
+
+
+class ASN1Codec(EnumElement):
+ def register_stem(cls, stem):
+ cls._stem = stem
+ def dec(cls, s, context=None):
+ return cls._stem.dec(s, context=context)
+ def safedec(cls, s, context=None):
+ return cls._stem.safedec(s, context=context)
+ def get_stem(cls):
+ return cls.stem
+
+
+class ASN1_Codecs_metaclass(Enum_metaclass):
+ element_class = ASN1Codec
+
+class ASN1_Codecs:
+ __metaclass__ = ASN1_Codecs_metaclass
+ BER = 1
+ DER = 2
+ PER = 3
+ CER = 4
+ LWER = 5
+ BACnet = 6
+ OER = 7
+ SER = 8
+ XER = 9
+
+class ASN1Tag(EnumElement):
+ def __init__(self, key, value, context=None, codec=None):
+ EnumElement.__init__(self, key, value)
+ self._context = context
+ if codec == None:
+ codec = {}
+ self._codec = codec
+ def clone(self): # /!\ not a real deep copy. self.codec is shared
+ return self.__class__(self._key, self._value, self._context, self._codec)
+ def register_asn1_object(self, asn1obj):
+ self._asn1_obj = asn1obj
+ def asn1_object(self, val):
+ if hasattr(self,"_asn1_obj"):
+ return self._asn1_obj(val)
+ raise ASN1_Error("%r does not have any assigned ASN1 object" % self)
+ def register(self, codecnum, codec):
+ self._codec[codecnum] = codec
+ def get_codec(self, codec):
+ try:
+ c = self._codec[codec]
+ except KeyError,msg:
+ raise ASN1_Error("Codec %r not found for tag %r" % (codec, self))
+ return c
+
+class ASN1_Class_metaclass(Enum_metaclass):
+ element_class = ASN1Tag
+ def __new__(cls, name, bases, dct): # XXX factorise a bit with Enum_metaclass.__new__()
+ for b in bases:
+ for k,v in b.__dict__.iteritems():
+ if k not in dct and isinstance(v,ASN1Tag):
+ dct[k] = v.clone()
+
+ rdict = {}
+ for k,v in dct.iteritems():
+ if type(v) is int:
+ v = ASN1Tag(k,v)
+ dct[k] = v
+ rdict[v] = v
+ elif isinstance(v, ASN1Tag):
+ rdict[v] = v
+ dct["__rdict__"] = rdict
+
+ cls = type.__new__(cls, name, bases, dct)
+ for v in cls.__dict__.values():
+ if isinstance(v, ASN1Tag):
+ v.context = cls # overwrite ASN1Tag contexts, even cloned ones
+ return cls
+
+
+class ASN1_Class:
+ __metaclass__ = ASN1_Class_metaclass
+
+class ASN1_Class_UNIVERSAL(ASN1_Class):
+ name = "UNIVERSAL"
+ ERROR = -3
+ RAW = -2
+ NONE = -1
+ ANY = 0
+ BOOLEAN = 1
+ INTEGER = 2
+ BIT_STRING = 3
+ STRING = 4
+ NULL = 5
+ OID = 6
+ OBJECT_DESCRIPTOR = 7
+ EXTERNAL = 8
+ REAL = 9
+ ENUMERATED = 10
+ EMBEDDED_PDF = 11
+ UTF8_STRING = 12
+ RELATIVE_OID = 13
+ SEQUENCE = 0x30#XXX 16 ??
+ SET = 0x31 #XXX 17 ??
+ NUMERIC_STRING = 18
+ PRINTABLE_STRING = 19
+ T61_STRING = 20
+ VIDEOTEX_STRING = 21
+ IA5_STRING = 22
+ UTC_TIME = 23
+ GENERALIZED_TIME = 24
+ GRAPHIC_STRING = 25
+ ISO646_STRING = 26
+ GENERAL_STRING = 27
+ UNIVERSAL_STRING = 28
+ CHAR_STRING = 29
+ BMP_STRING = 30
+ COUNTER32 = 0x41
+ TIME_TICKS = 0x43
+
+class ASN1_Object_metaclass(type):
+ def __new__(cls, name, bases, dct):
+ c = super(ASN1_Object_metaclass, cls).__new__(cls, name, bases, dct)
+ try:
+ c.tag.register_asn1_object(c)
+ except:
+ warning("Error registering %r for %r" % (c.tag, c.codec))
+ return c
+
+
+class ASN1_Object:
+ __metaclass__ = ASN1_Object_metaclass
+ tag = ASN1_Class_UNIVERSAL.ANY
+ def __init__(self, val):
+ self.val = val
+ def enc(self, codec):
+ return self.tag.get_codec(codec).enc(self.val)
+ def __repr__(self):
+ return "<%s[%r]>" % (self.__dict__.get("name", self.__class__.__name__), self.val)
+ def __str__(self):
+ return self.enc(conf.ASN1_default_codec)
+ def strshow(self, lvl=0):
+ return (" "*lvl)+repr(self)+"\n"
+ def show(self, lvl=0):
+ print self.strshow(lvl)
+ def __eq__(self, other):
+ return self.val == other
+ def __cmp__(self, other):
+ return cmp(self.val, other)
+
+class ASN1_DECODING_ERROR(ASN1_Object):
+ tag = ASN1_Class_UNIVERSAL.ERROR
+ def __init__(self, val, exc=None):
+ ASN1_Object.__init__(self, val)
+ self.exc = exc
+ def __repr__(self):
+ return "<%s[%r]{{%s}}>" % (self.__dict__.get("name", self.__class__.__name__),
+ self.val, self.exc.args[0])
+ def enc(self, codec):
+ if isinstance(self.val, ASN1_Object):
+ return self.val.enc(codec)
+ return self.val
+
+class ASN1_force(ASN1_Object):
+ tag = ASN1_Class_UNIVERSAL.RAW
+ def enc(self, codec):
+ if isinstance(self.val, ASN1_Object):
+ return self.val.enc(codec)
+ return self.val
+
+class ASN1_BADTAG(ASN1_force):
+ pass
+
+class ASN1_INTEGER(ASN1_Object):
+ tag = ASN1_Class_UNIVERSAL.INTEGER
+
+class ASN1_STRING(ASN1_Object):
+ tag = ASN1_Class_UNIVERSAL.STRING
+
+class ASN1_BIT_STRING(ASN1_STRING):
+ tag = ASN1_Class_UNIVERSAL.BIT_STRING
+
+class ASN1_PRINTABLE_STRING(ASN1_STRING):
+ tag = ASN1_Class_UNIVERSAL.PRINTABLE_STRING
+
+class ASN1_T61_STRING(ASN1_STRING):
+ tag = ASN1_Class_UNIVERSAL.T61_STRING
+
+class ASN1_IA5_STRING(ASN1_STRING):
+ tag = ASN1_Class_UNIVERSAL.IA5_STRING
+
+class ASN1_NUMERIC_STRING(ASN1_STRING):
+ tag = ASN1_Class_UNIVERSAL.NUMERIC_STRING
+
+class ASN1_VIDEOTEX_STRING(ASN1_STRING):
+ tag = ASN1_Class_UNIVERSAL.VIDEOTEX_STRING
+
+class ASN1_UTC_TIME(ASN1_STRING):
+ tag = ASN1_Class_UNIVERSAL.UTC_TIME
+
+class ASN1_TIME_TICKS(ASN1_INTEGER):
+ tag = ASN1_Class_UNIVERSAL.TIME_TICKS
+
+class ASN1_BOOLEAN(ASN1_INTEGER):
+ tag = ASN1_Class_UNIVERSAL.BOOLEAN
+
+class ASN1_NULL(ASN1_INTEGER):
+ tag = ASN1_Class_UNIVERSAL.NULL
+
+class ASN1_COUNTER32(ASN1_INTEGER):
+ tag = ASN1_Class_UNIVERSAL.COUNTER32
+
+class ASN1_SEQUENCE(ASN1_Object):
+ tag = ASN1_Class_UNIVERSAL.SEQUENCE
+ def strshow(self, lvl=0):
+ s = (" "*lvl)+("# %s:" % self.__class__.__name__)+"\n"
+ for o in self.val:
+ s += o.strshow(lvl=lvl+1)
+ return s
+
+class ASN1_SET(ASN1_SEQUENCE):
+ tag = ASN1_Class_UNIVERSAL.SET
+
+class ASN1_OID(ASN1_Object):
+ tag = ASN1_Class_UNIVERSAL.OID
+ def __init__(self, val):
+ val = conf.mib._oid(val)
+ ASN1_Object.__init__(self, val)
+ def __repr__(self):
+ return "<%s[%r]>" % (self.__dict__.get("name", self.__class__.__name__), conf.mib._oidname(self.val))
+
+
+
+##################
+## BER encoding ##
+##################
+
+
+
+#####[ BER tools ]#####
+
+
+class BER_Exception(Exception):
+ pass
+
+class BER_Decoding_Error(ASN1_Decoding_Error):
+ def __init__(self, msg, decoded=None, remaining=None):
+ Exception.__init__(self, msg)
+ self.remaining = remaining
+ self.decoded = decoded
+ def __str__(self):
+ s = Exception.__str__(self)
+ if isinstance(self.decoded, BERcodec_Object):
+ s+="\n### Already decoded ###\n%s" % self.decoded.strshow()
+ else:
+ s+="\n### Already decoded ###\n%r" % self.decoded
+ s+="\n### Remaining ###\n%r" % self.remaining
+ return s
+
+class BER_BadTag_Decoding_Error(BER_Decoding_Error, ASN1_BadTag_Decoding_Error):
+ pass
+
+def BER_len_enc(l, size=0):
+ if l <= 127 and size==0:
+ return chr(l)
+ s = ""
+ while l or size>0:
+ s = chr(l&0xff)+s
+ l >>= 8L
+ size -= 1
+ if len(s) > 127:
+ raise BER_Exception("BER_len_enc: Length too long (%i) to be encoded [%r]" % (len(s),s))
+ return chr(len(s)|0x80)+s
+def BER_len_dec(s):
+ l = ord(s[0])
+ if not l & 0x80:
+ return l,s[1:]
+ l &= 0x7f
+ if len(s) <= l:
+ raise BER_Decoding_Error("BER_len_dec: Got %i bytes while expecting %i" % (len(s)-1, l),remaining=s)
+ ll = 0L
+ for c in s[1:l+1]:
+ ll <<= 8L
+ ll |= ord(c)
+ return ll,s[l+1:]
+
+def BER_num_enc(l, size=1):
+ x=[]
+ while l or size>0:
+ x.insert(0, l & 0x7f)
+ if len(x) > 1:
+ x[0] |= 0x80
+ l >>= 7
+ size -= 1
+ return "".join([chr(k) for k in x])
+def BER_num_dec(s):
+ x = 0
+ for i in range(len(s)):
+ c = ord(s[i])
+ x <<= 7
+ x |= c&0x7f
+ if not c&0x80:
+ break
+ if c&0x80:
+ raise BER_Decoding_Error("BER_num_dec: unfinished number description", remaining=s)
+ return x, s[i+1:]
+
+#####[ BER classes ]#####
+
+class BERcodec_metaclass(type):
+ def __new__(cls, name, bases, dct):
+ c = super(BERcodec_metaclass, cls).__new__(cls, name, bases, dct)
+ try:
+ c.tag.register(c.codec, c)
+ except:
+ warning("Error registering %r for %r" % (c.tag, c.codec))
+ return c
+
+
+class BERcodec_Object:
+ __metaclass__ = BERcodec_metaclass
+ codec = ASN1_Codecs.BER
+ tag = ASN1_Class_UNIVERSAL.ANY
+
+ @classmethod
+ def asn1_object(cls, val):
+ return cls.tag.asn1_object(val)
+
+ @classmethod
+ def check_string(cls, s):
+ if not s:
+ raise BER_Decoding_Error("%s: Got empty object while expecting tag %r" %
+ (cls.__name__,cls.tag), remaining=s)
+ @classmethod
+ def check_type(cls, s):
+ cls.check_string(s)
+ if cls.tag != ord(s[0]):
+ raise BER_BadTag_Decoding_Error("%s: Got tag [%i/%#x] while expecting %r" %
+ (cls.__name__, ord(s[0]), ord(s[0]),cls.tag), remaining=s)
+ return s[1:]
+ @classmethod
+ def check_type_get_len(cls, s):
+ s2 = cls.check_type(s)
+ if not s2:
+ raise BER_Decoding_Error("%s: No bytes while expecting a length" %
+ cls.__name__, remaining=s)
+ return BER_len_dec(s2)
+ @classmethod
+ def check_type_check_len(cls, s):
+ l,s3 = cls.check_type_get_len(s)
+ if len(s3) < l:
+ raise BER_Decoding_Error("%s: Got %i bytes while expecting %i" %
+ (cls.__name__, len(s3), l), remaining=s)
+ return l,s3[:l],s3[l:]
+
+ @classmethod
+ def do_dec(cls, s, context=None, safe=False):
+ if context is None:
+ context = cls.tag.context
+ cls.check_string(s)
+ p = ord(s[0])
+ if p not in context:
+ t = s
+ if len(t) > 18:
+ t = t[:15]+"..."
+ raise BER_Decoding_Error("Unknown prefix [%02x] for [%r]" % (p,t), remaining=s)
+ codec = context[p].get_codec(ASN1_Codecs.BER)
+ return codec.dec(s,context,safe)
+
+ @classmethod
+ def dec(cls, s, context=None, safe=False):
+ if not safe:
+ return cls.do_dec(s, context, safe)
+ try:
+ return cls.do_dec(s, context, safe)
+ except BER_BadTag_Decoding_Error,e:
+ o,remain = BERcodec_Object.dec(e.remaining, context, safe)
+ return ASN1_BADTAG(o),remain
+ except BER_Decoding_Error, e:
+ return ASN1_DECODING_ERROR(s, exc=e),""
+ except ASN1_Error, e:
+ return ASN1_DECODING_ERROR(s, exc=e),""
+
+ @classmethod
+ def safedec(cls, s, context=None):
+ return cls.dec(s, context, safe=True)
+
+
+ @classmethod
+ def enc(cls, s):
+ if type(s) is str:
+ return BERcodec_STRING.enc(s)
+ else:
+ return BERcodec_INTEGER.enc(int(s))
+
+
+
+ASN1_Codecs.BER.register_stem(BERcodec_Object)
+
+
+class BERcodec_INTEGER(BERcodec_Object):
+ tag = ASN1_Class_UNIVERSAL.INTEGER
+ @classmethod
+ def enc(cls, i):
+ s = []
+ while 1:
+ s.append(i&0xff)
+ if -127 <= i < 0:
+ break
+ if 128 <= i <= 255:
+ s.append(0)
+ i >>= 8
+ if not i:
+ break
+ s = map(chr, s)
+ s.append(BER_len_enc(len(s)))
+ s.append(chr(cls.tag))
+ s.reverse()
+ return "".join(s)
+ @classmethod
+ def do_dec(cls, s, context=None, safe=False):
+ l,s,t = cls.check_type_check_len(s)
+ x = 0L
+ if s:
+ if ord(s[0])&0x80: # negative int
+ x = -1L
+ for c in s:
+ x <<= 8
+ x |= ord(c)
+ return cls.asn1_object(x),t
+
+
+class BERcodec_BOOLEAN(BERcodec_INTEGER):
+ tag = ASN1_Class_UNIVERSAL.BOOLEAN
+
+class BERcodec_NULL(BERcodec_INTEGER):
+ tag = ASN1_Class_UNIVERSAL.NULL
+ @classmethod
+ def enc(cls, i):
+ if i == 0:
+ return chr(cls.tag)+"\0"
+ else:
+ return super(cls,cls).enc(i)
+
+class BERcodec_STRING(BERcodec_Object):
+ tag = ASN1_Class_UNIVERSAL.STRING
+ @classmethod
+ def enc(cls,s):
+ return chr(cls.tag)+BER_len_enc(len(s))+s
+ @classmethod
+ def do_dec(cls, s, context=None, safe=False):
+ l,s,t = cls.check_type_check_len(s)
+ return cls.tag.asn1_object(s),t
+
+class BERcodec_BIT_STRING(BERcodec_STRING):
+ tag = ASN1_Class_UNIVERSAL.BIT_STRING
+
+class BERcodec_PRINTABLE_STRING(BERcodec_STRING):
+ tag = ASN1_Class_UNIVERSAL.PRINTABLE_STRING
+
+class BERcodec_T61_STRING (BERcodec_STRING):
+ tag = ASN1_Class_UNIVERSAL.T61_STRING
+
+class BERcodec_IA5_STRING(BERcodec_STRING):
+ tag = ASN1_Class_UNIVERSAL.IA5_STRING
+
+class BERcodec_UTC_TIME(BERcodec_STRING):
+ tag = ASN1_Class_UNIVERSAL.UTC_TIME
+
+class BERcodec_TIME_TICKS(BERcodec_INTEGER):
+ tag = ASN1_Class_UNIVERSAL.TIME_TICKS
+
+class BERcodec_COUNTER32(BERcodec_INTEGER):
+ tag = ASN1_Class_UNIVERSAL.COUNTER32
+
+class BERcodec_SEQUENCE(BERcodec_Object):
+ tag = ASN1_Class_UNIVERSAL.SEQUENCE
+ @classmethod
+ def enc(cls, l):
+ if type(l) is not str:
+ l = "".join(map(lambda x: x.enc(cls.codec), l))
+ return chr(cls.tag)+BER_len_enc(len(l))+l
+ @classmethod
+ def do_dec(cls, s, context=None, safe=False):
+ if context is None:
+ context = cls.tag.context
+ l,st = cls.check_type_get_len(s) # we may have len(s) < l
+ s,t = st[:l],st[l:]
+ obj = []
+ while s:
+ try:
+ o,s = BERcodec_Object.dec(s, context, safe)
+ except BER_Decoding_Error, err:
+ print "enrichi %r <- %r %r" % (err.remaining,t,s), obj
+ err.remaining += t
+ if err.decoded is not None:
+ obj.append(err.decoded)
+ err.decoded = obj
+ raise
+ obj.append(o)
+ if len(st) < l:
+ raise BER_Decoding_Error("Not enough bytes to decode sequence", decoded=obj)
+ return cls.asn1_object(obj),t
+
+class BERcodec_SET(BERcodec_SEQUENCE):
+ tag = ASN1_Class_UNIVERSAL.SET
+
+
+class BERcodec_OID(BERcodec_Object):
+ tag = ASN1_Class_UNIVERSAL.OID
+
+ @classmethod
+ def enc(cls, oid):
+ lst = [int(x) for x in oid.strip(".").split(".")]
+ if len(lst) >= 2:
+ lst[1] += 40*lst[0]
+ del(lst[0])
+ s = "".join([BER_num_enc(k) for k in lst])
+ return chr(cls.tag)+BER_len_enc(len(s))+s
+ @classmethod
+ def do_dec(cls, s, context=None, safe=False):
+ l,s,t = cls.check_type_check_len(s)
+ lst = []
+ while s:
+ l,s = BER_num_dec(s)
+ lst.append(l)
+ if (len(lst) > 0):
+ lst.insert(0,lst[0]/40)
+ lst[1] %= 40
+ return cls.asn1_object(".".join([str(k) for k in lst])), t
+
+
+#################
+## MIB parsing ##
+#################
+
+_mib_re_integer = re.compile("^[0-9]+$")
+_mib_re_both = re.compile("^([a-zA-Z_][a-zA-Z0-9_-]*)\(([0-9]+)\)$")
+_mib_re_oiddecl = re.compile("$\s*([a-zA-Z0-9_-]+)\s+OBJECT[^:]+::=\s*\{([^\}]+)\}",re.M)
+_mib_re_strings = re.compile('"[^"]*"')
+_mib_re_comments = re.compile('--.*(\r|\n)')
+
+class MIBDict(DADict):
+ def _findroot(self, x):
+ if x.startswith("."):
+ x = x[1:]
+ if not x.endswith("."):
+ x += "."
+ max=0
+ root="."
+ for k in self.keys():
+ if x.startswith(self[k]+"."):
+ if max < len(self[k]):
+ max = len(self[k])
+ root = k
+ return root, x[max:-1]
+ def _oidname(self, x):
+ root,remainder = self._findroot(x)
+ return root+remainder
+ def _oid(self, x):
+ xl = x.strip(".").split(".")
+ p = len(xl)-1
+ while p >= 0 and _mib_re_integer.match(xl[p]):
+ p -= 1
+ if p != 0 or xl[p] not in self:
+ return x
+ xl[p] = self[xl[p]]
+ return ".".join(xl[p:])
+ def _make_graph(self, other_keys=[], **kargs):
+ nodes = [(k,self[k]) for k in self.keys()]
+ oids = [self[k] for k in self.keys()]
+ for k in other_keys:
+ if k not in oids:
+ nodes.append(self.oidname(k),k)
+ s = 'digraph "mib" {\n\trankdir=LR;\n\n'
+ for k,o in nodes:
+ s += '\t"%s" [ label="%s" ];\n' % (o,k)
+ s += "\n"
+ for k,o in nodes:
+ parent,remainder = self._findroot(o[:-1])
+ remainder = remainder[1:]+o[-1]
+ if parent != ".":
+ parent = self[parent]
+ s += '\t"%s" -> "%s" [label="%s"];\n' % (parent, o,remainder)
+ s += "}\n"
+ do_graph(s, **kargs)
+
+
+def mib_register(ident, value, the_mib, unresolved):
+ if ident in the_mib or ident in unresolved:
+ return ident in the_mib
+ resval = []
+ not_resolved = 0
+ for v in value:
+ if _mib_re_integer.match(v):
+ resval.append(v)
+ else:
+ v = fixname(v)
+ if v not in the_mib:
+ not_resolved = 1
+ if v in the_mib:
+ v = the_mib[v]
+ elif v in unresolved:
+ v = unresolved[v]
+ if type(v) is list:
+ resval += v
+ else:
+ resval.append(v)
+ if not_resolved:
+ unresolved[ident] = resval
+ return False
+ else:
+ the_mib[ident] = resval
+ keys = unresolved.keys()
+ i = 0
+ while i < len(keys):
+ k = keys[i]
+ if mib_register(k,unresolved[k], the_mib, {}):
+ del(unresolved[k])
+ del(keys[i])
+ i = 0
+ else:
+ i += 1
+
+ return True
+
+
+def load_mib(filenames):
+ the_mib = {'iso': ['1']}
+ unresolved = {}
+ for k in conf.mib.keys():
+ mib_register(k, conf.mib[k].split("."), the_mib, unresolved)
+
+ if type(filenames) is str:
+ filenames = [filenames]
+ for fnames in filenames:
+ for fname in glob(fnames):
+ f = open(fname)
+ text = f.read()
+ cleantext = " ".join(_mib_re_strings.split(" ".join(_mib_re_comments.split(text))))
+ for m in _mib_re_oiddecl.finditer(cleantext):
+ ident,oid = m.groups()
+ ident=fixname(ident)
+ oid = oid.split()
+ for i in range(len(oid)):
+ m = _mib_re_both.match(oid[i])
+ if m:
+ oid[i] = m.groups()[1]
+ mib_register(ident, oid, the_mib, unresolved)
+
+ newmib = MIBDict(_name="MIB")
+ for k,o in the_mib.iteritems():
+ newmib[k]=".".join(o)
+ for k,o in unresolved.iteritems():
+ newmib[k]=".".join(o)
+
+ conf.mib=newmib
+
+
+
+################
+## Generators ##
+################
+
+class Gen(object):
+ def __iter__(self):
+ return iter([])
+
+class SetGen(Gen):
+ def __init__(self, set, _iterpacket=1):
+ self._iterpacket=_iterpacket
+ if type(set) is list:
+ self.set = set
+ elif isinstance(set, PacketList):
+ self.set = list(set)
+ else:
+ self.set = [set]
+ def transf(self, element):
+ return element
+ def __iter__(self):
+ for i in self.set:
+ if (type(i) is tuple) and (len(i) == 2) and type(i[0]) is int and type(i[1]) is int:
+ if (i[0] <= i[1]):
+ j=i[0]
+ while j <= i[1]:
+ yield j
+ j += 1
+ elif isinstance(i, Gen) and (self._iterpacket or not isinstance(i,Packet)):
+ for j in i:
+ yield j
+ else:
+ yield i
+ def __repr__(self):
+ return "<SetGen %s>" % self.set.__repr__()
+
+class Net(Gen):
+ """Generate a list of IPs from a network address or a name"""
+ name = "ip"
+ ipaddress = re.compile(r"^(\*|[0-2]?[0-9]?[0-9](-[0-2]?[0-9]?[0-9])?)\.(\*|[0-2]?[0-9]?[0-9](-[0-2]?[0-9]?[0-9])?)\.(\*|[0-2]?[0-9]?[0-9](-[0-2]?[0-9]?[0-9])?)\.(\*|[0-2]?[0-9]?[0-9](-[0-2]?[0-9]?[0-9])?)(/[0-3]?[0-9])?$")
+ def __init__(self, net):
+ self.repr=net
+
+ tmp=net.split('/')+["32"]
+ if not self.ipaddress.match(net):
+ tmp[0]=socket.gethostbyname(tmp[0])
+ netmask = int(tmp[1])
+
+ def parse_digit(a,netmask):
+ netmask = min(8,max(netmask,0))
+ if a == "*":
+ a = (0,256)
+ elif a.find("-") >= 0:
+ x,y = map(int,a.split("-"))
+ if x > y:
+ y = x
+ a = (x & (0xffL<<netmask) , max(y, (x | (0xffL>>(8-netmask))))+1)
+ else:
+ a = (int(a) & (0xffL<<netmask),(int(a) | (0xffL>>(8-netmask)))+1)
+ return a
+
+ self.parsed = map(lambda x,y: parse_digit(x,y), tmp[0].split("."), map(lambda x,nm=netmask: x-nm, (8,16,24,32)))
+
+ def __iter__(self):
+ for d in xrange(*self.parsed[3]):
+ for c in xrange(*self.parsed[2]):
+ for b in xrange(*self.parsed[1]):
+ for a in xrange(*self.parsed[0]):
+ yield "%i.%i.%i.%i" % (a,b,c,d)
+ def choice(self):
+ ip = []
+ for v in self.parsed:
+ ip.append(str(random.randint(v[0],v[1]-1)))
+ return ".".join(ip)
+
+ def __repr__(self):
+ return "Net(%r)" % self.repr
+
+class OID(Gen):
+ name = "OID"
+ def __init__(self, oid):
+ self.oid = oid
+ self.cmpt = []
+ fmt = []
+ for i in oid.split("."):
+ if "-" in i:
+ fmt.append("%i")
+ self.cmpt.append(tuple(map(int, i.split("-"))))
+ else:
+ fmt.append(i)
+ self.fmt = ".".join(fmt)
+ def __repr__(self):
+ return "OID(%r)" % self.oid
+ def __iter__(self):
+ ii = [k[0] for k in self.cmpt]
+ while 1:
+ yield self.fmt % tuple(ii)
+ i = 0
+ while 1:
+ if i >= len(ii):
+ raise StopIteration
+ if ii[i] < self.cmpt[i][1]:
+ ii[i]+=1
+ break
+ else:
+ ii[i] = self.cmpt[i][0]
+ i += 1
+
+
+#############
+## Results ##
+#############
+
+class PacketList:
+ res = []
+ def __init__(self, res=None, name="PacketList", stats=None):
+ """create a packet list from a list of packets
+ res: the list of packets
+ stats: a list of classes that will appear in the stats (defaults to [TCP,UDP,ICMP])"""
+ if stats is None:
+ stats = [ TCP,UDP,ICMP ]
+ self.stats = stats
+ if res is None:
+ res = []
+ if isinstance(res, PacketList):
+ res = res.res
+ self.res = res
+ self.listname = name
+ def _elt2pkt(self, elt):
+ return elt
+ def _elt2sum(self, elt):
+ return elt.summary()
+ def _elt2show(self, elt):
+ return self._elt2sum(elt)
+ def __repr__(self):
+# stats=dict.fromkeys(self.stats,0) ## needs python >= 2.3 :(
+ stats = dict(map(lambda x: (x,0), self.stats))
+ other = 0
+ for r in self.res:
+ f = 0
+ for p in stats:
+ if self._elt2pkt(r).haslayer(p):
+ stats[p] += 1
+ f = 1
+ break
+ if not f:
+ other += 1
+ s = ""
+ ct = conf.color_theme
+ for p in stats:
+ s += " %s%s%s" % (ct.packetlist_proto(p.name),
+ ct.punct(":"),
+ ct.packetlist_value(stats[p]))
+ s += " %s%s%s" % (ct.packetlist_proto("Other"),
+ ct.punct(":"),
+ ct.packetlist_value(other))
+ return "%s%s%s%s%s" % (ct.punct("<"),
+ ct.packetlist_name(self.listname),
+ ct.punct(":"),
+ s,
+ ct.punct(">"))
+ def __getattr__(self, attr):
+ return getattr(self.res, attr)
+ def __getitem__(self, item):
+ if isinstance(item,type) and issubclass(item,Packet):
+ return self.__class__(filter(lambda x: item in self._elt2pkt(x),self.res),
+ name="%s from %s"%(item.__name__,self.listname))
+ if type(item) is slice:
+ return self.__class__(self.res.__getitem__(item),
+ name = "mod %s" % self.listname)
+ return self.res.__getitem__(item)
+ def __getslice__(self, *args, **kargs):
+ return self.__class__(self.res.__getslice__(*args, **kargs),
+ name="mod %s"%self.listname)
+ def __add__(self, other):
+ return self.__class__(self.res+other.res,
+ name="%s+%s"%(self.listname,other.listname))
+ def summary(self, prn=None, lfilter=None):
+ """prints a summary of each packet
+prn: function to apply to each packet instead of lambda x:x.summary()
+lfilter: truth function to apply to each packet to decide whether it will be displayed"""
+ for r in self.res:
+ if lfilter is not None:
+ if not lfilter(r):
+ continue
+ if prn is None:
+ print self._elt2sum(r)
+ else:
+ print prn(r)
+ def nsummary(self,prn=None, lfilter=None):
+ """prints a summary of each packet with the packet's number
+prn: function to apply to each packet instead of lambda x:x.summary()
+lfilter: truth function to apply to each packet to decide whether it will be displayed"""
+ for i in range(len(self.res)):
+ if lfilter is not None:
+ if not lfilter(self.res[i]):
+ continue
+ print conf.color_theme.id(i,"%04i"),
+ if prn is None:
+ print self._elt2sum(self.res[i])
+ else:
+ print prn(self.res[i])
+ def display(self): # Deprecated. Use show()
+ """deprecated. is show()"""
+ self.show()
+ def show(self, *args, **kargs):
+ """Best way to display the packet list. Defaults to nsummary() method"""
+ return self.nsummary(*args, **kargs)
+
+ def filter(self, func):
+ """Returns a packet list filtered by a truth function"""
+ return self.__class__(filter(func,self.res),
+ name="filtered %s"%self.listname)
+ def make_table(self, *args, **kargs):
+ """Prints a table using a function that returs for each packet its head column value, head row value and displayed value
+ ex: p.make_table(lambda x:(x[IP].dst, x[TCP].dport, x[TCP].sprintf("%flags%")) """
+ return make_table(self.res, *args, **kargs)
+ def make_lined_table(self, *args, **kargs):
+ """Same as make_table, but print a table with lines"""
+ return make_lined_table(self.res, *args, **kargs)
+ def make_tex_table(self, *args, **kargs):
+ """Same as make_table, but print a table with LaTeX syntax"""
+ return make_tex_table(self.res, *args, **kargs)
+
+ def plot(self, f, lfilter=None,**kargs):
+ """Applies a function to each packet to get a value that will be plotted with GnuPlot. A gnuplot object is returned
+ lfilter: a truth function that decides whether a packet must be ploted"""
+ g=Gnuplot.Gnuplot()
+ l = self.res
+ if lfilter is not None:
+ l = filter(lfilter, l)
+ l = map(f,l)
+ g.plot(Gnuplot.Data(l, **kargs))
+ return g
+
+ def diffplot(self, f, delay=1, lfilter=None, **kargs):
+ """diffplot(f, delay=1, lfilter=None)
+ Applies a function to couples (l[i],l[i+delay])"""
+ g = Gnuplot.Gnuplot()
+ l = self.res
+ if lfilter is not None:
+ l = filter(lfilter, l)
+ l = map(f,l[:-delay],l[delay:])
+ g.plot(Gnuplot.Data(l, **kargs))
+ return g
+
+ def multiplot(self, f, lfilter=None, **kargs):
+ """Uses a function that returns a label and a value for this label, then plots all the values label by label"""
+ g=Gnuplot.Gnuplot()
+ l = self.res
+ if lfilter is not None:
+ l = filter(lfilter, l)
+
+ d={}
+ for e in l:
+ k,v = f(e)
+ if k in d:
+ d[k].append(v)
+ else:
+ d[k] = [v]
+ data=[]
+ for k in d:
+ data.append(Gnuplot.Data(d[k], title=k, **kargs))
+
+ g.plot(*data)
+ return g
+
+
+ def rawhexdump(self):
+ """Prints an hexadecimal dump of each packet in the list"""
+ for p in self:
+ hexdump(self._elt2pkt(p))
+
+ def hexraw(self, lfilter=None):
+ """Same as nsummary(), except that if a packet has a Raw layer, it will be hexdumped
+ lfilter: a truth function that decides whether a packet must be displayed"""
+ for i in range(len(self.res)):
+ p = self._elt2pkt(self.res[i])
+ if lfilter is not None and not lfilter(p):
+ continue
+ print "%s %s %s" % (conf.color_theme.id(i,"%04i"),
+ p.sprintf("%.time%"),
+ self._elt2sum(self.res[i]))
+ if p.haslayer(Raw):
+ hexdump(p.getlayer(Raw).load)
+
+ def hexdump(self, lfilter=None):
+ """Same as nsummary(), except that packets are also hexdumped
+ lfilter: a truth function that decides whether a packet must be displayed"""
+ for i in range(len(self.res)):
+ p = self._elt2pkt(self.res[i])
+ if lfilter is not None and not lfilter(p):
+ continue
+ print "%s %s %s" % (conf.color_theme.id(i,"%04i"),
+ p.sprintf("%.time%"),
+ self._elt2sum(self.res[i]))
+ hexdump(p)
+
+ def padding(self, lfilter=None):
+ """Same as hexraw(), for Padding layer"""
+ for i in range(len(self.res)):
+ p = self._elt2pkt(self.res[i])
+ if p.haslayer(Padding):
+ if lfilter is None or lfilter(p):
+ print "%s %s %s" % (conf.color_theme.id(i,"%04i"),
+ p.sprintf("%.time%"),
+ self._elt2sum(self.res[i]))
+ hexdump(p.getlayer(Padding).load)
+
+ def nzpadding(self, lfilter=None):
+ """Same as padding() but only non null padding"""
+ for i in range(len(self.res)):
+ p = self._elt2pkt(self.res[i])
+ if p.haslayer(Padding):
+ pad = p.getlayer(Padding).load
+ if pad == pad[0]*len(pad):
+ continue
+ if lfilter is None or lfilter(p):
+ print "%s %s %s" % (conf.color_theme.id(i,"%04i"),
+ p.sprintf("%.time%"),
+ self._elt2sum(self.res[i]))
+ hexdump(p.getlayer(Padding).load)
+
+
+ def conversations(self, getsrcdst=None,**kargs):
+ """Graphes a conversations between sources and destinations and display it
+ (using graphviz and imagemagick)
+ getsrcdst: a function that takes an element of the list and return the source and dest
+ by defaults, return source and destination IP
+ type: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
+ target: filename or redirect. Defaults pipe to Imagemagick's display program
+ prog: which graphviz program to use"""
+ if getsrcdst is None:
+ getsrcdst = lambda x:(x[IP].src, x[IP].dst)
+ conv = {}
+ for p in self.res:
+ p = self._elt2pkt(p)
+ try:
+ c = getsrcdst(p)
+ except:
+ #XXX warning()
+ continue
+ conv[c] = conv.get(c,0)+1
+ gr = 'digraph "conv" {\n'
+ for s,d in conv:
+ gr += '\t "%s" -> "%s"\n' % (s,d)
+ gr += "}\n"
+ return do_graph(gr, **kargs)
+
+ def afterglow(self, src=None, event=None, dst=None, **kargs):
+ """Experimental clone attempt of http://sourceforge.net/projects/afterglow
+ each datum is reduced as src -> event -> dst and the data are graphed.
+ by default we have IP.src -> IP.dport -> IP.dst"""
+ if src is None:
+ src = lambda x: x[IP].src
+ if event is None:
+ event = lambda x: x[IP].dport
+ if dst is None:
+ dst = lambda x: x[IP].dst
+ sl = {}
+ el = {}
+ dl = {}
+ for i in self.res:
+ try:
+ s,e,d = src(i),event(i),dst(i)
+ if s in sl:
+ n,l = sl[s]
+ n += 1
+ if e not in l:
+ l.append(e)
+ sl[s] = (n,l)
+ else:
+ sl[s] = (1,[e])
+ if e in el:
+ n,l = el[e]
+ n+=1
+ if d not in l:
+ l.append(d)
+ el[e] = (n,l)
+ else:
+ el[e] = (1,[d])
+ dl[d] = dl.get(d,0)+1
+ except:
+ continue
+
+ import math
+ def normalize(n):
+ return 2+math.log(n)/4.0
+
+ def minmax(x):
+ m,M = min(x),max(x)
+ if m == M:
+ m = 0
+ if M == 0:
+ M = 1
+ return m,M
+
+ mins,maxs = minmax(map(lambda (x,y): x, sl.values()))
+ mine,maxe = minmax(map(lambda (x,y): x, el.values()))
+ mind,maxd = minmax(dl.values())
+
+ gr = 'digraph "afterglow" {\n\tedge [len=2.5];\n'
+
+ gr += "# src nodes\n"
+ for s in sl:
+ n,l = sl[s]; n = 1+float(n-mins)/(maxs-mins)
+ gr += '"src.%s" [label = "%s", shape=box, fillcolor="#FF0000", style=filled, fixedsize=1, height=%.2f,width=%.2f];\n' % (`s`,`s`,n,n)
+ gr += "# event nodes\n"
+ for e in el:
+ n,l = el[e]; n = n = 1+float(n-mine)/(maxe-mine)
+ gr += '"evt.%s" [label = "%s", shape=circle, fillcolor="#00FFFF", style=filled, fixedsize=1, height=%.2f, width=%.2f];\n' % (`e`,`e`,n,n)
+ for d in dl:
+ n = dl[d]; n = n = 1+float(n-mind)/(maxd-mind)
+ gr += '"dst.%s" [label = "%s", shape=triangle, fillcolor="#0000ff", style=filled, fixedsize=1, height=%.2f, width=%.2f];\n' % (`d`,`d`,n,n)
+
+ gr += "###\n"
+ for s in sl:
+ n,l = sl[s]
+ for e in l:
+ gr += ' "src.%s" -> "evt.%s";\n' % (`s`,`e`)
+ for e in el:
+ n,l = el[e]
+ for d in l:
+ gr += ' "evt.%s" -> "dst.%s";\n' % (`e`,`d`)
+
+ gr += "}"
+ open("/tmp/aze","w").write(gr)
+ return do_graph(gr, **kargs)
+
+
+
+ def timeskew_graph(self, ip, **kargs):
+ """Tries to graph the timeskew between the timestamps and real time for a given ip"""
+ res = map(lambda x: self._elt2pkt(x), self.res)
+ b = filter(lambda x:x.haslayer(IP) and x.getlayer(IP).src == ip and x.haslayer(TCP), res)
+ c = []
+ for p in b:
+ opts = p.getlayer(TCP).options
+ for o in opts:
+ if o[0] == "Timestamp":
+ c.append((p.time,o[1][0]))
+ if not c:
+ warning("No timestamps found in packet list")
+ return
+ d = map(lambda (x,y): (x%2000,((x-c[0][0])-((y-c[0][1])/1000.0))),c)
+ g = Gnuplot.Gnuplot()
+ g.plot(Gnuplot.Data(d,**kargs))
+ return g
+
+ def _dump_document(self, **kargs):
+ d = pyx.document.document()
+ l = len(self.res)
+ for i in range(len(self.res)):
+ elt = self.res[i]
+ c = self._elt2pkt(elt).canvas_dump(**kargs)
+ cbb = c.bbox()
+ c.text(cbb.left(),cbb.top()+1,r"\font\cmssfont=cmss12\cmssfont{Frame %i/%i}" % (i,l),[pyx.text.size.LARGE])
+ if conf.verb >= 2:
+ os.write(1,".")
+ d.append(pyx.document.page(c, paperformat=pyx.document.paperformat.A4,
+ margin=1*pyx.unit.t_cm,
+ fittosize=1))
+ return d
+
+
+
+ def psdump(self, filename = None, **kargs):
+ """Creates a multipage poscript file with a psdump of every packet
+ filename: name of the file to write to. If empty, a temporary file is used and
+ conf.prog.psreader is called"""
+ d = self._dump_document(**kargs)
+ if filename is None:
+ filename = "/tmp/scapy.psd.%i" % os.getpid()
+ d.writePSfile(filename)
+ os.system("%s %s.ps &" % (conf.prog.psreader,filename))
+ else:
+ d.writePSfile(filename)
+ print
+
+ def pdfdump(self, filename = None, **kargs):
+ """Creates a PDF file with a psdump of every packet
+ filename: name of the file to write to. If empty, a temporary file is used and
+ conf.prog.pdfreader is called"""
+ d = self._dump_document(**kargs)
+ if filename is None:
+ filename = "/tmp/scapy.psd.%i" % os.getpid()
+ d.writePDFfile(filename)
+ os.system("%s %s.pdf &" % (conf.prog.pdfreader,filename))
+ else:
+ d.writePDFfile(filename)
+ print
+
+ def sr(self,multi=0):
+ """sr([multi=1]) -> (SndRcvList, PacketList)
+ Matches packets in the list and return ( (matched couples), (unmatched packets) )"""
+ remain = self.res[:]
+ sr = []
+ i = 0
+ while i < len(remain):
+ s = remain[i]
+ j = i
+ while j < len(remain)-1:
+ j += 1
+ r = remain[j]
+ if r.answers(s):
+ sr.append((s,r))
+ if multi:
+ remain[i]._answered=1
+ remain[j]._answered=2
+ continue
+ del(remain[j])
+ del(remain[i])
+ i -= 1
+ break
+ i += 1
+ if multi:
+ remain = filter(lambda x:not hasattr(x,"_answered"), remain)
+ return SndRcvList(sr),PacketList(remain)
+
+
+
+
+
+
+class Dot11PacketList(PacketList):
+ def __init__(self, res=None, name="Dot11List", stats=None):
+ if stats is None:
+ stats = [Dot11WEP, Dot11Beacon, UDP, ICMP, TCP]
+
+ PacketList.__init__(self, res, name, stats)
+ def toEthernet(self):
+ data = map(lambda x:x.getlayer(Dot11), filter(lambda x : x.haslayer(Dot11) and x.type == 2, self.res))
+ r2 = []
+ for p in data:
+ q = p.copy()
+ q.unwep()
+ r2.append(Ether()/q.payload.payload.payload) #Dot11/LLC/SNAP/IP
+ return PacketList(r2,name="Ether from %s"%self.listname)
+
+
+
+class SndRcvList(PacketList):
+ def __init__(self, res=None, name="Results", stats=None):
+ PacketList.__init__(self, res, name, stats)
+ def _elt2pkt(self, elt):
+ return elt[1]
+ def _elt2sum(self, elt):
+ return "%s ==> %s" % (elt[0].summary(),elt[1].summary())
+
+
+class ARPingResult(SndRcvList):
+ def __init__(self, res=None, name="ARPing", stats=None):
+ PacketList.__init__(self, res, name, stats)
+
+ def show(self):
+ for s,r in self.res:
+ print r.sprintf("%Ether.src% %ARP.psrc%")
+
+
+class AS_resolver:
+ server = None
+ options = "-k"
+ def __init__(self, server=None, port=43, options=None):
+ if server is not None:
+ self.server = server
+ self.port = port
+ if options is not None:
+ self.options = options
+
+ def _start(self):
+ self.s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ self.s.connect((self.server,self.port))
+ if self.options:
+ self.s.send(self.options+"\n")
+ self.s.recv(8192)
+ def _stop(self):
+ self.s.close()
+
+ def _parse_whois(self, txt):
+ asn,desc = None,""
+ for l in txt.splitlines():
+ if not asn and l.startswith("origin:"):
+ asn = l[7:].strip()
+ if l.startswith("descr:"):
+ if desc:
+ desc += r"\n"
+ desc += l[6:].strip()
+ if asn is not None and desc:
+ break
+ return asn,desc.strip()
+
+ def _resolve_one(self, ip):
+ self.s.send("%s\n" % ip)
+ x = ""
+ while not ("%" in x or "source" in x):
+ x += self.s.recv(8192)
+ asn, desc = self._parse_whois(x)
+ return ip,asn,desc
+ def resolve(self, *ips):
+ self._start()
+ ret = []
+ for ip in ips:
+ ip,asn,desc = self._resolve_one(ip)
+ if asn is not None:
+ ret.append((ip,asn,desc))
+ self._stop()
+ return ret
+
+class AS_resolver_riswhois(AS_resolver):
+ server = "riswhois.ripe.net"
+ options = "-k -M -1"
+
+
+class AS_resolver_radb(AS_resolver):
+ server = "whois.ra.net"
+ options = "-k -M"
+
+
+class AS_resolver_cymru(AS_resolver):
+ server = "whois.cymru.com"
+ options = None
+ def resolve(self, *ips):
+ ASNlist = []
+ s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
+ s.connect((self.server,self.port))
+ s.send("begin\r\n"+"\r\n".join(ips)+"\r\nend\r\n")
+ r = ""
+ while 1:
+ l = s.recv(8192)
+ if l == "":
+ break
+ r += l
+ s.close()
+ for l in r.splitlines()[1:]:
+ if "|" not in l:
+ continue
+ asn,ip,desc = map(str.strip, l.split("|"))
+ if asn == "NA":
+ continue
+ asn = int(asn)
+ ASNlist.append((ip,asn,desc))
+ return ASNlist
+
+class AS_resolver_multi(AS_resolver):
+ resolvers_list = ( AS_resolver_cymru(),AS_resolver_riswhois(),AS_resolver_radb() )
+ def __init__(self, *reslist):
+ if reslist:
+ self.resolvers_list = reslist
+ def resolve(self, *ips):
+ todo = ips
+ ret = []
+ for ASres in self.resolvers_list:
+ res = ASres.resolve(*todo)
+ resolved = [ ip for ip,asn,desc in res ]
+ todo = [ ip for ip in todo if ip not in resolved ]
+ ret += res
+ return ret
+
+
+
+class TracerouteResult(SndRcvList):
+ def __init__(self, res=None, name="Traceroute", stats=None):
+ PacketList.__init__(self, res, name, stats)
+ self.graphdef = None
+ self.graphASres = 0
+ self.padding = 0
+ self.hloc = None
+ self.nloc = None
+
+ def show(self):
+ return self.make_table(lambda (s,r): (s.sprintf("%IP.dst%:{TCP:tcp%ir,TCP.dport%}{UDP:udp%ir,UDP.dport%}{ICMP:ICMP}"),
+ s.ttl,
+ r.sprintf("%-15s,IP.src% {TCP:%TCP.flags%}{ICMP:%ir,ICMP.type%}")))
+
+
+ def get_trace(self):
+ trace = {}
+ for s,r in self.res:
+ if IP not in s:
+ continue
+ d = s[IP].dst
+ if d not in trace:
+ trace[d] = {}
+ trace[d][s[IP].ttl] = r[IP].src, ICMP not in r
+ for k in trace.values():
+ m = filter(lambda x:k[x][1], k.keys())
+ if not m:
+ continue
+ m = min(m)
+ for l in k.keys():
+ if l > m:
+ del(k[l])
+ return trace
+
+ def trace3D(self):
+ """Give a 3D representation of the traceroute.
+ right button: rotate the scene
+ middle button: zoom
+ left button: move the scene
+ left button on a ball: toggle IP displaying
+ ctrl-left button on a ball: scan ports 21,22,23,25,80 and 443 and display the result"""
+ trace = self.get_trace()
+ import visual
+
+ class IPsphere(visual.sphere):
+ def __init__(self, ip, **kargs):
+ visual.sphere.__init__(self, **kargs)
+ self.ip=ip
+ self.label=None
+ self.setlabel(self.ip)
+ def setlabel(self, txt,visible=None):
+ if self.label is not None:
+ if visible is None:
+ visible = self.label.visible
+ self.label.visible = 0
+ elif visible is None:
+ visible=0
+ self.label=visual.label(text=txt, pos=self.pos, space=self.radius, xoffset=10, yoffset=20, visible=visible)
+ def action(self):
+ self.label.visible ^= 1
+
+ visual.scene = visual.display()
+ visual.scene.exit_on_close(0)
+ start = visual.box()
+ rings={}
+ tr3d = {}
+ for i in trace:
+ tr = trace[i]
+ tr3d[i] = []
+ ttl = tr.keys()
+ for t in range(1,max(ttl)+1):
+ if t not in rings:
+ rings[t] = []
+ if t in tr:
+ if tr[t] not in rings[t]:
+ rings[t].append(tr[t])
+ tr3d[i].append(rings[t].index(tr[t]))
+ else:
+ rings[t].append(("unk",-1))
+ tr3d[i].append(len(rings[t])-1)
+ for t in rings:
+ r = rings[t]
+ l = len(r)
+ for i in range(l):
+ if r[i][1] == -1:
+ col = (0.75,0.75,0.75)
+ elif r[i][1]:
+ col = visual.color.green
+ else:
+ col = visual.color.blue
+
+ s = IPsphere(pos=((l-1)*visual.cos(2*i*visual.pi/l),(l-1)*visual.sin(2*i*visual.pi/l),2*t),
+ ip = r[i][0],
+ color = col)
+ for trlst in tr3d.values():
+ if t <= len(trlst):
+ if trlst[t-1] == i:
+ trlst[t-1] = s
+ forecol = colgen(0.625, 0.4375, 0.25, 0.125)
+ for trlst in tr3d.values():
+ col = forecol.next()
+ start = (0,0,0)
+ for ip in trlst:
+ visual.cylinder(pos=start,axis=ip.pos-start,color=col,radius=0.2)
+ start = ip.pos
+
+ movcenter=None
+ while 1:
+ if visual.scene.kb.keys:
+ k = visual.scene.kb.getkey()
+ if k == "esc":
+ break
+ if visual.scene.mouse.events:
+ ev = visual.scene.mouse.getevent()
+ if ev.press == "left":
+ o = ev.pick
+ if o:
+ if ev.ctrl:
+ if o.ip == "unk":
+ continue
+ savcolor = o.color
+ o.color = (1,0,0)
+ a,b=sr(IP(dst=o.ip)/TCP(dport=[21,22,23,25,80,443]),timeout=2)
+ o.color = savcolor
+ if len(a) == 0:
+ txt = "%s:\nno results" % o.ip
+ else:
+ txt = "%s:\n" % o.ip
+ for s,r in a:
+ txt += r.sprintf("{TCP:%IP.src%:%TCP.sport% %TCP.flags%}{TCPerror:%IPerror.dst%:%TCPerror.dport% %IP.src% %ir,ICMP.type%}\n")
+ o.setlabel(txt, visible=1)
+ else:
+ if hasattr(o, "action"):
+ o.action()
+ elif ev.drag == "left":
+ movcenter = ev.pos
+ elif ev.drop == "left":
+ movcenter = None
+ if movcenter:
+ visual.scene.center -= visual.scene.mouse.pos-movcenter
+ movcenter = visual.scene.mouse.pos
+
+
+ def world_trace(self):
+ ips = {}
+ rt = {}
+ ports_done = {}
+ for s,r in self.res:
+ ips[r.src] = None
+ if s.haslayer(TCP) or s.haslayer(UDP):
+ trace_id = (s.src,s.dst,s.proto,s.dport)
+ elif s.haslayer(ICMP):
+ trace_id = (s.src,s.dst,s.proto,s.type)
+ else:
+ trace_id = (s.src,s.dst,s.proto,0)
+ trace = rt.get(trace_id,{})
+ if not r.haslayer(ICMP) or r.type != 11:
+ if ports_done.has_key(trace_id):
+ continue
+ ports_done[trace_id] = None
+ trace[s.ttl] = r.src
+ rt[trace_id] = trace
+
+ trt = {}
+ for trace_id in rt:
+ trace = rt[trace_id]
+ loctrace = []
+ for i in range(max(trace.keys())):
+ ip = trace.get(i,None)
+ if ip is None:
+ continue
+ loc = locate_ip(ip)
+ if loc is None:
+ continue
+# loctrace.append((ip,loc)) # no labels yet
+ loctrace.append(loc)
+ if loctrace:
+ trt[trace_id] = loctrace
+
+ tr = map(lambda x: Gnuplot.Data(x,with="lines"), trt.values())
+ g = Gnuplot.Gnuplot()
+ world = Gnuplot.File(conf.gnuplot_world,with="lines")
+ g.plot(world,*tr)
+ return g
+
+ def make_graph(self,ASres=None,padding=0):
+ if ASres is None:
+ ASres = conf.AS_resolver
+ self.graphASres = ASres
+ self.graphpadding = padding
+ ips = {}
+ rt = {}
+ ports = {}
+ ports_done = {}
+ for s,r in self.res:
+ r = r[IP] or r[IPv6] or r
+ s = s[IP] or s[IPv6] or s
+ ips[r.src] = None
+ if TCP in s:
+ trace_id = (s.src,s.dst,6,s.dport)
+ elif UDP in s:
+ trace_id = (s.src,s.dst,17,s.dport)
+ elif ICMP in s:
+ trace_id = (s.src,s.dst,1,s.type)
+ else:
+ trace_id = (s.src,s.dst,s.proto,0)
+ trace = rt.get(trace_id,{})
+ ttl = IPv6 in s and s.hlim or s.ttl
+ if not (ICMP in r and r[ICMP].type == 11) and not (IPv6 in r and ICMPv6TimeExceeded in r):
+ if trace_id in ports_done:
+ continue
+ ports_done[trace_id] = None
+ p = ports.get(r.src,[])
+ if TCP in r:
+ p.append(r.sprintf("<T%ir,TCP.sport%> %TCP.sport% %TCP.flags%"))
+ trace[ttl] = r.sprintf('"%r,src%":T%ir,TCP.sport%')
+ elif UDP in r:
+ p.append(r.sprintf("<U%ir,UDP.sport%> %UDP.sport%"))
+ trace[ttl] = r.sprintf('"%r,src%":U%ir,UDP.sport%')
+ elif ICMP in r:
+ p.append(r.sprintf("<I%ir,ICMP.type%> ICMP %ICMP.type%"))
+ trace[ttl] = r.sprintf('"%r,src%":I%ir,ICMP.type%')
+ else:
+ p.append(r.sprintf("{IP:<P%ir,proto%> IP %proto%}{IPv6:<P%ir,nh%> IPv6 %nh%}"))
+ trace[ttl] = r.sprintf('"%r,src%":{IP:P%ir,proto%}{IPv6:P%ir,nh%}')
+ ports[r.src] = p
+ else:
+ trace[ttl] = r.sprintf('"%r,src%"')
+ rt[trace_id] = trace
+
+ # Fill holes with unk%i nodes
+ unknown_label = incremental_label("unk%i")
+ blackholes = []
+ bhip = {}
+ for rtk in rt:
+ trace = rt[rtk]
+ k = trace.keys()
+ for n in range(min(k), max(k)):
+ if not trace.has_key(n):
+ trace[n] = unknown_label.next()
+ if not ports_done.has_key(rtk):
+ if rtk[2] == 1: #ICMP
+ bh = "%s %i/icmp" % (rtk[1],rtk[3])
+ elif rtk[2] == 6: #TCP
+ bh = "%s %i/tcp" % (rtk[1],rtk[3])
+ elif rtk[2] == 17: #UDP
+ bh = '%s %i/udp' % (rtk[1],rtk[3])
+ else:
+ bh = '%s %i/proto' % (rtk[1],rtk[2])
+ ips[bh] = None
+ bhip[rtk[1]] = bh
+ bh = '"%s"' % bh
+ trace[max(k)+1] = bh
+ blackholes.append(bh)
+
+ # Find AS numbers
+ ASN_query_list = dict.fromkeys(map(lambda x:x.rsplit(" ",1)[0],ips)).keys()
+ if ASres is None:
+ ASNlist = []
+ else:
+ ASNlist = ASres.resolve(*ASN_query_list)
+
+ ASNs = {}
+ ASDs = {}
+ for ip,asn,desc, in ASNlist:
+ if asn is None:
+ continue
+ iplist = ASNs.get(asn,[])
+ if ip in bhip:
+ if ip in ports:
+ iplist.append(ip)
+ iplist.append(bhip[ip])
+ else:
+ iplist.append(ip)
+ ASNs[asn] = iplist
+ ASDs[asn] = desc
+
+
+ backcolorlist=colgen("60","86","ba","ff")
+ forecolorlist=colgen("a0","70","40","20")
+
+ s = "digraph trace {\n"
+
+ s += "\n\tnode [shape=ellipse,color=black,style=solid];\n\n"
+
+ s += "\n#ASN clustering\n"
+ for asn in ASNs:
+ s += '\tsubgraph cluster_%s {\n' % asn
+ col = backcolorlist.next()
+ s += '\t\tcolor="#%s%s%s";' % col
+ s += '\t\tnode [fillcolor="#%s%s%s",style=filled];' % col
+ s += '\t\tfontsize = 10;'
+ s += '\t\tlabel = "%s\\n[%s]"\n' % (asn,ASDs[asn])
+ for ip in ASNs[asn]:
+
+ s += '\t\t"%s";\n'%ip
+ s += "\t}\n"
+
+
+
+
+ s += "#endpoints\n"
+ for p in ports:
+ s += '\t"%s" [shape=record,color=black,fillcolor=green,style=filled,label="%s|%s"];\n' % (p,p,"|".join(ports[p]))
+
+ s += "\n#Blackholes\n"
+ for bh in blackholes:
+ s += '\t%s [shape=octagon,color=black,fillcolor=red,style=filled];\n' % bh
+
+ if padding:
+ s += "\n#Padding\n"
+ pad={}
+ for snd,rcv in self.res:
+ if rcv.src not in ports and rcv.haslayer(Padding):
+ p = rcv.getlayer(Padding).load
+ if p != "\x00"*len(p):
+ pad[rcv.src]=None
+ for rcv in pad:
+ s += '\t"%s" [shape=triangle,color=black,fillcolor=red,style=filled];\n' % rcv
+
+
+
+ s += "\n\tnode [shape=ellipse,color=black,style=solid];\n\n"
+
+
+ for rtk in rt:
+ s += "#---[%s\n" % `rtk`
+ s += '\t\tedge [color="#%s%s%s"];\n' % forecolorlist.next()
+ trace = rt[rtk]
+ k = trace.keys()
+ for n in range(min(k), max(k)):
+ s += '\t%s ->\n' % trace[n]
+ s += '\t%s;\n' % trace[max(k)]
+
+ s += "}\n";
+ self.graphdef = s
+
+ def graph(self, ASres=None, padding=0, **kargs):
+ """x.graph(ASres=conf.AS_resolver, other args):
+ ASres=None : no AS resolver => no clustering
+ ASres=AS_resolver() : default whois AS resolver (riswhois.ripe.net)
+ ASres=AS_resolver_cymru(): use whois.cymru.com whois database
+ ASres=AS_resolver(server="whois.ra.net")
+ type: output type (svg, ps, gif, jpg, etc.), passed to dot's "-T" option
+ target: filename or redirect. Defaults pipe to Imagemagick's display program
+ prog: which graphviz program to use"""
+ if ASres is None:
+ ASres = conf.AS_resolver
+ if (self.graphdef is None or
+ self.graphASres != ASres or
+ self.graphpadding != padding):
+ self.make_graph(ASres,padding)
+
+ return do_graph(self.graphdef, **kargs)
+
+
+
+
+############
+## Fields ##
+############
+
+class Field:
+ """For more informations on how this work, please refer to
+ http://www.secdev.org/projects/scapy/files/scapydoc.pdf
+ chapter ``Adding a New Field''"""
+ islist=0
+ holds_packets=0
+ def __init__(self, name, default, fmt="H"):
+ self.name = name
+ if fmt[0] in "@=<>!":
+ self.fmt = fmt
+ else:
+ self.fmt = "!"+fmt
+ self.default = self.any2i(None,default)
+ self.sz = struct.calcsize(self.fmt)
+ self.owners = []
+
+ def register_owner(self, cls):
+ self.owners.append(cls)
+
+ def i2len(self, pkt, x):
+ """Convert internal value to a length usable by a FieldLenField"""
+ return self.sz
+ def i2count(self, pkt, x):
+ """Convert internal value to a number of elements usable by a FieldLenField.
+ Always 1 except for list fields"""
+ return 1
+ def h2i(self, pkt, x):
+ """Convert human value to internal value"""
+ return x
+ def i2h(self, pkt, x):
+ """Convert internal value to human value"""
+ return x
+ def m2i(self, pkt, x):
+ """Convert machine value to internal value"""
+ return x
+ def i2m(self, pkt, x):
+ """Convert internal value to machine value"""
+ if x is None:
+ x = 0
+ return x
+ def any2i(self, pkt, x):
+ """Try to understand the most input values possible and make an internal value from them"""
+ return self.h2i(pkt, x)
+ def i2repr(self, pkt, x):
+ """Convert internal value to a nice representation"""
+ if x is None:
+ x = 0
+ return repr(self.i2h(pkt,x))
+ def addfield(self, pkt, s, val):
+ """Add an internal value to a string"""
+ return s+struct.pack(self.fmt, self.i2m(pkt,val))
+ def getfield(self, pkt, s):
+ """Extract an internal value from a string"""
+ return s[self.sz:], self.m2i(pkt, struct.unpack(self.fmt, s[:self.sz])[0])
+ def do_copy(self, x):
+ if hasattr(x, "copy"):
+ return x.copy()
+ if type(x) is list:
+ x = x[:]
+ for i in xrange(len(x)):
+ if isinstance(x[i], Packet):
+ x[i] = x[i].copy()
+ return x
+ def __repr__(self):
+ return "<Field (%s).%s>" % (",".join(x.__name__ for x in self.owners),self.name)
+ def copy(self):
+ return copy.deepcopy(self)
+ def randval(self):
+ """Return a volatile object whose value is both random and suitable for this field"""
+ fmtt = self.fmt[-1]
+ if fmtt in "BHIQ":
+ return {"B":RandByte,"H":RandShort,"I":RandInt, "Q":RandLong}[fmtt]()
+ elif fmtt == "s":
+ if self.fmt[0] in "0123456789":
+ l = int(self.fmt[:-1])
+ else:
+ l = int(self.fmt[1:-1])
+ return RandBin(l)
+ else:
+ warning("no random class for [%s] (fmt=%s)." % (self.name, self.fmt))
+
+
+
+
+class Emph:
+ fld = ""
+ def __init__(self, fld):
+ self.fld = fld
+ def __getattr__(self, attr):
+ return getattr(self.fld,attr)
+ def __hash__(self):
+ return hash(self.fld)
+ def __eq__(self, other):
+ return self.fld == other
+
+
+class ActionField:
+ _fld = None
+ def __init__(self, fld, action_method, **kargs):
+ self._fld = fld
+ self._action_method = action_method
+ self._privdata = kargs
+ def any2i(self, pkt, val):
+ getattr(pkt, self._action_method)(val, self._fld, **self._privdata)
+ return getattr(self._fld, "any2i")(pkt, val)
+ def __getattr__(self, attr):
+ return getattr(self._fld,attr)
+
+
+class ConditionalField:
+ fld = None
+ def __init__(self, fld, cond):
+ self.fld = fld
+ self.cond = cond
+ def _evalcond(self,pkt):
+ return self.cond(pkt)
+
+ def getfield(self, pkt, s):
+ if self._evalcond(pkt):
+ return self.fld.getfield(pkt,s)
+ else:
+ return s,None
+
+ def addfield(self, pkt, s, val):
+ if self._evalcond(pkt):
+ return self.fld.addfield(pkt,s,val)
+ else:
+ return s
+ def __getattr__(self, attr):
+ return getattr(self.fld,attr)
+
+
+class PadField:
+ """Add bytes after the proxified field so that it ends at the specified
+ alignment from its begining"""
+ _fld = None
+ def __init__(self, fld, align, padwith=None):
+ self._fld = fld
+ self._align = align
+ self._padwith = padwith or ""
+
+ def addfield(self, pkt, s, val):
+ sval = self._fld.addfield(pkt, "", val)
+ return s+sval+struct.pack("%is" % (-len(sval)%self._align), self._padwith)
+
+ def __getattr__(self, attr):
+ return getattr(self._fld,attr)
+
+
+class MACField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "6s")
+ def i2m(self, pkt, x):
+ if x is None:
+ return "\0\0\0\0\0\0"
+ return mac2str(x)
+ def m2i(self, pkt, x):
+ return str2mac(x)
+ def any2i(self, pkt, x):
+ if type(x) is str and len(x) is 6:
+ x = self.m2i(pkt, x)
+ return x
+ def i2repr(self, pkt, x):
+ x = self.i2h(pkt, x)
+ if self in conf.resolve:
+ x = conf.manufdb._resolve_MAC(x)
+ return x
+ def randval(self):
+ return RandMAC()
+
+class DestMACField(MACField):
+ def __init__(self, name):
+ MACField.__init__(self, name, None)
+ def i2h(self, pkt, x):
+ if x is None:
+ dstip = None
+ if isinstance(pkt.payload, IPv6):
+ dstip = pkt.payload.dst
+ elif isinstance(pkt.payload, IP):
+ dstip = pkt.payload.dst
+ elif isinstance(pkt.payload, ARP):
+ dstip = pkt.payload.pdst
+ if isinstance(dstip, Gen):
+ dstip = dstip.__iter__().next()
+ if dstip is not None:
+ if isinstance(pkt.payload, IPv6):
+ x = getmacbyip6(dstip)
+ else:
+ x = getmacbyip(dstip)
+ if x is None:
+ x = "ff:ff:ff:ff:ff:ff"
+ warning("Mac address to reach %s not found\n"%dstip)
+ return MACField.i2h(self, pkt, x)
+ def i2m(self, pkt, x):
+ return MACField.i2m(self, pkt, self.i2h(pkt, x))
+
+class SourceMACField(MACField):
+ def __init__(self, name):
+ MACField.__init__(self, name, None)
+ def i2h(self, pkt, x):
+ if x is None:
+ dstip = None
+ if isinstance(pkt.payload, IPv6):
+ dstip = pkt.payload.dst
+ elif isinstance(pkt.payload, IP):
+ dstip = pkt.payload.dst
+ elif isinstance(pkt.payload, ARP):
+ dstip = pkt.payload.pdst
+ if isinstance(dstip, Gen):
+ dstip = dstip.__iter__().next()
+ if dstip is not None:
+ if isinstance(pkt.payload, IPv6):
+ iff,a,nh = conf.route6.route(dstip)
+ else:
+ iff,a,gw = conf.route.route(dstip)
+ try:
+ x = get_if_hwaddr(iff)
+ except:
+ pass
+ if x is None:
+ x = "00:00:00:00:00:00"
+ return MACField.i2h(self, pkt, x)
+ def i2m(self, pkt, x):
+ return MACField.i2m(self, pkt, self.i2h(pkt, x))
+
+class ARPSourceMACField(MACField):
+ def __init__(self, name):
+ MACField.__init__(self, name, None)
+ def i2h(self, pkt, x):
+ if x is None:
+ dstip = pkt.pdst
+ if isinstance(dstip, Gen):
+ dstip = dstip.__iter__().next()
+ if dstip is not None:
+ iff,a,gw = conf.route.route(dstip)
+ try:
+ x = get_if_hwaddr(iff)
+ except:
+ pass
+ if x is None:
+ x = "00:00:00:00:00:00"
+ return MACField.i2h(self, pkt, x)
+ def i2m(self, pkt, x):
+ return MACField.i2m(self, pkt, self.i2h(pkt, x))
+
+class Dot11AddrMACField(MACField):
+ def is_applicable(self, pkt):
+ return 1
+ def addfield(self, pkt, s, val):
+ if self.is_applicable(pkt):
+ return MACField.addfield(self, pkt, s, val)
+ else:
+ return s
+ def getfield(self, pkt, s):
+ if self.is_applicable(pkt):
+ return MACField.getfield(self, pkt, s)
+ else:
+ return s,None
+
+class Dot11Addr2MACField(Dot11AddrMACField):
+ def is_applicable(self, pkt):
+ if pkt.type == 1:
+ return pkt.subtype in [ 0xb, 0xa, 0xe, 0xf] # RTS, PS-Poll, CF-End, CF-End+CF-Ack
+ return 1
+
+class Dot11Addr3MACField(Dot11AddrMACField):
+ def is_applicable(self, pkt):
+ if pkt.type in [0,2]:
+ return 1
+ return 0
+
+class Dot11Addr4MACField(Dot11AddrMACField):
+ def is_applicable(self, pkt):
+ if pkt.type == 2:
+ if pkt.FCfield & 0x3 == 0x3: # To-DS and From-DS are set
+ return 1
+ return 0
+
+class IPField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "4s")
+ def h2i(self, pkt, x):
+ if type(x) is str:
+ try:
+ inet_aton(x)
+ except socket.error:
+ x = Net(x)
+ elif type(x) is list:
+ x = [self.h2i(pkt, n) for n in x]
+ return x
+ def resolve(self, x):
+ if self in conf.resolve:
+ try:
+ ret = socket.gethostbyaddr(x)[0]
+ except:
+ pass
+ else:
+ if ret:
+ return ret
+ return x
+ def i2m(self, pkt, x):
+ return inet_aton(x)
+ def m2i(self, pkt, x):
+ return inet_ntoa(x)
+ def any2i(self, pkt, x):
+ return self.h2i(pkt,x)
+ def i2repr(self, pkt, x):
+ return self.resolve(self.i2h(pkt, x))
+ def randval(self):
+ return RandIP()
+
+class SourceIPField(IPField):
+ def __init__(self, name, dstname):
+ IPField.__init__(self, name, None)
+ self.dstname = dstname
+ def i2m(self, pkt, x):
+ if x is None:
+ iff,x,gw = conf.route.route(getattr(pkt,self.dstname))
+ return IPField.i2m(self, pkt, x)
+ def i2h(self, pkt, x):
+ if x is None:
+ dst=getattr(pkt,self.dstname)
+ if isinstance(dst,Gen):
+ r = map(conf.route.route, dst)
+ r.sort()
+ if r[0] == r[-1]:
+ x=r[0][1]
+ else:
+ warning("More than one possible route for %s"%repr(dst))
+ return None
+ else:
+ iff,x,gw = conf.route.route(dst)
+ return IPField.i2h(self, pkt, x)
+
+
+
+
+class ByteField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "B")
+
+class XByteField(ByteField):
+ def i2repr(self, pkt, x):
+ if x is None:
+ x = 0
+ return lhex(self.i2h(pkt, x))
+
+class X3BytesField(XByteField):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "!I")
+ def addfield(self, pkt, s, val):
+ return s+struct.pack(self.fmt, self.i2m(pkt,val))[1:4]
+ def getfield(self, pkt, s):
+ return s[3:], self.m2i(pkt, struct.unpack(self.fmt, "\x00"+s[:3])[0])
+
+
+class ShortField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "H")
+
+class LEShortField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "<H")
+
+class XShortField(ShortField):
+ def i2repr(self, pkt, x):
+ if x is None:
+ x = 0
+ return lhex(self.i2h(pkt, x))
+
+
+class IntField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "I")
+
+class SignedIntField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "i")
+ def randval(self):
+ return RandSInt()
+
+class LEIntField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "<I")
+
+class LESignedIntField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "<i")
+ def randval(self):
+ return RandSInt()
+
+class XIntField(IntField):
+ def i2repr(self, pkt, x):
+ if x is None:
+ x = 0
+ return lhex(self.i2h(pkt, x))
+
+
+class LongField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "Q")
+
+class XLongField(LongField):
+ def i2repr(self, pkt, x):
+ if x is None:
+ x = 0
+ return lhex(self.i2h(pkt, x))
+
+def FIELD_LENGTH_MANAGEMENT_DEPRECATION(x):
+ try:
+ for tb in traceback.extract_stack()+[("??",-1,None,"")]:
+ f,l,_,line = tb
+ if line.startswith("fields_desc"):
+ break
+ except:
+ f,l="??",-1
+ log_loading.warning("Deprecated use of %s (%s l. %i). See http://trac.secdev.org/scapy/wiki/LengthFields" % (x,f,l))
+
+class StrField(Field):
+ def __init__(self, name, default, fmt="H", remain=0, shift=0):
+ Field.__init__(self,name,default,fmt)
+ self.remain = remain
+ self.shift = shift
+ if shift != 0:
+ FIELD_LENGTH_MANAGEMENT_DEPRECATION(self.__class__.__name__)
+ def i2len(self, pkt, i):
+ return len(i)+self.shift
+ def i2m(self, pkt, x):
+ if x is None:
+ x = ""
+ return x
+ def addfield(self, pkt, s, val):
+ return s+self.i2m(pkt, val)
+ def getfield(self, pkt, s):
+ if self.remain == 0:
+ return "",self.m2i(pkt, s)
+ else:
+ return s[-self.remain:],self.m2i(pkt, s[:-self.remain])
+ def randval(self):
+ return RandBin(RandNum(0,1200))
+
+class PacketField(StrField):
+ holds_packets=1
+ def __init__(self, name, default, cls, remain=0, shift=0):
+ StrField.__init__(self, name, default, remain=remain, shift=shift)
+ self.cls = cls
+ def i2m(self, pkt, i):
+ return str(i)
+ def m2i(self, pkt, m):
+ return self.cls(m)
+ def getfield(self, pkt, s):
+ i = self.m2i(pkt, s)
+ remain = ""
+ if i.haslayer(Padding):
+ r = i.getlayer(Padding)
+ del(r.underlayer.payload)
+ remain = r.load
+ return remain,i
+
+class PacketLenField(PacketField):
+ holds_packets=1
+ def __init__(self, name, default, cls, fld=None, length_from=None, shift=0):
+ PacketField.__init__(self, name, default, cls, shift=shift)
+ self.length_from = length_from
+ if fld is not None or shift != 0:
+ FIELD_LENGTH_MANAGEMENT_DEPRECATION(self.__class__.__name__)
+ self.count_from = lambda pkt,fld=fld,shift=shift: getattr(pkt,fld)-shift
+ def getfield(self, pkt, s):
+ l = self.length_from(pkt)
+ i = self.m2i(pkt, s[:l])
+ return s[l:],i
+
+
+class PacketListField(PacketField):
+ islist = 1
+ holds_packets=1
+ def __init__(self, name, default, cls, fld=None, count_from=None, length_from=None, shift=0):
+ if default is None:
+ default = [] # Create a new list for each instance
+ PacketField.__init__(self, name, default, cls, shift=shift)
+ self.count_from = count_from
+ self.length_from = length_from
+
+ if fld is not None or shift != 0:
+ FIELD_LENGTH_MANAGEMENT_DEPRECATION(self.__class__.__name__)
+ if fld is not None:
+ self.count_from = lambda pkt,fld=fld,shift=shift: getattr(pkt,fld)-shift
+
+ def any2i(self, pkt, x):
+ if type(x) is not list:
+ return [x]
+ else:
+ return x
+ def i2count(self, pkt, val):
+ if type(val) is list:
+ return len(val)
+ return 1
+ def i2len(self, pkt, val):
+ return sum( len(p) for p in val )
+ def do_copy(self, x):
+ return map(lambda p:p.copy(), x)
+ def getfield(self, pkt, s):
+ c = l = None
+ if self.length_from is not None:
+ l = self.length_from(pkt)
+ elif self.count_from is not None:
+ c = self.count_from(pkt)
+
+ lst = []
+ ret = ""
+ remain = s
+ if l is not None:
+ remain,ret = s[:l],s[l:]
+ while remain:
+ if c is not None:
+ if c <= 0:
+ break
+ c -= 1
+ p = self.m2i(pkt,remain)
+ if Padding in p:
+ pad = p[Padding]
+ remain = pad.load
+ del(pad.underlayer.payload)
+ else:
+ remain = ""
+ lst.append(p)
+ return remain+ret,lst
+ def addfield(self, pkt, s, val):
+ return s+"".join(map(str, val))
+
+
+class StrFixedLenField(StrField):
+ def __init__(self, name, default, length=None, length_from=None, shift=0):
+ StrField.__init__(self, name, default, shift=shift)
+ self.length_from = length_from
+ if length is not None:
+ self.length_from = lambda pkt,length=length: length
+ def getfield(self, pkt, s):
+ l = self.length_from(pkt)
+ return s[l:], self.m2i(pkt,s[:l])
+ def addfield(self, pkt, s, val):
+ l = self.length_from(pkt)
+ return s+struct.pack("%is"%l,self.i2m(pkt, val))
+ def randval(self):
+ try:
+ l = self.length_from(None)
+ except:
+ l = RandNum(0,200)
+ return RandBin(l)
+
+class NetBIOSNameField(StrFixedLenField):
+ def __init__(self, name, default, length=31, shift=0):
+ StrFixedLenField.__init__(self, name, default, length, shift=shift)
+ def i2m(self, pkt, x):
+ if x is None:
+ x = ""
+ x += " "*(self.length/2)
+ x = x[:(self.length/2)]
+ x = "".join(map(lambda x: chr(0x41+(ord(x)>>4))+chr(0x41+(ord(x)&0xf)), x))
+ x = " "+x
+ return x
+ def m2i(self, pkt, x):
+ x = x.strip("\x00").strip(" ")
+ return "".join(map(lambda x,y: chr((((ord(x)-1)&0xf)<<4)+((ord(y)-1)&0xf)), x[::2],x[1::2]))
+
+class StrLenField(StrField):
+ def __init__(self, name, default, fld=None, length_from=None, shift=0):
+ StrField.__init__(self, name, default, shift=shift)
+ self.length_from = length_from
+ if fld is not None or shift != 0:
+ FIELD_LENGTH_MANAGEMENT_DEPRECATION(self.__class__.__name__)
+ self.length_from = lambda pkt,fld=fld,shift=shift: getattr(pkt,fld)-shift
+ def getfield(self, pkt, s):
+ l = self.length_from(pkt)
+ return s[l:], self.m2i(pkt,s[:l])
+
+class FieldListField(Field):
+ islist=1
+ def __init__(self, name, default, field, fld=None, shift=0, length_from=None, count_from=None):
+ if default is None:
+ default = [] # Create a new list for each instance
+ Field.__init__(self, name, default)
+ self.count_from = count_from
+ self.length_from = length_from
+ self.field = field
+ if fld is not None or shift != 0:
+ FIELD_LENGTH_MANAGEMENT_DEPRECATION(self.__class__.__name__)
+ self.count_from = lambda pkt,fld=fld,shift=shift: getattr(pkt,fld)-shift
+
+
+ def i2count(self, pkt, val):
+ if type(val) is list:
+ return len(val)
+ return 1
+ def i2len(self, pkt, val):
+ return sum( self.field.i2len(pkt,v) for v in val )
+
+ def i2m(self, pkt, val):
+ if val is None:
+ val = []
+ return val
+ def any2i(self, pkt, x):
+ if type(x) is not list:
+ return [x]
+ else:
+ return x
+ def addfield(self, pkt, s, val):
+ val = self.i2m(pkt, val)
+ for v in val:
+ s = self.field.addfield(pkt, s, v)
+ return s
+ def getfield(self, pkt, s):
+ c = l = None
+ if self.length_from is not None:
+ l = self.length_from(pkt)
+ elif self.count_from is not None:
+ c = self.count_from(pkt)
+
+ val = []
+ ret=""
+ if l is not None:
+ s,ret = s[:l],s[l:]
+
+ while s:
+ if c is not None:
+ if c <= 0:
+ break
+ c -= 1
+ s,v = self.field.getfield(pkt, s)
+ val.append(v)
+ return s+ret, val
+
+class FieldLenField(Field):
+ def __init__(self, name, default, length_of=None, fmt = "H", count_of=None, adjust=lambda pkt,x:x, fld=None):
+ Field.__init__(self, name, default, fmt)
+ self.length_of=length_of
+ self.count_of=count_of
+ self.adjust=adjust
+ if fld is not None:
+ FIELD_LENGTH_MANAGEMENT_DEPRECATION(self.__class__.__name__)
+ self.length_of = fld
+ def i2m(self, pkt, x):
+ if x is None:
+ if self.length_of is not None:
+ fld,fval = pkt.getfield_and_val(self.length_of)
+ f = fld.i2len(pkt, fval)
+ else:
+ fld,fval = pkt.getfield_and_val(self.count_of)
+ f = fld.i2count(pkt, fval)
+ x = self.adjust(pkt,f)
+ return x
+
+# see http://www.iana.org/assignments/ipsec-registry for details
+ISAKMPAttributeTypes= { "Encryption": (1, { "DES-CBC" : 1,
+ "IDEA-CBC" : 2,
+ "Blowfish-CBC" : 3,
+ "RC5-R16-B64-CBC" : 4,
+ "3DES-CBC" : 5,
+ "CAST-CBC" : 6,
+ "AES-CBC" : 7,
+ "CAMELLIA-CBC" : 8, }, 0),
+ "Hash": (2, { "MD5": 1,
+ "SHA": 2,
+ "Tiger": 3,
+ "SHA2-256": 4,
+ "SHA2-384": 5,
+ "SHA2-512": 6,}, 0),
+ "Authentication":(3, { "PSK": 1,
+ "DSS": 2,
+ "RSA Sig": 3,
+ "RSA Encryption": 4,
+ "RSA Encryption Revised": 5,
+ "ElGamal Encryption": 6,
+ "ElGamal Encryption Revised": 7,
+ "ECDSA Sig": 8,
+ "HybridInitRSA": 64221,
+ "HybridRespRSA": 64222,
+ "HybridInitDSS": 64223,
+ "HybridRespDSS": 64224,
+ "XAUTHInitPreShared": 65001,
+ "XAUTHRespPreShared": 65002,
+ "XAUTHInitDSS": 65003,
+ "XAUTHRespDSS": 65004,
+ "XAUTHInitRSA": 65005,
+ "XAUTHRespRSA": 65006,
+ "XAUTHInitRSAEncryption": 65007,
+ "XAUTHRespRSAEncryption": 65008,
+ "XAUTHInitRSARevisedEncryption": 65009,
+ "XAUTHRespRSARevisedEncryptio": 65010, }, 0),
+ "GroupDesc": (4, { "768MODPgr" : 1,
+ "1024MODPgr" : 2,
+ "EC2Ngr155" : 3,
+ "EC2Ngr185" : 4,
+ "1536MODPgr" : 5,
+ "2048MODPgr" : 14,
+ "3072MODPgr" : 15,
+ "4096MODPgr" : 16,
+ "6144MODPgr" : 17,
+ "8192MODPgr" : 18, }, 0),
+ "GroupType": (5, {"MODP": 1,
+ "ECP": 2,
+ "EC2N": 3}, 0),
+ "GroupPrime": (6, {}, 1),
+ "GroupGenerator1":(7, {}, 1),
+ "GroupGenerator2":(8, {}, 1),
+ "GroupCurveA": (9, {}, 1),
+ "GroupCurveB": (10, {}, 1),
+ "LifeType": (11, {"Seconds": 1,
+ "Kilobytes": 2, }, 0),
+ "LifeDuration": (12, {}, 1),
+ "PRF": (13, {}, 0),
+ "KeyLength": (14, {}, 0),
+ "FieldSize": (15, {}, 0),
+ "GroupOrder": (16, {}, 1),
+ }
+
+# the name 'ISAKMPTransformTypes' is actually a misnomer (since the table
+# holds info for all ISAKMP Attribute types, not just transforms, but we'll
+# keep it for backwards compatibility... for now at least
+ISAKMPTransformTypes = ISAKMPAttributeTypes
+
+ISAKMPTransformNum = {}
+for n in ISAKMPTransformTypes:
+ val = ISAKMPTransformTypes[n]
+ tmp = {}
+ for e in val[1]:
+ tmp[val[1][e]] = e
+ ISAKMPTransformNum[val[0]] = (n,tmp, val[2])
+del(n)
+del(e)
+del(tmp)
+del(val)
+
+
+class ISAKMPTransformSetField(StrLenField):
+ islist=1
+ def type2num(self, (typ,val)):
+ type_val,enc_dict,tlv = ISAKMPTransformTypes.get(typ, (typ,{},0))
+ val = enc_dict.get(val, val)
+ s = ""
+ if (val & ~0xffff):
+ if not tlv:
+ warning("%r should not be TLV but is too big => using TLV encoding" % typ)
+ n = 0
+ while val:
+ s = chr(val&0xff)+s
+ val >>= 8
+ n += 1
+ val = n
+ else:
+ type_val |= 0x8000
+ return struct.pack("!HH",type_val, val)+s
+ def num2type(self, typ, enc):
+ val = ISAKMPTransformNum.get(typ,(typ,{}))
+ enc = val[1].get(enc,enc)
+ return (val[0],enc)
+ def i2m(self, pkt, i):
+ if i is None:
+ return ""
+ i = map(self.type2num, i)
+ return "".join(i)
+ def m2i(self, pkt, m):
+ # I try to ensure that we don't read off the end of our packet based
+ # on bad length fields we're provided in the packet. There are still
+ # conditions where struct.unpack() may not get enough packet data, but
+ # worst case that should result in broken attributes (which would
+ # be expected). (wam)
+ lst = []
+ while len(m) >= 4:
+ trans_type, = struct.unpack("!H", m[:2])
+ is_tlv = not (trans_type & 0x8000)
+ if is_tlv:
+ # We should probably check to make sure the attribute type we
+ # are looking at is allowed to have a TLV format and issue a
+ # warning if we're given an TLV on a basic attribute.
+ value_len, = struct.unpack("!H", m[2:4])
+ if value_len+4 > len(m):
+ warning("Bad length for ISAKMP tranform type=%#6x" % trans_type)
+ value = m[4:4+value_len]
+ value = reduce(lambda x,y: (x<<8L)|y, struct.unpack("!%s" % ("B"*len(value),), value),0)
+ else:
+ trans_type &= 0x7fff
+ value_len=0
+ value, = struct.unpack("!H", m[2:4])
+ m=m[4+value_len:]
+ lst.append(self.num2type(trans_type, value))
+ if len(m) > 0:
+ warning("Extra bytes after ISAKMP transform dissection [%r]" % m)
+ return lst
+
+class StrNullField(StrField):
+ def addfield(self, pkt, s, val):
+ return s+self.i2m(pkt, val)+"\x00"
+ def getfield(self, pkt, s):
+ l = s.find("\x00")
+ if l < 0:
+ #XXX \x00 not found
+ return "",s
+ return s[l+1:],self.m2i(pkt, s[:l])
+ def randval(self):
+ return RandTermString(RandNum(0,1200),"\x00")
+
+class StrStopField(StrField):
+ def __init__(self, name, default, stop, additionnal=0):
+ Field.__init__(self, name, default)
+ self.stop=stop
+ self.additionnal=additionnal
+ def getfield(self, pkt, s):
+ l = s.find(self.stop)
+ if l < 0:
+ return "",s
+# raise Scapy_Exception,"StrStopField: stop value [%s] not found" %stop
+ l += len(self.stop)+self.additionnal
+ return s[l:],s[:l]
+ def randval(self):
+ return RandTermString(RandNum(0,1200),self.stop)
+
+class LenField(Field):
+ def i2m(self, pkt, x):
+ if x is None:
+ x = len(pkt.payload)
+ return x
+
+class BCDFloatField(Field):
+ def i2m(self, pkt, x):
+ return int(256*x)
+ def m2i(self, pkt, x):
+ return x/256.0
+
+class BitField(Field):
+ def __init__(self, name, default, size):
+ Field.__init__(self, name, default)
+ self.rev = size < 0
+ self.size = abs(size)
+ def reverse(self, val):
+ if self.size == 16:
+ val = socket.ntohs(val)
+ elif self.size == 32:
+ val = socket.ntohl(val)
+ return val
+
+ def addfield(self, pkt, s, val):
+ val = self.i2m(pkt, val)
+ if type(s) is tuple:
+ s,bitsdone,v = s
+ else:
+ bitsdone = 0
+ v = 0
+ if self.rev:
+ val = self.reverse(val)
+ v <<= self.size
+ v |= val & ((1L<<self.size) - 1)
+ bitsdone += self.size
+ while bitsdone >= 8:
+ bitsdone -= 8
+ s = s+struct.pack("!B", v >> bitsdone)
+ v &= (1L<<bitsdone)-1
+ if bitsdone:
+ return s,bitsdone,v
+ else:
+ return s
+ def getfield(self, pkt, s):
+ if type(s) is tuple:
+ s,bn = s
+ else:
+ bn = 0
+ # we don't want to process all the string
+ nb_bytes = (self.size+bn-1)/8 + 1
+ w = s[:nb_bytes]
+
+ # split the substring byte by byte
+ bytes = struct.unpack('!%dB' % nb_bytes , w)
+
+ b = 0L
+ for c in range(nb_bytes):
+ b |= long(bytes[c]) << (nb_bytes-c-1)*8
+
+ # get rid of high order bits
+ b &= (1L << (nb_bytes*8-bn)) - 1
+
+ # remove low order bits
+ b = b >> (nb_bytes*8 - self.size - bn)
+
+ if self.rev:
+ b = self.reverse(b)
+
+ bn += self.size
+ s = s[bn/8:]
+ bn = bn%8
+ b = self.m2i(pkt, b)
+ if bn:
+ return (s,bn),b
+ else:
+ return s,b
+ def randval(self):
+ return RandNum(0,2**self.size-1)
+
+
+class BitFieldLenField(BitField):
+ def __init__(self, name, default, size, length_of=None, count_of=None, adjust=lambda pkt,x:x):
+ BitField.__init__(self, name, default, size)
+ self.length_of=length_of
+ self.count_of=count_of
+ self.adjust=adjust
+ def i2m(self, pkt, x):
+ return FieldLenField.i2m.im_func(self, pkt, x)
+
+
+class XBitField(BitField):
+ def i2repr(self, pkt, x):
+ return lhex(self.i2h(pkt,x))
+
+
+class EnumField(Field):
+ def __init__(self, name, default, enum, fmt = "H"):
+ i2s = self.i2s = {}
+ s2i = self.s2i = {}
+ if type(enum) is list:
+ keys = xrange(len(enum))
+ else:
+ keys = enum.keys()
+ if filter(lambda x: type(x) is str, keys):
+ i2s,s2i = s2i,i2s
+ for k in keys:
+ i2s[k] = enum[k]
+ s2i[enum[k]] = k
+ Field.__init__(self, name, default, fmt)
+ def any2i_one(self, pkt, x):
+ if type(x) is str:
+ x = self.s2i[x]
+ return x
+ def i2repr_one(self, pkt, x):
+ if self not in conf.noenum and not isinstance(x,VolatileValue) and x in self.i2s:
+ return self.i2s[x]
+ return repr(x)
+
+ def any2i(self, pkt, x):
+ if type(x) is list:
+ return map(lambda z,pkt=pkt:self.any2i_one(pkt,z), x)
+ else:
+ return self.any2i_one(pkt,x)
+ def i2repr(self, pkt, x):
+ if type(x) is list:
+ return map(lambda z,pkt=pkt:self.i2repr_one(pkt,z), x)
+ else:
+ return self.i2repr_one(pkt,x)
+
+class CharEnumField(EnumField):
+ def __init__(self, name, default, enum, fmt = "1s"):
+ EnumField.__init__(self, name, default, enum, fmt)
+ k = self.i2s.keys()
+ if k and len(k[0]) != 1:
+ self.i2s,self.s2i = self.s2i,self.i2s
+ def any2i_one(self, pkt, x):
+ if len(x) != 1:
+ x = self.s2i[x]
+ return x
+
+class BitEnumField(BitField,EnumField):
+ def __init__(self, name, default, size, enum):
+ EnumField.__init__(self, name, default, enum)
+ self.rev = size < 0
+ self.size = abs(size)
+ def any2i(self, pkt, x):
+ return EnumField.any2i(self, pkt, x)
+ def i2repr(self, pkt, x):
+ return EnumField.i2repr(self, pkt, x)
+
+class ShortEnumField(EnumField):
+ def __init__(self, name, default, enum):
+ EnumField.__init__(self, name, default, enum, "H")
+
+class LEShortEnumField(EnumField):
+ def __init__(self, name, default, enum):
+ EnumField.__init__(self, name, default, enum, "<H")
+
+class ByteEnumField(EnumField):
+ def __init__(self, name, default, enum):
+ EnumField.__init__(self, name, default, enum, "B")
+
+class IntEnumField(EnumField):
+ def __init__(self, name, default, enum):
+ EnumField.__init__(self, name, default, enum, "I")
+
+class SignedIntEnumField(EnumField):
+ def __init__(self, name, default, enum):
+ EnumField.__init__(self, name, default, enum, "i")
+ def randval(self):
+ return RandSInt()
+
+class LEIntEnumField(EnumField):
+ def __init__(self, name, default, enum):
+ EnumField.__init__(self, name, default, enum, "<I")
+
+class XShortEnumField(ShortEnumField):
+ def i2repr_one(self, pkt, x):
+ if self not in conf.noenum and not isinstance(x,VolatileValue) and x in self.i2s:
+ return self.i2s[x]
+ return lhex(x)
+
+# Little endian long field
+class LELongField(Field):
+ def __init__(self, name, default):
+ Field.__init__(self, name, default, "<Q")
+
+# Little endian fixed length field
+class LEFieldLenField(FieldLenField):
+ def __init__(self, name, default, length_of=None, fmt = "<H", count_of=None, adjust=lambda pkt,x:x, fld=None):
+ FieldLenField.__init__(self, name, default, length_of=length_of, fmt=fmt, fld=fld, adjust=adjust)
+
+
+class FlagsField(BitField):
+ def __init__(self, name, default, size, names):
+ BitField.__init__(self, name, default, size)
+ self.multi = type(names) is list
+ if self.multi:
+ self.names = map(lambda x:[x], names)
+ else:
+ self.names = names
+ def any2i(self, pkt, x):
+ if type(x) is str:
+ if self.multi:
+ x = map(lambda y:[y], x.split("+"))
+ y = 0
+ for i in x:
+ y |= 1 << self.names.index(i)
+ x = y
+ return x
+ def i2repr(self, pkt, x):
+ if self.multi:
+ r = []
+ else:
+ r = ""
+ i=0
+ while x:
+ if x & 1:
+ r += self.names[i]
+ i += 1
+ x >>= 1
+ if self.multi:
+ r = "+".join(r)
+ return r
+
+
+
+
+
+class IPoptionsField(StrField):
+ def i2m(self, pkt, x):
+ return x+"\x00"*(3-((len(x)+3)%4))
+ def getfield(self, pkt, s):
+ opsz = (pkt.ihl-5)*4
+ if opsz < 0:
+ warning("bad ihl (%i). Assuming ihl=5"%pkt.ihl)
+ opsz = 0
+ return s[opsz:],s[:opsz]
+ def randval(self):
+ return RandBin(RandNum(0,39))
+
+
+TCPOptions = (
+ { 0 : ("EOL",None),
+ 1 : ("NOP",None),
+ 2 : ("MSS","!H"),
+ 3 : ("WScale","!B"),
+ 4 : ("SAckOK",None),
+ 5 : ("SAck","!"),
+ 8 : ("Timestamp","!II"),
+ 14 : ("AltChkSum","!BH"),
+ 15 : ("AltChkSumOpt",None)
+ },
+ { "EOL":0,
+ "NOP":1,
+ "MSS":2,
+ "WScale":3,
+ "SAckOK":4,
+ "SAck":5,
+ "Timestamp":8,
+ "AltChkSum":14,
+ "AltChkSumOpt":15,
+ } )
+
+class TCPOptionsField(StrField):
+ islist=1
+ def getfield(self, pkt, s):
+ opsz = (pkt.dataofs-5)*4
+ if opsz < 0:
+ warning("bad dataofs (%i). Assuming dataofs=5"%pkt.dataofs)
+ opsz = 0
+ return s[opsz:],self.m2i(pkt,s[:opsz])
+ def m2i(self, pkt, x):
+ opt = []
+ while x:
+ onum = ord(x[0])
+ if onum == 0:
+ opt.append(("EOL",None))
+ x=x[1:]
+ break
+ if onum == 1:
+ opt.append(("NOP",None))
+ x=x[1:]
+ continue
+ olen = ord(x[1])
+ if olen < 2:
+ warning("Malformed TCP option (announced length is %i)" % olen)
+ olen = 2
+ oval = x[2:olen]
+ if TCPOptions[0].has_key(onum):
+ oname, ofmt = TCPOptions[0][onum]
+ if onum == 5: #SAck
+ ofmt += "%iI" % (len(oval)/4)
+ if ofmt and struct.calcsize(ofmt) == len(oval):
+ oval = struct.unpack(ofmt, oval)
+ if len(oval) == 1:
+ oval = oval[0]
+ opt.append((oname, oval))
+ else:
+ opt.append((onum, oval))
+ x = x[olen:]
+ return opt
+
+ def i2m(self, pkt, x):
+ opt = ""
+ for oname,oval in x:
+ if type(oname) is str:
+ if oname == "NOP":
+ opt += "\x01"
+ continue
+ elif oname == "EOL":
+ opt += "\x00"
+ continue
+ elif TCPOptions[1].has_key(oname):
+ onum = TCPOptions[1][oname]
+ ofmt = TCPOptions[0][onum][1]
+ if onum == 5: #SAck
+ ofmt += "%iI" % len(oval)
+ if ofmt is not None and (type(oval) is not str or "s" in ofmt):
+ if type(oval) is not tuple:
+ oval = (oval,)
+ oval = struct.pack(ofmt, *oval)
+ else:
+ warning("option [%s] unknown. Skipped."%oname)
+ continue
+ else:
+ onum = oname
+ if type(oval) is not str:
+ warning("option [%i] is not string."%onum)
+ continue
+ opt += chr(onum)+chr(2+len(oval))+oval
+ return opt+"\x00"*(3-((len(opt)+3)%4))
+ def randval(self):
+ return [] # XXX
+
+
+class DNSStrField(StrField):
+ def i2m(self, pkt, x):
+ x = [k[:63] for k in x.split(".")] # Truncate chunks that cannont be encoded (more than 63 bytes..)
+ x = map(lambda y: chr(len(y))+y, x)
+ x = "".join(x)
+ if x[-1] != "\x00":
+ x += "\x00"
+ return x
+ def getfield(self, pkt, s):
+ n = ""
+ while 1:
+ l = ord(s[0])
+ s = s[1:]
+ if not l:
+ break
+ if l & 0xc0:
+ raise Scapy_Exception("DNS message can't be compressed at this point!")
+ else:
+ n += s[:l]+"."
+ s = s[l:]
+ return s, n
+
+
+class DNSRRCountField(ShortField):
+ holds_packets=1
+ def __init__(self, name, default, rr):
+ ShortField.__init__(self, name, default)
+ self.rr = rr
+ def _countRR(self, pkt):
+ x = getattr(pkt,self.rr)
+ i = 0
+ while isinstance(x, DNSRR) or isinstance(x, DNSQR):
+ x = x.payload
+ i += 1
+ return i
+
+ def i2m(self, pkt, x):
+ if x is None:
+ x = self._countRR(pkt)
+ return x
+ def i2h(self, pkt, x):
+ if x is None:
+ x = self._countRR(pkt)
+ return x
+
+
+def DNSgetstr(s,p):
+ name = ""
+ q = 0
+ jpath = [p]
+ while 1:
+ if p >= len(s):
+ warning("DNS RR prematured end (ofs=%i, len=%i)"%(p,len(s)))
+ break
+ l = ord(s[p])
+ p += 1
+ if l & 0xc0:
+ if not q:
+ q = p+1
+ if p >= len(s):
+ warning("DNS incomplete jump token at (ofs=%i)" % p)
+ break
+ p = ((l & 0x3f) << 8) + ord(s[p]) - 12
+ if p in jpath:
+ warning("DNS decompression loop detected")
+ break
+ jpath.append(p)
+ continue
+ elif l > 0:
+ name += s[p:p+l]+"."
+ p += l
+ continue
+ break
+ if q:
+ p = q
+ return name,p
+
+
+class DNSRRField(StrField):
+ holds_packets=1
+ def __init__(self, name, countfld, passon=1):
+ StrField.__init__(self, name, None)
+ self.countfld = countfld
+ self.passon = passon
+ def i2m(self, pkt, x):
+ if x is None:
+ return ""
+ return str(x)
+ def decodeRR(self, name, s, p):
+ ret = s[p:p+10]
+ type,cls,ttl,rdlen = struct.unpack("!HHIH", ret)
+ p += 10
+ rr = DNSRR("\x00"+ret+s[p:p+rdlen])
+ if rr.type in [2, 3, 4, 5]:
+ rr.rdata = DNSgetstr(s,p)[0]
+ del(rr.rdlen)
+
+ p += rdlen
+
+ rr.rrname = name
+ return rr,p
+ def getfield(self, pkt, s):
+ if type(s) is tuple :
+ s,p = s
+ else:
+ p = 0
+ ret = None
+ c = getattr(pkt, self.countfld)
+ if c > len(s):
+ warning("wrong value: DNS.%s=%i" % (self.countfld,c))
+ return s,""
+ while c:
+ c -= 1
+ name,p = DNSgetstr(s,p)
+ rr,p = self.decodeRR(name, s, p)
+ if ret is None:
+ ret = rr
+ else:
+ ret.add_payload(rr)
+ if self.passon:
+ return (s,p),ret
+ else:
+ return s[p:],ret
+
+
+class DNSQRField(DNSRRField):
+ holds_packets=1
+ def decodeRR(self, name, s, p):
+ ret = s[p:p+4]
+ p += 4
+ rr = DNSQR("\x00"+ret)
+ rr.qname = name
+ return rr,p
+
+
+
+class RDataField(StrLenField):
+ def m2i(self, pkt, s):
+ family = None
+ if pkt.type == 1:
+ family = socket.AF_INET
+ elif pkt.type == 28:
+ family = socket.AF_INET6
+ elif pkt.type == 12:
+ s = DNSgetstr(s, 0)[0]
+ if family is not None:
+ s = inet_ntop(family, s)
+ return s
+ def i2m(self, pkt, s):
+ if pkt.type == 1:
+ if s:
+ s = inet_aton(s)
+ elif pkt.type == 28:
+ if s:
+ s = inet_pton(socket.AF_INET6, s)
+ elif pkt.type in [2,3,4,5]:
+ s = "".join(map(lambda x: chr(len(x))+x, s.split(".")))
+ if ord(s[-1]):
+ s += "\x00"
+ return s
+
+class RDLenField(Field):
+ def __init__(self, name):
+ Field.__init__(self, name, None, "H")
+ def i2m(self, pkt, x):
+ if x is None:
+ rdataf = pkt.get_field("rdata")
+ x = len(rdataf.i2m(pkt, pkt.rdata))
+ return x
+ def i2h(self, pkt, x):
+ if x is None:
+ rdataf = pkt.get_field("rdata")
+ x = len(rdataf.i2m(pkt, pkt.rdata))
+ return x
+
+# seconds between 01-01-1900 and 01-01-1970
+ntp_basetime = 2208988800
+
+class TimeStampField(BitField):
+ def __init__(self, name, default, size):
+ BitField.__init__(self, name, default, size)
+ self.size = size
+ def getfield(self, pkt, s):
+ s,timestamp = BitField.getfield(self, pkt, s)
+
+ if timestamp:
+ # timestamp is a 64 bits field :
+ # + first 32 bits : number of seconds since 1900
+ # + last 32 bits : fraction part
+ timestamp >>= 32
+ timestamp -= ntp_basetime
+
+ from time import gmtime, strftime
+ b = strftime("%a, %d %b %Y %H:%M:%S +0000", gmtime(timestamp))
+ else:
+ b = 'None'
+
+ return s, b
+ def addfield(self, pkt, s, val):
+ t = -1
+ if type(val) is str:
+ from time import strptime, mktime
+ t = int(mktime(strptime(val))) + ntp_basetime + 3600
+ else:
+ if val == -1:
+ from time import time
+ t = int(time()) + ntp_basetime
+ else:
+ t = val
+ t <<= 32
+ return BitField.addfield(self,pkt,s, t)
+
+class FloatField(BitField):
+ def getfield(self, pkt, s):
+ s,b = BitField.getfield(self, pkt, s)
+
+ # fraction point between bits 15 and 16.
+ sec = b >> 16
+ frac = b & (1L << (32+1)) - 1
+ frac /= 65536.0
+ b = sec+frac
+ return s,b
+
+class Dot11SCField(LEShortField):
+ def is_applicable(self, pkt):
+ return pkt.type != 1 # control frame
+ def addfield(self, pkt, s, val):
+ if self.is_applicable(pkt):
+ return LEShortField.addfield(self, pkt, s, val)
+ else:
+ return s
+ def getfield(self, pkt, s):
+ if self.is_applicable(pkt):
+ return LEShortField.getfield(self, pkt, s)
+ else:
+ return s,None
+
+#####################
+#### ASN1 Fields ####
+#####################
+
+class ASN1F_badsequence(Exception):
+ pass
+
+class ASN1F_element:
+ pass
+
+class ASN1F_field(ASN1F_element):
+ holds_packets=0
+ islist=0
+
+ ASN1_tag = ASN1_Class_UNIVERSAL.ANY
+
+ def __init__(self, name, default):
+ self.name = name
+ self.default = default
+
+ def i2repr(self, pkt, x):
+ if x is None:
+ x = 0
+ return repr(x)
+ def i2h(self, pkt, x):
+ if x is None:
+ x = 0
+ return x
+ def any2i(self, pkt, x):
+ return x
+ def m2i(self, pkt, x):
+ return self.ASN1_tag.get_codec(pkt.ASN1_codec).safedec(x)
+ def i2m(self, pkt, x):
+ if x is None:
+ x = 0
+ if isinstance(x, ASN1_Object):
+ if ( self.ASN1_tag == ASN1_Class_UNIVERSAL.ANY
+ or x.tag == ASN1_Class_UNIVERSAL.RAW
+ or x.tag == ASN1_Class_UNIVERSAL.ERROR
+ or self.ASN1_tag == x.tag ):
+ return x.enc(pkt.ASN1_codec)
+ else:
+ raise ASN1_Error("Encoding Error: got %r instead of an %r for field [%s]" % (x, self.ASN1_tag, self.name))
+ return self.ASN1_tag.get_codec(pkt.ASN1_codec).enc(x)
+
+ def do_copy(self, x):
+ if hasattr(x, "copy"):
+ return x.copy()
+ if type(x) is list:
+ x = x[:]
+ for i in xrange(len(x)):
+ if isinstance(x[i], Packet):
+ x[i] = x[i].copy()
+ return x
+
+ def build(self, pkt):
+ return self.i2m(pkt, getattr(pkt, self.name))
+
+ def set_val(self, pkt, val):
+ setattr(pkt, self.name, val)
+
+ def dissect(self, pkt, s):
+ v,s = self.m2i(pkt, s)
+ self.set_val(pkt, v)
+ return s
+
+ def get_fields_list(self):
+ return [self]
+
+ def __hash__(self):
+ return hash(self.name)
+ def __str__(self):
+ return self.name
+ def __eq__(self, other):
+ return self.name == other
+ def __repr__(self):
+ return self.name
+ def randval(self):
+ return RandInt()
+
+
+class ASN1F_INTEGER(ASN1F_field):
+ ASN1_tag= ASN1_Class_UNIVERSAL.INTEGER
+ def randval(self):
+ return RandNum(-2**64, 2**64)
+
+class ASN1F_enum_INTEGER(ASN1F_INTEGER):
+ def __init__(self, name, default, enum):
+ ASN1F_INTEGER.__init__(self, name, default)
+ i2s = self.i2s = {}
+ s2i = self.s2i = {}
+ if type(enum) is list:
+ keys = xrange(len(enum))
+ else:
+ keys = enum.keys()
+ if filter(lambda x: type(x) is str, keys):
+ i2s,s2i = s2i,i2s
+ for k in keys:
+ i2s[k] = enum[k]
+ s2i[enum[k]] = k
+ def any2i_one(self, pkt, x):
+ if type(x) is str:
+ x = self.s2i[x]
+ return x
+ def i2repr_one(self, pkt, x):
+ return self.i2s.get(x, repr(x))
+
+ def any2i(self, pkt, x):
+ if type(x) is list:
+ return map(lambda z,pkt=pkt:self.any2i_one(pkt,z), x)
+ else:
+ return self.any2i_one(pkt,x)
+ def i2repr(self, pkt, x):
+ if type(x) is list:
+ return map(lambda z,pkt=pkt:self.i2repr_one(pkt,z), x)
+ else:
+ return self.i2repr_one(pkt,x)
+
+class ASN1F_STRING(ASN1F_field):
+ ASN1_tag = ASN1_Class_UNIVERSAL.STRING
+ def randval(self):
+ return RandString(RandNum(0, 1000))
+
+class ASN1F_OID(ASN1F_field):
+ ASN1_tag = ASN1_Class_UNIVERSAL.OID
+ def randval(self):
+ return RandOID()
+
+class ASN1F_SEQUENCE(ASN1F_field):
+ ASN1_tag = ASN1_Class_UNIVERSAL.SEQUENCE
+ def __init__(self, *seq, **kargs):
+ if "ASN1_tag" in kargs:
+ self.ASN1_tag = kargs["ASN1_tag"]
+ self.seq = seq
+ def __repr__(self):
+ return "<%s%r>" % (self.__class__.__name__,self.seq,)
+ def get_fields_list(self):
+ return reduce(lambda x,y: x+y.get_fields_list(), self.seq, [])
+ def build(self, pkt):
+ s = reduce(lambda x,y: x+y.build(pkt), self.seq, "")
+ return self.i2m(pkt, s)
+ def dissect(self, pkt, s):
+ codec = self.ASN1_tag.get_codec(pkt.ASN1_codec)
+ try:
+ i,s,remain = codec.check_type_check_len(s)
+ for obj in self.seq:
+ s = obj.dissect(pkt,s)
+ if s:
+ warning("Too many bytes to decode sequence: [%r]" % s) # XXX not reversible!
+ return remain
+ except ASN1_Error,e:
+ raise ASN1F_badsequence(e)
+
+class ASN1F_SEQUENCE_OF(ASN1F_SEQUENCE):
+ holds_packets = 1
+ islist = 1
+ def __init__(self, name, default, asn1pkt, ASN1_tag=0x30):
+ self.asn1pkt = asn1pkt
+ self.tag = chr(ASN1_tag)
+ self.name = name
+ self.default = default
+ def get_fields_list(self):
+ return [self]
+ def build(self, pkt):
+ val = getattr(pkt, self.name)
+ if isinstance(val, ASN1_Object) and val.tag == ASN1_Class_UNIVERSAL.RAW:
+ s = val
+ else:
+ s = "".join(map(str, val ))
+ return self.i2m(pkt, s)
+ def dissect(self, pkt, s):
+ codec = self.ASN1_tag.get_codec(pkt.ASN1_codec)
+ i,s1,remain = codec.check_type_check_len(s)
+ lst = []
+ while s1:
+ try:
+ p = self.asn1pkt(s1)
+ except ASN1F_badsequence:
+ lst.append(Raw(s1))
+ break
+ lst.append(p)
+ if Raw in p:
+ s1 = p[Raw].load
+ del(p[Raw].underlayer.payload)
+ else:
+ break
+ self.set_val(pkt, lst)
+ return remain
+ def randval(self):
+ return fuzz(self.asn1pkt())
+
+class ASN1F_PACKET(ASN1F_field):
+ holds_packets = 1
+ def __init__(self, name, default, cls):
+ ASN1_field.__init__(self, name, default)
+ self.cls = cls
+ def i2m(self, pkt, x):
+ if x is None:
+ x = ""
+ return str(x)
+ def extract_packet(self, cls, x):
+ try:
+ c = cls(x)
+ except ASN1F_badsequence:
+ c = Raw(x)
+ cpad = c[Padding]
+ x = ""
+ if cpad is not None:
+ x = cpad.load
+ del(cpad.underlayer.payload)
+ return c,x
+ def m2i(self, pkt, x):
+ return self.extract_packet(self.cls, x)
+
+
+class ASN1F_CHOICE(ASN1F_PACKET):
+ ASN1_tag = ASN1_Class_UNIVERSAL.NONE
+ def __init__(self, name, default, *args):
+ self.name=name
+ self.choice = {}
+ for p in args:
+ self.choice[p.ASN1_root.ASN1_tag] = p
+# self.context=context
+ self.default=default
+ def m2i(self, pkt, x):
+ if len(x) == 0:
+ return Raw(),""
+ raise ASN1_Error("ASN1F_CHOICE: got empty string")
+ if ord(x[0]) not in self.choice:
+ return Raw(x),"" # XXX return RawASN1 packet ? Raise error
+ raise ASN1_Error("Decoding Error: choice [%i] not found in %r" % (ord(x[0]), self.choice.keys()))
+
+ z = ASN1F_PACKET.extract_packet(self, self.choice[ord(x[0])], x)
+ return z
+ def randval(self):
+ return RandChoice(*map(lambda x:fuzz(x()), self.choice.values()))
+
+
+
+###########################
+## Packet abstract class ##
+###########################
+
+class Packet_metaclass(type):
+ def __new__(cls, name, bases, dct):
+ newcls = super(Packet_metaclass, cls).__new__(cls, name, bases, dct)
+ for f in newcls.fields_desc:
+ f.register_owner(newcls)
+ return newcls
+ def __getattr__(self, attr):
+ for k in self.fields_desc:
+ if k.name == attr:
+ return k
+ raise AttributeError(attr)
+
+class NewDefaultValues(Packet_metaclass):
+ """NewDefaultValues metaclass. Example usage:
+ class MyPacket(Packet):
+ fields_desc = [ StrField("my_field", "my default value"), ]
+
+ class MyPacket_variant(MyPacket):
+ __metaclass__ = NewDefaultValues
+ my_field = "my new default value"
+ """
+ def __new__(cls, name, bases, dct):
+ fields = None
+ for b in bases:
+ if hasattr(b,"fields_desc"):
+ fields = b.fields_desc
+ break
+ if fields is None:
+ raise Scapy_Exception("No fields_desc in superclasses")
+
+ new_fields = []
+ for f in fields:
+ if f.name in dct:
+ f = f.copy()
+ f.default = dct[f.name]
+ del(dct[f.name])
+ new_fields.append(f)
+ dct["fields_desc"] = new_fields
+ return super(NewDefaultValues, cls).__new__(cls, name, bases, dct)
+
+class Packet(Gen):
+ __metaclass__ = Packet_metaclass
+ name=None
+
+ fields_desc = []
+
+ aliastypes = []
+ overload_fields = {}
+
+ underlayer = None
+
+ payload_guess = []
+ initialized = 0
+ show_indent=1
+ explicit = 0
+
+ @classmethod
+ def from_hexcap(cls):
+ return cls(import_hexcap())
+
+ @classmethod
+ def upper_bonds(self):
+ for fval,upper in self.payload_guess:
+ print "%-20s %s" % (upper.__name__, ", ".join("%-12s" % ("%s=%r"%i) for i in fval.iteritems()))
+
+ @classmethod
+ def lower_bonds(self):
+ for lower,fval in self.overload_fields.iteritems():
+ print "%-20s %s" % (lower.__name__, ", ".join("%-12s" % ("%s=%r"%i) for i in fval.iteritems()))
+
+ def __init__(self, _pkt="", post_transform=None, _internal=0, _underlayer=None, **fields):
+ self.time = time.time()
+ if self.name is None:
+ self.name = self.__class__.__name__
+ self.aliastypes = [ self.__class__ ] + self.aliastypes
+ self.default_fields = {}
+ self.overloaded_fields = {}
+ self.fields={}
+ self.fieldtype={}
+ self.packetfields=[]
+ self.__dict__["payload"] = NoPayload()
+ self.init_fields()
+ self.underlayer = _underlayer
+ self.initialized = 1
+ if _pkt:
+ self.dissect(_pkt)
+ if not _internal:
+ self.dissection_done(self)
+ for f in fields.keys():
+ self.fields[f] = self.get_field(f).any2i(self,fields[f])
+ if type(post_transform) is list:
+ self.post_transforms = post_transform
+ elif post_transform is None:
+ self.post_transforms = []
+ else:
+ self.post_transforms = [post_transform]
+
+ def init_fields(self):
+ self.do_init_fields(self.fields_desc)
+
+ def do_init_fields(self, flist):
+ for f in flist:
+ self.default_fields[f.name] = f.default
+ self.fieldtype[f.name] = f
+ if f.holds_packets:
+ self.packetfields.append(f)
+
+ def dissection_done(self,pkt):
+ """DEV: will be called after a dissection is completed"""
+ self.post_dissection(pkt)
+ self.payload.dissection_done(pkt)
+
+ def post_dissection(self, pkt):
+ """DEV: is called after the dissection of the whole packet"""
+ pass
+
+ def get_field(self, fld):
+ """DEV: returns the field instance from the name of the field"""
+ return self.fieldtype[fld]
+
+ def add_payload(self, payload):
+ if payload is None:
+ return
+ elif not isinstance(self.payload, NoPayload):
+ self.payload.add_payload(payload)
+ else:
+ if isinstance(payload, Packet):
+ self.__dict__["payload"] = payload
+ payload.add_underlayer(self)
+ for t in self.aliastypes:
+ if payload.overload_fields.has_key(t):
+ self.overloaded_fields = payload.overload_fields[t]
+ break
+ elif type(payload) is str:
+ self.__dict__["payload"] = Raw(load=payload)
+ else:
+ raise TypeError("payload must be either 'Packet' or 'str', not [%s]" % repr(payload))
+ def remove_payload(self):
+ self.payload.remove_underlayer(self)
+ self.__dict__["payload"] = NoPayload()
+ self.overloaded_fields = {}
+ def add_underlayer(self, underlayer):
+ self.underlayer = underlayer
+ def remove_underlayer(self,other):
+ self.underlayer = None
+ def copy(self):
+ """Returns a deep copy of the instance."""
+ clone = self.__class__()
+ clone.fields = self.fields.copy()
+ for k in clone.fields:
+ clone.fields[k]=self.get_field(k).do_copy(clone.fields[k])
+ clone.default_fields = self.default_fields.copy()
+ clone.overloaded_fields = self.overloaded_fields.copy()
+ clone.overload_fields = self.overload_fields.copy()
+ clone.underlayer=self.underlayer
+ clone.explicit=self.explicit
+ clone.post_transforms=self.post_transforms[:]
+ clone.__dict__["payload"] = self.payload.copy()
+ clone.payload.add_underlayer(clone)
+ return clone
+
+ def getfieldval(self, attr):
+ if attr in self.fields:
+ return self.fields[attr]
+ if attr in self.overloaded_fields:
+ return self.overloaded_fields[attr]
+ if attr in self.default_fields:
+ return self.default_fields[attr]
+ return self.payload.getfieldval(attr)
+
+ def getfield_and_val(self, attr):
+ if attr in self.fields:
+ return self.get_field(attr),self.fields[attr]
+ if attr in self.overloaded_fields:
+ return self.get_field(attr),self.overloaded_fields[attr]
+ if attr in self.default_fields:
+ return self.get_field(attr),self.default_fields[attr]
+ return self.payload.getfield_and_val(attr)
+
+ def __getattr__(self, attr):
+ if self.initialized:
+ fld,v = self.getfield_and_val(attr)
+ if fld is not None:
+ return fld.i2h(self, v)
+ return v
+ raise AttributeError(attr)
+
+ def __setattr__(self, attr, val):
+ if self.initialized:
+ if self.default_fields.has_key(attr):
+ fld = self.get_field(attr)
+ if fld is None:
+ any2i = lambda x,y: y
+ else:
+ any2i = fld.any2i
+ self.fields[attr] = any2i(self, val)
+ self.explicit=0
+ elif attr == "payload":
+ self.remove_payload()
+ self.add_payload(val)
+ else:
+ self.__dict__[attr] = val
+ else:
+ self.__dict__[attr] = val
+ def __delattr__(self, attr):
+ if self.initialized:
+ if self.fields.has_key(attr):
+ del(self.fields[attr])
+ self.explicit=0 # in case a default value must be explicited
+ return
+ elif self.default_fields.has_key(attr):
+ return
+ elif attr == "payload":
+ self.remove_payload()
+ return
+ if self.__dict__.has_key(attr):
+ del(self.__dict__[attr])
+ else:
+ raise AttributeError(attr)
+
+ def __repr__(self):
+ s = ""
+ ct = conf.color_theme
+ for f in self.fields_desc:
+ if f.name in self.fields:
+ val = f.i2repr(self, self.fields[f.name])
+ elif f.name in self.overloaded_fields:
+ val = f.i2repr(self, self.overloaded_fields[f.name])
+ else:
+ continue
+ if isinstance(f, Emph):
+ ncol = ct.emph_field_name
+ vcol = ct.emph_field_value
+ else:
+ ncol = ct.field_name
+ vcol = ct.field_value
+
+
+ s += " %s%s%s" % (ncol(f.name),
+ ct.punct("="),
+ vcol(val))
+ return "%s%s %s %s%s%s"% (ct.punct("<"),
+ ct.layer_name(self.__class__.__name__),
+ s,
+ ct.punct("|"),
+ repr(self.payload),
+ ct.punct(">"))
+ def __str__(self):
+ return self.build()
+ def __div__(self, other):
+ if isinstance(other, Packet):
+ cloneA = self.copy()
+ cloneB = other.copy()
+ cloneA.add_payload(cloneB)
+ return cloneA
+ elif type(other) is str:
+ return self/Raw(load=other)
+ else:
+ return other.__rdiv__(self)
+ def __rdiv__(self, other):
+ if type(other) is str:
+ return Raw(load=other)/self
+ else:
+ raise TypeError
+ def __mul__(self, other):
+ if type(other) is int:
+ return [self]*other
+ else:
+ raise TypeError
+ def __rmul__(self,other):
+ return self.__mul__(other)
+
+ def __nonzero__(self):
+ return True
+ def __len__(self):
+ return len(self.__str__())
+ def do_build(self):
+ p=""
+ for f in self.fields_desc:
+ p = f.addfield(self, p, self.getfieldval(f.name))
+ return p
+
+ def post_build(self, pkt, pay):
+ """DEV: called right after the current layer is build."""
+ return pkt+pay
+
+ def build_payload(self):
+ return self.payload.build(internal=1)
+
+ def build(self,internal=0):
+ if not self.explicit:
+ self = self.__iter__().next()
+ pkt = self.do_build()
+ for t in self.post_transforms:
+ pkt = t(pkt)
+ pay = self.build_payload()
+ try:
+ p = self.post_build(pkt,pay)
+ except TypeError:
+ log_runtime.error("API changed! post_build() now takes 2 arguments. Compatibility is only assured for a short transition time")
+ p = self.post_build(pkt+pay)
+ if not internal:
+ pad = self.payload.getlayer(Padding)
+ if pad:
+ p += pad.build()
+ p = self.build_done(p)
+ return p
+
+ def build_done(self, p):
+ return self.payload.build_done(p)
+
+ def do_build_ps(self):
+ p=""
+ pl = []
+ q=""
+ for f in self.fields_desc:
+ p = f.addfield(self, p, self.getfieldval(f.name) )
+ if type(p) is str:
+ r = p[len(q):]
+ q = p
+ else:
+ r = ""
+ pl.append( (f, f.i2repr(self,self.getfieldval(f.name)), r) )
+
+ pkt,lst = self.payload.build_ps(internal=1)
+ p += pkt
+ lst.append( (self, pl) )
+
+ return p,lst
+
+ def build_ps(self,internal=0):
+ p,lst = self.do_build_ps()
+# if not internal:
+# pkt = self
+# while pkt.haslayer(Padding):
+# pkt = pkt.getlayer(Padding)
+# lst.append( (pkt, [ ("loakjkjd", pkt.load, pkt.load) ] ) )
+# p += pkt.load
+# pkt = pkt.payload
+ return p,lst
+
+
+ def psdump(self, filename=None, **kargs):
+ """psdump(filename=None, layer_shift=0, rebuild=1)
+Creates an EPS file describing a packet. If filename is not provided a temporary file is created and gs is called."""
+ canvas = self.canvas_dump(**kargs)
+ if filename is None:
+ fname = "/tmp/scapy.%i"%os.getpid()
+ canvas.writeEPSfile(fname)
+ os.system("%s '%s.eps' &" % (conf.prog.psreader,fname))
+ else:
+ canvas.writeEPSfile(filename)
+
+ def pdfdump(self, filename=None, **kargs):
+ """pdfdump(filename=None, layer_shift=0, rebuild=1)
+ Creates a PDF file describing a packet. If filename is not provided a temporary file is created and xpdf is called."""
+ canvas = self.canvas_dump(**kargs)
+ if filename is None:
+ fname = "/tmp/scapy.%i"%os.getpid()
+ canvas.writePDFfile(fname)
+ os.system("%s '%s.pdf' &" % (conf.prog.pdfreader,fname))
+ else:
+ canvas.writePDFfile(filename)
+
+
+ def canvas_dump(self, layer_shift=0, rebuild=1):
+ canvas = pyx.canvas.canvas()
+ if rebuild:
+ p,t = self.__class__(str(self)).build_ps()
+ else:
+ p,t = self.build_ps()
+ YTXT=len(t)
+ for n,l in t:
+ YTXT += len(l)
+ YTXT = float(YTXT)
+ YDUMP=YTXT
+
+ XSTART = 1
+ XDSTART = 10
+ y = 0.0
+ yd = 0.0
+ xd = 0
+ XMUL= 0.55
+ YMUL = 0.4
+
+ backcolor=colgen(0.6, 0.8, 1.0, trans=pyx.color.rgb)
+ forecolor=colgen(0.2, 0.5, 0.8, trans=pyx.color.rgb)
+# backcolor=makecol(0.376, 0.729, 0.525, 1.0)
+
+
+ def hexstr(x):
+ s = []
+ for c in x:
+ s.append("%02x" % ord(c))
+ return " ".join(s)
+
+
+ def make_dump_txt(x,y,txt):
+ return pyx.text.text(XDSTART+x*XMUL, (YDUMP-y)*YMUL, r"\tt{%s}"%hexstr(txt), [pyx.text.size.Large])
+
+ def make_box(o):
+ return pyx.box.rect(o.left(), o.bottom(), o.width(), o.height(), relcenter=(0.5,0.5))
+
+ def make_frame(lst):
+ if len(lst) == 1:
+ b = lst[0].bbox()
+ b.enlarge(pyx.unit.u_pt)
+ return b.path()
+ else:
+ fb = lst[0].bbox()
+ fb.enlarge(pyx.unit.u_pt)
+ lb = lst[-1].bbox()
+ lb.enlarge(pyx.unit.u_pt)
+ if len(lst) == 2 and fb.left() > lb.right():
+ return pyx.path.path(pyx.path.moveto(fb.right(), fb.top()),
+ pyx.path.lineto(fb.left(), fb.top()),
+ pyx.path.lineto(fb.left(), fb.bottom()),
+ pyx.path.lineto(fb.right(), fb.bottom()),
+ pyx.path.moveto(lb.left(), lb.top()),
+ pyx.path.lineto(lb.right(), lb.top()),
+ pyx.path.lineto(lb.right(), lb.bottom()),
+ pyx.path.lineto(lb.left(), lb.bottom()))
+ else:
+ # XXX
+ gb = lst[1].bbox()
+ if gb != lb:
+ gb.enlarge(pyx.unit.u_pt)
+ kb = lst[-2].bbox()
+ if kb != gb and kb != lb:
+ kb.enlarge(pyx.unit.u_pt)
+ return pyx.path.path(pyx.path.moveto(fb.left(), fb.top()),
+ pyx.path.lineto(fb.right(), fb.top()),
+ pyx.path.lineto(fb.right(), kb.bottom()),
+ pyx.path.lineto(lb.right(), kb.bottom()),
+ pyx.path.lineto(lb.right(), lb.bottom()),
+ pyx.path.lineto(lb.left(), lb.bottom()),
+ pyx.path.lineto(lb.left(), gb.top()),
+ pyx.path.lineto(fb.left(), gb.top()),
+ pyx.path.closepath(),)
+
+
+ def make_dump(s, shift=0, y=0, col=None, bkcol=None, larg=16):
+ c = pyx.canvas.canvas()
+ tlist = []
+ while s:
+ dmp,s = s[:larg-shift],s[larg-shift:]
+ txt = make_dump_txt(shift, y, dmp)
+ tlist.append(txt)
+ shift += len(dmp)
+ if shift >= 16:
+ shift = 0
+ y += 1
+ if col is None:
+ col = pyx.color.rgb.red
+ if bkcol is None:
+ col = pyx.color.rgb.white
+ c.stroke(make_frame(tlist),[col,pyx.deco.filled([bkcol]),pyx.style.linewidth.Thick])
+ for txt in tlist:
+ c.insert(txt)
+ return c, tlist[-1].bbox(), shift, y
+
+
+ last_shift,last_y=0,0.0
+ while t:
+ bkcol = backcolor.next()
+ proto,fields = t.pop()
+ y += 0.5
+ pt = pyx.text.text(XSTART, (YTXT-y)*YMUL, r"\font\cmssfont=cmss10\cmssfont{%s}" % proto.name, [ pyx.text.size.Large])
+ y += 1
+ ptbb=pt.bbox()
+ ptbb.enlarge(pyx.unit.u_pt*2)
+ canvas.stroke(ptbb.path(),[pyx.color.rgb.black, pyx.deco.filled([bkcol])])
+ canvas.insert(pt)
+ for fname, fval, fdump in fields:
+ col = forecolor.next()
+ ft = pyx.text.text(XSTART, (YTXT-y)*YMUL, r"\font\cmssfont=cmss10\cmssfont{%s}" % tex_escape(fname.name))
+ if fval is not None:
+ if len(fval) > 18:
+ fval = fval[:18]+"[...]"
+ else:
+ fval=""
+ vt = pyx.text.text(XSTART+3, (YTXT-y)*YMUL, r"\font\cmssfont=cmss10\cmssfont{%s}" % tex_escape(fval))
+ y += 1.0
+ if fdump:
+ dt,target,last_shift,last_y = make_dump(fdump, last_shift, last_y, col, bkcol)
+
+ dtb = dt.bbox()
+ dtb=target
+ vtb = vt.bbox()
+ bxvt = make_box(vtb)
+ bxdt = make_box(dtb)
+ dtb.enlarge(pyx.unit.u_pt)
+ try:
+ if yd < 0:
+ cnx = pyx.connector.curve(bxvt,bxdt,absangle1=0, absangle2=-90)
+ else:
+ cnx = pyx.connector.curve(bxvt,bxdt,absangle1=0, absangle2=90)
+ except:
+ pass
+ else:
+ canvas.stroke(cnx,[pyx.style.linewidth.thin,pyx.deco.earrow.small,col])
+
+ canvas.insert(dt)
+
+ canvas.insert(ft)
+ canvas.insert(vt)
+ last_y += layer_shift
+
+ return canvas
+
+
+
+ def extract_padding(self, s):
+ """DEV: to be overloaded to extract current layer's padding. Return a couple of strings (actual layer, padding)"""
+ return s,None
+
+ def post_dissect(self, s):
+ """DEV: is called right after the current layer has been dissected"""
+ return s
+
+ def pre_dissect(self, s):
+ """DEV: is called right before the current layer is dissected"""
+ return s
+
+ def do_dissect(self, s):
+ flist = self.fields_desc[:]
+ flist.reverse()
+ while s and flist:
+ f = flist.pop()
+ s,fval = f.getfield(self, s)
+ self.fields[f.name] = fval
+
+ return s
+
+ def do_dissect_payload(self, s):
+ if s:
+ cls = self.guess_payload_class(s)
+ try:
+ p = cls(s, _internal=1, _underlayer=self)
+ except KeyboardInterrupt:
+ raise
+ except:
+ if conf.debug_dissector:
+ if isinstance(cls,type) and issubclass(cls,Packet):
+ log_runtime.error("%s dissector failed" % cls.name)
+ else:
+ log_runtime.error("%s.guess_payload_class() returned [%s]" % (self.__class__.__name__,repr(cls)))
+ if cls is not None:
+ raise
+ p = Raw(s, _internal=1, _underlayer=self)
+ self.add_payload(p)
+
+ def dissect(self, s):
+ s = self.pre_dissect(s)
+
+ s = self.do_dissect(s)
+
+ s = self.post_dissect(s)
+
+ payl,pad = self.extract_padding(s)
+ self.do_dissect_payload(payl)
+ if pad and conf.padding:
+ self.add_payload(Padding(pad))
+
+
+ def guess_payload_class(self, payload):
+ """DEV: Guesses the next payload class from layer bonds. Can be overloaded to use a different mechanism."""
+ for t in self.aliastypes:
+ for fval, cls in t.payload_guess:
+ ok = 1
+ for k in fval.keys():
+ if not hasattr(self, k) or fval[k] != self.getfieldval(k):
+ ok = 0
+ break
+ if ok:
+ return cls
+ return self.default_payload_class(payload)
+
+ def default_payload_class(self, payload):
+ """DEV: Returns the default payload class if nothing has been found by the guess_payload_class() method."""
+ return Raw
+
+ def hide_defaults(self):
+ """Removes fields' values that are the same as default values."""
+ for k in self.fields.keys():
+ if self.default_fields.has_key(k):
+ if self.default_fields[k] == self.fields[k]:
+ del(self.fields[k])
+ self.payload.hide_defaults()
+
+
+ def __iter__(self):
+ def loop(todo, done, self=self):
+ if todo:
+ eltname = todo.pop()
+ elt = self.getfieldval(eltname)
+ if not isinstance(elt, Gen):
+ if self.get_field(eltname).islist:
+ elt = SetGen([elt])
+ else:
+ elt = SetGen(elt)
+ for e in elt:
+ done[eltname]=e
+ for x in loop(todo[:], done):
+ yield x
+ else:
+ if isinstance(self.payload,NoPayload):
+ payloads = [None]
+ else:
+ payloads = self.payload
+ for payl in payloads:
+ done2=done.copy()
+ for k in done2:
+ if isinstance(done2[k], VolatileValue):
+ done2[k] = done2[k]._fix()
+ pkt = self.__class__()
+ pkt.explicit = 1
+ pkt.fields = done2
+ pkt.time = self.time
+ pkt.underlayer = self.underlayer
+ pkt.overload_fields = self.overload_fields.copy()
+ pkt.post_transforms = self.post_transforms
+ if payl is not None:
+ pkt.add_payload(payl)
+ yield pkt
+
+ if self.explicit:
+ todo = []
+ done = self.fields
+ else:
+ todo = [ k for (k,v) in itertools.chain(self.default_fields.iteritems(),
+ self.overloaded_fields.iteritems())
+ if isinstance(v, VolatileValue) ] + self.fields.keys()
+ done = {}
+ return loop(todo, done)
+
+ def __gt__(self, other):
+ """True if other is an answer from self (self ==> other)."""
+ if isinstance(other, Packet):
+ return other < self
+ elif type(other) is str:
+ return 1
+ else:
+ raise TypeError((self, other))
+ def __lt__(self, other):
+ """True if self is an answer from other (other ==> self)."""
+ if isinstance(other, Packet):
+ return self.answers(other)
+ elif type(other) is str:
+ return 1
+ else:
+ raise TypeError((self, other))
+
+ def __eq__(self, other):
+ if not isinstance(other, self.__class__):
+ return False
+ for f in self.fields_desc:
+ if f not in other.fields_desc:
+ return False
+ if self.getfieldval(f.name) != other.getfieldval(f.name):
+ return False
+ return self.payload == other.payload
+
+ def __ne__(self, other):
+ return not self.__eq__(other)
+
+ def hashret(self):
+ """DEV: returns a string that has the same value for a request and its answer."""
+ return self.payload.hashret()
+ def answers(self, other):
+ """DEV: true if self is an answer from other"""
+ if other.__class__ == self.__class__:
+ return self.payload.answers(other.payload)
+ return 0
+
+ def haslayer(self, cls):
+ """true if self has a layer that is an instance of cls. Superseded by "cls in self" syntax."""
+ if self.__class__ == cls or self.__class__.__name__ == cls:
+ return 1
+ for f in self.packetfields:
+ fvalue_gen = self.getfieldval(f.name)
+ if fvalue_gen is None:
+ continue
+ if not f.islist:
+ fvalue_gen = SetGen(fvalue_gen,_iterpacket=0)
+ for fvalue in fvalue_gen:
+ if isinstance(fvalue, Packet):
+ ret = fvalue.haslayer(cls)
+ if ret:
+ return ret
+ return self.payload.haslayer(cls)
+ def getlayer(self, cls, nb=1, _track=None):
+ """Return the nb^th layer that is an instance of cls."""
+ if type(cls) is str and "." in cls:
+ ccls,fld = cls.split(".",1)
+ else:
+ ccls,fld = cls,None
+ if self.__class__ == cls or self.__class__.name == ccls:
+ if nb == 1:
+ if fld is None:
+ return self
+ else:
+ return self.getfieldval(fld)
+ else:
+ nb -=1
+ for f in self.packetfields:
+ fvalue_gen = self.getfieldval(f.name)
+ if fvalue_gen is None:
+ continue
+ if not f.islist:
+ fvalue_gen = SetGen(fvalue_gen,_iterpacket=0)
+ for fvalue in fvalue_gen:
+ if isinstance(fvalue, Packet):
+ track=[]
+ ret = fvalue.getlayer(cls, nb, _track=track)
+ if ret is not None:
+ return ret
+ nb = track[0]
+ return self.payload.getlayer(cls,nb,_track=_track)
+
+ def __getitem__(self, cls):
+ if type(cls) is slice:
+ if cls.stop:
+ ret = self.getlayer(cls.start, cls.stop)
+ else:
+ ret = self.getlayer(cls.start)
+ if ret is None and cls.step is not None:
+ ret = cls.step
+ return ret
+ else:
+ return self.getlayer(cls)
+
+ def __contains__(self, cls):
+ """"cls in self" returns true if self has a layer which is an instance of cls."""
+ return self.haslayer(cls)
+
+
+
+ def display(self,*args,**kargs): # Deprecated. Use show()
+ """Deprecated. Use show() method."""
+ self.show(*args,**kargs)
+ def show(self, indent=3, lvl="", label_lvl=""):
+ """Prints a hierarchical view of the packet. "indent" gives the size of indentation for each layer."""
+ ct = conf.color_theme
+ print "%s%s %s %s" % (label_lvl,
+ ct.punct("###["),
+ ct.layer_name(self.name),
+ ct.punct("]###"))
+ for f in self.fields_desc:
+ if isinstance(f, Emph):
+ ncol = ct.emph_field_name
+ vcol = ct.emph_field_value
+ else:
+ ncol = ct.field_name
+ vcol = ct.field_value
+ fvalue = self.getfieldval(f.name)
+ if isinstance(fvalue, Packet) or (f.islist and f.holds_packets and type(fvalue) is list):
+ print "%s \\%-10s\\" % (label_lvl+lvl, ncol(f.name))
+ fvalue_gen = SetGen(fvalue,_iterpacket=0)
+ for fvalue in fvalue_gen:
+ fvalue.show(indent=indent, label_lvl=label_lvl+lvl+" |")
+ else:
+ print "%s %-10s%s %s" % (label_lvl+lvl,
+ ncol(f.name),
+ ct.punct("="),
+ vcol(f.i2repr(self,fvalue)))
+ self.payload.show(indent=indent, lvl=lvl+(" "*indent*self.show_indent), label_lvl=label_lvl)
+ def show2(self):
+ """Prints a hierarchical view of an assembled version of the packet, so that automatic fields are calculated (checksums, etc.)"""
+ self.__class__(str(self)).show()
+
+ def sprintf(self, fmt, relax=1):
+ """sprintf(format, [relax=1]) -> str
+where format is a string that can include directives. A directive begins and
+ends by % and has the following format %[fmt[r],][cls[:nb].]field%.
+
+fmt is a classic printf directive, "r" can be appended for raw substitution
+(ex: IP.flags=0x18 instead of SA), nb is the number of the layer we want
+(ex: for IP/IP packets, IP:2.src is the src of the upper IP layer).
+Special case : "%.time%" is the creation time.
+Ex : p.sprintf("%.time% %-15s,IP.src% -> %-15s,IP.dst% %IP.chksum% "
+ "%03xr,IP.proto% %r,TCP.flags%")
+
+Moreover, the format string can include conditionnal statements. A conditionnal
+statement looks like : {layer:string} where layer is a layer name, and string
+is the string to insert in place of the condition if it is true, i.e. if layer
+is present. If layer is preceded by a "!", the result si inverted. Conditions
+can be imbricated. A valid statement can be :
+ p.sprintf("This is a{TCP: TCP}{UDP: UDP}{ICMP:n ICMP} packet")
+ p.sprintf("{IP:%IP.dst% {ICMP:%ICMP.type%}{TCP:%TCP.dport%}}")
+
+A side effect is that, to obtain "{" and "}" characters, you must use
+"%(" and "%)".
+"""
+
+ escape = { "%": "%",
+ "(": "{",
+ ")": "}" }
+
+
+ # Evaluate conditions
+ while "{" in fmt:
+ i = fmt.rindex("{")
+ j = fmt[i+1:].index("}")
+ cond = fmt[i+1:i+j+1]
+ k = cond.find(":")
+ if k < 0:
+ raise Scapy_Exception("Bad condition in format string: [%s] (read sprintf doc!)"%cond)
+ cond,format = cond[:k],cond[k+1:]
+ res = False
+ if cond[0] == "!":
+ res = True
+ cond = cond[1:]
+ if self.haslayer(cond):
+ res = not res
+ if not res:
+ format = ""
+ fmt = fmt[:i]+format+fmt[i+j+2:]
+
+ # Evaluate directives
+ s = ""
+ while "%" in fmt:
+ i = fmt.index("%")
+ s += fmt[:i]
+ fmt = fmt[i+1:]
+ if fmt and fmt[0] in escape:
+ s += escape[fmt[0]]
+ fmt = fmt[1:]
+ continue
+ try:
+ i = fmt.index("%")
+ sfclsfld = fmt[:i]
+ fclsfld = sfclsfld.split(",")
+ if len(fclsfld) == 1:
+ f = "s"
+ clsfld = fclsfld[0]
+ elif len(fclsfld) == 2:
+ f,clsfld = fclsfld
+ else:
+ raise Scapy_Exception
+ if "." in clsfld:
+ cls,fld = clsfld.split(".")
+ else:
+ cls = self.__class__.__name__
+ fld = clsfld
+ num = 1
+ if ":" in cls:
+ cls,num = cls.split(":")
+ num = int(num)
+ fmt = fmt[i+1:]
+ except:
+ raise Scapy_Exception("Bad format string [%%%s%s]" % (fmt[:25], fmt[25:] and "..."))
+ else:
+ if fld == "time":
+ val = time.strftime("%H:%M:%S.%%06i", time.localtime(self.time)) % int((self.time-int(self.time))*1000000)
+ elif cls == self.__class__.__name__ and hasattr(self, fld):
+ if num > 1:
+ val = self.payload.sprintf("%%%s,%s:%s.%s%%" % (f,cls,num-1,fld), relax)
+ f = "s"
+ elif f[-1] == "r": # Raw field value
+ val = getattr(self,fld)
+ f = f[:-1]
+ if not f:
+ f = "s"
+ else:
+ val = getattr(self,fld)
+ if fld in self.fieldtype:
+ val = self.fieldtype[fld].i2repr(self,val)
+ else:
+ val = self.payload.sprintf("%%%s%%" % sfclsfld, relax)
+ f = "s"
+ s += ("%"+f) % val
+
+ s += fmt
+ return s
+
+ def mysummary(self):
+ """DEV: can be overloaded to return a string that summarizes the layer.
+ Only one mysummary() is used in a whole packet summary: the one of the upper layer,
+ except if a mysummary() also returns (as a couple) a list of layers whose
+ mysummary() must be called if they are present."""
+ return ""
+
+ def summary(self, intern=0):
+ """Prints a one line summary of a packet."""
+ found,s,needed = self.payload.summary(intern=1)
+ if s:
+ s = " / "+s
+ ret = ""
+ if not found or self.__class__ in needed:
+ ret = self.mysummary()
+ if type(ret) is tuple:
+ ret,n = ret
+ needed += n
+ if ret or needed:
+ found = 1
+ if not ret:
+ ret = self.__class__.__name__
+ ret = "%s%s" % (ret,s)
+ if intern:
+ return found,ret,needed
+ else:
+ return ret
+
+ def lastlayer(self,layer=None):
+ """Returns the uppest layer of the packet"""
+ return self.payload.lastlayer(self)
+
+ def decode_payload_as(self,cls):
+ """Reassembles the payload and decode it using another packet class"""
+ s = str(self.payload)
+ self.payload = cls(s)
+
+ def libnet(self):
+ """Not ready yet. Should give the necessary C code that interfaces with libnet to recreate the packet"""
+ print "libnet_build_%s(" % self.__class__.name.lower()
+ det = self.__class__(str(self))
+ for f in self.fields_desc:
+ val = det.getfieldval(f.name)
+ if val is None:
+ val = 0
+ elif type(val) is int:
+ val = str(val)
+ else:
+ val = '"%s"' % str(val)
+ print "\t%s, \t\t/* %s */" % (val,f.name)
+ print ");"
+ def command(self):
+ """Returns a string representing the command you have to type to obtain the same packet"""
+ f = []
+ for fn,fv in self.fields.items():
+ fld = self.get_field(fn)
+ if isinstance(fv, Packet):
+ fv = fv.command()
+ elif fld.islist and fld.holds_packets and type(fv) is list:
+ fv = "[%s]" % ",".join( map(Packet.command, fv))
+ else:
+ fv = repr(fv)
+ f.append("%s=%s" % (fn, fv))
+ c = "%s(%s)" % (self.__class__.__name__, ", ".join(f))
+ pc = self.payload.command()
+ if pc:
+ c += "/"+pc
+ return c
+
+
+class ASN1_Packet(Packet):
+ ASN1_root = None
+ ASN1_codec = None
+ def init_fields(self):
+ flist = self.ASN1_root.get_fields_list()
+ self.do_init_fields(flist)
+ self.fields_desc = flist
+ def do_build(self):
+ return self.ASN1_root.build(self)
+ def do_dissect(self, x):
+ return self.ASN1_root.dissect(self, x)
+
+
+class NoPayload(Packet,object):
+ def __new__(cls, *args, **kargs):
+ singl = cls.__dict__.get("__singl__")
+ if singl is None:
+ cls.__singl__ = singl = object.__new__(cls)
+ Packet.__init__(singl, *args, **kargs)
+ return singl
+ def __init__(self, *args, **kargs):
+ pass
+ def dissection_done(self,pkt):
+ return
+ def add_payload(self, payload):
+ raise Scapy_Exception("Can't add payload to NoPayload instance")
+ def remove_payload(self):
+ pass
+ def add_underlayer(self,underlayer):
+ pass
+ def remove_underlayer(self,other):
+ pass
+ def copy(self):
+ return self
+ def __repr__(self):
+ return ""
+ def __str__(self):
+ return ""
+ def __nonzero__(self):
+ return False
+ def build(self, internal=0):
+ return ""
+ def build_done(self, p):
+ return p
+ def build_ps(self, internal=0):
+ return "",[]
+ def getfieldval(self, attr):
+ raise AttributeError(attr)
+ def getfield_and_val(self, attr):
+ raise AttributeError(attr)
+ def __getattr__(self, attr):
+ if attr in self.__dict__:
+ return self.__dict__[attr]
+ elif attr in self.__class__.__dict__:
+ return self.__class__.__dict__[attr]
+ else:
+ raise AttributeError, attr
+ def hide_defaults(self):
+ pass
+ def __iter__(self):
+ return iter([])
+ def __eq__(self, other):
+ if isinstance(other, NoPayload):
+ return True
+ return False
+ def hashret(self):
+ return ""
+ def answers(self, other):
+ return isinstance(other, NoPayload) or isinstance(other, Padding)
+ def haslayer(self, cls):
+ return 0
+ def getlayer(self, cls, nb=1, _track=None):
+ if _track is not None:
+ _track.append(nb)
+ return None
+ def show(self, indent=3, lvl="", label_lvl=""):
+ pass
+ def sprintf(self, fmt, relax):
+ if relax:
+ return "??"
+ else:
+ raise Scapy_Exception("Format not found [%s]"%fmt)
+ def summary(self, intern=0):
+ return 0,"",[]
+ def lastlayer(self,layer):
+ return layer
+ def command(self):
+ return ""
+
+
+####################
+## packet classes ##
+####################
+
+
+class Raw(Packet):
+ name = "Raw"
+ fields_desc = [ StrField("load", "") ]
+ def answers(self, other):
+ return 1
+# s = str(other)
+# t = self.load
+# l = min(len(s), len(t))
+# return s[:l] == t[:l]
+
+class Padding(Raw):
+ name = "Padding"
+ def build(self, internal=0):
+ if internal:
+ return ""
+ else:
+ return Raw.build(self)
+
+class Ether(Packet):
+ name = "Ethernet"
+ fields_desc = [ DestMACField("dst"),
+ SourceMACField("src"),
+ XShortEnumField("type", 0x0000, ETHER_TYPES) ]
+ def hashret(self):
+ return struct.pack("H",self.type)+self.payload.hashret()
+ def answers(self, other):
+ if isinstance(other,Ether):
+ if self.type == other.type:
+ return self.payload.answers(other.payload)
+ return 0
+ def mysummary(self):
+ return self.sprintf("%src% > %dst% (%type%)")
+
+class PPPoE(Packet):
+ name = "PPP over Ethernet"
+ fields_desc = [ BitField("version", 1, 4),
+ BitField("type", 1, 4),
+ ByteEnumField("code", 0, {0:"Session"}),
+ XShortField("sessionid", 0x0),
+ ShortField("len", None) ]
+
+ def post_build(self, p, pay):
+ p += pay
+ if self.len is None:
+ l = len(p)-6
+ p = p[:4]+struct.pack("!H", l)+p[6:]
+ return p
+
+class PPPoED(PPPoE):
+ name = "PPP over Ethernet Discovery"
+ fields_desc = [ BitField("version", 1, 4),
+ BitField("type", 1, 4),
+ ByteEnumField("code", 0x09, {0x09:"PADI",0x07:"PADO",0x19:"PADR",0x65:"PADS",0xa7:"PADT"}),
+ XShortField("sessionid", 0x0),
+ ShortField("len", None) ]
+
+class Dot3(Packet):
+ name = "802.3"
+ fields_desc = [ MACField("dst", ETHER_BROADCAST),
+ MACField("src", ETHER_ANY),
+ LenField("len", None, "H") ]
+ def extract_padding(self,s):
+ l = self.len
+ return s[:l],s[l:]
+ def answers(self, other):
+ if isinstance(other,Dot3):
+ return self.payload.answers(other.payload)
+ return 0
+ def mysummary(self):
+ return "802.3 %s > %s" % (self.src, self.dst)
+
+
+class LLC(Packet):
+ name = "LLC"
+ fields_desc = [ XByteField("dsap", 0x00),
+ XByteField("ssap", 0x00),
+ ByteField("ctrl", 0) ]
+
+
+class CookedLinux(Packet):
+ name = "cooked linux"
+ fields_desc = [ ShortEnumField("pkttype",0, {0: "unicast",
+ 4:"sent-by-us"}), #XXX incomplete
+ XShortField("lladdrtype",512),
+ ShortField("lladdrlen",0),
+ StrFixedLenField("src","",8),
+ XShortEnumField("proto",0x800,ETHER_TYPES) ]
+
+
+
+class SNAP(Packet):
+ name = "SNAP"
+ fields_desc = [ X3BytesField("OUI",0x000000),
+ XShortEnumField("code", 0x000, ETHER_TYPES) ]
+
+
+class Dot1Q(Packet):
+ name = "802.1Q"
+ aliastypes = [ Ether ]
+ fields_desc = [ BitField("prio", 0, 3),
+ BitField("id", 0, 1),
+ BitField("vlan", 1, 12),
+ XShortEnumField("type", 0x0000, ETHER_TYPES) ]
+ def answers(self, other):
+ if isinstance(other,Dot1Q):
+ if ( (self.type == other.type) and
+ (self.vlan == other.vlan) ):
+ return self.payload.answers(other.payload)
+ else:
+ return self.payload.answers(other)
+ return 0
+ def default_payload_class(self, pay):
+ if self.type <= 1500:
+ return LLC
+ return Raw
+ def extract_padding(self,s):
+ if self.type <= 1500:
+ return s[:self.type],s[self.type:]
+ return s,None
+ def mysummary(self):
+ if isinstance(self.underlayer, Ether):
+ return self.underlayer.sprintf("802.1q %Ether.src% > %Ether.dst% (%Dot1Q.type%) vlan %Dot1Q.vlan%")
+ else:
+ return self.sprintf("802.1q (%Dot1Q.type%) vlan %Dot1Q.vlan%")
+
+
+
+
+class RadioTap(Packet):
+ name = "RadioTap dummy"
+ fields_desc = [ ByteField('version', 0),
+ ByteField('pad', 0),
+ FieldLenField('len', None, 'notdecoded', '@H', adjust=lambda pkt,x:x+8),
+ FlagsField('present', None, -32, ['TSFT','Flags','Rate','Channel','FHSS','dBm_AntSignal',
+ 'dBm_AntNoise','Lock_Quality','TX_Attenuation','dB_TX_Attenuation',
+ 'dBm_TX_Power', 'Antenna', 'dB_AntSignal', 'dB_AntNoise',
+ 'b14', 'b15','b16','b17','b18','b19','b20','b21','b22','b23',
+ 'b24','b25','b26','b27','b28','b29','b30','Ext']),
+ StrLenField('notdecoded', "", length_from= lambda pkt:pkt.len-8) ]
+
+class STP(Packet):
+ name = "Spanning Tree Protocol"
+ fields_desc = [ ShortField("proto", 0),
+ ByteField("version", 0),
+ ByteField("bpdutype", 0),
+ ByteField("bpduflags", 0),
+ ShortField("rootid", 0),
+ MACField("rootmac", ETHER_ANY),
+ IntField("pathcost", 0),
+ ShortField("bridgeid", 0),
+ MACField("bridgemac", ETHER_ANY),
+ ShortField("portid", 0),
+ BCDFloatField("age", 1),
+ BCDFloatField("maxage", 20),
+ BCDFloatField("hellotime", 2),
+ BCDFloatField("fwddelay", 15) ]
+
+
+class EAPOL(Packet):
+ name = "EAPOL"
+ fields_desc = [ ByteField("version", 1),
+ ByteEnumField("type", 0, ["EAP_PACKET", "START", "LOGOFF", "KEY", "ASF"]),
+ LenField("len", None, "H") ]
+
+ EAP_PACKET= 0
+ START = 1
+ LOGOFF = 2
+ KEY = 3
+ ASF = 4
+ def extract_padding(self, s):
+ l = self.len
+ return s[:l],s[l:]
+ def hashret(self):
+ return chr(self.type)+self.payload.hashret()
+ def answers(self, other):
+ if isinstance(other,EAPOL):
+ if ( (self.type == self.EAP_PACKET) and
+ (other.type == self.EAP_PACKET) ):
+ return self.payload.answers(other.payload)
+ return 0
+ def mysummary(self):
+ return self.sprintf("EAPOL %EAPOL.type%")
+
+
+class EAP(Packet):
+ name = "EAP"
+ fields_desc = [ ByteEnumField("code", 4, {1:"REQUEST",2:"RESPONSE",3:"SUCCESS",4:"FAILURE"}),
+ ByteField("id", 0),
+ ShortField("len",None),
+ ConditionalField(ByteEnumField("type",0, {1:"ID",4:"MD5"}), lambda pkt:pkt.code not in [EAP.SUCCESS, EAP.FAILURE])
+
+ ]
+
+ REQUEST = 1
+ RESPONSE = 2
+ SUCCESS = 3
+ FAILURE = 4
+ TYPE_ID = 1
+ TYPE_MD5 = 4
+ def answers(self, other):
+ if isinstance(other,EAP):
+ if self.code == self.REQUEST:
+ return 0
+ elif self.code == self.RESPONSE:
+ if ( (other.code == self.REQUEST) and
+ (other.type == self.type) ):
+ return 1
+ elif other.code == self.RESPONSE:
+ return 1
+ return 0
+
+ def post_build(self, p, pay):
+ if self.len is None:
+ l = len(p)+len(pay)
+ p = p[:2]+chr((l>>8)&0xff)+chr(l&0xff)+p[4:]
+ return p+pay
+
+
+class ARP(Packet):
+ name = "ARP"
+ fields_desc = [ XShortField("hwtype", 0x0001),
+ XShortEnumField("ptype", 0x0800, ETHER_TYPES),
+ ByteField("hwlen", 6),
+ ByteField("plen", 4),
+ ShortEnumField("op", 1, {"who-has":1, "is-at":2, "RARP-req":3, "RARP-rep":4, "Dyn-RARP-req":5, "Dyn-RAR-rep":6, "Dyn-RARP-err":7, "InARP-req":8, "InARP-rep":9}),
+ ARPSourceMACField("hwsrc"),
+ SourceIPField("psrc","pdst"),
+ MACField("hwdst", ETHER_ANY),
+ IPField("pdst", "0.0.0.0") ]
+ who_has = 1
+ is_at = 2
+ def answers(self, other):
+ if isinstance(other,ARP):
+ if ( (self.op == self.is_at) and
+ (other.op == self.who_has) and
+ (self.psrc == other.pdst) ):
+ return 1
+ return 0
+ def extract_padding(self, s):
+ return "",s
+ def mysummary(self):
+ if self.op == self.is_at:
+ return "ARP is at %s says %s" % (self.hwsrc, self.psrc)
+ elif self.op == self.who_has:
+ return "ARP who has %s says %s" % (self.pdst, self.psrc)
+ else:
+ return "ARP %ARP.op% %ARP.psrc% > %ARP.pdst%"
+
+
+class IP(Packet, IPTools):
+ name = "IP"
+ fields_desc = [ BitField("version" , 4 , 4),
+ BitField("ihl", None, 4),
+ XByteField("tos", 0),
+ ShortField("len", None),
+ ShortField("id", 1),
+ FlagsField("flags", 0, 3, ["MF","DF","evil"]),
+ BitField("frag", 0, 13),
+ ByteField("ttl", 64),
+ ByteEnumField("proto", 0, IP_PROTOS),
+ XShortField("chksum", None),
+ #IPField("src", "127.0.0.1"),
+ Emph(SourceIPField("src","dst")),
+ Emph(IPField("dst", "127.0.0.1")),
+ IPoptionsField("options", "") ]
+ def post_build(self, p, pay):
+ ihl = self.ihl
+ if ihl is None:
+ ihl = len(p)/4
+ p = chr(((self.version&0xf)<<4) | ihl&0x0f)+p[1:]
+ if self.len is None:
+ l = len(p)+len(pay)
+ p = p[:2]+struct.pack("!H", l)+p[4:]
+ if self.chksum is None:
+ ck = checksum(p)
+ p = p[:10]+chr(ck>>8)+chr(ck&0xff)+p[12:]
+ return p+pay
+
+ def extract_padding(self, s):
+ l = self.len - (self.ihl << 2)
+ return s[:l],s[l:]
+
+ def send(self, s, slp=0):
+ for p in self:
+ try:
+ s.sendto(str(p), (p.dst,0))
+ except socket.error, msg:
+ log_runtime.error(msg)
+ if slp:
+ time.sleep(slp)
+ def hashret(self):
+ if ( (self.proto == socket.IPPROTO_ICMP)
+ and (isinstance(self.payload, ICMP))
+ and (self.payload.type in [3,4,5,11,12]) ):
+ return self.payload.payload.hashret()
+ else:
+ if conf.checkIPsrc and conf.checkIPaddr:
+ return strxor(inet_aton(self.src),inet_aton(self.dst))+struct.pack("B",self.proto)+self.payload.hashret()
+ else:
+ return struct.pack("B", self.proto)+self.payload.hashret()
+ def answers(self, other):
+ if not isinstance(other,IP):
+ return 0
+ if conf.checkIPaddr and (self.dst != other.src):
+ return 0
+ if ( (self.proto == socket.IPPROTO_ICMP) and
+ (isinstance(self.payload, ICMP)) and
+ (self.payload.type in [3,4,5,11,12]) ):
+ # ICMP error message
+ return self.payload.payload.answers(other)
+
+ else:
+ if ( (conf.checkIPaddr and (self.src != other.dst)) or
+ (self.proto != other.proto) ):
+ return 0
+ return self.payload.answers(other.payload)
+ def mysummary(self):
+ s = self.sprintf("%IP.src% > %IP.dst% %IP.proto%")
+ if self.frag:
+ s += " frag:%i" % self.frag
+ return s
+
+
+
+class TCP(Packet):
+ name = "TCP"
+ fields_desc = [ ShortEnumField("sport", 20, TCP_SERVICES),
+ ShortEnumField("dport", 80, TCP_SERVICES),
+ IntField("seq", 0),
+ IntField("ack", 0),
+ BitField("dataofs", None, 4),
+ BitField("reserved", 0, 4),
+ FlagsField("flags", 0x2, 8, "FSRPAUEC"),
+ ShortField("window", 8192),
+ XShortField("chksum", None),
+ ShortField("urgptr", 0),
+ TCPOptionsField("options", {}) ]
+ def post_build(self, p, pay):
+ p += pay
+ dataofs = self.dataofs
+ if dataofs is None:
+ dataofs = 5+((len(self.get_field("options").i2m(self,self.options))+3)/4)
+ p = p[:12]+chr((dataofs << 4) | ord(p[12])&0x0f)+p[13:]
+ if self.chksum is None:
+ if isinstance(self.underlayer, IP):
+ if self.underlayer.len is not None:
+ ln = self.underlayer.len-20
+ else:
+ ln = len(p)
+ psdhdr = struct.pack("!4s4sHH",
+ inet_aton(self.underlayer.src),
+ inet_aton(self.underlayer.dst),
+ self.underlayer.proto,
+ ln)
+ ck=checksum(psdhdr+p)
+ p = p[:16]+struct.pack("!H", ck)+p[18:]
+ elif isinstance(self.underlayer, IPv6) or isinstance(self.underlayer, _IPv6OptionHeader):
+ ck = in6_chksum(socket.IPPROTO_TCP, self.underlayer, p)
+ p = p[:16]+struct.pack("!H", ck)+p[18:]
+ else:
+ warning("No IP underlayer to compute checksum. Leaving null.")
+ return p
+ def hashret(self):
+ if conf.checkIPsrc:
+ return struct.pack("H",self.sport ^ self.dport)+self.payload.hashret()
+ else:
+ return self.payload.hashret()
+ def answers(self, other):
+ if not isinstance(other, TCP):
+ return 0
+ if conf.checkIPsrc:
+ if not ((self.sport == other.dport) and
+ (self.dport == other.sport)):
+ return 0
+ if (abs(other.seq-self.ack) > 2+len(other.payload)):
+ return 0
+ return 1
+ def mysummary(self):
+ if isinstance(self.underlayer, IP):
+ return self.underlayer.sprintf("TCP %IP.src%:%TCP.sport% > %IP.dst%:%TCP.dport% %TCP.flags%")
+ elif isinstance(self.underlayer, IPv6):
+ return self.underlayer.sprintf("TCP %IPv6.src%:%TCP.sport% > %IPv6.dst%:%TCP.dport% %TCP.flags%")
+ else:
+ return self.sprintf("TCP %TCP.sport% > %TCP.dport% %TCP.flags%")
+
+class UDP(Packet):
+ name = "UDP"
+ fields_desc = [ ShortEnumField("sport", 53, UDP_SERVICES),
+ ShortEnumField("dport", 53, UDP_SERVICES),
+ ShortField("len", None),
+ XShortField("chksum", None), ]
+ def post_build(self, p, pay):
+ p += pay
+ l = self.len
+ if l is None:
+ l = len(p)
+ p = p[:4]+struct.pack("!H",l)+p[6:]
+ if self.chksum is None:
+ if isinstance(self.underlayer, IP):
+ if self.underlayer.len is not None:
+ ln = self.underlayer.len-20
+ else:
+ ln = len(p)
+ psdhdr = struct.pack("!4s4sHH",
+ inet_aton(self.underlayer.src),
+ inet_aton(self.underlayer.dst),
+ self.underlayer.proto,
+ ln)
+ ck=checksum(psdhdr+p)
+ p = p[:6]+struct.pack("!H", ck)+p[8:]
+ elif isinstance(self.underlayer, IPv6) or isinstance(self.underlayer, _IPv6OptionHeader):
+ ck = in6_chksum(socket.IPPROTO_UDP, self.underlayer, p)
+ p = p[:6]+struct.pack("!H", ck)+p[8:]
+ else:
+ warning("No IP underlayer to compute checksum. Leaving null.")
+ return p
+ def extract_padding(self, s):
+ l = self.len - 8
+ return s[:l],s[l:]
+ def hashret(self):
+ return self.payload.hashret()
+ def answers(self, other):
+ if not isinstance(other, UDP):
+ return 0
+ if conf.checkIPsrc:
+ if self.dport != other.sport:
+ return 0
+ return self.payload.answers(other.payload)
+ def mysummary(self):
+ if isinstance(self.underlayer, IP):
+ return self.underlayer.sprintf("UDP %IP.src%:%UDP.sport% > %IP.dst%:%UDP.dport%")
+ elif isinstance(self.underlayer, IPv6):
+ return self.underlayer.sprintf("UDP %IPv6.src%:%UDP.sport% > %IPv6.dst%:%UDP.dport%")
+ else:
+ return self.sprintf("UDP %UDP.sport% > %UDP.dport%")
+
+icmptypes = { 0 : "echo-reply",
+ 3 : "dest-unreach",
+ 4 : "source-quench",
+ 5 : "redirect",
+ 8 : "echo-request",
+ 9 : "router-advertisement",
+ 10 : "router-solicitation",
+ 11 : "time-exceeded",
+ 12 : "parameter-problem",
+ 13 : "timestamp-request",
+ 14 : "timestamp-reply",
+ 15 : "information-request",
+ 16 : "information-response",
+ 17 : "address-mask-request",
+ 18 : "address-mask-reply" }
+
+class ICMP(Packet):
+ name = "ICMP"
+ fields_desc = [ ByteEnumField("type",8, icmptypes),
+ ByteField("code",0),
+ XShortField("chksum", None),
+ XShortField("id",0),
+ XShortField("seq",0) ]
+ def post_build(self, p, pay):
+ p += pay
+ if self.chksum is None:
+ ck = checksum(p)
+ p = p[:2]+chr(ck>>8)+chr(ck&0xff)+p[4:]
+ return p
+
+ def hashret(self):
+ return struct.pack("HH",self.id,self.seq)+self.payload.hashret()
+ def answers(self, other):
+ if not isinstance(other,ICMP):
+ return 0
+ if ( (other.type,self.type) in [(8,0),(13,14),(15,16),(17,18)] and
+ self.id == other.id and
+ self.seq == other.seq ):
+ return 1
+ return 0
+
+ def guess_payload_class(self, payload):
+ if self.type in [3,4,5,11,12]:
+ return IPerror
+ else:
+ return None
+ def mysummary(self):
+ if isinstance(self.underlayer, IP):
+ return self.underlayer.sprintf("ICMP %IP.src% > %IP.dst% %ICMP.type% %ICMP.code%")
+ else:
+ return self.sprintf("ICMP %ICMP.type% %ICMP.code%")
+
+
+
+
+
+class IPerror(IP):
+ name = "IP in ICMP"
+ def answers(self, other):
+ if not isinstance(other, IP):
+ return 0
+ if not ( ((conf.checkIPsrc == 0) or (self.dst == other.dst)) and
+ (self.src == other.src) and
+ ( ((conf.checkIPID == 0)
+ or (self.id == other.id)
+ or (conf.checkIPID == 1 and self.id == socket.htons(other.id)))) and
+ (self.proto == other.proto) ):
+ return 0
+ return self.payload.answers(other.payload)
+ def mysummary(self):
+ return Packet.mysummary(self)
+
+
+class TCPerror(TCP):
+ name = "TCP in ICMP"
+ def answers(self, other):
+ if not isinstance(other, TCP):
+ return 0
+ if conf.checkIPsrc:
+ if not ((self.sport == other.sport) and
+ (self.dport == other.dport)):
+ return 0
+ if conf.check_TCPerror_seqack:
+ if self.seq is not None:
+ if self.seq != other.seq:
+ return 0
+ if self.ack is not None:
+ if self.ack != other.ack:
+ return 0
+ return 1
+ def mysummary(self):
+ return Packet.mysummary(self)
+
+
+class UDPerror(UDP):
+ name = "UDP in ICMP"
+ def answers(self, other):
+ if not isinstance(other, UDP):
+ return 0
+ if conf.checkIPsrc:
+ if not ((self.sport == other.sport) and
+ (self.dport == other.dport)):
+ return 0
+ return 1
+ def mysummary(self):
+ return Packet.mysummary(self)
+
+
+
+class ICMPerror(ICMP):
+ name = "ICMP in ICMP"
+ def answers(self, other):
+ if not isinstance(other,ICMP):
+ return 0
+ if not ((self.type == other.type) and
+ (self.code == other.code)):
+ return 0
+ if self.code in [0,8,13,14,17,18]:
+ if (self.id == other.id and
+ self.seq == other.seq):
+ return 1
+ else:
+ return 0
+ else:
+ return 1
+ def mysummary(self):
+ return Packet.mysummary(self)
+
+class IPv6(Packet):
+ """See http://namabiiru.hongo.wide.ad.jp/scapy6"""
+ name = "IPv6 not implemented here."
+ def __init__(self, *args, **kargs):
+ log_interactive.error(self.name)
+ def __repr__(self):
+ return "<IPv6: ERROR not implemented>"
+
+class _IPv6OptionHeader(Packet):
+ """See http://namabiiru.hongo.wide.ad.jp/scapy6"""
+ name = "IPv6 not implemented here."
+ def __init__(self, *args, **kargs):
+ log_interactive.error(self.name)
+ def __repr__(self):
+ return "<IPv6: ERROR not implemented>"
+
+class PPP(Packet):
+ name = "PPP Link Layer"
+ fields_desc = [ ShortEnumField("proto", 0x0021, {0x0021: "IP",
+ 0xc021: "LCP"} ) ]
+
+
+class DNS(Packet):
+ name = "DNS"
+ fields_desc = [ ShortField("id",0),
+ BitField("qr",0, 1),
+ BitEnumField("opcode", 0, 4, {0:"QUERY",1:"IQUERY",2:"STATUS"}),
+ BitField("aa", 0, 1),
+ BitField("tc", 0, 1),
+ BitField("rd", 0, 1),
+ BitField("ra", 0 ,1),
+ BitField("z", 0, 3),
+ BitEnumField("rcode", 0, 4, {0:"ok", 1:"format-error", 2:"server-failure", 3:"name-error", 4:"not-implemented", 5:"refused"}),
+ DNSRRCountField("qdcount", None, "qd"),
+ DNSRRCountField("ancount", None, "an"),
+ DNSRRCountField("nscount", None, "ns"),
+ DNSRRCountField("arcount", None, "ar"),
+ DNSQRField("qd", "qdcount"),
+ DNSRRField("an", "ancount"),
+ DNSRRField("ns", "nscount"),
+ DNSRRField("ar", "arcount",0) ]
+ def answers(self, other):
+ return (isinstance(other, DNS)
+ and self.id == other.id
+ and self.qr == 1
+ and other.qr == 0)
+
+ def mysummary(self):
+ type = ["Qry","Ans"][self.qr]
+ name = ""
+ if self.qr:
+ type = "Ans"
+ if self.ancount > 0 and isinstance(self.an, DNSRR):
+ name = ' "%s"' % self.an.rdata
+ else:
+ type = "Qry"
+ if self.qdcount > 0 and isinstance(self.qd, DNSQR):
+ name = ' "%s"' % self.qd.qname
+ return 'DNS %s%s ' % (type, name)
+
+dnstypes = { 0:"ANY", 255:"ALL",
+ 1:"A", 2:"NS", 3:"MD", 4:"MD", 5:"CNAME", 6:"SOA", 7: "MB", 8:"MG",
+ 9:"MR",10:"NULL",11:"WKS",12:"PTR",13:"HINFO",14:"MINFO",15:"MX",16:"TXT",
+ 17:"RP",18:"AFSDB",28:"AAAA", 33:"SRV",38:"A6",39:"DNAME"}
+
+dnsqtypes = {251:"IXFR",252:"AXFR",253:"MAILB",254:"MAILA",255:"ALL"}
+dnsqtypes.update(dnstypes)
+dnsclasses = {1: 'IN', 2: 'CS', 3: 'CH', 4: 'HS', 255: 'ANY'}
+
+
+class DNSQR(Packet):
+ name = "DNS Question Record"
+ show_indent=0
+ fields_desc = [ DNSStrField("qname",""),
+ ShortEnumField("qtype", 1, dnsqtypes),
+ ShortEnumField("qclass", 1, dnsclasses) ]
+
+
+
+class DNSRR(Packet):
+ name = "DNS Resource Record"
+ show_indent=0
+ fields_desc = [ DNSStrField("rrname",""),
+ ShortEnumField("type", 1, dnstypes),
+ ShortEnumField("rclass", 1, dnsclasses),
+ IntField("ttl", 0),
+ RDLenField("rdlen"),
+ RDataField("rdata", "", length_from=lambda pkt:pkt.rdlen) ]
+
+dhcpmagic="c\x82Sc"
+
+
+class BOOTP(Packet):
+ name = "BOOTP"
+ fields_desc = [ ByteEnumField("op",1, {1:"BOOTREQUEST", 2:"BOOTREPLY"}),
+ ByteField("htype",1),
+ ByteField("hlen",6),
+ ByteField("hops",0),
+ IntField("xid",0),
+ ShortField("secs",0),
+ FlagsField("flags", 0, 16, "???????????????B"),
+ IPField("ciaddr","0.0.0.0"),
+ IPField("yiaddr","0.0.0.0"),
+ IPField("siaddr","0.0.0.0"),
+ IPField("giaddr","0.0.0.0"),
+ Field("chaddr","", "16s"),
+ Field("sname","","64s"),
+ Field("file","","128s"),
+ StrField("options","") ]
+ def guess_payload_class(self, payload):
+ if self.options[:len(dhcpmagic)] == dhcpmagic:
+ return DHCP
+ else:
+ return Packet.guess_payload_class(self, payload)
+ def extract_padding(self,s):
+ if self.options[:len(dhcpmagic)] == dhcpmagic:
+ # set BOOTP options to DHCP magic cookie and make rest a payload of DHCP options
+ payload = self.options[len(dhcpmagic):]
+ self.options = self.options[:len(dhcpmagic)]
+ return payload, None
+ else:
+ return "", None
+ def hashret(self):
+ return struct.pack("L", self.xid)
+ def answers(self, other):
+ if not isinstance(other, BOOTP):
+ return 0
+ return self.xid == other.xid
+
+
+
+#DHCP_UNKNOWN, DHCP_IP, DHCP_IPLIST, DHCP_TYPE \
+#= range(4)
+#
+
+DHCPTypes = {
+ 1: "discover",
+ 2: "offer",
+ 3: "request",
+ 4: "decline",
+ 5: "ack",
+ 6: "nak",
+ 7: "release",
+ 8: "inform",
+ 9: "force_renew",
+ 10:"lease_query",
+ 11:"lease_unassigned",
+ 12:"lease_unknown",
+ 13:"lease_active",
+ }
+
+DHCPOptions = {
+ 0: "pad",
+ 1: IPField("subnet_mask", "0.0.0.0"),
+ 2: "time_zone",
+ 3: IPField("router","0.0.0.0"),
+ 4: IPField("time_server","0.0.0.0"),
+ 5: IPField("IEN_name_server","0.0.0.0"),
+ 6: IPField("name_server","0.0.0.0"),
+ 7: IPField("log_server","0.0.0.0"),
+ 8: IPField("cookie_server","0.0.0.0"),
+ 9: IPField("lpr_server","0.0.0.0"),
+ 12: "hostname",
+ 14: "dump_path",
+ 15: "domain",
+ 17: "root_disk_path",
+ 22: "max_dgram_reass_size",
+ 23: "default_ttl",
+ 24: "pmtu_timeout",
+ 28: IPField("broadcast_address","0.0.0.0"),
+ 35: "arp_cache_timeout",
+ 36: "ether_or_dot3",
+ 37: "tcp_ttl",
+ 38: "tcp_keepalive_interval",
+ 39: "tcp_keepalive_garbage",
+ 40: "NIS_domain",
+ 41: IPField("NIS_server","0.0.0.0"),
+ 42: IPField("NTP_server","0.0.0.0"),
+ 43: "vendor_specific",
+ 44: IPField("NetBIOS_server","0.0.0.0"),
+ 45: IPField("NetBIOS_dist_server","0.0.0.0"),
+ 50: IPField("requested_addr","0.0.0.0"),
+ 51: IntField("lease_time", 43200),
+ 54: IPField("server_id","0.0.0.0"),
+ 55: "param_req_list",
+ 57: ShortField("max_dhcp_size", 1500),
+ 58: IntField("renewal_time", 21600),
+ 59: IntField("rebinding_time", 37800),
+ 60: "vendor_class_id",
+ 61: "client_id",
+
+ 64: "NISplus_domain",
+ 65: IPField("NISplus_server","0.0.0.0"),
+ 69: IPField("SMTP_server","0.0.0.0"),
+ 70: IPField("POP3_server","0.0.0.0"),
+ 71: IPField("NNTP_server","0.0.0.0"),
+ 72: IPField("WWW_server","0.0.0.0"),
+ 73: IPField("Finger_server","0.0.0.0"),
+ 74: IPField("IRC_server","0.0.0.0"),
+ 75: IPField("StreetTalk_server","0.0.0.0"),
+ 76: "StreetTalk_Dir_Assistance",
+ 82: "relay_agent_Information",
+ 53: ByteEnumField("message-type", 1, DHCPTypes),
+ # 55: DHCPRequestListField("request-list"),
+ 255: "end"
+ }
+
+DHCPRevOptions = {}
+
+for k,v in DHCPOptions.iteritems():
+ if type(v) is str:
+ n = v
+ v = None
+ else:
+ n = v.name
+ DHCPRevOptions[n] = (k,v)
+del(n)
+del(v)
+del(k)
+
+
+
+
+
+class DHCPOptionsField(StrField):
+ islist=1
+ def i2repr(self,pkt,x):
+ s = []
+ for v in x:
+ if type(v) is tuple and len(v) == 2:
+ if DHCPRevOptions.has_key(v[0]) and isinstance(DHCPRevOptions[v[0]][1],Field):
+ f = DHCPRevOptions[v[0]][1]
+ vv = f.i2repr(pkt,v[1])
+ else:
+ vv = repr(v[1])
+ s.append("%s=%s" % (v[0],vv))
+ else:
+ s.append(str(v))
+ return "[%s]" % (" ".join(s))
+
+ def getfield(self, pkt, s):
+ return "", self.m2i(pkt, s)
+ def m2i(self, pkt, x):
+ opt = []
+ while x:
+ o = ord(x[0])
+ if o == 255:
+ opt.append("end")
+ x = x[1:]
+ continue
+ if o == 0:
+ opt.append("pad")
+ x = x[1:]
+ continue
+ if DHCPOptions.has_key(o):
+ f = DHCPOptions[o]
+
+ if isinstance(f, str):
+ olen = ord(x[1])
+ opt.append( (f,x[2:olen+2]) )
+ x = x[olen+2:]
+ else:
+ olen = ord(x[1])
+ left, val = f.getfield(pkt,x[2:olen+2])
+# val = f.m2i(pkt,val)
+# if left:
+# print "m2i data left left=%s" % left
+ opt.append((f.name, val))
+ x = x[olen+2:]
+ else:
+ olen = ord(x[1])
+ opt.append((o, x[2:olen+2]))
+ x = x[olen+2:]
+ return opt
+ def i2m(self, pkt, x):
+ #print "i2m x=%s" % x
+ s = ""
+ for o in x:
+ if type(o) is tuple and len(o) == 2:
+ name, val = o
+
+ if isinstance(name, int):
+ onum, oval = name, val
+ elif DHCPRevOptions.has_key(name):
+ onum, f = DHCPRevOptions[name]
+ if f is None:
+ oval = val
+ else:
+# oval = f.addfield(pkt,"",f.i2m(pkt,f.any2i(pkt,val)))
+ oval = f.addfield(pkt,"",f.any2i(pkt,val))
+
+ else:
+ warning("Unknown field option %s" % name)
+ continue
+
+ s += chr(onum)
+ s += chr(len(oval))
+ s += oval
+
+ elif (type(o) is str and DHCPRevOptions.has_key(o) and
+ DHCPRevOptions[o][1] == None):
+ s += chr(DHCPRevOptions[o][0])
+ elif type(o) is int:
+ s += chr(o)
+ else:
+ warning("Malformed option %s" % o)
+ return s
+
+
+class DHCP(Packet):
+ name = "DHCP options"
+ fields_desc = [ DHCPOptionsField("options","") ]
+
+
+class Dot11(Packet):
+ name = "802.11"
+ fields_desc = [
+ BitField("subtype", 0, 4),
+ BitEnumField("type", 0, 2, ["Management", "Control", "Data", "Reserved"]),
+ BitField("proto", 0, 2),
+ FlagsField("FCfield", 0, 8, ["to-DS", "from-DS", "MF", "retry", "pw-mgt", "MD", "wep", "order"]),
+ ShortField("ID",0),
+ MACField("addr1", ETHER_ANY),
+ Dot11Addr2MACField("addr2", ETHER_ANY),
+ Dot11Addr3MACField("addr3", ETHER_ANY),
+ Dot11SCField("SC", 0),
+ Dot11Addr4MACField("addr4", ETHER_ANY)
+ ]
+ def mysummary(self):
+ return self.sprintf("802.11 %Dot11.type% %Dot11.subtype% %Dot11.addr2% > %Dot11.addr1%")
+ def guess_payload_class(self, payload):
+ if self.FCfield & 0x40:
+ return Dot11WEP
+ else:
+ return Packet.guess_payload_class(self, payload)
+ def answers(self, other):
+ if isinstance(other,Dot11):
+ if self.type == 0: # management
+ if self.addr1.lower() != other.addr2.lower(): # check resp DA w/ req SA
+ return 0
+ if (other.subtype,self.subtype) in [(0,1),(2,3),(4,5)]:
+ return 1
+ if self.subtype == other.subtype == 11: # auth
+ return self.payload.answers(other.payload)
+ elif self.type == 1: # control
+ return 0
+ elif self.type == 2: # data
+ return self.payload.answers(other.payload)
+ elif self.type == 3: # reserved
+ return 0
+ return 0
+ def unwep(self, key=None, warn=1):
+ if self.FCfield & 0x40 == 0:
+ if warn:
+ warning("No WEP to remove")
+ return
+ if isinstance(self.payload.payload, NoPayload):
+ if key or conf.wepkey:
+ self.payload.decrypt(key)
+ if isinstance(self.payload.payload, NoPayload):
+ if warn:
+ warning("Dot11 can't be decrypted. Check conf.wepkey.")
+ return
+ self.FCfield &= ~0x40
+ self.payload=self.payload.payload
+
+
+capability_list = [ "res8", "res9", "short-slot", "res11",
+ "res12", "DSSS-OFDM", "res14", "res15",
+ "ESS", "IBSS", "CFP", "CFP-req",
+ "privacy", "short-preamble", "PBCC", "agility"]
+
+reason_code = {0:"reserved",1:"unspec", 2:"auth-expired",
+ 3:"deauth-ST-leaving",
+ 4:"inactivity", 5:"AP-full", 6:"class2-from-nonauth",
+ 7:"class3-from-nonass", 8:"disas-ST-leaving",
+ 9:"ST-not-auth"}
+
+status_code = {0:"success", 1:"failure", 10:"cannot-support-all-cap",
+ 11:"inexist-asso", 12:"asso-denied", 13:"algo-unsupported",
+ 14:"bad-seq-num", 15:"challenge-failure",
+ 16:"timeout", 17:"AP-full",18:"rate-unsupported" }
+
+class Dot11Beacon(Packet):
+ name = "802.11 Beacon"
+ fields_desc = [ LELongField("timestamp", 0),
+ LEShortField("beacon_interval", 0x0064),
+ FlagsField("cap", 0, 16, capability_list) ]
+
+
+class Dot11Elt(Packet):
+ name = "802.11 Information Element"
+ fields_desc = [ ByteEnumField("ID", 0, {0:"SSID", 1:"Rates", 2: "FHset", 3:"DSset", 4:"CFset", 5:"TIM", 6:"IBSSset", 16:"challenge",
+ 42:"ERPinfo", 47:"ERPinfo", 48:"RSNinfo", 50:"ESRates",221:"vendor",68:"reserved"}),
+ FieldLenField("len", None, "info", "B"),
+ StrLenField("info", "", length_from=lambda x:x.len) ]
+ def mysummary(self):
+ if self.ID == 0:
+ return "SSID=%s"%repr(self.info),[Dot11]
+ else:
+ return ""
+
+class Dot11ATIM(Packet):
+ name = "802.11 ATIM"
+
+class Dot11Disas(Packet):
+ name = "802.11 Disassociation"
+ fields_desc = [ LEShortEnumField("reason", 1, reason_code) ]
+
+class Dot11AssoReq(Packet):
+ name = "802.11 Association Request"
+ fields_desc = [ FlagsField("cap", 0, 16, capability_list),
+ LEShortField("listen_interval", 0x00c8) ]
+
+
+class Dot11AssoResp(Packet):
+ name = "802.11 Association Response"
+ fields_desc = [ FlagsField("cap", 0, 16, capability_list),
+ LEShortField("status", 0),
+ LEShortField("AID", 0) ]
+
+class Dot11ReassoReq(Packet):
+ name = "802.11 Reassociation Request"
+ fields_desc = [ FlagsField("cap", 0, 16, capability_list),
+ MACField("current_AP", ETHER_ANY),
+ LEShortField("listen_interval", 0x00c8) ]
+
+
+class Dot11ReassoResp(Dot11AssoResp):
+ name = "802.11 Reassociation Response"
+
+class Dot11ProbeReq(Packet):
+ name = "802.11 Probe Request"
+
+class Dot11ProbeResp(Packet):
+ name = "802.11 Probe Response"
+ fields_desc = [ LELongField("timestamp", 0),
+ LEShortField("beacon_interval", 0x0064),
+ FlagsField("cap", 0, 16, capability_list) ]
+
+class Dot11Auth(Packet):
+ name = "802.11 Authentication"
+ fields_desc = [ LEShortEnumField("algo", 0, ["open", "sharedkey"]),
+ LEShortField("seqnum", 0),
+ LEShortEnumField("status", 0, status_code) ]
+ def answers(self, other):
+ if self.seqnum == other.seqnum+1:
+ return 1
+ return 0
+
+class Dot11Deauth(Packet):
+ name = "802.11 Deauthentication"
+ fields_desc = [ LEShortEnumField("reason", 1, reason_code) ]
+
+
+
+class Dot11WEP(Packet):
+ name = "802.11 WEP packet"
+ fields_desc = [ StrFixedLenField("iv", "\0\0\0", 3),
+ ByteField("keyid", 0),
+ StrField("wepdata",None,remain=4),
+ IntField("icv",None) ]
+
+ def post_dissect(self, s):
+# self.icv, = struct.unpack("!I",self.wepdata[-4:])
+# self.wepdata = self.wepdata[:-4]
+ self.decrypt()
+
+ def build_payload(self):
+ if self.wepdata is None:
+ return Packet.build_payload(self)
+ return ""
+
+ def post_build(self, p, pay):
+ if self.wepdata is None:
+ key = conf.wepkey
+ if key:
+ if self.icv is None:
+ pay += struct.pack("<I",crc32(pay))
+ icv = ""
+ else:
+ icv = p[4:8]
+ c = ARC4.new(self.iv+key)
+ p = p[:4]+c.encrypt(pay)+icv
+ else:
+ warning("No WEP key set (conf.wepkey).. strange results expected..")
+ return p
+
+
+ def decrypt(self,key=None):
+ if key is None:
+ key = conf.wepkey
+ if key:
+ c = ARC4.new(self.iv+key)
+ self.add_payload(LLC(c.decrypt(self.wepdata)))
+
+
+
+class PrismHeader(Packet):
+ """ iwpriv wlan0 monitor 3 """
+ name = "Prism header"
+ fields_desc = [ LEIntField("msgcode",68),
+ LEIntField("len",144),
+ StrFixedLenField("dev","",16),
+ LEIntField("hosttime_did",0),
+ LEShortField("hosttime_status",0),
+ LEShortField("hosttime_len",0),
+ LEIntField("hosttime",0),
+ LEIntField("mactime_did",0),
+ LEShortField("mactime_status",0),
+ LEShortField("mactime_len",0),
+ LEIntField("mactime",0),
+ LEIntField("channel_did",0),
+ LEShortField("channel_status",0),
+ LEShortField("channel_len",0),
+ LEIntField("channel",0),
+ LEIntField("rssi_did",0),
+ LEShortField("rssi_status",0),
+ LEShortField("rssi_len",0),
+ LEIntField("rssi",0),
+ LEIntField("sq_did",0),
+ LEShortField("sq_status",0),
+ LEShortField("sq_len",0),
+ LEIntField("sq",0),
+ LEIntField("signal_did",0),
+ LEShortField("signal_status",0),
+ LEShortField("signal_len",0),
+ LESignedIntField("signal",0),
+ LEIntField("noise_did",0),
+ LEShortField("noise_status",0),
+ LEShortField("noise_len",0),
+ LEIntField("noise",0),
+ LEIntField("rate_did",0),
+ LEShortField("rate_status",0),
+ LEShortField("rate_len",0),
+ LEIntField("rate",0),
+ LEIntField("istx_did",0),
+ LEShortField("istx_status",0),
+ LEShortField("istx_len",0),
+ LEIntField("istx",0),
+ LEIntField("frmlen_did",0),
+ LEShortField("frmlen_status",0),
+ LEShortField("frmlen_len",0),
+ LEIntField("frmlen",0),
+ ]
+ def answers(self, other):
+ if isinstance(other, PrismHeader):
+ return self.payload.answers(other.payload)
+ else:
+ return self.payload.answers(other)
+
+
+
+class HSRP(Packet):
+ name = "HSRP"
+ fields_desc = [
+ ByteField("version", 0),
+ ByteEnumField("opcode", 0, { 0:"Hello"}),
+ ByteEnumField("state", 16, { 16:"Active"}),
+ ByteField("hellotime", 3),
+ ByteField("holdtime", 10),
+ ByteField("priority", 120),
+ ByteField("group", 1),
+ ByteField("reserved", 0),
+ StrFixedLenField("auth","cisco",8),
+ IPField("virtualIP","192.168.1.1") ]
+
+
+
+
+
+
+
+class NTP(Packet):
+ # RFC 1769
+ name = "NTP"
+ fields_desc = [
+ BitEnumField('leap', 0, 2,
+ { 0: 'nowarning',
+ 1: 'longminute',
+ 2: 'shortminute',
+ 3: 'notsync'}),
+ BitField('version', 3, 3),
+ BitEnumField('mode', 3, 3,
+ { 0: 'reserved',
+ 1: 'sym_active',
+ 2: 'sym_passive',
+ 3: 'client',
+ 4: 'server',
+ 5: 'broadcast',
+ 6: 'control',
+ 7: 'private'}),
+ BitField('stratum', 2, 8),
+ BitField('poll', 0xa, 8), ### XXX : it's a signed int
+ BitField('precision', 0, 8), ### XXX : it's a signed int
+ FloatField('delay', 0, 32),
+ FloatField('dispersion', 0, 32),
+ IPField('id', "127.0.0.1"),
+ TimeStampField('ref', 0, 64),
+ TimeStampField('orig', -1, 64), # -1 means current time
+ TimeStampField('recv', 0, 64),
+ TimeStampField('sent', -1, 64)
+ ]
+ def mysummary(self):
+ return self.sprintf("NTP v%ir,NTP.version%, %NTP.mode%")
+
+
+class GRE(Packet):
+ name = "GRE"
+ fields_desc = [ BitField("chksumpresent",0,1),
+ BitField("reserved0",0,12),
+ BitField("version",0,3),
+ XShortEnumField("proto", 0x0000, ETHER_TYPES),
+ ConditionalField(XShortField("chksum",None),lambda pkt:pkt.chksumpresent==1),
+ ConditionalField(XShortField("reserved1",None),lambda pkt:pkt.chksumpresent==1),
+ ]
+ def post_build(self, p, pay):
+ p += pay
+ if self.chksumpresent and self.chksum is None:
+ c = checksum(p)
+ p = p[:4]+chr((c>>8)&0xff)+chr(c&0xff)+p[6:]
+ return p
+
+
+class Radius(Packet):
+ name = "Radius"
+ fields_desc = [ ByteEnumField("code", 1, {1: "Access-Request",
+ 2: "Access-Accept",
+ 3: "Access-Reject",
+ 4: "Accounting-Request",
+ 5: "Accounting-Accept",
+ 6: "Accounting-Status",
+ 7: "Password-Request",
+ 8: "Password-Ack",
+ 9: "Password-Reject",
+ 10: "Accounting-Message",
+ 11: "Access-Challenge",
+ 12: "Status-Server",
+ 13: "Status-Client",
+ 21: "Resource-Free-Request",
+ 22: "Resource-Free-Response",
+ 23: "Resource-Query-Request",
+ 24: "Resource-Query-Response",
+ 25: "Alternate-Resource-Reclaim-Request",
+ 26: "NAS-Reboot-Request",
+ 27: "NAS-Reboot-Response",
+ 29: "Next-Passcode",
+ 30: "New-Pin",
+ 31: "Terminate-Session",
+ 32: "Password-Expired",
+ 33: "Event-Request",
+ 34: "Event-Response",
+ 40: "Disconnect-Request",
+ 41: "Disconnect-ACK",
+ 42: "Disconnect-NAK",
+ 43: "CoA-Request",
+ 44: "CoA-ACK",
+ 45: "CoA-NAK",
+ 50: "IP-Address-Allocate",
+ 51: "IP-Address-Release",
+ 253: "Experimental-use",
+ 254: "Reserved",
+ 255: "Reserved"} ),
+ ByteField("id", 0),
+ ShortField("len", None),
+ StrFixedLenField("authenticator","",16) ]
+ def post_build(self, p, pay):
+ p += pay
+ l = self.len
+ if l is None:
+ l = len(p)
+ p = p[:2]+struct.pack("!H",l)+p[4:]
+ return p
+
+
+
+
+class RIP(Packet):
+ name = "RIP header"
+ fields_desc = [
+ ByteEnumField("command",1,{1:"req",2:"resp",3:"traceOn",4:"traceOff",5:"sun",
+ 6:"trigReq",7:"trigResp",8:"trigAck",9:"updateReq",
+ 10:"updateResp",11:"updateAck"}),
+ ByteField("version",1),
+ ShortField("null",0),
+ ]
+
+class RIPEntry(Packet):
+ name = "RIP entry"
+ fields_desc = [
+ ShortEnumField("AF",2,{2:"IP"}),
+ ShortField("RouteTag",0),
+ IPField("addr","0.0.0.0"),
+ IPField("mask","0.0.0.0"),
+ IPField("nextHop","0.0.0.0"),
+ IntEnumField("metric",1,{16:"Unreach"}),
+ ]
+
+
+
+
+ISAKMP_payload_type = ["None","SA","Proposal","Transform","KE","ID","CERT","CR","Hash",
+ "SIG","Nonce","Notification","Delete","VendorID"]
+
+ISAKMP_exchange_type = ["None","base","identity prot.",
+ "auth only", "aggressive", "info"]
+
+
+class ISAKMP_class(Packet):
+ def guess_payload_class(self, payload):
+ np = self.next_payload
+ if np == 0:
+ return Raw
+ elif np < len(ISAKMP_payload_type):
+ pt = ISAKMP_payload_type[np]
+ return globals().get("ISAKMP_payload_%s" % pt, ISAKMP_payload)
+ else:
+ return ISAKMP_payload
+
+
+class ISAKMP(ISAKMP_class): # rfc2408
+ name = "ISAKMP"
+ fields_desc = [
+ StrFixedLenField("init_cookie","",8),
+ StrFixedLenField("resp_cookie","",8),
+ ByteEnumField("next_payload",0,ISAKMP_payload_type),
+ XByteField("version",0x10),
+ ByteEnumField("exch_type",0,ISAKMP_exchange_type),
+ FlagsField("flags",0, 8, ["encryption","commit","auth_only","res3","res4","res5","res6","res7"]), # XXX use a Flag field
+ IntField("id",0),
+ IntField("length",None)
+ ]
+
+ def guess_payload_class(self, payload):
+ if self.flags & 1:
+ return Raw
+ return ISAKMP_class.guess_payload_class(self, payload)
+
+ def answers(self, other):
+ if isinstance(other, ISAKMP):
+ if other.init_cookie == self.init_cookie:
+ return 1
+ return 0
+ def post_build(self, p, pay):
+ p += pay
+ if self.length is None:
+ p = p[:24]+struct.pack("!I",len(p))+p[28:]
+ return p
+
+
+
+
+class ISAKMP_payload_Transform(ISAKMP_class):
+ name = "IKE Transform"
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+# ShortField("len",None),
+ ShortField("length",None),
+ ByteField("num",None),
+ ByteEnumField("id",1,{1:"KEY_IKE"}),
+ ShortField("res2",0),
+ ISAKMPTransformSetField("transforms",None,length_from=lambda x:x.length-8)
+# XIntField("enc",0x80010005L),
+# XIntField("hash",0x80020002L),
+# XIntField("auth",0x80030001L),
+# XIntField("group",0x80040002L),
+# XIntField("life_type",0x800b0001L),
+# XIntField("durationh",0x000c0004L),
+# XIntField("durationl",0x00007080L),
+ ]
+ def post_build(self, p, pay):
+ if self.length is None:
+ l = len(p)
+ p = p[:2]+chr((l>>8)&0xff)+chr(l&0xff)+p[4:]
+ p += pay
+ return p
+
+
+
+
+class ISAKMP_payload_Proposal(ISAKMP_class):
+ name = "IKE proposal"
+# ISAKMP_payload_type = 0
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+ FieldLenField("length",None,"trans","H", adjust=lambda pkt,x:x+8),
+ ByteField("proposal",1),
+ ByteEnumField("proto",1,{1:"ISAKMP"}),
+ FieldLenField("SPIsize",None,"SPI","B"),
+ ByteField("trans_nb",None),
+ StrLenField("SPI","",length_from=lambda x:x.SPIsize),
+ PacketLenField("trans",Raw(),ISAKMP_payload_Transform,length_from=lambda x:x.length-8),
+ ]
+
+
+class ISAKMP_payload(ISAKMP_class):
+ name = "ISAKMP payload"
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+ FieldLenField("length",None,"load","H", adjust=lambda pkt,x:x+4),
+ StrLenField("load","",length_from=lambda x:x.length-4),
+ ]
+
+
+class ISAKMP_payload_VendorID(ISAKMP_class):
+ name = "ISAKMP Vendor ID"
+ overload_fields = { ISAKMP: { "next_payload":13 }}
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+ FieldLenField("length",None,"vendorID","H", adjust=lambda pkt,x:x+4),
+ StrLenField("vendorID","",length_from=lambda x:x.length-4),
+ ]
+
+class ISAKMP_payload_SA(ISAKMP_class):
+ name = "ISAKMP SA"
+ overload_fields = { ISAKMP: { "next_payload":1 }}
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+ FieldLenField("length",None,"prop","H", adjust=lambda pkt,x:x+12),
+ IntEnumField("DOI",1,{1:"IPSEC"}),
+ IntEnumField("situation",1,{1:"identity"}),
+ PacketLenField("prop",Raw(),ISAKMP_payload_Proposal,length_from=lambda x:x.length-12),
+ ]
+
+class ISAKMP_payload_Nonce(ISAKMP_class):
+ name = "ISAKMP Nonce"
+ overload_fields = { ISAKMP: { "next_payload":10 }}
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+ FieldLenField("length",None,"load","H", adjust=lambda pkt,x:x+4),
+ StrLenField("load","",length_from=lambda x:x.length-4),
+ ]
+
+class ISAKMP_payload_KE(ISAKMP_class):
+ name = "ISAKMP Key Exchange"
+ overload_fields = { ISAKMP: { "next_payload":4 }}
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+ FieldLenField("length",None,"load","H", adjust=lambda pkt,x:x+4),
+ StrLenField("load","",length_from=lambda x:x.length-4),
+ ]
+
+class ISAKMP_payload_ID(ISAKMP_class):
+ name = "ISAKMP Identification"
+ overload_fields = { ISAKMP: { "next_payload":5 }}
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+ FieldLenField("length",None,"load","H",adjust=lambda pkt,x:x+8),
+ ByteEnumField("IDtype",1,{1:"IPv4_addr", 11:"Key"}),
+ ByteEnumField("ProtoID",0,{0:"Unused"}),
+ ShortEnumField("Port",0,{0:"Unused"}),
+# IPField("IdentData","127.0.0.1"),
+ StrLenField("load","",length_from=lambda x:x.length-8),
+ ]
+
+
+
+class ISAKMP_payload_Hash(ISAKMP_class):
+ name = "ISAKMP Hash"
+ overload_fields = { ISAKMP: { "next_payload":8 }}
+ fields_desc = [
+ ByteEnumField("next_payload",None,ISAKMP_payload_type),
+ ByteField("res",0),
+ FieldLenField("length",None,"load","H",adjust=lambda pkt,x:x+4),
+ StrLenField("load","",length_from=lambda x:x.length-4),
+ ]
+
+
+
+ISAKMP_payload_type_overload = {}
+for i in range(len(ISAKMP_payload_type)):
+ name = "ISAKMP_payload_%s" % ISAKMP_payload_type[i]
+ if name in globals():
+ ISAKMP_payload_type_overload[globals()[name]] = {"next_payload":i}
+
+del(i)
+del(name)
+ISAKMP_class.overload_fields = ISAKMP_payload_type_overload.copy()
+
+
+
+
+# Cisco Skinny protocol
+
+# shamelessly ripped from Ethereal dissector
+skinny_messages = {
+# Station -> Callmanager
+ 0x0000: "KeepAliveMessage",
+ 0x0001: "RegisterMessage",
+ 0x0002: "IpPortMessage",
+ 0x0003: "KeypadButtonMessage",
+ 0x0004: "EnblocCallMessage",
+ 0x0005: "StimulusMessage",
+ 0x0006: "OffHookMessage",
+ 0x0007: "OnHookMessage",
+ 0x0008: "HookFlashMessage",
+ 0x0009: "ForwardStatReqMessage",
+ 0x000A: "SpeedDialStatReqMessage",
+ 0x000B: "LineStatReqMessage",
+ 0x000C: "ConfigStatReqMessage",
+ 0x000D: "TimeDateReqMessage",
+ 0x000E: "ButtonTemplateReqMessage",
+ 0x000F: "VersionReqMessage",
+ 0x0010: "CapabilitiesResMessage",
+ 0x0011: "MediaPortListMessage",
+ 0x0012: "ServerReqMessage",
+ 0x0020: "AlarmMessage",
+ 0x0021: "MulticastMediaReceptionAck",
+ 0x0022: "OpenReceiveChannelAck",
+ 0x0023: "ConnectionStatisticsRes",
+ 0x0024: "OffHookWithCgpnMessage",
+ 0x0025: "SoftKeySetReqMessage",
+ 0x0026: "SoftKeyEventMessage",
+ 0x0027: "UnregisterMessage",
+ 0x0028: "SoftKeyTemplateReqMessage",
+ 0x0029: "RegisterTokenReq",
+ 0x002A: "MediaTransmissionFailure",
+ 0x002B: "HeadsetStatusMessage",
+ 0x002C: "MediaResourceNotification",
+ 0x002D: "RegisterAvailableLinesMessage",
+ 0x002E: "DeviceToUserDataMessage",
+ 0x002F: "DeviceToUserDataResponseMessage",
+ 0x0030: "UpdateCapabilitiesMessage",
+ 0x0031: "OpenMultiMediaReceiveChannelAckMessage",
+ 0x0032: "ClearConferenceMessage",
+ 0x0033: "ServiceURLStatReqMessage",
+ 0x0034: "FeatureStatReqMessage",
+ 0x0035: "CreateConferenceResMessage",
+ 0x0036: "DeleteConferenceResMessage",
+ 0x0037: "ModifyConferenceResMessage",
+ 0x0038: "AddParticipantResMessage",
+ 0x0039: "AuditConferenceResMessage",
+ 0x0040: "AuditParticipantResMessage",
+ 0x0041: "DeviceToUserDataVersion1Message",
+# Callmanager -> Station */
+ 0x0081: "RegisterAckMessage",
+ 0x0082: "StartToneMessage",
+ 0x0083: "StopToneMessage",
+ 0x0085: "SetRingerMessage",
+ 0x0086: "SetLampMessage",
+ 0x0087: "SetHkFDetectMessage",
+ 0x0088: "SetSpeakerModeMessage",
+ 0x0089: "SetMicroModeMessage",
+ 0x008A: "StartMediaTransmission",
+ 0x008B: "StopMediaTransmission",
+ 0x008C: "StartMediaReception",
+ 0x008D: "StopMediaReception",
+ 0x008F: "CallInfoMessage",
+ 0x0090: "ForwardStatMessage",
+ 0x0091: "SpeedDialStatMessage",
+ 0x0092: "LineStatMessage",
+ 0x0093: "ConfigStatMessage",
+ 0x0094: "DefineTimeDate",
+ 0x0095: "StartSessionTransmission",
+ 0x0096: "StopSessionTransmission",
+ 0x0097: "ButtonTemplateMessage",
+ 0x0098: "VersionMessage",
+ 0x0099: "DisplayTextMessage",
+ 0x009A: "ClearDisplay",
+ 0x009B: "CapabilitiesReqMessage",
+ 0x009C: "EnunciatorCommandMessage",
+ 0x009D: "RegisterRejectMessage",
+ 0x009E: "ServerResMessage",
+ 0x009F: "Reset",
+ 0x0100: "KeepAliveAckMessage",
+ 0x0101: "StartMulticastMediaReception",
+ 0x0102: "StartMulticastMediaTransmission",
+ 0x0103: "StopMulticastMediaReception",
+ 0x0104: "StopMulticastMediaTransmission",
+ 0x0105: "OpenReceiveChannel",
+ 0x0106: "CloseReceiveChannel",
+ 0x0107: "ConnectionStatisticsReq",
+ 0x0108: "SoftKeyTemplateResMessage",
+ 0x0109: "SoftKeySetResMessage",
+ 0x0110: "SelectSoftKeysMessage",
+ 0x0111: "CallStateMessage",
+ 0x0112: "DisplayPromptStatusMessage",
+ 0x0113: "ClearPromptStatusMessage",
+ 0x0114: "DisplayNotifyMessage",
+ 0x0115: "ClearNotifyMessage",
+ 0x0116: "ActivateCallPlaneMessage",
+ 0x0117: "DeactivateCallPlaneMessage",
+ 0x0118: "UnregisterAckMessage",
+ 0x0119: "BackSpaceReqMessage",
+ 0x011A: "RegisterTokenAck",
+ 0x011B: "RegisterTokenReject",
+ 0x0042: "DeviceToUserDataResponseVersion1Message",
+ 0x011C: "StartMediaFailureDetection",
+ 0x011D: "DialedNumberMessage",
+ 0x011E: "UserToDeviceDataMessage",
+ 0x011F: "FeatureStatMessage",
+ 0x0120: "DisplayPriNotifyMessage",
+ 0x0121: "ClearPriNotifyMessage",
+ 0x0122: "StartAnnouncementMessage",
+ 0x0123: "StopAnnouncementMessage",
+ 0x0124: "AnnouncementFinishMessage",
+ 0x0127: "NotifyDtmfToneMessage",
+ 0x0128: "SendDtmfToneMessage",
+ 0x0129: "SubscribeDtmfPayloadReqMessage",
+ 0x012A: "SubscribeDtmfPayloadResMessage",
+ 0x012B: "SubscribeDtmfPayloadErrMessage",
+ 0x012C: "UnSubscribeDtmfPayloadReqMessage",
+ 0x012D: "UnSubscribeDtmfPayloadResMessage",
+ 0x012E: "UnSubscribeDtmfPayloadErrMessage",
+ 0x012F: "ServiceURLStatMessage",
+ 0x0130: "CallSelectStatMessage",
+ 0x0131: "OpenMultiMediaChannelMessage",
+ 0x0132: "StartMultiMediaTransmission",
+ 0x0133: "StopMultiMediaTransmission",
+ 0x0134: "MiscellaneousCommandMessage",
+ 0x0135: "FlowControlCommandMessage",
+ 0x0136: "CloseMultiMediaReceiveChannel",
+ 0x0137: "CreateConferenceReqMessage",
+ 0x0138: "DeleteConferenceReqMessage",
+ 0x0139: "ModifyConferenceReqMessage",
+ 0x013A: "AddParticipantReqMessage",
+ 0x013B: "DropParticipantReqMessage",
+ 0x013C: "AuditConferenceReqMessage",
+ 0x013D: "AuditParticipantReqMessage",
+ 0x013F: "UserToDeviceDataVersion1Message",
+ }
+
+
+
+class Skinny(Packet):
+ name="Skinny"
+ fields_desc = [ LEIntField("len",0),
+ LEIntField("res",0),
+ LEIntEnumField("msg",0,skinny_messages) ]
+
+_rtp_payload_types = {
+ # http://www.iana.org/assignments/rtp-parameters
+ 0: 'G.711 PCMU', 3: 'GSM',
+ 4: 'G723', 5: 'DVI4',
+ 6: 'DVI4', 7: 'LPC',
+ 8: 'PCMA', 9: 'G722',
+ 10: 'L16', 11: 'L16',
+ 12: 'QCELP', 13: 'CN',
+ 14: 'MPA', 15: 'G728',
+ 16: 'DVI4', 17: 'DVI4',
+ 18: 'G729', 25: 'CelB',
+ 26: 'JPEG', 28: 'nv',
+ 31: 'H261', 32: 'MPV',
+ 33: 'MP2T', 34: 'H263' }
+
+class RTP(Packet):
+ name="RTP"
+ fields_desc = [ BitField('version', 2, 2),
+ BitField('padding', 0, 1),
+ BitField('extension', 0, 1),
+ BitFieldLenField('numsync', None, 4, count_of='sync'),
+ BitField('marker', 0, 1),
+ BitEnumField('payload', 0, 7, _rtp_payload_types),
+ ShortField('sequence', 0),
+ IntField('timestamp', 0),
+ IntField('sourcesync', 0),
+ FieldListField('sync', [], IntField("id",0), count_from=lambda pkt:pkt.numsync) ]
+
+### SEBEK
+
+
+class SebekHead(Packet):
+ name = "Sebek header"
+ fields_desc = [ XIntField("magic", 0xd0d0d0),
+ ShortField("version", 1),
+ ShortEnumField("type", 0, {"read":0, "write":1,
+ "socket":2, "open":3}),
+ IntField("counter", 0),
+ IntField("time_sec", 0),
+ IntField("time_usec", 0) ]
+ def mysummary(self):
+ return self.sprintf("Sebek Header v%SebekHead.version% %SebekHead.type%")
+
+# we need this because Sebek headers differ between v1 and v3, and
+# between v3 type socket and v3 others
+
+class SebekV1(Packet):
+ name = "Sebek v1"
+ fields_desc = [ IntField("pid", 0),
+ IntField("uid", 0),
+ IntField("fd", 0),
+ StrFixedLenField("command", "", 12),
+ FieldLenField("data_length", None, "data",fmt="I"),
+ StrLenField("data", "", length_from=lambda x:x.data_length) ]
+ def mysummary(self):
+ if isinstance(self.underlayer, SebekHead):
+ return self.underlayer.sprintf("Sebek v1 %SebekHead.type% (%SebekV1.command%)")
+ else:
+ return self.sprintf("Sebek v1 (%SebekV1.command%)")
+
+class SebekV3(Packet):
+ name = "Sebek v3"
+ fields_desc = [ IntField("parent_pid", 0),
+ IntField("pid", 0),
+ IntField("uid", 0),
+ IntField("fd", 0),
+ IntField("inode", 0),
+ StrFixedLenField("command", "", 12),
+ FieldLenField("data_length", None, "data",fmt="I"),
+ StrLenField("data", "", length_from=lambda x:x.data_length) ]
+ def mysummary(self):
+ if isinstance(self.underlayer, SebekHead):
+ return self.underlayer.sprintf("Sebek v%SebekHead.version% %SebekHead.type% (%SebekV3.command%)")
+ else:
+ return self.sprintf("Sebek v3 (%SebekV3.command%)")
+
+class SebekV2(SebekV3):
+ def mysummary(self):
+ if isinstance(self.underlayer, SebekHead):
+ return self.underlayer.sprintf("Sebek v%SebekHead.version% %SebekHead.type% (%SebekV2.command%)")
+ else:
+ return self.sprintf("Sebek v2 (%SebekV2.command%)")
+
+class SebekV3Sock(Packet):
+ name = "Sebek v2 socket"
+ fields_desc = [ IntField("parent_pid", 0),
+ IntField("pid", 0),
+ IntField("uid", 0),
+ IntField("fd", 0),
+ IntField("inode", 0),
+ StrFixedLenField("command", "", 12),
+ IntField("data_length", 15),
+ IPField("dip", "127.0.0.1"),
+ ShortField("dport", 0),
+ IPField("sip", "127.0.0.1"),
+ ShortField("sport", 0),
+ ShortEnumField("call", 0, { "bind":2,
+ "connect":3, "listen":4,
+ "accept":5, "sendmsg":16,
+ "recvmsg":17, "sendto":11,
+ "recvfrom":12}),
+ ByteEnumField("proto", 0, IP_PROTOS) ]
+ def mysummary(self):
+ if isinstance(self.underlayer, SebekHead):
+ return self.underlayer.sprintf("Sebek v%SebekHead.version% %SebekHead.type% (%SebekV3Sock.command%)")
+ else:
+ return self.sprintf("Sebek v3 socket (%SebekV3Sock.command%)")
+
+class SebekV2Sock(SebekV3Sock):
+ def mysummary(self):
+ if isinstance(self.underlayer, SebekHead):
+ return self.underlayer.sprintf("Sebek v%SebekHead.version% %SebekHead.type% (%SebekV2Sock.command%)")
+ else:
+ return self.sprintf("Sebek v2 socket (%SebekV2Sock.command%)")
+
+class MGCP(Packet):
+ name = "MGCP"
+ longname = "Media Gateway Control Protocol"
+ fields_desc = [ StrStopField("verb","AUEP"," ", -1),
+ StrFixedLenField("sep1"," ",1),
+ StrStopField("transaction_id","1234567"," ", -1),
+ StrFixedLenField("sep2"," ",1),
+ StrStopField("endpoint","dummy@dummy.net"," ", -1),
+ StrFixedLenField("sep3"," ",1),
+ StrStopField("version","MGCP 1.0 NCS 1.0","\x0a", -1),
+ StrFixedLenField("sep4","\x0a",1),
+ ]
+
+
+#class MGCP(Packet):
+# name = "MGCP"
+# longname = "Media Gateway Control Protocol"
+# fields_desc = [ ByteEnumField("type",0, ["request","response","others"]),
+# ByteField("code0",0),
+# ByteField("code1",0),
+# ByteField("code2",0),
+# ByteField("code3",0),
+# ByteField("code4",0),
+# IntField("trasid",0),
+# IntField("req_time",0),
+# ByteField("is_duplicate",0),
+# ByteField("req_available",0) ]
+#
+class GPRS(Packet):
+ name = "GPRSdummy"
+ fields_desc = [
+ StrStopField("dummy","","\x65\x00\x00",1)
+ ]
+
+
+class HCI_Hdr(Packet):
+ name = "HCI header"
+ fields_desc = [ ByteEnumField("type",2,{1:"command",2:"ACLdata",3:"SCOdata",4:"event",5:"vendor"}),]
+
+ def mysummary(self):
+ return self.sprintf("HCI %type%")
+
+class HCI_ACL_Hdr(Packet):
+ name = "HCI ACL header"
+ fields_desc = [ ByteField("handle",0), # Actually, handle is 12 bits and flags is 4.
+ ByteField("flags",0), # I wait to write a LEBitField
+ LEShortField("len",None), ]
+ def post_build(self, p, pay):
+ p += pay
+ if self.len is None:
+ l = len(p)-4
+ p = p[:2]+chr(l&0xff)+chr((l>>8)&0xff)+p[4:]
+ return p
+
+
+class L2CAP_Hdr(Packet):
+ name = "L2CAP header"
+ fields_desc = [ LEShortField("len",None),
+ LEShortEnumField("cid",0,{1:"control"}),]
+
+ def post_build(self, p, pay):
+ p += pay
+ if self.len is None:
+ l = len(p)-4
+ p = p[:2]+chr(l&0xff)+chr((l>>8)&0xff)+p[4:]
+ return p
+
+
+
+class L2CAP_CmdHdr(Packet):
+ name = "L2CAP command header"
+ fields_desc = [
+ ByteEnumField("code",8,{1:"rej",2:"conn_req",3:"conn_resp",
+ 4:"conf_req",5:"conf_resp",6:"disconn_req",
+ 7:"disconn_resp",8:"echo_req",9:"echo_resp",
+ 10:"info_req",11:"info_resp"}),
+ ByteField("id",0),
+ LEShortField("len",None) ]
+ def post_build(self, p, pay):
+ p += pay
+ if self.len is None:
+ l = len(p)-4
+ p = p[:2]+chr(l&0xff)+chr((l>>8)&0xff)+p[4:]
+ return p
+ def answers(self, other):
+ if other.id == self.id:
+ if self.code == 1:
+ return 1
+ if other.code in [2,4,6,8,10] and self.code == other.code+1:
+ if other.code == 8:
+ return 1
+ return self.payload.answers(other.payload)
+ return 0
+
+class L2CAP_ConnReq(Packet):
+ name = "L2CAP Conn Req"
+ fields_desc = [ LEShortEnumField("psm",0,{1:"SDP",3:"RFCOMM",5:"telephony control"}),
+ LEShortField("scid",0),
+ ]
+
+class L2CAP_ConnResp(Packet):
+ name = "L2CAP Conn Resp"
+ fields_desc = [ LEShortField("dcid",0),
+ LEShortField("scid",0),
+ LEShortEnumField("result",0,["no_info","authen_pend","author_pend"]),
+ LEShortEnumField("status",0,["success","pend","bad_psm",
+ "cr_sec_block","cr_no_mem"]),
+ ]
+ def answers(self, other):
+ return self.scid == other.scid
+
+class L2CAP_CmdRej(Packet):
+ name = "L2CAP Command Rej"
+ fields_desc = [ LEShortField("reason",0),
+ ]
+
+
+class L2CAP_ConfReq(Packet):
+ name = "L2CAP Conf Req"
+ fields_desc = [ LEShortField("dcid",0),
+ LEShortField("flags",0),
+ ]
+
+class L2CAP_ConfResp(Packet):
+ name = "L2CAP Conf Resp"
+ fields_desc = [ LEShortField("scid",0),
+ LEShortField("flags",0),
+ LEShortEnumField("result",0,["success","unaccept","reject","unknown"]),
+ ]
+ def answers(self, other):
+ return self.scid == other.scid
+
+
+class L2CAP_DisconnReq(Packet):
+ name = "L2CAP Disconn Req"
+ fields_desc = [ LEShortField("dcid",0),
+ LEShortField("scid",0), ]
+
+class L2CAP_DisconnResp(Packet):
+ name = "L2CAP Disconn Resp"
+ fields_desc = [ LEShortField("dcid",0),
+ LEShortField("scid",0), ]
+ def answers(self, other):
+ return self.scid == other.scid
+
+
+
+class L2CAP_InfoReq(Packet):
+ name = "L2CAP Info Req"
+ fields_desc = [ LEShortEnumField("type",0,{1:"CL_MTU",2:"FEAT_MASK"}),
+ StrField("data","")
+ ]
+
+
+class L2CAP_InfoResp(Packet):
+ name = "L2CAP Info Resp"
+ fields_desc = [ LEShortField("type",0),
+ LEShortEnumField("result",0,["success","not_supp"]),
+ StrField("data",""), ]
+ def answers(self, other):
+ return self.type == other.type
+
+
+
+
+class NetBIOS_DS(Packet):
+ name = "NetBIOS datagram service"
+ fields_desc = [
+ ByteEnumField("type",17, {17:"direct_group"}),
+ ByteField("flags",0),
+ XShortField("id",0),
+ IPField("src","127.0.0.1"),
+ ShortField("sport",138),
+ ShortField("len",None),
+ ShortField("ofs",0),
+ NetBIOSNameField("srcname",""),
+ NetBIOSNameField("dstname",""),
+ ]
+ def post_build(self, p, pay):
+ p += pay
+ if self.len is None:
+ l = len(p)-14
+ p = p[:10]+struct.pack("!H", l)+p[12:]
+ return p
+
+# ShortField("length",0),
+# ShortField("Delimitor",0),
+# ByteField("command",0),
+# ByteField("data1",0),
+# ShortField("data2",0),
+# ShortField("XMIt",0),
+# ShortField("RSPCor",0),
+# StrFixedLenField("dest","",16),
+# StrFixedLenField("source","",16),
+#
+# ]
+#
+
+# IR
+
+class IrLAPHead(Packet):
+ name = "IrDA Link Access Protocol Header"
+ fields_desc = [ XBitField("Address", 0x7f, 7),
+ BitEnumField("Type", 1, 1, {"Response":0,
+ "Command":1})]
+
+class IrLAPCommand(Packet):
+ name = "IrDA Link Access Protocol Command"
+ fields_desc = [ XByteField("Control", 0),
+ XByteField("Format identifier", 0),
+ XIntField("Source address", 0),
+ XIntField("Destination address", 0xffffffffL),
+ XByteField("Discovery flags", 0x1),
+ ByteEnumField("Slot number", 255, {"final":255}),
+ XByteField("Version", 0)]
+
+
+class IrLMP(Packet):
+ name = "IrDA Link Management Protocol"
+ fields_desc = [ XShortField("Service hints", 0),
+ XByteField("Character set", 0),
+ StrField("Device name", "") ]
+
+
+#NetBIOS
+
+
+# Name Query Request
+# Node Status Request
+class NBNSQueryRequest(Packet):
+ name="NBNS query request"
+ fields_desc = [ShortField("NAME_TRN_ID",0),
+ ShortField("FLAGS", 0x0110),
+ ShortField("QDCOUNT",1),
+ ShortField("ANCOUNT",0),
+ ShortField("NSCOUNT",0),
+ ShortField("ARCOUNT",0),
+ NetBIOSNameField("QUESTION_NAME","windows"),
+ ShortEnumField("SUFFIX",0x4141,{0x4141:"workstation",0x4141+0x03:"messenger service",0x4141+0x200:"file server service",0x4141+0x10b:"domain master browser",0x4141+0x10c:"domain controller", 0x4141+0x10e:"browser election service"}),
+ ByteField("NULL",0),
+ ShortEnumField("QUESTION_TYPE",0x20, {0x20:"NB",0x21:"NBSTAT"}),
+ ShortEnumField("QUESTION_CLASS",1,{1:"INTERNET"})]
+
+# Name Registration Request
+# Name Refresh Request
+# Name Release Request or Demand
+class NBNSRequest(Packet):
+ name="NBNS request"
+ fields_desc = [ShortField("NAME_TRN_ID",0),
+ ShortField("FLAGS", 0x2910),
+ ShortField("QDCOUNT",1),
+ ShortField("ANCOUNT",0),
+ ShortField("NSCOUNT",0),
+ ShortField("ARCOUNT",1),
+ NetBIOSNameField("QUESTION_NAME","windows"),
+ ShortEnumField("SUFFIX",0x4141,{0x4141:"workstation",0x4141+0x03:"messenger service",0x4141+0x200:"file server service",0x4141+0x10b:"domain master browser",0x4141+0x10c:"domain controller", 0x4141+0x10e:"browser election service"}),
+ ByteField("NULL",0),
+ ShortEnumField("QUESTION_TYPE",0x20, {0x20:"NB",0x21:"NBSTAT"}),
+ ShortEnumField("QUESTION_CLASS",1,{1:"INTERNET"}),
+ ShortEnumField("RR_NAME",0xC00C,{0xC00C:"Label String Pointer to QUESTION_NAME"}),
+ ShortEnumField("RR_TYPE",0x20, {0x20:"NB",0x21:"NBSTAT"}),
+ ShortEnumField("RR_CLASS",1,{1:"INTERNET"}),
+ IntField("TTL", 0),
+ ShortField("RDLENGTH", 6),
+ BitEnumField("G",0,1,{0:"Unique name",1:"Group name"}),
+ BitEnumField("OWNER NODE TYPE",00,2,{00:"B node",01:"P node",02:"M node",03:"H node"}),
+ BitEnumField("UNUSED",0,13,{0:"Unused"}),
+ IPField("NB_ADDRESS", "127.0.0.1")]
+
+# Name Query Response
+# Name Registration Response
+class NBNSQueryResponse(Packet):
+ name="NBNS query response"
+ fields_desc = [ShortField("NAME_TRN_ID",0),
+ ShortField("FLAGS", 0x8500),
+ ShortField("QDCOUNT",0),
+ ShortField("ANCOUNT",1),
+ ShortField("NSCOUNT",0),
+ ShortField("ARCOUNT",0),
+ NetBIOSNameField("RR_NAME","windows"),
+ ShortEnumField("SUFFIX",0x4141,{0x4141:"workstation",0x4141+0x03:"messenger service",0x4141+0x200:"file server service",0x4141+0x10b:"domain master browser",0x4141+0x10c:"domain controller", 0x4141+0x10e:"browser election service"}),
+ ByteField("NULL",0),
+ ShortEnumField("QUESTION_TYPE",0x20, {0x20:"NB",0x21:"NBSTAT"}),
+ ShortEnumField("QUESTION_CLASS",1,{1:"INTERNET"}),
+ IntField("TTL", 0x493e0),
+ ShortField("RDLENGTH", 6),
+ ShortField("NB_FLAGS", 0),
+ IPField("NB_ADDRESS", "127.0.0.1")]
+
+# Name Query Response (negative)
+# Name Release Response
+class NBNSQueryResponseNegative(Packet):
+ name="NBNS query response (negative)"
+ fields_desc = [ShortField("NAME_TRN_ID",0),
+ ShortField("FLAGS", 0x8506),
+ ShortField("QDCOUNT",0),
+ ShortField("ANCOUNT",1),
+ ShortField("NSCOUNT",0),
+ ShortField("ARCOUNT",0),
+ NetBIOSNameField("RR_NAME","windows"),
+ ShortEnumField("SUFFIX",0x4141,{0x4141:"workstation",0x4141+0x03:"messenger service",0x4141+0x200:"file server service",0x4141+0x10b:"domain master browser",0x4141+0x10c:"domain controller", 0x4141+0x10e:"browser election service"}),
+ ByteField("NULL",0),
+ ShortEnumField("RR_TYPE",0x20, {0x20:"NB",0x21:"NBSTAT"}),
+ ShortEnumField("RR_CLASS",1,{1:"INTERNET"}),
+ IntField("TTL",0),
+ ShortField("RDLENGTH",6),
+ BitEnumField("G",0,1,{0:"Unique name",1:"Group name"}),
+ BitEnumField("OWNER NODE TYPE",00,2,{00:"B node",01:"P node",02:"M node",03:"H node"}),
+ BitEnumField("UNUSED",0,13,{0:"Unused"}),
+ IPField("NB_ADDRESS", "127.0.0.1")]
+
+# Node Status Response
+class NBNSNodeStatusResponse(Packet):
+ name="NBNS Node Status Response"
+ fields_desc = [ShortField("NAME_TRN_ID",0),
+ ShortField("FLAGS", 0x8500),
+ ShortField("QDCOUNT",0),
+ ShortField("ANCOUNT",1),
+ ShortField("NSCOUNT",0),
+ ShortField("ARCOUNT",0),
+ NetBIOSNameField("RR_NAME","windows"),
+ ShortEnumField("SUFFIX",0x4141,{0x4141:"workstation",0x4141+0x03:"messenger service",0x4141+0x200:"file server service",0x4141+0x10b:"domain master browser",0x4141+0x10c:"domain controller", 0x4141+0x10e:"browser election service"}),
+ ByteField("NULL",0),
+ ShortEnumField("RR_TYPE",0x21, {0x20:"NB",0x21:"NBSTAT"}),
+ ShortEnumField("RR_CLASS",1,{1:"INTERNET"}),
+ IntField("TTL",0),
+ ShortField("RDLENGTH",83),
+ ByteField("NUM_NAMES",1)]
+
+# Service for Node Status Response
+class NBNSNodeStatusResponseService(Packet):
+ name="NBNS Node Status Response Service"
+ fields_desc = [StrFixedLenField("NETBIOS_NAME","WINDOWS ",15),
+ ByteEnumField("SUFFIX",0,{0:"workstation",0x03:"messenger service",0x20:"file server service",0x1b:"domain master browser",0x1c:"domain controller", 0x1e:"browser election service"}),
+ ByteField("NAME_FLAGS",0x4),
+ ByteEnumField("UNUSED",0,{0:"unused"})]
+
+# End of Node Status Response packet
+class NBNSNodeStatusResponseEnd(Packet):
+ name="NBNS Node Status Response"
+ fields_desc = [SourceMACField("MAC_ADDRESS"),
+ BitField("STATISTICS",0,57*8)]
+
+# Wait for Acknowledgement Response
+class NBNSWackResponse(Packet):
+ name="NBNS Wait for Acknowledgement Response"
+ fields_desc = [ShortField("NAME_TRN_ID",0),
+ ShortField("FLAGS", 0xBC07),
+ ShortField("QDCOUNT",0),
+ ShortField("ANCOUNT",1),
+ ShortField("NSCOUNT",0),
+ ShortField("ARCOUNT",0),
+ NetBIOSNameField("RR_NAME","windows"),
+ ShortEnumField("SUFFIX",0x4141,{0x4141:"workstation",0x4141+0x03:"messenger service",0x4141+0x200:"file server service",0x4141+0x10b:"domain master browser",0x4141+0x10c:"domain controller", 0x4141+0x10e:"browser election service"}),
+ ByteField("NULL",0),
+ ShortEnumField("RR_TYPE",0x20, {0x20:"NB",0x21:"NBSTAT"}),
+ ShortEnumField("RR_CLASS",1,{1:"INTERNET"}),
+ IntField("TTL", 2),
+ ShortField("RDLENGTH",2),
+ BitField("RDATA",10512,16)] #10512=0010100100010000
+
+class NBTDatagram(Packet):
+ name="NBT Datagram Packet"
+ fields_desc= [ByteField("Type", 0x10),
+ ByteField("Flags", 0x02),
+ ShortField("ID", 0),
+ IPField("SourceIP", "127.0.0.1"),
+ ShortField("SourcePort", 138),
+ ShortField("Length", 272),
+ ShortField("Offset", 0),
+ NetBIOSNameField("SourceName","windows"),
+ ShortEnumField("SUFFIX1",0x4141,{0x4141:"workstation",0x4141+0x03:"messenger service",0x4141+0x200:"file server service",0x4141+0x10b:"domain master browser",0x4141+0x10c:"domain controller", 0x4141+0x10e:"browser election service"}),
+ ByteField("NULL",0),
+ NetBIOSNameField("DestinationName","windows"),
+ ShortEnumField("SUFFIX2",0x4141,{0x4141:"workstation",0x4141+0x03:"messenger service",0x4141+0x200:"file server service",0x4141+0x10b:"domain master browser",0x4141+0x10c:"domain controller", 0x4141+0x10e:"browser election service"}),
+ ByteField("NULL",0)]
+
+
+class NBTSession(Packet):
+ name="NBT Session Packet"
+ fields_desc= [ByteEnumField("TYPE",0,{0x00:"Session Message",0x81:"Session Request",0x82:"Positive Session Response",0x83:"Negative Session Response",0x84:"Retarget Session Response",0x85:"Session Keepalive"}),
+ BitField("RESERVED",0x00,7),
+ BitField("LENGTH",0,17)]
+
+
+# SMB NetLogon Response Header
+class SMBNetlogon_Protocol_Response_Header(Packet):
+ name="SMBNetlogon Protocol Response Header"
+ fields_desc = [StrFixedLenField("Start","\xffSMB",4),
+ ByteEnumField("Command",0x25,{0x25:"Trans"}),
+ ByteField("Error_Class",0x02),
+ ByteField("Reserved",0),
+ LEShortField("Error_code",4),
+ ByteField("Flags",0),
+ LEShortField("Flags2",0x0000),
+ LEShortField("PIDHigh",0x0000),
+ LELongField("Signature",0x0),
+ LEShortField("Unused",0x0),
+ LEShortField("TID",0),
+ LEShortField("PID",0),
+ LEShortField("UID",0),
+ LEShortField("MID",0),
+ ByteField("WordCount",17),
+ LEShortField("TotalParamCount",0),
+ LEShortField("TotalDataCount",112),
+ LEShortField("MaxParamCount",0),
+ LEShortField("MaxDataCount",0),
+ ByteField("MaxSetupCount",0),
+ ByteField("unused2",0),
+ LEShortField("Flags3",0),
+ ByteField("TimeOut1",0xe8),
+ ByteField("TimeOut2",0x03),
+ LEShortField("unused3",0),
+ LEShortField("unused4",0),
+ LEShortField("ParamCount2",0),
+ LEShortField("ParamOffset",0),
+ LEShortField("DataCount",112),
+ LEShortField("DataOffset",92),
+ ByteField("SetupCount", 3),
+ ByteField("unused5", 0)]
+
+# SMB MailSlot Protocol
+class SMBMailSlot(Packet):
+ name = "SMB Mail Slot Protocol"
+ fields_desc = [LEShortField("opcode", 1),
+ LEShortField("priority", 1),
+ LEShortField("class", 2),
+ LEShortField("size", 135),
+ StrNullField("name","\MAILSLOT\NET\GETDC660")]
+
+# SMB NetLogon Protocol Response Tail SAM
+class SMBNetlogon_Protocol_Response_Tail_SAM(Packet):
+ name = "SMB Netlogon Protocol Response Tail SAM"
+ fields_desc = [ByteEnumField("Command", 0x17, {0x12:"SAM logon request", 0x17:"SAM Active directory Response"}),
+ ByteField("unused", 0),
+ ShortField("Data1", 0),
+ ShortField("Data2", 0xfd01),
+ ShortField("Data3", 0),
+ ShortField("Data4", 0xacde),
+ ShortField("Data5", 0x0fe5),
+ ShortField("Data6", 0xd10a),
+ ShortField("Data7", 0x374c),
+ ShortField("Data8", 0x83e2),
+ ShortField("Data9", 0x7dd9),
+ ShortField("Data10", 0x3a16),
+ ShortField("Data11", 0x73ff),
+ ByteField("Data12", 0x04),
+ StrFixedLenField("Data13", "rmff", 4),
+ ByteField("Data14", 0x0),
+ ShortField("Data16", 0xc018),
+ ByteField("Data18", 0x0a),
+ StrFixedLenField("Data20", "rmff-win2k", 10),
+ ByteField("Data21", 0xc0),
+ ShortField("Data22", 0x18c0),
+ ShortField("Data23", 0x180a),
+ StrFixedLenField("Data24", "RMFF-WIN2K", 10),
+ ShortField("Data25", 0),
+ ByteField("Data26", 0x17),
+ StrFixedLenField("Data27", "Default-First-Site-Name", 23),
+ ShortField("Data28", 0x00c0),
+ ShortField("Data29", 0x3c10),
+ ShortField("Data30", 0x00c0),
+ ShortField("Data31", 0x0200),
+ ShortField("Data32", 0x0),
+ ShortField("Data33", 0xac14),
+ ShortField("Data34", 0x0064),
+ ShortField("Data35", 0x0),
+ ShortField("Data36", 0x0),
+ ShortField("Data37", 0x0),
+ ShortField("Data38", 0x0),
+ ShortField("Data39", 0x0d00),
+ ShortField("Data40", 0x0),
+ ShortField("Data41", 0xffff)]
+
+# SMB NetLogon Protocol Response Tail LM2.0
+class SMBNetlogon_Protocol_Response_Tail_LM20(Packet):
+ name = "SMB Netlogon Protocol Response Tail LM20"
+ fields_desc = [ByteEnumField("Command",0x06,{0x06:"LM 2.0 Response to logon request"}),
+ ByteField("unused", 0),
+ StrFixedLenField("DblSlash", "\\\\", 2),
+ StrNullField("ServerName","WIN"),
+ LEShortField("LM20Token", 0xffff)]
+
+# SMBNegociate Protocol Request Header
+class SMBNegociate_Protocol_Request_Header(Packet):
+ name="SMBNegociate Protocol Request Header"
+ fields_desc = [StrFixedLenField("Start","\xffSMB",4),
+ ByteEnumField("Command",0x72,{0x72:"SMB_COM_NEGOTIATE"}),
+ ByteField("Error_Class",0),
+ ByteField("Reserved",0),
+ LEShortField("Error_code",0),
+ ByteField("Flags",0x18),
+ LEShortField("Flags2",0x0000),
+ LEShortField("PIDHigh",0x0000),
+ LELongField("Signature",0x0),
+ LEShortField("Unused",0x0),
+ LEShortField("TID",0),
+ LEShortField("PID",1),
+ LEShortField("UID",0),
+ LEShortField("MID",2),
+ ByteField("WordCount",0),
+ LEShortField("ByteCount",12)]
+
+# SMB Negociate Protocol Request Tail
+class SMBNegociate_Protocol_Request_Tail(Packet):
+ name="SMB Negociate Protocol Request Tail"
+ fields_desc=[ByteField("BufferFormat",0x02),
+ StrNullField("BufferData","NT LM 0.12")]
+
+# SMBNegociate Protocol Response Advanced Security
+class SMBNegociate_Protocol_Response_Advanced_Security(Packet):
+ name="SMBNegociate Protocol Response Advanced Security"
+ fields_desc = [StrFixedLenField("Start","\xffSMB",4),
+ ByteEnumField("Command",0x72,{0x72:"SMB_COM_NEGOTIATE"}),
+ ByteField("Error_Class",0),
+ ByteField("Reserved",0),
+ LEShortField("Error_Code",0),
+ ByteField("Flags",0x98),
+ LEShortField("Flags2",0x0000),
+ LEShortField("PIDHigh",0x0000),
+ LELongField("Signature",0x0),
+ LEShortField("Unused",0x0),
+ LEShortField("TID",0),
+ LEShortField("PID",1),
+ LEShortField("UID",0),
+ LEShortField("MID",2),
+ ByteField("WordCount",17),
+ LEShortField("DialectIndex",7),
+ ByteField("SecurityMode",0x03),
+ LEShortField("MaxMpxCount",50),
+ LEShortField("MaxNumberVC",1),
+ LEIntField("MaxBufferSize",16144),
+ LEIntField("MaxRawSize",65536),
+ LEIntField("SessionKey",0x0000),
+ LEShortField("ServerCapabilities",0xf3f9),
+ BitField("UnixExtensions",0,1),
+ BitField("Reserved2",0,7),
+ BitField("ExtendedSecurity",1,1),
+ BitField("CompBulk",0,2),
+ BitField("Reserved3",0,5),
+# There have been 127490112000000000 tenths of micro-seconds between 1st january 1601 and 1st january 2005. 127490112000000000=0x1C4EF94D6228000, so ServerTimeHigh=0xD6228000 and ServerTimeLow=0x1C4EF94.
+ LEIntField("ServerTimeHigh",0xD6228000L),
+ LEIntField("ServerTimeLow",0x1C4EF94),
+ LEShortField("ServerTimeZone",0x3c),
+ ByteField("EncryptionKeyLength",0),
+ LEFieldLenField("ByteCount", None, "SecurityBlob", adjust=lambda pkt,x:x-16),
+ BitField("GUID",0,128),
+ StrLenField("SecurityBlob", "", length_from=lambda x:x.ByteCount+16)]
+
+# SMBNegociate Protocol Response No Security
+# When using no security, with EncryptionKeyLength=8, you must have an EncryptionKey before the DomainName
+class SMBNegociate_Protocol_Response_No_Security(Packet):
+ name="SMBNegociate Protocol Response No Security"
+ fields_desc = [StrFixedLenField("Start","\xffSMB",4),
+ ByteEnumField("Command",0x72,{0x72:"SMB_COM_NEGOTIATE"}),
+ ByteField("Error_Class",0),
+ ByteField("Reserved",0),
+ LEShortField("Error_Code",0),
+ ByteField("Flags",0x98),
+ LEShortField("Flags2",0x0000),
+ LEShortField("PIDHigh",0x0000),
+ LELongField("Signature",0x0),
+ LEShortField("Unused",0x0),
+ LEShortField("TID",0),
+ LEShortField("PID",1),
+ LEShortField("UID",0),
+ LEShortField("MID",2),
+ ByteField("WordCount",17),
+ LEShortField("DialectIndex",7),
+ ByteField("SecurityMode",0x03),
+ LEShortField("MaxMpxCount",50),
+ LEShortField("MaxNumberVC",1),
+ LEIntField("MaxBufferSize",16144),
+ LEIntField("MaxRawSize",65536),
+ LEIntField("SessionKey",0x0000),
+ LEShortField("ServerCapabilities",0xf3f9),
+ BitField("UnixExtensions",0,1),
+ BitField("Reserved2",0,7),
+ BitField("ExtendedSecurity",0,1),
+ FlagsField("CompBulk",0,2,"CB"),
+ BitField("Reserved3",0,5),
+ # There have been 127490112000000000 tenths of micro-seconds between 1st january 1601 and 1st january 2005. 127490112000000000=0x1C4EF94D6228000, so ServerTimeHigh=0xD6228000 and ServerTimeLow=0x1C4EF94.
+ LEIntField("ServerTimeHigh",0xD6228000L),
+ LEIntField("ServerTimeLow",0x1C4EF94),
+ LEShortField("ServerTimeZone",0x3c),
+ ByteField("EncryptionKeyLength",8),
+ LEShortField("ByteCount",24),
+ BitField("EncryptionKey",0,64),
+ StrNullField("DomainName","WORKGROUP"),
+ StrNullField("ServerName","RMFF1")]
+
+# SMBNegociate Protocol Response No Security No Key
+class SMBNegociate_Protocol_Response_No_Security_No_Key(Packet):
+ namez="SMBNegociate Protocol Response No Security No Key"
+ fields_desc = [StrFixedLenField("Start","\xffSMB",4),
+ ByteEnumField("Command",0x72,{0x72:"SMB_COM_NEGOTIATE"}),
+ ByteField("Error_Class",0),
+ ByteField("Reserved",0),
+ LEShortField("Error_Code",0),
+ ByteField("Flags",0x98),
+ LEShortField("Flags2",0x0000),
+ LEShortField("PIDHigh",0x0000),
+ LELongField("Signature",0x0),
+ LEShortField("Unused",0x0),
+ LEShortField("TID",0),
+ LEShortField("PID",1),
+ LEShortField("UID",0),
+ LEShortField("MID",2),
+ ByteField("WordCount",17),
+ LEShortField("DialectIndex",7),
+ ByteField("SecurityMode",0x03),
+ LEShortField("MaxMpxCount",50),
+ LEShortField("MaxNumberVC",1),
+ LEIntField("MaxBufferSize",16144),
+ LEIntField("MaxRawSize",65536),
+ LEIntField("SessionKey",0x0000),
+ LEShortField("ServerCapabilities",0xf3f9),
+ BitField("UnixExtensions",0,1),
+ BitField("Reserved2",0,7),
+ BitField("ExtendedSecurity",0,1),
+ FlagsField("CompBulk",0,2,"CB"),
+ BitField("Reserved3",0,5),
+ # There have been 127490112000000000 tenths of micro-seconds between 1st january 1601 and 1st january 2005. 127490112000000000=0x1C4EF94D6228000, so ServerTimeHigh=0xD6228000 and ServerTimeLow=0x1C4EF94.
+ LEIntField("ServerTimeHigh",0xD6228000L),
+ LEIntField("ServerTimeLow",0x1C4EF94),
+ LEShortField("ServerTimeZone",0x3c),
+ ByteField("EncryptionKeyLength",0),
+ LEShortField("ByteCount",16),
+ StrNullField("DomainName","WORKGROUP"),
+ StrNullField("ServerName","RMFF1")]
+
+# Session Setup AndX Request
+class SMBSession_Setup_AndX_Request(Packet):
+ name="Session Setup AndX Request"
+ fields_desc=[StrFixedLenField("Start","\xffSMB",4),
+ ByteEnumField("Command",0x73,{0x73:"SMB_COM_SESSION_SETUP_ANDX"}),
+ ByteField("Error_Class",0),
+ ByteField("Reserved",0),
+ LEShortField("Error_Code",0),
+ ByteField("Flags",0x18),
+ LEShortField("Flags2",0x0001),
+ LEShortField("PIDHigh",0x0000),
+ LELongField("Signature",0x0),
+ LEShortField("Unused",0x0),
+ LEShortField("TID",0),
+ LEShortField("PID",1),
+ LEShortField("UID",0),
+ LEShortField("MID",2),
+ ByteField("WordCount",13),
+ ByteEnumField("AndXCommand",0x75,{0x75:"SMB_COM_TREE_CONNECT_ANDX"}),
+ ByteField("Reserved2",0),
+ LEShortField("AndXOffset",96),
+ LEShortField("MaxBufferS",2920),
+ LEShortField("MaxMPXCount",50),
+ LEShortField("VCNumber",0),
+ LEIntField("SessionKey",0),
+ LEFieldLenField("ANSIPasswordLength",None,"ANSIPassword"),
+ LEShortField("UnicodePasswordLength",0),
+ LEIntField("Reserved3",0),
+ LEShortField("ServerCapabilities",0x05),
+ BitField("UnixExtensions",0,1),
+ BitField("Reserved4",0,7),
+ BitField("ExtendedSecurity",0,1),
+ BitField("CompBulk",0,2),
+ BitField("Reserved5",0,5),
+ LEShortField("ByteCount",35),
+ StrLenField("ANSIPassword", "Pass",length_from=lambda x:x.ANSIPasswordLength),
+ StrNullField("Account","GUEST"),
+ StrNullField("PrimaryDomain", ""),
+ StrNullField("NativeOS","Windows 4.0"),
+ StrNullField("NativeLanManager","Windows 4.0"),
+ ByteField("WordCount2",4),
+ ByteEnumField("AndXCommand2",0xFF,{0xFF:"SMB_COM_NONE"}),
+ ByteField("Reserved6",0),
+ LEShortField("AndXOffset2",0),
+ LEShortField("Flags3",0x2),
+ LEShortField("PasswordLength",0x1),
+ LEShortField("ByteCount2",18),
+ ByteField("Password",0),
+ StrNullField("Path","\\\\WIN2K\\IPC$"),
+ StrNullField("Service","IPC")]
+
+# Session Setup AndX Response
+class SMBSession_Setup_AndX_Response(Packet):
+ name="Session Setup AndX Response"
+ fields_desc=[StrFixedLenField("Start","\xffSMB",4),
+ ByteEnumField("Command",0x73,{0x73:"SMB_COM_SESSION_SETUP_ANDX"}),
+ ByteField("Error_Class",0),
+ ByteField("Reserved",0),
+ LEShortField("Error_Code",0),
+ ByteField("Flags",0x90),
+ LEShortField("Flags2",0x1001),
+ LEShortField("PIDHigh",0x0000),
+ LELongField("Signature",0x0),
+ LEShortField("Unused",0x0),
+ LEShortField("TID",0),
+ LEShortField("PID",1),
+ LEShortField("UID",0),
+ LEShortField("MID",2),
+ ByteField("WordCount",3),
+ ByteEnumField("AndXCommand",0x75,{0x75:"SMB_COM_TREE_CONNECT_ANDX"}),
+ ByteField("Reserved2",0),
+ LEShortField("AndXOffset",66),
+ LEShortField("Action",0),
+ LEShortField("ByteCount",25),
+ StrNullField("NativeOS","Windows 4.0"),
+ StrNullField("NativeLanManager","Windows 4.0"),
+ StrNullField("PrimaryDomain",""),
+ ByteField("WordCount2",3),
+ ByteEnumField("AndXCommand2",0xFF,{0xFF:"SMB_COM_NONE"}),
+ ByteField("Reserved3",0),
+ LEShortField("AndXOffset2",80),
+ LEShortField("OptionalSupport",0x01),
+ LEShortField("ByteCount2",5),
+ StrNullField("Service","IPC"),
+ StrNullField("NativeFileSystem","")]
+
+class MobileIP(Packet):
+ name = "Mobile IP (RFC3344)"
+ fields_desc = [ ByteEnumField("type", 1, {1:"RRQ", 3:"RRP"}) ]
+
+class MobileIPRRQ(Packet):
+ name = "Mobile IP Registration Request (RFC3344)"
+ fields_desc = [ XByteField("flags", 0),
+ ShortField("lifetime", 180),
+ IPField("homeaddr", "0.0.0.0"),
+ IPField("haaddr", "0.0.0.0"),
+ IPField("coaddr", "0.0.0.0"),
+ Field("id", "", "64s") ]
+
+class MobileIPRRP(Packet):
+ name = "Mobile IP Registration Reply (RFC3344)"
+ fields_desc = [ ByteField("code", 0),
+ ShortField("lifetime", 180),
+ IPField("homeaddr", "0.0.0.0"),
+ IPField("haaddr", "0.0.0.0"),
+ Field("id", "", "64s") ]
+
+class MobileIPTunnelData(Packet):
+ name = "Mobile IP Tunnel Data Message (RFC3519)"
+ fields_desc = [ ByteField("nexthdr", 4),
+ ShortField("res", 0) ]
+
+
+# Cisco Netflow Protocol version 1
+class NetflowHeader(Packet):
+ name = "Netflow Header"
+ fields_desc = [ ShortField("version", 1) ]
+
+class NetflowHeaderV1(Packet):
+ name = "Netflow Header V1"
+ fields_desc = [ ShortField("count", 0),
+ IntField("sysUptime", 0),
+ IntField("unixSecs", 0),
+ IntField("unixNanoSeconds", 0) ]
+
+
+class NetflowRecordV1(Packet):
+ name = "Netflow Record"
+ fields_desc = [ IPField("ipsrc", "0.0.0.0"),
+ IPField("ipdst", "0.0.0.0"),
+ IPField("nexthop", "0.0.0.0"),
+ ShortField("inputIfIndex", 0),
+ ShortField("outpuIfIndex", 0),
+ IntField("dpkts", 0),
+ IntField("dbytes", 0),
+ IntField("starttime", 0),
+ IntField("endtime", 0),
+ ShortField("srcport", 0),
+ ShortField("dstport", 0),
+ ShortField("padding", 0),
+ ByteField("proto", 0),
+ ByteField("tos", 0),
+ IntField("padding1", 0),
+ IntField("padding2", 0) ]
+
+
+TFTP_operations = { 1:"RRQ",2:"WRQ",3:"DATA",4:"ACK",5:"ERROR",6:"OACK" }
+
+
+class TFTP(Packet):
+ name = "TFTP opcode"
+ fields_desc = [ ShortEnumField("op", 1, TFTP_operations), ]
+
+
+
+class TFTP_RRQ(Packet):
+ name = "TFTP Read Request"
+ fields_desc = [ StrNullField("filename", ""),
+ StrNullField("mode", "octet") ]
+ def answers(self, other):
+ return 0
+ def mysummary(self):
+ return self.sprintf("RRQ %filename%"),[UDP]
+
+
+class TFTP_WRQ(Packet):
+ name = "TFTP Write Request"
+ fields_desc = [ StrNullField("filename", ""),
+ StrNullField("mode", "octet") ]
+ def answers(self, other):
+ return 0
+ def mysummary(self):
+ return self.sprintf("WRQ %filename%"),[UDP]
+
+class TFTP_DATA(Packet):
+ name = "TFTP Data"
+ fields_desc = [ ShortField("block", 0) ]
+ def answers(self, other):
+ return self.block == 1 and isinstance(other, TFTP_RRQ)
+ def mysummary(self):
+ return self.sprintf("DATA %block%"),[UDP]
+
+class TFTP_Option(Packet):
+ fields_desc = [ StrNullField("oname",""),
+ StrNullField("value","") ]
+ def extract_padding(self, pkt):
+ return "",pkt
+
+class TFTP_Options(Packet):
+ fields_desc = [ PacketListField("options", [], TFTP_Option, length_from=lambda x:None) ]
+
+
+class TFTP_ACK(Packet):
+ name = "TFTP Ack"
+ fields_desc = [ ShortField("block", 0) ]
+ def answers(self, other):
+ if isinstance(other, TFTP_DATA):
+ return self.block == other.block
+ elif isinstance(other, TFTP_RRQ) or isinstance(other, TFTP_WRQ) or isinstance(other, TFTP_OACK):
+ return self.block == 0
+ return 0
+ def mysummary(self):
+ return self.sprintf("ACK %block%"),[UDP]
+
+TFTP_Error_Codes = { 0: "Not defined",
+ 1: "File not found",
+ 2: "Access violation",
+ 3: "Disk full or allocation exceeded",
+ 4: "Illegal TFTP operation",
+ 5: "Unknown transfer ID",
+ 6: "File already exists",
+ 7: "No such user",
+ 8: "Terminate transfer due to option negotiation",
+ }
+
+class TFTP_ERROR(Packet):
+ name = "TFTP Error"
+ fields_desc = [ ShortEnumField("errorcode", 0, TFTP_Error_Codes),
+ StrNullField("errormsg", "")]
+ def answers(self, other):
+ return (isinstance(other, TFTP_DATA) or
+ isinstance(other, TFTP_RRQ) or
+ isinstance(other, TFTP_WRQ) or
+ isinstance(other, TFTP_ACK))
+ def mysummary(self):
+ return self.sprintf("ERROR %errorcode%: %errormsg%"),[UDP]
+
+
+class TFTP_OACK(Packet):
+ name = "TFTP Option Ack"
+ fields_desc = [ ]
+ def answers(self, other):
+ return isinstance(other, TFTP_WRQ) or isinstance(other, TFTP_RRQ)
+
+
+##########
+## SNMP ##
+##########
+
+######[ ASN1 class ]######
+
+class ASN1_Class_SNMP(ASN1_Class_UNIVERSAL):
+ name="SNMP"
+ PDU_GET = 0xa0
+ PDU_NEXT = 0xa1
+ PDU_RESPONSE = 0xa2
+ PDU_SET = 0xa3
+ PDU_TRAPv1 = 0xa4
+ PDU_BULK = 0xa5
+ PDU_INFORM = 0xa6
+ PDU_TRAPv2 = 0xa7
+
+
+class ASN1_SNMP_PDU_GET(ASN1_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_GET
+
+class ASN1_SNMP_PDU_NEXT(ASN1_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_NEXT
+
+class ASN1_SNMP_PDU_RESPONSE(ASN1_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_RESPONSE
+
+class ASN1_SNMP_PDU_SET(ASN1_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_SET
+
+class ASN1_SNMP_PDU_TRAPv1(ASN1_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_TRAPv1
+
+class ASN1_SNMP_PDU_BULK(ASN1_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_BULK
+
+class ASN1_SNMP_PDU_INFORM(ASN1_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_INFORM
+
+class ASN1_SNMP_PDU_TRAPv2(ASN1_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_TRAPv2
+
+
+######[ BER codecs ]#######
+
+class BERcodec_SNMP_PDU_GET(BERcodec_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_GET
+
+class BERcodec_SNMP_PDU_NEXT(BERcodec_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_NEXT
+
+class BERcodec_SNMP_PDU_RESPONSE(BERcodec_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_RESPONSE
+
+class BERcodec_SNMP_PDU_SET(BERcodec_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_SET
+
+class BERcodec_SNMP_PDU_TRAPv1(BERcodec_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_TRAPv1
+
+class BERcodec_SNMP_PDU_BULK(BERcodec_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_BULK
+
+class BERcodec_SNMP_PDU_INFORM(BERcodec_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_INFORM
+
+class BERcodec_SNMP_PDU_TRAPv2(BERcodec_SEQUENCE):
+ tag = ASN1_Class_SNMP.PDU_TRAPv2
+
+
+
+######[ ASN1 fields ]######
+
+class ASN1F_SNMP_PDU_GET(ASN1F_SEQUENCE):
+ ASN1_tag = ASN1_Class_SNMP.PDU_GET
+
+class ASN1F_SNMP_PDU_NEXT(ASN1F_SEQUENCE):
+ ASN1_tag = ASN1_Class_SNMP.PDU_NEXT
+
+class ASN1F_SNMP_PDU_RESPONSE(ASN1F_SEQUENCE):
+ ASN1_tag = ASN1_Class_SNMP.PDU_RESPONSE
+
+class ASN1F_SNMP_PDU_SET(ASN1F_SEQUENCE):
+ ASN1_tag = ASN1_Class_SNMP.PDU_SET
+
+class ASN1F_SNMP_PDU_TRAPv1(ASN1F_SEQUENCE):
+ ASN1_tag = ASN1_Class_SNMP.PDU_TRAPv1
+
+class ASN1F_SNMP_PDU_BULK(ASN1F_SEQUENCE):
+ ASN1_tag = ASN1_Class_SNMP.PDU_BULK
+
+class ASN1F_SNMP_PDU_INFORM(ASN1F_SEQUENCE):
+ ASN1_tag = ASN1_Class_SNMP.PDU_INFORM
+
+class ASN1F_SNMP_PDU_TRAPv2(ASN1F_SEQUENCE):
+ ASN1_tag = ASN1_Class_SNMP.PDU_TRAPv2
+
+
+
+######[ SNMP Packet ]######
+
+SNMP_error = { 0: "no_error",
+ 1: "too_big",
+ 2: "no_such_name",
+ 3: "bad_value",
+ 4: "read_only",
+ 5: "generic_error",
+ 6: "no_access",
+ 7: "wrong_type",
+ 8: "wrong_length",
+ 9: "wrong_encoding",
+ 10: "wrong_value",
+ 11: "no_creation",
+ 12: "inconsistent_value",
+ 13: "ressource_unavailable",
+ 14: "commit_failed",
+ 15: "undo_failed",
+ 16: "authorization_error",
+ 17: "not_writable",
+ 18: "inconsistent_name",
+ }
+
+SNMP_trap_types = { 0: "cold_start",
+ 1: "warm_start",
+ 2: "link_down",
+ 3: "link_up",
+ 4: "auth_failure",
+ 5: "egp_neigh_loss",
+ 6: "enterprise_specific",
+ }
+
+class SNMPvarbind(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SEQUENCE( ASN1F_OID("oid","1.3"),
+ ASN1F_field("value",ASN1_NULL(0))
+ )
+
+
+class SNMPget(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SNMP_PDU_GET( ASN1F_INTEGER("id",0),
+ ASN1F_enum_INTEGER("error",0, SNMP_error),
+ ASN1F_INTEGER("error_index",0),
+ ASN1F_SEQUENCE_OF("varbindlist", [], SNMPvarbind)
+ )
+
+class SNMPnext(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SNMP_PDU_NEXT( ASN1F_INTEGER("id",0),
+ ASN1F_enum_INTEGER("error",0, SNMP_error),
+ ASN1F_INTEGER("error_index",0),
+ ASN1F_SEQUENCE_OF("varbindlist", [], SNMPvarbind)
+ )
+
+class SNMPresponse(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SNMP_PDU_RESPONSE( ASN1F_INTEGER("id",0),
+ ASN1F_enum_INTEGER("error",0, SNMP_error),
+ ASN1F_INTEGER("error_index",0),
+ ASN1F_SEQUENCE_OF("varbindlist", [], SNMPvarbind)
+ )
+
+class SNMPset(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SNMP_PDU_SET( ASN1F_INTEGER("id",0),
+ ASN1F_enum_INTEGER("error",0, SNMP_error),
+ ASN1F_INTEGER("error_index",0),
+ ASN1F_SEQUENCE_OF("varbindlist", [], SNMPvarbind)
+ )
+
+class SNMPtrapv1(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SNMP_PDU_TRAPv1( ASN1F_INTEGER("id",0),
+ ASN1F_OID("enterprise", "1.3"),
+ ASN1F_STRING("agent_addr",""),
+ ASN1F_enum_INTEGER("generic_trap", 0, SNMP_trap_types),
+ ASN1F_INTEGER("specific_trap", 0),
+ ASN1F_INTEGER("time_stamp", IntAutoTime()),
+ ASN1F_SEQUENCE_OF("varbindlist", [], SNMPvarbind)
+ )
+
+class SNMPbulk(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SNMP_PDU_BULK( ASN1F_INTEGER("id",0),
+ ASN1F_INTEGER("non_repeaters",0),
+ ASN1F_INTEGER("max_repetitions",0),
+ ASN1F_SEQUENCE_OF("varbindlist", [], SNMPvarbind)
+ )
+
+class SNMPinform(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SNMP_PDU_INFORM( ASN1F_INTEGER("id",0),
+ ASN1F_enum_INTEGER("error",0, SNMP_error),
+ ASN1F_INTEGER("error_index",0),
+ ASN1F_SEQUENCE_OF("varbindlist", [], SNMPvarbind)
+ )
+
+class SNMPtrapv2(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SNMP_PDU_TRAPv2( ASN1F_INTEGER("id",0),
+ ASN1F_enum_INTEGER("error",0, SNMP_error),
+ ASN1F_INTEGER("error_index",0),
+ ASN1F_SEQUENCE_OF("varbindlist", [], SNMPvarbind)
+ )
+
+
+class SNMP(ASN1_Packet):
+ ASN1_codec = ASN1_Codecs.BER
+ ASN1_root = ASN1F_SEQUENCE(
+ ASN1F_enum_INTEGER("version", 1, {0:"v1", 1:"v2c", 2:"v2", 3:"v3"}),
+ ASN1F_STRING("community","public"),
+ ASN1F_CHOICE("PDU", SNMPget(),
+ SNMPget, SNMPnext, SNMPresponse, SNMPset,
+ SNMPtrapv1, SNMPbulk, SNMPinform, SNMPtrapv2)
+ )
+ def answers(self, other):
+ return ( isinstance(self.PDU, SNMPresponse) and
+ ( isinstance(other.PDU, SNMPget) or
+ isinstance(other.PDU, SNMPnext) or
+ isinstance(other.PDU, SNMPset) ) and
+ self.PDU.id == other.PDU.id )
+
+
+
+#################
+## Bind layers ##
+#################
+
+
+def bind_bottom_up(lower, upper, __fval=None, **fval):
+ if __fval is not None:
+ fval.update(__fval)
+ lower.payload_guess = lower.payload_guess[:]
+ lower.payload_guess.append((fval, upper))
+
+
+def bind_top_down(lower, upper, __fval=None, **fval):
+ if __fval is not None:
+ fval.update(__fval)
+ upper.overload_fields = upper.overload_fields.copy()
+ upper.overload_fields[lower] = fval
+
+def bind_layers(lower, upper, __fval=None, **fval):
+ if __fval is not None:
+ fval.update(__fval)
+ bind_top_down(lower, upper, **fval)
+ bind_bottom_up(lower, upper, **fval)
+
+def split_bottom_up(lower, upper, __fval=None, **fval):
+ if __fval is not None:
+ fval.update(__fval)
+ def do_filter((f,u),upper=upper,fval=fval):
+ if u != upper:
+ return True
+ for k in fval:
+ if k not in f or f[k] != fval[k]:
+ return True
+ return False
+ lower.payload_guess = filter(do_filter, lower.payload_guess)
+
+def split_top_down(lower, upper, __fval=None, **fval):
+ if __fval is not None:
+ fval.update(__fval)
+ if lower in upper.overload_fields:
+ ofval = upper.overload_fields[lower]
+ for k in fval:
+ if k not in ofval or ofval[k] != fval[k]:
+ return
+ upper.overload_fields = upper.overload_fields.copy()
+ del(upper.overload_fields[lower])
+
+def split_layers(lower, upper, __fval=None, **fval):
+ if __fval is not None:
+ fval.update(__fval)
+ split_bottom_up(lower, upper, **fval)
+ split_top_down(lower, upper, **fval)
+
+
+bind_layers( Dot3, LLC, )
+bind_layers( GPRS, IP, )
+bind_layers( PrismHeader, Dot11, )
+bind_layers( RadioTap, Dot11, )
+bind_layers( Dot11, LLC, type=2)
+bind_layers( PPP, IP, proto=33)
+bind_layers( Ether, LLC, type=122)
+bind_layers( Ether, Dot1Q, type=33024)
+bind_layers( Ether, Ether, type=1)
+bind_layers( Ether, ARP, type=2054)
+bind_layers( Ether, IP, type=2048)
+bind_layers( Ether, EAPOL, type=34958)
+bind_layers( Ether, EAPOL, dst='01:80:c2:00:00:03', type=34958)
+bind_layers( Ether, PPPoED, type=34915)
+bind_layers( Ether, PPPoE, type=34916)
+bind_layers( CookedLinux, LLC, proto=122)
+bind_layers( CookedLinux, Dot1Q, proto=33024)
+bind_layers( CookedLinux, Ether, proto=1)
+bind_layers( CookedLinux, ARP, proto=2054)
+bind_layers( CookedLinux, IP, proto=2048)
+bind_layers( CookedLinux, EAPOL, proto=34958)
+bind_layers( CookedLinux, PPPoED, proto=34915)
+bind_layers( CookedLinux, PPPoE, proto=34916)
+bind_layers( GRE, LLC, proto=122)
+bind_layers( GRE, Dot1Q, proto=33024)
+bind_layers( GRE, Ether, proto=1)
+bind_layers( GRE, ARP, proto=2054)
+bind_layers( GRE, IP, proto=2048)
+bind_layers( GRE, EAPOL, proto=34958)
+bind_layers( PPPoE, PPP, code=0)
+bind_layers( EAPOL, EAP, type=0)
+bind_layers( LLC, STP, dsap=66, ssap=66, ctrl=3)
+bind_layers( LLC, SNAP, dsap=170, ssap=170, ctrl=3)
+bind_layers( SNAP, Dot1Q, code=33024)
+bind_layers( SNAP, Ether, code=1)
+bind_layers( SNAP, ARP, code=2054)
+bind_layers( SNAP, IP, code=2048)
+bind_layers( SNAP, EAPOL, code=34958)
+bind_layers( SNAP, STP, code=267)
+bind_layers( IPerror, IPerror, frag=0, proto=4)
+bind_layers( IPerror, ICMPerror, frag=0, proto=1)
+bind_layers( IPerror, TCPerror, frag=0, proto=6)
+bind_layers( IPerror, UDPerror, frag=0, proto=17)
+bind_layers( IP, IP, frag=0, proto=4)
+bind_layers( IP, ICMP, frag=0, proto=1)
+bind_layers( IP, TCP, frag=0, proto=6)
+bind_layers( IP, UDP, frag=0, proto=17)
+bind_layers( IP, GRE, frag=0, proto=47)
+bind_layers( UDP, SNMP, sport=161)
+bind_layers( UDP, SNMP, dport=161)
+bind_layers( UDP, MGCP, dport=2727)
+bind_layers( UDP, MGCP, sport=2727)
+bind_layers( UDP, DNS, dport=53)
+bind_layers( UDP, DNS, sport=53)
+bind_layers( UDP, ISAKMP, dport=500, sport=500)
+bind_layers( UDP, HSRP, dport=1985, sport=1985)
+bind_layers( UDP, NTP, dport=123, sport=123)
+bind_layers( UDP, BOOTP, dport=67, sport=68)
+bind_layers( UDP, BOOTP, dport=68, sport=67)
+bind_layers( BOOTP, DHCP, options='c\x82Sc')
+bind_layers( UDP, RIP, sport=520)
+bind_layers( UDP, RIP, dport=520)
+bind_layers( RIP, RIPEntry, )
+bind_layers( RIPEntry, RIPEntry, )
+bind_layers( Dot11, Dot11AssoReq, subtype=0, type=0)
+bind_layers( Dot11, Dot11AssoResp, subtype=1, type=0)
+bind_layers( Dot11, Dot11ReassoReq, subtype=2, type=0)
+bind_layers( Dot11, Dot11ReassoResp, subtype=3, type=0)
+bind_layers( Dot11, Dot11ProbeReq, subtype=4, type=0)
+bind_layers( Dot11, Dot11ProbeResp, subtype=5, type=0)
+bind_layers( Dot11, Dot11Beacon, subtype=8, type=0)
+bind_layers( Dot11, Dot11ATIM, subtype=9, type=0)
+bind_layers( Dot11, Dot11Disas, subtype=10, type=0)
+bind_layers( Dot11, Dot11Auth, subtype=11, type=0)
+bind_layers( Dot11, Dot11Deauth, subtype=12, type=0)
+bind_layers( Dot11Beacon, Dot11Elt, )
+bind_layers( Dot11AssoReq, Dot11Elt, )
+bind_layers( Dot11AssoResp, Dot11Elt, )
+bind_layers( Dot11ReassoReq, Dot11Elt, )
+bind_layers( Dot11ReassoResp, Dot11Elt, )
+bind_layers( Dot11ProbeReq, Dot11Elt, )
+bind_layers( Dot11ProbeResp, Dot11Elt, )
+bind_layers( Dot11Auth, Dot11Elt, )
+bind_layers( Dot11Elt, Dot11Elt, )
+bind_layers( TCP, Skinny, dport=2000)
+bind_layers( TCP, Skinny, sport=2000)
+bind_layers( UDP, SebekHead, sport=1101)
+bind_layers( UDP, SebekHead, dport=1101)
+bind_layers( UDP, SebekHead, dport=1101, sport=1101)
+bind_layers( SebekHead, SebekV1, version=1)
+bind_layers( SebekHead, SebekV2Sock, version=2, type=2)
+bind_layers( SebekHead, SebekV2, version=2)
+bind_layers( SebekHead, SebekV3Sock, version=3, type=2)
+bind_layers( SebekHead, SebekV3, version=3)
+bind_layers( CookedLinux, IrLAPHead, proto=23)
+bind_layers( IrLAPHead, IrLAPCommand, Type=1)
+bind_layers( IrLAPCommand, IrLMP, )
+bind_layers( UDP, NBNSQueryRequest, dport=137)
+bind_layers( UDP, NBNSRequest, dport=137)
+bind_layers( UDP, NBNSQueryResponse, sport=137)
+bind_layers( UDP, NBNSQueryResponseNegative, sport=137)
+bind_layers( UDP, NBNSNodeStatusResponse, sport=137)
+bind_layers( NBNSNodeStatusResponse, NBNSNodeStatusResponseService, )
+bind_layers( NBNSNodeStatusResponse, NBNSNodeStatusResponseService, )
+bind_layers( NBNSNodeStatusResponseService, NBNSNodeStatusResponseService, )
+bind_layers( NBNSNodeStatusResponseService, NBNSNodeStatusResponseEnd, )
+bind_layers( UDP, NBNSWackResponse, sport=137)
+bind_layers( UDP, NBTDatagram, dport=138)
+bind_layers( TCP, NBTSession, dport=139)
+bind_layers( NBTSession, SMBNegociate_Protocol_Request_Header, )
+bind_layers( SMBNegociate_Protocol_Request_Header, SMBNegociate_Protocol_Request_Tail, )
+bind_layers( SMBNegociate_Protocol_Request_Tail, SMBNegociate_Protocol_Request_Tail, )
+bind_layers( NBTSession, SMBNegociate_Protocol_Response_Advanced_Security, ExtendedSecurity=1)
+bind_layers( NBTSession, SMBNegociate_Protocol_Response_No_Security, ExtendedSecurity=0, EncryptionKeyLength=8)
+bind_layers( NBTSession, SMBNegociate_Protocol_Response_No_Security_No_Key, ExtendedSecurity=0, EncryptionKeyLength=0)
+bind_layers( NBTSession, SMBSession_Setup_AndX_Request, )
+bind_layers( NBTSession, SMBSession_Setup_AndX_Response, )
+bind_layers( HCI_Hdr, HCI_ACL_Hdr, type=2)
+bind_layers( HCI_Hdr, Raw, )
+bind_layers( HCI_ACL_Hdr, L2CAP_Hdr, )
+bind_layers( L2CAP_Hdr, L2CAP_CmdHdr, cid=1)
+bind_layers( L2CAP_CmdHdr, L2CAP_CmdRej, code=1)
+bind_layers( L2CAP_CmdHdr, L2CAP_ConnReq, code=2)
+bind_layers( L2CAP_CmdHdr, L2CAP_ConnResp, code=3)
+bind_layers( L2CAP_CmdHdr, L2CAP_ConfReq, code=4)
+bind_layers( L2CAP_CmdHdr, L2CAP_ConfResp, code=5)
+bind_layers( L2CAP_CmdHdr, L2CAP_DisconnReq, code=6)
+bind_layers( L2CAP_CmdHdr, L2CAP_DisconnResp, code=7)
+bind_layers( L2CAP_CmdHdr, L2CAP_InfoReq, code=10)
+bind_layers( L2CAP_CmdHdr, L2CAP_InfoResp, code=11)
+bind_layers( UDP, MobileIP, sport=434)
+bind_layers( UDP, MobileIP, dport=434)
+bind_layers( MobileIP, MobileIPRRQ, type=1)
+bind_layers( MobileIP, MobileIPRRP, type=3)
+bind_layers( MobileIP, MobileIPTunnelData, type=4)
+bind_layers( MobileIPTunnelData, IP, nexthdr=4)
+bind_layers( NetflowHeader, NetflowHeaderV1, version=1)
+bind_layers( NetflowHeaderV1, NetflowRecordV1, )
+
+bind_layers(UDP, TFTP, dport=69)
+bind_layers(TFTP, TFTP_RRQ, op=1)
+bind_layers(TFTP, TFTP_WRQ, op=2)
+bind_layers(TFTP, TFTP_DATA, op=3)
+bind_layers(TFTP, TFTP_ACK, op=4)
+bind_layers(TFTP, TFTP_ERROR, op=5)
+bind_layers(TFTP, TFTP_OACK, op=6)
+bind_layers(TFTP_RRQ, TFTP_Options)
+bind_layers(TFTP_WRQ, TFTP_Options)
+bind_layers(TFTP_OACK, TFTP_Options)
+
+
+###################
+## Fragmentation ##
+###################
+
+def fragment(pkt, fragsize=1480):
+ fragsize = (fragsize+7)/8*8
+ lst = []
+ for p in pkt:
+ s = str(p[IP].payload)
+ nb = (len(s)+fragsize-1)/fragsize
+ for i in range(nb):
+ q = p.copy()
+ del(q[IP].payload)
+ del(q[IP].chksum)
+ del(q[IP].len)
+ if i == nb-1:
+ q[IP].flags &= ~1
+ else:
+ q[IP].flags |= 1
+ q[IP].frag = i*fragsize/8
+ r = Raw(load=s[i*fragsize:(i+1)*fragsize])
+ r.overload_fields = p[IP].payload.overload_fields.copy()
+ q.add_payload(r)
+ lst.append(q)
+ return lst
+
+def overlap_frag(p, overlap, fragsize=8, overlap_fragsize=None):
+ if overlap_fragsize is None:
+ overlap_fragsize = fragsize
+ q = p.copy()
+ del(q[IP].payload)
+ q[IP].add_payload(overlap)
+
+ qfrag = fragment(q, overlap_fragsize)
+ qfrag[-1][IP].flags |= 1
+ return qfrag+fragment(p, fragsize)
+
+def defrag(plist):
+ """defrag(plist) -> ([not fragmented], [defragmented],
+ [ [bad fragments], [bad fragments], ... ])"""
+ frags = {}
+ nofrag = PacketList()
+ for p in plist:
+ ip = p[IP]
+ if IP not in p:
+ nofrag.append(p)
+ continue
+ if ip.frag == 0 and ip.flags & 1 == 0:
+ nofrag.append(p)
+ continue
+ uniq = (ip.id,ip.src,ip.dst,ip.proto)
+ if uniq in frags:
+ frags[uniq].append(p)
+ else:
+ frags[uniq] = PacketList([p])
+ defrag = []
+ missfrag = []
+ for lst in frags.itervalues():
+ lst.sort(lambda x,y:cmp(x.frag, y.frag))
+ p = lst[0]
+ if p.frag > 0:
+ missfrag.append(lst)
+ continue
+ p = p.copy()
+ if Padding in p:
+ del(p[Padding].underlayer.payload)
+ ip = p[IP]
+ if ip.len is None or ip.ihl is None:
+ clen = len(ip.payload)
+ else:
+ clen = ip.len - (ip.ihl<<2)
+ txt = Raw()
+ for q in lst[1:]:
+ if clen != q.frag<<3:
+ if clen > q.frag<<3:
+ warning("Fragment overlap (%i > %i) %r || %r || %r" % (clen, q.frag<<3, p,txt,q))
+ missfrag.append(lst)
+ txt = None
+ break
+ if q[IP].len is None or q[IP].ihl is None:
+ clen += len(q[IP].payload)
+ else:
+ clen += q[IP].len - (q[IP].ihl<<2)
+ if Padding in q:
+ del(q[Padding].underlayer.payload)
+ txt.add_payload(q[IP].payload.copy())
+
+ if txt is None:
+ continue
+
+ ip.flags &= ~1 # !MF
+ del(ip.chksum)
+ del(ip.len)
+ p = p/txt
+ defrag.append(p)
+ defrag2=PacketList()
+ for p in defrag:
+ defrag2.append(p.__class__(str(p)))
+ return nofrag,defrag2,missfrag
+
+def defragment(plist):
+ """defrag(plist) -> plist defragmented as much as possible """
+ frags = {}
+ final = []
+
+ pos = 0
+ for p in plist:
+ p._defrag_pos = pos
+ pos += 1
+ if IP in p:
+ ip = p[IP]
+ if ip.frag != 0 or ip.flags & 1:
+ ip = p[IP]
+ uniq = (ip.id,ip.src,ip.dst,ip.proto)
+ if uniq in frags:
+ frags[uniq].append(p)
+ else:
+ frags[uniq] = [p]
+ continue
+ final.append(p)
+
+ defrag = []
+ missfrag = []
+ for lst in frags.itervalues():
+ lst.sort(lambda x,y:cmp(x.frag, y.frag))
+ p = lst[0]
+ if p.frag > 0:
+ missfrag += lst
+ continue
+ p = p.copy()
+ if Padding in p:
+ del(p[Padding].underlayer.payload)
+ ip = p[IP]
+ if ip.len is None or ip.ihl is None:
+ clen = len(ip.payload)
+ else:
+ clen = ip.len - (ip.ihl<<2)
+ txt = Raw()
+ for q in lst[1:]:
+ if clen != q.frag<<3:
+ if clen > q.frag<<3:
+ warning("Fragment overlap (%i > %i) %r || %r || %r" % (clen, q.frag<<3, p,txt,q))
+ missfrag += lst
+ txt = None
+ break
+ if q[IP].len is None or q[IP].ihl is None:
+ clen += len(q[IP].payload)
+ else:
+ clen += q[IP].len - (q[IP].ihl<<2)
+ if Padding in q:
+ del(q[Padding].underlayer.payload)
+ txt.add_payload(q[IP].payload.copy())
+
+ if txt is None:
+ continue
+
+ ip.flags &= ~1 # !MF
+ del(ip.chksum)
+ del(ip.len)
+ p = p/txt
+ p._defrag_pos = lst[-1]._defrag_pos
+ defrag.append(p)
+ defrag2=[]
+ for p in defrag:
+ q = p.__class__(str(p))
+ q._defrag_pos = p._defrag_pos
+ defrag2.append(q)
+ final += defrag2
+ final += missfrag
+ final.sort(lambda x,y: cmp(x._defrag_pos, y._defrag_pos))
+ for p in final:
+ del(p._defrag_pos)
+
+ if hasattr(plist, "listname"):
+ name = "Defragmented %s" % plist.listname
+ else:
+ name = "Defragmented"
+
+
+ return PacketList(final, name=name)
+
+
+
+
+
+
+###################
+## Super sockets ##
+###################
+
+def Ether_Dot3_Dispatcher(pkt=None, **kargs):
+ if type(pkt) is str and len(pkt) >= 14 and struct.unpack("!H", pkt[12:14])[0] <= 1500:
+ return Dot3(pkt, **kargs)
+ return Ether(pkt, **kargs)
+
+# According to libdnet
+LLTypes = { ARPHDR_ETHER : Ether_Dot3_Dispatcher,
+ ARPHDR_METRICOM : Ether_Dot3_Dispatcher,
+ ARPHDR_LOOPBACK : Ether_Dot3_Dispatcher,
+ 12 : IP,
+ 101 : IP,
+ 801 : Dot11,
+ 802 : PrismHeader,
+ 803 : RadioTap,
+ 105 : Dot11,
+ 113 : CookedLinux,
+ 119 : PrismHeader, # for atheros
+ 127 : RadioTap,
+ 144 : CookedLinux, # called LINUX_IRDA, similar to CookedLinux
+ 783 : IrLAPHead,
+ 0xB1E70073L : HCI_Hdr, # I invented this one
+ }
+
+LLNumTypes = { Ether : ARPHDR_ETHER,
+ IP : 12,
+ IP : 101,
+ Dot11 : 801,
+ PrismHeader : 802,
+ RadioTap : 803,
+ RadioTap : 127,
+ Dot11 : 105,
+ CookedLinux : 113,
+ CookedLinux : 144,
+ IrLAPHead : 783
+ }
+
+L3Types = { ETH_P_IP : IP,
+ ETH_P_ARP : ARP,
+ ETH_P_ALL : IP
+ }
+
+
+
+class SuperSocket:
+ closed=0
+ def __init__(self, family=socket.AF_INET,type=socket.SOCK_STREAM, proto=0):
+ self.ins = socket.socket(family, type, proto)
+ self.outs = self.ins
+ self.promisc=None
+ def send(self, x):
+ return self.outs.send(str(x))
+ def recv(self, x):
+ return Raw(self.ins.recv(x))
+ def fileno(self):
+ return self.ins.fileno()
+ def close(self):
+ if self.closed:
+ return
+ self.closed=1
+ if self.ins != self.outs:
+ if self.outs and self.outs.fileno() != -1:
+ self.outs.close()
+ if self.ins and self.ins.fileno() != -1:
+ self.ins.close()
+ def bind_in(self, addr):
+ self.ins.bind(addr)
+ def bind_out(self, addr):
+ self.outs.bind(addr)
+
+
+class L3RawSocket(SuperSocket):
+ def __init__(self, type = ETH_P_IP, filter=None, iface=None, promisc=None, nofilter=0):
+ self.outs = socket.socket(socket.AF_INET, socket.SOCK_RAW, socket.IPPROTO_RAW)
+ self.outs.setsockopt(socket.SOL_IP, socket.IP_HDRINCL, 1)
+ self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
+ def recv(self, x):
+ return Ether(self.ins.recv(x)).payload
+ def send(self, x):
+ try:
+ self.outs.sendto(str(x),(x.dst,0))
+ except socket.error,msg:
+ log_runtime.error(msg)
+
+
+
+class L3PacketSocket(SuperSocket):
+ def __init__(self, type = ETH_P_ALL, filter=None, promisc=None, iface=None, nofilter=0):
+ self.type = type
+ self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
+ self.ins.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 0)
+ if not nofilter:
+ if conf.except_filter:
+ if filter:
+ filter = "(%s) and not (%s)" % (filter, conf.except_filter)
+ else:
+ filter = "not (%s)" % conf.except_filter
+ if filter is not None:
+ attach_filter(self.ins, filter)
+ self.ins.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 2**30)
+ self.outs = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
+ self.outs.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 2**30)
+ if promisc is None:
+ promisc = conf.promisc
+ self.promisc = promisc
+ if self.promisc:
+ if iface is None:
+ self.iff = get_if_list()
+ else:
+ if iface.__class__ is list:
+ self.iff = iface
+ else:
+ self.iff = [iface]
+ for i in self.iff:
+ set_promisc(self.ins, i)
+ def close(self):
+ if self.closed:
+ return
+ self.closed=1
+ if self.promisc:
+ for i in self.iff:
+ set_promisc(self.ins, i, 0)
+ SuperSocket.close(self)
+ def recv(self, x):
+ pkt, sa_ll = self.ins.recvfrom(x)
+ if sa_ll[2] == socket.PACKET_OUTGOING:
+ return None
+ if LLTypes.has_key(sa_ll[3]):
+ cls = LLTypes[sa_ll[3]]
+ lvl = 2
+ elif L3Types.has_key(sa_ll[1]):
+ cls = L3Types[sa_ll[1]]
+ lvl = 3
+ else:
+ warning("Unable to guess type (interface=%s protocol=%#x family=%i). Using Ethernet" % (sa_ll[0],sa_ll[1],sa_ll[3]))
+ cls = Ether
+ lvl = 2
+
+ try:
+ pkt = cls(pkt)
+ except KeyboardInterrupt:
+ raise
+ except:
+ if conf.debug_dissector:
+ raise
+ pkt = Raw(pkt)
+ if lvl == 2:
+ pkt = pkt.payload
+ return pkt
+
+ def send(self, x):
+ if isinstance(x, IPv6):
+ iff,a,gw = conf.route6.route(x.dst)
+ elif hasattr(x,"dst"):
+ iff,a,gw = conf.route.route(x.dst)
+ else:
+ iff = conf.iface
+ sdto = (iff, self.type)
+ self.outs.bind(sdto)
+ sn = self.outs.getsockname()
+ ll = lambda x:x
+ if sn[3] in (ARPHDR_PPP,ARPHDR_TUN):
+ sdto = (iff, ETH_P_IP)
+ if LLTypes.has_key(sn[3]):
+ ll = lambda x:LLTypes[sn[3]]()/x
+ try:
+ self.outs.sendto(str(ll(x)), sdto)
+ except socket.error,msg:
+ if conf.auto_fragment and msg[0] == 90:
+ for p in fragment(x):
+ self.outs.sendto(str(ll(p)), sdto)
+ else:
+ raise
+
+
+
+
+class L2Socket(SuperSocket):
+ def __init__(self, iface = None, type = ETH_P_ALL, filter=None, nofilter=0):
+ if iface is None:
+ iface = conf.iface
+ self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
+ self.ins.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 0)
+ if not nofilter:
+ if conf.except_filter:
+ if filter:
+ filter = "(%s) and not (%s)" % (filter, conf.except_filter)
+ else:
+ filter = "not (%s)" % conf.except_filter
+ if filter is not None:
+ attach_filter(self.ins, filter)
+ self.ins.bind((iface, type))
+ self.ins.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 2**30)
+ self.outs = self.ins
+ self.outs.setsockopt(socket.SOL_SOCKET, socket.SO_SNDBUF, 2**30)
+ sa_ll = self.outs.getsockname()
+ if LLTypes.has_key(sa_ll[3]):
+ self.LL = LLTypes[sa_ll[3]]
+ elif L3Types.has_key(sa_ll[1]):
+ self.LL = L3Types[sa_ll[1]]
+ else:
+ warning("Unable to guess type (interface=%s protocol=%#x family=%i). Using Ethernet" % (sa_ll[0],sa_ll[1],sa_ll[3]))
+ self.LL = Ether
+
+ def recv(self, x):
+ pkt, sa_ll = self.ins.recvfrom(x)
+ if sa_ll[2] == socket.PACKET_OUTGOING:
+ return None
+ try:
+ q = self.LL(pkt)
+ except KeyboardInterrupt:
+ raise
+ except:
+ if conf.debug_dissector:
+ raise
+ q = Raw(pkt)
+ return q
+
+
+class L2ListenSocket(SuperSocket):
+ def __init__(self, iface = None, type = ETH_P_ALL, promisc=None, filter=None, nofilter=0):
+ self.type = type
+ self.outs = None
+ self.ins = socket.socket(socket.AF_PACKET, socket.SOCK_RAW, socket.htons(type))
+ self.ins.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 0)
+ if iface is not None:
+ self.ins.bind((iface, type))
+ if not nofilter:
+ if conf.except_filter:
+ if filter:
+ filter = "(%s) and not (%s)" % (filter, conf.except_filter)
+ else:
+ filter = "not (%s)" % conf.except_filter
+ if filter is not None:
+ attach_filter(self.ins, filter)
+ if promisc is None:
+ promisc = conf.sniff_promisc
+ self.promisc = promisc
+ if iface is None:
+ self.iff = get_if_list()
+ else:
+ if iface.__class__ is list:
+ self.iff = iface
+ else:
+ self.iff = [iface]
+ if self.promisc:
+ for i in self.iff:
+ set_promisc(self.ins, i)
+ self.ins.setsockopt(socket.SOL_SOCKET, socket.SO_RCVBUF, 2**30)
+ def close(self):
+ if self.promisc:
+ for i in self.iff:
+ set_promisc(self.ins, i, 0)
+ SuperSocket.close(self)
+
+ def recv(self, x):
+ pkt, sa_ll = self.ins.recvfrom(x)
+ if LLTypes.has_key(sa_ll[3]):
+ cls = LLTypes[sa_ll[3]]
+ elif L3Types.has_key(sa_ll[1]):
+ cls = L3Types[sa_ll[1]]
+ else:
+ warning("Unable to guess type (interface=%s protocol=%#x family=%i). Using Ethernet" % (sa_ll[0],sa_ll[1],sa_ll[3]))
+ cls = Ether
+
+ try:
+ pkt = cls(pkt)
+ except KeyboardInterrupt:
+ raise
+ except:
+ if conf.debug_dissector:
+ raise
+ pkt = Raw(pkt)
+ return pkt
+
+ def send(self, x):
+ raise Scapy_Exception("Can't send anything with L2ListenSocket")
+
+
+
+class L3dnetSocket(SuperSocket):
+ def __init__(self, type = ETH_P_ALL, filter=None, promisc=None, iface=None, nofilter=0):
+ self.iflist = {}
+ self.ins = pcap.pcapObject()
+ if iface is None:
+ iface = conf.iface
+ self.iface = iface
+ self.ins.open_live(iface, 1600, 0, 100)
+ try:
+ ioctl(self.ins.fileno(),BIOCIMMEDIATE,struct.pack("I",1))
+ except:
+ pass
+ if nofilter:
+ if type != ETH_P_ALL: # PF_PACKET stuff. Need to emulate this for pcap
+ filter = "ether proto %i" % type
+ else:
+ filter = None
+ else:
+ if conf.except_filter:
+ if filter:
+ filter = "(%s) and not (%s)" % (filter, conf.except_filter)
+ else:
+ filter = "not (%s)" % conf.except_filter
+ if type != ETH_P_ALL: # PF_PACKET stuff. Need to emulate this for pcap
+ if filter:
+ filter = "(ether proto %i) and (%s)" % (type,filter)
+ else:
+ filter = "ether proto %i" % type
+ if filter:
+ self.ins.setfilter(filter, 0, 0)
+ def send(self, x):
+ if isinstance(x, IPv6):
+ iff,a,gw = conf.route6.route(x.dst)
+ elif hasattr(x,"dst"):
+ iff,a,gw = conf.route.route(x.dst)
+ else:
+ iff = conf.iface
+ ifs = self.iflist.get(iff)
+ if ifs is None:
+ self.iflist[iff] = ifs = dnet.eth(iff)
+ ifs.send(str(Ether()/x))
+ def recv(self,x=MTU):
+ ll = self.ins.datalink()
+ if LLTypes.has_key(ll):
+ cls = LLTypes[ll]
+ else:
+ warning("Unable to guess datalink type (interface=%s linktype=%i). Using Ethernet" % (self.iface, ll))
+ cls = Ether
+
+ pkt = self.ins.next()
+ if pkt is not None:
+ pkt = pkt[1]
+ if pkt is None:
+ return
+
+ try:
+ pkt = cls(pkt)
+ except KeyboardInterrupt:
+ raise
+ except:
+ if conf.debug_dissector:
+ raise
+ pkt = Raw(pkt)
+ return pkt.payload
+
+ def nonblock_recv(self):
+ self.ins.setnonblock(1)
+ p = self.recv()
+ self.ins.setnonblock(0)
+ return p
+
+ def close(self):
+ if hasattr(self, "ins"):
+ del(self.ins)
+ if hasattr(self, "outs"):
+ del(self.outs)
+
+class L2dnetSocket(SuperSocket):
+ def __init__(self, iface = None, type = ETH_P_ALL, filter=None, nofilter=0):
+ if iface is None:
+ iface = conf.iface
+ self.iface = iface
+ self.ins = pcap.pcapObject()
+ self.ins.open_live(iface, 1600, 0, 100)
+ try:
+ ioctl(self.ins.fileno(),BIOCIMMEDIATE,struct.pack("I",1))
+ except:
+ pass
+ if nofilter:
+ if type != ETH_P_ALL: # PF_PACKET stuff. Need to emulate this for pcap
+ filter = "ether proto %i" % type
+ else:
+ filter = None
+ else:
+ if conf.except_filter:
+ if filter:
+ filter = "(%s) and not (%s)" % (filter, conf.except_filter)
+ else:
+ filter = "not (%s)" % conf.except_filter
+ if type != ETH_P_ALL: # PF_PACKET stuff. Need to emulate this for pcap
+ if filter:
+ filter = "(ether proto %i) and (%s)" % (type,filter)
+ else:
+ filter = "ether proto %i" % type
+ if filter:
+ self.ins.setfilter(filter, 0, 0)
+ self.outs = dnet.eth(iface)
+ def recv(self,x):
+ ll = self.ins.datalink()
+ if LLTypes.has_key(ll):
+ cls = LLTypes[ll]
+ else:
+ warning("Unable to guess datalink type (interface=%s linktype=%i). Using Ethernet" % (self.iface, ll))
+ cls = Ether
+
+ pkt = self.ins.next()
+ if pkt is not None:
+ pkt = pkt[1]
+ if pkt is None:
+ return
+
+ try:
+ pkt = cls(pkt)
+ except KeyboardInterrupt:
+ raise
+ except:
+ if conf.debug_dissector:
+ raise
+ pkt = Raw(pkt)
+ return pkt
+
+ def nonblock_recv(self):
+ self.ins.setnonblock(1)
+ p = self.recv(MTU)
+ self.ins.setnonblock(0)
+ return p
+
+ def close(self):
+ if hasattr(self, "ins"):
+ del(self.ins)
+ if hasattr(self, "outs"):
+ del(self.outs)
+
+
+
+
+
+class L2pcapListenSocket(SuperSocket):
+ def __init__(self, iface = None, type = ETH_P_ALL, promisc=None, filter=None):
+ self.type = type
+ self.outs = None
+ self.ins = pcap.pcapObject()
+ self.iface = iface
+ if iface is None:
+ iface = conf.iface
+ if promisc is None:
+ promisc = conf.sniff_promisc
+ self.promisc = promisc
+ self.ins.open_live(iface, 1600, self.promisc, 100)
+ try:
+ ioctl(self.ins.fileno(),BIOCIMMEDIATE,struct.pack("I",1))
+ except:
+ pass
+ if type == ETH_P_ALL: # Do not apply any filter if Ethernet type is given
+ if conf.except_filter:
+ if filter:
+ filter = "(%s) and not (%s)" % (filter, conf.except_filter)
+ else:
+ filter = "not (%s)" % conf.except_filter
+ if filter:
+ self.ins.setfilter(filter, 0, 0)
+
+ def close(self):
+ del(self.ins)
+
+ def recv(self, x):
+ ll = self.ins.datalink()
+ if LLTypes.has_key(ll):
+ cls = LLTypes[ll]
+ else:
+ warning("Unable to guess datalink type (interface=%s linktype=%i). Using Ethernet" % (self.iface, ll))
+ cls = Ether
+
+ pkt = None
+ while pkt is None:
+ pkt = self.ins.next()
+ if pkt is not None:
+ pkt = pkt[1]
+
+ try:
+ pkt = cls(pkt)
+ except KeyboardInterrupt:
+ raise
+ except:
+ if conf.debug_dissector:
+ raise
+ pkt = Raw(pkt)
+ return pkt
+
+ def send(self, x):
+ raise Scapy_Exception("Can't send anything with L2pcapListenSocket")
+
+
+class SimpleSocket(SuperSocket):
+ def __init__(self, sock):
+ self.ins = sock
+ self.outs = sock
+
+
+class StreamSocket(SimpleSocket):
+ def __init__(self, sock, basecls=Raw):
+ SimpleSocket.__init__(self, sock)
+ self.basecls = basecls
+
+ def recv(self, x=MTU):
+ pkt = self.ins.recv(x, socket.MSG_PEEK)
+ x = len(pkt)
+ pkt = self.basecls(pkt)
+ pad = pkt[Padding]
+ if pad is not None and pad.underlayer is not None:
+ del(pad.underlayer.payload)
+ while pad is not None and not isinstance(pad, NoPayload):
+ x -= len(pad.load)
+ pad = pad.payload
+ self.ins.recv(x)
+ return pkt
+
+
+class BluetoothL2CAPSocket(SuperSocket):
+ def __init__(self, peer):
+ s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW,
+ socket.BTPROTO_L2CAP)
+ s.connect((peer,0))
+
+ self.ins = self.outs = s
+
+ def recv(self, x):
+ return L2CAP_CmdHdr(self.ins.recv(x))
+
+
+class BluetoothHCISocket(SuperSocket):
+ def __init__(self, iface=0x10000, type=None):
+ s = socket.socket(socket.AF_BLUETOOTH, socket.SOCK_RAW, socket.BTPROTO_HCI)
+ s.setsockopt(socket.SOL_HCI, socket.HCI_DATA_DIR,1)
+ s.setsockopt(socket.SOL_HCI, socket.HCI_TIME_STAMP,1)
+ s.setsockopt(socket.SOL_HCI, socket.HCI_FILTER, struct.pack("IIIh2x", 0xffffffffL,0xffffffffL,0xffffffffL,0)) #type mask, event mask, event mask, opcode
+ s.bind((iface,))
+ self.ins = self.outs = s
+# s.connect((peer,0))
+
+
+ def recv(self, x):
+ return HCI_Hdr(self.ins.recv(x))
+
+
+
+####################
+## Send / Receive ##
+####################
+
+
+
+
+def sndrcv(pks, pkt, timeout = 2, inter = 0, verbose=None, chainCC=0, retry=0, multi=0):
+ if not isinstance(pkt, Gen):
+ pkt = SetGen(pkt)
+
+ if verbose is None:
+ verbose = conf.verb
+ debug.recv = PacketList([],"Unanswered")
+ debug.sent = PacketList([],"Sent")
+ debug.match = SndRcvList([])
+ nbrecv=0
+ ans = []
+ # do it here to fix random fields, so that parent and child have the same
+ tobesent = [p for p in pkt]
+ notans = len(tobesent)
+
+ hsent={}
+ for i in tobesent:
+ h = i.hashret()
+ if h in hsent:
+ hsent[h].append(i)
+ else:
+ hsent[h] = [i]
+ if retry < 0:
+ retry = -retry
+ autostop=retry
+ else:
+ autostop=0
+
+
+ while retry >= 0:
+ found=0
+
+ if timeout < 0:
+ timeout = None
+
+ rdpipe,wrpipe = os.pipe()
+ rdpipe=os.fdopen(rdpipe)
+ wrpipe=os.fdopen(wrpipe,"w")
+
+ pid = os.fork()
+ if pid == 0:
+ sys.stdin.close()
+ rdpipe.close()
+ try:
+ i = 0
+ if verbose:
+ print "Begin emission:"
+ for p in tobesent:
+ pks.send(p)
+ i += 1
+ time.sleep(inter)
+ if verbose:
+ print "Finished to send %i packets." % i
+ except SystemExit:
+ pass
+ except KeyboardInterrupt:
+ pass
+ except:
+ log_runtime.exception("--- Error in child %i" % os.getpid())
+ log_runtime.info("--- Error in child %i" % os.getpid())
+ os._exit(0)
+ else:
+ cPickle.dump(arp_cache, wrpipe)
+ wrpipe.close()
+ os._exit(0)
+ elif pid < 0:
+ log_runtime.error("fork error")
+ else:
+ wrpipe.close()
+ stoptime = 0
+ remaintime = None
+ inmask = [rdpipe,pks]
+ try:
+ while 1:
+ if stoptime:
+ remaintime = stoptime-time.time()
+ if remaintime <= 0:
+ break
+ r = None
+ if FREEBSD or DARWIN:
+ inp, out, err = select(inmask,[],[], 0.05)
+ if len(inp) == 0 or pks in inp:
+ r = pks.nonblock_recv()
+ else:
+ inp, out, err = select(inmask,[],[], remaintime)
+ if len(inp) == 0:
+ break
+ if pks in inp:
+ r = pks.recv(MTU)
+ if rdpipe in inp:
+ if timeout:
+ stoptime = time.time()+timeout
+ del(inmask[inmask.index(rdpipe)])
+ if r is None:
+ continue
+ ok = 0
+ h = r.hashret()
+ if h in hsent:
+ hlst = hsent[h]
+ for i in range(len(hlst)):
+ if r.answers(hlst[i]):
+ ans.append((hlst[i],r))
+ if verbose > 1:
+ os.write(1, "*")
+ ok = 1
+ if not multi:
+ del(hlst[i])
+ notans -= 1;
+ else:
+ if not hasattr(hlst[i], '_answered'):
+ notans -= 1;
+ hlst[i]._answered = 1;
+ break
+ if notans == 0 and not multi:
+ break
+ if not ok:
+ if verbose > 1:
+ os.write(1, ".")
+ nbrecv += 1
+ if conf.debug_match:
+ debug.recv.append(r)
+ except KeyboardInterrupt:
+ if chainCC:
+ raise
+
+ try:
+ ac = cPickle.load(rdpipe)
+ except EOFError:
+ warning("Child died unexpectedly. Packets may have not been sent")
+ else:
+ arp_cache.update(ac)
+ os.waitpid(pid,0)
+
+ remain = reduce(list.__add__, hsent.values(), [])
+ if multi:
+ remain = filter(lambda p: not hasattr(p, '_answered'), remain);
+
+ if autostop and len(remain) > 0 and len(remain) != len(tobesent):
+ retry = autostop
+
+ tobesent = remain
+ if len(tobesent) == 0:
+ break
+ retry -= 1
+
+ if conf.debug_match:
+ debug.sent=PacketList(remain[:],"Sent")
+ debug.match=SndRcvList(ans[:])
+
+ #clean the ans list to delete the field _answered
+ if (multi):
+ for s,r in ans:
+ if hasattr(s, '_answered'):
+ del(s._answered)
+
+ if verbose:
+ print "\nReceived %i packets, got %i answers, remaining %i packets" % (nbrecv+len(ans), len(ans), notans)
+ return SndRcvList(ans),PacketList(remain,"Unanswered"),debug.recv
+
+
+def __gen_send(s, x, inter=0, loop=0, count=None, verbose=None, *args, **kargs):
+ if not isinstance(x, Gen):
+ x = SetGen(x)
+ if verbose is None:
+ verbose = conf.verb
+ n = 0
+ if count is not None:
+ loop = -count
+ elif not loop:
+ loop=-1
+ try:
+ while loop:
+ for p in x:
+ s.send(p)
+ n += 1
+ if verbose:
+ os.write(1,".")
+ time.sleep(inter)
+ if loop < 0:
+ loop += 1
+ except KeyboardInterrupt:
+ pass
+ s.close()
+ if verbose:
+ print "\nSent %i packets." % n
+
+def send(x, inter=0, loop=0, count=None, verbose=None, *args, **kargs):
+ """Send packets at layer 3
+send(packets, [inter=0], [loop=0], [verbose=conf.verb]) -> None"""
+ __gen_send(conf.L3socket(*args, **kargs), x, inter=inter, loop=loop, count=count,verbose=verbose)
+
+def sendp(x, inter=0, loop=0, iface=None, iface_hint=None, count=None, verbose=None, *args, **kargs):
+ """Send packets at layer 2
+send(packets, [inter=0], [loop=0], [verbose=conf.verb]) -> None"""
+ if iface is None and iface_hint is not None:
+ iface = conf.route.route(iface_hint)[0]
+ __gen_send(conf.L2socket(iface=iface, *args, **kargs), x, inter=inter, loop=loop, count=count, verbose=verbose)
+
+def sendpfast(x, pps=None, mbps=None, realtime=None, loop=0, iface=None):
+ """Send packets at layer 2 using tcpreplay for performance
+ pps: packets per second
+ mpbs: MBits per second
+ realtime: use packet's timestamp, bending time with realtime value
+ loop: number of times to process the packet list
+ iface: output interface """
+ if iface is None:
+ iface = conf.iface
+ options = ["--intf1=%s" % iface ]
+ if pps is not None:
+ options.append("--pps=%i" % pps)
+ elif mbps is not None:
+ options.append("--mbps=%i" % mbps)
+ elif realtime is not None:
+ options.append("--multiplier=%i" % realtime)
+ else:
+ options.append("--topspeed")
+
+ if loop:
+ options.append("--loop=%i" % loop)
+
+ f = os.tempnam("scapy")
+ options.append(f)
+ wrpcap(f, x)
+ try:
+ try:
+ os.spawnlp(os.P_WAIT, conf.prog.tcpreplay, conf.prog.tcpreplay, *options)
+ except KeyboardInterrupt:
+ log_interactive.info("Interrupted by user")
+ finally:
+ os.unlink(f)
+
+
+
+
+
+def sr(x,filter=None, iface=None, nofilter=0, *args,**kargs):
+ """Send and receive packets at layer 3
+nofilter: put 1 to avoid use of bpf filters
+retry: if positive, how many times to resend unanswered packets
+ if negative, how many times to retry when no more packets are answered
+timeout: how much time to wait after the last packet has been sent
+verbose: set verbosity level
+multi: whether to accept multiple answers for the same stimulus
+filter: provide a BPF filter
+iface: listen answers only on the given interface"""
+ if not kargs.has_key("timeout"):
+ kargs["timeout"] = -1
+ s = conf.L3socket(filter=filter, iface=iface, nofilter=nofilter)
+ a,b,c=sndrcv(s,x,*args,**kargs)
+ s.close()
+ return a,b
+
+def sr1(x,filter=None,iface=None, nofilter=0, *args,**kargs):
+ """Send packets at layer 3 and return only the first answer
+nofilter: put 1 to avoid use of bpf filters
+retry: if positive, how many times to resend unanswered packets
+ if negative, how many times to retry when no more packets are answered
+timeout: how much time to wait after the last packet has been sent
+verbose: set verbosity level
+multi: whether to accept multiple answers for the same stimulus
+filter: provide a BPF filter
+iface: listen answers only on the given interface"""
+ if not kargs.has_key("timeout"):
+ kargs["timeout"] = -1
+ s=conf.L3socket(filter=filter, nofilter=nofilter, iface=iface)
+ a,b,c=sndrcv(s,x,*args,**kargs)
+ s.close()
+ if len(a) > 0:
+ return a[0][1]
+ else:
+ return None
+
+def srp(x,iface=None, iface_hint=None, filter=None, nofilter=0, type=ETH_P_ALL, *args,**kargs):
+ """Send and receive packets at layer 2
+nofilter: put 1 to avoid use of bpf filters
+retry: if positive, how many times to resend unanswered packets
+ if negative, how many times to retry when no more packets are answered
+timeout: how much time to wait after the last packet has been sent
+verbose: set verbosity level
+multi: whether to accept multiple answers for the same stimulus
+filter: provide a BPF filter
+iface: work only on the given interface"""
+ if not kargs.has_key("timeout"):
+ kargs["timeout"] = -1
+ if iface is None and iface_hint is not None:
+ iface = conf.route.route(iface_hint)[0]
+ a,b,c=sndrcv(conf.L2socket(iface=iface, filter=filter, nofilter=nofilter, type=type),x,*args,**kargs)
+ return a,b
+
+def srp1(*args,**kargs):
+ """Send and receive packets at layer 2 and return only the first answer
+nofilter: put 1 to avoid use of bpf filters
+retry: if positive, how many times to resend unanswered packets
+ if negative, how many times to retry when no more packets are answered
+timeout: how much time to wait after the last packet has been sent
+verbose: set verbosity level
+multi: whether to accept multiple answers for the same stimulus
+filter: provide a BPF filter
+iface: work only on the given interface"""
+ if not kargs.has_key("timeout"):
+ kargs["timeout"] = -1
+ a,b=srp(*args,**kargs)
+ if len(a) > 0:
+ return a[0][1]
+ else:
+ return None
+
+def __sr_loop(srfunc, pkts, prn=lambda x:x[1].summary(), prnfail=lambda x:x.summary(), inter=1, timeout=None, count=None, verbose=0, store=1, *args, **kargs):
+ n = 0
+ r = 0
+ ct = conf.color_theme
+ parity = 0
+ ans=[]
+ unans=[]
+ if timeout is None:
+ timeout = min(2*inter, 5)
+ try:
+ while 1:
+ parity ^= 1
+ col = [ct.even,ct.odd][parity]
+ if count is not None:
+ if count == 0:
+ break
+ count -= 1
+ start = time.time()
+ print "\rsend...\r",
+ res = srfunc(pkts, timeout=timeout, verbose=0, chainCC=1, *args, **kargs)
+ n += len(res[0])+len(res[1])
+ r += len(res[0])
+ if prn and len(res[0]) > 0:
+ msg = "RECV %i:" % len(res[0])
+ print "\r"+ct.success(msg),
+ for p in res[0]:
+ print col(prn(p))
+ print " "*len(msg),
+ if prnfail and len(res[1]) > 0:
+ msg = "fail %i:" % len(res[1])
+ print "\r"+ct.fail(msg),
+ for p in res[1]:
+ print col(prnfail(p))
+ print " "*len(msg),
+ if not (prn or prnfail):
+ print "recv:%i fail:%i" % tuple(map(len, res[:2]))
+ if store:
+ ans += res[0]
+ unans += res[1]
+ end=time.time()
+ if end-start < inter:
+ time.sleep(inter+start-end)
+ except KeyboardInterrupt:
+ pass
+
+ if n>0:
+ print "%s\nSent %i packets, received %i packets. %3.1f%% hits." % (Color.normal,n,r,100.0*r/n)
+
+ return SndRcvList(ans),PacketList(unans)
+
+def srloop(pkts, *args, **kargs):
+ """Send a packet at layer 3 in loop and print the answer each time
+srloop(pkts, [prn], [inter], [count], ...) --> None"""
+ return __sr_loop(sr, pkts, *args, **kargs)
+
+def srploop(pkts, *args, **kargs):
+ """Send a packet at layer 2 in loop and print the answer each time
+srloop(pkts, [prn], [inter], [count], ...) --> None"""
+ return __sr_loop(srp, pkts, *args, **kargs)
+
+
+def sndrcvflood(pks, pkt, prn=lambda (s,r):r.summary(), chainCC=0, store=1, unique=0):
+ if not isinstance(pkt, Gen):
+ pkt = SetGen(pkt)
+ tobesent = [p for p in pkt]
+ received = SndRcvList()
+ seen = {}
+
+ hsent={}
+ for i in tobesent:
+ h = i.hashret()
+ if h in hsent:
+ hsent[h].append(i)
+ else:
+ hsent[h] = [i]
+
+ def send_in_loop(tobesent):
+ while 1:
+ for p in tobesent:
+ yield p
+
+ packets_to_send = send_in_loop(tobesent)
+
+ ssock = rsock = pks.fileno()
+
+ try:
+ while 1:
+ readyr,readys,_ = select([rsock],[ssock],[])
+ if ssock in readys:
+ pks.send(packets_to_send.next())
+
+ if rsock in readyr:
+ p = pks.recv(MTU)
+ if p is None:
+ continue
+ h = p.hashret()
+ if h in hsent:
+ hlst = hsent[h]
+ for i in hlst:
+ if p.answers(i):
+ res = prn((i,p))
+ if unique:
+ if res in seen:
+ continue
+ seen[res] = None
+ if res is not None:
+ print res
+ if store:
+ received.append((i,p))
+ except KeyboardInterrupt:
+ if chainCC:
+ raise
+ return received
+
+def srflood(x,filter=None, iface=None, nofilter=None, *args,**kargs):
+ """Flood and receive packets at layer 3
+prn: function applied to packets received. Ret val is printed if not None
+store: if 1 (default), store answers and return them
+unique: only consider packets whose print
+nofilter: put 1 to avoid use of bpf filters
+filter: provide a BPF filter
+iface: listen answers only on the given interface"""
+ s = conf.L3socket(filter=filter, iface=iface, nofilter=nofilter)
+ r=sndrcvflood(s,x,*args,**kargs)
+ s.close()
+ return r
+
+def srpflood(x,filter=None, iface=None, iface_hint=None, nofilter=None, *args,**kargs):
+ """Flood and receive packets at layer 2
+prn: function applied to packets received. Ret val is printed if not None
+store: if 1 (default), store answers and return them
+unique: only consider packets whose print
+nofilter: put 1 to avoid use of bpf filters
+filter: provide a BPF filter
+iface: listen answers only on the given interface"""
+ if iface is None and iface_hint is not None:
+ iface = conf.route.route(iface_hint)[0]
+ s = conf.L2socket(filter=filter, iface=iface, nofilter=nofilter)
+ r=sndrcvflood(s,x,*args,**kargs)
+ s.close()
+ return r
+
+
+## Bluetooth
+
+
+def srbt(peer, pkts, inter=0.1, *args, **kargs):
+ s = conf.BTsocket(peer=peer)
+ a,b,c=sndrcv(s,pkts,inter=inter,*args,**kargs)
+ s.close()
+ return a,b
+
+def srbt1(peer, pkts, *args, **kargs):
+ a,b = srbt(peer, pkts, *args, **kargs)
+ if len(a) > 0:
+ return a[0][1]
+
+
+
+
+
+#############################
+## pcap capture file stuff ##
+#############################
+
+def wrpcap(filename, pkt, *args, **kargs):
+ """Write a list of packets to a pcap file
+gz: set to 1 to save a gzipped capture
+linktype: force linktype value
+endianness: "<" or ">", force endianness"""
+ PcapWriter(filename, *args, **kargs).write(pkt)
+
+def rdpcap(filename, count=-1):
+ """Read a pcap file and return a packet list
+count: read only <count> packets"""
+ return PcapReader(filename).read_all(count=count)
+
+class PcapReader:
+ """A stateful pcap reader
+
+ Based entirely on scapy.rdpcap(), this class allows for packets
+ to be dispatched without having to be loaded into memory all at
+ once
+ """
+
+ def __init__(self, filename):
+ self.filename = filename
+ try:
+ self.f = gzip.open(filename,"rb")
+ magic = self.f.read(4)
+ except IOError:
+ self.f = open(filename,"rb")
+ magic = self.f.read(4)
+ if magic == "\xa1\xb2\xc3\xd4": #big endian
+ self.endian = ">"
+ elif magic == "\xd4\xc3\xb2\xa1": #little endian
+ self.endian = "<"
+ else:
+ raise RuntimeWarning, "Not a pcap capture file (bad magic)"
+ hdr = self.f.read(20)
+ if len(hdr)<20:
+ raise RuntimeWarning, "Invalid pcap file (too short)"
+ vermaj,vermin,tz,sig,snaplen,linktype = struct.unpack(self.endian+"HHIIII",hdr)
+ self.LLcls = LLTypes.get(linktype, Raw)
+ if self.LLcls == Raw:
+ warning("PcapReader: unkonwon LL type [%i]/[%#x]. Using Raw packets" % (linktype,linktype))
+
+ def __iter__(self):
+ return self
+
+ def next(self):
+ """impliment the iterator protocol on a set of packets in a
+ pcap file
+ """
+ pkt = self.read_packet()
+ if pkt == None:
+ raise StopIteration
+ return pkt
+
+
+ def read_packet(self):
+ """return a single packet read from the file
+
+ returns None when no more packets are available
+ """
+ hdr = self.f.read(16)
+ if len(hdr) < 16:
+ return None
+ sec,usec,caplen,olen = struct.unpack(self.endian+"IIII", hdr)
+ s = self.f.read(caplen)
+ try:
+ p = self.LLcls(s)
+ except KeyboardInterrupt:
+ raise
+ except:
+ if conf.debug_dissector:
+ raise
+ p = Raw(s)
+ p.time = sec+0.000001*usec
+ return p
+
+ def dispatch(self, callback):
+ """call the specified callback routine for each packet read
+
+ This is just a convienience function for the main loop
+ that allows for easy launching of packet processing in a
+ thread.
+ """
+ p = self.read_packet()
+ while p != None:
+ callback(p)
+ p = self.read_packet()
+
+ def read_all(self,count=-1):
+ """return a list of all packets in the pcap file
+ """
+ res=[]
+ while count != 0:
+ count -= 1
+ p = self.read_packet()
+ if p is None:
+ break
+ res.append(p)
+ return PacketList(res,name = os.path.basename(self.filename))
+
+ def recv(self, size):
+ """ Emulate a socket
+ """
+ return self.read_packet()
+
+ def fileno(self):
+ return self.f.fileno()
+
+
+
+class PcapWriter:
+ """A pcap writer with more control than wrpcap()
+
+ This routine is based entirely on scapy.wrpcap(), but adds capability
+ of writing one packet at a time in a streaming manner.
+ """
+ def __init__(self, filename, linktype=None, gz=0, endianness=""):
+ self.linktype = linktype
+ self.header_done = 0
+ if gz:
+ self.f = gzip.open(filename,"wb")
+ else:
+ self.f = open(filename,"wb")
+ self.endian = endianness
+
+ def fileno(self):
+ return self.f.fileno()
+
+ def write(self, pkt):
+ """accepts a either a single packet or a list of packets
+ to be written to the dumpfile
+ """
+
+ if self.header_done == 0:
+ if self.linktype == None:
+ if isinstance(pkt,Packet):
+ linktype = LLNumTypes.get(pkt.__class__,1)
+ else:
+ linktype = LLNumTypes.get(pkt[0].__class__,1)
+
+ self.f.write(struct.pack(self.endian+"IHHIIII", 0xa1b2c3d4L,
+ 2, 4, 0, 0, MTU, linktype))
+ self.header_done = 1
+
+ for p in pkt:
+ self._write_packet(p)
+
+ def _write_packet(self, packet):
+ """writes a single packet to the pcap file
+ """
+ s = str(packet)
+ l = len(s)
+ sec = int(packet.time)
+ usec = int((packet.time-sec)*1000000)
+ self.f.write(struct.pack(self.endian+"IIII", sec, usec, l, l))
+ self.f.write(s)
+
+re_extract_hexcap = re.compile("^(0x[0-9a-fA-F]{2,}[ :\t]|(0x)?[0-9a-fA-F]{2,}:|(0x)?[0-9a-fA-F]{3,}[: \t]|) *(([0-9a-fA-F]{2} {,2}){,16})")
+
+def import_hexcap():
+ p = ""
+ try:
+ while 1:
+ l = raw_input().strip()
+ try:
+ p += re_extract_hexcap.match(l).groups()[3]
+ except:
+ warning("Parsing error during hexcap")
+ continue
+ except EOFError:
+ pass
+
+ p = p.replace(" ","")
+ p2=""
+ for i in range(len(p)/2):
+ p2 += chr(int(p[2*i:2*i+2],16))
+ return p2
+
+
+
+def wireshark(pktlist):
+ f = os.tempnam("scapy")
+ wrpcap(f, pktlist)
+ os.spawnlp(os.P_NOWAIT, conf.prog.wireshark, conf.prog.wireshark, "-r", f)
+
+def hexedit(x):
+ x = str(x)
+ f = os.tempnam("scapy")
+ open(f,"w").write(x)
+ os.spawnlp(os.P_WAIT, conf.prog.hexedit, conf.prog.hexedit, f)
+ x = open(f).read()
+ os.unlink(f)
+ return x
+
+
+#####################
+## knowledge bases ##
+#####################
+
+class KnowledgeBase:
+ def __init__(self, filename):
+ self.filename = filename
+ self.base = None
+
+ def lazy_init(self):
+ self.base = ""
+
+ def reload(self, filename = None):
+ if filename is not None:
+ self.filename = filename
+ oldbase = self.base
+ self.base = None
+ self.lazy_init()
+ if self.base is None:
+ self.base = oldbase
+
+ def get_base(self):
+ if self.base is None:
+ self.lazy_init()
+ return self.base
+
+
+
+##########################
+## IP location database ##
+##########################
+
+class IPCountryKnowledgeBase(KnowledgeBase):
+ """
+How to generate the base :
+db = []
+for l in open("GeoIPCountryWhois.csv").readlines():
+ s,e,c = l.split(",")[2:5]
+ db.append((int(s[1:-1]),int(e[1:-1]),c[1:-1]))
+cPickle.dump(gzip.open("xxx","w"),db)
+"""
+ def lazy_init(self):
+ self.base = load_object(self.filename)
+
+
+class CountryLocKnowledgeBase(KnowledgeBase):
+ def lazy_init(self):
+ f=open(self.filename)
+ self.base = {}
+ while 1:
+ l = f.readline()
+ if not l:
+ break
+ l = l.strip().split(",")
+ if len(l) != 3:
+ continue
+ c,lat,long = l
+
+ self.base[c] = (float(long),float(lat))
+ f.close()
+
+
+
+
+def locate_ip(ip):
+ ip=map(int,ip.split("."))
+ ip = ip[3]+(ip[2]<<8L)+(ip[1]<<16L)+(ip[0]<<24L)
+
+ cloc = country_loc_kdb.get_base()
+ db = IP_country_kdb.get_base()
+
+ d=0
+ f=len(db)-1
+ while (f-d) > 1:
+ guess = (d+f)/2
+ if ip > db[guess][0]:
+ d = guess
+ else:
+ f = guess
+ s,e,c = db[guess]
+ if s <= ip and ip <= e:
+ return cloc.get(c,None)
+
+
+
+
+###############
+## p0f stuff ##
+###############
+
+# File format (according to p0f.fp) :
+#
+# wwww:ttt:D:ss:OOO...:QQ:OS:Details
+#
+# wwww - window size
+# ttt - initial TTL
+# D - don't fragment bit (0=unset, 1=set)
+# ss - overall SYN packet size
+# OOO - option value and order specification
+# QQ - quirks list
+# OS - OS genre
+# details - OS description
+
+
+
+class p0fKnowledgeBase(KnowledgeBase):
+ def __init__(self, filename):
+ KnowledgeBase.__init__(self, filename)
+ #self.ttl_range=[255]
+ def lazy_init(self):
+ try:
+ f=open(self.filename)
+ except IOError:
+ warning("Can't open base %s" % self.filename)
+ return
+ try:
+ self.base = []
+ for l in f:
+ if l[0] in ["#","\n"]:
+ continue
+ l = tuple(l.split(":"))
+ if len(l) < 8:
+ continue
+ li = map(int,l[1:4])
+ #if li[0] not in self.ttl_range:
+ # self.ttl_range.append(li[0])
+ # self.ttl_range.sort()
+ self.base.append((l[0], li[0], li[1], li[2], l[4], l[5], l[6], l[7][:-1]))
+ except:
+ warning("Can't parse p0f database (new p0f version ?)")
+ self.base = None
+ f.close()
+
+
+def packet2p0f(pkt):
+ while pkt.haslayer(IP) and pkt.haslayer(TCP):
+ pkt = pkt.getlayer(IP)
+ if isinstance(pkt.payload, TCP):
+ break
+ pkt = pkt.payload
+
+ if not isinstance(pkt, IP) or not isinstance(pkt.payload, TCP):
+ raise TypeError("Not a TCP/IP packet")
+ if pkt.payload.flags & 0x13 != 0x02: #S,!A,!F
+ raise TypeError("Not a syn packet")
+
+ #t = p0f_kdb.ttl_range[:]
+ #t += [pkt.ttl]
+ #t.sort()
+ #ttl=t[t.index(pkt.ttl)+1]
+ ttl = pkt.ttl
+
+ df = (pkt.flags & 2) / 2
+ ss = len(pkt)
+ # from p0f/config.h : PACKET_BIG = 100
+ if ss > 100:
+ ss = 0
+
+ ooo = ""
+ mss = -1
+ qqT = False
+ qqP = False
+ #qqBroken = False
+ ilen = (pkt[TCP].dataofs << 2) - 20 # from p0f.c
+ for option in pkt.payload.options:
+ ilen -= 1
+ if option[0] == "MSS":
+ ooo += "M" + str(option[1]) + ","
+ mss = option[1]
+ # FIXME: qqBroken
+ ilen -= 3
+ elif option[0] == "WScale":
+ ooo += "W" + str(option[1]) + ","
+ # FIXME: qqBroken
+ ilen -= 2
+ elif option[0] == "Timestamp":
+ if option[1][0] == 0:
+ ooo += "T0,"
+ else:
+ ooo += "T,"
+ if option[1][1] != 0:
+ qqT = True
+ ilen -= 9
+ elif option[0] == "SAckOK":
+ ooo += "S,"
+ ilen -= 1
+ elif option[0] == "NOP":
+ ooo += "N,"
+ elif option[0] == "EOL":
+ ooo += "E,"
+ if ilen > 0:
+ qqP = True
+ else:
+ ooo += "?,"
+ # FIXME: ilen
+ ooo = ooo[:-1]
+ if ooo == "": ooo = "."
+
+ win = pkt.payload.window
+ if mss != -1:
+ if win % mss == 0:
+ win = "S" + str(win/mss)
+ elif win % (mss + 40) == 0:
+ win = "T" + str(win/(mss+40))
+ win = str(win)
+
+ qq = ""
+
+ if qqP:
+ qq += "P"
+ if pkt[IP].id == 0:
+ qq += "Z"
+ if pkt[IP].options != '':
+ qq += "I"
+ if pkt[TCP].urgptr != 0:
+ qq += "U"
+ if pkt[TCP].reserved != 0:
+ qq += "X"
+ if pkt[TCP].ack != 0:
+ qq += "A"
+ if qqT:
+ qq += "T"
+ if pkt[TCP].flags & 40 != 0:
+ # U or P
+ qq += "F"
+ if not isinstance(pkt[TCP].payload, NoPayload):
+ qq += "D"
+ # FIXME : "!" - broken options segment
+
+ if qq == "":
+ qq = "."
+
+ return (win,
+ ttl,
+ df,
+ ss,
+ ooo,
+ qq)
+
+def p0f_correl(x,y):
+ d = 0
+ # wwww can be "*" or "%nn"
+ d += (x[0] == y[0] or y[0] == "*" or (y[0][0] == "%" and x[0].isdigit() and (int(x[0]) % int(y[0][1:])) == 0))
+ # ttl
+ d += (y[1] >= x[1] and y[1] - x[1] < 32)
+ for i in [2, 3, 5]:
+ d += (x[i] == y[i])
+ xopt = x[4].split(",")
+ yopt = y[4].split(",")
+ if len(xopt) == len(yopt):
+ same = True
+ for i in range(len(xopt)):
+ if not (xopt[i] == yopt[i] or
+ (len(yopt[i]) == 2 and len(xopt[i]) > 1 and
+ yopt[i][1] == "*" and xopt[i][0] == yopt[i][0]) or
+ (len(yopt[i]) > 2 and len(xopt[i]) > 1 and
+ yopt[i][1] == "%" and xopt[i][0] == yopt[i][0] and
+ int(xopt[i][1:]) % int(yopt[i][2:]) == 0)):
+ same = False
+ break
+ if same:
+ d += len(xopt)
+ return d
+
+
+def p0f(pkt):
+ """Passive OS fingerprinting: which OS emitted this TCP SYN ?
+p0f(packet) -> accuracy, [list of guesses]
+"""
+ pb = p0f_kdb.get_base()
+ if not pb:
+ warning("p0f base empty.")
+ return []
+ s = len(pb[0][0])
+ r = []
+ sig = packet2p0f(pkt)
+ max = len(sig[4].split(",")) + 5
+ for b in pb:
+ d = p0f_correl(sig,b)
+ if d == max:
+ r.append((b[6], b[7], b[1] - pkt[IP].ttl))
+ return r
+
+
+def prnp0f(pkt):
+ try:
+ r = p0f(pkt)
+ except:
+ return
+ if r == []:
+ r = ("UNKNOWN", "[" + ":".join(map(str, packet2p0f(pkt))) + ":?:?]", None)
+ else:
+ r = r[0]
+ uptime = None
+ try:
+ uptime = pkt2uptime(pkt)
+ except:
+ pass
+ if uptime == 0:
+ uptime = None
+ res = pkt.sprintf("%IP.src%:%TCP.sport% - " + r[0] + " " + r[1])
+ if uptime is not None:
+ res += pkt.sprintf(" (up: " + str(uptime/3600) + " hrs)\n -> %IP.dst%:%TCP.dport%")
+ else:
+ res += pkt.sprintf("\n -> %IP.dst%:%TCP.dport%")
+ if r[2] is not None:
+ res += " (distance " + str(r[2]) + ")"
+ print res
+
+
+def pkt2uptime(pkt, HZ=100):
+ """Calculate the date the machine which emitted the packet booted using TCP timestamp
+pkt2uptime(pkt, [HZ=100])"""
+ if not isinstance(pkt, Packet):
+ raise TypeError("Not a TCP packet")
+ if isinstance(pkt,NoPayload):
+ raise TypeError("Not a TCP packet")
+ if not isinstance(pkt, TCP):
+ return pkt2uptime(pkt.payload)
+ for opt in pkt.options:
+ if opt[0] == "Timestamp":
+ #t = pkt.time - opt[1][0] * 1.0/HZ
+ #return time.ctime(t)
+ t = opt[1][0] / HZ
+ return t
+ raise TypeError("No timestamp option")
+
+
+
+#################
+## Queso stuff ##
+#################
+
+
+def quesoTCPflags(flags):
+ if flags == "-":
+ return "-"
+ flv = "FSRPAUXY"
+ v = 0
+ for i in flags:
+ v |= 2**flv.index(i)
+ return "%x" % v
+
+class QuesoKnowledgeBase(KnowledgeBase):
+ def lazy_init(self):
+ try:
+ f = open(self.filename)
+ except IOError:
+ return
+ self.base = {}
+ p = None
+ try:
+ for l in f:
+ l = l.strip()
+ if not l or l[0] == ';':
+ continue
+ if l[0] == '*':
+ if p is not None:
+ p[""] = name
+ name = l[1:].strip()
+ p = self.base
+ continue
+ if l[0] not in list("0123456"):
+ continue
+ res = l[2:].split()
+ res[-1] = quesoTCPflags(res[-1])
+ res = " ".join(res)
+ if not p.has_key(res):
+ p[res] = {}
+ p = p[res]
+ if p is not None:
+ p[""] = name
+ except:
+ self.base = None
+ warning("Can't load queso base [%s]", self.filename)
+ f.close()
+
+
+
+
+def queso_sig(target, dport=80, timeout=3):
+ p = queso_kdb.get_base()
+ ret = []
+ for flags in ["S", "SA", "F", "FA", "SF", "P", "SEC"]:
+ ans, unans = sr(IP(dst=target)/TCP(dport=dport,flags=flags,seq=RandInt()),
+ timeout=timeout, verbose=0)
+ if len(ans) == 0:
+ rs = "- - - -"
+ else:
+ s,r = ans[0]
+ rs = "%i" % (r.seq != 0)
+ if not r.ack:
+ r += " 0"
+ elif r.ack-s.seq > 666:
+ rs += " R" % 0
+ else:
+ rs += " +%i" % (r.ack-s.seq)
+ rs += " %X" % r.window
+ rs += " %x" % r.payload.flags
+ ret.append(rs)
+ return ret
+
+def queso_search(sig):
+ p = queso_kdb.get_base()
+ sig.reverse()
+ ret = []
+ try:
+ while sig:
+ s = sig.pop()
+ p = p[s]
+ if p.has_key(""):
+ ret.append(p[""])
+ except KeyError:
+ pass
+ return ret
+
+
+def queso(*args,**kargs):
+ """Queso OS fingerprinting
+queso(target, dport=80, timeout=3)"""
+ return queso_search(queso_sig(*args, **kargs))
+
+
+
+######################
+## nmap OS fp stuff ##
+######################
+
+
+class NmapKnowledgeBase(KnowledgeBase):
+ def lazy_init(self):
+ try:
+ f=open(self.filename)
+ except IOError:
+ return
+
+ self.base = []
+ name = None
+ try:
+ for l in f:
+ l = l.strip()
+ if not l or l[0] == "#":
+ continue
+ if l[:12] == "Fingerprint ":
+ if name is not None:
+ self.base.append((name,sig))
+ name = l[12:].strip()
+ sig={}
+ p = self.base
+ continue
+ elif l[:6] == "Class ":
+ continue
+ op = l.find("(")
+ cl = l.find(")")
+ if op < 0 or cl < 0:
+ warning("error reading nmap os fp base file")
+ continue
+ test = l[:op]
+ s = map(lambda x: x.split("="), l[op+1:cl].split("%"))
+ si = {}
+ for n,v in s:
+ si[n] = v
+ sig[test]=si
+ if name is not None:
+ self.base.append((name,sig))
+ except:
+ self.base = None
+ warning("Can't read nmap database [%s](new nmap version ?)" % self.filename)
+ f.close()
+
+def TCPflags2str(f):
+ fl="FSRPAUEC"
+ s=""
+ for i in range(len(fl)):
+ if f & 1:
+ s = fl[i]+s
+ f >>= 1
+ return s
+
+def nmap_tcppacket_sig(pkt):
+ r = {}
+ if pkt is not None:
+# r["Resp"] = "Y"
+ r["DF"] = (pkt.flags & 2) and "Y" or "N"
+ r["W"] = "%X" % pkt.window
+ r["ACK"] = pkt.ack==2 and "S++" or pkt.ack==1 and "S" or "O"
+ r["Flags"] = TCPflags2str(pkt.payload.flags)
+ r["Ops"] = "".join(map(lambda x: x[0][0],pkt.payload.options))
+ else:
+ r["Resp"] = "N"
+ return r
+
+
+def nmap_udppacket_sig(S,T):
+ r={}
+ if T is None:
+ r["Resp"] = "N"
+ else:
+ r["DF"] = (T.flags & 2) and "Y" or "N"
+ r["TOS"] = "%X" % T.tos
+ r["IPLEN"] = "%X" % T.len
+ r["RIPTL"] = "%X" % T.payload.payload.len
+ r["RID"] = S.id == T.payload.payload.id and "E" or "F"
+ r["RIPCK"] = S.chksum == T.getlayer(IPerror).chksum and "E" or T.getlayer(IPerror).chksum == 0 and "0" or "F"
+ r["UCK"] = S.payload.chksum == T.getlayer(UDPerror).chksum and "E" or T.getlayer(UDPerror).chksum ==0 and "0" or "F"
+ r["ULEN"] = "%X" % T.getlayer(UDPerror).len
+ r["DAT"] = T.getlayer(Raw) is None and "E" or S.getlayer(Raw).load == T.getlayer(Raw).load and "E" or "F"
+ return r
+
+
+
+def nmap_match_one_sig(seen, ref):
+ c = 0
+ for k in seen.keys():
+ if ref.has_key(k):
+ if seen[k] in ref[k].split("|"):
+ c += 1
+ if c == 0 and seen.get("Resp") == "N":
+ return 0.7
+ else:
+ return 1.0*c/len(seen.keys())
+
+
+
+def nmap_sig(target, oport=80, cport=81, ucport=1):
+ res = {}
+
+ tcpopt = [ ("WScale", 10),
+ ("NOP",None),
+ ("MSS", 256),
+ ("Timestamp",(123,0)) ]
+ tests = [ IP(dst=target, id=1)/TCP(seq=1, sport=5001, dport=oport, options=tcpopt, flags="CS"),
+ IP(dst=target, id=1)/TCP(seq=1, sport=5002, dport=oport, options=tcpopt, flags=0),
+ IP(dst=target, id=1)/TCP(seq=1, sport=5003, dport=oport, options=tcpopt, flags="SFUP"),
+ IP(dst=target, id=1)/TCP(seq=1, sport=5004, dport=oport, options=tcpopt, flags="A"),
+ IP(dst=target, id=1)/TCP(seq=1, sport=5005, dport=cport, options=tcpopt, flags="S"),
+ IP(dst=target, id=1)/TCP(seq=1, sport=5006, dport=cport, options=tcpopt, flags="A"),
+ IP(dst=target, id=1)/TCP(seq=1, sport=5007, dport=cport, options=tcpopt, flags="FPU"),
+ IP(str(IP(dst=target)/UDP(sport=5008,dport=ucport)/(300*"i"))) ]
+
+ ans, unans = sr(tests, timeout=2)
+ ans += map(lambda x: (x,None), unans)
+
+ for S,T in ans:
+ if S.sport == 5008:
+ res["PU"] = nmap_udppacket_sig(S,T)
+ else:
+ t = "T%i" % (S.sport-5000)
+ if T is not None and T.haslayer(ICMP):
+ warning("Test %s answered by an ICMP" % t)
+ T=None
+ res[t] = nmap_tcppacket_sig(T)
+
+ return res
+
+def nmap_probes2sig(tests):
+ tests=tests.copy()
+ res = {}
+ if "PU" in tests:
+ res["PU"] = nmap_udppacket_sig(*tests["PU"])
+ del(tests["PU"])
+ for k in tests:
+ res[k] = nmap_tcppacket_sig(tests[k])
+ return res
+
+
+def nmap_search(sigs):
+ guess = 0,[]
+ for os,fp in nmap_kdb.get_base():
+ c = 0.0
+ for t in sigs.keys():
+ if t in fp:
+ c += nmap_match_one_sig(sigs[t], fp[t])
+ c /= len(sigs.keys())
+ if c > guess[0]:
+ guess = c,[ os ]
+ elif c == guess[0]:
+ guess[1].append(os)
+ return guess
+
+
+def nmap_fp(target, oport=80, cport=81):
+ """nmap fingerprinting
+nmap_fp(target, [oport=80,] [cport=81,]) -> list of best guesses with accuracy
+"""
+ sigs = nmap_sig(target, oport, cport)
+ return nmap_search(sigs)
+
+
+def nmap_sig2txt(sig):
+ torder = ["TSeq","T1","T2","T3","T4","T5","T6","T7","PU"]
+ korder = ["Class", "gcd", "SI", "IPID", "TS",
+ "Resp", "DF", "W", "ACK", "Flags", "Ops",
+ "TOS", "IPLEN", "RIPTL", "RID", "RIPCK", "UCK", "ULEN", "DAT" ]
+ txt=[]
+ for i in sig.keys():
+ if i not in torder:
+ torder.append(i)
+ for t in torder:
+ sl = sig.get(t)
+ if sl is None:
+ continue
+ s = []
+ for k in korder:
+ v = sl.get(k)
+ if v is None:
+ continue
+ s.append("%s=%s"%(k,v))
+ txt.append("%s(%s)" % (t, "%".join(s)))
+ return "\n".join(txt)
+
+
+
+
+
+###################
+## User commands ##
+###################
+
+
+def sniff(count=0, store=1, offline=None, prn = None, lfilter=None, L2socket=None, timeout=None, *arg, **karg):
+ """Sniff packets
+sniff([count=0,] [prn=None,] [store=1,] [offline=None,] [lfilter=None,] + L2ListenSocket args) -> list of packets
+
+ count: number of packets to capture. 0 means infinity
+ store: wether to store sniffed packets or discard them
+ prn: function to apply to each packet. If something is returned,
+ it is displayed. Ex:
+ ex: prn = lambda x: x.summary()
+lfilter: python function applied to each packet to determine
+ if further action may be done
+ ex: lfilter = lambda x: x.haslayer(Padding)
+offline: pcap file to read packets from, instead of sniffing them
+timeout: stop sniffing after a given time (default: None)
+L2socket: use the provided L2socket
+ """
+ c = 0
+
+ if offline is None:
+ if L2socket is None:
+ L2socket = conf.L2listen
+ s = L2socket(type=ETH_P_ALL, *arg, **karg)
+ else:
+ s = PcapReader(offline)
+
+ lst = []
+ if timeout is not None:
+ stoptime = time.time()+timeout
+ remain = None
+ while 1:
+ try:
+ if timeout is not None:
+ remain = stoptime-time.time()
+ if remain <= 0:
+ break
+ sel = select([s],[],[],remain)
+ if s in sel[0]:
+ p = s.recv(MTU)
+ if p is None:
+ break
+ if lfilter and not lfilter(p):
+ continue
+ if store:
+ lst.append(p)
+ c += 1
+ if prn:
+ r = prn(p)
+ if r is not None:
+ print r
+ if count > 0 and c >= count:
+ break
+ except KeyboardInterrupt:
+ break
+ return PacketList(lst,"Sniffed")
+
+
+
+def arpcachepoison(target, victim, interval=60):
+ """Poison target's cache with (your MAC,victim's IP) couple
+arpcachepoison(target, victim, [interval=60]) -> None
+"""
+ tmac = getmacbyip(target)
+ p = Ether(dst=tmac)/ARP(op="who-has", psrc=victim, pdst=target)
+ try:
+ while 1:
+ sendp(p, iface_hint=target)
+ if conf.verb > 1:
+ os.write(1,".")
+ time.sleep(interval)
+ except KeyboardInterrupt:
+ pass
+
+def traceroute(target, dport=80, minttl=1, maxttl=30, sport=RandShort(), l4 = None, filter=None, timeout=2, verbose=None, **kargs):
+ """Instant TCP traceroute
+traceroute(target, [maxttl=30,] [dport=80,] [sport=80,] [verbose=conf.verb]) -> None
+"""
+ if verbose is None:
+ verbose = conf.verb
+ if filter is None:
+ filter="(icmp and icmp[0]=11) or (tcp and (tcp[13] & 0x16 > 0x10))"
+ if l4 is None:
+ a,b = sr(IP(dst=target, id=RandShort(), ttl=(minttl,maxttl))/TCP(seq=RandInt(),sport=sport, dport=dport),
+ timeout=timeout, filter=filter, verbose=verbose, **kargs)
+ else:
+ a,b = sr(IP(dst=target, id=RandShort(), ttl=(minttl,maxttl))/l4,
+ verbose=verbose, timeout=timeout, **kargs)
+
+ a = TracerouteResult(a.res)
+ if verbose:
+ a.show()
+ return a,b
+
+
+
+
+def arping(net, timeout=2, cache=0, verbose=None, **kargs):
+ """Send ARP who-has requests to determine which hosts are up
+arping(net, [cache=0,] [iface=conf.iface,] [verbose=conf.verb]) -> None
+Set cache=True if you want arping to modify internal ARP-Cache"""
+ if verbose is None:
+ verbose = conf.verb
+ ans,unans = srp(Ether(dst="ff:ff:ff:ff:ff:ff")/ARP(pdst=net), verbose=verbose,
+ filter="arp and arp[7] = 2", timeout=timeout, iface_hint=net, **kargs)
+ ans = ARPingResult(ans.res)
+
+ if cache and ans is not None:
+ for pair in ans:
+ arp_cache[pair[1].psrc] = (pair[1].hwsrc, time.time())
+ if verbose:
+ ans.show()
+ return ans,unans
+
+def dyndns_add(nameserver, name, rdata, type="A", ttl=10):
+ """Send a DNS add message to a nameserver for "name" to have a new "rdata"
+dyndns_add(nameserver, name, rdata, type="A", ttl=10) -> result code (0=ok)
+
+example: dyndns_add("ns1.toto.com", "dyn.toto.com", "127.0.0.1")
+RFC2136
+"""
+ zone = name[name.find(".")+1:]
+ r=sr1(IP(dst=nameserver)/UDP()/DNS(opcode=5,
+ qd=[DNSQR(qname=zone, qtype="SOA")],
+ ns=[DNSRR(rrname=name, type="A",
+ ttl=ttl, rdata=rdata)]),
+ verbose=0, timeout=5)
+ if r and r.haslayer(DNS):
+ return r.getlayer(DNS).rcode
+ else:
+ return -1
+
+
+
+
+def dyndns_del(nameserver, name, type="ALL", ttl=10):
+ """Send a DNS delete message to a nameserver for "name"
+dyndns_del(nameserver, name, type="ANY", ttl=10) -> result code (0=ok)
+
+example: dyndns_del("ns1.toto.com", "dyn.toto.com")
+RFC2136
+"""
+ zone = name[name.find(".")+1:]
+ r=sr1(IP(dst=nameserver)/UDP()/DNS(opcode=5,
+ qd=[DNSQR(qname=zone, qtype="SOA")],
+ ns=[DNSRR(rrname=name, type=type,
+ rclass="ANY", ttl=0, rdata="")]),
+ verbose=0, timeout=5)
+ if r and r.haslayer(DNS):
+ return r.getlayer(DNS).rcode
+ else:
+ return -1
+
+
+def is_promisc(ip, fake_bcast="ff:ff:00:00:00:00",**kargs):
+ """Try to guess if target is in Promisc mode. The target is provided by its ip."""
+
+ responses = srp1(Ether(dst=fake_bcast) / ARP(op="who-has", pdst=ip),type=ETH_P_ARP, iface_hint=ip, timeout=1, verbose=0,**kargs)
+
+ return responses is not None
+
+def promiscping(net, timeout=2, fake_bcast="ff:ff:ff:ff:ff:fe", **kargs):
+ """Send ARP who-has requests to determine which hosts are in promiscuous mode
+ promiscping(net, iface=conf.iface)"""
+ ans,unans = srp(Ether(dst=fake_bcast)/ARP(pdst=net),
+ filter="arp and arp[7] = 2", timeout=timeout, iface_hint=net, **kargs)
+ ans = ARPingResult(ans.res, name="PROMISCPing")
+
+ ans.display()
+ return ans,unans
+
+def ikescan(ip):
+ return sr(IP(dst=ip)/UDP()/ISAKMP(init_cookie=RandString(8),
+ exch_type=2)/ISAKMP_payload_SA(prop=ISAKMP_payload_Proposal()))
+
+
+def dhcp_request(iface=None,**kargs):
+ if conf.checkIPaddr != 0:
+ warning("conf.checkIPaddr is not 0, I may not be able to match the answer")
+ if iface is None:
+ iface = conf.iface
+ fam,hw = get_if_raw_hwaddr(iface)
+ return srp1(Ether(dst="ff:ff:ff:ff:ff:ff")/IP(src="0.0.0.0",dst="255.255.255.255")/UDP(sport=68,dport=67)
+ /BOOTP(chaddr=hw)/DHCP(options=[("message-type","discover"),"end"]),iface=iface,**kargs)
+
+def snmpwalk(dst, oid="1", community="public"):
+ try:
+ while 1:
+ r = sr1(IP(dst=dst)/UDP(sport=RandShort())/SNMP(community=community, PDU=SNMPnext(varbindlist=[SNMPvarbind(oid=oid)])),timeout=2, chainCC=1, verbose=0, retry=2)
+ if ICMP in r:
+ print repr(r)
+ break
+ if r is None:
+ print "No answers"
+ break
+ print "%-40s: %r" % (r[SNMPvarbind].oid.val,r[SNMPvarbind].value)
+ oid = r[SNMPvarbind].oid
+
+ except KeyboardInterrupt:
+ pass
+
+
+#####################
+## Reporting stuff ##
+#####################
+
+def report_ports(target, ports):
+ """portscan a target and output a LaTeX table
+report_ports(target, ports) -> string"""
+ ans,unans = sr(IP(dst=target)/TCP(dport=ports),timeout=5)
+ rep = "\\begin{tabular}{|r|l|l|}\n\\hline\n"
+ for s,r in ans:
+ if not r.haslayer(ICMP):
+ if r.payload.flags == 0x12:
+ rep += r.sprintf("%TCP.sport% & open & SA \\\\\n")
+ rep += "\\hline\n"
+ for s,r in ans:
+ if r.haslayer(ICMP):
+ rep += r.sprintf("%TCPerror.dport% & closed & ICMP type %ICMP.type%/%ICMP.code% from %IP.src% \\\\\n")
+ elif r.payload.flags != 0x12:
+ rep += r.sprintf("%TCP.sport% & closed & TCP %TCP.flags% \\\\\n")
+ rep += "\\hline\n"
+ for i in unans:
+ rep += i.sprintf("%TCP.dport% & ? & unanswered \\\\\n")
+ rep += "\\hline\n\\end{tabular}\n"
+ return rep
+
+
+def __make_table(yfmtfunc, fmtfunc, endline, list, fxyz, sortx=None, sorty=None, seplinefunc=None):
+ vx = {}
+ vy = {}
+ vz = {}
+ vxf = {}
+ vyf = {}
+ l = 0
+ for e in list:
+ xx,yy,zz = map(str, fxyz(e))
+ l = max(len(yy),l)
+ vx[xx] = max(vx.get(xx,0), len(xx), len(zz))
+ vy[yy] = None
+ vz[(xx,yy)] = zz
+
+ vxk = vx.keys()
+ vyk = vy.keys()
+ if sortx:
+ vxk.sort(sortx)
+ else:
+ try:
+ vxk.sort(lambda x,y:int(x)-int(y))
+ except:
+ try:
+ vxk.sort(lambda x,y: cmp(atol(x),atol(y)))
+ except:
+ vxk.sort()
+ if sorty:
+ vyk.sort(sorty)
+ else:
+ try:
+ vyk.sort(lambda x,y:int(x)-int(y))
+ except:
+ try:
+ vyk.sort(lambda x,y: cmp(atol(x),atol(y)))
+ except:
+ vyk.sort()
+
+
+ if seplinefunc:
+ sepline = seplinefunc(l, map(lambda x:vx[x],vxk))
+ print sepline
+
+ fmt = yfmtfunc(l)
+ print fmt % "",
+ for x in vxk:
+ vxf[x] = fmtfunc(vx[x])
+ print vxf[x] % x,
+ print endline
+ if seplinefunc:
+ print sepline
+ for y in vyk:
+ print fmt % y,
+ for x in vxk:
+ print vxf[x] % vz.get((x,y), "-"),
+ print endline
+ if seplinefunc:
+ print sepline
+
+def make_table(*args, **kargs):
+ __make_table(lambda l:"%%-%is" % l, lambda l:"%%-%is" % l, "", *args, **kargs)
+
+def make_lined_table(*args, **kargs):
+ __make_table(lambda l:"%%-%is |" % l, lambda l:"%%-%is |" % l, "",
+ seplinefunc=lambda a,x:"+".join(map(lambda y:"-"*(y+2), [a-1]+x+[-2])),
+ *args, **kargs)
+
+def make_tex_table(*args, **kargs):
+ __make_table(lambda l: "%s", lambda l: "& %s", "\\\\", seplinefunc=lambda a,x:"\\hline", *args, **kargs)
+
+
+######################
+## Online doc stuff ##
+######################
+
+
+def lsc(cmd=None):
+ """List user commands"""
+ if cmd is None:
+ for c in user_commands:
+ doc = "No doc. available"
+ if c.__doc__:
+ doc = c.__doc__.split("\n")[0]
+
+ print "%-16s : %s" % (c.__name__, doc)
+ else:
+ print cmd.__doc__
+
+def ls(obj=None):
+ """List available layers, or infos on a given layer"""
+ if obj is None:
+ import __builtin__
+ all = __builtin__.__dict__.copy()
+ all.update(globals())
+ objlst = filter(lambda (n,o): isinstance(o,type) and issubclass(o,Packet), all.items())
+ objlst.sort(lambda x,y:cmp(x[0],y[0]))
+ for n,o in objlst:
+ print "%-10s : %s" %(n,o.name)
+ else:
+ if isinstance(obj, type) and issubclass(obj, Packet):
+ for f in obj.fields_desc:
+ print "%-10s : %-20s = (%s)" % (f.name, f.__class__.__name__, repr(f.default))
+ elif isinstance(obj, Packet):
+ for f in obj.fields_desc:
+ print "%-10s : %-20s = %-15s (%s)" % (f.name, f.__class__.__name__, repr(getattr(obj,f.name)), repr(f.default))
+ if not isinstance(obj.payload, NoPayload):
+ print "--"
+ ls(obj.payload)
+
+
+ else:
+ print "Not a packet class. Type 'ls()' to list packet classes."
+
+
+
+
+
+user_commands = [ sr, sr1, srp, srp1, srloop, srploop, sniff, p0f, arpcachepoison, send, sendp, traceroute, arping, ls, lsc, queso, nmap_fp, report_ports, dyndns_add, dyndns_del, is_promisc, promiscping ]
+
+
+##############
+## Automata ##
+##############
+
+class ATMT:
+ STATE = "State"
+ ACTION = "Action"
+ CONDITION = "Condition"
+ RECV = "Receive condition"
+ TIMEOUT = "Timeout condition"
+
+ class NewStateRequested(Exception):
+ def __init__(self, state_func, automaton, *args, **kargs):
+ self.func = state_func
+ self.state = state_func.atmt_state
+ self.initial = state_func.atmt_initial
+ self.error = state_func.atmt_error
+ self.final = state_func.atmt_final
+ Exception.__init__(self, "Request state [%s]" % self.state)
+ self.automaton = automaton
+ self.args = args
+ self.kargs = kargs
+ self.action_parameters() # init action parameters
+ def action_parameters(self, *args, **kargs):
+ self.action_args = args
+ self.action_kargs = kargs
+ return self
+ def run(self):
+ return self.func(self.automaton, *self.args, **self.kargs)
+
+ @staticmethod
+ def state(initial=0,final=0,error=0):
+ def deco(f,initial=initial, final=final):
+ f.atmt_type = ATMT.STATE
+ f.atmt_state = f.func_name
+ f.atmt_initial = initial
+ f.atmt_final = final
+ f.atmt_error = error
+ def state_wrapper(self, *args, **kargs):
+ return ATMT.NewStateRequested(f, self, *args, **kargs)
+
+ state_wrapper.func_name = "%s_wrapper" % f.func_name
+ state_wrapper.atmt_type = ATMT.STATE
+ state_wrapper.atmt_state = f.func_name
+ state_wrapper.atmt_initial = initial
+ state_wrapper.atmt_final = final
+ state_wrapper.atmt_error = error
+ state_wrapper.atmt_origfunc = f
+ return state_wrapper
+ return deco
+ @staticmethod
+ def action(cond, prio=0):
+ def deco(f,cond=cond):
+ if not hasattr(f,"atmt_type"):
+ f.atmt_cond = {}
+ f.atmt_type = ATMT.ACTION
+ f.atmt_cond[cond.atmt_condname] = prio
+ return f
+ return deco
+ @staticmethod
+ def condition(state, prio=0):
+ def deco(f, state=state):
+ f.atmt_type = ATMT.CONDITION
+ f.atmt_state = state.atmt_state
+ f.atmt_condname = f.func_name
+ f.atmt_prio = prio
+ return f
+ return deco
+ @staticmethod
+ def receive_condition(state, prio=0):
+ def deco(f, state=state):
+ f.atmt_type = ATMT.RECV
+ f.atmt_state = state.atmt_state
+ f.atmt_condname = f.func_name
+ f.atmt_prio = prio
+ return f
+ return deco
+ @staticmethod
+ def timeout(state, timeout, name=None):
+ def deco(f, state=state, timeout=timeout,name=name):
+ f.atmt_type = ATMT.TIMEOUT
+ f.atmt_state = state.atmt_state
+ f.atmt_timeout = timeout
+ f.atmt_condname = f.func_name
+ return f
+ return deco
+
+
+class Automaton_metaclass(type):
+ def __new__(cls, name, bases, dct):
+ cls = super(Automaton_metaclass, cls).__new__(cls, name, bases, dct)
+ cls.states={}
+ cls.state = None
+ cls.recv_conditions={}
+ cls.conditions={}
+ cls.timeout={}
+ cls.actions={}
+ cls.initial_states=[]
+
+ members = {}
+ classes = [cls]
+ while classes:
+ c = classes.pop(0) # order is important to avoid breaking method overloading
+ classes += list(c.__bases__)
+ for k,v in c.__dict__.iteritems():
+ if k not in members:
+ members[k] = v
+
+ decorated = [v for v in members.itervalues()
+ if type(v) is types.FunctionType and hasattr(v, "atmt_type")]
+
+ for m in decorated:
+ if m.atmt_type == ATMT.STATE:
+ s = m.atmt_state
+ cls.states[s] = m
+ cls.recv_conditions[s]=[]
+ cls.conditions[s]=[]
+ cls.timeout[s]=[]
+ if m.atmt_initial:
+ cls.initial_states.append(m)
+ elif m.atmt_type in [ATMT.CONDITION, ATMT.RECV, ATMT.TIMEOUT]:
+ cls.actions[m.atmt_condname] = []
+
+ for m in decorated:
+ if m.atmt_type == ATMT.CONDITION:
+ cls.conditions[m.atmt_state].append(m)
+ elif m.atmt_type == ATMT.RECV:
+ cls.recv_conditions[m.atmt_state].append(m)
+ elif m.atmt_type == ATMT.TIMEOUT:
+ cls.timeout[m.atmt_state].append((m.atmt_timeout, m))
+ elif m.atmt_type == ATMT.ACTION:
+ for c in m.atmt_cond:
+ cls.actions[c].append(m)
+
+
+ for v in cls.timeout.itervalues():
+ v.sort(lambda (t1,f1),(t2,f2): cmp(t1,t2))
+ v.append((None, None))
+ for v in itertools.chain(cls.conditions.itervalues(),
+ cls.recv_conditions.itervalues()):
+ v.sort(lambda c1,c2: cmp(c1.atmt_prio,c2.atmt_prio))
+ for condname,actlst in cls.actions.iteritems():
+ actlst.sort(lambda c1,c2: cmp(c1.atmt_cond[condname], c2.atmt_cond[condname]))
+
+ return cls
+
+
+ def graph(self, **kargs):
+ s = 'digraph "%s" {\n' % self.__class__.__name__
+
+ se = "" # Keep initial nodes at the begining for better rendering
+ for st in self.states.itervalues():
+ if st.atmt_initial:
+ se = ('\t"%s" [ style=filled, fillcolor=blue, shape=box, root=true];\n' % st.atmt_state)+se
+ elif st.atmt_final:
+ se += '\t"%s" [ style=filled, fillcolor=green, shape=octagon ];\n' % st.atmt_state
+ elif st.atmt_error:
+ se += '\t"%s" [ style=filled, fillcolor=red, shape=octagon ];\n' % st.atmt_state
+ s += se
+
+ for st in self.states.values():
+ for n in st.atmt_origfunc.func_code.co_names+st.atmt_origfunc.func_code.co_consts:
+ if n in self.states:
+ s += '\t"%s" -> "%s" [ color=green ];\n' % (st.atmt_state,n)
+
+
+ for c,k,v in [("purple",k,v) for k,v in self.conditions.items()]+[("red",k,v) for k,v in self.recv_conditions.items()]:
+ for f in v:
+ for n in f.func_code.co_names+f.func_code.co_consts:
+ if n in self.states:
+ l = f.atmt_condname
+ for x in self.actions[f.atmt_condname]:
+ l += "\\l>[%s]" % x.func_name
+ s += '\t"%s" -> "%s" [label="%s", color=%s];\n' % (k,n,l,c)
+ for k,v in self.timeout.iteritems():
+ for t,f in v:
+ if f is None:
+ continue
+ for n in f.func_code.co_names+f.func_code.co_consts:
+ if n in self.states:
+ l = "%s/%.1fs" % (f.atmt_condname,t)
+ for x in self.actions[f.atmt_condname]:
+ l += "\\l>[%s]" % x.func_name
+ s += '\t"%s" -> "%s" [label="%s",color=blue];\n' % (k,n,l)
+ s += "}\n"
+ return do_graph(s, **kargs)
+
+
+
+class Automaton:
+ __metaclass__ = Automaton_metaclass
+
+ def __init__(self, *args, **kargs):
+ self.debug_level=0
+ self.init_args=args
+ self.init_kargs=kargs
+ self.parse_args(*args, **kargs)
+
+ def debug(self, lvl, msg):
+ if self.debug_level >= lvl:
+ log_interactive.debug(msg)
+
+
+
+
+ class ErrorState(Exception):
+ def __init__(self, msg, result=None):
+ Exception.__init__(self, msg)
+ self.result = result
+ class Stuck(ErrorState):
+ pass
+
+ def parse_args(self, debug=0, store=1, **kargs):
+ self.debug_level=debug
+ self.socket_kargs = kargs
+ self.store_packets = store
+
+
+ def master_filter(self, pkt):
+ return True
+
+ def run_condition(self, cond, *args, **kargs):
+ try:
+ cond(self,*args, **kargs)
+ except ATMT.NewStateRequested, state_req:
+ self.debug(2, "%s [%s] taken to state [%s]" % (cond.atmt_type, cond.atmt_condname, state_req.state))
+ if cond.atmt_type == ATMT.RECV:
+ self.packets.append(args[0])
+ for action in self.actions[cond.atmt_condname]:
+ self.debug(2, " + Running action [%s]" % action.func_name)
+ action(self, *state_req.action_args, **state_req.action_kargs)
+ raise
+ else:
+ self.debug(2, "%s [%s] not taken" % (cond.atmt_type, cond.atmt_condname))
+
+
+ def run(self, *args, **kargs):
+ # Update default parameters
+ a = args+self.init_args[len(args):]
+ k = self.init_kargs
+ k.update(kargs)
+ self.parse_args(*a,**k)
+
+ # Start the automaton
+ self.state=self.initial_states[0](self)
+ self.send_sock = conf.L3socket()
+ l = conf.L2listen(**self.socket_kargs)
+ self.packets = PacketList(name="session[%s]"%self.__class__.__name__)
+ while 1:
+ try:
+ self.debug(1, "## state=[%s]" % self.state.state)
+
+ # Entering a new state. First, call new state function
+ state_output = self.state.run()
+ if self.state.error:
+ raise self.ErrorState("Reached %s: [%r]" % (self.state.state, state_output), result=state_output)
+ if self.state.final:
+ return state_output
+
+ if state_output is None:
+ state_output = ()
+ elif type(state_output) is not list:
+ state_output = state_output,
+
+ # Then check immediate conditions
+ for cond in self.conditions[self.state.state]:
+ self.run_condition(cond, *state_output)
+
+ # If still there and no conditions left, we are stuck!
+ if ( len(self.recv_conditions[self.state.state]) == 0
+ and len(self.timeout[self.state.state]) == 1 ):
+ raise self.Stuck("stuck in [%s]" % self.state.state,result=state_output)
+
+ # Finally listen and pay attention to timeouts
+ expirations = iter(self.timeout[self.state.state])
+ next_timeout,timeout_func = expirations.next()
+ t0 = time.time()
+
+ while 1:
+ t = time.time()-t0
+ if next_timeout is None:
+ remain = None
+ else:
+ if next_timeout <= t:
+ self.run_condition(timeout_func, *state_output)
+ next_timeout,timeout_func = expirations.next()
+ remain = next_timeout-t
+
+ r,_,_ = select([l],[],[],remain)
+ if l in r:
+ pkt = l.recv(MTU)
+ if pkt is not None:
+ if self.master_filter(pkt):
+ self.debug(3, "RECVD: %s" % pkt.summary())
+ for rcvcond in self.recv_conditions[self.state.state]:
+ self.run_condition(rcvcond, pkt, *state_output)
+ else:
+ self.debug(4, "FILTR: %s" % pkt.summary())
+
+ except ATMT.NewStateRequested,state_req:
+ self.debug(2, "switching from [%s] to [%s]" % (self.state.state,state_req.state))
+ self.state = state_req
+ except KeyboardInterrupt:
+ self.debug(1,"Interrupted by user")
+ break
+
+ def my_send(self, pkt):
+ self.send_sock.send(pkt)
+
+ def send(self, pkt):
+ self.my_send(pkt)
+ self.debug(3,"SENT : %s" % pkt.summary())
+ self.packets.append(pkt.copy())
+
+
+
+
+
+
+class TFTP_read(Automaton):
+ def parse_args(self, filename, server, sport = None, port=69, **kargs):
+ Automaton.parse_args(self, **kargs)
+ self.filename = filename
+ self.server = server
+ self.port = port
+ self.sport = sport
+
+
+ def master_filter(self, pkt):
+ return ( IP in pkt and pkt[IP].src == self.server and UDP in pkt
+ and pkt[UDP].dport == self.my_tid
+ and (self.server_tid is None or pkt[UDP].sport == self.server_tid) )
+
+ # BEGIN
+ @ATMT.state(initial=1)
+ def BEGIN(self):
+ self.blocksize=512
+ self.my_tid = self.sport or RandShort()._fix()
+ bind_bottom_up(UDP, TFTP, dport=self.my_tid)
+ self.server_tid = None
+ self.res = ""
+
+ self.l3 = IP(dst=self.server)/UDP(sport=self.my_tid, dport=self.port)/TFTP()
+ self.last_packet = self.l3/TFTP_RRQ(filename=self.filename, mode="octet")
+ self.send(self.last_packet)
+ self.awaiting=1
+
+ raise self.WAITING()
+
+ # WAITING
+ @ATMT.state()
+ def WAITING(self):
+ pass
+
+
+ @ATMT.receive_condition(WAITING)
+ def receive_data(self, pkt):
+ if TFTP_DATA in pkt and pkt[TFTP_DATA].block == self.awaiting:
+ if self.server_tid is None:
+ self.server_tid = pkt[UDP].sport
+ self.l3[UDP].dport = self.server_tid
+ raise self.RECEIVING(pkt)
+
+ @ATMT.receive_condition(WAITING, prio=1)
+ def receive_error(self, pkt):
+ if TFTP_ERROR in pkt:
+ raise self.ERROR(pkt)
+
+
+ @ATMT.timeout(WAITING, 3)
+ def timeout_waiting(self):
+ raise self.WAITING()
+ @ATMT.action(timeout_waiting)
+ def retransmit_last_packet(self):
+ self.send(self.last_packet)
+
+ @ATMT.action(receive_data)
+# @ATMT.action(receive_error)
+ def send_ack(self):
+ self.last_packet = self.l3 / TFTP_ACK(block = self.awaiting)
+ self.send(self.last_packet)
+
+
+ # RECEIVED
+ @ATMT.state()
+ def RECEIVING(self, pkt):
+ recvd = pkt[Raw].load
+ self.res += recvd
+ self.awaiting += 1
+ if len(recvd) == self.blocksize:
+ raise self.WAITING()
+ raise self.END()
+
+ # ERROR
+ @ATMT.state(error=1)
+ def ERROR(self,pkt):
+ split_bottom_up(UDP, TFTP, dport=self.my_tid)
+ return pkt[TFTP_ERROR].summary()
+
+ #END
+ @ATMT.state(final=1)
+ def END(self):
+ split_bottom_up(UDP, TFTP, dport=self.my_tid)
+ return self.res
+
+
+
+
+class TFTP_write(Automaton):
+ def parse_args(self, filename, data, server, sport=None, port=69,**kargs):
+ Automaton.parse_args(self, **kargs)
+ self.filename = filename
+ self.server = server
+ self.port = port
+ self.sport = sport
+ self.blocksize = 512
+ self.origdata = data
+
+ def master_filter(self, pkt):
+ return ( IP in pkt and pkt[IP].src == self.server and UDP in pkt
+ and pkt[UDP].dport == self.my_tid
+ and (self.server_tid is None or pkt[UDP].sport == self.server_tid) )
+
+
+ # BEGIN
+ @ATMT.state(initial=1)
+ def BEGIN(self):
+ self.data = [ self.origdata[i*self.blocksize:(i+1)*self.blocksize]
+ for i in range( len(self.origdata)/self.blocksize+1) ]
+ self.my_tid = self.sport or RandShort()._fix()
+ bind_bottom_up(UDP, TFTP, dport=self.my_tid)
+ self.server_tid = None
+
+ self.l3 = IP(dst=self.server)/UDP(sport=self.my_tid, dport=self.port)/TFTP()
+ self.last_packet = self.l3/TFTP_WRQ(filename=self.filename, mode="octet")
+ self.send(self.last_packet)
+ self.res = ""
+ self.awaiting=0
+
+ raise self.WAITING_ACK()
+
+ # WAITING_ACK
+ @ATMT.state()
+ def WAITING_ACK(self):
+ pass
+
+ @ATMT.receive_condition(WAITING_ACK)
+ def received_ack(self,pkt):
+ if TFTP_ACK in pkt and pkt[TFTP_ACK].block == self.awaiting:
+ if self.server_tid is None:
+ self.server_tid = pkt[UDP].sport
+ self.l3[UDP].dport = self.server_tid
+ raise self.SEND_DATA()
+
+ @ATMT.receive_condition(WAITING_ACK)
+ def received_error(self, pkt):
+ if TFTP_ERROR in pkt:
+ raise self.ERROR(pkt)
+
+ @ATMT.timeout(WAITING_ACK, 3)
+ def timeout_waiting(self):
+ raise self.WAITING_ACK()
+ @ATMT.action(timeout_waiting)
+ def retransmit_last_packet(self):
+ self.send(self.last_packet)
+
+ # SEND_DATA
+ @ATMT.state()
+ def SEND_DATA(self):
+ self.awaiting += 1
+ self.last_packet = self.l3/TFTP_DATA(block=self.awaiting)/self.data.pop(0)
+ self.send(self.last_packet)
+ if self.data:
+ raise self.WAITING_ACK()
+ raise self.END()
+
+
+ # ERROR
+ @ATMT.state(error=1)
+ def ERROR(self,pkt):
+ split_bottom_up(UDP, TFTP, dport=self.my_tid)
+ return pkt[TFTP_ERROR].summary()
+
+ # END
+ @ATMT.state(final=1)
+ def END(self):
+ split_bottom_up(UDP, TFTP, dport=self.my_tid)
+
+
+class TFTP_WRQ_server(Automaton):
+
+ def parse_args(self, ip=None, sport=None, *args, **kargs):
+ Automaton.parse_args(self, *args, **kargs)
+ self.ip = ip
+ self.sport = sport
+
+ def master_filter(self, pkt):
+ return TFTP in pkt and (not self.ip or pkt[IP].dst == self.ip)
+
+ @ATMT.state(initial=1)
+ def BEGIN(self):
+ self.blksize=512
+ self.blk=0
+ self.filedata=""
+ self.my_tid = self.sport or random.randint(10000,65500)
+ bind_bottom_up(UDP, TFTP, dport=self.my_tid)
+
+ @ATMT.receive_condition(BEGIN)
+ def receive_WRQ(self,pkt):
+ if TFTP_WRQ in pkt:
+ raise self.WAIT_DATA().action_parameters(pkt)
+
+ @ATMT.action(receive_WRQ)
+ def ack_WRQ(self, pkt):
+ ip = pkt[IP]
+ self.ip = ip.dst
+ self.dst = ip.src
+ self.filename = pkt[TFTP_WRQ].filename
+ options = pkt[TFTP_Options]
+ self.l3 = IP(src=ip.dst, dst=ip.src)/UDP(sport=self.my_tid, dport=pkt.sport)/TFTP()
+ if options is None:
+ self.last_packet = self.l3/TFTP_ACK(block=0)
+ self.send(self.last_packet)
+ else:
+ opt = [x for x in options.options if x.oname == "BLKSIZE"]
+ if opt:
+ self.blksize = int(opt[0].value)
+ self.debug(2,"Negotiated new blksize at %i" % self.blksize)
+ self.last_packet = self.l3/TFTP_OACK()/TFTP_Options(options=opt)
+ self.send(self.last_packet)
+
+ @ATMT.state()
+ def WAIT_DATA(self):
+ self.blk += 1
+
+ @ATMT.receive_condition(WAIT_DATA)
+ def receive_data(self, pkt):
+ if TFTP_DATA in pkt:
+ data = pkt[TFTP_DATA]
+ if data.block == self.blk:
+ raise self.DATA(data)
+
+ @ATMT.action(receive_data)
+ def ack_data(self):
+ self.last_packet = self.l3/TFTP_ACK(block = self.blk)
+ self.send(self.last_packet)
+
+ @ATMT.state()
+ def DATA(self, data):
+ self.filedata += data.load
+ if len(data.load) < self.blksize:
+ raise self.END()
+ raise self.WAIT_DATA()
+
+ @ATMT.state(final=1)
+ def END(self):
+ return self.filename,self.filedata
+ split_bottom_up(UDP, TFTP, dport=self.my_tid)
+
+
+
+########################
+## Answering machines ##
+########################
+
+class ReferenceAM(type):
+ def __new__(cls, name, bases, dct):
+ o = super(ReferenceAM, cls).__new__(cls, name, bases, dct)
+ if o.function_name:
+ globals()[o.function_name] = lambda o=o,*args,**kargs: o(*args,**kargs)()
+ return o
+
+
+class AnsweringMachine(object):
+ __metaclass__ = ReferenceAM
+ function_name = ""
+ filter = None
+ sniff_options = { "store":0 }
+ sniff_options_list = [ "store", "iface", "count", "promisc", "filter", "type", "prn" ]
+ send_options = { "verbose":0 }
+ send_options_list = ["iface", "inter", "loop", "verbose"]
+ send_function = staticmethod(send)
+
+
+ def __init__(self, **kargs):
+ self.mode = 0
+ if self.filter:
+ kargs.setdefault("filter",self.filter)
+ kargs.setdefault("prn", self.reply)
+ self.optam1 = {}
+ self.optam2 = {}
+ self.optam0 = {}
+ doptsend,doptsniff = self.parse_all_options(1, kargs)
+ self.defoptsend = self.send_options.copy()
+ self.defoptsend.update(doptsend)
+ self.defoptsniff = self.sniff_options.copy()
+ self.defoptsniff.update(doptsniff)
+ self.optsend,self.optsniff = [{},{}]
+
+ def __getattr__(self, attr):
+ for d in [self.optam2, self.optam1]:
+ if attr in d:
+ return d[attr]
+ raise AttributeError,attr
+
+ def __setattr__(self, attr, val):
+ mode = self.__dict__.get("mode",0)
+ if mode == 0:
+ self.__dict__[attr] = val
+ else:
+ [self.optam1, self.optam2][mode-1][attr] = val
+
+ def parse_options(self):
+ pass
+
+ def parse_all_options(self, mode, kargs):
+ sniffopt = {}
+ sendopt = {}
+ for k in kargs.keys():
+ if k in self.sniff_options_list:
+ sniffopt[k] = kargs[k]
+ if k in self.send_options_list:
+ sendopt[k] = kargs[k]
+ if k in self.sniff_options_list+self.send_options_list:
+ del(kargs[k])
+ if mode != 2 or kargs:
+ if mode == 1:
+ self.optam0 = kargs
+ elif mode == 2 and kargs:
+ k = self.optam0.copy()
+ k.update(kargs)
+ self.parse_options(**k)
+ kargs = k
+ omode = self.__dict__.get("mode",0)
+ self.__dict__["mode"] = mode
+ self.parse_options(**kargs)
+ self.__dict__["mode"] = omode
+ return sendopt,sniffopt
+
+ def is_request(self, req):
+ return 1
+
+ def make_reply(self, req):
+ return req
+
+ def send_reply(self, reply):
+ self.send_function(reply, **self.optsend)
+
+ def print_reply(self, req, reply):
+ print "%s ==> %s" % (req.summary(),reply.summary())
+
+ def reply(self, pkt):
+ if not self.is_request(pkt):
+ return
+ reply = self.make_reply(pkt)
+ self.send_reply(reply)
+ if conf.verb >= 0:
+ self.print_reply(pkt, reply)
+
+ def run(self, *args, **kargs):
+ log_interactive.warning("run() method deprecated. The intance is now callable")
+ self(*args,**kargs)
+
+ def __call__(self, *args, **kargs):
+ optsend,optsniff = self.parse_all_options(2,kargs)
+ self.optsend=self.defoptsend.copy()
+ self.optsend.update(optsend)
+ self.optsniff=self.defoptsniff.copy()
+ self.optsniff.update(optsniff)
+
+ try:
+ self.sniff()
+ except KeyboardInterrupt:
+ print "Interrupted by user"
+
+ def sniff(self):
+ sniff(**self.optsniff)
+
+
+class BOOTP_am(AnsweringMachine):
+ function_name = "bootpd"
+ filter = "udp and port 68 and port 67"
+ send_function = staticmethod(sendp)
+ def parse_options(self, pool=Net("192.168.1.128/25"), network="192.168.1.0/24",gw="192.168.1.1",
+ renewal_time=60, lease_time=1800):
+ if type(pool) is str:
+ poom = Net(pool)
+ netw,msk = (network.split("/")+["32"])[:2]
+ msk = itom(int(msk))
+ self.netmask = ltoa(msk)
+ self.network = ltoa(atol(netw)&msk)
+ self.broadcast = ltoa( atol(self.network) | (0xffffffff&~msk) )
+ self.gw = gw
+ if isinstance(pool,Gen):
+ pool = [k for k in pool if k not in [gw, self.network, self.broadcast]]
+ pool.reverse()
+ if len(pool) == 1:
+ pool, = pool
+ self.pool = pool
+ self.lease_time = lease_time
+ self.renewal_time = renewal_time
+ self.leases = {}
+
+ def is_request(self, req):
+ if not req.haslayer(BOOTP):
+ return 0
+ reqb = req.getlayer(BOOTP)
+ if reqb.op != 1:
+ return 0
+ return 1
+
+ def print_reply(self, req, reply):
+ print "Reply %s to %s" % (reply.getlayer(IP).dst,reply.dst)
+
+ def make_reply(self, req):
+ mac = req.src
+ if type(self.pool) is list:
+ if not self.leases.has_key(mac):
+ self.leases[mac] = self.pool.pop()
+ ip = self.leases[mac]
+ else:
+ ip = self.pool
+
+ repb = req.getlayer(BOOTP).copy()
+ repb.op="BOOTREPLY"
+ repb.yiaddr = ip
+ repb.siaddr = self.gw
+ repb.ciaddr = self.gw
+ repb.giaddr = self.gw
+ del(repb.payload)
+ rep=Ether(dst=mac)/IP(dst=ip)/UDP(sport=req.dport,dport=req.sport)/repb
+ return rep
+
+
+class DHCP_am(BOOTP_am):
+ function_name="dhcpd"
+ def make_reply(self, req):
+ resp = BOOTP_am.make_reply(self, req)
+ if DHCP in req:
+ dhcp_options = [(op[0],{1:2,3:5}.get(op[1],op[1]))
+ for op in req[DHCP].options
+ if type(op) is tuple and op[0] == "message-type"]
+ dhcp_options += [("router", self.gw),
+ ("name_server", self.gw),
+ ("broadcast_address", self.broadcast),
+ ("subnet_mask", self.netmask),
+ ("renewal_time", self.renewal_time),
+ ("lease_time", self.lease_time),
+ ]
+ resp /= DHCP(options=dhcp_options)
+ return resp
+
+
+
+class DNS_am(AnsweringMachine):
+ function_name="dns_spoof"
+ filter = "udp port 53"
+
+ def parse_options(self, joker="192.168.1.1", match=None):
+ if match is None:
+ self.match = {}
+ else:
+ self.match = match
+ self.joker=joker
+
+ def is_request(self, req):
+ return req.haslayer(DNS) and req.getlayer(DNS).qr == 0
+
+ def make_reply(self, req):
+ ip = req.getlayer(IP)
+ dns = req.getlayer(DNS)
+ resp = IP(dst=ip.src, src=ip.dst)/UDP(dport=ip.sport,sport=ip.dport)
+ rdata = self.match.get(dns.qd.qname, self.joker)
+ resp /= DNS(id=dns.id, qr=1, qd=dns.qd,
+ an=DNSRR(rrname=dns.qd.qname, ttl=10, rdata=rdata))
+ return resp
+
+
+class WiFi_am(AnsweringMachine):
+ """Before using this, initialize "iffrom" and "ifto" interfaces:
+iwconfig iffrom mode monitor
+iwpriv orig_ifto hostapd 1
+ifconfig ifto up
+note: if ifto=wlan0ap then orig_ifto=wlan0
+note: ifto and iffrom must be set on the same channel
+ex:
+ifconfig eth1 up
+iwconfig eth1 mode monitor
+iwconfig eth1 channel 11
+iwpriv wlan0 hostapd 1
+ifconfig wlan0ap up
+iwconfig wlan0 channel 11
+iwconfig wlan0 essid dontexist
+iwconfig wlan0 mode managed
+"""
+ function_name = "airpwn"
+ filter = None
+
+ def parse_options(iffrom, ifto, replace, pattern="", ignorepattern=""):
+ self.iffrom = iffrom
+ self.ifto = ifto
+ ptrn = re.compile(pattern)
+ iptrn = re.compile(ignorepattern)
+
+ def is_request(self, pkt):
+ if not isinstance(pkt,Dot11):
+ return 0
+ if not pkt.FCfield & 1:
+ return 0
+ if not pkt.haslayer(TCP):
+ return 0
+ ip = pkt.getlayer(IP)
+ tcp = pkt.getlayer(TCP)
+ pay = str(tcp.payload)
+ if not self.ptrn.match(pay):
+ return 0
+ if self.iptrn.match(pay):
+ return 0
+
+ def make_reply(self, p):
+ ip = p.getlayer(IP)
+ tcp = p.getlayer(TCP)
+ pay = str(tcp.payload)
+ del(p.payload.payload.payload)
+ p.FCfield="from-DS"
+ p.addr1,p.addr2 = p.addr2,p.addr1
+ p /= IP(src=ip.dst,dst=ip.src)
+ p /= TCP(sport=tcp.dport, dport=tcp.sport,
+ seq=tcp.ack, ack=tcp.seq+len(pay),
+ flags="PA")
+ q = p.copy()
+ p /= self.replace
+ q.ID += 1
+ q.getlayer(TCP).flags="RA"
+ q.getlayer(TCP).seq+=len(replace)
+ return [p,q]
+
+ def print_reply(self):
+ print p.sprintf("Sent %IP.src%:%IP.sport% > %IP.dst%:%TCP.dport%")
+
+ def send_reply(self, reply):
+ sendp(reply, iface=self.ifto, **self.optsend)
+
+ def sniff(self):
+ sniff(iface=self.iffrom, **self.optsniff)
+
+
+
+class ARP_am(AnsweringMachine):
+ function_name="farpd"
+ filter = "arp"
+ send_function = staticmethod(sendp)
+
+ def parse_options(self, IP_addr=None, iface=None, ARP_addr=None):
+ self.IP_addr=IP_addr
+ self.iface=iface
+ self.ARP_addr=ARP_addr
+
+ def is_request(self, req):
+ return (req.haslayer(ARP) and
+ req.getlayer(ARP).op == 1 and
+ (self.IP_addr == None or self.IP_addr == req.getlayer(ARP).pdst))
+
+ def make_reply(self, req):
+ ether = req.getlayer(Ether)
+ arp = req.getlayer(ARP)
+ iff,a,gw = conf.route.route(arp.psrc)
+ if self.iface != None:
+ iff = iface
+ ARP_addr = self.ARP_addr
+ IP_addr = arp.pdst
+ resp = Ether(dst=ether.src,
+ src=ARP_addr)/ARP(op="is-at",
+ hwsrc=ARP_addr,
+ psrc=IP_addr,
+ hwdst=arp.hwsrc,
+ pdst=arp.pdst)
+ return resp
+
+ def sniff(self):
+ sniff(iface=self.iface, **self.optsniff)
+
+
+#############
+## Fuzzing ##
+#############
+
+
+def fuzz(p, _inplace=0):
+ if not _inplace:
+ p = p.copy()
+ q = p
+ while not isinstance(q, NoPayload):
+ for f in q.fields_desc:
+ if isinstance(f, PacketListField):
+ for r in getattr(q, f.name):
+ print "fuzzing", repr(r)
+ fuzz(r, _inplace=1)
+ elif f.default is not None:
+ rnd = f.randval()
+ if rnd is not None:
+ q.default_fields[f.name] = rnd
+ q = q.payload
+ return p
+
+
+
+
+###################
+## Testing stuff ##
+###################
+
+
+
+def merge(x,y):
+ if len(x) > len(y):
+ y += "\x00"*(len(x)-len(y))
+ elif len(x) < len(y):
+ x += "\x00"*(len(y)-len(x))
+ m = ""
+ for i in range(len(x)/ss):
+ m += x[ss*i:ss*(i+1)]+y[ss*i:ss*(i+1)]
+ return m
+# return "".join(map(str.__add__, x, y))
+
+
+def voip_play(s1,list=None,**kargs):
+ FIFO="/tmp/conv1.%i.%%i" % os.getpid()
+ FIFO1=FIFO % 1
+ FIFO2=FIFO % 2
+
+ os.mkfifo(FIFO1)
+ os.mkfifo(FIFO2)
+ try:
+ os.system("soxmix -t .ul %s -t .ul %s -t ossdsp /dev/dsp &" % (FIFO1,FIFO2))
+
+ c1=open(FIFO1,"w", 4096)
+ c2=open(FIFO2,"w", 4096)
+ fcntl.fcntl(c1.fileno(),fcntl.F_SETFL, os.O_NONBLOCK)
+ fcntl.fcntl(c2.fileno(),fcntl.F_SETFL, os.O_NONBLOCK)
+
+ # dsp,rd = os.popen2("sox -t .ul -c 2 - -t ossdsp /dev/dsp")
+ def play(pkt,last=[]):
+ if not pkt:
+ return
+ if not pkt.haslayer(UDP):
+ return
+ ip=pkt.getlayer(IP)
+ if s1 in [ip.src, ip.dst]:
+ if not last:
+ last.append(pkt)
+ return
+ load=last.pop()
+ # x1 = load.load[12:]
+ c1.write(load.load[12:])
+ if load.getlayer(IP).src == ip.src:
+ # x2 = ""
+ c2.write("\x00"*len(load.load[12:]))
+ last.append(pkt)
+ else:
+ # x2 = pkt.load[:12]
+ c2.write(pkt.load[12:])
+ # dsp.write(merge(x1,x2))
+
+ if list is None:
+ sniff(store=0, prn=play, **kargs)
+ else:
+ for p in list:
+ play(p)
+ finally:
+ os.unlink(FIFO1)
+ os.unlink(FIFO2)
+
+
+
+def voip_play1(s1,list=None,**kargs):
+
+
+ dsp,rd = os.popen2("sox -t .ul - -t ossdsp /dev/dsp")
+ def play(pkt):
+ if not pkt:
+ return
+ if not pkt.haslayer(UDP):
+ return
+ ip=pkt.getlayer(IP)
+ if s1 in [ip.src, ip.dst]:
+ dsp.write(pkt.getlayer(Raw).load[12:])
+ try:
+ if list is None:
+ sniff(store=0, prn=play, **kargs)
+ else:
+ for p in list:
+ play(p)
+ finally:
+ dsp.close()
+ rd.close()
+
+def voip_play2(s1,**kargs):
+ dsp,rd = os.popen2("sox -t .ul -c 2 - -t ossdsp /dev/dsp")
+ def play(pkt,last=[]):
+ if not pkt:
+ return
+ if not pkt.haslayer(UDP):
+ return
+ ip=pkt.getlayer(IP)
+ if s1 in [ip.src, ip.dst]:
+ if not last:
+ last.append(pkt)
+ return
+ load=last.pop()
+ x1 = load.load[12:]
+# c1.write(load.load[12:])
+ if load.getlayer(IP).src == ip.src:
+ x2 = ""
+# c2.write("\x00"*len(load.load[12:]))
+ last.append(pkt)
+ else:
+ x2 = pkt.load[:12]
+# c2.write(pkt.load[12:])
+ dsp.write(merge(x1,x2))
+
+ sniff(store=0, prn=play, **kargs)
+
+def voip_play3(lst=None,**kargs):
+ dsp,rd = os.popen2("sox -t .ul - -t ossdsp /dev/dsp")
+ try:
+ def play(pkt, dsp=dsp):
+ if pkt and pkt.haslayer(UDP) and pkt.haslayer(Raw):
+ dsp.write(pkt.getlayer(RTP).load)
+ if lst is None:
+ sniff(store=0, prn=play, **kargs)
+ else:
+ for p in lst:
+ play(p)
+ finally:
+ try:
+ dsp.close()
+ rd.close()
+ except:
+ pass
+
+
+def IPID_count(lst, funcID=lambda x:x[1].id, funcpres=lambda x:x[1].summary()):
+ idlst = map(funcID, lst)
+ idlst.sort()
+ classes = [idlst[0]]+map(lambda x:x[1],filter(lambda (x,y): abs(x-y)>50, map(lambda x,y: (x,y),idlst[:-1], idlst[1:])))
+ lst = map(lambda x:(funcID(x), funcpres(x)), lst)
+ lst.sort()
+ print "Probably %i classes:" % len(classes), classes
+ for id,pr in lst:
+ print "%5i" % id, pr
+
+
+
+
+
+last=None
+
+
+def tethereal(*args,**kargs):
+ sniff(prn=lambda x: x.display(),*args,**kargs)
+
+def etherleak(target, **kargs):
+ return srpflood(Ether()/ARP(pdst=target), prn=lambda (s,r): Padding in r and hexstr(r[Padding].load),
+ filter="arp", **kargs)
+
+
+def fragleak(target,sport=123, dport=123, timeout=0.2, onlyasc=0):
+ load = "XXXXYYYYYYYYYY"
+# getmacbyip(target)
+# pkt = IP(dst=target, id=RandShort(), options="\x22"*40)/UDP()/load
+ pkt = IP(dst=target, id=RandShort(), options="\x00"*40, flags=1)/UDP(sport=sport, dport=sport)/load
+ s=conf.L3socket()
+ intr=0
+ found={}
+ try:
+ while 1:
+ try:
+ if not intr:
+ s.send(pkt)
+ sin,sout,serr = select([s],[],[],timeout)
+ if not sin:
+ continue
+ ans=s.recv(1600)
+ if not isinstance(ans, IP): #TODO: IPv6
+ continue
+ if not isinstance(ans.payload, ICMP):
+ continue
+ if not isinstance(ans.payload.payload, IPerror):
+ continue
+ if ans.payload.payload.dst != target:
+ continue
+ if ans.src != target:
+ print "leak from", ans.src,
+
+
+# print repr(ans)
+ if not ans.haslayer(Padding):
+ continue
+
+
+# print repr(ans.payload.payload.payload.payload)
+
+# if not isinstance(ans.payload.payload.payload.payload, Raw):
+# continue
+# leak = ans.payload.payload.payload.payload.load[len(load):]
+ leak = ans.getlayer(Padding).load
+ if leak not in found:
+ found[leak]=None
+ linehexdump(leak, onlyasc=onlyasc)
+ except KeyboardInterrupt:
+ if intr:
+ raise
+ intr=1
+ except KeyboardInterrupt:
+ pass
+
+def fragleak2(target, timeout=0.4, onlyasc=0):
+ found={}
+ try:
+ while 1:
+ p = sr1(IP(dst=target, options="\x00"*40, proto=200)/"XXXXYYYYYYYYYYYY",timeout=timeout,verbose=0)
+ if not p:
+ continue
+ if Padding in p:
+ leak = p[Padding].load
+ if leak not in found:
+ found[leak]=None
+ linehexdump(leak,onlyasc=onlyasc)
+ except:
+ pass
+
+
+
+plst=[]
+def get_toDS():
+ global plst
+ while 1:
+ p,=sniff(iface="eth1",count=1)
+ if not isinstance(p,Dot11):
+ continue
+ if p.FCfield & 1:
+ plst.append(p)
+ print "."
+
+
+# if not ifto.endswith("ap"):
+# print "iwpriv %s hostapd 1" % ifto
+# os.system("iwpriv %s hostapd 1" % ifto)
+# ifto += "ap"
+#
+# os.system("iwconfig %s mode monitor" % iffrom)
+#
+
+def airpwn(iffrom, ifto, replace, pattern="", ignorepattern=""):
+ """Before using this, initialize "iffrom" and "ifto" interfaces:
+iwconfig iffrom mode monitor
+iwpriv orig_ifto hostapd 1
+ifconfig ifto up
+note: if ifto=wlan0ap then orig_ifto=wlan0
+note: ifto and iffrom must be set on the same channel
+ex:
+ifconfig eth1 up
+iwconfig eth1 mode monitor
+iwconfig eth1 channel 11
+iwpriv wlan0 hostapd 1
+ifconfig wlan0ap up
+iwconfig wlan0 channel 11
+iwconfig wlan0 essid dontexist
+iwconfig wlan0 mode managed
+"""
+
+ ptrn = re.compile(pattern)
+ iptrn = re.compile(ignorepattern)
+ def do_airpwn(p, ifto=ifto, replace=replace, ptrn=ptrn, iptrn=iptrn):
+ if not isinstance(p,Dot11):
+ return
+ if not p.FCfield & 1:
+ return
+ if not p.haslayer(TCP):
+ return
+ ip = p.getlayer(IP)
+ tcp = p.getlayer(TCP)
+ pay = str(tcp.payload)
+# print "got tcp"
+ if not ptrn.match(pay):
+ return
+# print "match 1"
+ if iptrn.match(pay):
+ return
+# print "match 2"
+ del(p.payload.payload.payload)
+ p.FCfield="from-DS"
+ p.addr1,p.addr2 = p.addr2,p.addr1
+ q = p.copy()
+ p /= IP(src=ip.dst,dst=ip.src)
+ p /= TCP(sport=tcp.dport, dport=tcp.sport,
+ seq=tcp.ack, ack=tcp.seq+len(pay),
+ flags="PA")
+ q = p.copy()
+ p /= replace
+ q.ID += 1
+ q.getlayer(TCP).flags="RA"
+ q.getlayer(TCP).seq+=len(replace)
+
+ sendp([p,q], iface=ifto, verbose=0)
+# print "send",repr(p)
+# print "send",repr(q)
+ print p.sprintf("Sent %IP.src%:%IP.sport% > %IP.dst%:%TCP.dport%")
+
+ sniff(iface=iffrom,prn=do_airpwn)
+
+
+
+
+##################
+## Color themes ##
+##################
+
+class Color:
+ normal = "\033[0m"
+ black = "\033[30m"
+ red = "\033[31m"
+ green = "\033[32m"
+ yellow = "\033[33m"
+ blue = "\033[34m"
+ purple = "\033[35m"
+ cyan = "\033[36m"
+ grey = "\033[37m"
+
+ bold = "\033[1m"
+ uline = "\033[4m"
+ blink = "\033[5m"
+ invert = "\033[7m"
+
+
+class ColorTheme:
+ def __repr__(self):
+ return "<%s>" % self.__class__.__name__
+ def __getattr__(self, attr):
+ return lambda x:x
+
+
+class NoTheme(ColorTheme):
+ pass
+
+
+class AnsiColorTheme(ColorTheme):
+ def __getattr__(self, attr):
+ if attr.startswith("__"):
+ raise AttributeError(attr)
+ s = "style_%s" % attr
+ if s in self.__class__.__dict__:
+ before = getattr(self, s)
+ after = self.style_normal
+ else:
+ before = after = ""
+
+ def do_style(val, fmt=None, before=before, after=after):
+ if fmt is None:
+ if type(val) is not str:
+ val = str(val)
+ else:
+ val = fmt % val
+ return before+val+after
+ return do_style
+
+
+ style_normal = ""
+ style_prompt = ""
+ style_punct = ""
+ style_id = ""
+ style_not_printable = ""
+ style_layer_name = ""
+ style_field_name = ""
+ style_field_value = ""
+ style_emph_field_name = ""
+ style_emph_field_value = ""
+ style_packetlist_name = ""
+ style_packetlist_proto = ""
+ style_packetlist_value = ""
+ style_fail = ""
+ style_success = ""
+ style_odd = ""
+ style_even = ""
+ style_opening = ""
+ style_active = ""
+ style_closed = ""
+ style_left = ""
+ style_right = ""
+
+class BlackAndWhite(AnsiColorTheme):
+ pass
+
+class DefaultTheme(AnsiColorTheme):
+ style_normal = Color.normal
+ style_prompt = Color.blue+Color.bold
+ style_punct = Color.normal
+ style_id = Color.blue+Color.bold
+ style_not_printable = Color.grey
+ style_layer_name = Color.red+Color.bold
+ style_field_name = Color.blue
+ style_field_value = Color.purple
+ style_emph_field_name = Color.blue+Color.uline+Color.bold
+ style_emph_field_value = Color.purple+Color.uline+Color.bold
+ style_packetlist_name = Color.red+Color.bold
+ style_packetlist_proto = Color.blue
+ style_packetlist_value = Color.purple
+ style_fail = Color.red+Color.bold
+ style_success = Color.blue+Color.bold
+ style_even = Color.black+Color.bold
+ style_odd = Color.black
+ style_opening = Color.yellow
+ style_active = Color.black
+ style_closed = Color.grey
+ style_left = Color.blue+Color.invert
+ style_right = Color.red+Color.invert
+
+class BrightTheme(AnsiColorTheme):
+ style_normal = Color.normal
+ style_punct = Color.normal
+ style_id = Color.yellow+Color.bold
+ style_layer_name = Color.red+Color.bold
+ style_field_name = Color.yellow+Color.bold
+ style_field_value = Color.purple+Color.bold
+ style_emph_field_name = Color.yellow+Color.bold
+ style_emph_field_value = Color.green+Color.bold
+ style_packetlist_name = Color.red+Color.bold
+ style_packetlist_proto = Color.yellow+Color.bold
+ style_packetlist_value = Color.purple+Color.bold
+ style_fail = Color.red+Color.bold
+ style_success = Color.blue+Color.bold
+ style_even = Color.black+Color.bold
+ style_odd = Color.black
+ style_left = Color.cyan+Color.invert
+ style_right = Color.purple+Color.invert
+
+
+class RastaTheme(AnsiColorTheme):
+ style_normal = Color.normal+Color.green+Color.bold
+ style_prompt = Color.yellow+Color.bold
+ style_punct = Color.red
+ style_id = Color.green+Color.bold
+ style_not_printable = Color.green
+ style_layer_name = Color.red+Color.bold
+ style_field_name = Color.yellow+Color.bold
+ style_field_value = Color.green+Color.bold
+ style_emph_field_name = Color.green
+ style_emph_field_value = Color.green
+ style_packetlist_name = Color.red+Color.bold
+ style_packetlist_proto = Color.yellow+Color.bold
+ style_packetlist_value = Color.green+Color.bold
+ style_fail = Color.red
+ style_success = Color.red+Color.bold
+ style_even = Color.yellow
+ style_odd = Color.green
+ style_left = Color.yellow+Color.invert
+ style_right = Color.red+Color.invert
+
+
+class FormatTheme(ColorTheme):
+ def __getattr__(self, attr):
+ if attr.startswith("__"):
+ raise AttributeError(attr)
+ col = self.__class__.__dict__.get("style_%s" % attr, "%s")
+ def do_style(val, fmt=None, col=col):
+ if fmt is None:
+ if type(val) is not str:
+ val = str(val)
+ else:
+ val = fmt % val
+ return col % val
+ return do_style
+
+
+class LatexTheme(FormatTheme):
+ style_prompt = r"\textcolor{blue}{%s}"
+ style_not_printable = r"\textcolor{gray}{%s}"
+ style_layer_name = r"\textcolor{red}{\bf %s}"
+ style_field_name = r"\textcolor{blue}{%s}"
+ style_field_value = r"\textcolor{purple}{%s}"
+ style_emph_field_name = r"\textcolor{blue}{\underline{%s}}" #ul
+ style_emph_field_value = r"\textcolor{purple}{\underline{%s}}" #ul
+ style_packetlist_name = r"\textcolor{red}{\bf %s}"
+ style_packetlist_proto = r"\textcolor{blue}{%s}"
+ style_packetlist_value = r"\textcolor{purple}{%s}"
+ style_fail = r"\textcolor{red}{\bf %s}"
+ style_success = r"\textcolor{blue}{\bf %s}"
+ style_left = r"\textcolor{blue}{%s}"
+ style_right = r"\textcolor{red}{%s}"
+# style_even = r"}{\bf "
+# style_odd = ""
+
+class LatexTheme2(FormatTheme):
+ style_prompt = r"@`@textcolor@[@blue@]@@[@%s@]@"
+ style_not_printable = r"@`@textcolor@[@gray@]@@[@%s@]@"
+ style_layer_name = r"@`@textcolor@[@red@]@@[@@`@bfseries@[@@]@%s@]@"
+ style_field_name = r"@`@textcolor@[@blue@]@@[@%s@]@"
+ style_field_value = r"@`@textcolor@[@purple@]@@[@%s@]@"
+ style_emph_field_name = r"@`@textcolor@[@blue@]@@[@@`@underline@[@%s@]@@]@"
+ style_emph_field_value = r"@`@textcolor@[@purple@]@@[@@`@underline@[@%s@]@@]@"
+ style_packetlist_name = r"@`@textcolor@[@red@]@@[@@`@bfseries@[@@]@%s@]@"
+ style_packetlist_proto = r"@`@textcolor@[@blue@]@@[@%s@]@"
+ style_packetlist_value = r"@`@textcolor@[@purple@]@@[@%s@]@"
+ style_fail = r"@`@textcolor@[@red@]@@[@@`@bfseries@[@@]@%s@]@"
+ style_success = r"@`@textcolor@[@blue@]@@[@@`@bfserices@[@@]@%s@]@"
+ style_even = r"@`@textcolor@[@gray@]@@[@@`@bfseries@[@@]@%s@]@"
+# style_odd = r"@`@textcolor@[@black@]@@[@@`@bfseries@[@@]@%s@]@"
+ style_left = r"@`@textcolor@[@blue@]@@[@%s@]@"
+ style_right = r"@`@textcolor@[@red@]@@[@%s@]@"
+
+class HTMLTheme(FormatTheme):
+ style_prompt = "<span class=prompt>%s</span>"
+ style_not_printable = "<span class=not_printable>%s</span>"
+ style_layer_name = "<span class=layer_name>%s</span>"
+ style_field_name = "<span class=field_name>%s</span>"
+ style_field_value = "<span class=field_value>%s</span>"
+ style_emph_field_name = "<span class=emph_field_name>%s</span>"
+ style_emph_field_value = "<span class=emph_field_value>%s</span>"
+ style_packetlist_name = "<span class=packetlist_name>%s</span>"
+ style_packetlist_proto = "<span class=packetlist_proto>%s</span>"
+ style_packetlist_value = "<span class=packetlist_value>%s</span>"
+ style_fail = "<span class=fail>%s</span>"
+ style_success = "<span class=success>%s</span>"
+ style_even = "<span class=even>%s</span>"
+ style_odd = "<span class=odd>%s</span>"
+ style_left = "<span class=left>%s</span>"
+ style_right = "<span class=right>%s</span>"
+
+class HTMLTheme2(HTMLTheme):
+ style_prompt = "#[#span class=prompt#]#%s#[#/span#]#"
+ style_not_printable = "#[#span class=not_printable#]#%s#[#/span#]#"
+ style_layer_name = "#[#span class=layer_name#]#%s#[#/span#]#"
+ style_field_name = "#[#span class=field_name#]#%s#[#/span#]#"
+ style_field_value = "#[#span class=field_value#]#%s#[#/span#]#"
+ style_emph_field_name = "#[#span class=emph_field_name#]#%s#[#/span#]#"
+ style_emph_field_value = "#[#span class=emph_field_value#]#%s#[#/span#]#"
+ style_packetlist_name = "#[#span class=packetlist_name#]#%s#[#/span#]#"
+ style_packetlist_proto = "#[#span class=packetlist_proto#]#%s#[#/span#]#"
+ style_packetlist_value = "#[#span class=packetlist_value#]#%s#[#/span#]#"
+ style_fail = "#[#span class=fail#]#%s#[#/span#]#"
+ style_success = "#[#span class=success#]#%s#[#/span#]#"
+ style_even = "#[#span class=even#]#%s#[#/span#]#"
+ style_odd = "#[#span class=odd#]#%s#[#/span#]#"
+ style_left = "#[#span class=left#]#%s#[#/span#]#"
+ style_right = "#[#span class=right#]#%s#[#/span#]#"
+
+
+class ColorPrompt:
+ __prompt = ">>> "
+ def __str__(self):
+ try:
+ ct = conf.color_theme
+ if isinstance(ct, AnsiColorTheme):
+ ## ^A and ^B delimit invisible caracters for readline to count right
+ return "\001%s\002" % ct.prompt("\002"+conf.prompt+"\001")
+ else:
+ return ct.prompt(conf.prompt)
+ except:
+ return self.__prompt
+
+############
+## Config ##
+############
+
+class ConfClass:
+ def configure(self, cnf):
+ self.__dict__ = cnf.__dict__.copy()
+ def __repr__(self):
+ return str(self)
+ def __str__(self):
+ s="Version = %s\n" % VERSION
+ keys = self.__class__.__dict__.copy()
+ keys.update(self.__dict__)
+ keys = keys.keys()
+ keys.sort()
+ for i in keys:
+ if i[0] != "_":
+ s += "%-10s = %s\n" % (i, repr(getattr(self, i)))
+ return s[:-1]
+
+class ProgPath(ConfClass):
+ pdfreader = "acroread"
+ psreader = "gv"
+ dot = "dot"
+ display = "display"
+ tcpdump = "tcpdump"
+ tcpreplay = "tcpreplay"
+ hexedit = "hexer"
+ wireshark = "wireshark"
+
+class Resolve:
+ def __init__(self):
+ self.fields = {}
+ def add(self, *flds):
+ for fld in flds:
+ self.fields[fld]=None
+ def remove(self, *flds):
+ for fld in flds:
+ if fld in self.fields:
+ del(self.fields[fld])
+ def __contains__(self, elt):
+ return elt in self.fields
+ def __repr__(self):
+ return "<Resolve [%s]>" % " ".join(str(x) for x in self.fields)
+
+
+
+
+class Conf(ConfClass):
+ """This object contains the configuration of scapy.
+session : filename where the session will be saved
+stealth : if 1, prevents any unwanted packet to go out (ARP, DNS, ...)
+checkIPID: if 0, doesn't check that IPID matches between IP sent and ICMP IP citation received
+ if 1, checks that they either are equal or byte swapped equals (bug in some IP stacks)
+ if 2, strictly checks that they are equals
+checkIPsrc: if 1, checks IP src in IP and ICMP IP citation match (bug in some NAT stacks)
+check_TCPerror_seqack: if 1, also check that TCP seq and ack match the ones in ICMP citation
+iff : selects the default output interface for srp() and sendp(). default:"eth0")
+verb : level of verbosity, from 0 (almost mute) to 3 (verbose)
+promisc : default mode for listening socket (to get answers if you spoof on a lan)
+sniff_promisc : default mode for sniff()
+filter : bpf filter added to every sniffing socket to exclude traffic from analysis
+histfile : history file
+padding : includes padding in desassembled packets
+except_filter : BPF filter for packets to ignore
+debug_match : when 1, store received packet that are not matched into debug.recv
+route : holds the Scapy routing table and provides methods to manipulate it
+warning_threshold : how much time between warnings from the same place
+ASN1_default_codec: Codec used by default for ASN1 objects
+mib : holds MIB direct access dictionnary
+resolve : holds list of fields for which resolution should be done
+noenum : holds list of enum fields for which conversion to string should NOT be done
+AS_resolver: choose the AS resolver class to use
+"""
+ session = ""
+ stealth = "not implemented"
+ iface = get_working_if()
+ checkIPID = 0
+ checkIPsrc = 1
+ checkIPaddr = 1
+ check_TCPerror_seqack = 0
+ verb = 2
+ prompt = ">>> "
+ promisc = 1
+ sniff_promisc = 1
+ L3socket = L3PacketSocket
+ L2socket = L2Socket
+ L2listen = L2ListenSocket
+ BTsocket = BluetoothL2CAPSocket
+ histfile = os.path.join(os.environ["HOME"], ".scapy_history")
+ padding = 1
+ p0f_base ="/etc/p0f/p0f.fp"
+ queso_base ="/etc/queso.conf"
+ nmap_base ="/usr/share/nmap/nmap-os-fingerprints"
+ IPCountry_base = "GeoIPCountry4Scapy.gz"
+ countryLoc_base = "countryLoc.csv"
+ gnuplot_world = "world.dat"
+ except_filter = ""
+ debug_match = 0
+ route = Route()
+ wepkey = ""
+ auto_fragment = 1
+ debug_dissector = 0
+ color_theme = DefaultTheme()
+ warning_threshold = 5
+ ASN1_default_codec = ASN1_Codecs.BER
+ mib = MIBDict(_name="MIB")
+ prog = ProgPath()
+ resolve = Resolve()
+ noenum = Resolve()
+ ethertypes = ETHER_TYPES
+ protocols = IP_PROTOS
+ services_tcp = TCP_SERVICES
+ services_udp = UDP_SERVICES
+ manufdb = MANUFDB
+ AS_resolver = AS_resolver_multi()
+
+
+conf=Conf()
+
+betteriface = conf.route.route("0.0.0.0", verbose=0)[0]
+if betteriface != "lo": #XXX linux specific...
+ conf.iface = betteriface
+del(betteriface)
+
+if PCAP:
+ conf.L2listen=L2pcapListenSocket
+ if DNET:
+ conf.L3socket=L3dnetSocket
+ conf.L2socket=L2dnetSocket
+
+
+p0f_kdb = p0fKnowledgeBase(conf.p0f_base)
+queso_kdb = QuesoKnowledgeBase(conf.queso_base)
+nmap_kdb = NmapKnowledgeBase(conf.nmap_base)
+IP_country_kdb = IPCountryKnowledgeBase(conf.IPCountry_base)
+country_loc_kdb = CountryLocKnowledgeBase(conf.countryLoc_base)
+
+
+#########################
+##### Autorun stuff #####
+#########################
+
+
+class ScapyAutorunInterpreter(code.InteractiveInterpreter):
+ def __init__(self, *args, **kargs):
+ code.InteractiveInterpreter.__init__(self, *args, **kargs)
+ self.error = 0
+ def showsyntaxerror(self, *args, **kargs):
+ self.error = 1
+ return code.InteractiveInterpreter.showsyntaxerror(self, *args, **kargs)
+ def showtraceback(self, *args, **kargs):
+ self.error = 1
+ return code.InteractiveInterpreter.showtraceback(self, *args, **kargs)
+
+
+def autorun_commands(cmds,my_globals=None,verb=0):
+ sv = conf.verb
+ import __builtin__
+ try:
+ if my_globals is None:
+ my_globals = globals()
+ conf.verb = verb
+ interp = ScapyAutorunInterpreter(my_globals)
+ cmd = ""
+ cmds = cmds.splitlines()
+ cmds.append("") # ensure we finish multiline commands
+ cmds.reverse()
+ __builtin__.__dict__["_"] = None
+ while 1:
+ if cmd:
+ sys.stderr.write(sys.__dict__.get("ps2","... "))
+ else:
+ sys.stderr.write(str(sys.__dict__.get("ps1",ColorPrompt())))
+
+ l = cmds.pop()
+ print l
+ cmd += "\n"+l
+ if interp.runsource(cmd):
+ continue
+ if interp.error:
+ return 0
+ cmd = ""
+ if len(cmds) <= 1:
+ break
+ finally:
+ conf.verb = sv
+ return _
+
+def autorun_get_interactive_session(cmds, **kargs):
+ class StringWriter:
+ def __init__(self):
+ self.s = ""
+ def write(self, x):
+ self.s += x
+
+ sw = StringWriter()
+ sstdout,sstderr = sys.stdout,sys.stderr
+ try:
+ sys.stdout = sys.stderr = sw
+ res = autorun_commands(cmds, **kargs)
+ finally:
+ sys.stdout,sys.stderr = sstdout,sstderr
+ return sw.s,res
+
+def autorun_get_text_interactive_session(cmds, **kargs):
+ ct = conf.color_theme
+ try:
+ conf.color_theme = NoTheme()
+ s,res = autorun_get_interactive_session(cmds, **kargs)
+ finally:
+ conf.color_theme = ct
+ return s,res
+
+def autorun_get_ansi_interactive_session(cmds, **kargs):
+ ct = conf.color_theme
+ try:
+ conf.color_theme = DefaultTheme()
+ s,res = autorun_get_interactive_session(cmds, **kargs)
+ finally:
+ conf.color_theme = ct
+ return s,res
+
+def autorun_get_html_interactive_session(cmds, **kargs):
+ ct = conf.color_theme
+ try:
+ conf.color_theme = HTMLTheme2()
+ s,res = autorun_get_interactive_session(cmds, **kargs)
+ finally:
+ conf.color_theme = ct
+
+ s = s.replace("<","&lt;").replace(">","&gt;").replace("#[#","<").replace("#]#",">")
+ return s,res
+
+def autorun_get_latex_interactive_session(cmds, **kargs):
+ ct = conf.color_theme
+ try:
+ conf.color_theme = LatexTheme2()
+ s,res = autorun_get_interactive_session(cmds, **kargs)
+ finally:
+ conf.color_theme = ct
+ s = tex_escape(s)
+ s = s.replace("@[@","{").replace("@]@","}").replace("@`@","\\")
+ return s,res
+
+
+################
+##### Main #####
+################
+
+def scapy_write_history_file(readline):
+ if conf.histfile:
+ try:
+ readline.write_history_file(conf.histfile)
+ except IOError,e:
+ try:
+ warning("Could not write history to [%s]\n\t (%s)" % (conf.histfile,e))
+ tmp = os.tempnam("","scapy")
+ readline.write_history_file(tmp)
+ warning("Wrote history to [%s]" % tmp)
+ except:
+ warning("Cound not write history to [%s]. Discarded" % tmp)
+
+
+def interact(mydict=None,argv=None,mybanner=None,loglevel=1):
+ import code,sys,cPickle,types,os,imp,getopt,logging
+
+ logging.getLogger("scapy").setLevel(loglevel)
+
+ the_banner = "Welcome to Scapy (%s)"
+ if mybanner is not None:
+ the_banner += "\n"
+ the_banner += mybanner
+
+ if argv is None:
+ argv = sys.argv
+
+# scapy_module = argv[0][argv[0].rfind("/")+1:]
+# if not scapy_module:
+# scapy_module = "scapy"
+# else:
+# if scapy_module.endswith(".py"):
+# scapy_module = scapy_module[:-3]
+#
+# scapy=imp.load_module("scapy",*imp.find_module(scapy_module))
+
+
+ import __builtin__
+# __builtin__.__dict__.update(scapy.__dict__)
+ __builtin__.__dict__.update(globals())
+ if mydict is not None:
+ __builtin__.__dict__.update(mydict)
+
+
+ import re, atexit
+ try:
+ import rlcompleter,readline
+ except ImportError:
+ log_loading.info("Can't load Python libreadline or completer")
+ READLINE=0
+ else:
+ READLINE=1
+ class ScapyCompleter(rlcompleter.Completer):
+ def global_matches(self, text):
+ matches = []
+ n = len(text)
+ for lst in [dir(__builtin__), session.keys()]:
+ for word in lst:
+ if word[:n] == text and word != "__builtins__":
+ matches.append(word)
+ return matches
+
+
+ def attr_matches(self, text):
+ m = re.match(r"(\w+(\.\w+)*)\.(\w*)", text)
+ if not m:
+ return
+ expr, attr = m.group(1, 3)
+ try:
+ object = eval(expr)
+ except:
+ object = eval(expr, session)
+ if isinstance(object, Packet) or isinstance(object, Packet_metaclass):
+ words = filter(lambda x: x[0]!="_",dir(object))
+ words += [x.name for x in object.fields_desc]
+ else:
+ words = dir(object)
+ if hasattr( object,"__class__" ):
+ words = words + rlcompleter.get_class_members(object.__class__)
+ matches = []
+ n = len(attr)
+ for word in words:
+ if word[:n] == attr and word != "__builtins__":
+ matches.append("%s.%s" % (expr, word))
+ return matches
+
+ readline.set_completer(ScapyCompleter().complete)
+ readline.parse_and_bind("C-o: operate-and-get-next")
+ readline.parse_and_bind("tab: complete")
+
+
+ session=None
+ session_name=""
+ CONFIG_FILE = DEFAULT_CONFIG_FILE
+
+ iface = None
+ try:
+ opts=getopt.getopt(argv[1:], "hs:Cc:")
+ for opt, parm in opts[0]:
+ if opt == "-h":
+ usage()
+ elif opt == "-s":
+ session_name = parm
+ elif opt == "-c":
+ CONFIG_FILE = parm
+ elif opt == "-C":
+ CONFIG_FILE = None
+
+ if len(opts[1]) > 0:
+ raise getopt.GetoptError("Too many parameters : [%s]" % string.join(opts[1]),None)
+
+
+ except getopt.GetoptError, msg:
+ log_loading.error(msg)
+ sys.exit(1)
+
+
+ if CONFIG_FILE:
+ read_config_file(CONFIG_FILE)
+
+ if session_name:
+ try:
+ os.stat(session_name)
+ except OSError:
+ log_loading.info("New session [%s]" % session_name)
+ else:
+ try:
+ try:
+ session = cPickle.load(gzip.open(session_name,"rb"))
+ except IOError:
+ session = cPickle.load(open(session_name,"rb"))
+ log_loading.info("Using session [%s]" % session_name)
+ except EOFError:
+ log_loading.error("Error opening session [%s]" % session_name)
+ except AttributeError:
+ log_loading.error("Error opening session [%s]. Attribute missing" % session_name)
+
+ if session:
+ if "conf" in session:
+ conf.configure(session["conf"])
+ session["conf"] = conf
+ else:
+ conf.session = session_name
+ session={"conf":conf}
+
+ else:
+ session={"conf": conf}
+
+ __builtin__.__dict__["scapy_session"] = session
+
+
+ if READLINE:
+ if conf.histfile:
+ try:
+ readline.read_history_file(conf.histfile)
+ except IOError:
+ pass
+ atexit.register(scapy_write_history_file,readline)
+
+ sys.ps1 = ColorPrompt()
+ code.interact(banner = the_banner % (VERSION), local=session)
+
+ if conf.session:
+ save_session(conf.session, session)
+
+ sys.exit()
+
+
+def read_config_file(configfile):
+ try:
+ execfile(configfile)
+ except IOError,e:
+ log_loading.warning("Cannot read config file [%s] [%s]" % (configfile,e))
+ except Exception,e:
+ log_loading.exception("Error during evaluation of config file [%s]" % configfile)
+
+
+if __name__ == "__main__":
+ interact()
+else:
+ if DEFAULT_CONFIG_FILE:
+ read_config_file(DEFAULT_CONFIG_FILE)
diff --git a/cesar/maximus/python/maximus/ethernet/sniffer.py b/cesar/maximus/python/maximus/ethernet/sniffer.py
new file mode 100644
index 0000000000..65abfa2d35
--- /dev/null
+++ b/cesar/maximus/python/maximus/ethernet/sniffer.py
@@ -0,0 +1,128 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.macframe.msdu import MSDU_TYPES, MSDU
+from maximus.utils.exception import Error, OutOfRangeError
+from maximus.utils.format import *
+
+# Sniffer types
+SNIFFER_TYPES = ['Beacon', 'MME']
+
+class Sniffer(MSDU):
+ """The Sniffer object is composed of the 4 following fields:
+ way - a Python boolean:
+ 'False' for Tx
+ 'True' for Rx
+ encryption - a Python boolean
+ sniffer type - a Python dictionnary
+ packet - a Python string
+ """
+
+ def __init__(self, way, encryption, sniffer_type):
+ self.set_way(way)
+ self.set_encryption(encryption)
+ self.set_sniffer_type(sniffer_type)
+ self.__packet = None
+
+ def set_way(self, way):
+ """This function sets the way.
+ The way must be a Python boolean.
+ """
+ self.__way = None
+ if type(way) is not bool:
+ raise TypeError("Way")
+ else:
+ self.__way = way
+
+ def set_encryption(self, encryption):
+ """This function sets the encryption.
+ The encryption must be a Python boolean.
+ """
+ self.__encryption = None
+ if type(encryption) is not bool:
+ raise TypeError("Encryption")
+ else:
+ self.__encryption = encryption
+
+ def set_sniffer_type(self, sniffer_type):
+ """This function sets the sniffer type.
+ The sniffer type must be a Python integer lower than the SNIFFER_TYPES Python list length.
+ """
+ self.__sniffer_type = None
+ if type(sniffer_type) is not int:
+ raise TypeError("Sniffer type")
+ elif sniffer_type >= len(SNIFFER_TYPES):
+ raise OutOfRangeError("Sniffer type")
+ else:
+ self.__sniffer_type = sniffer_type
+
+ def set_msdu_attr(self, payload):
+ """This function sets the MSDU attributes from the received Ethernet Frame.
+ """
+ if type(payload) is not str:
+ raise TypeError("Packet")
+ else:
+ self.__packet = payload
+
+ def sendnrecv(self, maximus, station, file=None, timeout=None, filter=None, count=1):
+ raise Error("Cannot call this function for a sniffed Ethernet Frame")
+
+ def send(self, maximus, station, file=None):
+ raise Error("Cannot call this function for a sniffed Ethernet Frame")
+
+ def get(self):
+ """This function returns the sniffed packet into a string.
+ """
+ return self.__packet
+
+ def get_ether_type(self):
+ """This function returns the Sniffer object type into a Python integer (u8).
+ """
+ ether_type = None
+ for i in range (0,len(MSDU_TYPES)):
+ if MSDU_TYPES[i] == self.get_type():
+ ether_type = i
+ return ether_type # 7
+
+ def get_type(self):
+ """This function returns the Sniffer object type into a Python string.
+ """
+ return 'ETHERNET_TYPE_SNIFFER'
+
+ def get_way(self):
+ """This function gets the way.
+ The way is a Python boolean.
+ """
+ return self.__way
+
+ def get_encryption(self):
+ """This function gets the encryption.
+ The encryption is a Python boolean.
+ """
+ return self.__encryption
+
+ def get_sniffer_type(self):
+ """This function gets the sniffer type.
+ The sniffer type is a Python integer lower than the SNIFFER_TYPES Python list length.
+ """
+ return self.__sniffer_type
+
+ def display(self):
+ """This function displays the sniffed Ethernet Frame.
+ """
+ print "display the sniffed Ethernet Frame"
+ print "way =",
+ if self.get_way():
+ print 'Rx'
+ else:
+ print 'Tx'
+ print "encryption =", self.get_encryption()
+ print "sniffer type =", SNIFFER_TYPES[self.get_sniffer_type()]
+ print "packet =",
+ if self.get() is not None:
+ for c in self.get():
+ print hex(ntoh8(c)),
+ print
+ else:
+ print self.get()
diff --git a/cesar/maximus/python/maximus/fsm/FSM.py b/cesar/maximus/python/maximus/fsm/FSM.py
new file mode 100644
index 0000000000..e4b09f9f11
--- /dev/null
+++ b/cesar/maximus/python/maximus/fsm/FSM.py
@@ -0,0 +1,263 @@
+#!/usr/bin/env python
+'''This module implements a Finite State Machine (FSM).
+In addition to state this FSM also maintains a user defined "something".
+This "something" is effectively memory, so this FSM could be considered
+a Push-down Automata (PDA) since a PDA is a FSM + memory.
+
+The following describes how the FSM works, but you will probably also need
+to see the example function to understand how the FSM is used in practice.
+
+You define an FSM by building tables of transitions.
+For a given input symbol the process() method uses these tables
+to decide what action to call and what the next state will be.
+The FSM has a table of transitions that associate:
+ (input_symbol, current_state) --> (action, next_state)
+where "action" is a function you define. The symbols and states
+can be any objects. You use the add_transition() and add_transition_list()
+methods to add to the transition table. The FSM also has a table
+of transitions that associate:
+ (current_state) --> (action, next_state)
+You use the add_transition_any() method to add to this transition table.
+The FSM also has one default transition that is not associated
+with any specific input_symbol or state. You use the
+set_default_transition() method to set the default transition.
+
+When an action function is called it is passed a reference to the FSM.
+The action function may then access attributes of the FSM such as
+input_symbol, current_state, or "something". The "something" attribute
+can be any object that you want to pass along to the action functions.
+It is not used by the FSM. For parsing you would typically pass a list
+to be used as a stack.
+
+The processing sequence is as follows.
+The process() method is given an input_symbol to process.
+The FSM will search the table of transitions that associate:
+ (input_symbol, current_state) --> (action, next_state)
+If the pair (input_symbol, current_state) is found then
+process() will call the associated action function and then set the
+current state to the next_state.
+
+If the FSM cannot find a match for (input_symbol, current_state)
+it will then search the table of transitions that associate:
+ (current_state) --> (action, next_state)
+If the current_state is found then the process() method will call
+the associated action function and then set the current state to
+the next_state. Notice that this table lacks an input_symbol.
+It lets you define transitions for a current_state and ANY input_symbol.
+Hence, it is called the "any" table. Remember, it is always checked
+after first searching the table for a specific (input_symbol, current_state).
+
+For the case where the FSM did not match either of the previous two cases
+the FSM will try to use the default transition. If the default transition
+is defined then the process() method will call the associated action function
+and then set the current state to the next_state. This lets you define
+a default transition as a catch-all case. You can think of it as an
+exception handler. There can be only one default transition.
+
+Finally, if none of the previous cases are defined for an input_symbol
+and current_state then the FSM will raise an exception.
+This may be desirable, but you can always prevent this just by
+defining a default transition.
+
+Noah Spurrier 20020822
+'''
+
+class ExceptionFSM(Exception):
+ '''This is the FSM Exception class.'''
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return `self.value`
+
+class FSM:
+ '''This is a Finite State Machine (FSM).
+ '''
+
+ def __init__(self, initial_state, something):
+ '''This creates the FSM.
+ You set the initial state here. The "something" attribute is any
+ object that you want to pass along to the action functions.
+ It is not used by the FSM. For parsing you would typically pass
+ a list to be used as a stack.
+ '''
+ # Map (input_symbol, current_state) --> (action, next_state).
+ self.state_transitions = {}
+ # Map (current_state) --> (action, next_state).
+ self.state_transitions_any = {}
+ self.default_transition = None
+
+ self.input_symbol = None
+ self.initial_state = initial_state
+ self.current_state = self.initial_state
+ self.something = something
+
+ def reset (self):
+ '''This sets the current_state to the initial_state and
+ sets input_symbol to None.
+ The initial state was set by the constructor __init__().
+ '''
+ self.current_state = self.initial_state
+ self.input_symbol = None
+
+ def add_transition (self, input_symbol, state, action, next_state):
+ '''This adds a transition that associates
+ (input_symbol, current_state) --> (action, next_state)
+ The action may be set to None in which case the process() method
+ will ignore the action and only set the next_state.
+
+ You can also set transitions for a list of symbols by using
+ add_transition_list().
+ '''
+ self.state_transitions[(input_symbol, state)] = (action, next_state)
+
+ def add_transition_list (self, list_input_symbols, state, action, next_state):
+ '''This adds the same transition for lots of different input symbols.
+ You can pass a list or a string. Note that it is handy to use
+ string.digits, string.whitespace, string.letters, etc. to add
+ transitions that match character classes.
+ '''
+ for input_symbol in list_input_symbols:
+ self.add_transition (input_symbol, state, action, next_state)
+
+ def add_transition_any (self, state, action, next_state):
+ '''This adds a transition that associates
+ (current_state) --> (action, next_state)
+ The process() method checks these associations if it cannot
+ first find a match of an (input_symbol, current_state).
+ '''
+ self.state_transitions_any [state] = (action, next_state)
+
+ def set_default_transition (self, action, next_state):
+ '''This sets the default transition.
+ This defines an action and next_state if the FSM cannot find the
+ input symbol and the current state in the transition list and
+ if the FSM cannot find the current_state in the transition_any list.
+ This is useful for catching errors and undefined states.
+
+ The default transition can be removed by setting the attribute
+ default_transition to None.
+ '''
+ self.default_transition = (action, next_state)
+
+ def get_transition (self, input_symbol, state):
+ '''This returns (action, next state) given an input_symbol and state.
+ This leaves the FSM unchanged. This does not update the current state
+ nor does it trigger the output action. Normally you do not call
+ this method. It is called by process().
+
+ The sequence of steps to check for a defined transition goes from
+ the most specific to the least specific.
+ 1. Check state_transitions[] that match (input_symbol, state)
+ 2. Check state_transitions_any[] that match (state)
+ In other words, match a specific state and ANY input_symbol.
+ 3. Check if the default_transition is defined.
+ This catches any input_symbol and any state.
+ This is a handler for errors, undefined states, or defaults.
+ 4. No transition was defined. If we get here then raise an exception.
+ '''
+ if self.state_transitions.has_key((input_symbol, self.current_state)):
+ return self.state_transitions[(input_symbol, self.current_state)]
+ elif self.state_transitions_any.has_key (self.current_state):
+ return self.state_transitions_any[self.current_state]
+ elif self.default_transition != None:
+ return self.default_transition
+ else:
+ raise ExceptionFSM ('Transition is undefined: (%s, %s).' %
+ (str(input_symbol), str(self.current_state)) )
+
+ def process (self, input_symbol):
+ '''This is the main method that you call to process input.
+ This may cause the FSM to change state and call an action.
+ This method calls get_transition() to find the action and next_state
+ associated with the input_symbol and current_state.
+ If the action is None then the action is not called and
+ only the current state is changed.
+ This method processes one input symbol. You can process a list of
+ symbols (or a string) by calling process_list().
+ '''
+ self.input_symbol = input_symbol
+ (action, next_state) = self.get_transition (self.input_symbol, self.current_state)
+ if action != None:
+ action (self)
+ self.current_state = next_state
+
+ def process_list (self, s):
+ '''This takes a list and sends each element to process().
+ The list may be a string.
+ '''
+ for c in s:
+ self.process (c)
+
+##########################################################################
+# The following example demonstrates the use of the FSM class in
+# processing RPN expressions. Run this module from the command line.
+# You will get a prompt > for input.
+# Enter an RPN Expression.
+# Numbers may be integers. Operators are * / + -
+# Use the = sign to evaluate and print the expression.
+# For example:
+# 167 3 2 2 * * * 1 - =
+# will print:
+# 2003
+##########################################################################
+
+import string
+
+#
+# These define the actions.
+# Note that "something" is a list being used as a stack.
+#
+def BeginBuildNumber (fsm):
+ fsm.something.append (fsm.input_symbol)
+def BuildNumber (fsm):
+ s = fsm.something.pop ()
+ s = s + fsm.input_symbol
+ fsm.something.append (s)
+def EndBuildNumber (fsm):
+ s = fsm.something.pop ()
+ fsm.something.append (int(s))
+def DoOperator (fsm):
+ ar = fsm.something.pop()
+ al = fsm.something.pop()
+ if fsm.input_symbol == '+':
+ fsm.something.append (al + ar)
+ elif fsm.input_symbol == '-':
+ fsm.something.append (al - ar)
+ elif fsm.input_symbol == '*':
+ fsm.something.append (al * ar)
+ elif fsm.input_symbol == '/':
+ fsm.something.append (al / ar)
+def DoEqual (fsm):
+ print str(fsm.something.pop())
+def Error (fsm):
+ print 'That does not compute.'
+ print str(fsm.input_symbol)
+
+#
+# This is where the example starts and the FSM state transitions are defined.
+# Note that states (such as 'INIT') are strings. This is not necessary, but
+# it makes the example easier to read.
+#
+def example ():
+ f = FSM ('INIT', []) # "something" will be used as a stack.
+ f.set_default_transition (Error, 'INIT')
+ f.add_transition_any ('INIT', None, 'INIT')
+ f.add_transition ('=', 'INIT', DoEqual, 'INIT')
+ f.add_transition_list (string.digits, 'INIT', BeginBuildNumber, 'BUILDING_NUMBER')
+ f.add_transition_list (string.digits, 'BUILDING_NUMBER', BuildNumber, 'BUILDING_NUMBER')
+ f.add_transition_list (string.whitespace, 'BUILDING_NUMBER', EndBuildNumber, 'INIT')
+ f.add_transition_list ('+-*/', 'INIT', DoOperator, 'INIT')
+
+ print
+ print 'Enter an RPN Expression.'
+ print 'Numbers may be integers. Operators are * / + -'
+ print 'Use the = sign to evaluate and print the expression.'
+ print 'For example: '
+ print ' 167 3 2 2 * * * 1 - ='
+ inputs = raw_input ('>')
+ for s in inputs:
+ f.process (s)
+
+if __name__ == '__main__':
+ example ()
+
diff --git a/cesar/maximus/python/maximus/fsm/__init__.py b/cesar/maximus/python/maximus/fsm/__init__.py
new file mode 100644
index 0000000000..8606c61734
--- /dev/null
+++ b/cesar/maximus/python/maximus/fsm/__init__.py
@@ -0,0 +1,7 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["FSM"]
+
+import FSM
diff --git a/cesar/maximus/python/maximus/macframe/__init__.py b/cesar/maximus/python/maximus/macframe/__init__.py
new file mode 100644
index 0000000000..a9482d470f
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/__init__.py
@@ -0,0 +1,13 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["create", "fc_10", "fc_av", "macframe", "macframeheader", "macframequeue", "mpdu", "msdu", "pb"]
+
+from fc_10 import FC_10
+from fc_av import FC_AV
+from macframe import MACFrame
+from macframeheader import MACFrameHeader
+from macframequeue import MACFrameQueue
+from mpdu import MPDU_TYPES
+from pbheader import PBHeader
diff --git a/cesar/maximus/python/maximus/macframe/create.py b/cesar/maximus/python/maximus/macframe/create.py
new file mode 100644
index 0000000000..99055e4e86
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/create.py
@@ -0,0 +1,10 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.macframe.pb import PB
+
+def create_pb():
+ """This function creates and returns a new PB object.
+ """
+ return PB()
diff --git a/cesar/maximus/python/maximus/macframe/fc_10.py b/cesar/maximus/python/maximus/macframe/fc_10.py
new file mode 100644
index 0000000000..f6ad3ffc3f
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/fc_10.py
@@ -0,0 +1,135 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.utils.crc import crc8
+from maximus.utils.exception import OutOfRangeError
+from maximus.utils.format import *
+
+# Constants to check arguments validity
+MAX_VALUE_OF_CC = 0x01
+DT_DICTIONARY = {'SOF':0x00, 'SOF_RSP':0x01, 'EOF':0x02, 'EOF_RSP':0x03, 'ACK':0x04, 'NACK':0x05}
+MAX_VALUE_OF_DT = 0x07
+MAX_VALUE_OF_VF = 0x1FFF
+MAX_VALUE_OF_FCCS = MAX_VALUE_OF_U8
+SIZE_OF_FCCS = SIZE_OF_U8 # in octets
+
+# Constants for 'self.get()' function
+size_of_dt = 3 # in bits
+size_of_vf = 13 # in bits
+size_of_fccs = 8 * SIZE_OF_FCCS # in bits
+
+class FC_10:
+ """The FC 1.0 is composed of the 4 following fields:
+ CC (1-bit)
+ DT (3-bit)
+ VF (13-bit)
+ FCCS (8-bit)
+ """
+ def __init__(self, CC=0, DT='SOF', VF=0, FCCS=None):
+ self.set_cc(CC)
+ self.set_dt(DT)
+ self.set_vf(VF)
+ self.set_fccs(FCCS)
+
+ def set_cc(self, cc):
+ """Set the CC.
+ The CC must be a Python integer (decimal or hexadecimal value).
+ """
+ if cc <= MAX_VALUE_OF_CC and cc >= 0:
+ self.__cc = cc
+ else:
+ raise OutOfRangeError("CC")
+
+ def set_dt(self, dt):
+ """Set the DT.
+ The DT can be a Python integer (decimal or hexadecimal value),
+ or a Python string of the DT dictionary.
+ """
+ if dt in DT_DICTIONARY:
+ self.__dt = DT_DICTIONARY[dt]
+ elif dt <= MAX_VALUE_OF_DT and dt >= 0:
+ self.__dt = dt
+ else:
+ raise OutOfRangeError("DT")
+
+ def set_vf(self, vf):
+ """Set the VF.
+ The VF must be a Python integer (decimal or hexadecimal value).
+ """
+ if vf <= MAX_VALUE_OF_VF and vf >= 0:
+ self.__vf = vf
+ else:
+ raise OutOfRangeError("VF")
+
+ def set_fccs(self, fccs):
+ """Set the FCCS.
+ The FCCS can be a Python integer (decimal or hexadecimal value),
+ or a Python string of length equals to sizeof(u8).
+ """
+ if fccs != None:
+ try:
+ if len(fccs) == SIZE_OF_FCCS:
+ # FCCS is a Python string of length equals to sizeof(u8)
+ self.__fccs = hptoh8(fccs)
+ else:
+ raise OutOfRangeError("FCCS")
+ except TypeError:
+ # FCCS is a Python integer
+ if fccs <= MAX_VALUE_OF_FCCS and fccs >= 0:
+ self.__fccs = fccs
+ else:
+ raise OutOfRangeError("FCCS")
+ else:
+ self.__fccs = None
+
+ def get_cc(self):
+ """Get the CC.
+ The CC is a Python integer.
+ """
+ return self.__cc
+
+ def get_dt(self):
+ """Get the DT.
+ The DT is a Python integer.
+ """
+ return self.__dt
+
+ def get_vf(self):
+ """Get the VF.
+ The VF is a Python integer.
+ """
+ return self.__vf
+
+ def get_fccs(self):
+ """Get the FCCS.
+ The FCCS is a Python integer.
+ """
+ return self.__fccs
+
+ def get(self):
+ """This function returns the FC 1.0 into a Python long (u32).
+ """
+ fc10 = self.get_cc() << (size_of_dt + size_of_vf + size_of_fccs)
+ fc10 += self.get_dt() << (size_of_vf + size_of_fccs)
+ fc10 += self.get_vf() << size_of_fccs
+
+ if self.get_fccs() is None:
+ # The 8-bit CRC must be calculated
+ self.__fccs = crc8(htohp24(fc10 >> size_of_fccs))
+
+ fc10 += self.get_fccs()
+ return fc10
+
+ def display(self):
+ """This function displays the FC 1.0 in hexadecimal values.
+ """
+ print "display the FC 1.0"
+ print "CC =", hex(self.get_cc())
+ print "DT =", hex(self.get_dt())
+ print "VF =", hex(self.get_vf())
+ if self.get_fccs() != None:
+ print "FCCS =", hex(self.get_fccs())
+ else:
+ print "FCCS = None"
+
diff --git a/cesar/maximus/python/maximus/macframe/fc_av.py b/cesar/maximus/python/maximus/macframe/fc_av.py
new file mode 100644
index 0000000000..38cccc8e2b
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/fc_av.py
@@ -0,0 +1,173 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.utils.crc import crc24
+from maximus.utils.exception import OutOfRangeError
+from maximus.utils.format import *
+
+# Constants to check arguments validity
+size_of_u8 = 8 * SIZE_OF_U8 # in bits
+size_of_u32 = 8 * SIZE_OF_U32 # in bits
+DT_AV_DICTIONARY = {'Beacon':0x00, 'SOF':0x01, 'SACK':0x02, 'RTS_CTS':0x03, 'Sound':0x04, 'RSOF':0x05}
+MAX_VALUE_OF_DT_AV = 0x07
+MAX_VALUE_OF_ACCESS = 0x01
+MAX_VALUE_OF_SNID = 0x0F
+MAX_VALUE_OF_VF_AV = 0xFFFFFFFFFFFFFFFFFFFFFFFF
+SIZE_OF_VF_AV = 3 * SIZE_OF_U32 # in octets
+MAX_VALUE_OF_FCCS_AV = 0xFFFFFF
+SIZE_OF_FCCS_AV = 3 * SIZE_OF_U8 # in octets
+
+# Constants for 'self.get()' function
+size_of_dt_av = 3 # in bits
+size_of_access = 1 # in bits
+size_of_vf_av = 8 * SIZE_OF_VF_AV # in bits
+size_of_fccs_av = 8 * SIZE_OF_FCCS_AV # in bits
+
+class FC_AV:
+ """The FC AV is composed of the 5 following fields:
+ DT_AV (3-bit)
+ ACCESS (1-bit)
+ SNID (4-bit)
+ VF_AV (96-bit)
+ FCCS_AV (24-bit)
+ """
+ def __init__(self, DT_AV='Beacon', ACCESS=0, SNID=0, VF_AV=0, FCCS_AV=None):
+ self.set_dt_av(DT_AV)
+ self.set_access(ACCESS)
+ self.set_snid(SNID)
+ self.set_vf_av(VF_AV)
+ self.set_fccs_av(FCCS_AV)
+
+ def set_dt_av(self, dt_av):
+ """Set the DT AV.
+ The DT AV can be a Python integer (decimal or hexadecimal value),
+ or a Python string of the DT AV dictionary.
+ """
+ if dt_av in DT_AV_DICTIONARY:
+ self.__dt_av = DT_AV_DICTIONARY[dt_av]
+ elif dt_av <= MAX_VALUE_OF_DT_AV and dt_av >= 0:
+ self.__dt_av = dt_av
+ else:
+ raise OutOfRangeError("DT AV")
+
+ def set_access(self, access):
+ """Set the ACCESS.
+ The ACCESS must be a Python integer (decimal or hexadecimal value).
+ """
+ if access <= MAX_VALUE_OF_ACCESS and access >= 0:
+ self.__access = access
+ else:
+ raise OutOfRangeError("ACCESS")
+
+ def set_snid(self, snid):
+ """Set the SNID.
+ The SNID must be a Python integer (decimal or hexadecimal value).
+ """
+ if snid <= MAX_VALUE_OF_SNID and snid >= 0:
+ self.__snid = snid
+ else:
+ raise OutOfRangeError("SNID")
+
+ def set_vf_av(self, vf_av):
+ """Set the VF AF.
+ The VF AF can be a Python long (decimal or hexadecimal value),
+ or a Python string of length equals to 12 octets.
+ """
+ try:
+ if len(vf_av) == SIZE_OF_VF_AV:
+ # VF AV is a Python string of length equals to 12 octets
+ vf_av = unpack(hp + 3 * u32, vf_av)
+ self.__vf_av = (vf_av[2] << 2*size_of_u32) + (vf_av[1] << size_of_u32) + vf_av[0]
+ else:
+ raise OutOfRangeError("VF AV")
+ except TypeError:
+ # VF AV is a Python long
+ if vf_av <= MAX_VALUE_OF_VF_AV and vf_av >= 0:
+ self.__vf_av = vf_av
+ else:
+ raise OutOfRangeError("VF AV")
+
+ def set_fccs_av(self, fccs_av):
+ """Set the FCCS AV.
+ The FCCS can be a Python long (decimal or hexadecimal value),
+ or a Python string of length equals to 3 octets.
+ """
+ if fccs_av != None:
+ try:
+ if len(fccs_av) == SIZE_OF_FCCS_AV:
+ # FCCS AV is a Python string of length equals to 3 octets
+ self.__fccs_av = hptoh24(fccs_av)
+ else:
+ raise OutOfRangeError("FCCS AV")
+ except TypeError:
+ # FCCS AV is a Python long
+ if fccs_av <= MAX_VALUE_OF_FCCS_AV and fccs_av >= 0:
+ self.__fccs_av = fccs_av
+ else:
+ raise OutOfRangeError("FCCS AV")
+ else:
+ self.__fccs_av = None
+
+ def get_dt_av(self):
+ """Get the DT AV.
+ The DT AV is a Python integer.
+ """
+ return self.__dt_av
+
+ def get_access(self):
+ """Get the ACCESS.
+ The ACCESS is a Python integer.
+ """
+ return self.__access
+
+ def get_snid(self):
+ """Get the SNID.
+ The SNID is a Python integer.
+ """
+ return self.__snid
+
+ def get_vf_av(self):
+ """Get the VF AV.
+ The VF is a Python long.
+ """
+ return self.__vf_av
+
+ def get_fccs_av(self):
+ """Get the FCCS AV.
+ The FCCS AV is a Python long.
+ """
+ return self.__fccs_av
+
+ def get(self):
+ """This function returns the FC AV into a tuple of 4 Python longs (u32).
+ """
+ tuple0 = self.get_snid() << (size_of_access + size_of_dt_av + 3*size_of_u8)
+ tuple0 += self.get_access() << (size_of_dt_av + 3*size_of_u8)
+ tuple0 += self.get_dt_av() << (3*size_of_u8)
+ tuple0 += self.get_vf_av() >> (2*size_of_u32 + size_of_u8)
+ tuple1 = ((self.get_vf_av() >> (size_of_u32 + size_of_u8))) & MAX_VALUE_OF_U32
+ tuple2 = (self.get_vf_av() >> size_of_u8) & MAX_VALUE_OF_U32
+ tuple3 = (self.get_vf_av() & MAX_VALUE_OF_U8) << size_of_fccs_av
+
+ if self.get_fccs_av() is None:
+ # The 24-bit CRC must be calculated
+ self.__fccs_av = crc24(htohp32(tuple0) + htohp32(tuple1) + htohp32(tuple2) + htohp8(tuple3 >> size_of_fccs_av))
+
+ tuple3 += self.get_fccs_av()
+ tuple = tuple0, tuple1, tuple2, tuple3
+ return tuple
+
+ def display(self):
+ """This function displays the FC AV in hexadecimal values.
+ """
+ print "display the FC AV"
+ print "DT AV =", hex(self.get_dt_av())
+ print "ACCESS =", hex(self.get_access())
+ print "SNID =", hex(self.get_snid())
+ print "VF AV =", hex(self.get_vf_av())
+ if self.get_fccs_av() != None:
+ print "FCCS AV =", hex(self.get_fccs_av())
+ else:
+ print "FCCS AV = None"
+
diff --git a/cesar/maximus/python/maximus/macframe/macframe.py b/cesar/maximus/python/maximus/macframe/macframe.py
new file mode 100644
index 0000000000..e5c8b56e37
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/macframe.py
@@ -0,0 +1,252 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.macframe.fc_av import FC_AV
+from maximus.macframe.macframeheader import MACFrameHeader
+from maximus.macframe.mpdu import SIZE_OF_IV, SIZE_OF_NEK, SIZE_OF_PB136, SIZE_OF_PB520, MAX_PB_NB_PER_MPDU, MPDU_TYPES, MPDU
+from maximus.macframe.msdu import MAX_SIZE_OF_MSDU
+from maximus.utils.crc import crc32
+from maximus.utils.exception import Error, OutOfRangeError
+from maximus.utils.format import *
+
+# Constants to check arguments validity
+SIZE_OF_FC_10 = SIZE_OF_U32 # in octets
+SIZE_OF_FC_AV = 4 * SIZE_OF_U32 # in octets
+SIZE_OF_MACFRAMEHEADER = SIZE_OF_U16 # in octets
+SIZE_OF_ATS_CONFOUNDER = SIZE_OF_U32 # in octets
+SIZE_OF_ICV = SIZE_OF_U32 # in octets
+SIZE_OF_IV = 3 * SIZE_OF_U32 # in octets
+SIZE_OF_NEK = 4 * SIZE_OF_U32 # in octets
+MAX_VALUE_OF_FC_10 = MAX_VALUE_OF_U32
+MAX_VALUE_OF_MACFRAMEHEADER = MAX_VALUE_OF_U16
+MAX_VALUE_OF_ATS_CONFOUNDER = MAX_VALUE_OF_U32
+MAX_VALUE_OF_ICV = MAX_VALUE_OF_U32
+MAX_SIZE_OF_MACFRAME = MAX_SIZE_OF_MSDU + SIZE_OF_MACFRAMEHEADER + SIZE_OF_ATS_CONFOUNDER + SIZE_OF_ICV # 1528 octets
+
+class MACFrame(MPDU):
+ """The MAC Frame is composed of the 4 following fields:
+ MACFrameHeader (2-octet)
+ ATS or Confounder (4-octet)
+ ICV (4-octet)
+ msdu (1518-octet max)
+ """
+ def __init__(self, FC_10=None, FC_AV=FC_AV(), MACFrameHeader=MACFrameHeader(), ATS=None, Confounder=None, ICV=None, msdu=None, iv=SIZE_OF_IV*'0', nek=SIZE_OF_NEK*'0', PBHeader=0):
+
+ # Set FC 1.0 and FC AV
+ self.set_fc_10(FC_10)
+ self.set_fc_av(FC_AV)
+
+ # Set MAC Frame Header
+ self.set_macframeheader(MACFrameHeader)
+
+ # Set ATS or Confounder
+ if ATS != None and Confounder != None:
+ raise Error("Usage: cannot give the ATS AND the Confounder as arguments")
+ else:
+ self.set_ats(ATS)
+ self.set_confounder(Confounder)
+
+ # Set ICV, MSDU, IV, and NEK
+ self.set_icv(ICV)
+ self.set_msdu(msdu)
+ self.set_iv(iv)
+ self.set_nek(nek)
+
+ # Set first PB Header
+ mmqf = False
+ try:
+ if msdu.get_type() is 'ETHERNET_TYPE_MME':
+ mmqf = True
+ except AttributeError:
+ pass
+ self.set_first_pb_header(first_pb_header=PBHeader, mmqf=mmqf)
+
+ def set_macframeheader(self, macframeheader):
+ """Set the MAC Frame Header.
+ The MAC Frame Header can be a MAC Frame Header object,
+ a Python integer (decimal or hexadecimal value),
+ or a Python string of length equals to sizeof(u16).
+ """
+ if macframeheader is not None:
+ try:
+ # MAC Frame Header is a MAC Frame Header object
+ self.__macframeheader = macframeheader.get() # set MAC Frame Header into a Python string of length equals to sizeof(u16)
+ except AttributeError:
+ try:
+ if len(macframeheader) == SIZE_OF_MACFRAMEHEADER:
+ # MAC Frame Header is a Python string of length equals to sizeof(u16)
+ self.__macframeheader = macframeheader
+ else:
+ raise OutOfRangeError("MAC Frame Header")
+ except TypeError:
+ # MAC Frame Header is a Python integer
+ if macframeheader <= MAX_VALUE_OF_MACFRAMEHEADER and macframeheader >= 0:
+ self.__macframeheader = htohp16(macframeheader) # set MAC Frame Header into a Python string of length equals to sizeof(u16)
+ else:
+ raise OutOfRangeError("MAC Frame Header")
+ else:
+ self.__macframeheader = None
+
+ def set_ats(self, ats):
+ """Set the ATS.
+ The ATS can be a Python long (decimal or hexadecimal value),
+ or a Python string of length equals to sizeof(u32).
+ """
+ if ats != None:
+ try:
+ if len(ats) == SIZE_OF_ATS_CONFOUNDER:
+ # ATS is a Python string of length equals to sizeof(u32)
+ self.__ats = ats
+ else:
+ raise OutOfRangeError("ATS")
+ except TypeError:
+ # ATS is a Python long
+ if ats <= MAX_VALUE_OF_ATS_CONFOUNDER and ats >= 0:
+ self.__ats = htohp32(ats) # set ATS into a Python string of length equals to sizeof(u32)
+ else:
+ raise OutOfRangeError("ATS")
+ else:
+ self.__ats = None
+
+ def set_confounder(self, confounder):
+ """Set the Confounder.
+ The Confounder can be a Python long (decimal or hexadecimal value),
+ or a Python string of length equals to sizeof(u32).
+ """
+ if confounder != None:
+ try:
+ if len(confounder) == SIZE_OF_ATS_CONFOUNDER:
+ # Confounder is a Python string of length equals to sizeof(u32)
+ self.__confounder = confounder
+ else:
+ raise OutOfRangeError("Confounder")
+ except TypeError:
+ # Confounder is a Python long
+ if confounder <= MAX_VALUE_OF_ATS_CONFOUNDER and confounder >= 0:
+ self.__confounder = htohp32(confounder) # set Confounder into a Python string of length equals to sizeof(u32)
+ else:
+ raise OutOfRangeError("Confounder")
+ else:
+ self.__confounder = None
+
+ def set_icv(self, icv):
+ """Set the ICV.
+ The ICV can be a Python long (decimal or hexadecimal value),
+ or a Python string of length equals to sizeof(u32).
+ """
+ if icv != None:
+ try:
+ if len(icv) == SIZE_OF_ICV:
+ # ICV is a Python string of length equals to sizeof(u32)
+ self.__icv = icv
+ else:
+ raise OutOfRangeError("ICV")
+ except TypeError:
+ # ICV is a Python long
+ if icv <= MAX_VALUE_OF_ICV and icv >= 0:
+ self.__icv = htohp32(icv) # set ICV into a Python string of length equals to sizeof(u32)
+ else:
+ raise OutOfRangeError("ICV")
+ else:
+ self.__icv = None
+
+ def set_msdu(self, msdu):
+ """Set the MSDU.
+ The MSDU can be an MSDU object,
+ or a Python string.
+ """
+ if msdu == None:
+ self.__msdu = ''
+ else:
+ try:
+ # MSDU is an MSDU object
+ self.__msdu = msdu.get() # set MSDU into a Python string
+ except AttributeError:
+ # MSDU is a Python string of length smaller than 1518 octets
+ if len(msdu) <= MAX_SIZE_OF_MSDU:
+ self.__msdu = msdu
+ else:
+ raise OutOfRangeError("MSDU too long")
+
+ def get_macframeheader(self):
+ """Get the MAC Frame Header.
+ The MAC Frame Header is a Python string of length equals to sizeof(u16).
+ """
+ return self.__macframeheader
+
+ def get_ats(self):
+ """Get the ATS.
+ The ATS is Python string of length equals to sizeof(u32).
+ """
+ return self.__ats
+
+ def get_confounder(self):
+ """Get the Confounder.
+ The Confounder is a Python string of length equals to sizeof(u32).
+ """
+ return self.__confounder
+
+ def get_icv(self):
+ """Get the ICV.
+ The ICV is a Python string of length equals to sizeof(u32).
+ """
+ return self.__icv
+
+ def get_msdu(self):
+ """Get the MSDU.
+ The MSDU is a Python string.
+ """
+ return self.__msdu
+
+ def get_type(self):
+ """This function returns the MAC Frame object type into a Python string.
+ """
+ return MPDU_TYPES[1]
+
+ def fill_mpdu_attr(self, fc_mode, short_ppdu, mod):
+ """Set the MPDU attributes from the MAC Frame to send.
+ """
+ # Set ATS or Confounder, and computes the MFT of the MAC Frame Header
+ if self.__ats != None and self.__confounder != None:
+ raise MACFrameSendError("Cannot send the ATS AND the Confounder")
+ elif self.__ats == None and self.__confounder == None:
+ # Ethernet frame without ATS => MFT = 0b01
+ ats_confounder = ''
+ mft = 0x01
+ elif self.__ats != None:
+ # Ethernet frame with ATS => MFT = 0b10
+ ats_confounder = self.__ats
+ mft = 0x02
+ elif self.__confounder != None:
+ # MME => MFT = 0b11
+ ats_confounder = self.__confounder
+ mft = 0x03
+
+ # Set ICV
+ if self.get_icv() is None:
+ # The 32-bit CRC must be calculated
+ self.__icv = htohp32(crc32(self.__msdu))
+
+ if self.get_macframeheader() is None\
+ or (type(self.get_macframeheader()) is str and hptoh16(self.get_macframeheader()) == 0):
+ # Set the MFT and the MFL of the MAC Frame Header
+ # "MAC Frame Length (MFL) is a 14-bit field that specifies the MAC Frame length in octets,
+ # excluding the 2-octet MAC Frame Header field and the 4-octet ICV, but including the ATS or
+ # counfounder (if either is present). A value of 0x0000 indicates a length of 1 octet, and so on."
+ if len(ats_confounder + self.__msdu) >= 1:
+ mfl = len(ats_confounder + self.__msdu) - 1
+ else:
+ mfl = 0
+ self.set_macframeheader(MACFrameHeader(MFT=mft, MFL=mfl))
+
+ # Set the MPDU payload
+ self.payload = self.__macframeheader + ats_confounder + self.__msdu + self.__icv
+
+ # Set the MAC Frame Boundary Offset
+ self.mfbo = (0, 0)
+
+ # Set PHY attributes
+ self.fc_mode = fc_mode
+ self.short_ppdu = short_ppdu
+ self.mod = mod
diff --git a/cesar/maximus/python/maximus/macframe/macframeheader.py b/cesar/maximus/python/maximus/macframe/macframeheader.py
new file mode 100644
index 0000000000..e0ce5b1014
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/macframeheader.py
@@ -0,0 +1,80 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.utils.exception import OutOfRangeError, MACFrameSendError
+from maximus.utils.format import *
+
+# Constants to check arguments validity
+MAX_VALUE_OF_MFT = 0x03 # MFT is coded on 2 bits (max value is 0b11)
+MAX_VALUE_OF_MFL = 0x3FFF # MFL is coded on 14 bits
+
+# Constant for 'self.get()' function
+size_of_mft = 2 # in bits
+
+class MACFrameHeader:
+ """The MAC Frame Header is composed of the 2 following fields:
+ MFT (2-bit LSB)
+ MFL (14-bit MSB)
+ """
+ def __init__(self, MFT=0, MFL=0):
+ self.set_mft(MFT)
+ self.set_mfl(MFL)
+
+ def set_mft(self, mft):
+ """Set the MFT.
+ The MFT must be a Python integer (decimal or hexadecimal value).
+ """
+ if mft <= MAX_VALUE_OF_MFT and mft >= 0:
+ self.__mft = mft
+ else:
+ raise OutOfRangeError("MFT")
+
+ def set_mfl(self, mfl):
+ """Set the MFL.
+ The MFL must be a Python integer (decimal or hexadecimal value).
+ """
+ if mfl <= MAX_VALUE_OF_MFL and mfl >= 0:
+ self.__mfl = mfl
+ else:
+ raise OutOfRangeError("MFL")
+
+ def get_mft(self):
+ """Get the MFT.
+ The MFT is a Python integer.
+ """
+ return self.__mft
+
+ def get_mfl(self):
+ """Get the MFL.
+ The MFL is a Python integer.
+ """
+ return self.__mfl
+
+ def set(self, mft, mfl):
+ """This function computes the MAC Frame Header fields if they are not set.
+ """
+ # Check MFT
+ if self.get_mft() == 0:
+ self.set_mft(mft)
+ elif self.get_mft() != mft:
+ raise MACFrameSendError("Incoherent MFT")
+ # Check MFL
+ if self.get_mfl() == 0:
+ self.set_mfl(mfl)
+ elif self.get_mfl() != mfl:
+ raise MACFrameSendError("Incoherent MFL")
+
+ def get(self):
+ """This function returns the MAC Frame Header into a string
+ of length equals to sizeof(u16).
+ """
+ header = (self.get_mfl() << size_of_mft) + self.get_mft()
+ return htohp16(header)
+
+ def display(self):
+ """This function displays the MAC Frame Header in hexadecimal values.
+ """
+ print "display the MAC Frame Header"
+ print "MFT =", hex(self.get_mft())
+ print "MFL =", hex(self.get_mfl())
diff --git a/cesar/maximus/python/maximus/macframe/macframequeue.py b/cesar/maximus/python/maximus/macframe/macframequeue.py
new file mode 100644
index 0000000000..9008d58966
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/macframequeue.py
@@ -0,0 +1,90 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.macframe.fc_av import FC_AV
+from maximus.macframe.macframe import MAX_SIZE_OF_MACFRAME
+from maximus.macframe.mpdu import SIZE_OF_IV, SIZE_OF_NEK, SIZE_OF_PB520, MAX_PB_NB_PER_MPDU, MPDU_TYPES, MPDU
+from maximus.utils.exception import OutOfRangeError
+
+MAX_SIZE_OF_LIST = (SIZE_OF_PB520*MAX_PB_NB_PER_MPDU + (MAX_SIZE_OF_MACFRAME - 1)) / MAX_SIZE_OF_MACFRAME # 80 elements
+
+class MACFrameQueue(MPDU):
+ """The MAC Frame Queue is composed of the following field:
+ macframelist - a Python list composed of 80 MAC Frames maximum
+ """
+ def __init__(self, FC_10=None, FC_AV=FC_AV(), iv=SIZE_OF_IV*'0', nek=SIZE_OF_NEK*'0', PBHeader=0, macframelist=None):
+
+ # Set FC 1.0, FC AV, IV, NEK, first PB Header, and list
+ self.set_fc_10(FC_10)
+ self.set_fc_av(FC_AV)
+ self.set_iv(iv)
+ self.set_nek(nek)
+ self.set_first_pb_header(first_pb_header=PBHeader)
+ self.set_macframelist(macframelist)
+
+ def set_macframelist(self, macframelist):
+ """Set the list of MAC Frames.
+ The list of MAC Frames must be a Python list composed of 80 MAC Frames maximum.
+ """
+ if macframelist is None:
+ self.__macframelist = []
+ elif type(macframelist) is list:
+ if len(macframelist) <= MAX_SIZE_OF_LIST:
+ self.__macframelist = macframelist
+ else:
+ raise OutOfRangeError("List of MAC Frames too long")
+ else:
+ raise OutOfRangeError("List of MAC Frames")
+
+ def add(self, frame):
+ """Add a MAC Frame or a list of MAC Frames to the list of MAC Frames.
+ The frame must be a MAC Frame,
+ or a Python list of MAC Frames.
+ """
+ try:
+ # frame is a MAC Frame object
+ if frame.get_type() is MPDU_TYPES[1]:
+ if len(self.get_macframelist()) + 1 <= MAX_SIZE_OF_LIST:
+ self.get_macframelist().append(frame)
+ else:
+ raise OutOfRangeError("List of MAC Frames too long")
+ except AttributeError:
+ if type(frame) is list:
+ if len(self.get_macframelist()) + len(frame) <= MAX_SIZE_OF_LIST:
+ self.get_macframelist().extend(frame)
+ else:
+ raise OutOfRangeError("List of MAC Frames too long")
+ else:
+ raise OutOfRangeError("List of MAC Frames")
+
+ def get_macframelist(self):
+ """Get the list of MAC Frames.
+ The list of MAC Frames is a Python list composed of 80 MAC Frames maximum.
+ """
+ return self.__macframelist
+
+ def get_type(self):
+ """This function returns the MAC Frame Queue object type into a Python string.
+ """
+ return MPDU_TYPES[2]
+
+ def fill_mpdu_attr(self, fc_mode, short_ppdu, mod):
+ """Set the MPDU attributes from the MAC Frame Queue to send.
+ """
+
+ self.payload = ''
+ self.mfbo = 0,
+ for i in range (len(self.get_macframelist())):
+ # Set the MPDU payload
+ frame = self.get_macframelist().pop(0)
+ frame.fill_mpdu_attr(fc_mode, short_ppdu, mod)
+ self.payload += frame.payload
+ # Set the MAC Frame Boundary Offset
+ self.mfbo += len(frame.payload),
+ self.mfbo += 0,
+
+ # Set PHY attributes
+ self.fc_mode = fc_mode
+ self.short_ppdu = short_ppdu
+ self.mod = mod
diff --git a/cesar/maximus/python/maximus/macframe/mpdu.py b/cesar/maximus/python/maximus/macframe/mpdu.py
new file mode 100644
index 0000000000..88806ff8de
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/mpdu.py
@@ -0,0 +1,187 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.macframe.fc_10 import FC_10
+from maximus.macframe.fc_av import FC_AV
+from maximus.macframe.pbheader import PBHeader
+from maximus.utils.exception import OutOfRangeError
+from maximus.utils.format import *
+from interface import *
+
+# Constants to check arguments validity
+
+SIZE_OF_FC_10 = SIZE_OF_U32 # in octets
+MAX_VALUE_OF_FC_10 = MAX_VALUE_OF_U32
+SIZE_OF_FC_AV = 4 * SIZE_OF_U32 # in octets
+SIZE_OF_IV = 3 * SIZE_OF_U32 # in octets
+SIZE_OF_NEK = 4 * SIZE_OF_U32 # in octets
+
+SIZE_OF_PB136 = 128 # in octets
+SIZE_OF_PB520 = 512 # in octets
+MAX_PB_NB_PER_MPDU = 236
+
+# MPDU object type
+MPDU_TYPES = ['PHY_TYPE_NONE',\
+ 'PHY_TYPE_MACFrame',\
+ 'PHY_TYPE_MACFrameQueue',\
+ 'PHY_TYPE_MPDU_PAYLOAD']
+
+class MPDU:
+ """The MPDU is composed of the 5 following fields:
+ FC_10 (4-octet)
+ FC_AV (16-octet)
+ iv (12-octet)
+ nek (16-octet)
+ first PB Header (4-octet)
+ """
+ def set_fc_10(self, fc_10):
+ """Set the FC 1.0 (FC 1.0 is optional).
+ The FC 1.0 can be an FC 1.0 object,
+ a Python long (decimal or hexadecimal value),
+ or a Python string of length equals to sizeof(u32).
+ """
+ if fc_10 != None:
+ try:
+ # FC 1.0 is an FC 1.0 object
+ self.fc_10 = fc_10.get() # set FC 1.0 into a Python long (u32)
+ except AttributeError:
+ try:
+ if len(fc_10) == SIZE_OF_FC_10:
+ # FC 1.0 is a Python string of length equals to sizeof(u32)
+ self.fc_10 = hptoh32(fc_10) # set FC 1.0 into a Python long (u32)
+ else:
+ raise OutOfRangeError("FC 1.0")
+ except TypeError:
+ # FC 1.0 is a Python long
+ if fc_10 <= MAX_VALUE_OF_FC_10 and fc_10 >= 0:
+ self.fc_10 = fc_10
+ else:
+ raise OutOfRangeError("FC 1.0")
+ else:
+ self.fc_10 = 0
+
+ def set_fc_av(self, fc_av):
+ """Set the FC AV.
+ The FC AV can be an FC AV object,
+ a Python string of length equals to 4 * sizeof(u32),
+ or a tuple of 4 Python longs (u32).
+ """
+ try:
+ # FC AV is an FC AV object
+ self.fc_av = fc_av.get() # set FC AV into a tuple of 4 Python longs (u32)
+ except AttributeError:
+ if type(fc_av) is str:
+ if len(fc_av) == SIZE_OF_FC_AV:
+ # FC AV is a Python string of length equals to 4 * sizeof(32)
+ self.fc_av = unpack(hp + 4 * u32, fc_av) # set FC AV into a tuple of 4 Python longs (u32)
+ else:
+ raise OutOfRangeError("FC AV")
+ elif type(fc_av) is tuple:
+ if len(fc_av) == 4:
+ # FC AV is a tuple of 4 Python longs (u32)
+ self.fc_av = fc_av
+ else:
+ raise OutOfRangeError("FC AV")
+ else:
+ raise OutOfRangeError("FC AV")
+
+ def set_iv(self, iv):
+ """Set the IV.
+ IV must be a Python string of length equals to 3 * sizeof(u32).
+ """
+ if len(iv) == SIZE_OF_IV:
+ self.iv = iv
+ else:
+ raise OutOfRangeError("IV")
+
+ def set_nek(self, nek):
+ """Set the NEK.
+ NEK must be a Python string of length equals to 4 * sizeof(u32).
+ """
+ if len(nek) == SIZE_OF_NEK:
+ self.nek = nek
+ else:
+ raise OutOfRangeError("NEK")
+
+ def set_first_pb_header(self, first_pb_header, mmqf=False):
+ """Set the first PB Header.
+ The first PB Header can be a PB Header object,
+ or a Python long (decimal or hexadecimal value).
+ The MMQF must be a Python boolean.
+ """
+ if type(first_pb_header) is int or type(first_pb_header) is long:
+ # First PB Header is a Python long (u32)
+ if first_pb_header >=0 and first_pb_header <= MAX_VALUE_OF_U32:
+ self.first_pb_header = first_pb_header
+ else:
+ raise OutOfRangeError("First PB Header")
+ else:
+ try:
+ # First PB Header is a PB Header object
+ first_pb_header.set_mmqf(mmqf)
+ self.first_pb_header = first_pb_header.get()
+ except AttributeError:
+ raise TypeError("First PB Header")
+
+ def get_fc_10(self):
+ """Get the FC 1.0.
+ The FC 1.0 is a Python long (u32).
+ """
+ return self.fc_10
+
+ def get_fc_av(self):
+ """Get the FC AV.
+ The FC AV is a tuple of 4 Python longs (u32).
+ """
+ return self.fc_av
+
+ def get_iv(self):
+ """Get the IV.
+ IV is a string of length equals to 3 * sizeof(u32).
+ """
+ return self.iv
+
+ def get_nek(self):
+ """Get the NEK.
+ NEK is a string of length equals to 4 * sizeof(u32).
+ """
+ return self.nek
+
+ def get_first_pb_header(self):
+ """Get the first PB Header.
+ The first PB Header is a Python long (u32).
+ """
+ return self.first_pb_header
+
+ def set_mpdu_attr(self, fc_10, fc_av, payload):
+ """Set the MPDU attributes from the received MPDU.
+ """
+
+ def sendnrecv(self, maximus, fc_mode=4, short_ppdu=0, mod=4, file=None, timeout=None, filter=None, count=1):
+ """This function sends the MPDU synchronously.
+ """
+ from maximus.simu.rx import recv
+ # Set MPDU attributes for Maximus
+ self.fill_mpdu_attr(fc_mode, short_ppdu, mod)
+ # Request to Maximus to send the MPDU synchronously
+ maximus.send_mpdu(self)
+ # Return the received MAC Frame(s)
+ return recv(maximus, timeout=timeout, filter=filter, count=count)
+
+ def send(self, maximus, fc_mode=4, short_ppdu=0, mod=4, file=None):
+ """This function sends the MPDU asynchronously.
+ """
+ # Set MPDU attributes for Maximus
+ self.fill_mpdu_attr(fc_mode, short_ppdu, mod)
+ # Request to Maximus to send the MPDU asynchronously
+ maximus.send_mpdu(self)
+
+ def get_type(self):
+ """This function returns the MPDU object type into a Python string.
+ """
+ return MPDU_TYPES[0] # 'PHY_TYPE_NONE'
+
+ def fill_mpdu_attr(self, fc_mode, short_ppdu, mod):
+ """Set the MPDU attributes from the MPDU to send.
+ """
diff --git a/cesar/maximus/python/maximus/macframe/msdu.py b/cesar/maximus/python/maximus/macframe/msdu.py
new file mode 100644
index 0000000000..26d8997c5d
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/msdu.py
@@ -0,0 +1,66 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.utils.format import *
+
+# Constants to check arguments validity
+MIN_SIZE_OF_MSDU = 60 # in octets
+MAX_SIZE_OF_MSDU = 1518 # in octets
+
+# MSDU object type
+MSDU_TYPES = ['ETHERNET_TYPE_NONE',\
+ 'ETHERNET_TYPE_DATA',\
+ 'ETHERNET_TYPE_MME',\
+ 'ETHERNET_TYPE_DATA_BUFFER_ADD',\
+ 'ETHERNET_TYPE_MME_BUFFER_ADD',\
+ 'ETHERNET_TYPE_INTERFACE_BUFFER_ADD',\
+ 'ETHERNET_TYPE_BUFFER_RELEASED',\
+ 'ETHERNET_TYPE_SNIFFER']
+
+class MSDU:
+
+ def set_msdu_attr(self, payload):
+ """This function sets the MSDU attributes from the received Ethernet Frame.
+ """
+
+ def sendnrecv(self, maximus, station, file=None, timeout=None, filter=None, count=1):
+ """This function sends the MSDU synchronously.
+ """
+ from maximus.simu.rx import recv
+ # Request to Maximus to send the MSDU synchronously
+ while not station.is_idle():
+ maximus.process()
+ maximus.send_msdu(self, station.get_station_id())
+ # Return the received Ethernet Frame(s)
+ return recv(maximus, timeout=timeout, filter=filter, count=count)
+
+ def send(self, maximus, station, file=None):
+ """This function sends the MSDU asynchronously.
+ """
+ # Request to Maximus to send the MSDU asynchronously
+ while not station.is_idle():
+ maximus.process()
+ maximus.send_msdu(self, station.get_station_id())
+
+ def get(self):
+ """This function returns the MSDU object into a string.
+ """
+
+ def get_ether_type(self):
+ """This function returns the MSDU object type into a Python integer (u8).
+ """
+ return 0
+
+ def get_type(self):
+ """This function returns the MSDU object type into a Python string.
+ """
+ return MSDU_TYPES[self.get_ether_type()] # 'ETHERNET_TYPE_NONE'
+
+ def pad(self, length):
+ """This function adds padding to the MSDU.
+ """
+ pad = ''
+ for i in range (0, length):
+ pad += htohp8(0)
+ return pad
diff --git a/cesar/maximus/python/maximus/macframe/pb.py b/cesar/maximus/python/maximus/macframe/pb.py
new file mode 100644
index 0000000000..3ff0df41f9
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/pb.py
@@ -0,0 +1,59 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.macframe.mpdu import SIZE_OF_PB136, SIZE_OF_PB520, MPDU_TYPES, MPDU
+from maximus.utils.exception import OutOfRangeError
+
+class PB(MPDU):
+ """The PB is composed of the following field:
+ pblist - a Python list composed of 236 PBs maximum
+ """
+ def __init__(self):
+ self.__pblist = []
+
+ def __set_pblist(self, payload):
+ """Set the list of received PBs.
+ The payload must be a Python string.
+ """
+ if payload is None:
+ self.__pblist = []
+ elif len(payload) == SIZE_OF_PB136:
+ self.__pblist.append(payload)
+ elif len(payload) % SIZE_OF_PB520 == 0:
+ for i in range(0,len(payload)/SIZE_OF_PB520):
+ self.__pblist.append(payload[i*SIZE_OF_PB520:min((i+1)*SIZE_OF_PB520, len(payload))])
+ else:
+ raise OutOfRangeError("List of PBs")
+
+ def get_pblist(self):
+ """Get the list of received PBs.
+ The list of PBs is a Python list of Python strings.
+ """
+ return self.__pblist
+
+ def get_type(self):
+ """This function returns the PB object type into a Python string.
+ """
+ return MPDU_TYPES[3]
+
+ def set_mpdu_attr(self, fc_10, fc_av, payload):
+ """Set the MPDU attributes from the received MPDU.
+ """
+ # Set FC 1.0
+ if type(fc_10) is not int:
+ raise OutOfRangeError("FC 1.0")
+ else:
+ self.set_fc_10(fc_10)
+
+ # Set FC AV
+ if type(fc_av) is not tuple:
+ raise OutOfRangeError("FC AV")
+ else:
+ self.set_fc_av(fc_av)
+
+ # Set list of PBs
+ if type(payload) is not str:
+ raise OutOfRangeError("Payload")
+ else:
+ self.__set_pblist(payload)
diff --git a/cesar/maximus/python/maximus/macframe/pbheader.py b/cesar/maximus/python/maximus/macframe/pbheader.py
new file mode 100644
index 0000000000..9b9c65ef40
--- /dev/null
+++ b/cesar/maximus/python/maximus/macframe/pbheader.py
@@ -0,0 +1,95 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.utils.exception import OutOfRangeError
+from maximus.utils.format import MAX_VALUE_OF_U16, SIZE_OF_U16
+
+# Constants to check arguments validity
+MAX_VALUE_OF_SSN = MAX_VALUE_OF_U16
+MAX_VALUE_OF_MFBO = 0x1FF
+MAX_VALUE_OF_RSVD = 0x7
+
+# Constants for 'self.get()' function
+size_of_ssn = 8 * SIZE_OF_U16 # in bits
+size_of_mfbo = 9 # in bits
+
+class PBHeader:
+ """The PB is composed of the 8 following fields:
+ SSN (16 bits) - a Python integer
+ MFBO (9 bits) - a Python integer
+ VPBF (1 bit) - a Python boolean
+ MMQF (1 bit) - a Python boolean
+ MFBF (1 bit) - a Python boolean
+ OPSF (1 bit) - a Python boolean
+ RSVD (3 bits) - a Python integer
+ """
+ def __init__(self, SSN=0, MFBO=0, VPBF=True, MMQF=False, MFBF=True, OPSF=False, RSVD=0):
+
+ # Set first Segment Sequence Number
+ if type(SSN) is int:
+ if SSN >=0 and SSN <= MAX_VALUE_OF_SSN:
+ self.__ssn = SSN
+ else:
+ raise OutOfRangeError("SSN")
+ else:
+ raise TypeError("SSN")
+
+ # Set MAC Frame Boundary Offset
+ if type(MFBO) is int:
+ if MFBO >=0 and MFBO <= MAX_VALUE_OF_MFBO:
+ self.__mfbo = MFBO
+ else:
+ raise OutOfRangeError("MFBO")
+ else:
+ raise TypeError("MFBO")
+
+ # Set Valid PHY Block Flag
+ if type(VPBF) is bool:
+ self.__vpbf = VPBF
+ else:
+ raise TypeError("VPBF")
+
+ # Set Management Message Queue Flag
+ if type(MMQF) is bool:
+ self.__mmqf = MMQF
+ else:
+ raise TypeError("MMQF")
+
+ # Set MAC Frame Boundary Flag
+ if type(MFBF) is bool:
+ self.__mfbf = MFBF
+ else:
+ raise TypeError("MFBF")
+
+ # Set Oldest Pending Segment Flag
+ if type(OPSF) is bool:
+ self.__opsf = OPSF
+ else:
+ raise TypeError("OPSF")
+
+ # Set Reserved
+ if type(RSVD) is int:
+ if RSVD >=0 and RSVD <= MAX_VALUE_OF_RSVD:
+ self.__rsvd = RSVD
+ else:
+ raise OutOfRangeError("RSVD")
+ else:
+ raise TypeError("RSVD")
+
+ def set_mmqf(self, mmqf):
+ """Sets the Management Message Queue Flag.
+ The MMQF must be a Python boolean.
+ """
+ self.__mmqf = mmqf
+
+ def get(self):
+ """This function returns the PB Header into an u32.
+ """
+ return (self.__rsvd << (size_of_ssn + size_of_mfbo + 4)) +\
+ (int(self.__opsf) << (size_of_ssn + size_of_mfbo + 3)) +\
+ (int(self.__mfbf) << (size_of_ssn + size_of_mfbo + 2)) +\
+ (int(self.__mmqf) << (size_of_ssn + size_of_mfbo + 1)) +\
+ (int(self.__vpbf) << (size_of_ssn + size_of_mfbo)) +\
+ (self.__mfbo << size_of_ssn) +\
+ self.__ssn
diff --git a/cesar/maximus/python/maximus/mme/__init__.py b/cesar/maximus/python/maximus/mme/__init__.py
new file mode 100644
index 0000000000..a1178d6a80
--- /dev/null
+++ b/cesar/maximus/python/maximus/mme/__init__.py
@@ -0,0 +1,10 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["create", "mme", "mmentry", "mmheader", "mmtype"]
+
+from mme import MME
+from mmentry import MMEntry
+from mmheader import MMHeader
+from mmtype import *
diff --git a/cesar/maximus/python/maximus/mme/create.py b/cesar/maximus/python/maximus/mme/create.py
new file mode 100644
index 0000000000..5ddb4e7725
--- /dev/null
+++ b/cesar/maximus/python/maximus/mme/create.py
@@ -0,0 +1,10 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.mme.mme import MME
+
+def create_mme():
+ """This function creates and returns a new MME object.
+ """
+ return MME()
diff --git a/cesar/maximus/python/maximus/mme/mme.py b/cesar/maximus/python/maximus/mme/mme.py
new file mode 100644
index 0000000000..b4dcdb5326
--- /dev/null
+++ b/cesar/maximus/python/maximus/mme/mme.py
@@ -0,0 +1,130 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.mme.mmentry import MAX_SIZE_OF_MMENTRY, MMEntry
+from maximus.mme.mmheader import MMHeader, MIN_SIZE_OF_MMHEADER, MAX_SIZE_OF_MMHEADER,\
+ SIZE_OF_ODA, SIZE_OF_OSA,\
+ SIZE_OF_VLANTAG, MIN_VALUE_OF_VLANTAG, MAX_VALUE_OF_VLANTAG
+from maximus.macframe.msdu import MIN_SIZE_OF_MSDU, MSDU_TYPES, MSDU
+from maximus.utils.exception import OutOfRangeError
+from maximus.utils.format import ntoh32
+
+# Define an empty MME structure for Maximus
+class MMEStruct:
+ """The MME structure is composed of the 2 following fields:
+ header - a Python string of length equals to 23 octets
+ entry - a Python string of length smaller than 1518 octets
+ """
+ pass
+
+class MME(MSDU):
+ """The MME is composed of the 2 following fields:
+ MMHeader (23-octet)
+ MMEntry
+ """
+ def __init__(self, MMHeader=MMHeader(), MMEntry=MMEntry()):
+
+ # Create an MME structure for Maximus
+ self.__mme = MMEStruct()
+
+ self.set_mmheader(MMHeader)
+ self.set_mmentry(MMEntry)
+
+ def set_mmheader(self, mmheader):
+ """Set the MM Header.
+ The MM Header can be an MM Header object,
+ or a Python string of length equals to 19 or 23 octets.
+ """
+ self.__mmheader = mmheader
+ try:
+ # MM Header is an MM Header object
+ self.__mme.header = mmheader.get() # set MM Header into a Python string of length equals to 23 octets
+ except AttributeError:
+ if len(mmheader) == MIN_SIZE_OF_MMHEADER or len(mmheader) == MAX_SIZE_OF_MMHEADER:
+ # MM Header is a Python string of length equals to 19 or 23 octets
+ self.__mme.header = mmheader
+ else:
+ raise OutOfRangeError("MM Header")
+
+ def set_mmentry(self, mmentry):
+ """Set the MM Entry.
+ The MM Entry can be an MM Entry object,
+ or a Python string of length smaller than (1518 - 23) octets.
+ """
+ self.__mmentry = mmentry
+ try:
+ # MM Entry is an MM Entry object
+ self.__mme.entry = mmentry.get() # set MM Entry into a Python string of length smaller than (1518 - 23) octets
+ except AttributeError:
+ if len(mmentry) <= MAX_SIZE_OF_MMENTRY:
+ # MM Entry is a Python string of length smaller than (1518 - 23) octets
+ self.__mme.entry = mmentry
+ else:
+ raise OutOfRangeError("MM Entry too long")
+
+ def set_msdu_attr(self, payload):
+ """Set the MME attributes from the received Ethernet Frame.
+ """
+ # Check VLAN Tag
+ begin = SIZE_OF_ODA + SIZE_OF_OSA
+ end = begin + SIZE_OF_VLANTAG
+ if ntoh32(payload[begin:end]) <= MAX_VALUE_OF_VLANTAG\
+ and ntoh32(payload[begin:end]) >= MIN_VALUE_OF_VLANTAG:
+ # There is a VLAN Tag
+ end = MAX_SIZE_OF_MMHEADER
+ else:
+ # There is no VLAN Tag
+ end = MIN_SIZE_OF_MMHEADER
+
+ # Set MM Header
+ begin = 0
+ self.set_mmheader(payload[begin:end])
+
+ # Set MM Entry
+ begin = end
+ end = len(payload)
+ self.set_mmentry(payload[begin:end])
+
+ def get_mmheader(self):
+ """Get the MM Header.
+ The MM Header can be an MM Header object,
+ or a Python string of length equals to 23 octets.
+ """
+ return self.__mmheader
+
+ def get_mmentry(self):
+ """Get the MM Entry.
+ The MM Entry can be an MM Entry object,
+ or a Python string of length smaller than 1518 octets.
+ """
+ return self.__mmentry
+
+ def get(self):
+ """This function returns the MME into a string.
+ """
+ length = len(self.__mme.header) + len(self.__mme.entry)
+ mmepad = self.pad(MIN_SIZE_OF_MSDU - length)
+ mme = self.__mme.header + self.__mme.entry + mmepad
+ return mme
+
+ def get_ether_type(self):
+ """This function returns the MME type into a Python integer (uint8_t).
+ """
+ type = 0
+ for i, j in enumerate(MSDU_TYPES):
+ if j == self.get_type():
+ type = i
+ return type # 2
+
+ def get_type(self):
+ """This function returns the MME type into a Python string.
+ """
+ return MSDU_TYPES[2] # 'ETHERNET_TYPE_MME'
+
+ def display(self):
+ """This function displays the MME in strings.
+ """
+ print "display the MME"
+ print "MM Header =", self.__mme.header
+ print "MM Entry =", self.__mme.entry
diff --git a/cesar/maximus/python/maximus/mme/mmentry.py b/cesar/maximus/python/maximus/mme/mmentry.py
new file mode 100644
index 0000000000..7d69dd0817
--- /dev/null
+++ b/cesar/maximus/python/maximus/mme/mmentry.py
@@ -0,0 +1,33 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.mme.mmheader import MIN_SIZE_OF_MMHEADER
+from maximus.macframe.msdu import MAX_SIZE_OF_MSDU
+from maximus.utils.exception import OutOfRangeError
+
+# Constants to check arguments validity
+MAX_SIZE_OF_MMENTRY = MAX_SIZE_OF_MSDU - MIN_SIZE_OF_MMHEADER
+MAX_SIZE_OF_DATA = MAX_SIZE_OF_MMENTRY
+
+class MMEntry:
+
+ def __init__(self, data=''):
+ self.set_data(data)
+
+ def set_data(self, data):
+ """Set Data.
+ Data must be a Python string of length smaller than 1518 octets.
+ """
+ self.__data = data
+ if len(data) > MAX_SIZE_OF_DATA:
+ raise OutOfRangeError("Data")
+
+ def get_data(self):
+ """Get Data.
+ Data must be a Python string of length smaller than 1518 octets.
+ """
+ return self.__data
+
+ def get(self):
+ return self.get_data()
diff --git a/cesar/maximus/python/maximus/mme/mmheader.py b/cesar/maximus/python/maximus/mme/mmheader.py
new file mode 100644
index 0000000000..01588973c0
--- /dev/null
+++ b/cesar/maximus/python/maximus/mme/mmheader.py
@@ -0,0 +1,298 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.utils.exception import OutOfRangeError
+from maximus.utils.format import *
+
+# Constants to check arguments validity
+MIN_SIZE_OF_MMHEADER = 19 # in octets
+MAX_SIZE_OF_MMHEADER = 23 # in octets
+SIZE_OF_ODA = SIZE_OF_U48
+MAX_VALUE_OF_ODA = MAX_VALUE_OF_U48
+SIZE_OF_OSA = SIZE_OF_ODA
+MAX_VALUE_OF_OSA = MAX_VALUE_OF_ODA
+MIN_VALUE_OF_VLANTAG = 0x81000000
+MAX_VALUE_OF_VLANTAG = 0x8100FFFF
+SIZE_OF_MTYPE = SIZE_OF_U16
+MAX_VALUE_OF_MTYPE = MAX_VALUE_OF_U16
+SIZE_OF_VLANTAG = SIZE_OF_U32
+SIZE_OF_MMV = SIZE_OF_U8
+MAX_VALUE_OF_MMV = MAX_VALUE_OF_U8
+SIZE_OF_MMTYPE = SIZE_OF_U16
+MAX_VALUE_OF_MMTYPE = MAX_VALUE_OF_U16
+SIZE_OF_FMI = SIZE_OF_U16
+MAX_VALUE_OF_FMI = MAX_VALUE_OF_U16
+
+# Define an empty MM Header structure for Maximus
+class MMHeaderStruct:
+ """The MME structure is composed of the 7 following fields:
+ oda - a Python string of length equals to 6 octets
+ osa - a Python string of length equals to 6 octets
+ vlantag (optional) - a Python string of length equals to 4 octets
+ mtype - a Python string of length equals to 2 octets
+ mmv - a Python string of length equals to 1 octet
+ mmtype - a Python string of length equals to 2 octets
+ fmi - a Python string of length equals to 2 octets
+ """
+ pass
+
+class MMHeader:
+
+ def __init__(self, ODA=MAX_VALUE_OF_ODA, OSA=0, VLANTag=None, MTYPE=0x88e1, MMV=0, MMTYPE=0, FMI=0):
+
+ # Create an MME structure for Maximus
+ self.__mmheader = MMHeaderStruct()
+
+ self.set_oda(ODA)
+ self.set_osa(OSA)
+ self.set_vlantag(VLANTag)
+ self.set_mtype(MTYPE)
+ self.set_mmv(MMV)
+ self.set_mmtype(MMTYPE)
+ self.set_fmi(FMI)
+
+ def set_oda(self, oda):
+ """Set the ODA.
+ The ODA can be a Python tuple of 6 Python integers,
+ a Python long (decimal or hexadecimal value),
+ a Python string of length equals to 6 octets,
+ or a Python string of length equals to 17 octets.
+ """
+ self.__oda = oda
+ if type(oda) is str:
+ if len(oda) == 3 * SIZE_OF_ODA - 1:
+ # ODA is a Python string of length equals to 17 octets ('XX:XX:XX:XX:XX:XX')
+ if oda.count(':') == SIZE_OF_ODA - 1:
+ self.__mmheader.oda = pack(n + u64, int(oda.replace(':',''), 16))[SIZE_OF_U16:]
+ else:
+ raise OutOfRangeError("ODA")
+ elif len(oda) == SIZE_OF_ODA:
+ # ODA is a Python string of length equals to 6 octets
+ self.__mmheader.oda = oda
+ else:
+ raise OutOfRangeError("ODA")
+ elif type(oda) is long or type(oda) is int:
+ # ODA is a Python long
+ if oda <= MAX_VALUE_OF_ODA and oda >= 0:
+ self.__mmheader.oda = hton48(oda)
+ else:
+ raise OutOfRangeError("ODA")
+ elif type(oda) is tuple:
+ # ODA is a Python tuple
+ if len(oda) == SIZE_OF_ODA:
+ self.__mmheader.oda = hton48_tuple(oda)
+ else:
+ raise OutOfRangeError("ODA")
+ else:
+ raise TypeError("ODA")
+
+ def set_osa(self, osa):
+ """Set the OSA.
+ The OSA can be a Python tuple of 6 Python integers,
+ a Python long (decimal or hexadecimal value),
+ a Python string of length equals to 6 octets,
+ or a Python string of length equals to 17 octets.
+ """
+ self.__osa = osa
+ if type(osa) is str:
+ if len(osa) == 3 * SIZE_OF_OSA - 1:
+ # OSA is a Python string of length equals to 17 octets ('XX:XX:XX:XX:XX:XX')
+ if osa.count(':') == SIZE_OF_OSA - 1:
+ self.__mmheader.osa = pack(n + u64, int(osa.replace(':',''), 16))[SIZE_OF_U16:]
+ else:
+ raise OutOfRangeError("OSA")
+ elif len(osa) == SIZE_OF_OSA:
+ # OSA is a Python string of length equals to 6 octets
+ self.__mmheader.osa = osa
+ else:
+ raise OutOfRangeError("OSA")
+ elif type(osa) is long or type(osa) is int:
+ # OSA is a Python long
+ if osa <= MAX_VALUE_OF_OSA and osa >= 0:
+ self.__mmheader.osa = hton48(osa)
+ else:
+ raise OutOfRangeError("OSA")
+ elif type(osa) is tuple:
+ # OSA is a Python tuple
+ if len(osa) == SIZE_OF_OSA:
+ self.__mmheader.osa = hton48_tuple(osa)
+ else:
+ raise OutOfRangeError("OSA")
+ else:
+ raise TypeError("OSA")
+
+ def set_vlantag(self, vlantag):
+ """Set the VLAN Tag (VLAN Tag is optional).
+ The VLAN Tag can be a Python long (decimal or hexadecimal value),
+ or a Python string of length equals to 4 octets.
+ """
+ self.__vlantag = vlantag
+ if type(vlantag) is str:
+ if len(vlantag) == SIZE_OF_VLANTAG:
+ # VLAN Tag is a Python string of length equals to 4 octets
+ if ntoh32(vlantag) <= MAX_VALUE_OF_VLANTAG and ntoh32(vlantag) >= MIN_VALUE_OF_VLANTAG:
+ self.__mmheader.vlantag = vlantag
+ else:
+ raise OutOfRangeError("VLAN Tag")
+ else:
+ raise OutOfRangeError("VLAN Tag")
+ elif type(vlantag) is int or type(vlantag) is long:
+ # VLAN Tag is a Python long
+ if vlantag <= MAX_VALUE_OF_VLANTAG and vlantag >= MIN_VALUE_OF_VLANTAG:
+ self.__mmheader.vlantag = hton32(vlantag)
+ else:
+ raise OutOfRangeError("VLAN Tag")
+ elif vlantag is None:
+ self.__mmheader.vlantag = ''
+ else:
+ raise TypeError("VLAN Tag")
+
+ def set_mtype(self, mtype):
+ """Set the MTYPE.
+ The MTYPE can be a Python integer (decimal or hexadecimal value),
+ or a Python string of length equals to 2 octets.
+ """
+ self.__mtype = mtype
+ try:
+ if len(mtype) == SIZE_OF_MTYPE:
+ # MTYPE is a Python string of length equals to 2 octets
+ self.__mmheader.mtype = mtype
+ else:
+ raise OutOfRangeError("MTYPE")
+ except TypeError:
+ # MTYPE is a Python integer
+ if mtype <= MAX_VALUE_OF_MTYPE and mtype >= 0:
+ self.__mmheader.mtype = hton16(mtype)
+ else:
+ raise OutOfRangeError("MTYPE")
+
+ def set_mmv(self, mmv):
+ """Set the MMV.
+ The MMV can be a Python integer (decimal or hexadecimal value),
+ or a Python string of length equals to 1 octet.
+ """
+ self.__mmv = mmv
+ try:
+ if len(mmv) == SIZE_OF_MMV:
+ # MMV is a Python string of length equals to 1 octet
+ self.__mmheader.mmv = mmv
+ else:
+ raise OutOfRangeError("MMV")
+ except TypeError:
+ # MMV is a Python integer
+ if mmv <= MAX_VALUE_OF_MMV and mmv >= 0:
+ self.__mmheader.mmv = htohp8(mmv)
+ else:
+ raise OutOfRangeError("MMV")
+
+ def set_mmtype(self, mmtype):
+ """Set the MMTYPE.
+ The MMTYPE can be a Python integer (decimal or hexadecimal value),
+ or a Python string of length equals to 2 octets.
+ """
+ self.__mmtype = mmtype
+ if mmtype != None:
+ try:
+ if len(mmtype) == SIZE_OF_MMTYPE:
+ # MMTYPE is a Python string of length equals to 2 octets
+ self.__mmheader.mmtype = mmtype
+ else:
+ raise OutOfRangeError("MMTYPE")
+ except TypeError:
+ # MMTYPE is a Python integer
+ if mmtype <= MAX_VALUE_OF_MMTYPE and mmtype >= 0:
+ self.__mmheader.mmtype = htohp16(mmtype)
+ else:
+ raise OutOfRangeError("MMTYPE")
+
+ def set_fmi(self, fmi):
+ """Set the FMI.
+ The FMI can be a Python integer (decimal or hexadecimal value),
+ or a Python string of length equals to 2 octets.
+ """
+ self.__fmi = fmi
+ try:
+ if len(fmi) == SIZE_OF_FMI:
+ # FMI is a Python string of length equals to 2 octets
+ self.__mmheader.fmi = fmi
+ else:
+ raise OutOfRangeError("FMI")
+ except TypeError:
+ # FMI is a Python integer
+ if fmi <= MAX_VALUE_OF_FMI and fmi >= 0:
+ self.__mmheader.fmi = htohp16(fmi)
+ else:
+ raise OutOfRangeError("FMI")
+
+ def get_oda(self):
+ """Get the ODA.
+ The ODA can be a Python tuple of 6 Python integers,
+ a Python long (decimal or hexadecimal value),
+ a Python string of length equals to 6 octets,
+ or a Python string of length equals to 17 octets.
+ """
+ return self.__oda
+
+ def get_osa(self):
+ """Get the OSA.
+ The OSA can be a Python tuple of 6 Python integers,
+ a Python long (decimal or hexadecimal value),
+ a Python string of length equals to 6 octets,
+ or a Python string of length equals to 17 octets.
+ """
+ return self.__osa
+
+ def get_vlantag(self):
+ """Get the VLAN Tag (VLAN Tag is optional).
+ The VLAN Tag can be a Python long,
+ or a Python string of length equals to 4 octets.
+ """
+ return self.__vlantag
+
+ def get_mtype(self):
+ """Get the MTYPE.
+ The MTYPE can be a Python integer,
+ or a Python string of length equals to 2 octets.
+ """
+ return self.__mtype
+
+ def get_mmv(self):
+ """Get the MMV.
+ The MMV can be a Python integer,
+ or a Python string of length equals to 1 octet.
+ """
+ return self.__mmv
+
+ def get_mmtype(self):
+ """Get the MMTYPE.
+ The MMTYPE can be a Python integer,
+ or a Python string of length equals to 2 octets.
+ """
+ return self.__mmtype
+
+ def get_fmi(self):
+ """Get the FMI.
+ The FMI can be a Python integer,
+ or a Python string of length equals to 2 octets.
+ """
+ return self.__fmi
+
+ def get(self):
+ """This function returns the MM Header into a string.
+ """
+ mmheader = self.__mmheader.oda + self.__mmheader.osa + self.__mmheader.vlantag + self.__mmheader.mtype + self.__mmheader.mmv + self.__mmheader.mmtype + self.__mmheader.fmi
+ return mmheader
+
+ def display(self):
+ """This function displays the MM Header in hexadecimal values.
+ """
+ print "display the MM Header"
+ print "ODA =", hex(ntoh48(self.__mmheader.oda))
+ print "OSA =", hex(ntoh48(self.__mmheader.oda))
+ if self.get_vlantag() is not None:
+ print "VLAN Tag =", hex(ntoh16(self.__mmheader.vlantag))
+ print "MTYPE =", hex(ntoh16(self.__mmheader.mtype))
+ print "MMV =", hex(hptoh8(self.__mmheader.mmv))
+ print "MMTYPE =", hex(hptoh16(self.__mmheader.mmtype))
+ print "FMI =", hex(hptoh16(self.__mmheader.fmi))
diff --git a/cesar/maximus/python/maximus/mme/mmtype.py b/cesar/maximus/python/maximus/mme/mmtype.py
new file mode 100644
index 0000000000..bc4f978f48
--- /dev/null
+++ b/cesar/maximus/python/maximus/mme/mmtype.py
@@ -0,0 +1,20 @@
+#! usr/bin/env python
+
+#print __name__
+
+# MME name constants to compute MMTYPE
+DRV_STA_SET_MAC_ADDR = 0xA000
+DRV_STA_SET_CCO_PREF = 0xA004
+DRV_STA_SET_WAS_CCO = 0xA008
+DRV_STA_SET_NPW = 0xA00C
+DRV_STA_SET_DPW = 0xA010
+DRV_STA_SET_SL = 0xA014
+DRV_STA_SET_M_STA_HFID = 0xA018
+DRV_STA_SET_U_STA_HFID = 0xA01C
+DRV_STA_SET_AVLN_HFID = 0xA020
+DRV_STA_SET_TONEMASK = 0xA024
+DRV_STA_START = 0xA028
+DRV_STA_STOP = 0xA02C
+
+# MME types dictionnary to compute MMTYPE
+MME_TYPES = {'REQ':0x00, 'CNF':0x01, 'IND':0x02, 'RSP':0x03}
diff --git a/cesar/maximus/python/maximus/result/__init__.py b/cesar/maximus/python/maximus/result/__init__.py
new file mode 100644
index 0000000000..730e8c685d
--- /dev/null
+++ b/cesar/maximus/python/maximus/result/__init__.py
@@ -0,0 +1,5 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = []
diff --git a/cesar/maximus/python/maximus/simu/__init__.py b/cesar/maximus/python/maximus/simu/__init__.py
new file mode 100644
index 0000000000..abcdd28c01
--- /dev/null
+++ b/cesar/maximus/python/maximus/simu/__init__.py
@@ -0,0 +1,8 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["rx", "tx"]
+
+from rx import recv
+from tx import sendnrecv, send
diff --git a/cesar/maximus/python/maximus/simu/rx.py b/cesar/maximus/python/maximus/simu/rx.py
new file mode 100644
index 0000000000..d4257bf12a
--- /dev/null
+++ b/cesar/maximus/python/maximus/simu/rx.py
@@ -0,0 +1,136 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.ethernet.create import create_eth, create_buffer, create_sniffer
+from maximus.macframe.create import create_pb
+from maximus.mme.create import create_mme
+
+class GenericCallback:
+ """Following class permits to pre-register parameters for a function,
+ then call the function with registered parameters
+ followed by optional additional parameters precised during the real call.
+ """
+ def __init__(self, callback, *firstArgs):
+ self.__callback = callback
+ self.__firstArgs = firstArgs
+ def __call__(self, *args):
+ apply(self.__callback, self.__firstArgs + args)
+
+def cb(rx, frame):
+ """When a frame is received, check if it corresponds to user expectations.
+ If this is the case, add it to the RX received frame(s) list
+ and decrement the RX messages counter.
+ Return 'True' is the RX messages counter equals 0.
+ """
+ ended = False
+ if rx.call_filter_fc(frame):
+ rx.add_frame(frame)
+ rx.decr_counter()
+ if rx.get_counter() == 0:
+ ended = True
+ return ended
+
+class Rx:
+ """RX is an internal object for Maximus, to define the expected response.
+ """
+ def __init__(self, maximus, filter_fc=None, counter=0):
+ # Set RX attributes
+ self.set_filter_fc(filter_fc)
+ self.set_counter(counter)
+
+ # Set the received MAC Frame(s) list to its default value
+ self.__frame_list = None
+
+ # Set Maximus reception attributes
+ self.__maximus = maximus
+ self.__cb = GenericCallback(cb, self)
+ self.__maximus.set_mpdu_rx(self.__cb, create_pb)
+ self.__maximus.set_msdu_rx(self.__cb, create_eth, create_mme, create_buffer, create_sniffer)
+
+ def recv(self, timeout=None):
+ """This function only returns when the response defined by user is received,
+ i.e. when the messages counter equals 0,
+ or when the timeout expires.
+ The returned value is the received frame(s) list,
+ or None if timeout has expired before receiving any frame.
+ """
+ if timeout is None:
+ while self.get_counter() != 0:
+ self.__maximus.process()
+ elif type(timeout) is int or long and timeout >= 0:
+ # Calculate timeout tick value
+ timeout_tick_value = self.__maximus.get_date() + timeout
+ while self.get_counter() != 0 and self.__maximus.get_date() < timeout_tick_value:
+ self.__maximus.process()
+ else:
+ raise OutOfRangeError("Timeout")
+ return self.get_frame_list()
+
+ def set_filter_fc(self, filter_fc):
+ """Set the messages filter.
+ The messages filter must be a Python function taking a MAC Frame / MSDU object as argument,
+ returning 'True' if the received frame corresponds to the user expectations,
+ 'False' otherwise.
+ """
+ self.__filter_fc = filter_fc
+
+ def set_counter(self, counter):
+ """Set the messages counter.
+ The messages counter must be a Python integer.
+ """
+ if type(counter) is int and counter >= 0:
+ self.__counter = counter
+ else:
+ raise OutOfRangeError("Counter")
+
+ def decr_counter(self):
+ """When a message corresponding to the filter is received,
+ decrement the messages counter.
+ """
+ if self.get_counter() > 0:
+ self.__counter -= 1
+ else:
+ self.__counter = 0
+
+ def add_frame(self, frame):
+ """Add the received frame to the received frame(s) list.
+ The frame must be a MAC Frame / MSDU object.
+ """
+ if frame is None:
+ raise OutOfRangeError("Received frame")
+ if self.get_frame_list() is None:
+ self.__frame_list = [frame]
+ else:
+ self.__frame_list.append(frame)
+
+ def call_filter_fc(self, frame):
+ """This function calls the filter function with the received frame as argument,
+ and returns its result.
+ """
+ filter = True
+ if frame is None:
+ raise OutOfRangeError("Received frame")
+ elif self.__filter_fc is not None:
+ filter = self.__filter_fc(frame)
+ return filter
+
+ def get_counter(self):
+ """Get the messages counter.
+ The messages counter is a Python integer.
+ """
+ return self.__counter
+
+ def get_frame_list(self):
+ """Get the received frame(s) list.
+ The received frame(s) list is a list of (messages counter) received MAC Frame / MSDU object(s).
+ """
+ return self.__frame_list
+
+def recv(maximus, timeout=None, filter=None, count=1):
+ """This function waits for (count) specific frame(s) defined by user by the filter function.
+ """
+ # Create an RX object for frame(s) reception
+ rx = Rx(maximus, filter_fc=filter, counter=count)
+ # Return the received frame(s)
+ return rx.recv(timeout)
diff --git a/cesar/maximus/python/maximus/simu/tx.py b/cesar/maximus/python/maximus/simu/tx.py
new file mode 100644
index 0000000000..0e3f679531
--- /dev/null
+++ b/cesar/maximus/python/maximus/simu/tx.py
@@ -0,0 +1,9 @@
+#! usr/bin/env python
+
+#print __name__
+
+def sendnrecv(file, timeout=None, filter=None, count=1):
+ pass
+
+def send(file, count=1):
+ pass
diff --git a/cesar/maximus/python/maximus/station/__init__.py b/cesar/maximus/python/maximus/station/__init__.py
new file mode 100644
index 0000000000..87afe293ab
--- /dev/null
+++ b/cesar/maximus/python/maximus/station/__init__.py
@@ -0,0 +1,8 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["config", "sta"]
+
+from config import Config
+from sta import STA
diff --git a/cesar/maximus/python/maximus/station/config.py b/cesar/maximus/python/maximus/station/config.py
new file mode 100644
index 0000000000..2c5b8fce25
--- /dev/null
+++ b/cesar/maximus/python/maximus/station/config.py
@@ -0,0 +1,98 @@
+#! usr/bin/env python
+
+#print __name__
+
+# Default values of station parameters
+DEFAULT_MAC_ADDRESS = 0x123456789ABC
+DEFAULT_CCO_PREFERENCE = False
+DEFAULT_WAS_CCO = False
+DEFAULT_NPW = "HomePlugAV0123"
+DEFAULT_DPW = "DPW_"
+DEFAULT_M_STA_HFID = "M_STA_HFID_"
+DEFAULT_U_STA_HFID = "U_STA_HFID_"
+DEFAULT_AVLN_HFID = "AVLN_HomePlugAV0123"
+DEFAULT_SL = 0
+DEFAULT_TONEMASK = 85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535
+DEFAULT_SNID = 0
+
+class Config:
+ """The Config structure is composed of the 11 following fields:
+ mac_address - a Python tuple of 6 Python integers
+ cco_preference - a Python boolean
+ was_cco - a Python boolean
+ npw - a Python string of length from 8 to 64 octets
+ dpw - a Python string of length from 0 to 64 octets
+ m_sta_hfid - a Python string of length from 0 to 64 octets
+ u_sta_hfid - a Python string of length from 0 to 64 octets
+ avln_hfid - a Python string of length from 0 to 64 octets
+ sl - a Python integer from 0 to 2
+ tonemask - a Python tuple of Python integers
+ snid - a Python integer from 0 to 15
+ """
+ def __init__(self, default_config=True, mac_address=None, cco_preference=None, was_cco=None, npw=None, dpw=None, m_sta_hfid=None, u_sta_hfid=None, avln_hfid=None, sl=None, tonemask=None, snid=None):
+
+ # MAC address
+ if mac_address is None and default_config is True:
+ self.mac_address = DEFAULT_MAC_ADDRESS
+ else:
+ self.mac_address = mac_address
+
+ # CCo preference
+ if cco_preference is None and default_config is True:
+ self.cco_preference = DEFAULT_CCO_PREFERENCE
+ else:
+ self.cco_preference = cco_preference
+
+ # Was CCo
+ if was_cco is None and default_config is True:
+ self.was_cco = DEFAULT_WAS_CCO
+ else:
+ self.was_cco = was_cco
+
+ # Network password
+ if npw is None and default_config is True:
+ self.npw = DEFAULT_NPW
+ else:
+ self.npw = npw
+
+ # Device password
+ if dpw is None and default_config is True:
+ self.dpw = DEFAULT_DPW
+ else:
+ self.dpw = dpw
+
+ # Manufacturer STA HFID
+ if m_sta_hfid is None and default_config is True:
+ self.m_sta_hfid = DEFAULT_M_STA_HFID
+ else:
+ self.m_sta_hfid = m_sta_hfid
+
+ # User STA HFID
+ if u_sta_hfid is None and default_config is True:
+ self.u_sta_hfid = DEFAULT_U_STA_HFID
+ else:
+ self.u_sta_hfid = u_sta_hfid
+
+ # AVLN HFID
+ if avln_hfid is None and default_config is True:
+ self.avln_hfid = DEFAULT_AVLN_HFID
+ else:
+ self.avln_hfid = avln_hfid
+
+ # Security level
+ if sl is None and default_config is True:
+ self.sl = DEFAULT_SL
+ else:
+ self.sl = sl
+
+ # Tonemask
+ if tonemask is None and default_config is True:
+ self.tonemask = DEFAULT_TONEMASK
+ else:
+ self.tonemask = tonemask
+
+ # SNID
+ if snid is None and default_config is True:
+ self.snid = DEFAULT_SNID
+ else:
+ self.snid = snid
diff --git a/cesar/maximus/python/maximus/station/sta.py b/cesar/maximus/python/maximus/station/sta.py
new file mode 100644
index 0000000000..ecd49ba425
--- /dev/null
+++ b/cesar/maximus/python/maximus/station/sta.py
@@ -0,0 +1,1052 @@
+#! usr/bin/env python
+
+#print __name__
+
+from maximus.station.config import *
+from maximus.ethernet.buffer import alloc_data_buffer, alloc_mme_buffer, alloc_interface_buffer
+from maximus.macframe.msdu import MSDU_TYPES
+from maximus.mme import *
+from maximus.mme.mmheader import MIN_SIZE_OF_MMHEADER, SIZE_OF_MMTYPE, SIZE_OF_FMI
+from maximus.utils.exception import Error, OutOfRangeError
+from maximus.utils.format import *
+
+# Constants to check arguments validity
+SIZE_OF_MAC_ADDRESS = SIZE_OF_U48 # in octets
+MAX_VALUE_OF_MAC_ADDRESS = MAX_VALUE_OF_U48
+MIN_SIZE_OF_NPW = 8 # in octets
+MAX_SIZE_OF_NPW = 64 # in octets
+MAX_SIZE_OF_DPW = MAX_SIZE_OF_NPW
+MAX_SIZE_OF_HFID = MAX_SIZE_OF_DPW
+MAX_VALUE_OF_SL = 2
+MAX_VALUE_OF_SNID = 15
+
+# Constants from 'hal/phy/defs.h'
+PHY_CARRIER_NB = 1155 # number of OFDM carrier, defined by the hardware
+PHY_CARRIER_OFFSET = 74 # number of first OFDM carrier, defined by the hardware
+PHY_TONEMASK_SIZE = ((PHY_CARRIER_NB + 8 - 1) / 8) # number of bytes needed to define a tonemask
+
+# Possible configuration modes to set station parameters
+CONFIG_MODES = ['MME', 'fcall_process_drv', 'fcall_cp_station']
+
+# Constants for MME responses
+# Driver ID result
+FAILURE = 0x00
+SUCCESS = 0x01
+RESERVED = 0x02 # to 0xFF
+# Driver ID error code on failure
+ERROR_CODES = {0x00:'Bad parameter', 0x01:'Unknown ID', 0x02:'Invalid value'}
+
+# Filter function to receive only MME responses
+def mme_filter(rsp):
+ if rsp.get_type() is MSDU_TYPES[2]: # ETHERNET_TYPE_MME
+ return True
+ elif rsp.get_type() is MSDU_TYPES[6]: # ETHERNET_TYPE_BUFFER_RELEASED
+ return False
+ else:
+ raise Error("Received unexpected message of type " + rsp.get_type())
+ return False
+
+class STA:
+ """The STA class is composed of the 16 following private attributes:
+ maximus - a Maximus object
+ station - a Sta object
+ name - a Python string
+ data_buffer_nb - a Python integer
+ mme_buffer_nb - a Python integer
+ interface_buffer_nb - a Python integer
+ mme_config - a Python boolean
+ mac_address - a Python tuple of 6 Python integers
+ cco_preference - a Python boolean
+ was_cco - a Python boolean
+ npw - a Python string of length from 8 to 64 octets
+ dpw - a Python string of length from 0 to 64 octets
+ m_sta_hfid - a Python string of length from 0 to 64 octets
+ u_sta_hfid - a Python string of length from 0 to 64 octets
+ avln_hfid - a Python string of length from 0 to 64 octets
+ sl - a Python integer from 0 to 2
+ tonemask - a Python tuple of Python integers
+ snid - a Python integer from 0 to 15
+ """
+ def __init__(self,\
+ maximus,\
+ executable=None,\
+ debug=False,\
+ name=None,\
+ data_buffer_nb=0,\
+ mme_buffer_nb=1,\
+ interface_buffer_nb=0,\
+ config_mode=CONFIG_MODES[0],\
+ config=Config()):
+ """Initialize the STA with following attributes:
+ maximus - a Maximus object (already initialized)
+ executable - a Python string
+ debug - a Python boolean
+ name - a Python string
+ data_buffer_nb - a Python integer
+ mme_buffer_nb - a Python integer
+ interface_buffer_nb - a Python integer
+ config_mode - a Python string
+ config - a Python Config object
+ """
+
+ # Set Maximus
+ self.__set_maximus(maximus)
+
+ # Create station and launch debugger if requested
+ self.__create_station(executable, debug)
+
+ # Set station configuration
+ self.set_name(name)
+ self.set_data_buffer_nb(data_buffer_nb)
+ self.set_mme_buffer_nb(mme_buffer_nb)
+ self.set_interface_buffer_nb(interface_buffer_nb)
+ self.set_config_mode(config_mode)
+ self.set_config(config)
+
+ # Start station
+ self.__start()
+
+ def __set_maximus(self, maximus):
+ """Set Maximus.
+ Maximus must be a Maximus object (already initialized).
+ """
+ self.__maximus = maximus
+
+ def __create_station(self, executable, debug):
+ """Create the station and launch the debugger if requested.
+ The station is a Sta object.
+ """
+ if executable is None:
+ self.__station = self.__get_maximus().create_sta()
+ else:
+ self.__station = self.__get_maximus().create_sta(executable)
+ if debug is True:
+ self.__station.debug()
+
+ def __start(self):
+ """Send the MAC_START message to the station.
+ """
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_mac_start") \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_START + MME_TYPES['REQ'])
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_mac_start") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_START)
+
+ def stop(self):
+ """Send the MAC_STOP message to the station.
+ """
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_mac_stop") \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_STOP + MME_TYPES['REQ'])
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_mac_stop") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_STOP)
+
+ def set_name(self, name):
+ """Set the name.
+ The name must be a Python string.
+ """
+ self.__name = name
+
+ # Configure the station name
+ if self.get_name() is not None:
+ self.get().set_name(name)
+
+ def set_data_buffer_nb(self, data_buffer_nb):
+ """Set the number of data buffers to allocate into the station.
+ The number of data buffers must be a Python integer.
+ """
+ if type(data_buffer_nb) is int:
+ if data_buffer_nb >= 0:
+ self.__data_buffer_nb = data_buffer_nb
+ else:
+ raise OutOfRangeError("Number of data buffers")
+ else:
+ raise TypeError
+
+ # Allocate data buffers
+ if data_buffer_nb > 0:
+ alloc_data_buffer(maximus=self.__get_maximus(), station=self.get(), buffer_nb=data_buffer_nb)
+
+ def set_mme_buffer_nb(self, mme_buffer_nb):
+ """Set the number of MME buffers to allocate into the station.
+ The number of MME buffers must be a Python integer.
+ """
+ if type(mme_buffer_nb) is int:
+ if mme_buffer_nb >= 0:
+ self.__mme_buffer_nb = mme_buffer_nb
+ else:
+ raise OutOfRangeError("Number of MME buffers")
+ else:
+ raise TypeError
+
+ # Allocate MME buffers
+ if mme_buffer_nb > 0:
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get(), buffer_nb=mme_buffer_nb)
+
+ def set_interface_buffer_nb(self, interface_buffer_nb):
+ """Set the number of interface buffers to allocate into the station.
+ The number of interface buffers must be a Python integer.
+ """
+ if type(interface_buffer_nb) is int:
+ if interface_buffer_nb >= 0:
+ self.__interface_buffer_nb = interface_buffer_nb
+ else:
+ raise OutOfRangeError("Number of interface buffers")
+ else:
+ raise TypeError
+
+ # Allocate interface buffers
+ if interface_buffer_nb > 0:
+ alloc_interface_buffer(maximus=self.__get_maximus(), station=self.get(), buffer_nb=interface_buffer_nb)
+
+ def set_config_mode(self, config_mode):
+ """Set the configuration mode.
+ The configuration mode must be a Python string of the CONFIG_MODES Python list.
+ """
+ if type(config_mode) is str:
+ if config_mode in CONFIG_MODES:
+ self.__config_mode = config_mode
+ else:
+ raise OutOfRangeError("Configuration mode")
+ else:
+ raise TypeError
+
+ def set_config(self, config):
+ """Set the station parameters.
+ The station configuration must be a Python Config structure.
+ """
+ self.set_mac_address(config.mac_address)
+ self.set_cco_preference(config.cco_preference)
+ self.set_was_cco(config.was_cco)
+ self.set_npw(config.npw)
+ self.set_dpw(config.dpw)
+ self.set_m_sta_hfid(config.m_sta_hfid)
+ self.set_u_sta_hfid(config.u_sta_hfid)
+ self.set_avln_hfid(config.avln_hfid)
+ self.set_sl(config.sl)
+ self.set_tonemask(config.tonemask)
+ self.set_snid(config.snid)
+
+ def set_mac_address(self, mac_address):
+ """Set the MAC address.
+ The MAC address can be a Python tuple of 6 Python integers,
+ a Python long (decimal or hexadecimal value),
+ a Python string of length equals to 6 octets,
+ or a Python string of length equals to 17 octets.
+ """
+ if type(mac_address) is str:
+ if len(mac_address) == 3 * SIZE_OF_MAC_ADDRESS - 1:
+ # MAC address is a Python string of length equals to 17 octets ('XX:XX:XX:XX:XX:XX')
+ if mac_address.count(':') == SIZE_OF_MAC_ADDRESS - 1:
+ self.__mac_address = unpack(6 * u8, pack(n + u64, int(mac_address.replace(':',''), 16))[SIZE_OF_U16:])
+ else:
+ raise OutOfRangeError("MAC address")
+ elif len(mac_address) == SIZE_OF_MAC_ADDRESS:
+ # MAC address is a Python string of length equals to 6 octets
+ self.__mac_address = ntoh48_tuple(mac_address)
+ else:
+ raise OutOfRangeError("MAC address")
+ elif type(mac_address) is long or type(mac_address) is int:
+ # MAC address is a Python long
+ if mac_address <= MAX_VALUE_OF_MAC_ADDRESS and mac_address >= 0:
+ self.__mac_address = ntoh48_tuple(hton48(mac_address))
+ else:
+ raise OutOfRangeError("MAC address")
+ elif type(mac_address) is tuple:
+ # MAC address is a Python tuple
+ if len(mac_address) == SIZE_OF_MAC_ADDRESS:
+ self.__mac_address = mac_address
+ else:
+ raise OutOfRangeError("MAC address")
+ elif mac_address is None:
+ self.__mac_address = None
+ else:
+ raise TypeError("MAC address")
+
+ # Send a message to the station to configure the MAC address
+ self.__send_mac_address()
+
+ def set_cco_preference(self, cco_preference):
+ """Set the CCo preference.
+ The CCo preference must be a Python boolean.
+ """
+ if type(cco_preference) is bool or cco_preference is None:
+ self.__cco_preference = cco_preference
+ else:
+ raise TypeError("CCo preference")
+
+ # Send a message to the station to configure the CCo preference
+ self.__send_cco_preference()
+
+ def set_was_cco(self, was_cco):
+ """Set the previous CCo status.
+ The previous CCo status must be a Python boolean.
+ """
+ if type(was_cco) is bool or was_cco is None:
+ self.__was_cco = was_cco
+ else:
+ raise TypeError("Was CCo")
+
+ # Send a message to the station to configure the previous CCo status
+ self.__send_was_cco()
+
+ def set_npw(self, npw):
+ """Set the Network PassWord.
+ The NPW must be a Python string of length from 8 to 64 octets.
+ """
+ if type(npw) is str:
+ if len(npw) >= MIN_SIZE_OF_NPW and len(npw) <= MAX_SIZE_OF_NPW:
+ self.__npw = npw
+ else:
+ raise OutOfRangeError("NPW")
+ elif npw is None:
+ self.__npw = npw
+ else:
+ raise TypeError("NPW")
+
+ # Send a message to the station to configure the NPW
+ self.__send_npw()
+
+ def set_dpw(self, dpw):
+ """Set the Device PassWord.
+ The DPW must be a Python string of length from 0 to 64 octets.
+ """
+ if type(dpw) is str:
+ if dpw is DEFAULT_DPW:
+ self.__dpw = DEFAULT_DPW + str(self.get_station_id())
+ elif len(dpw) <= MAX_SIZE_OF_DPW:
+ self.__dpw = dpw
+ else:
+ raise OutOfRangeError("DPW")
+ elif dpw is None:
+ self.__dpw = dpw
+ else:
+ raise TypeError("DPW")
+
+ # Send a message to the station to configure the DPW
+ self.__send_dpw()
+
+ def set_m_sta_hfid(self, m_sta_hfid):
+ """Set the Manufacturer STA HFID.
+ The Manufacturer STA HFID must be a Python string of length from 0 to 64 octets.
+ """
+ if type(m_sta_hfid) is str:
+ if m_sta_hfid is DEFAULT_M_STA_HFID:
+ self.__m_sta_hfid = DEFAULT_M_STA_HFID + str(self.get_station_id())
+ elif len(m_sta_hfid) <= MAX_SIZE_OF_HFID:
+ self.__m_sta_hfid = m_sta_hfid
+ else:
+ raise OutOfRangeError("Manufacturer STA HFID")
+ elif m_sta_hfid is None:
+ self.__m_sta_hfid = m_sta_hfid
+ else:
+ raise TypeError("Manufacturer STA HFID")
+
+ # Send a message to the station to configure the Manufacturer STA HFID
+ self.__send_m_sta_hfid()
+
+ def set_u_sta_hfid(self, u_sta_hfid):
+ """Set the User STA HFID.
+ The User STA HFID must be a Python string of length from 0 to 64 octets.
+ """
+ if type(u_sta_hfid) is str:
+ if u_sta_hfid is DEFAULT_U_STA_HFID:
+ self.__u_sta_hfid = DEFAULT_U_STA_HFID + str(self.get_station_id())
+ elif len(u_sta_hfid) <= MAX_SIZE_OF_HFID:
+ self.__u_sta_hfid = u_sta_hfid
+ else:
+ raise OutOfRangeError("User STA HFID")
+ elif u_sta_hfid is None:
+ self.__u_sta_hfid = u_sta_hfid
+ else:
+ raise TypeError("User STA HFID")
+
+ # Send a message to the station to configure the User STA HFID
+ self.__send_u_sta_hfid()
+
+ def set_avln_hfid(self, avln_hfid):
+ """Set the AVLN HFID.
+ The AVLN HFID must be a Python string of length from 0 to 64 octets.
+ """
+ if type(avln_hfid) is str:
+ if len(avln_hfid) <= MAX_SIZE_OF_HFID:
+ self.__avln_hfid = avln_hfid
+ else:
+ raise OutOfRangeError("AVLN HFID")
+ elif avln_hfid is None:
+ self.__avln_hfid = avln_hfid
+ else:
+ raise TypeError("AVLN HFID")
+
+ # Send a message to the station to configure the AVLN HFID
+ self.__send_avln_hfid()
+
+ def set_sl(self, sl):
+ """Set the Security Level.
+ The SL must be a Python integer from 0 to 2.
+ """
+ if type(sl) is int:
+ if sl >= 0 and sl <= MAX_VALUE_OF_SL:
+ self.__sl = sl
+ else:
+ raise OutOfRangeError("Security Level")
+ elif sl is None:
+ self.__sl = sl
+ else:
+ raise TypeError("SL")
+
+ # Send a message to the station to configure the SL
+ self.__send_sl()
+
+ def set_tonemask(self, carriers):
+ """Set the tonemask.
+ The carriers must be a Python tuple of Python integers.
+ """
+ if type(carriers) is tuple:
+ # Use the algorithm from 'mac/common/src/tonemask.c'
+ dtc_idx = 0
+ dtc_stop = carriers[dtc_idx] - PHY_CARRIER_OFFSET
+ dtc_on = False
+ tonemask = [] # Python list
+ for l in range(0, PHY_TONEMASK_SIZE):
+ tonemask.append(0)
+ for i in range(0, PHY_TONEMASK_SIZE):
+ for j in range(0, 8):
+ if i * 8 + j > dtc_stop:
+ dtc_on = not dtc_on
+ dtc_idx += 1
+ dtc_stop = carriers[dtc_idx] - PHY_CARRIER_OFFSET
+ if dtc_on is True:
+ tonemask[i] |= 1 << j
+
+ self.__tonemask = ''
+ for t in tonemask:
+ self.__tonemask += htohp8(t)
+ elif carriers is None:
+ self.__tonemask = carriers
+ else:
+ raise TypeError("Tonemask")
+
+ # Send a message to the station to configure the tonemask
+ self.__send_tonemask()
+
+ def set_snid(self, snid):
+ """Set the SNID.
+ The SNID must be a Python integer from 0 to 15.
+ """
+ if type(snid) is int:
+ if snid >= 0 and snid <= MAX_VALUE_OF_SNID:
+ self.__snid = snid
+ else:
+ raise OutOfRangeError("SNID")
+ elif snid is None:
+ self.__snid = snid
+ else:
+ raise TypeError("SNID")
+
+ # Send a message to the station to configure the SNID
+ self.__send_snid()
+
+ def __get_maximus(self):
+ """Get Maximus.
+ Maximus is a Maximus object.
+ """
+ return self.__maximus
+
+ def get(self):
+ """Get the station.
+ The station is a Sta object.
+ """
+ return self.__station
+
+ def get_name(self):
+ """Get the name.
+ The name is a Python string.
+ """
+ return self.__name
+
+ def get_data_buffer_nb(self):
+ """Get the number of data buffers allocated into the station.
+ The number of data buffers is a Python integer.
+ """
+ return self.__data_buffer_nb
+
+ def get_mme_buffer_nb(self):
+ """Get the number of MME buffers allocated into the station.
+ The number of MME buffers is a Python integer.
+ """
+ return self.__mme_buffer_nb
+
+ def get_interface_buffer_nb(self):
+ """Get the number of interface buffers allocated into the station.
+ The number of interface buffers is a Python integer.
+ """
+ return self.__interface_buffer_nb
+
+ def get_config_mode(self):
+ """Get the configuration mode.
+ The configuration mode is a Python string of the CONFIG_MODES Python list.
+ """
+ return self.__config_mode
+
+ def get_config(self):
+ """Get the station parameters.
+ The station configuration is a Python Config structure.
+ """
+ return Config(mac_address=self.get_mac_address(), \
+ cco_preference=self.get_cco_preference(), \
+ was_cco=self.get_was_cco(), \
+ npw=self.get_npw(), \
+ dpw=self.get_dpw(), \
+ m_sta_hfid=self.get_m_sta_hfid(), \
+ u_sta_hfid=self.get_u_sta_hfid(), \
+ avln_hfid=self.get_avln_hfid(), \
+ sl=self.get_sl(), \
+ tonemask=self.get_tonemask())
+
+ def get_mac_address(self):
+ """Get the MAC address.
+ The MAC address is a Python tuple of 6 Python integers.
+ """
+ return self.__mac_address
+
+ def get_cco_preference(self):
+ """Get the CCo preference.
+ The CCo preference is a Python boolean.
+ """
+ return self.__cco_preference
+
+ def get_was_cco(self):
+ """Get the previous CCo status.
+ The previous CCo status is a Python boolean.
+ """
+ return self.__was_cco
+
+ def get_npw(self):
+ """Get the Network PassWord.
+ The NPW is a Python string of length from 8 to 64 octets.
+ """
+ return self.__npw
+
+ def get_dpw(self):
+ """Get the Device PassWord.
+ The DPW is a Python string of length from 0 to 64 octets.
+ """
+ return self.__dpw
+
+ def get_m_sta_hfid(self):
+ """Get the Manufacturer STA HFID.
+ The Manufacturer STA HFID is a Python string of length from 0 to 64 octets.
+ """
+ return self.__m_sta_hfid
+
+ def get_u_sta_hfid(self):
+ """Get the User STA HFID.
+ The User STA HFID is a Python string of length from 0 to 64 octets.
+ """
+ return self.__u_sta_hfid
+
+ def get_avln_hfid(self):
+ """Get the AVLN HFID.
+ The AVLN HFID is a Python string of length from 0 to 64 octets.
+ """
+ return self.__avln_hfid
+
+ def get_sl(self):
+ """Get the Security Level.
+ The SL is a Python integer.
+ """
+ return self.__sl
+
+ def get_tonemask(self):
+ """Get the tonemask.
+ The tonemask is a bits field.
+ """
+ return self.__tonemask
+
+ def get_snid(self):
+ """Get the SNID.
+ The SNID is a Python integer.
+ """
+ return self.__snid
+
+ def __send_mac_address(self):
+ """Send a message to the station to configure the MAC address.
+ """
+ if self.get_mac_address() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_mac_address") \
+ .add_param_n_u8("mac_address", self.get_mac_address()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=self.get_mac_address(), MMV=0x01, MMTYPE = DRV_STA_SET_MAC_ADDR + MME_TYPES['REQ'])
+
+ # Computes MM Entry: Mac address of the station
+ # Octet Number = 0 - 5
+ # Field Size (Octets) = 6
+ StaMAC = ''
+ for t in self.get_mac_address():
+ StaMAC += htohp8(t)
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=StaMAC)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_mac_address") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_MAC_ADDR)
+
+ def __send_cco_preference(self):
+ """Send a message to the station to configure the CCo preference.
+ """
+ if self.get_cco_preference() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_cco_preference") \
+ .add_param_bool("cco_preference", self.get_cco_preference()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_CCO_PREF + MME_TYPES['REQ'])
+
+ # Computes MM Entry:
+ # - 0x00 = Station is not CCo
+ # - 0x01 = Station is CCo
+ # - 0x02 - 0xFF = Reserved
+ # Octet Number = 0
+ # Field Size (Octets) = 1
+ if self.get_cco_preference() is True:
+ CCoPref = htohp8(0x01)
+ else:
+ CCoPref = htohp8(0x00)
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=CCoPref)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_cco_preference") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_CCO_PREF)
+
+ def __send_was_cco(self):
+ """Send a message to the station to configure the previous CCo status.
+ """
+ if self.get_was_cco() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_was_cco") \
+ .add_param_bool("was_cco", self.get_was_cco()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_WAS_CCO + MME_TYPES['REQ'])
+
+ # Computes MM Entry:
+ # - 0x00 = Station was not CCo
+ # - 0x01 = Station was previously CCo
+ # - 0x02 - 0xFF = Reserved
+ # Octet Number = 0
+ # Field Size (Octets) = 1
+ if self.get_was_cco() is True:
+ WasCCo = htohp8(0x01)
+ else:
+ WasCCo = htohp8(0x00)
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=WasCCo)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_was_cco") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_WAS_CCO)
+
+ def __send_npw(self):
+ """Send a message to the station to configure the NPW.
+ """
+ if self.get_npw() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_npw") \
+ .add_param("npw", self.get_npw()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_NPW + MME_TYPES['REQ'])
+
+ # Computes MM Entry: Human-Readable (ASCII) Station Network Password
+ # Octet Number = 0 - 63
+ # Field Size (Octets) = 64
+ StaNPW = self.get_npw()
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=StaNPW)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_npw") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_NPW)
+
+ def __send_dpw(self):
+ """Send a message to the station to configure the DPW.
+ """
+ if self.get_dpw() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_dpw") \
+ .add_param("dpw", self.get_dpw()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_DPW + MME_TYPES['REQ'])
+
+ # Computes MM Entry: Human-Readable (ASCII) Station Device Password
+ # Octet Number = 0 - 63
+ # Field Size (Octets) = 64
+ StaDPW = self.get_dpw()
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=StaDPW)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_dpw") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_DPW)
+
+ def __send_m_sta_hfid(self):
+ """Send a message to the station to configure the Manufacturer STA HFID.
+ """
+ if self.get_m_sta_hfid() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_m_sta_hfid") \
+ .add_param("m_sta_hfid", self.get_m_sta_hfid()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_M_STA_HFID + MME_TYPES['REQ'])
+
+ # Computes MM Entry: Manufacturer Station Human-Friendly ID in ASCII format
+ # Octet Number = 0 - 63
+ # Field Size (Octets) = 64
+ Sta_m_HFID = self.get_m_sta_hfid()
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=Sta_m_HFID)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_m_sta_hfid") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_M_STA_HFID)
+
+ def __send_u_sta_hfid(self):
+ """Send a message to the station to configure the User STA HFID.
+ """
+ if self.get_u_sta_hfid() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_u_sta_hfid") \
+ .add_param("u_sta_hfid", self.get_u_sta_hfid()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_U_STA_HFID + MME_TYPES['REQ'])
+
+ # Computes MM Entry: User Station Human-Friendly ID in ASCII format
+ # Octet Number = 0 - 63
+ # Field Size (Octets) = 64
+ Sta_u_HFID = self.get_u_sta_hfid()
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=Sta_u_HFID)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_u_sta_hfid") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_U_STA_HFID)
+
+ def __send_avln_hfid(self):
+ """Send a message to the station to configure the AVLN HFID.
+ """
+ if self.get_avln_hfid() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_avln_hfid") \
+ .add_param("avln_hfid", self.get_avln_hfid()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_AVLN_HFID + MME_TYPES['REQ'])
+
+ # Computes MM Entry: AVLN Station Human-Readable ID in ASCII format
+ # Octet Number = 0 - 63
+ # Field Size (Octets) = 64
+ Sta_AVLN_HFID = self.get_avln_hfid()
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=Sta_AVLN_HFID)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_avln_hfid") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_AVLN_HFID)
+
+ def __send_sl(self):
+ """Send a message to the station to configure the SL.
+ """
+ if self.get_sl() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_sl") \
+ .add_param_uchar("sl", self.get_sl()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_SL + MME_TYPES['REQ'])
+
+ # Computes MM Entry: Security Level for New NMK
+ # Octet Number = 0
+ # Field Size (Octets) = 1
+ SL = htohp8(self.get_sl())
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=SL)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_sl") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_SL)
+
+ def __send_tonemask(self):
+ """Send a message to the station to configure the tonemask.
+ """
+ if self.get_tonemask() is not None:
+ if self.get_config_mode() is CONFIG_MODES[2]: # 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_tonemask") \
+ .add_param("tonemask", self.get_tonemask()) \
+ .send(self.get())
+ else: # we need to build an MME
+
+ # Computes MM Header
+ if self.get_mac_address() is not None:
+ osa = self.get_mac_address()
+ else:
+ osa = DEFAULT_MAC_ADDRESS
+ mmheader = MMHeader(ODA=DEFAULT_MAC_ADDRESS, OSA=osa, MMV=0x01, MMTYPE = DRV_STA_SET_TONEMASK + MME_TYPES['REQ'])
+
+ # Computes MM Entry:
+
+ # First carrier offset
+ # Octet Number = 0 - 1
+ # Field Size (Octets) = 2
+ Tonemask_offset = htohp16(PHY_CARRIER_OFFSET)
+
+ # Size of tonemask in bits
+ # Octet Number = 2 - 3
+ # Field Size (Octets) = 2
+ Tonemask_length = htohp16(PHY_CARRIER_NB)
+
+ # Station Tonemask bitfield
+ # Octet Number = 0 - 191
+ # Field Size (Octets) = 192
+ Sta_Tonemask = self.get_tonemask()
+
+ # Create the MME
+ mme = MME(MMHeader=mmheader, MMEntry=Tonemask_offset+Tonemask_length+Sta_Tonemask)
+
+ if self.get_config_mode() is CONFIG_MODES[1]: # 'fcall_process_drv'
+ self.__get_maximus().create_fcall("maximus_set_tonemask") \
+ .add_param("mme", mme.get()) \
+ .send(self.get())
+ else: # 'MME'
+ # Allocate an MME buffer
+ alloc_mme_buffer(maximus=self.__get_maximus(), station=self.get())
+
+ # Send the MME and wait for the response
+ rsp = mme.sendnrecv(maximus=self.__get_maximus(), station=self.get(), filter=mme_filter)
+ self.__check_cnf(rsp, DRV_STA_SET_TONEMASK)
+
+ def __send_snid(self):
+ """Send a message to the station to configure the SNID.
+ """
+ if self.get_snid() is not None:
+ # allways 'fcall_cp_station'
+ self.__get_maximus().create_fcall("maximus_set_snid") \
+ .add_param_uchar("snid", self.get_snid()) \
+ .send(self.get())
+
+ def __check_cnf(self, rsp, name):
+ """Check the MME response validity.
+ """
+ mmtype = hptoh16(rsp[0].get_mmheader()[MIN_SIZE_OF_MMHEADER - SIZE_OF_FMI - SIZE_OF_MMTYPE:MIN_SIZE_OF_MMHEADER - SIZE_OF_FMI])
+ if mmtype != name + MME_TYPES['CNF']:
+ raise Error("Received unexpected message of type " + hex(mmtype))
+ result = hptoh8(rsp[0].get_mmentry()[0])
+ if result == FAILURE:
+ err_code = hptoh8(rsp[0].get_mmentry()[1])
+ try:
+ err_msg = ERROR_CODES[err_code]
+ except KeyError:
+ err_msg = "Unknow error code"
+ raise Error(hex(name) + ".CNF => Failure: " + err_msg)
+ elif result >= RESERVED:
+ raise Error(hex(name) + ".CNF => Reserved: " + hex(result))
+
+ # Following functions just are encapsulation of interface module Boost Python functions.
+ #
+
+ def remove(self):
+ return self.get().remove()
+
+ def deactivate(self):
+ return self.get().deactivate()
+
+ def activate(self):
+ return self.get().activate()
+
+ def debug(self):
+ return self.get().debug()
+
+ def is_idle(self):
+ return self.get().is_idle()
+
+ def get_station_id(self):
+ return self.get().get_station_id()
diff --git a/cesar/maximus/python/maximus/utils/__init__.py b/cesar/maximus/python/maximus/utils/__init__.py
new file mode 100644
index 0000000000..817bb5db8a
--- /dev/null
+++ b/cesar/maximus/python/maximus/utils/__init__.py
@@ -0,0 +1,10 @@
+#! usr/bin/env python
+
+#print __name__
+
+#__all__ = ["converter", "crc", "exception", "format"]
+
+from converter import *
+from crc import *
+from exception import *
+from format import *
diff --git a/cesar/maximus/python/maximus/utils/converter.py b/cesar/maximus/python/maximus/utils/converter.py
new file mode 100644
index 0000000000..4f19d5d1ce
--- /dev/null
+++ b/cesar/maximus/python/maximus/utils/converter.py
@@ -0,0 +1,106 @@
+#! usr/bin/env python
+
+#print __name__
+
+from re import *
+from struct import pack, unpack
+
+class Data:
+
+ """Allow to get values in different formats.
+ """
+
+ def __init__(self, n=0, b=0, s=''):
+ self.base2=None
+ self.base10=None
+ self.base16=None
+ self.data=None
+ if b==0:
+ if s=='':
+ raise Exception, "unspecified base"
+ else:
+ self.data=s
+ t=unpack(len(self.data)*'B',self.data)
+ self.base2=''
+ i=0
+ for c in t:
+ self.base10=t[i]
+ self.base2+=self.get_bin(8)
+ i+=1
+ self.base10=int(self.base2,2)
+ self.base16=hex(self.base10).strip('L')
+ elif b==2:
+ self.base2=n
+ self.base10=int(self.base2,2)
+ self.base16=hex(self.base10).strip('L')
+ self.data=self.string()
+ elif b==10:
+ self.base10=n
+ self.base16=hex(self.base10).strip('L')
+ self.base2=self.bin(self.base10)
+ self.data=self.string()
+ elif b==16:
+ self.base16=n
+ self.base10=int(self.base16,16)
+ self.base2=self.bin(self.base10)
+ self.data=self.string()
+ else:
+ raise Exception, "unsupported base"
+
+ def bin(self, n):
+ base2 = ''
+ if n < 0:
+ raise ValueError, "must be a positive integer"
+ elif n == 0:
+ return '0'
+ else:
+ while n > 0:
+ base2 = str(n % 2) + base2
+ n = n >> 1
+ return base2
+
+ def string(self):
+ data=''
+ i=0
+ s=''
+ for c in self.get_hex():
+ if i<2:
+ s+=c
+ i+=1
+ if i==2:
+ data += pack('B',int(s,16))
+ i=0
+ s=''
+ return data
+
+ def get_bin(self, count=0):
+ if count < 0:
+ raise ValueError, "must be a positive integer"
+ elif count == 0:
+ return self.base2
+ else:
+ return ''.join([str((self.base10 >> y) & 1) for y in range(count-1, -1, -1)])
+
+ def get_int(self):
+ return self.base10
+
+ def get_hex(self, count=0):
+
+ """Get hexadecimal value.
+
+ >>> from maximus.utils.converter import *
+ >>> d=Data(123,10)
+ >>> d.get_hex()
+ '7b'
+ """
+
+ string=sub("0x", '', self.base16, 1)
+ if count < 0:
+ raise ValueError, "must be a positive integer"
+ elif count > 0:
+ for i in range(len(self.base16)-1,count+1):
+ string = '0' + string
+ return string
+
+ def get_str(self):
+ return self.data
diff --git a/cesar/maximus/python/maximus/utils/crc.py b/cesar/maximus/python/maximus/utils/crc.py
new file mode 100644
index 0000000000..05f7bd281f
--- /dev/null
+++ b/cesar/maximus/python/maximus/utils/crc.py
@@ -0,0 +1,102 @@
+#! usr/bin/env python
+
+#print __name__
+
+import sys
+base = '../../../../'
+path = 'maximus/python/lib/fcVf/crc24'
+sys.path.append (__file__[:__file__.find("crc.py")] + base + path) # or ".pyc"
+
+from maximus.utils.format import *
+from pycrc24 import check_string
+import binascii # for 'binascii.crc32()'
+
+CRC8_TABLE = [ 0x00, 0x07, 0x0e, 0x09, 0x1c, 0x1b, 0x12, 0x15,
+ 0x38, 0x3f, 0x36, 0x31, 0x24, 0x23, 0x2a, 0x2d,
+ 0x70, 0x77, 0x7e, 0x79, 0x6c, 0x6b, 0x62, 0x65,
+ 0x48, 0x4f, 0x46, 0x41, 0x54, 0x53, 0x5a, 0x5d,
+ 0xe0, 0xe7, 0xee, 0xe9, 0xfc, 0xfb, 0xf2, 0xf5,
+ 0xd8, 0xdf, 0xd6, 0xd1, 0xc4, 0xc3, 0xca, 0xcd,
+ 0x90, 0x97, 0x9e, 0x99, 0x8c, 0x8b, 0x82, 0x85,
+ 0xa8, 0xaf, 0xa6, 0xa1, 0xb4, 0xb3, 0xba, 0xbd,
+ 0xc7, 0xc0, 0xc9, 0xce, 0xdb, 0xdc, 0xd5, 0xd2,
+ 0xff, 0xf8, 0xf1, 0xf6, 0xe3, 0xe4, 0xed, 0xea,
+ 0xb7, 0xb0, 0xb9, 0xbe, 0xab, 0xac, 0xa5, 0xa2,
+ 0x8f, 0x88, 0x81, 0x86, 0x93, 0x94, 0x9d, 0x9a,
+ 0x27, 0x20, 0x29, 0x2e, 0x3b, 0x3c, 0x35, 0x32,
+ 0x1f, 0x18, 0x11, 0x16, 0x03, 0x04, 0x0d, 0x0a,
+ 0x57, 0x50, 0x59, 0x5e, 0x4b, 0x4c, 0x45, 0x42,
+ 0x6f, 0x68, 0x61, 0x66, 0x73, 0x74, 0x7d, 0x7a,
+ 0x89, 0x8e, 0x87, 0x80, 0x95, 0x92, 0x9b, 0x9c,
+ 0xb1, 0xb6, 0xbf, 0xb8, 0xad, 0xaa, 0xa3, 0xa4,
+ 0xf9, 0xfe, 0xf7, 0xf0, 0xe5, 0xe2, 0xeb, 0xec,
+ 0xc1, 0xc6, 0xcf, 0xc8, 0xdd, 0xda, 0xd3, 0xd4,
+ 0x69, 0x6e, 0x67, 0x60, 0x75, 0x72, 0x7b, 0x7c,
+ 0x51, 0x56, 0x5f, 0x58, 0x4d, 0x4a, 0x43, 0x44,
+ 0x19, 0x1e, 0x17, 0x10, 0x05, 0x02, 0x0b, 0x0c,
+ 0x21, 0x26, 0x2f, 0x28, 0x3d, 0x3a, 0x33, 0x34,
+ 0x4e, 0x49, 0x40, 0x47, 0x52, 0x55, 0x5c, 0x5b,
+ 0x76, 0x71, 0x78, 0x7f, 0x6a, 0x6d, 0x64, 0x63,
+ 0x3e, 0x39, 0x30, 0x37, 0x22, 0x25, 0x2c, 0x2b,
+ 0x06, 0x01, 0x08, 0x0f, 0x1a, 0x1d, 0x14, 0x13,
+ 0xae, 0xa9, 0xa0, 0xa7, 0xb2, 0xb5, 0xbc, 0xbb,
+ 0x96, 0x91, 0x98, 0x9f, 0x8a, 0x8d, 0x84, 0x83,
+ 0xde, 0xd9, 0xd0, 0xd7, 0xc2, 0xc5, 0xcc, 0xcb,
+ 0xe6, 0xe1, 0xe8, 0xef, 0xfa, 0xfd, 0xf4, 0xf3 ]
+
+CRC16_TABLE = [ 0x0000, 0xc0c1, 0xc181, 0x0140, 0xc301, 0x03c0, 0x0280, 0xc241,
+ 0xc601, 0x06c0, 0x0780, 0xc741, 0x0500, 0xc5c1, 0xc481, 0x0440,
+ 0xcc01, 0x0cc0, 0x0d80, 0xcd41, 0x0f00, 0xcfc1, 0xce81, 0x0e40,
+ 0x0a00, 0xcac1, 0xcb81, 0x0b40, 0xc901, 0x09c0, 0x0880, 0xc841,
+ 0xd801, 0x18c0, 0x1980, 0xd941, 0x1b00, 0xdbc1, 0xda81, 0x1a40,
+ 0x1e00, 0xdec1, 0xdf81, 0x1f40, 0xdd01, 0x1dc0, 0x1c80, 0xdc41,
+ 0x1400, 0xd4c1, 0xd581, 0x1540, 0xd701, 0x17c0, 0x1680, 0xd641,
+ 0xd201, 0x12c0, 0x1380, 0xd341, 0x1100, 0xd1c1, 0xd081, 0x1040,
+ 0xf001, 0x30c0, 0x3180, 0xf141, 0x3300, 0xf3c1, 0xf281, 0x3240,
+ 0x3600, 0xf6c1, 0xf781, 0x3740, 0xf501, 0x35c0, 0x3480, 0xf441,
+ 0x3c00, 0xfcc1, 0xfd81, 0x3d40, 0xff01, 0x3fc0, 0x3e80, 0xfe41,
+ 0xfa01, 0x3ac0, 0x3b80, 0xfb41, 0x3900, 0xf9c1, 0xf881, 0x3840,
+ 0x2800, 0xe8c1, 0xe981, 0x2940, 0xeb01, 0x2bc0, 0x2a80, 0xea41,
+ 0xee01, 0x2ec0, 0x2f80, 0xef41, 0x2d00, 0xedc1, 0xec81, 0x2c40,
+ 0xe401, 0x24c0, 0x2580, 0xe541, 0x2700, 0xe7c1, 0xe681, 0x2640,
+ 0x2200, 0xe2c1, 0xe381, 0x2340, 0xe101, 0x21c0, 0x2080, 0xe041,
+ 0xa001, 0x60c0, 0x6180, 0xa141, 0x6300, 0xa3c1, 0xa281, 0x6240,
+ 0x6600, 0xa6c1, 0xa781, 0x6740, 0xa501, 0x65c0, 0x6480, 0xa441,
+ 0x6c00, 0xacc1, 0xad81, 0x6d40, 0xaf01, 0x6fc0, 0x6e80, 0xae41,
+ 0xaa01, 0x6ac0, 0x6b80, 0xab41, 0x6900, 0xa9c1, 0xa881, 0x6840,
+ 0x7800, 0xb8c1, 0xb981, 0x7940, 0xbb01, 0x7bc0, 0x7a80, 0xba41,
+ 0xbe01, 0x7ec0, 0x7f80, 0xbf41, 0x7d00, 0xbdc1, 0xbc81, 0x7c40,
+ 0xb401, 0x74c0, 0x7580, 0xb541, 0x7700, 0xb7c1, 0xb681, 0x7640,
+ 0x7200, 0xb2c1, 0xb381, 0x7340, 0xb101, 0x71c0, 0x7080, 0xb041,
+ 0x5000, 0x90c1, 0x9181, 0x5140, 0x9301, 0x53c0, 0x5280, 0x9241,
+ 0x9601, 0x56c0, 0x5780, 0x9741, 0x5500, 0x95c1, 0x9481, 0x5440,
+ 0x9c01, 0x5cc0, 0x5d80, 0x9d41, 0x5f00, 0x9fc1, 0x9e81, 0x5e40,
+ 0x5a00, 0x9ac1, 0x9b81, 0x5b40, 0x9901, 0x59c0, 0x5880, 0x9841,
+ 0x8801, 0x48c0, 0x4980, 0x8941, 0x4b00, 0x8bc1, 0x8a81, 0x4a40,
+ 0x4e00, 0x8ec1, 0x8f81, 0x4f40, 0x8d01, 0x4dc0, 0x4c80, 0x8c41,
+ 0x4400, 0x84c1, 0x8581, 0x4540, 0x8701, 0x47c0, 0x4680, 0x8641,
+ 0x8201, 0x42c0, 0x4380, 0x8341, 0x4100, 0x81c1, 0x8081, 0x4040 ]
+
+def crc8(data):
+ """Calculates CRC-8.
+ Data must be a Python string.
+ """
+ # CRC-8 polynomial: x^8 + x^2 + x^1 + x^0
+ crc = 0
+ for i in range(0, len(data)):
+ crc = CRC8_TABLE[crc^hptoh8(data[i])]
+ return crc
+
+def crc24(data):
+ """Calculates CRC-24.
+ Data must be a Python string.
+ """
+ # CRC-24 polynomial: x^24 + x^23 + x^6 + x^5 + x^1 + x^0
+ return check_string(data)
+
+def crc32(data):
+ """Calculates CRC-32.
+ Data must be a Python string.
+ """
+ # CRC-8 polynomial: x^32 + x^26 + x^23 + x^22 + x^16 + x^12 + x^11 + x^10 + x^8 + x^7 + x^5 + x^4 + x^2 + x^1 + x^0
+ return unpack(u32, pack('q', binascii.crc32(data))[0:SIZE_OF_U32])[0]
diff --git a/cesar/maximus/python/maximus/utils/exception.py b/cesar/maximus/python/maximus/utils/exception.py
new file mode 100644
index 0000000000..d94fed771d
--- /dev/null
+++ b/cesar/maximus/python/maximus/utils/exception.py
@@ -0,0 +1,21 @@
+#! usr/bin/env python
+
+#print __name__
+
+class Error(Exception):
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return repr(self.value)
+
+class OutOfRangeError(Exception):
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return repr(self.value)
+
+class MACFrameSendError(Exception):
+ def __init__(self, value):
+ self.value = value
+ def __str__(self):
+ return repr(self.value)
diff --git a/cesar/maximus/python/maximus/utils/format.py b/cesar/maximus/python/maximus/utils/format.py
new file mode 100644
index 0000000000..5285a23acd
--- /dev/null
+++ b/cesar/maximus/python/maximus/utils/format.py
@@ -0,0 +1,263 @@
+#! usr/bin/env python
+
+#print __name__
+
+from struct import calcsize, pack, unpack
+
+
+# Define needed constants for 'struct.pack()' and 'struct.unpack()' functions
+#
+
+# pack(fmt, v1, v2, ...)
+# Return a string containing the values v1, v2, ..., packed according to the given format.
+# The arguments must match the values required by the format exactly.
+
+# unpack(fmt, string)
+# Unpack the string (presumably packed by pack(fmt, ... )) according to the given format.
+# The result is a tuple even if it contains exactly one item.
+# The string must contain exactly the amount of data required by the format (len(string) must equal calcsize(fmt)).
+
+# calcsize(fmt)
+# Return the size of the struct (and hence of the string) corresponding to the given format.
+
+
+# Format C Type Python
+# "x" pad byte no value
+# "c" char string of length 1
+# "b" signed char integer
+# "B" unsigned char integer
+# "h" short integer
+# "H" unsigned short integer
+# "i" int integer
+# "I" unsigned int long
+# "l" long integer
+# "L" unsigned long long
+# "q" long long long
+# "Q" unsigned long long long
+# "f" float float
+# "d" double float
+# "s" char[] string
+# "p" char[] string
+# "P" void * integer
+
+u8 = 'B'
+u16 = 'H'
+u32 = 'L' # or 'I'
+u64 = 'Q'
+
+# In octets
+SIZE_OF_U8 = calcsize(u8)
+SIZE_OF_U16 = calcsize(u16)
+SIZE_OF_U24 = 3 * SIZE_OF_U8
+SIZE_OF_U32 = calcsize(u32)
+SIZE_OF_U48 = SIZE_OF_U32 + SIZE_OF_U16
+SIZE_OF_U64 = calcsize(u64)
+
+# In bits
+size_of_u8 = 8
+size_of_u16 = 16
+size_of_u24 = 24
+size_of_u32 = 32
+size_of_u48 = 48
+size_of_u64 = 64
+
+MAX_VALUE_OF_U8 = 0xFF
+MAX_VALUE_OF_U16 = 0xFFFF
+MAX_VALUE_OF_U24 = 0xFFFFFF
+MAX_VALUE_OF_U32 = 0xFFFFFFFF
+MAX_VALUE_OF_U48 = 0xFFFFFFFFFFFF
+MAX_VALUE_OF_U64 = 0xFFFFFFFFFFFFFFFF
+
+
+# Character Byte order Size and alignment
+# "@" native native
+# "=" native standard
+# "<" little-endian standard
+# ">" big-endian standard
+# "!" network (= big-endian) standard
+
+h = '=' # hardware (= native = little-endian)
+le = '<' # little-endian
+be = '>' # big-endian
+n = '!' # network (= big-endian)
+hp = le # HomePlug (= little-endian)
+
+
+# Following functions respectively pack a u8, u16, u24, u32, u48 or u64 value into a string
+#
+
+def htohp8(value):
+ """Hardware to HomePlug,
+ i.e. little-endian to little-endian.
+ """
+ return pack(hp + u8, value)
+
+def htohp16(value):
+ """Hardware to HomePlug,
+ i.e. little-endian to little-endian.
+ """
+ return pack(hp + u16, value)
+
+def htohp24(value):
+ """Hardware to HomePlug,
+ i.e. little-endian to little-endian.
+ """
+ string = pack(hp + u32, value)
+ return string[:SIZE_OF_U24]
+
+def htohp32(value):
+ """Hardware to HomePlug,
+ i.e. little-endian to little-endian.
+ """
+ return pack(hp + u32, value)
+
+def htohp48(value):
+ """Hardware to HomePlug,
+ i.e. little-endian to little-endian.
+ """
+ string = pack(hp + u64, value)
+ return string[SIZE_OF_U16:SIZE_OF_U48] + string[:SIZE_OF_U16]
+
+def htohp48_tuple(tuple):
+ """Hardware to HomePlug,
+ i.e. little-endian to little-endian.
+ """
+ string = ''
+ for t in tuple:
+ string += htohp8(t)
+ result = ''
+ for i in range(0, len(string)):
+ result += string[len(string)-1-i]
+ return result[SIZE_OF_U16:SIZE_OF_U48] + result[:SIZE_OF_U16]
+
+def htohp64(value):
+ """Hardware to HomePlug,
+ i.e. little-endian to little-endian.
+ """
+ return pack(hp + u64, value)
+
+def hton8(value):
+ """Hardware to network,
+ i.e. little-endian to big-endian.
+ """
+ return pack(n + u8, value)
+
+def hton16(value):
+ """Hardware to network,
+ i.e. little-endian to big-endian.
+ """
+ return pack(n + u16, value)
+
+def hton32(value):
+ """Hardware to network,
+ i.e. little-endian to big-endian.
+ """
+ return pack(n + u32, value)
+
+def hton48(value):
+ """Hardware to network,
+ i.e. little-endian to big-endian.
+ """
+ return pack(n + u64, value)[SIZE_OF_U16:]
+
+def hton48_tuple(tuple):
+ """Hardware to HomePlug,
+ i.e. little-endian to big-endian.
+ """
+ string = ''
+ for t in tuple:
+ string += htohp8(t)
+ return string
+
+def hton64(value):
+ """Hardware to network,
+ i.e. little-endian to big-endian.
+ """
+ return pack(n + u64, value)
+
+
+# Following functions respectively unpack a string into a u8, u16, u24, u32, u48 or u64 value
+#
+
+def ntoh8(string):
+ """Network to hardware,
+ i.e. big-endian to little-endian.
+ """
+ return unpack(n + u8, string)[0]
+
+def ntoh16(string):
+ """Network to hardware,
+ i.e. big-endian to little-endian.
+ """
+ return unpack(n + u16, string)[0]
+
+def ntoh32(string):
+ """Network to hardware,
+ i.e. big-endian to little-endian.
+ """
+ return unpack(n + u32, string)[0]
+
+def ntoh48(string):
+ """Network to hardware,
+ i.e. big-endian to little-endian.
+ """
+ return unpack(n + u64, '\0\0' + string)[0]
+
+def ntoh48_tuple(string):
+ """HomePlug to hardware,
+ i.e. big-endian to little-endian.
+ """
+ return unpack(hp + len(string) * u8, string)[:len(string)]
+
+def ntoh64(string):
+ """Network to hardware,
+ i.e. big-endian to little-endian.
+ """
+ return unpack(n + u64, string)[0]
+
+def hptoh8(string):
+ """HomePlug to hardware,
+ i.e. little-endian to little-endian.
+ """
+ return unpack(hp + u8, string)[0]
+
+def hptoh16(string):
+ """HomePlug to hardware,
+ i.e. little-endian to little-endian.
+ """
+ return unpack(hp + u16, string)[0]
+
+def hptoh24(string):
+ """HomePlug to hardware,
+ i.e. little-endian to little-endian.
+ """
+ return unpack(hp + u32, string + '\0')[0]
+
+def hptoh32(string):
+ """HomePlug to hardware,
+ i.e. little-endian to little-endian.
+ """
+ return unpack(hp + u32, string)[0]
+
+def hptoh48(string):
+ """HomePlug to hardware,
+ i.e. little-endian to little-endian.
+ """
+ return unpack(hp + u64, string[SIZE_OF_U32:SIZE_OF_U48] + string[:SIZE_OF_U32] + '\0\0')[0]
+
+def hptoh48_tuple(string):
+ """HomePlug to hardware,
+ i.e. little-endian to little-endian.
+ """
+ string = string[SIZE_OF_U32:SIZE_OF_U48] + string[:SIZE_OF_U32]
+ tuple = unpack(hp + len(string) * u8, string)[:len(string)]
+ result = ()
+ for i in range(0, len(tuple)):
+ result += (tuple[len(tuple)-1-i]),
+ return result
+
+def hptoh64(string):
+ """HomePlug to hardware,
+ i.e. little-endian to little-endian.
+ """
+ return unpack(hp + u64, string)[0]
diff --git a/cesar/maximus/python/py/script_example.py b/cesar/maximus/python/py/script_example.py
new file mode 100644
index 0000000000..aa0c643fd5
--- /dev/null
+++ b/cesar/maximus/python/py/script_example.py
@@ -0,0 +1,140 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+
+# SCRIPT EXAMPLE
+# To be run with "stationtest.elf" station executable
+# (to be compiled under "/trunk/maximus/stationtest").
+
+from interface import *
+from struct import pack, unpack
+
+def my_cb (msg):
+ print "=>",my_cb.func_name
+ if msg.is_param("result_2"):
+ result2 = unpack('q',msg.bind_param("result_2"))
+ print "result 2 =",result2[0]
+ receive_fc1_rsp = True
+
+# Instantiate a Maximus object and initialize it.
+maximus = Maximus()
+maximus.init(sys.argv)
+
+# Create three stations.
+stationA = maximus.create_sta()
+stationB = maximus.create_sta()
+stationC = maximus.create_sta()
+
+# Launch a debugger attached to station B.
+stationB.debug()
+
+# Send an asynchronous function message to station A.
+#
+
+# Create a function message and set the name of the function to call of station A.
+fc1 = maximus.create_fcall("function_1")
+
+# Add a first parameter to the created message.
+param1 = pack('iiB',1,2,True)
+fc1.add_param("param_1", param1)
+
+# Add a second parameter to the created message.
+param2 = pack('iiiiiiiiii',0,1,2,3,4,5,6,7,8,9)
+fc1.add_param("param_2", param2)
+
+# Add a third parameter to the created message.
+param3 = "hello"
+fc1.add_param("param_3", param3)
+
+# Add a fourth parameter to the created message.
+param4 = pack('q',123)
+fc1.add_param("param_4", param4)
+
+# Register a callback function which will be called at message response reception.
+fc1.set_cb(my_cb)
+
+# Set destination station of message 1.
+fc1.set_sta(stationA)
+
+# Send the configured message in an asynchronous mode.
+receive_fc1_rsp = False
+fc1.send_async()
+
+# Send a synchronous function message to station B.
+
+# Create a function message and set the name of the function to call into station B.
+fc2 = maximus.create_fcall("function_2")
+
+# Add a first parameter to the created message.
+fc2.add_param_bool("param_5", True)
+
+# Send the configured message to station B in a synchronous mode.
+fc2.send(stationB)
+
+# Get the function result.
+result1 = fc2.bind_param_string("result_1")
+print "result1 =",result1
+
+# Set a parameter value of station B.
+probe1 = maximus.create_probe()
+param6 = 789
+probe1.add_param_ulong("param_6", param6)
+probe1.send(stationB)
+
+# Get a parameter value from station B.
+probe2 = maximus.create_probe().add_param("param_7")
+probe2.send(stationB)
+param7 = probe2.bind_param_ulong("param_7")
+print "param 7 =",param7
+
+# Get the same parameter value from station C, re-using existing message.
+probe2.send(stationC)
+
+# Send asynchronous function message(s) to station B.
+if 456 == param7:
+ fc3 = maximus.create_fcall("function_3")
+ fc3.send_async(stationC)
+fc4 = maximus.create_fcall("function_4")
+fc4.send_async(stationC)
+
+# Send an asynchronous function message to station C.
+fc5 = maximus.create_fcall("function_5")
+fc5.send_async(stationC)
+
+# Wait for responses to all sent messages in asynchronous mode.
+maximus.wait()
+
+# Get list of all registered parameters of stations C.
+probe3 = maximus.create_probe()
+probe3.send(stationC)
+if probe3.is_param("param_8"):
+ # Get parameter 8 value and set parameter 9 value of station C.
+ probe4 = maximus.create_probe()
+ probe4.add_param("param_8")
+ probe4.add_param_bool("param_9", False)
+ probe4.send(stationC)
+ param8 = probe4.bind_param_bool("param_8")
+ print "param 8 =",param8
+
+# Wait during 1000000 ticks before creating another station.
+maximus.wait(1000000)
+
+# Create a fourth station.
+stationD = maximus.create_sta()
+
+# Wait during 1000000 ticks before terminating the program.
+maximus.wait(1000000)
+
+# Remove stations.
+stationA.remove()
+stationB.remove()
+stationC.remove()
+stationD.remove()
+
+print "\n*** END ***\n"
diff --git a/cesar/maximus/python/py/test_cb.py b/cesar/maximus/python/py/test_cb.py
new file mode 100644
index 0000000000..5bb8f46b97
--- /dev/null
+++ b/cesar/maximus/python/py/test_cb.py
@@ -0,0 +1,84 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+
+# TICKET #47
+# To be run with "test_cb.elf" station executable
+# (to be compiled under "/trunk/maximus/stationtest").
+
+from interface import *
+
+# Instantiate a Maximus object and initialize it.
+maximus = Maximus()
+maximus.init(sys.argv)
+
+# Create three stations.
+sta = maximus.create_sta()
+
+def get_seg_cb1 (msg):
+ print "=> get_seg_cb1"
+m1 = maximus.create_fcall ('get_seg')
+m1.set_cb (get_seg_cb1)
+m1.send_async (sta)
+maximus.wait()
+
+def get_seg_cb2 (msg):
+ print "=> get_seg_cb2"
+def a():
+ m2 = maximus.create_fcall ('get_seg')
+ m2.set_cb (get_seg_cb2)
+ m2.send_async (sta)
+a()
+maximus.wait()
+
+def b():
+ s = "=> get_seg_cb3"
+ def get_seg_cb3 (msg):
+ print s
+ m3 = maximus.create_fcall ('get_seg')
+ m3.set_cb (get_seg_cb3)
+ m3.send_async (sta)
+b()
+maximus.wait()
+
+
+# TICKET #48
+
+def a2 (m, msg):
+ s = 'I am "a2", '
+ def cb_a2(msg):
+ print s + m
+ msg.set_cb (cb_a2)
+
+def cb_b2_inner (msg):
+ print 'I am "b2", ' + m
+
+def b2 (m, msg):
+ msg.set_cb (lambda x: cb_b2_inner (x))
+
+def c (m, msg):
+ class CCb:
+ def __call__ (self, msg):
+ print self.s + m
+ c_cb = CCb ()
+ c_cb.s = 'I am "c", '
+ msg.set_cb (c_cb)
+
+m = 'I am being called'
+msg = maximus.create_fcall ('get_seg')
+a2 (m, msg)
+msg.send (sta)
+b2 (m, msg)
+msg.send (sta)
+c (m, msg)
+msg.send (sta)
+
+sta.remove()
+
+print "\n*** END ***\n"
diff --git a/cesar/maximus/python/py/test_ether.py b/cesar/maximus/python/py/test_ether.py
new file mode 100644
index 0000000000..db2184c29c
--- /dev/null
+++ b/cesar/maximus/python/py/test_ether.py
@@ -0,0 +1,227 @@
+#!/usr/bin/python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+from interface import *
+from maximus import *
+from maximus.ethernet.eth import MAX_SIZE_OF_HEADER
+from maximus.mme.mmheader import MAX_SIZE_OF_MMHEADER
+from maximus.macframe.msdu import MIN_SIZE_OF_MSDU
+from maximus.simu.rx import * # for 'recv()' function
+from struct import pack
+
+m = Maximus()
+m.init(sys.argv)
+
+
+# TEST ETHER
+# To be run with "test_ether.elf" station executable
+# (to be compiled under "/trunk/maximus/stationtest").
+
+# Create station(s)
+sta1 = m.create_sta ()
+sta1.debug()
+
+# Init ether
+fcall = m.create_fcall('init_ether')
+fcall.send(sta1)
+
+# Test following functions:
+# - send(self, maximus, file=None)
+# - sendnrecv(self, maximus, file=None, timeout=None, filter=None, count=1)
+# - recv(maximus, timeout=None, filter=None, count=1)
+
+# Disable the automatic buffer allocation
+realloc_buffer(False)
+
+# Ethernet Frame config
+dst = '41:42:43:44:45:46'
+src = '47:48:49:4a:4b:4c'
+vlantag = 0x81004D4E
+type = 0x4F50
+
+# MME config
+mmheader = 'MMHeader 19 octets!'
+mmentry = '--- This is the Management Message Entry ---'
+
+# Send an Ethernet Frame asynchronously
+frame1 = Eth()
+frame1.dst = dst
+frame1.src = src
+frame1.vlantag = vlantag
+frame1.type = type
+msdu1 = 'This is the Ethernet payload'
+frame1.payload = msdu1
+alloc_data_buffer(m, sta1, buffer_nb=2)
+frame1.send(m, sta1)
+rsp1 = recv(m, count=4)
+
+# Test the 1st received MSDU (Eth) object
+i = 0
+if rsp1[i].dst != dst:
+ print "dst1 =", rsp1[i].dst
+ raise Error("dst1")
+if rsp1[i].src != src:
+ print "src1 =", rsp1[i].src
+ raise Error("src1")
+if rsp1[i].vlantag != vlantag:
+ print "vlantag1 =", hex(rsp1[i].vlantag)
+ raise Error("vlantag1")
+if rsp1[i].type != type:
+ print "type1 =", hex(rsp1[i].type)
+ raise Error("type1")
+if str(rsp1[i].payload) != msdu1 + (MIN_SIZE_OF_MSDU - MAX_SIZE_OF_HEADER - len(msdu1)) * pack('B', 0):
+ print len(str(rsp1[i].payload))
+ print "msdu1 =", str(rsp1[i].payload)
+ raise Error("msdu1")
+
+# Test the 2nd received MSDU (MME) object
+i = 2 # i = 2 because the second received frame is the BUFFER RELEASED message
+if rsp1[i].get_mmheader() != 'ABCDEFGHIJKL' + pack('!I', vlantag) + 'OPThis ':
+ print "mmheader1 =", rsp1[i].get_mmheader()
+ raise Error("mmheader1")
+if rsp1[i].get_mmentry() != 'is the Ethernet payload' + (MIN_SIZE_OF_MSDU - MAX_SIZE_OF_MMHEADER - 23) * pack('B', 0):
+ print "mmentry1 =", rsp1[i].get_mmentry()
+ raise Error("mmentry1")
+
+m.wait(100000)
+
+# Send an Ethernet Frame synchronously
+frame2 = Eth()
+frame2.dst = dst
+frame2.src = src
+frame2.vlantag = vlantag
+frame2.type = type
+msdu2 = 'This is the Ethernet payload'
+frame2.payload = msdu2
+alloc_data_buffer(m, sta1, buffer_nb=2)
+rsp2 = frame2.sendnrecv(m, sta1, count=4)
+
+# Test the 1st received MSDU (Eth) object
+i = 0
+if rsp2[i].dst != dst:
+ print "dst2 =", rsp2[i].dst
+ raise Error("dst2")
+if rsp2[i].src != src:
+ print "src2 =", rsp2[i].src
+ raise Error("src2")
+if rsp2[i].vlantag != vlantag:
+ print "vlantag2 =", hex(rsp2[i].vlantag)
+ raise Error("vlantag2")
+if rsp2[i].type != type:
+ print "type2 =", hex(rsp2[i].type)
+ raise Error("type2")
+if str(rsp2[i].payload) != msdu2 + (MIN_SIZE_OF_MSDU - MAX_SIZE_OF_HEADER - len(msdu2)) * pack('B', 0):
+ print "msdu2 =", str(rsp2[i].payload)
+ raise Error("msdu2")
+
+# Test the 2nd received MSDU (MME) object
+i = 2 # i = 2 because the second received frame is the BUFFER RELEASED message
+if rsp2[i].get_mmheader() != 'ABCDEFGHIJKL' + pack('!I', vlantag) + 'OPThis ':
+ print "mmheader2 =", rsp2[i].get_mmheader()
+ raise Error("mmheader2")
+if rsp2[i].get_mmentry() != 'is the Ethernet payload' + (MIN_SIZE_OF_MSDU - MAX_SIZE_OF_MMHEADER - 23) * pack('B', 0):
+ print "mmentry2 =", rsp2[i].get_mmentry()
+ raise Error("mmentry2")
+
+m.wait(100000)
+
+# Send an MME asynchronously
+mme3 = MME(MMHeader=mmheader, MMEntry=mmentry)
+alloc_data_buffer(m, sta1, buffer_nb=2)
+mme3.send(m, sta1)
+rsp3 = recv(m, count=4)
+
+# Test the 1st received MSDU (Eth) object
+i = 0
+if rsp3[i].dst != '4d:4d:48:65:61:64': # 'MMHead'
+ print "dst3 =", rsp3[i].dst
+ raise Error("dst3")
+if rsp3[i].src != '65:72:20:31:39:20': # 'er 19 '
+ print "src3 =", rsp3[i].src
+ raise Error("src3")
+if rsp3[i].type != 0x6F63: # 'oc'
+ print "type3 =", hex(rsp3[i].type)
+ raise Error("type3")
+if str(rsp3[i].payload) != 'tets!--- This is the Management Message Entry ---':
+ print "msdu3 =", str(rsp3[i].payload)
+ raise Error("msdu3")
+
+# Test the 2nd received MSDU (MME) object
+i = 2 # i = 2 because the second received frame is the BUFFER RELEASED message
+if rsp3[i].get_mmheader() != mmheader:
+ print "mmheader3 =", rsp3[i].get_mmheader()
+ raise Error("mmheader3")
+if rsp3[i].get_mmentry() != mmentry:
+ print "mmentry3 =", rsp3[i].get_mmentry()
+ raise Error("mmentry3")
+
+m.wait(100000)
+
+# Send an MME synchronously
+mme4 = MME(MMHeader=mmheader, MMEntry=mmentry)
+alloc_data_buffer(m, sta1, buffer_nb=2)
+rsp4 = mme4.sendnrecv(m, sta1, count=4)
+
+# Test the 1st received MSDU (Eth) object
+i = 0
+if rsp4[i].dst != '4d:4d:48:65:61:64': # 'MMHead'
+ print "dst4 =", rsp4[i].dst
+ raise Error("dst4")
+if rsp4[i].src != '65:72:20:31:39:20': # 'er 19 '
+ print "src4 =", rsp4[i].src
+ raise Error("src4")
+if rsp4[i].type != 0x6F63: # 'oc'
+ print "type4 =", hex(rsp4[i].type)
+ raise Error("type4")
+if str(rsp4[i].payload) != 'tets!--- This is the Management Message Entry ---':
+ print "msdu4 =", str(rsp4[i].payload)
+ raise Error("msdu4")
+
+# Test the 2nd received MSDU (MME) object
+i = 2 # i = 2 because the second received frame is the BUFFER RELEASED message
+if rsp4[i].get_mmheader() != mmheader:
+ print "mmheader4 =", rsp4[i].get_mmheader()
+ raise Error("mmheader4")
+if rsp4[i].get_mmentry() != mmentry:
+ print "mmentry4 =", rsp4[i].get_mmentry()
+ raise Error("mmentry4")
+
+m.wait(100000)
+
+# Test the sniffed received MSDU (Sniffer) object
+alloc_interface_buffer(m, sta1)
+snif = recv(m, count=2)[0] # the second received frame is the BUFFER RELEASED message
+snif.display()
+if snif.get()[0:48] != "This is a sniffed packet coming from the station":
+ print "packet =", snif.get()
+ raise Error("packet")
+if snif.get_ether_type() != 7:
+ print "ether type =", snif.get_ether_type()
+ raise Error("ether type")
+if snif.get_type() != 'ETHERNET_TYPE_SNIFFER':
+ print "type =", snif.get_type()
+ raise Error("type")
+if snif.get_way() != True:
+ print "way =", snif.get_way()
+ raise Error("way")
+if snif.get_encryption() != True:
+ print "encryption =", snif.get_encryption()
+ raise Error("encryption")
+if snif.get_sniffer_type() != 1:
+ print "sniffer type =", snif.get_sniffer_type()
+ raise Error("sniffer type")
+
+# Uninit ether
+fcall2 = m.create_fcall('uninit_ether')
+fcall2.send(sta1)
+
+# Remove station(s)
+sta1.remove()
+
+print "\n*** END ***\n"
diff --git a/cesar/maximus/python/py/test_false_alarm.py b/cesar/maximus/python/py/test_false_alarm.py
new file mode 100644
index 0000000000..9de6c4f5aa
--- /dev/null
+++ b/cesar/maximus/python/py/test_false_alarm.py
@@ -0,0 +1,74 @@
+#!/usr/bin/python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+from interface import *
+from maximus import *
+
+m = Maximus()
+m.init(sys.argv)
+
+
+# TEST FALSE ALARM (= WRONG PREAMBLES TRANSMISSIONS)
+# To be run with "test_false_alarm.elf" station executable
+# (to be compiled under "/trunk/maximus/stationtest").
+
+# Create station(s)
+sta1 = m.create_sta()
+sta1.set_name("sta1")
+sta1.debug()
+sta2 = m.create_sta()
+sta2.set_name("sta2")
+sta2.debug()
+
+# Init HAL PHY
+m.create_fcall('init_phy').send(sta1)
+m.create_fcall('init_phy').send(sta2)
+
+# Activate false alarm feature
+duration = 100
+deviation = 10
+m.activate_false_alarm(duration, deviation)
+
+# Activate RX in Hybrid Mode for sta1
+fc_mode_10 = 0 # PHY_FC_MODE_HYBRID_1
+m.create_fcall('activate_rx').add_param_ushort("fc_mode", fc_mode_10).add_param_bool("pre_detection", True).send(sta1)
+
+# Activate RX in AV Only Mode for sta2
+fc_mode_av = 2 # PHY_FC_MODE_AV_1
+m.create_fcall('activate_rx').add_param_ushort("fc_mode", fc_mode_av).add_param_bool("pre_detection", True).send(sta2)
+
+# Wait 1200 ticks for preamble detection => first wrong preamble
+m.wait(1200)
+
+# Activate RX for both stations
+m.create_fcall('activate_rx').add_param_ushort("fc_mode", fc_mode_10).add_param_bool("pre_detection", True).send(sta1)
+m.create_fcall('activate_rx').add_param_ushort("fc_mode", fc_mode_av).add_param_bool("pre_detection", True).send(sta2)
+
+# Wait 1200 ticks for preamble detection => second wrong preamble
+m.wait(1200)
+
+# Deactivate false alarm feature
+m.deactivate_false_alarm()
+
+# Deactivate preamble detection for both stations
+m.create_fcall('activate_rx').add_param_ushort("fc_mode", fc_mode_10).add_param_bool("pre_detection", False).send(sta1)
+m.create_fcall('activate_rx').add_param_ushort("fc_mode", fc_mode_av).add_param_bool("pre_detection", False).send(sta2)
+
+# Wait to check that there are no more wrong preambles sent
+m.wait(150)
+
+# Uninit HAL PHY
+m.create_fcall('uninit_phy').send(sta1)
+m.create_fcall('uninit_phy').send(sta2)
+
+# Remove station(s)
+sta1.remove()
+sta2.remove()
+
+print "\n*** END ***\n"
diff --git a/cesar/maximus/python/py/test_send_mpdu.py b/cesar/maximus/python/py/test_send_mpdu.py
new file mode 100644
index 0000000000..7397fb7b0b
--- /dev/null
+++ b/cesar/maximus/python/py/test_send_mpdu.py
@@ -0,0 +1,158 @@
+#!/usr/bin/python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+from interface import *
+from maximus import *
+from maximus.macframe.macframequeue import MAX_PB_NB_PER_MPDU
+from struct import pack
+
+# To be run with "test_send.elf" station executable
+# (to be compiled under "/trunk/maximus/stationtest").
+
+maximus = Maximus()
+maximus.init(sys.argv)
+
+def send_fcall2(station):
+ # Send an fcall for one PB of 128 octets
+ fcall2 = maximus.create_fcall('prepare_rx')
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ fcall2.add_param_ushort("fc_mode", fc_mode)
+ fcall2.add_param_bool("short_ppdu", False)
+ mod = 2 # PHY_MOD_MINI_ROBO
+ fcall2.add_param_ushort("mod", mod)
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ fcall2.add_param_ushort("fecrate", fecrate)
+ pb_size = 0 # PHY_PB_SIZE_136
+ fcall2.add_param_ushort("pb_size", pb_size)
+ gil = 1 # PHY_GIL_567
+ fcall2.add_param_ushort("gil", gil)
+ pb_nb = 1
+ fcall2.add_param_ushort("pb_nb", pb_nb)
+ fcall2.send(station)
+
+def send_fcall3(station):
+ # Send an fcall for 3 PBs of 512 octets
+ fcall3 = maximus.create_fcall('prepare_rx')
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ fcall3.add_param_ushort("fc_mode", fc_mode)
+ fcall3.add_param_bool("short_ppdu", False)
+ mod = 0 # PHY_MOD_ROBO
+ fcall3.add_param_ushort("mod", mod)
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ fcall3.add_param_ushort("fecrate", fecrate)
+ pb_size = 1 # PHY_PB_SIZE_520
+ fcall3.add_param_ushort("pb_size", pb_size)
+ gil = 0 # PHY_GIL_417
+ fcall3.add_param_ushort("gil", gil)
+ pb_nb = 3
+ fcall3.add_param_ushort("pb_nb", pb_nb)
+ fcall3.send(station)
+
+def send_fcall4(station):
+ # Send an fcall for a short PPDU with a FC 1.0
+ fcall4 = maximus.create_fcall('prepare_rx')
+ fc_mode = 0 # PHY_FC_MODE_HYBRID_1
+ fcall4.add_param_ushort("fc_mode", fc_mode)
+ fcall4.add_param_bool("short_ppdu", True)
+ fcall4.send(station)
+
+def send_fcall5(station):
+ # Send an fcall for one PB of 512 octets with a FC 1.0
+ fcall5 = maximus.create_fcall('prepare_rx')
+ fc_mode = 0 # PHY_FC_MODE_HYBRID_1
+ fcall5.add_param_ushort("fc_mode", fc_mode)
+ fcall5.add_param_bool("short_ppdu", False)
+ mod = 0 # PHY_MOD_ROBO
+ fcall5.add_param_ushort("mod", mod)
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ fcall5.add_param_ushort("fecrate", fecrate)
+ pb_size = 1 # PHY_PB_SIZE_520
+ fcall5.add_param_ushort("pb_size", pb_size)
+ gil = 0 # PHY_GIL_417
+ fcall5.add_param_ushort("gil", gil)
+ pb_nb = 1
+ fcall5.add_param_ushort("pb_nb", pb_nb)
+ fcall5.send(station)
+
+def send_fcall_236(station):
+ # Send an fcall for 236 PBs of 512 octets
+ fcall_236 = maximus.create_fcall('prepare_rx')
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ fcall_236.add_param_ushort("fc_mode", fc_mode)
+ fcall_236.add_param_bool("short_ppdu", False)
+ mod = 0 # PHY_MOD_ROBO
+ fcall_236.add_param_ushort("mod", mod)
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ fcall_236.add_param_ushort("fecrate", fecrate)
+ pb_size = 1 # PHY_PB_SIZE_520
+ fcall_236.add_param_ushort("pb_size", pb_size)
+ gil = 0 # PHY_GIL_417
+ fcall_236.add_param_ushort("gil", gil)
+ pb_nb = MAX_PB_NB_PER_MPDU
+ fcall_236.add_param_ushort("pb_nb", pb_nb)
+ fcall_236.send(station)
+
+sta = maximus.create_sta ()
+sta.debug ()
+
+fcall1 = maximus.create_fcall('set_tonemask')
+fcall1.send(sta)
+
+# Send an MPDU containing one PB of 128 octets
+send_fcall2(sta)
+macFrame2 = MACFrame()
+macFrame2.set_fc_av(pack('IIII', 123, 456, 789, 10))
+macFrame2.set_msdu('This is the MPDU payload')
+macFrame2.send(maximus)
+
+# Send an MPDU containing 3 PBs of 512 octets
+send_fcall3(sta)
+macFrame3 = MACFrame()
+macFrame3.set_fc_av(pack('IIII', 0, 456, 789, 10))
+macFrame3.set_msdu(1500*'a')
+macFrame3.send(maximus)
+
+# Send a short PPDU with a FC 1.0
+send_fcall4(sta)
+macFrame4 = MACFrame()
+macFrame4.set_fc_10(1)
+macFrame4.set_fc_av(pack('IIII', 123, 456, 789, 10))
+macFrame4.send(maximus, short_ppdu=True)
+
+# Send an MPDU containing one PB of 512 octets with a FC 1.0
+send_fcall5(sta)
+macFrame5 = MACFrame()
+macFrame5.set_fc_10(10)
+macFrame5.set_fc_av(pack('IIII', 123, 456, 789, 10))
+macFrame5.set_msdu(200*'b')
+macFrame5.send(maximus)
+
+# Send an MPDU containing one PB of 128 octets, created from an MME
+send_fcall2(sta)
+macFrame6 = MACFrame(MACFrameHeader='H!', ICV='ICV!')
+macFrame6.set_fc_av(pack('IIII', 123, 456, 789, 10))
+macFrame6.set_msdu(mme.MME(MMHeader='MMHeader 19 octets!', MMEntry='--- This is the Management Message Entry ---'))
+macFrame6.send(maximus)
+
+# Send an MPDU containing 236 PBs
+send_fcall_236(sta)
+macFrame6.set_msdu(512*'a')
+macFrameQueue = MACFrameQueue()
+for i in range (0,79):
+ macFrameQueue.add(macFrame6)
+macFrameQueue.send(maximus)
+
+maximus.wait(10000)
+
+fcall6 = maximus.create_fcall('uninit_phy')
+fcall6.send(sta)
+
+sta.remove()
+
+print "\n*** END ***\n"
diff --git a/cesar/maximus/python/py/test_send_noise.py b/cesar/maximus/python/py/test_send_noise.py
new file mode 100644
index 0000000000..1e5f7ca535
--- /dev/null
+++ b/cesar/maximus/python/py/test_send_noise.py
@@ -0,0 +1,86 @@
+#!/usr/bin/python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+from interface import *
+from maximus import *
+from struct import pack
+
+# To be run with "test_send.elf" station executable
+# (to be compiled under "/trunk/maximus/stationtest").
+
+# Create and initializes Maximus
+maximus = Maximus()
+maximus.init(sys.argv)
+
+# Create stations
+sta1 = maximus.create_sta ()
+sta1.debug ()
+sta2 = maximus.create_sta ()
+sta2.debug ()
+
+# Set TONEMASK
+fcall1 = maximus.create_fcall('set_tonemask')
+fcall1.send(sta1)
+fcall2 = maximus.create_fcall('set_tonemask')
+fcall2.send(sta2)
+
+# This function sends a prepare_rx message to the RX station
+def my_prepare_rx(station):
+ fcall = maximus.create_fcall('prepare_rx')
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ fcall.add_param_ushort("fc_mode", fc_mode)
+ fcall.add_param_bool("short_ppdu", False)
+ mod = 0 # PHY_MOD_ROBO
+ fcall.add_param_ushort("mod", mod)
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ fcall.add_param_ushort("fecrate", fecrate)
+ pb_size = 1 # PHY_PB_SIZE_520
+ fcall.add_param_ushort("pb_size", pb_size)
+ gil = 0 # PHY_GIL_417
+ fcall.add_param_ushort("gil", gil)
+ pb_nb = 3
+ fcall.add_param_ushort("pb_nb", pb_nb)
+ fcall.send(station)
+
+# This function sends an MPDU containing 3 PBs of 512 octets
+def my_send_mpdu(station):
+ my_prepare_rx(station)
+ macFrame1 = MACFrame()
+ macFrame1.set_fc_av(pack('IIII', 0, 456, 789, 10))
+ macFrame1.set_msdu(1500*'a')
+ macFrame1.send(maximus)
+
+# Channel perturbation is disabled => send empty NOISE
+my_prepare_rx(sta2)
+my_send_mpdu(sta1)
+maximus.wait(10000)
+
+# Enable channel perturbation => send default NOISE
+maximus.disturb_channel()
+my_prepare_rx(sta2)
+my_send_mpdu(sta1)
+maximus.wait(10000)
+
+# Set SNR => send default NOISE (because transmitting "station" is Maximus)
+set_snr(maximus, value=15)
+my_prepare_rx(sta2)
+my_send_mpdu(sta1)
+maximus.wait(10000)
+
+# Uninitialize PHY
+fcall3 = maximus.create_fcall('uninit_phy')
+fcall3.send(sta1)
+fcall4 = maximus.create_fcall('uninit_phy')
+fcall4.send(sta2)
+
+# Remove stations
+sta1.remove()
+sta2.remove()
+
+print "\n*** END ***\n"
diff --git a/cesar/maximus/python/py/test_tx_rx.py b/cesar/maximus/python/py/test_tx_rx.py
new file mode 100644
index 0000000000..ac1867ec2b
--- /dev/null
+++ b/cesar/maximus/python/py/test_tx_rx.py
@@ -0,0 +1,217 @@
+#!/usr/bin/python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+from interface import *
+from maximus import *
+from struct import pack
+
+m = Maximus()
+m.init(sys.argv)
+
+
+# TEST TX AND RX
+# To be run with "test_tx_rx.elf" station executable
+# (to be compiled under "/trunk/maximus/stationtest").
+
+# Create station(s)
+sta1 = m.create_sta ()
+
+# Enable channel perturbation
+m.disturb_channel()
+
+# Set tonemask
+fcall1 = m.create_fcall('set_tonemask')
+fcall1.send(sta1)
+
+def create_fcall_128():
+ # Create a fcall for an MPDU containing one PB of 128 octets
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ short_ppdu = False
+ mod = 2 # PHY_MOD_MINI_ROBO
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ pb_size = 0 # PHY_PB_SIZE_136
+ gil = 1 # PHY_GIL_567
+ pb_nb = 1
+ fcall_128 = m.create_fcall('prepare_rx')
+ fcall_128.add_param_ushort("fc_mode", fc_mode)
+ fcall_128.add_param_bool("short_ppdu", short_ppdu)
+ fcall_128.add_param_ushort("mod", mod)
+ fcall_128.add_param_ushort("fecrate", fecrate)
+ fcall_128.add_param_ushort("pb_size", pb_size)
+ fcall_128.add_param_ushort("gil", gil)
+ fcall_128.add_param_ushort("pb_nb", pb_nb)
+ return fcall_128
+
+def create_fcall_512_1():
+ # Create a fcall for an MPDU containing one PB of 512 octets with a FC 1.0
+ fc_mode = 0 # PHY_FC_MODE_HYBRID_1
+ short_ppdu = False
+ mod = 3 # PHY_MOD_TM
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ pb_size = 1 # PHY_PB_SIZE_520
+ gil = 1 # PHY_GIL_567
+ pb_nb = 1
+ fcall_512_1 = m.create_fcall('prepare_rx')
+ fcall_512_1.add_param_ushort("fc_mode", fc_mode)
+ fcall_512_1.add_param_bool("short_ppdu", short_ppdu)
+ fcall_512_1.add_param_ushort("mod", mod)
+ fcall_512_1.add_param_ushort("fecrate", fecrate)
+ fcall_512_1.add_param_ushort("pb_size", pb_size)
+ fcall_512_1.add_param_ushort("gil", gil)
+ fcall_512_1.add_param_ushort("pb_nb", pb_nb)
+ return fcall_512_1
+
+def create_fcall_512_3():
+ # Create a fcall for an MPDU containing 3 PBs of 512 octets
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ short_ppdu = False
+ mod = 0 # PHY_MOD_ROBO
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ pb_size = 1 # PHY_PB_SIZE_520
+ gil = 0 # PHY_GIL_417
+ pb_nb = 3
+ fcall_512_3 = m.create_fcall('prepare_rx')
+ fcall_512_3.add_param_ushort("fc_mode", fc_mode)
+ fcall_512_3.add_param_bool("short_ppdu", short_ppdu)
+ fcall_512_3.add_param_ushort("mod", mod)
+ fcall_512_3.add_param_ushort("fecrate", fecrate)
+ fcall_512_3.add_param_ushort("pb_size", pb_size)
+ fcall_512_3.add_param_ushort("gil", gil)
+ fcall_512_3.add_param_ushort("pb_nb", pb_nb)
+ return fcall_512_3
+
+def create_fcall_short_fc10():
+ # Create a fcall for a short PPDU with a FC 1.0
+ fc_mode = 0 # PHY_FC_MODE_HYBRID_1
+ short_ppdu = True
+ fcall_short_fc10 = m.create_fcall('prepare_rx')
+ fcall_short_fc10.add_param_ushort("fc_mode", fc_mode)
+ fcall_short_fc10.add_param_bool("short_ppdu", short_ppdu)
+ fcall_short_fc10.add_param_ushort("mod", 0)
+ fcall_short_fc10.add_param_ushort("fecrate", 0)
+ fcall_short_fc10.add_param_ushort("pb_size", 0)
+ fcall_short_fc10.add_param_ushort("gil", 0)
+ fcall_short_fc10.add_param_ushort("pb_nb", 0)
+ return fcall_short_fc10
+
+def get_pad(n):
+ pad = ''
+ for i in range (0,n):
+ pad += pack('B', 0)
+ return pad
+
+# Test following functions:
+# - send(self, maximus, fc_mode=4, short_ppdu=0, mod=4, file=None)
+# - sendnrecv(self, maximus, fc_mode=4, short_ppdu=0, mod=4, file=None, timeout=None, filter=None, count=1)
+# - recv(maximus, timeout=None, filter=None, count=1)
+
+# Send an MPDU containing one PB of 128 octets
+fcall_128 = create_fcall_128()
+fcall_128.send(sta1)
+macFrame1 = MACFrame()
+fc_av_1 = (0, 456, 789, 10)
+macFrame1.set_fc_av(fc_av_1)
+msdu1 = 'This is the MPDU payload'
+macFrame1.set_msdu(msdu1)
+macFrame1.set_macframeheader(MACFrameHeader(MFL=len(msdu1)-1))
+macFrame1.send(m)
+rsp1 = recv(m)
+if rsp1[0].get_fc_av() != fc_av_1:
+ print "fc_av_1 =", rsp1[0].get_fc_av()
+ raise Error("fc_av_1")
+if rsp1[0].get_pblist()[0] != MACFrameHeader(MFL=len(msdu1)-1).get() + msdu1 + macFrame1.get_icv() + get_pad(98):
+ print "msdu1 =", rsp1[0].get_pblist()[0]
+ raise Error("msdu1")
+m.wait(100000)
+
+# Send an MPDU containing 3 PBs of 512 octets
+fcall_512_3 = create_fcall_512_3()
+fcall_512_3.send(sta1)
+macFrame2 = MACFrame()
+fc_av_2 = fc_av_1
+macFrame2.set_fc_av(fc_av_2)
+msdu2 = 1500*'a'
+macFrame2.set_msdu(msdu2)
+macFrame2.set_macframeheader(MACFrameHeader(MFL=len(msdu2)-1))
+rsp2 = macFrame2.sendnrecv(m)
+if rsp2[0].get_fc_av() != fc_av_2:
+ print "fc_av_2 =", rsp2[0].get_fc_av()
+ raise Error("fc_av_2")
+if rsp2[0].get_pblist()[0] != MACFrameHeader(MFL=len(msdu2)-1).get() + 510*'a' \
+or rsp2[0].get_pblist()[1] != 512*'a' \
+or rsp2[0].get_pblist()[2] != 478*'a' + macFrame2.get_icv() + get_pad(30):
+ print "msdu2 =", rsp2[0].get_pblist()[0], rsp2[0].get_pblist()[1], rsp2[0].get_pblist()[2]
+ raise Error("msdu2")
+m.wait(100000)
+
+# Send a short PPDU with a FC 1.0
+fcall_short_fc10 = create_fcall_short_fc10()
+fcall_short_fc10.send(sta1)
+macFrame3 = MACFrame()
+fc_10_3 = 1
+macFrame3.set_fc_10(fc_10_3)
+fc_av_3 = (123, 456, 789, 10)
+macFrame3.set_fc_av(fc_av_3)
+macFrame3.send(maximus=m, short_ppdu=True)
+# no rsp3
+m.wait(100000)
+
+# Send an MPDU containing one PB of 512 octets with a FC 1.0
+fcall_512_1 = create_fcall_512_1()
+fcall_512_1.send(sta1)
+macFrame4 = MACFrame()
+fc_10_4 = 10
+macFrame4.set_fc_10(fc_10_4)
+fc_av_4 = fc_av_1
+macFrame4.set_fc_av(fc_av_4)
+msdu4 = 200*'b'
+macFrame4.set_msdu(msdu4)
+macFrame4.set_macframeheader(MACFrameHeader(MFL=len(msdu4)-1))
+macFrame4.send(m)
+rsp4 = recv(m)
+if rsp4[0].get_fc_10() != fc_10_4:
+ print "fc_10_4 =", rsp4[0].get_fc_10()
+ raise Error("fc_10_4")
+if rsp4[0].get_fc_av() != fc_av_4:
+ print "fc_av_4 =", rsp4[0].get_fc_av()
+ raise Error("fc_av_4")
+if rsp4[0].get_pblist()[0] != MACFrameHeader(MFL=len(msdu4)-1).get() + msdu4 + macFrame4.get_icv() + get_pad(306):
+ print "msdu4 =", rsp4[0].get_pblist()[0]
+ raise Error("msdu4")
+m.wait(100000)
+
+# Send an MPDU containing one PB of 128 octets, created from an MME
+fcall_128 = create_fcall_128()
+fcall_128.send(sta1)
+icv5 = 'ICV!'
+macFrame5 = MACFrame(ICV=icv5)
+fc_av_5 = fc_av_1
+macFrame5.set_fc_av(fc_av_5)
+mmheader5 = 'MMHeader 19 octets!'
+mmentry5 = '--- This is the Management Message Entry ---'
+msdu5 = MME(MMHeader=mmheader5, MMEntry=mmentry5)
+macFrame5.set_msdu(msdu5)
+macFrame5.set_macframeheader(MACFrameHeader(MFL=len(mmheader5)+len(mmentry5)-1))
+rsp5 = macFrame5.sendnrecv(m)
+if rsp5[0].get_fc_av() != fc_av_5:
+ print "fc_av_5 =", rsp5[0].get_fc_av()
+ raise Error("fc_av_5")
+if rsp5[0].get_pblist()[0] != MACFrameHeader(MFL=len(mmheader5)+len(mmentry5)-1).get() + mmheader5 + mmentry5 + macFrame5.get_icv() + get_pad(59):
+ print "msdu5 =", rsp5[0].get_pblist()[0]
+ raise Error("msdu5")
+m.wait(100000)
+
+# Uninitialize PHY
+fcall2 = m.create_fcall('uninit_phy')
+fcall2.send(sta1)
+
+# Remove station(s)
+sta1.remove()
+
+print "\n*** END ***\n"
diff --git a/cesar/maximus/python/src/interface_module.cpp b/cesar/maximus/python/src/interface_module.cpp
new file mode 100644
index 0000000000..7890989579
--- /dev/null
+++ b/cesar/maximus/python/src/interface_module.cpp
@@ -0,0 +1,745 @@
+
+#include <boost/python.hpp>
+#include <boost/python/class.hpp>
+#include <boost/python/module.hpp>
+#include <boost/python/call.hpp>
+#include <boost/python/call_method.hpp>
+
+#include <boost/python/return_value_policy.hpp>
+#include <boost/python/copy_non_const_reference.hpp>
+#include <boost/python/return_internal_reference.hpp>
+
+#include <boost/python/detail/api_placeholder.hpp>
+
+#include "maximus/common/interfaces/Maximus.h"
+#include "maximus/common/interfaces/Sta.h"
+#include "maximus/common/interfaces/Msg.h"
+
+#include "ISystem.h"
+#include "IFunctionCall.h"
+#include "PhySciMsgMpdu.h"
+#include "PhySciMsgFc.h"
+#include "EtherSciMsg.h"
+
+#include "Logger.h"
+
+using namespace std;
+using namespace boost::python;
+
+// For unitary tests
+extern bool UNITTEST;
+extern string stationTest;
+
+// For Maximus log
+extern Logger logger;
+
+// To catch signals
+extern Maximus * pMaximus;
+
+// To log Ether SCI messages
+File_Descriptor etherLogFileDescriptor = -1;
+
+typedef std::multimap<Function_Call_Msg_Id, object, compareMsgId> CbsList;
+CbsList listOfCbs;
+
+typedef struct rx_param_phy
+{
+ object create_pb;
+ object cb;
+ bool activated;
+} rx_param_phy_t;
+rx_param_phy_t phy_rx_param;
+
+typedef struct rx_param_ether
+{
+ object create_eth;
+ object create_mme;
+ object create_buffer;
+ object create_sniffer;
+ object cb;
+ bool activated;
+} rx_param__ether_t;
+rx_param__ether_t ether_rx_param;
+
+
+void log_ether ( EtherSciMsg & ether )
+{
+ logFunction();
+
+ if (-1 != etherLogFileDescriptor)
+ {
+ /* Write the Ether SCI message into the Ether log file. */
+ int length = 0;
+ int totalLength = 0;
+ while(totalLength < (int)ether.getSpecializedSciMsgDataLength())
+ {
+ length = write(etherLogFileDescriptor, ether.getSpecializedSciMsgData() + totalLength, ether.getSpecializedSciMsgDataLength() - totalLength);
+ if(length < 0)
+ {
+ if (EAGAIN != errno)
+ {
+ Error e(__PRETTY_FUNCTION__, "write Ether SCI message failed", errno);
+ e.display();
+ throw e;
+ }
+ else
+ {
+ length = 0;
+ }
+ }
+ totalLength += length;
+ }
+ }
+}
+
+
+void set_fcall_cb ( const Msg & msg, object user_cb )
+{
+ listOfCbs.insert(CbsList::value_type(msg.get_tx_msg_id(), user_cb));
+}
+
+
+void remove_fcall_cb ( const Msg & msg )
+{
+ for (CbsList::const_iterator it = listOfCbs.begin(); it != listOfCbs.end(); ++it)
+ {
+ if (msg.get_tx_msg_id() == it->first)
+ {
+ listOfCbs.erase(it->first);
+ break;
+ }
+ }
+}
+
+
+void recv_fcall_cb ( Msg & msg )
+{
+ for (CbsList::const_iterator it = listOfCbs.begin(); it != listOfCbs.end(); ++it)
+ {
+ if (msg.get_rx_msg_id() == it->first)
+ {
+ (it->second)(msg);
+ listOfCbs.erase(it->first);
+ break;
+ }
+ }
+}
+
+
+void recv_phy_mpdu_cb ( PhySciMsgMpdu & mpdu )
+{
+ logFunction();
+
+ if (phy_rx_param.activated)
+ {
+ // Create a new MPDU Python object (PB)
+ object rx_mpdu = phy_rx_param.create_pb();
+
+ // Get PHY SCI message MPDU attributes
+ // and set the MPDU object attributes
+ // (FC 1.0, FC AV and MPDU payload)
+ string payload((char *)mpdu.getSpecializedSciMsgData(), mpdu.getSpecializedSciMsgDataLength());
+ rx_mpdu.attr("set_mpdu_attr")(mpdu.getFc10(),
+ make_tuple(mpdu.getFcAv()[0], mpdu.getFcAv()[1], mpdu.getFcAv()[2], mpdu.getFcAv()[3]),
+ payload);
+
+ // Call the Python reception callback
+ phy_rx_param.activated = !phy_rx_param.cb(rx_mpdu);
+ }
+}
+
+
+void recv_ether_cb ( EtherSciMsg & ether )
+{
+ logFunction();
+
+ // Log the received Ether SCI message
+ log_ether(ether);
+
+ if ( ether_rx_param.activated
+ || (ETHERNET_TYPE_BUFFER_RELEASED == ether.getSpecializedSciMsgType()) )
+ {
+ // Get Ethernet SCI message attributes
+ string payload((char *)ether.getSpecializedSciMsgData(), ether.getSpecializedSciMsgDataLength());
+
+ // Create a new MSDU Python object (Eth, MME, Buffer or Sniffer)
+ object rx_msdu;
+ if (ETHERNET_TYPE_DATA == ether.getSpecializedSciMsgType())
+ {
+ rx_msdu = ether_rx_param.create_eth();
+ }
+ else if (ETHERNET_TYPE_MME == ether.getSpecializedSciMsgType())
+ {
+ rx_msdu = ether_rx_param.create_mme();
+ }
+ else if (ETHERNET_TYPE_BUFFER_RELEASED == ether.getSpecializedSciMsgType())
+ {
+ rx_msdu = ether_rx_param.create_buffer();
+ }
+ else if (ETHERNET_TYPE_SNIFFER == ether.getSpecializedSciMsgType())
+ {
+ /* Read flags. */
+ // way
+ bool way = (ETHERNET_FLAG_WAY == (ether.getFlags() & ETHERNET_FLAG_WAY));
+ // encryption
+ bool encryption = (ETHERNET_FLAG_ENCRYPTED == (ether.getFlags() & ETHERNET_FLAG_ENCRYPTED));
+
+ rx_msdu = ether_rx_param.create_sniffer(way, encryption, ether.getSnifferType());
+ }
+ else
+ {
+ errno = ENOMSG;
+ Error e(__PRETTY_FUNCTION__, "receive an Ether SCI message with a bad type (should be DATA, MME, BUFFER_RELEASED or SNIFFER)", errno);
+ e.display();
+ throw e;
+ }
+
+ if (ETHERNET_TYPE_BUFFER_RELEASED == ether.getSpecializedSciMsgType())
+ {
+ // Reallocate a buffer if requested by user
+ rx_msdu.attr("realloc")(ether.getSciMsgStationId(), payload);
+ }
+
+ // Set the MSDU object attributes (payload)
+ rx_msdu.attr("set_msdu_attr")(payload);
+
+ if (ether_rx_param.activated)
+ {
+ // Call the Python reception callback
+ ether_rx_param.activated = !ether_rx_param.cb(rx_msdu);
+ }
+ }
+}
+
+/*
+void init_wrap ( Maximus & m, const int argc, const string args )
+{
+ size_t previous = 0;
+ size_t found = 0;
+ char * argv[argc];
+ int i = 0;
+
+ do
+ {
+ found = args.find(' ', previous);
+ string temp = args.substr(previous, found-previous);
+ argv[i] = new char[temp.size()+1];
+ strcpy(argv[i], temp.c_str());
+ previous = found+1;
+ i++;
+ }
+ while ((found != string::npos) && (i<argc));
+
+ m.init(argc,argv);
+
+ for (i=0; i<argc; i++)
+ {
+ delete [] argv[i];
+ }
+}
+*/
+
+void init_wrap ( Maximus & m, object args )
+{
+ int argc = len (args);
+ /* std::string.c_str() returns a const, need a temporary storage because
+ * of getopt. */
+ std::vector<char> args_copy[argc];
+ char *argv[argc];
+ /* Make the argv array. */
+ for (int i = 0; i < argc; i++)
+ {
+ const std::string s = extract<std::string> (args[i]);
+ args_copy[i].insert (args_copy[i].end (), s.c_str (),
+ s.c_str () + s.size () + 1);
+ argv[i] = &args_copy[i][0];
+ }
+ /* Call the real function. */
+ m.init (argc, argv);
+
+ phy_rx_param.activated = false;
+ ether_rx_param.activated = false;
+ m.init_phy (&recv_phy_mpdu_cb);
+ etherLogFileDescriptor = m.init_ether (&recv_ether_cb);
+}
+
+
+PyObject * create_sta_wrapx1 ( Maximus & m )
+{
+ return_internal_reference<1, Maximus>::result_converter::apply<Sta &>::type converter;
+ return converter(m.create_sta());
+}
+
+
+PyObject * create_sta_wrapx2 ( Maximus & m, const string & station_executable )
+{
+ return_internal_reference<1, Maximus>::result_converter::apply<Sta &>::type converter;
+ return converter(m.create_sta(station_executable));
+}
+
+
+PyObject * create_fcall_wrap ( Maximus & m, const string name )
+{
+ return_internal_reference<1, Maximus>::result_converter::apply<Msg &>::type converter;
+ return converter(m.create_fc(name));
+}
+
+
+PyObject * create_probe_wrap ( Maximus & m )
+{
+ return_internal_reference<1, Maximus>::result_converter::apply<Msg &>::type converter;
+ return converter(m.create_probe());
+}
+
+
+void send_phy ( Maximus & m, object mpdu )
+{
+ /* Create a PHY SCI message MPDU. */
+ PhySciMsgMpdu * pMpdu = m.create_mpdu();
+
+ /* Extract MPDU object attributes
+ * and set the PHY SCI message MPDU attributes. */
+
+ // Extract and set FC 1.0
+ uint32_t fc_10 = extract<uint32_t>(mpdu.attr("fc_10"));
+ if (0 != fc_10)
+ {
+ pMpdu->setFc10(fc_10);
+ }
+
+ // Extract and set FC AV
+ uint32_t fc_av[4];
+ for (int i=0; i<4; i++)
+ {
+ fc_av[i] = extract<uint32_t>(mpdu.attr("fc_av")[i]);
+ }
+ pMpdu->setFcAv(fc_av);
+
+ // Extract MPDU payload and set MPDU payload length and MPDU payload
+ string payload = extract<string>(mpdu.attr("payload"));
+ pMpdu->setMpdu((unsigned long)payload.length(), (unsigned char *)payload.c_str());
+
+ // Set MPDU format
+ // HomePlug AV specs => delimiter type (DT_AV) is described by bits 0-2 of first fc_av octet:
+ // 000 Beacon
+ // 001 SOF
+ // 010 SACK
+ // 011 RTS/CTS
+ // 100 SOUND
+ // 101 RSOF
+ pMpdu->setMpduFormat((Phy_Mpdu_Format)((fc_av[0] & 0x07) + 1)); // +1 to have the correspondance with our own MPDU format definition (of 'phy_types.h')
+
+ // Extract and set FC mode
+ int fc_mode = extract<int>(mpdu.attr("fc_mode"));
+ if ( PHY_FC_MODE_NONE == (Phy_Fc_Mode)fc_mode )
+ {
+ if (0 == fc_10)
+ {
+ fc_mode = PHY_FC_MODE_AV_1;
+ }
+ else
+ {
+ fc_mode = PHY_FC_MODE_HYBRID_1;
+ }
+ }
+ pMpdu->setFcMode((Phy_Fc_Mode)fc_mode);
+
+ // Extract and set short PPDU
+ pMpdu->setShortPpdu((Phy_Short_Ppdu)extract<int>(mpdu.attr("short_ppdu")));
+
+ // Set default flags
+ pMpdu->setFlags(PHY_FLAG_CRC_OK);
+
+ if (!pMpdu->getShortPpdu())
+ {
+ // Extract and set modulation
+ int mod = extract<int>(mpdu.attr("mod"));
+ if (PHY_MOD_TM == (Phy_Mod)mod)
+ {
+ errno = EINVAL;
+ Error e(__PRETTY_FUNCTION__, "modulation cannot be set to PHY_MOD_TM", errno);
+ e.display();
+ throw e;
+ }
+ else if ((PHY_MOD_NONE == (Phy_Mod)mod) && (MAC_PB136_BYTES >= payload.length()))
+ {
+ mod = PHY_MOD_MINI_ROBO;
+ }
+ else if ((PHY_MOD_NONE == (Phy_Mod)mod) && (MAC_PB136_BYTES < payload.length()))
+ {
+ mod = PHY_MOD_ROBO;
+ }
+ pMpdu->setMod((Phy_Mod)mod);
+
+ // Set default FEC rate
+ pMpdu->setFecrate(PHY_FEC_RATE_1_2);
+
+ if (PHY_MOD_MINI_ROBO == pMpdu->getMod())
+ {
+ // Set default Guard Interval
+ pMpdu->setGil(PHY_GIL_567);
+ // Set default PB size
+ pMpdu->setPbSize(MAC_PB136_BYTES);
+ }
+ else
+ {
+ // Set default Guard Interval
+ pMpdu->setGil(PHY_GIL_417);
+ // Set default PB size
+ pMpdu->setPbSize(MAC_PB520_BYTES);
+ // Set default flags
+ pMpdu->setFlags(PHY_FLAG_CRC_OK+PHY_FLAG_PB512);
+ }
+ }
+
+ // Extract and set PB Header
+ uint32_t pbHeader = extract<uint32_t>(mpdu.attr("first_pb_header"));
+ if (0 != pbHeader)
+ {
+ unsigned short int mfboCounter = 1;
+ unsigned long mfbo = extract<unsigned long>(mpdu.attr("mfbo")[mfboCounter]);
+ for (unsigned short int n=0; n<MAC_MAX_PB_PER_MPDU; n++)
+ {
+ if (0 != n)
+ {
+ while ( (0 != mfbo) && (mfbo < (unsigned long)(n * pMpdu->getPbSize())) )
+ {
+ // increment MFBO counter
+ mfboCounter++;
+ // extract MFBO
+ mfbo = extract<unsigned long>(mpdu.attr("mfbo")[mfboCounter]);
+ }
+
+ // extract MFBO
+ if ( (0 != mfbo) && (mfbo < (unsigned long)((n + 1) * pMpdu->getPbSize())) )
+ {
+ // set MFBF
+ pbHeader |= (1 << 27);
+ // set MFB0
+ pbHeader += ((mfbo % pMpdu->getPbSize()) << 16);
+ }
+ }
+
+ // set PBs Headers
+ pMpdu->setPbsHeaders(n, pbHeader);
+
+ // reset MFBF and MFBO, and increment SSN
+ if (0xFFFF > (pbHeader & 0xFFFF))
+ {
+ pbHeader = (pbHeader & 0xF600FFFF) + 1;
+ }
+ else
+ {
+ pbHeader &= 0xF6000000;
+ }
+ }
+ }
+
+ /* Send the PHY SCI message MPDU. */
+ m.send_mpdu(pMpdu);
+ while (!pMpdu->isSent())
+ {
+ m.process();
+ }
+
+ /* Delete the PHY SCI message MPDU. */
+ if (NULL != pMpdu)
+ {
+ delete (pMpdu);
+ pMpdu = NULL;
+ }
+}
+
+
+void set_phy_rx ( Maximus & m, object user_cb, object create_pb_function )
+{
+ phy_rx_param.cb = user_cb;
+ phy_rx_param.create_pb = create_pb_function;
+ phy_rx_param.activated = true;
+}
+
+
+void send_ether ( Maximus & m, object msdu, int station_id )
+{
+ /* Create an Ether SCI message. */
+ EtherSciMsg * pEther = m.create_ether();
+
+ /* Set the Ether SCI message attributes. */
+
+ // Extract MSDU payload and set Ether SCI message payload length and Ether SCI message payload
+ string payload = extract<string>(msdu.attr("get")());
+ pEther->setSpecializedSciMsgDataLength((unsigned long)payload.length());
+ pEther->setSpecializedSciMsgData((unsigned char *)payload.c_str());
+
+ // Set Ether SCI message type
+ int type = extract<int>(msdu.attr("get_ether_type")());
+ pEther->setSpecializedSciMsgType(static_cast<Ethernet_Type>(type));
+
+ // Set station ID
+ pEther->setSciMsgStationId(static_cast<Sci_Msg_Station_Id>(station_id));
+
+ /* Log the Ether SCI message to send. */
+ log_ether(*pEther);
+
+ /* Send the Ether SCI message. */
+ m.send_ether(*pEther);
+
+ /* Delete the Ether SCI message. */
+ if (NULL != pEther)
+ {
+ delete (pEther);
+ pEther = NULL;
+ }
+}
+
+
+void set_ether_rx ( Maximus & m,
+ object user_cb,
+ object create_eth_function,
+ object create_mme_function,
+ object create_buffer_function,
+ object create_sniffer_function )
+{
+ ether_rx_param.cb = user_cb;
+ ether_rx_param.create_eth = create_eth_function;
+ ether_rx_param.create_mme = create_mme_function;
+ ether_rx_param.create_buffer = create_buffer_function;
+ ether_rx_param.create_sniffer = create_sniffer_function;
+ ether_rx_param.activated = true;
+}
+
+
+PyObject * add_param_bool ( Msg & msg, const string name, const bool value )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ msg.add_param<bool>(name, value);
+ return converter(msg);
+}
+
+
+PyObject * add_param_uchar ( Msg & msg, const string name, const unsigned char value )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ msg.add_param(name, sizeof(unsigned char), &value);
+ return converter(msg);
+}
+
+
+PyObject * add_param_ushort ( Msg & msg, const string name, const unsigned short int value )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ msg.add_param<unsigned short int>(name, value);
+ return converter(msg);
+}
+
+
+PyObject * add_param_ulong ( Msg & msg, const string name, const unsigned long int value )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ msg.add_param<unsigned long int>(name, value);
+ return converter(msg);
+}
+
+
+PyObject * add_param_n_u8 ( Msg & msg, const string name, tuple value )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ unsigned long length = (unsigned long)len(value);
+ unsigned char param[length];
+ for (unsigned long i=0; i<length; i++)
+ {
+ param[i] = extract<unsigned char>(value[i]);
+ }
+ msg.add_param(name, length*sizeof(unsigned char), param);
+ return converter(msg);
+}
+
+
+PyObject * add_param_n_u16 ( Msg & msg, const string name, tuple value )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ unsigned long length = (unsigned long)len(value);
+ unsigned short int param[length];
+ for (unsigned long i=0; i<length; i++)
+ {
+ param[i] = htons(extract<unsigned short int>(value[i]));
+ }
+ msg.add_param(name, length*sizeof(unsigned short int), (unsigned char *)&param);
+ return converter(msg);
+}
+
+
+PyObject * add_param_n_u32 ( Msg & msg, const string name, tuple value )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ unsigned long length = (unsigned long)len(value);
+ unsigned long int param[length];
+ for (unsigned long i=0; i<length; i++)
+ {
+ param[i] = htonl(extract<unsigned long int>(value[i]));
+ }
+ msg.add_param(name, length*sizeof(unsigned long int), (unsigned char *)&param);
+ return converter(msg);
+}
+
+
+PyObject * set_cb_wrap ( Msg & msg, object user_cb )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ remove_fcall_cb(msg);
+ set_fcall_cb(msg, user_cb);
+ msg.set_cb(&recv_fcall_cb);
+ return converter(msg);
+}
+
+
+PyObject * remove_cb_wrap ( Msg & msg )
+{
+ copy_non_const_reference::apply<Msg &>::type converter;
+ remove_fcall_cb(msg);
+ msg.remove_cb();
+ return converter(msg);
+}
+
+
+string bind_param ( Msg & msg, const string name )
+{
+ string str;
+ unsigned long ulLength = FUNCTION_CALL_PARAM_MAX_SIZE;
+ unsigned char ucValue[ulLength];
+ if (NULL != msg.bind_param(name, ulLength, ucValue))
+ {
+ str.assign((char *)ucValue, ulLength);
+ }
+ return str;
+}
+
+
+string bind_param_string ( Msg & msg, const string name )
+{
+ string str(bind_param(msg, name));
+ if ( (0 < str.length()) && ('\0' == str[str.length()-1]) )
+ {
+ str.erase(str.length()-1);
+ }
+ return str;
+}
+
+
+bool bind_param_bool ( Msg & msg, const string name )
+{
+ return msg.bind_param<bool>(name);
+}
+
+
+unsigned short int bind_param_ushort ( Msg & msg, const string name )
+{
+ return msg.bind_param<unsigned short int>(name);
+}
+
+
+unsigned long int bind_param_ulong ( Msg & msg, const string name )
+{
+ return msg.bind_param<unsigned long int>(name);
+}
+
+
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(disturb_channel_overloads, Maximus::disturb_channel, 0, 1)
+
+BOOST_PYTHON_MODULE(interface)
+{
+ /* class Maximus */
+
+ void (Maximus::*waitx1)(const tick_t) = &Maximus::wait;
+ void (Maximus::*waitx2)(void) = &Maximus::wait;
+
+ void (Maximus::*set_snrx1)(const float) = &Maximus::set_snr;
+ void (Maximus::*set_snrx2)(const string &) = &Maximus::set_snr;
+ void (Maximus::*set_snr_from_srcx1)(const float, const Sta &, const bool) = &Maximus::set_snr_from_src;
+ void (Maximus::*set_snr_from_srcx2)(const string &, const Sta &, const bool) = &Maximus::set_snr_from_src;
+ void (Maximus::*set_snr_to_dstx1)(const float, const Sta &, const bool) = &Maximus::set_snr_to_dst;
+ void (Maximus::*set_snr_to_dstx2)(const string &, const Sta &, const bool) = &Maximus::set_snr_to_dst;
+ void (Maximus::*set_snr_from_src_to_dstx1)(const float, const Sta &, const Sta &, const bool) = &Maximus::set_snr_from_src_to_dst;
+ void (Maximus::*set_snr_from_src_to_dstx2)(const string &, const Sta &, const Sta &, const bool) = &Maximus::set_snr_from_src_to_dst;
+
+ class_<Maximus, boost::noncopyable>("Maximus")
+ .def("init", init_wrap)
+ .def("process", &Maximus::process)
+ .def("create_sta", create_sta_wrapx1) // create a station with the default station executable (from command line arguments)
+ .def("create_sta", create_sta_wrapx2) // create a station with an explicit station executable
+ .def("create_fcall", create_fcall_wrap)
+ .def("create_probe", create_probe_wrap)
+ .def("send_mpdu", send_phy)
+ .def("set_mpdu_rx", set_phy_rx)
+ .def("send_msdu", send_ether)
+ .def("set_msdu_rx", set_ether_rx)
+ .def("wait", waitx1)
+ .def("wait", waitx2)
+ .def("disturb_channel", &Maximus::disturb_channel, disturb_channel_overloads())
+ .def("get_date", &Maximus::get_date)
+ .def("set_freq", &Maximus::set_freq)
+ .def("get_freq", &Maximus::get_freq)
+ .def("set_snr", set_snrx1)
+ .def("set_snr", set_snrx2)
+ .def("set_snr_from_src", set_snr_from_srcx1)
+ .def("set_snr_from_src", set_snr_from_srcx2)
+ .def("set_snr_to_dst", set_snr_to_dstx1)
+ .def("set_snr_to_dst", set_snr_to_dstx2)
+ .def("set_snr_from_src_to_dst", set_snr_from_src_to_dstx1)
+ .def("set_snr_from_src_to_dst", set_snr_from_src_to_dstx2)
+ .def("activate_false_alarm", &Maximus::activate_false_alarm)
+ .def("deactivate_false_alarm", &Maximus::deactivate_false_alarm)
+ .def("is_station_idle", &Maximus::is_station_idle)
+ ;
+
+ /* class Sta */
+
+ class_<Sta>("Sta", init< Maximus *, ISystem *, const string & >())
+ .def("remove", &Sta::remove)
+ .def("deactivate", &Sta::deactivate)
+ .def("activate", &Sta::activate)
+ .def("debug", &Sta::debug)
+ .def("is_idle", &Sta::is_idle)
+ .def("get_station_id", &Sta::getStationId)
+ .def("set_name", &Sta::set_name)
+ ;
+
+ /* class Msg */
+
+ Msg & (Msg::*add_paramx1)(const string &) = &Msg::add_param;
+ Msg & (Msg::*add_paramx2)(const string &, const string &) = &Msg::add_param;
+
+ void (Msg::*send_asyncx1)(void) = &Msg::send_async;
+ void (Msg::*send_asyncx2)(Sta &) = &Msg::send_async;
+
+ Msg & (Msg::*sendx1)(void) = &Msg::send;
+ Msg & (Msg::*sendx2)(Sta &) = &Msg::send;
+
+ class_<Msg>("Msg", init< Maximus *, IFunctionCall *, ISystem *, optional<const string &> >())
+ .def("add_param", add_paramx1, return_value_policy<copy_non_const_reference>())
+ .def("add_param", add_paramx2, return_value_policy<copy_non_const_reference>())
+ .def("add_param_bool", add_param_bool)
+ .def("add_param_uchar", add_param_uchar)
+ .def("add_param_ushort", add_param_ushort)
+ .def("add_param_ulong", add_param_ulong)
+ .def("add_param_n_u8", add_param_n_u8)
+ .def("add_param_n_u16", add_param_n_u16)
+ .def("add_param_n_u32", add_param_n_u32)
+ .def("remove_param", &Msg::remove_param, return_value_policy<copy_non_const_reference>())
+ .def("set_cb", set_cb_wrap)
+ .def("remove_cb", remove_cb_wrap)
+ .def("set_sta", &Msg::set_sta, return_value_policy<copy_non_const_reference>())
+ .def("send_async", send_asyncx1)
+ .def("send_async", send_asyncx2)
+ .def("send", sendx1, return_value_policy<copy_non_const_reference>())
+ .def("send", sendx2, return_value_policy<copy_non_const_reference>())
+ .def("is_param", &Msg::is_param)
+ .def("bind_param", bind_param)
+ .def("bind_param_string", bind_param_string)
+ .def("bind_param_bool", bind_param_bool)
+ .def("bind_param_ushort", bind_param_ushort)
+ .def("bind_param_ulong", bind_param_ulong)
+ ;
+
+}
+
diff --git a/cesar/maximus/python/test/startup.py b/cesar/maximus/python/test/startup.py
new file mode 100755
index 0000000000..205c4abd0d
--- /dev/null
+++ b/cesar/maximus/python/test/startup.py
@@ -0,0 +1,29 @@
+#! usr/bin/env python
+
+print __name__
+
+import sys
+
+# for maximus package
+sys.path.append('../python')
+sys.path.append('../../python')
+
+# for interface module
+sys.path.append('./obj')
+sys.path.append('../obj')
+
+# for libraries
+sys.path.append('./lib')
+sys.path.append('../lib')
+
+# for Cesar library
+sys.path.append('./lib/cesar')
+sys.path.append('../lib/cesar')
+
+# for CRC 24 library
+sys.path.append('./lib/fcVf/crc24')
+sys.path.append('../lib/fcVf/crc24')
+
+# for proto library
+sys.path.append('./lib/proto')
+sys.path.append('../lib/proto')
diff --git a/cesar/maximus/python/test/test.txt b/cesar/maximus/python/test/test.txt
new file mode 100644
index 0000000000..fdf4907302
--- /dev/null
+++ b/cesar/maximus/python/test/test.txt
@@ -0,0 +1,94 @@
+
+DATA TEST
+---------
+
+Allow to get values in different formats.
+
+>>> from maximus.utils.converter import *
+>>> d=Data(123,10)
+>>> d.get_hex()
+'7b'
+
+
+FORMAT TEST
+-----------
+
+>>> from maximus.utils.format import *
+>>> hton8(0x41)
+'A'
+>>> hex(ntoh8('A'))
+'0x41'
+>>> hex(ntoh8(hton8(0x41)))
+'0x41'
+>>> hton16(0x4142)
+'AB'
+>>> hex(ntoh16('AB'))
+'0x4142'
+>>> hex(ntoh16(hton16(0x4142)))
+'0x4142'
+>>> hton32(0x41424344)
+'ABCD'
+>>> hex(ntoh32('ABCD'))
+'0x41424344'
+>>> hex(ntoh32(hton32(0x41424344)))
+'0x41424344'
+>>> hton48(0x414243444546)
+'ABCDEF'
+>>> hex(ntoh48('ABCDEF'))
+'0x414243444546L'
+>>> hex(ntoh48(hton48(0x414243444546)))
+'0x414243444546L'
+>>> hton48_tuple((0x41, 0x42, 0x43, 0x44, 0x45, 0x46))
+'ABCDEF'
+>>> ntoh48_tuple('ABCDEF')
+(65, 66, 67, 68, 69, 70)
+>>> ntoh48_tuple(hton48_tuple((65, 66, 67, 68, 69, 70)))
+(65, 66, 67, 68, 69, 70)
+>>> hton64(0x4142434445464748)
+'ABCDEFGH'
+>>> hex(ntoh64('ABCDEFGH'))
+'0x4142434445464748L'
+>>> hex(ntoh64(hton64(0x4142434445464748)))
+'0x4142434445464748L'
+>>> htohp8(0x41)
+'A'
+>>> hex(hptoh8('A'))
+'0x41'
+>>> hex(hptoh8(htohp8(0x41)))
+'0x41'
+>>> htohp16(0x4142)
+'BA'
+>>> hex(hptoh16('BA'))
+'0x4142'
+>>> hex(hptoh16(htohp16(0x4142)))
+'0x4142'
+>>> htohp24(0x414243)
+'CBA'
+>>> hex(hptoh24('CBA'))
+'0x414243'
+>>> hex(hptoh24(htohp24(0x414243)))
+'0x414243'
+>>> htohp32(0x41424344)
+'DCBA'
+>>> hex(hptoh32('DCBA'))
+'0x41424344'
+>>> hex(hptoh32(htohp32(0x41424344)))
+'0x41424344'
+>>> htohp48(0x414243444546)
+'DCBAFE'
+>>> hex(hptoh48('DCBAFE'))
+'0x414243444546L'
+>>> hex(hptoh48(htohp48(0x414243444546)))
+'0x414243444546L'
+>>> htohp48_tuple((0x41, 0x42, 0x43, 0x44, 0x45, 0x46))
+'DCBAFE'
+>>> hptoh48_tuple('DCBAFE')
+(65, 66, 67, 68, 69, 70)
+>>> hptoh48_tuple(htohp48_tuple((65, 66, 67, 68, 69, 70)))
+(65, 66, 67, 68, 69, 70)
+>>> htohp64(0x4142434445464748)
+'HGFEDCBA'
+>>> hex(hptoh64('HGFEDCBA'))
+'0x4142434445464748L'
+>>> hex(hptoh64(htohp64(0x4142434445464748)))
+'0x4142434445464748L'
diff --git a/cesar/maximus/python/test/test_channel.py b/cesar/maximus/python/test/test_channel.py
new file mode 100644
index 0000000000..cc8a23d394
--- /dev/null
+++ b/cesar/maximus/python/test/test_channel.py
@@ -0,0 +1,80 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys, startup
+
+from maximus.channel import *
+from maximus.station import *
+from interface import *
+
+
+# CHANNEL TEST
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+# Enable channel perturbation
+m.disturb_channel()
+
+# Create an SNR description file
+f = open('test/channel_settings.txt', 'w+')
+for i in range(0, 7):
+ f.write(str((i+1)*5000) + "\t")
+f.write("# End times (in ticks) of each interval of the beacon period\n")
+for i in range (0, 1155):
+ f.write(str(i+1+0.1) + "\t" + str(i+1+0.2) + "\t" + str(i+1+0.3) + "\t" + str(i+1+0.4) + "\t" + str(i+1+0.5) + "\t" + str(i+1+0.6) + "\t" + str(i+1+0.7) + "\t" + str(i+1+0.8) + "\t" + "# SNR values (in dB) for carrier number " + str(i+1) + "\n")
+f.close()
+
+# Set the SNR
+staA = STA(m)
+staB = STA(m)
+set_snr(m, value=15)
+set_snr(m, file='test/channel_settings.txt')
+set_snr(m, value=10, src=staA)
+set_snr(m, file='test/channel_settings.txt', src=staA)
+set_snr(m, value=12, dst=staB)
+set_snr(m, file='test/channel_settings.txt', dst=staB)
+set_snr(m, value=12, src=staA, dst=staB)
+set_snr(m, file='test/channel_settings.txt', src=staA, dst=staB)
+staC = STA(m)
+set_snr(m, value=10, src=staA)
+set_snr(m, file='test/channel_settings.txt', src=staC, both_directions=True)
+set_snr(m, value=12, dst=staC)
+set_snr(m, file='test/channel_settings.txt', dst=staC, both_directions=True)
+set_snr(m, value=12, src=staA, dst=staC, both_directions=True)
+set_snr(m, file='test/channel_settings.txt', src=staA, dst=staC, both_directions=True)
+staD = m.create_sta()
+set_snr(m, value=12, src=staD)
+
+# Remove stations
+m.create_fcall("uninit_ether").send(staA.get())
+staA.remove()
+m.create_fcall("uninit_ether").send(staB.get())
+staB.remove()
+m.create_fcall("uninit_ether").send(staC.get())
+staC.remove()
+m.create_fcall("uninit_ether").send(staD)
+staD.remove()
+
+
+# DOC TEST
+
+import doctest
+doctest.testmod(snr)
+
+
+# UNIT TEST
+
+import unittest
+suite = unittest.TestSuite()
+try:
+ suite.addTest(doctest.DocTestSuite(snr))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_cli.py b/cesar/maximus/python/test/test_cli.py
new file mode 100644
index 0000000000..a0b8984d19
--- /dev/null
+++ b/cesar/maximus/python/test/test_cli.py
@@ -0,0 +1,26 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import startup
+
+from maximus.cli import *
+
+
+# CLI TEST
+
+
+# DOC TEST
+
+import doctest
+#doctest.testmod()
+
+
+# UNIT TEST
+
+import unittest
+suite = unittest.TestSuite()
+#try:
+# suite.addTest(doctest.DocTestSuite())
+#except ValueError:
+# print "has no tests"
diff --git a/cesar/maximus/python/test/test_ethernet.py b/cesar/maximus/python/test/test_ethernet.py
new file mode 100644
index 0000000000..fec75fe623
--- /dev/null
+++ b/cesar/maximus/python/test/test_ethernet.py
@@ -0,0 +1,489 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys, startup
+
+from maximus.ethernet import *
+from maximus.ethernet.buffer import Buffer
+from maximus.ethernet.create import create_eth, create_buffer, create_sniffer
+from maximus.ethernet.eth import MIN_SIZE_OF_HEADER, MAX_SIZE_OF_HEADER
+from maximus.ethernet.sniffer import Sniffer
+from maximus.macframe.msdu import MIN_SIZE_OF_MSDU
+from maximus.simu.rx import * # for 'recv()' function
+from maximus.utils.exception import Error, OutOfRangeError
+from interface import *
+from struct import pack, unpack
+
+
+# ETH TEST
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+# Create the destination station
+staRx = m.create_sta()
+staRx.debug()
+
+# Init ether
+fcall = m.create_fcall('init_ether')
+fcall.send(staRx)
+
+# Create an Ethernet frame
+f = Eth()
+
+# Create an Ethernet frame
+f.dst = '41:42:43:44:45:46'
+f.src = '47:48:49:4a:4b:4c'
+f.vlantag = 0x81004D4E
+f.type = 0x4F50
+s = 'This is the Ethernet Payload'
+f.payload = s
+if len(f) != MIN_SIZE_OF_HEADER + len(s):
+ print "expected length = ", MIN_SIZE_OF_HEADER + len(s)
+ print "length = ", len(f)
+ raise Error('Ethernet frame payload length')
+if str(f) != 'ABCDEFGHIJKLOP' + str(f.payload):
+ print "expected payload =", 'ABCDEFGHIJKLOP' + str(f.payload)
+ print "payload = ", str(f)
+ raise Error('Ethernet frame payload')
+
+# Create an Ethernet frame containing an IP frame
+g = Eth(dst=f.dst, src=f.src)/IP()
+if len(g) != MIN_SIZE_OF_HEADER + len(str(IP())):
+ raise Error('Ethernet IP frame payload length')
+h = unpack(34*'B', str(g))
+if h != (65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 8, 0, 69, 0, 0, 20, 0, 1, 0, 0, 64, 0, 124, 231, 127, 0, 0, 1, 127, 0, 0, 1):
+ raise Error('Ethernet IP frame payload')
+
+# Send the Ethernet frame asynchronously
+alloc_data_buffer(m, staRx, buffer_nb=2)
+f.send(m, staRx)
+
+# Send the Ethernet frame synchronously
+alloc_data_buffer(m, staRx, buffer_nb=2)
+rsp = f.sendnrecv(m, staRx)
+
+# Uninit ether
+fcall2 = m.create_fcall('uninit_ether')
+fcall2.send(staRx)
+
+# Remove the destination station
+staRx.remove()
+
+
+# SCAPY TEST
+
+#print [p for p in IP()]
+target="www.target.com"
+target="www.target.com/30"
+ip=IP(dst=target)
+#hexdump(ip)
+#print [p for p in ip]
+
+#print [p for p in IP()]
+a=IP(dst="172.16.1.40")
+#print [p for p in a]
+#print a.dst
+#print a.ttl
+
+a.ttl=32
+#print [p for p in a]
+del(a.ttl)
+#print [p for p in a]
+#print a.ttl
+
+t=TCP()
+t.flags="SA"
+#print t.flags
+#print [p for p in t]
+t.flags=23
+#print [p for p in t]
+i=IP(flags="DF+MF")
+#print i.flags
+#print [p for p in i]
+i.flags=6
+#print [p for p in i]
+
+#print a.dst
+#print a.src
+del(a.dst)
+#print a.dst
+#print a.src
+a.dst="192.168.11.10"
+#print a.src
+a.dst=target
+#print a.src
+a.src="1.2.3.4"
+#print [p for p in a]
+
+#print [p for p in IP()]
+#print [p for p in IP()/TCP()]
+#print [p for p in Ether()/IP()/TCP()]
+#print [p for p in IP()/TCP()/"GET / HTTP/1.0\r\n\r\n"]
+#print [p for p in Ether()/IP()/IP()/UDP()]
+#print [p for p in IP(proto=55)/TCP()]
+
+#print str(IP())
+#print [p for p in IP(str(IP()))]
+a=Ether()/IP()/TCP()/"GET /index.html HTTP/1.0 \n\n"
+#hexdump(a)
+b=str(a)
+#print b
+c=Ether(b)
+#print [p for p in c]
+
+c.hide_defaults()
+#print [p for p in c]
+
+a=IP(dst="www.slashdot.org/30")
+#hexdump(a)
+#print [p for p in a]
+b=IP(ttl=[1,2,(5,9)])
+#hexdump(b)
+#print [p for p in b]
+c=TCP(dport=[80,443])
+#print [p for p in a/c]
+
+d = IP(dst="1.2.3.4")/ICMP()
+e = Ether()/IP(dst="1.2.3.4",ttl=(1,4))
+
+
+# DOC TEST
+
+import doctest
+doctest.testmod(buffer)
+doctest.testmod(create)
+doctest.testmod(eth)
+doctest.testmod(scapy)
+doctest.testmod(sniffer)
+
+
+# UNIT TEST
+
+import unittest
+
+class TestEthFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.eth = Eth()
+ self.m = m
+
+ def tearDown(self):
+ pass
+
+ def test_set_msdu_attr(self):
+ # Test without vlantag
+ p = 'ABCDEFGHIJKLMNThis is the Ethernet Payload'
+ self.eth.set_msdu_attr(p)
+ self.assertEqual(self.eth.dst, '41:42:43:44:45:46')
+ self.assertEqual(self.eth.src, '47:48:49:4a:4b:4c')
+ self.assertEqual(self.eth.type, 0x4D4E)
+ self.assertEqual(str(self.eth.payload), 'This is the Ethernet Payload')
+
+ # Test with vlantag
+ p = 'ABCDEFGHIJKL' + pack('!I', 0x81004D4E) + 'OPThis is the Ethernet Payload'
+ self.eth.set_msdu_attr(p)
+ self.assertEqual(self.eth.dst, '41:42:43:44:45:46')
+ self.assertEqual(self.eth.src, '47:48:49:4a:4b:4c')
+ self.assertEqual(self.eth.vlantag, 0x81004D4E)
+ self.assertEqual(self.eth.type, 0x4F50)
+ self.assertEqual(str(self.eth.payload), 'This is the Ethernet Payload')
+
+ def test_sendnrecv(self):
+ sta = self.m.create_sta()
+ self.m.create_fcall('init_ether').send(sta)
+ none_buffer = Buffer('ETHERNET_TYPE_NONE')
+ length = len(none_buffer.get_buffer_dict())
+
+ # Disable the automatic buffer allocation
+ realloc_buffer(False)
+
+ alloc_data_buffer(self.m, sta, buffer_nb=2)
+ rsp = self.eth.sendnrecv(self.m, sta, count=4)
+
+ # 1st received frame is the Ethernet frame
+ self.assertEqual(rsp[0].dst, 'ff:ff:ff:ff:ff:ff')
+ self.assertEqual(rsp[0].src, '')
+ self.assertEqual(rsp[0].type, 0)
+
+ # 2nd and 4th received frames are BUFFER RELEASED messages
+ self.assertEqual(rsp[1].get_ether_type(), 6)
+ self.assertEqual(rsp[1].get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ self.assertEqual(rsp[3].get_ether_type(), 6)
+ self.assertEqual(rsp[3].get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ self.assertEqual(len(rsp[1].get_buffer_dict()), length)
+
+ # Enable the automatic buffer allocation
+ realloc_buffer(True)
+
+ alloc_data_buffer(self.m, sta, buffer_nb=2)
+ length = len(none_buffer.get_buffer_dict())
+ rsp = self.eth.sendnrecv(self.m, sta, count=4)
+
+ # 1st received frame is the Ethernet frame
+ self.assertEqual(rsp[0].dst, 'ff:ff:ff:ff:ff:ff')
+ self.assertEqual(rsp[0].src, '')
+ self.assertEqual(rsp[0].type, 0)
+
+ # 3rd and 4th received frames are BUFFER RELEASED messages
+ self.assertEqual(rsp[2].get_ether_type(), 6)
+ self.assertEqual(rsp[2].get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ self.assertEqual(rsp[3].get_ether_type(), 6)
+ self.assertEqual(rsp[3].get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ self.assertEqual(len(rsp[3].get_buffer_dict()), length)
+
+ self.m.create_fcall('uninit_ether').send(sta)
+ sta.remove()
+
+ def test_send(self):
+ sta = self.m.create_sta()
+ self.m.create_fcall('init_ether').send(sta)
+ alloc_data_buffer(self.m, sta, buffer_nb=2)
+ self.eth.send(self.m, sta)
+ self.m.create_fcall('uninit_ether').send(sta)
+ sta.remove()
+
+ def test_get(self):
+ # Test without vlantag
+ self.eth.dst = '41:42:43:44:45:46'
+ self.eth.src = '47:48:49:4a:4b:4c'
+ self.eth.type = 0x4D4E
+ s = 'This is the Ethernet Payload'
+ self.eth.payload = s
+ self.assertEqual(self.eth.get(), 'ABCDEFGHIJKLMNThis is the Ethernet Payload' + (MIN_SIZE_OF_MSDU - MIN_SIZE_OF_HEADER - len(s)) * pack('B', 0))
+
+ # Test with vlantag
+ self.eth.dst = '41:42:43:44:45:46'
+ self.eth.src = '47:48:49:4a:4b:4c'
+ self.eth.vlantag = 0x81004D4E
+ self.eth.type = 0x4F50
+ s = 'This is the Ethernet Payload'
+ self.eth.payload = s
+ self.assertEqual(self.eth.get(), 'ABCDEFGHIJKL' + pack('!I', 0x81004D4E) + 'OPThis is the Ethernet Payload' + (MIN_SIZE_OF_MSDU - MAX_SIZE_OF_HEADER - len(s)) * pack('B', 0))
+
+ # Test with a bad vlantag
+ test = False
+ self.eth.vlantag = 0x4D4E4D4E
+ try:
+ self.eth.get()
+ except OutOfRangeError:
+ test = True
+ self.assert_(test)
+
+ def test_get_ether_type(self):
+ self.assertEqual(self.eth.get_ether_type(), 1)
+
+ def test_get_type(self):
+ self.assertEqual(self.eth.get_type(), 'ETHERNET_TYPE_DATA')
+
+ def test_create_eth(self):
+ self.assertNotEqual(create_eth(), None)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestEthFunctions)
+
+class TestBufferFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.data_buffer = Buffer('ETHERNET_TYPE_DATA_BUFFER_ADD')
+ self.assertEqual(self.data_buffer.get_ether_type(), 3)
+ self.assertEqual(self.data_buffer.get_type(), 'ETHERNET_TYPE_DATA_BUFFER_ADD')
+ self.assertEqual(self.data_buffer.get_buffer_nb(), 1)
+ self.mme_buffer = Buffer('ETHERNET_TYPE_MME_BUFFER_ADD', buffer_nb=2)
+ self.assertEqual(self.mme_buffer.get_ether_type(), 4)
+ self.assertEqual(self.mme_buffer.get_type(), 'ETHERNET_TYPE_MME_BUFFER_ADD')
+ self.assertEqual(self.mme_buffer.get_buffer_nb(), 2)
+ self.interface_buffer = Buffer('ETHERNET_TYPE_INTERFACE_BUFFER_ADD', buffer_nb=3)
+ self.assertEqual(self.interface_buffer.get_ether_type(), 5)
+ self.assertEqual(self.interface_buffer.get_type(), 'ETHERNET_TYPE_INTERFACE_BUFFER_ADD')
+ self.assertEqual(self.interface_buffer.get_buffer_nb(), 3)
+ self.m = m
+
+ def tearDown(self):
+ pass
+
+ def test_set_type(self):
+ self.data_buffer.set_type('ETHERNET_TYPE_BUFFER_RELEASED')
+ self.assertEqual(self.data_buffer.get_ether_type(), 6)
+ self.assertEqual(self.data_buffer.get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ try:
+ self.mme_buffer.set_type('ETHERNET_TYPE_MME')
+ except OutOfRangeError:
+ self.assertEqual(self.mme_buffer.get_ether_type(), 0)
+ self.assertEqual(self.mme_buffer.get_type(), 'ETHERNET_TYPE_NONE')
+
+ def test_set_buffer_nb(self):
+ self.data_buffer.set_buffer_nb(123)
+ self.assertEqual(self.data_buffer.get_buffer_nb(), 123)
+ try:
+ self.mme_buffer.set_buffer_nb(-123)
+ except OutOfRangeError:
+ self.assertEqual(self.mme_buffer.get_buffer_nb(), 0)
+
+ def test_set_buffer_realloc(self):
+ self.assertEqual(self.data_buffer.get_buffer_realloc(), False)
+ self.data_buffer.set_buffer_realloc(True)
+ self.assertEqual(self.data_buffer.get_buffer_realloc(), True)
+ self.data_buffer.set_buffer_realloc(False)
+
+ def test_realloc(self):
+ sta = self.m.create_sta()
+ self.m.create_fcall('init_ether').send(sta)
+ realloc_buffer(True)
+ buffer_id = 123
+ self.interface_buffer.get_buffer_dict()[buffer_id] = 'ETHERNET_TYPE_DATA_BUFFER_ADD'
+ self.interface_buffer.realloc(station_id=sta.get_station_id(), payload=pack('I', buffer_id))
+ buffer_id = 456
+ self.interface_buffer.get_buffer_dict()[buffer_id] = 'ETHERNET_TYPE_MME_BUFFER_ADD'
+ self.interface_buffer.realloc(station_id=sta.get_station_id(), payload=pack('I', buffer_id))
+ buffer_id = 789
+ self.interface_buffer.get_buffer_dict()[buffer_id] = 'ETHERNET_TYPE_INTERFACE_BUFFER_ADD'
+ self.interface_buffer.realloc(station_id=sta.get_station_id(), payload=pack('I', buffer_id))
+ rsp = recv(self.m, count=2)
+ self.assertEqual(rsp[0].get_type(), 'ETHERNET_TYPE_SNIFFER')
+ self.assertEqual(rsp[1].get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ realloc_buffer(False)
+ self.m.create_fcall('uninit_ether').send(sta)
+ sta.remove()
+
+ def test_set_msdu_attr(self):
+ id = 123
+ self.assert_(self.data_buffer.get_buffer_dict().has_key(id))
+ self.data_buffer.set_msdu_attr(pack('I', id))
+ self.assert_(not self.data_buffer.get_buffer_dict().has_key(id))
+
+ def test_sendnrecv(self):
+ sta = self.m.create_sta()
+ self.m.create_fcall('init_ether').send(sta)
+ interface_buffer = Buffer('ETHERNET_TYPE_INTERFACE_BUFFER_ADD', buffer_nb=2)
+ rsp = interface_buffer.sendnrecv(self.m, sta, count=2)
+ self.assertEqual(rsp[0].get_type(), 'ETHERNET_TYPE_SNIFFER')
+ self.assertEqual(rsp[1].get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ self.m.create_fcall('uninit_ether').send(sta)
+ sta.remove()
+
+ def test_send(self):
+ sta = self.m.create_sta()
+ self.m.create_fcall('init_ether').send(sta)
+ mme_buffer = Buffer('ETHERNET_TYPE_MME_BUFFER_ADD', buffer_nb=10)
+ mme_buffer.send(self.m, sta)
+ self.m.create_fcall('uninit_ether').send(sta)
+ sta.remove()
+
+ def test_get(self):
+ mme_buffer = Buffer('ETHERNET_TYPE_MME_BUFFER_ADD', buffer_nb=3)
+ buf = mme_buffer.get()
+ res = pack('I', mme_buffer.get_buffer_nb())
+ for i in range (0, 3):
+ res += pack('I', mme_buffer.get_buffer_id() - 2 + i)
+ self.assertEqual(buf, res)
+
+ def test_create_buffer(self):
+ self.assertNotEqual(create_buffer(), None)
+
+ def test_alloc_data_buffer(self):
+ sta = self.m.create_sta()
+ self.m.create_fcall('init_ether').send(sta)
+ alloc_data_buffer(self.m, sta)
+ self.m.create_fcall('uninit_ether').send(sta)
+ sta.remove()
+
+ def test_alloc_mme_buffer(self):
+ sta = self.m.create_sta()
+ self.m.create_fcall('init_ether').send(sta)
+ alloc_mme_buffer(self.m, sta)
+ self.m.create_fcall('uninit_ether').send(sta)
+ sta.remove()
+
+ def test_alloc_interface_buffer(self):
+ sta = self.m.create_sta()
+ self.m.create_fcall('init_ether').send(sta)
+ realloc_buffer(True)
+ alloc_interface_buffer(self.m, sta)
+ rsp = recv(self.m, count=2)
+ self.assertEqual(rsp[0].get_type(), 'ETHERNET_TYPE_SNIFFER')
+ self.assertEqual(rsp[1].get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ realloc_buffer(False)
+ alloc_interface_buffer(self.m, sta)
+ rsp = recv(self.m, count=2)
+ self.assertEqual(rsp[0].get_type(), 'ETHERNET_TYPE_SNIFFER')
+ self.assertEqual(rsp[1].get_type(), 'ETHERNET_TYPE_BUFFER_RELEASED')
+ self.m.create_fcall('uninit_ether').send(sta)
+ sta.remove()
+
+ def test_realloc_buffer(self):
+ self.assertEqual(self.interface_buffer.get_buffer_realloc(), False)
+ realloc_buffer(True)
+ self.assertEqual(self.interface_buffer.get_buffer_realloc(), True)
+ realloc_buffer(False)
+
+ def test_get_buffer_dict(self):
+ get_buffer_dict()
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestBufferFunctions))
+
+class TestSnifferFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.sniffer = Sniffer(way=False, encryption=False, sniffer_type=0)
+ self.assertEqual(self.sniffer.get(), None)
+ self.assertEqual(self.sniffer.get_ether_type(), 7)
+ self.assertEqual(self.sniffer.get_type(), 'ETHERNET_TYPE_SNIFFER')
+ self.assertEqual(self.sniffer.get_way(), False)
+ self.assertEqual(self.sniffer.get_encryption(), False)
+ self.assertEqual(self.sniffer.get_sniffer_type(), 0)
+ self.m = m
+
+ def tearDown(self):
+ pass
+
+ def test_set_way(self):
+ way = True
+ self.sniffer.set_way(way)
+ self.assertEqual(self.sniffer.get_way(), way)
+
+ def test_set_encryption(self):
+ encryption = True
+ self.sniffer.set_encryption(encryption)
+ self.assertEqual(self.sniffer.get_encryption(), encryption)
+
+ def test_set_sniffer_type(self):
+ sniffer_type = 1
+ self.sniffer.set_sniffer_type(sniffer_type)
+ self.assertEqual(self.sniffer.get_sniffer_type(), sniffer_type)
+
+ def test_set_msdu_attr(self):
+ payload = "This is the sniffed packed"
+ self.sniffer.set_msdu_attr(payload)
+ self.assertEqual(self.sniffer.get(), payload)
+
+ def test_display(self):
+ self.sniffer.display()
+ self.sniffer.set_way(True)
+ self.sniffer.set_encryption(True)
+ self.sniffer.set_sniffer_type(1)
+ self.sniffer.set_msdu_attr("ABCD")
+ self.sniffer.display()
+
+ def test_create_sniffer(self):
+ way = True
+ encryption = True
+ sniffer_type = 1
+ self.assertNotEqual(create_sniffer(way, encryption, sniffer_type), None)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestSnifferFunctions))
+
+try:
+ suite.addTest(doctest.DocTestSuite(buffer))
+ suite.addTest(doctest.DocTestSuite(create))
+ suite.addTest(doctest.DocTestSuite(eth))
+ suite.addTest(doctest.DocTestSuite(scapy))
+ suite.addTest(doctest.DocTestSuite(sniffer))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_fsm.py b/cesar/maximus/python/test/test_fsm.py
new file mode 100644
index 0000000000..598768eb28
--- /dev/null
+++ b/cesar/maximus/python/test/test_fsm.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import startup
+
+from maximus.fsm import *
+
+
+# FSM TEST
+
+def create (fsm):
+ fsm.something.append ("station")
+ print "Create station"
+def send (fsm):
+ print "Send a message"
+def receive (fsm):
+ print "Receive the response"
+def remove (fsm):
+ fsm.something.pop ()
+ print "Remove station"
+def error (fsm):
+ print "Error"
+ print str(fsm.input_symbol)
+
+def trace(fsm):
+ print '=>',fsm.current_state,fsm.something
+
+f = FSM.FSM('INIT',[])
+f.set_default_transition (error, 'IDLE')
+f.add_transition_any ('INIT', None, 'END')
+f.add_transition_any ('IDLE', None, 'END')
+f.add_transition_any ('BUSY', None, 'END')
+f.add_transition ('create_station', 'INIT', create, 'IDLE')
+f.add_transition ('send_message', 'IDLE', send, 'BUSY')
+f.add_transition ('receive_response', 'BUSY', receive, 'IDLE')
+f.add_transition ('remove_station', 'IDLE', remove, 'INIT')
+
+trace(f)
+f.process("create_station")
+trace(f)
+f.process("send_message")
+trace(f)
+f.process("receive_response")
+trace(f)
+f.process("remove_station")
+trace(f)
+f.process("I want to quit!")
+trace(f)
+
+while f.current_state!='END':
+ inputs = raw_input ('>')
+ previous_state = f.current_state
+ f.process (inputs)
+ print previous_state,'=>',f.current_state
+ print f.something
+
+
+# DOC TEST
+
+import doctest
+doctest.testmod(FSM)
+
+
+# UNIT TEST
+
+import unittest
+suite = unittest.TestSuite()
+try:
+ suite.addTest(doctest.DocTestSuite(FSM))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_interface.py b/cesar/maximus/python/test/test_interface.py
new file mode 100644
index 0000000000..ae57e94a6e
--- /dev/null
+++ b/cesar/maximus/python/test/test_interface.py
@@ -0,0 +1,461 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+import startup
+
+import interface
+from interface import *
+from maximus.macframe import *
+from maximus.mme import *
+from struct import pack, unpack
+from string import *
+
+# DOC TEST
+
+import doctest
+doctest.testmod(interface)
+
+
+# UNIT TEST
+
+import unittest
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+def cb1(msg):
+ print "=>",cb1.func_name
+ if not msg.is_param("result_2"):
+ raise Exception(cb1.func_name)
+ result2 = unpack('q',msg.bind_param("result_2"))
+ if result2[0] != 0x0000007B:
+ raise Exception(cb1.func_name)
+
+def cb2(msg):
+ print "=>",cb2.func_name
+ if not msg.is_param("result_2"):
+ raise Exception(cb2.func_name)
+ result2 = unpack('q',msg.bind_param("result_2"))
+ if result2[0] != 0x0000007B:
+ raise Exception(cb2.func_name)
+
+class TestInterfaceFunctions(unittest.TestCase):
+
+ def setUp(self):
+
+ # Set the Maximus instance
+ self.m = m
+
+ # Create a station
+ self.station = self.m.create_sta()
+
+ def tearDown(self):
+
+ # Remove station
+ self.station.remove()
+
+ def test_process(self):
+ self.m.process()
+
+ def test_create_sta(self):
+
+ # Create station 1
+ station1 = self.m.create_sta()
+
+ # Copy to station 2
+ station2 = station1
+
+ # Remove station 1
+ station1.remove()
+
+ # Remove station 2
+ station2.remove()
+
+ def test_create_fcall(self):
+
+ # Create a fcall message
+ fcall1 = self.m.create_fcall("function_1")
+
+ # Copy the message
+ fcall2 = fcall1
+
+ def test_create_probe(self):
+
+ # Create a probe message
+ probe = self.m.create_probe()
+
+ def test_send_mpdu(self):
+
+ fcall1 = self.m.create_fcall('set_tonemask')
+ fcall1.send(self.station)
+ fcall2 = self.m.create_fcall('prepare_rx')
+ fcall2.send(self.station)
+
+ # Create a MAC Frame, configure it and send it asynchronously
+ frame = MACFrame()
+ frame.fc_10 = 123
+ frame.fc_av = (1, 123, 456, 789)
+ frame.payload = 'This is the MPDU payload'
+ frame.fc_mode = 4
+ frame.short_ppdu = 0
+ frame.mod = 4
+ self.m.send_mpdu(frame)
+
+ fcall3 = self.m.create_fcall('uninit_phy')
+ fcall3.send(self.station)
+
+ def test_set_mpdu_rx(self):
+ def cb(mpdu):
+ pass
+ def create_fc():
+ pass
+ self.m.set_mpdu_rx(cb, create_fc)
+
+ def test_send_msdu(self):
+ while not self.station.is_idle():
+ self.m.process()
+ self.m.send_msdu(MME(MMHeader=23*'H', MMEntry=37*'E'), self.station.get_station_id())
+
+ def test_set_msdu_rx(self):
+ def cb(msdu):
+ pass
+ def create_fc1():
+ pass
+ def create_fc2():
+ pass
+ def create_fc3():
+ pass
+ def create_fc4():
+ pass
+ self.m.set_msdu_rx(cb, create_fc1, create_fc2, create_fc3, create_fc4)
+
+ def test_wait(self):
+ self.m.wait()
+ self.m.wait(500000)
+
+ def test_disturb_channel(self):
+ self.m.disturb_channel()
+ self.m.disturb_channel(False)
+
+ def test_get_date(self):
+ date = self.m.get_date()
+ offset = 10000
+ self.m.wait(offset)
+ self.assertEqual(date+offset, self.m.get_date(), "get_date failed")
+
+ def test_set_freq(self):
+ freq = 54.321
+ self.m.set_freq(freq)
+ self.assertAlmostEqual(freq, self.m.get_freq(), 3, "get_freq failed")
+ freq = 0
+ self.m.set_freq(freq)
+ self.assertEqual(freq, self.m.get_freq(), "get_freq failed")
+ freq = 0
+ self.m.set_freq(freq)
+ self.assertEqual(freq, self.m.get_freq(), "get_freq failed")
+ freq = 49
+ self.m.set_freq(freq)
+ self.assertEqual(freq, self.m.get_freq(), "get_freq failed")
+ freq = 0
+ self.m.set_freq(freq)
+ self.assertEqual(freq, self.m.get_freq(), "get_freq failed")
+
+ def test_activate_false_alarm(self):
+ duration = 200
+ deviation = 0.2
+ self.m.activate_false_alarm(duration, deviation)
+ self.m.wait(2*duration)
+ self.m.deactivate_false_alarm()
+
+ def test_deactivate_false_alarm(self):
+ duration = 200
+ deviation = 0.2
+ self.m.deactivate_false_alarm()
+ self.m.activate_false_alarm(duration, deviation)
+ self.m.deactivate_false_alarm()
+
+ def test_is_station_idle(self):
+ self.m.wait(1) # to process the system IDLE message coming from the station
+ self.assert_(self.m.is_station_idle(self.station.get_station_id()))
+ self.station.deactivate()
+ self.assert_(not self.m.is_station_idle(self.station.get_station_id()))
+
+ def test_remove(self):
+
+ # Remove station
+ self.station.remove()
+
+ def test_deactivate(self):
+
+ # Deactivate station
+ self.station.deactivate()
+
+ def test_activate(self):
+
+ # Re-activate station
+ self.station.activate()
+
+ def test_debug(self):
+ self.station.debug()
+
+ def test_is_idle(self):
+ self.m.wait(1) # to process the system IDLE message coming from the station
+ self.assert_(self.station.is_idle())
+ self.station.deactivate()
+ self.assert_(not self.station.is_idle())
+
+ def test_add_param(self):
+
+ # Add an empty parameter to the probe message,
+ # and retrieve the added parameter
+ #
+ probe = self.m.create_probe()
+ probe.add_param("empty_param")
+ self.assert_(probe.is_param("empty_param"))
+
+ # Add a string parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ fcall = self.m.create_fcall("fcall").add_param("string_param", 'ABCD')
+ self.assertEqual(fcall.bind_param_string("string_param"),'ABCD')
+
+ def test_add_param_bool(self):
+
+ # Add a boolean parameter to the probe message,
+ # and retrieve the added parameter
+ #
+ probe = self.m.create_probe()
+ probe.add_param_bool("boolean_param", True)
+ self.assertEqual(probe.bind_param_bool("boolean_param"),True)
+
+ def test_add_param_ushort(self):
+
+ # Add an unsigned short parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ fcall = self.m.create_fcall("fcall")
+ fcall.add_param_ushort("ushort_param", 0xFEDC)
+ self.assertEqual(fcall.bind_param_ushort("ushort_param"),0xFEDC)
+
+ def test_add_param_ulong(self):
+
+ # Add an unsigned long parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ fcall = self.m.create_fcall("fcall")
+ fcall.add_param_ulong("ulong_param", 0xFEDCBA98)
+ self.assertEqual(fcall.bind_param_ulong("ulong_param"),0xFEDCBA98)
+
+ def test_add_param_n_u8(self):
+
+ # Add a Python tuple parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ tuple_u8 = (0x12, 0x34, 0x56)
+ fcall = self.m.create_fcall("test_u8").add_param_n_u8("tuple_u8", tuple_u8)
+ param = fcall.bind_param("tuple_u8")
+ param = unpack('!BBB', param)
+ self.assertEqual(param, tuple_u8)
+
+ def test_add_param_n_u16(self):
+
+ # Add a Python tuple parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+
+ tuple_u16 = (0x12AB, 0x34AB, 0x56AB, 0x78AB)
+ fcall = self.m.create_fcall("test_u16").add_param_n_u16("tuple_u16", tuple_u16)
+ param = fcall.bind_param("tuple_u16")
+ param = unpack('!HHHH', param)
+ self.assertEqual(param, tuple_u16)
+
+ def test_add_param_n_u32(self):
+
+ # Add a Python tuple parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+
+ tuple_u32 = (0x1234ABCD, 0x3456ABCD, 0x5678ABCD, 0x9ABCABCD, 0xEF01ABCD)
+ fcall = self.m.create_fcall("test_u32").add_param_n_u32("tuple_u32", tuple_u32)
+ param = fcall.bind_param("tuple_u32")
+ param = unpack('!IIIII', param)
+ self.assertEqual(param, tuple_u32)
+
+ def test_remove_param(self):
+
+ # Add a parameter to the probe message,
+ # remove the added parameter,
+ # and try to retrieve the removed parameter
+ #
+ probe = self.m.create_probe()
+ probe.add_param("param")
+ probe.remove_param("param")
+ self.failIf(probe.is_param("param"))
+
+ def test_set_cb(self):
+
+ # Set a callback to the fcall message,
+ # and set another callback
+ #
+ fcall = self.m.create_fcall("fcall")
+ fcall.set_cb(cb1)
+ fcall.set_cb(cb2)
+
+ def test_remove_cb(self):
+
+ # Set a callback to the fcall message,
+ # remove the set callback,
+ # and set another callback
+ #
+ fcall = self.m.create_fcall("fcall")
+ fcall.set_cb(cb1)
+ fcall.remove_cb()
+ fcall.set_cb(cb2)
+
+ def test_set_sta(self):
+
+ # Set the destination station to the probe message,
+ # create station 3,
+ # and set the destination station 3 to the probe message
+ #
+ probe = self.m.create_probe()
+ probe.set_sta(self.station)
+ station3 = self.m.create_sta()
+ probe.set_sta(station3)
+ station3.remove()
+
+ def test_send_async(self):
+
+ # Create a fcall message
+ fcall1 = self.m.create_fcall("function_1")
+
+ # Add a first parameter to the created message
+ param1 = pack('iiB',1,2,True)
+ fcall1.add_param("param_1", param1)
+
+ # Add a second parameter to the created message
+ param2 = pack('iiiiiiiiii',0,1,2,3,4,5,6,7,8,9)
+ fcall1.add_param("param_2", param2)
+
+ # Add a third parameter to the created message
+ param3 = "hello"
+ fcall1.add_param("param_3", param3)
+
+ # Add a fourth parameter to the created message
+ param4 = pack('q',123)
+ fcall1.add_param("param_4", param4)
+
+ # Register a callback function which will be called at message response reception
+ fcall1.set_cb(cb1)
+
+ # Set destination station of message
+ fcall1.set_sta(self.station)
+
+ # Send the configured message in an asynchronous mode
+ fcall1.send_async()
+
+ # Send another message in an asynchronous mode
+ station4 = self.m.create_sta()
+ fcall2 = self.m.create_fcall("function_1")
+ fcall2.add_param("param_1", param1)
+ fcall2.add_param("param_2", param2)
+ fcall2.add_param("param_3", param3)
+ fcall2.add_param("param_4", param4)
+ fcall2.set_cb(cb2)
+ fcall2.set_sta(station4)
+ fcall2.send_async()
+
+ # Wait for responses
+ self.m.wait()
+
+ station4.remove()
+
+ def test_send(self):
+
+ # Create a fcall message,
+ # add a boolean parameter,
+ # send the message to station,
+ # and get the result
+ #
+ fcall2 = self.m.create_fcall("function_2")
+ fcall2.add_param_bool("param_5", True)
+ fcall2 = fcall2.send(self.station)
+ result1 = fcall2.bind_param_string("result_1")
+ self.assertEqual(result1,"this is result 1")
+ self.assertEqual(len(result1),16)
+
+ # Create a probe message,
+ # set the destination station,
+ # add a parameter,
+ # send the message,
+ # and get the result
+ #
+ probe = self.m.create_probe().set_sta(self.station).add_param("param_6").send()
+ self.assertEqual(probe.bind_param_ulong("param_6"),0x7B000000)
+
+ def test_is_param(self):
+
+ # Add a parameter to the probe message,
+ # send the message to the destination station,
+ # and get the result
+ #
+ probe = self.m.create_probe()
+ probe.add_param("param_6").send(self.station)
+ self.assert_(probe.is_param("param_6"))
+
+ def test_bind_param_string(self):
+
+ # Add string parameters to the fcall message,
+ # and retrieve added parameters
+ #
+ fcall = self.m.create_fcall("fcall")
+ fcall.add_param("string_param_1","string param 1")
+ fcall.add_param("string_param_2","string param 2")
+ fcall.add_param("string_param_3","string param 3")
+ self.assertEqual(fcall.bind_param_string("string_param_1"),"string param 1")
+ self.assertEqual(fcall.bind_param_string("string_param_2"),"string param 2")
+ self.assertEqual(fcall.bind_param_string("string_param_3"),"string param 3")
+
+ def test_bind_param_bool(self):
+
+ # Add a boolean parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ fcall = self.m.create_fcall("fcall")
+ fcall.add_param_bool("boolean_param", False)
+ self.assertEqual(fcall.bind_param_bool("boolean_param"),False)
+
+ def test_bind_param_ushort(self):
+
+ # Add a parameter to the probe message,
+ # send the message to the destination station,
+ # and get the result
+ #
+ probe = self.m.create_probe()
+ probe = probe.add_param("param_10").send(self.station)
+ self.assertEqual(probe.bind_param_ushort("param_10"),0xEEFF)
+
+ def test_bind_param_ulong(self):
+
+ # Add a parameter to the probe message,
+ # send the message to the destination station,
+ # and get the result
+ #
+ probe = self.m.create_probe()
+ probe = probe.add_param("param_11").send(self.station)
+ self.assertEqual(probe.bind_param_ulong("param_11"),0xCCDDEEFF)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestInterfaceFunctions)
+
+try:
+ suite.addTest(doctest.DocTestSuite(interface))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_lib_cesar.py b/cesar/maximus/python/test/test_lib_cesar.py
new file mode 100644
index 0000000000..9827f2d6de
--- /dev/null
+++ b/cesar/maximus/python/test/test_lib_cesar.py
@@ -0,0 +1,330 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import startup, sys
+
+from maximus import *
+from interface import *
+from maximus_dur import *
+from sta_cesar import STACesar
+from maximus.station.sta import PHY_CARRIER_NB
+
+
+# LIB CESAR TEST
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+# Create a Cesar station
+sta = STACesar(m, name="sta")
+
+carrier_nb = maximus_dur_carrier_nb(m, sta.get(), sta.get_tonemask())
+
+mod = 3 # PHY_MOD_TM
+tonemap = ''
+for i in range (0, PHY_CARRIER_NB):
+ tonemap += pack('B', 0x01)
+bits_per_symbol = maximus_dur_bits_per_symbol(m, sta.get(), mod, sta.get_tonemask(), tonemap, carrier_nb)
+
+fecrate = 0 # PHY_FEC_RATE_1_2
+pb_size = 1 # PHY_PB_SIZE_520
+pb_nb = 10
+symbol_nb = maximus_dur_symbol_nb(m, sta.get(), fecrate, pb_size, bits_per_symbol, pb_nb)
+
+gil = 2 # PHY_GIL_3534
+data_tck = maximus_dur_data_tck(m, sta.get(), gil, symbol_nb)
+
+if data_tck != maximus_dur(m, sta.get(), sta.get_tonemask(), mod, tonemap, fecrate, pb_size, pb_nb, gil):
+ print "maximus_dur_data_tck =", data_tck
+ print "maximus_dur =", maximus_dur(m, sta.get(), sta.get_tonemask(), mod, tonemap, fecrate, pb_size, pb_nb, gil)
+ raise Error("maximus_dur")
+
+m.create_fcall("uninit_ether").send(sta.get())
+sta.remove()
+
+
+# DOC TEST
+
+import doctest, maximus_dur, sta_cesar
+doctest.testmod(maximus_dur)
+doctest.testmod(sta_cesar)
+
+
+# UNIT TEST
+
+import unittest
+
+class TestMaximusDurFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.maximus = m
+ # Create station
+ self.station = STACesar(self.maximus)
+
+ def tearDown(self):
+ # Remove station
+ m.create_fcall("uninit_ether").send(self.station.get())
+ self.station.remove()
+
+ def test_maximus_dur_carrier_nb(self):
+ # Default tonemask
+ bits_ref = 917
+ bits = maximus_dur_carrier_nb(self.maximus, self.station.get(), self.station.get_tonemask())
+ self.assertEqual(bits, bits_ref)
+
+ def test_maximus_dur_bits_per_symbol(self):
+ # Number of bytes needed to define a tonemap
+ PHY_TONEMAP_SIZE = ((PHY_CARRIER_NB + 2 - 1) / 2)
+
+ # robo
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 0, # PHY_MOD_ROBO
+ self.station.get_tonemask(), None, 400), 200)
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 0, # PHY_MOD_ROBO
+ self.station.get_tonemask(), None, 403), 200)
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 1, # PHY_MOD_HS_ROBO
+ self.station.get_tonemask(), None, 400), 400)
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 1, # PHY_MOD_HS_ROBO
+ self.station.get_tonemask(), None, 401), 400)
+ self.assertEqual(maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 2, # PHY_MOD_MINI_ROBO
+ self.station.get_tonemask(), None, 300), 120)
+
+ # tm
+ # Maximum modulations
+ tonemap = ''
+ for i in range (0, PHY_CARRIER_NB / 2):
+ if PHY_CARRIER_NB % 2 == 0:
+ tonemap += pack('B', 0x07)
+ else:
+ tonemap += pack('B', 0x77)
+ bits_ref = 917 * 10
+ bits = maximus_dur_bits_per_symbol(self.maximus, self.station.get(), 3, # PHY_MOD_TM
+ self.station.get_tonemask(), tonemap, 917)
+ self.assertEqual(bits, bits_ref)
+
+ def test_maximus_dur_symbol_nb(self):
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 0, # PHY_PB_SIZE_136
+ 136 * 8 * 2, 1), 1)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 0, # PHY_PB_SIZE_136
+ 136 * 8 / 16 * 21, 1), 1)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 520 * 8 * 2, 1), 1)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 520 * 8 / 16 * 21, 1), 1)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 0, # PHY_PB_SIZE_136
+ 136 * 2, 1), 8)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 0, # PHY_PB_SIZE_136
+ 136 / 16 * 21, 1), 9)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 520 * 2, 1), 8)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 520 / 16 * 21, 1), 9)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 520 * 8 * 2, 10), 10)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 520 * 8 / 16 * 21, 10), 10)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 2 * 520 * 8 * 2, 10), 5)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 2 * 520 * 8 / 16 * 21, 10), 5)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 0, # PHY_FEC_RATE_1_2
+ 1, # PHY_PB_SIZE_520
+ 2 * 520 * 8 * 2 - 10, 10), 6)
+ self.assertEqual(maximus_dur_symbol_nb(self.maximus, self.station.get(), 1, # PHY_FEC_RATE_16_21
+ 1, # PHY_PB_SIZE_520
+ 2 * 520 * 8 / 16 * 21 - 10, 10), 6)
+
+ def test_maximus_dur_data_tck(self):
+ # Symbol with a 417 sample guard length (ticks)
+ MAC_DX417_TCK = (3489/3)
+ # Symbol with a 567 sample guard length (ticks)
+ MAC_DX567_TCK = (3639/3)
+ # Symbol with a 3534 sample guard length (ticks)
+ MAC_DX3534_TCK = (6606/3)
+
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 0, # PHY_GIL_417
+ 1), MAC_DX567_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 1, # PHY_GIL_567
+ 1), MAC_DX567_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 2, # PHY_GIL_3534
+ 1), MAC_DX567_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 0, # PHY_GIL_417
+ 2), MAC_DX567_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 1, # PHY_GIL_567
+ 2), MAC_DX567_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 2, # PHY_GIL_3534
+ 2), MAC_DX567_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 0, # PHY_GIL_417
+ 3), MAC_DX567_TCK * 2 + MAC_DX417_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 1, # PHY_GIL_567
+ 3), MAC_DX567_TCK * 2 + MAC_DX567_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 2, # PHY_GIL_3534
+ 3), MAC_DX567_TCK * 2 + MAC_DX3534_TCK)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 0, # PHY_GIL_417
+ 4), MAC_DX567_TCK * 2 + MAC_DX417_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 1, # PHY_GIL_567
+ 4), MAC_DX567_TCK * 2 + MAC_DX567_TCK * 2)
+ self.assertEqual(maximus_dur_data_tck(self.maximus, self.station.get(), 2, # PHY_GIL_3534
+ 4), MAC_DX567_TCK * 2 + MAC_DX3534_TCK * 2)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestMaximusDurFunctions)
+
+class TestSTACesarFunctions(unittest.TestCase):
+
+ def setUp(self):
+ # Create station
+ self.station = STACesar(m)
+
+ def tearDown(self):
+ # Remove station
+ m.create_fcall("uninit_ether").send(self.station.get())
+ self.station.remove()
+
+ def test_stop(self):
+ self.station.stop()
+
+ def test_set_name(self):
+ name = "Name of my station"
+ self.station.set_name(name)
+ self.assertEqual(self.station.get_name(), name)
+
+ def test_set_mme_buffer_nb(self):
+ mme_buffer_nb = 4
+ self.station.set_mme_buffer_nb(mme_buffer_nb)
+ self.assertEqual(self.station.get_mme_buffer_nb(), mme_buffer_nb)
+
+ def test_set_config_mode(self):
+ config_mode = 'fcall_process_drv'
+ self.station.set_config_mode(config_mode)
+ self.assertEqual(self.station.get_config_mode(), config_mode)
+
+ def test_set_config(self):
+ test_conf = Config()
+ test_conf.mac_address = (0x11, 0x22, 0x33, 0x44, 0x55, 0x66)
+ test_conf.cco_preference = True
+ self.station.set_config(test_conf)
+ self.assertEqual(self.station.get_config().mac_address, test_conf.mac_address)
+ self.assertEqual(self.station.get_config().cco_preference, test_conf.cco_preference)
+
+ def test_set_mac_address(self):
+ mac_address = (0x41, 0x42, 0x43, 0x44, 0x45, 0x46)
+ # Test with a Python tuple of 6 Python integers
+ self.station.set_mac_address((0x41, 0x42, 0x43, 0x44, 0x45, 0x46))
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python long (decimal or hexadecimal value)
+ self.station.set_mac_address(0x414243444546)
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python string of length equals to 6 octets
+ self.station.set_mac_address(pack(n + u64, 0x414243444546)[SIZE_OF_U16:])
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python string of length equals to 17 octets ('XX:XX:XX:XX:XX:XX')
+ self.station.set_mac_address('41:42:43:44:45:46')
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+
+ def test_set_cco_preference(self):
+ cco_preference = False
+ self.station.set_cco_preference(cco_preference)
+ self.assertEqual(self.station.get_cco_preference(), cco_preference)
+
+ def test_set_was_cco(self):
+ was_cco = True
+ self.station.set_was_cco(was_cco)
+ self.assertEqual(self.station.get_was_cco(), was_cco)
+
+ def test_set_npw(self):
+ npw = "This is the network password"
+ self.station.set_npw(npw)
+ self.assertEqual(self.station.get_npw(), npw)
+
+ def test_set_dpw(self):
+ dpw = "This is the device password"
+ self.station.set_dpw(dpw)
+ self.assertEqual(self.station.get_dpw(), dpw)
+
+ def test_set_m_sta_hfid(self):
+ m_sta_hfid = "This is the manufacturer sta hfid"
+ self.station.set_m_sta_hfid(m_sta_hfid)
+ self.assertEqual(self.station.get_m_sta_hfid(), m_sta_hfid)
+
+ def test_set_u_sta_hfid(self):
+ u_sta_hfid = "This is the user sta hfid"
+ self.station.set_u_sta_hfid(u_sta_hfid)
+ self.assertEqual(self.station.get_u_sta_hfid(), u_sta_hfid)
+
+ def test_set_avln_hfid(self):
+ avln_hfid = "This is the avln hfid"
+ self.station.set_avln_hfid(avln_hfid)
+ self.assertEqual(self.station.get_avln_hfid(), avln_hfid)
+
+ def test_set_sl(self):
+ sl = 0x02
+ self.station.set_sl(sl)
+ self.assertEqual(self.station.get_sl(), sl)
+
+ def test_set_snid(self):
+ snid = 0x02
+ self.station.set_snid(snid)
+ self.assertEqual(self.station.get_snid(), snid)
+
+ def test_set_tonemask(self):
+ tonemask = 85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535
+ self.station.set_tonemask(tonemask)
+ self.assertEqual(self.station.get_tonemask()[0 / 8], pack('B', 0)) # 74
+ self.assertEqual(self.station.get_tonemask()[11 / 8], pack('B', 0xf0)) # 85
+ self.assertEqual(self.station.get_tonemask()[345 / 8], pack('B', 0xfc)) # 419
+ self.assertEqual(self.station.get_tonemask()[495 / 8], pack('B', 0xff)) # 569
+ self.assertEqual(self.station.get_tonemask()[782 / 8], pack('B', 0x7f)) # 856
+ self.assertEqual(self.station.get_tonemask()[1069 / 8], pack('B', 0x3f)) # 1143
+ self.assertEqual(self.station.get_tonemask()[1070 / 8], pack('B', 0x3f)) # 1144
+ self.assertEqual(self.station.get_tonemask()[1155 / 8], pack('B', 0x00)) # 1229
+
+ def test_remove(self):
+ m.create_fcall("uninit_ether").send(self.station.get())
+ self.station.remove()
+ self.station = STACesar(m)
+
+ def test_deactivate(self):
+ self.station.deactivate()
+ self.station.activate()
+
+ def test_activate(self):
+ self.station.activate()
+
+ def test_debug(self):
+ self.station.debug()
+
+ def test_is_idle(self):
+ m.wait(1) # to process the system IDLE message coming from the station
+ self.assert_(self.station.is_idle())
+ self.station.deactivate()
+ self.assert_(not self.station.is_idle())
+ self.station.activate()
+
+ def test_get_station_id(self):
+ self.assertNotEqual(self.station.get_station_id(), 0)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestSTACesarFunctions))
+
+try:
+ suite.addTest(doctest.DocTestSuite(maximus_dur))
+ suite.addTest(doctest.DocTestSuite(sta_cesar))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_lib_proto.py b/cesar/maximus/python/test/test_lib_proto.py
new file mode 100644
index 0000000000..884ed0cdc2
--- /dev/null
+++ b/cesar/maximus/python/test/test_lib_proto.py
@@ -0,0 +1,376 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys
+sys.path.append('./test')
+sys.path.append('../test')
+import startup
+
+#sys.argv += ['-r', '/dev/ttyS0']
+
+from fcall import *
+from struct import pack, unpack
+
+
+# LIB PROTO TEST
+
+def my_cb (msg):
+ print "=>",my_cb.func_name
+ if msg.is_param("result_2"):
+ result2 = unpack('q',msg.bind_param("result_2"))
+ print "result 2 =",result2[0]
+ receive_fc1_rsp = True
+
+stationA = "A"
+stationB = "B"
+stationC = "C"
+
+fc1 = create_fcall("function_1")
+param1 = pack('iiB',1,2,True)
+fc1.add_param("param_1", param1)
+param2 = pack('iiiiiiiiii',0,1,2,3,4,5,6,7,8,9)
+fc1.add_param("param_2", param2)
+param3 = "hello"
+fc1.add_param("param_3", param3)
+param4 = pack('q',123)
+fc1.add_param("param_4", param4)
+fc1.set_cb(my_cb)
+fc1.set_sta(stationA)
+receive_fc1_rsp = False
+fc1.send_async()
+
+fc2 = create_fcall("function_2")
+fc2.add_param_bool("param_5", True)
+fc2.send(stationB)
+result1 = fc2.bind_param_string("result_1")
+print "result1 =",result1
+
+probe1 = create_probe()
+param6 = 789
+probe1.add_param_ulong("param_6", param6)
+probe1.send(stationB)
+
+probe2 = create_probe().add_param("param_7")
+probe2.send(stationB)
+param7 = None #probe2.bind_param_ulong("param_7")
+print "param 7 =",param7
+probe2.send(stationC)
+
+if 456 == param7:
+ fc3 = create_fcall("function_3")
+ fc3.send_async(stationC)
+
+fc4 = create_fcall("function_4")
+fc4.send_async(stationC)
+
+fc5 = create_fcall("function_5")
+fc5.send_async(stationC)
+
+probe3 = create_probe()
+probe3.send(stationC)
+
+if probe3.is_param("param_8"):
+ probe4 = create_probe()
+ probe4.add_param("param_8")
+ probe4.add_param_bool("param_9", False)
+ probe4.send(stationC)
+ param8 = probe4.bind_param_bool("param_8")
+ print "param 8 =",param8
+
+
+# DOC TEST
+
+import doctest, fcall
+doctest.testmod(fcall)
+
+
+# UNIT TEST
+
+import unittest
+
+def cb1(msg):
+ print "=>",cb1.func_name
+ if not msg.is_param("result_2"):
+ raise Exception(cb1.func_name)
+ result2 = unpack('q',msg.bind_param("result_2"))
+ if result2[0] != 0x0000007B:
+ raise Exception(cb1.func_name)
+
+def cb2(msg):
+ print "=>",cb2.func_name
+ if not msg.is_param("result_2"):
+ raise Exception(cb2.func_name)
+ result2 = unpack('q',msg.bind_param("result_2"))
+ if result2[0] != 0x0000007B:
+ raise Exception(cb2.func_name)
+
+class TestFcallFunctions(unittest.TestCase):
+
+ def setUp(self):
+
+ # Create a station
+ self.station = 0
+
+ def tearDown(self):
+
+ # Remove station
+ pass
+
+ def test_create_fcall(self):
+
+ # Create a fcall message
+ fcall1 = create_fcall("function_1")
+
+ # Copy the message
+ fcall2 = fcall1
+
+ def test_create_probe(self):
+
+ # Create a probe message
+ probe = create_probe()
+
+ def test_add_param(self):
+
+ # Add an empty parameter to the probe message,
+ # and retrieve the added parameter
+ #
+ probe = create_probe()
+ probe.add_param("empty_param")
+ self.assert_(probe.is_param("empty_param"))
+
+ # Add a string parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ fcall = create_fcall("fcall").add_param("string_param", 'ABCD')
+ self.assertEqual(fcall.bind_param_string("string_param"),'ABCD')
+
+ def test_add_param_bool(self):
+
+ # Add a boolean parameter to the probe message,
+ # and retrieve the added parameter
+ #
+ probe = create_probe()
+ probe.add_param_bool("boolean_param", True)
+ self.assertEqual(probe.bind_param_bool("boolean_param"),True)
+
+ def test_add_param_ushort(self):
+
+ # Add an unsigned short parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ fcall = create_fcall("fcall")
+ fcall.add_param_ushort("ushort_param", 0xFEDC)
+ self.assertEqual(fcall.bind_param_ushort("ushort_param"),0xFEDC)
+
+ def test_add_param_ulong(self):
+
+ # Add an unsigned long parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ fcall = create_fcall("fcall")
+ fcall.add_param_ulong("ulong_param", 0xFEDCBA98)
+ self.assertEqual(fcall.bind_param_ulong("ulong_param"),0xFEDCBA98)
+
+ def test_add_param_n_u8(self):
+
+ # Add a Python tuple parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ tuple_u8 = (0x12, 0x34, 0x56)
+ fcall = create_fcall("test_u8").add_param_n_u8("tuple_u8", tuple_u8)
+ param = fcall.bind_param("tuple_u8")
+ param = unpack('!BBB', param)
+ self.assertEqual(param, tuple_u8)
+
+ def test_add_param_n_u16(self):
+
+ # Add a Python tuple parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+
+ tuple_u16 = (0x12AB, 0x34AB, 0x56AB, 0x78AB)
+ fcall = create_fcall("test_u16").add_param_n_u16("tuple_u16", tuple_u16)
+ param = fcall.bind_param("tuple_u16")
+ param = unpack('!HHHH', param)
+ self.assertEqual(param, tuple_u16)
+
+ def test_add_param_n_u32(self):
+
+ # Add a Python tuple parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+
+ tuple_u32 = (0x1234ABCD, 0x3456ABCD, 0x5678ABCD, 0x9ABCABCD, 0xEF01ABCD)
+ fcall = create_fcall("test_u32").add_param_n_u32("tuple_u32", tuple_u32)
+ param = fcall.bind_param("tuple_u32")
+ param = unpack('!IIIII', param)
+ self.assertEqual(param, tuple_u32)
+
+ def test_remove_param(self):
+
+ # Add a parameter to the probe message,
+ # remove the added parameter,
+ # and try to retrieve the removed parameter
+ #
+ probe = create_probe()
+ probe.add_param("param")
+ probe.remove_param("param")
+ self.failIf(probe.is_param("param"))
+
+ def test_set_cb(self):
+
+ # Set a callback to the fcall message,
+ # and set another callback
+ #
+ fcall = create_fcall("fcall")
+ fcall.set_cb(cb1)
+ fcall.set_cb(cb2)
+
+ def test_remove_cb(self):
+
+ # Set a callback to the fcall message,
+ # remove the set callback,
+ # and set another callback
+ #
+ fcall = create_fcall("fcall")
+ fcall.set_cb(cb1)
+ fcall.remove_cb()
+ fcall.set_cb(cb2)
+
+ def test_set_sta(self):
+
+ # Set the destination station to the probe message,
+ # create station 3,
+ # and set the destination station 3 to the probe message
+ #
+ probe = create_probe()
+ probe.set_sta(self.station)
+ station1 = 1
+ probe.set_sta(station1)
+
+ def test_send_async(self):
+
+ # Create a fcall message
+ fcall1 = create_fcall("function_1")
+
+ # Add a first parameter to the created message
+ param1 = pack('iiB',1,2,True)
+ fcall1.add_param("param_1", param1)
+
+ # Add a second parameter to the created message
+ param2 = pack('iiiiiiiiii',0,1,2,3,4,5,6,7,8,9)
+ fcall1.add_param("param_2", param2)
+
+ # Add a third parameter to the created message
+ param3 = "hello"
+ fcall1.add_param("param_3", param3)
+
+ # Add a fourth parameter to the created message
+ param4 = pack('q',123)
+ fcall1.add_param("param_4", param4)
+
+ # Register a callback function which will be called at message response reception
+ fcall1.set_cb(cb1)
+
+ # Set destination station of message
+ fcall1.set_sta(self.station)
+
+ # Send the configured message in an asynchronous mode
+ fcall1.send_async()
+
+ # Send another message in an asynchronous mode
+ station2 = 2
+ fcall2 = create_fcall("function_1")
+ fcall2.add_param("param_1", param1)
+ fcall2.add_param("param_2", param2)
+ fcall2.add_param("param_3", param3)
+ fcall2.add_param("param_4", param4)
+ fcall2.set_cb(cb2)
+ fcall2.set_sta(station2)
+ fcall2.send_async()
+
+ def test_send(self):
+
+ # Create a fcall message,
+ # add a boolean parameter,
+ # send the message to station,
+ # and get the result
+ #
+ fcall2 = create_fcall("function_2")
+ fcall2.add_param_bool("param_5", True)
+ fcall2 = fcall2.send(self.station)
+ result1 = fcall2.bind_param_string("result_1")
+ self.assertEqual(result1,"this is result 1")
+ self.assertEqual(len(result1),16)
+
+ # Create a probe message,
+ # set the destination station,
+ # add a parameter,
+ # send the message,
+ # and get the result
+ #
+ probe = create_probe().set_sta(self.station).add_param("param_6").send()
+ self.assertEqual(probe.bind_param_ulong("param_6"),0x7B000000)
+
+ def test_is_param(self):
+
+ # Add a parameter to the probe message,
+ # send the message to the destination station,
+ # and get the result
+ #
+ probe = create_probe()
+ probe.add_param("param_6").send(self.station)
+ self.assert_(probe.is_param("param_6"))
+
+ def test_bind_param_string(self):
+
+ # Add string parameters to the fcall message,
+ # and retrieve added parameters
+ #
+ fcall = create_fcall("fcall")
+ fcall.add_param("string_param_1","string param 1")
+ fcall.add_param("string_param_2","string param 2")
+ fcall.add_param("string_param_3","string param 3")
+ self.assertEqual(fcall.bind_param_string("string_param_1"),"string param 1")
+ self.assertEqual(fcall.bind_param_string("string_param_2"),"string param 2")
+ self.assertEqual(fcall.bind_param_string("string_param_3"),"string param 3")
+
+ def test_bind_param_bool(self):
+
+ # Add a boolean parameter to the fcall message,
+ # and retrieve the added parameter
+ #
+ fcall = create_fcall("fcall")
+ fcall.add_param_bool("boolean_param", False)
+ self.assertEqual(fcall.bind_param_bool("boolean_param"),False)
+
+ def test_bind_param_ushort(self):
+
+ # Add a parameter to the probe message,
+ # send the message to the destination station,
+ # and get the result
+ #
+ probe = create_probe()
+ probe = probe.add_param("param_10").send(self.station)
+ self.assertEqual(probe.bind_param_ushort("param_10"),0xEEFF)
+
+ def test_bind_param_ulong(self):
+
+ # Add a parameter to the probe message,
+ # send the message to the destination station,
+ # and get the result
+ #
+ probe = create_probe()
+ probe = probe.add_param("param_11").send(self.station)
+ self.assertEqual(probe.bind_param_ulong("param_11"),0xCCDDEEFF)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestFcallFunctions)
+
+try:
+ suite.addTest(doctest.DocTestSuite(fcall))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_macframe.py b/cesar/maximus/python/test/test_macframe.py
new file mode 100644
index 0000000000..ab5026ead8
--- /dev/null
+++ b/cesar/maximus/python/test/test_macframe.py
@@ -0,0 +1,547 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys, startup
+
+from maximus.macframe import *
+from maximus.macframe.create import create_pb
+from maximus.macframe.mpdu import SIZE_OF_PB520, MAX_PB_NB_PER_MPDU, MPDU
+from maximus.macframe.msdu import MSDU
+from maximus.macframe.pb import PB
+from maximus.mme import *
+from maximus.utils.crc import crc8, crc24, crc32
+from maximus.utils.format import *
+from interface import *
+from struct import pack, unpack
+
+
+# MPDU TEST
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+def prepare_rx(s, pb_nb=1):
+ fcall = m.create_fcall('prepare_rx')
+ if pb_nb == 1:
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ short_ppdu = False
+ mod = 2 # PHY_MOD_MINI_ROBO
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ pb_size = 0 # PHY_PB_SIZE_136
+ gil = 1 # PHY_GIL_567
+ else:
+ fc_mode = 2 # PHY_FC_MODE_AV_1
+ short_ppdu = False
+ mod = 0 # PHY_MOD_ROBO
+ fecrate = 0 # PHY_FEC_RATE_1_2
+ pb_size = 1 # PHY_PB_SIZE_520
+ gil = 0 # PHY_GIL_417
+ fcall.add_param_ushort("fc_mode", fc_mode)
+ fcall.add_param_bool("short_ppdu", short_ppdu)
+ fcall.add_param_ushort("mod", mod)
+ fcall.add_param_ushort("fecrate", fecrate)
+ fcall.add_param_ushort("pb_size", pb_size)
+ fcall.add_param_ushort("gil", gil)
+ fcall.add_param_ushort("pb_nb", pb_nb)
+ fcall.send(s)
+
+# Create a MAC Frame (6 octets)
+macFrame1 = MACFrame(FC_10 = FC_10(), FC_AV = FC_AV())
+
+# Create a MAC Frame (6 octets)
+fcav = FC_AV()
+macFrame2 = MACFrame(FC_AV=fcav)
+
+# Create a MAC Frame (14 octets)
+macFrame3 = MACFrame()
+macFrame3.set_msdu(pack('Q', 0x1122334455667788))
+
+# Create a MAC Frame (10 octets)
+f = file('/tmp/data.txt', 'w')
+f.write(pack('I', 0x31323334))
+f.close()
+macFrame4 = MACFrame(FC_AV=FC_AV(DT_AV='SOF'))
+f = file('/tmp/data.txt', 'r')
+macFrame4.set_msdu(f.readline())
+f.close()
+macFrame4.set_fc_10(FC_10(CC=1, DT='SOF_RSP'))
+
+# Maximus needs to receive the TONEMASK from a station
+station = m.create_sta()
+station.debug()
+fcall1 = m.create_fcall('set_tonemask')
+fcall1.send(station)
+
+# Send the MAC Frame asynchronously
+prepare_rx(station)
+macFrame4.send(m)
+
+# Create a MAC Frame containing an MME (66 octets)
+macFrame5 = MACFrame(msdu=MME(), PBHeader=PBHeader(SSN=0xFFF0))
+prepare_rx(station)
+macFrame5.send(m)
+
+# Create a MAC Frame Queue
+list1 = [macFrame1, macFrame2, macFrame3, macFrame4, macFrame5] # 102 octets => 1 PB
+queue = MACFrameQueue(PBHeader=PBHeader(), macframelist=list1)
+list1.reverse()
+queue.add(list1)
+prepare_rx(station, pb_nb=1)
+queue.send(m)
+list2 = [MACFrame(msdu=507*'a'), MACFrame(msdu=1017*'b')] # 1536 octets => 3 PBs
+queue.set_macframelist(list2)
+prepare_rx(station, pb_nb=3)
+queue.send(m)
+
+station.remove()
+
+
+# DOC TEST
+
+import doctest
+doctest.testmod(create)
+doctest.testmod(fc_10)
+doctest.testmod(fc_av)
+doctest.testmod(macframe)
+doctest.testmod(macframeheader)
+doctest.testmod(macframequeue)
+doctest.testmod(mpdu)
+doctest.testmod(msdu)
+doctest.testmod(pb)
+doctest.testmod(pbheader)
+
+# UNIT TEST
+
+import unittest
+
+class TestFC_10Functions(unittest.TestCase):
+
+ def setUp(self):
+ self.fc10 = FC_10()
+
+ def tearDown(self):
+ pass
+
+ def test_set_cc(self):
+ # Test with a Python integer
+ cc = 1
+ self.fc10.set_cc(cc)
+ self.assertEqual(self.fc10.get_cc(),cc)
+
+ def test_set_dt(self):
+ # Test with a Python integer
+ dt = 0x07
+ self.fc10.set_dt(dt)
+ self.assertEqual(self.fc10.get_dt(),dt)
+ # Test with a Python string
+ dt = 'NACK'
+ self.fc10.set_dt(dt)
+ self.assertEqual(self.fc10.get_dt(),0x05)
+
+ def test_set_vf(self):
+ # Test with a Python integer
+ vf = 0x1FFF
+ self.fc10.set_vf(vf)
+ self.assertEqual(self.fc10.get_vf(),vf)
+
+ def test_set_fccs(self):
+ # Test with a Python integer
+ fccs = 0xFF
+ self.fc10.set_fccs(fccs)
+ self.assertEqual(self.fc10.get_fccs(),fccs)
+ # Test with a Python string
+ s = pack('B',fccs)
+ self.fc10.set_fccs(s)
+ self.assertEqual(self.fc10.get_fccs(),fccs)
+
+ def test_get(self):
+ fc10 = FC_10(CC=1, DT='NACK', VF=0x1FFF)
+ self.assertEqual(fc10.get(),0x01BFFF00 + crc8(htohp24(0x01BFFF)))
+ fc10.set_fccs(15)
+ self.assertEqual(fc10.get(),0x01BFFF0F)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestFC_10Functions)
+
+class TestFC_AVFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.fcav = FC_AV()
+
+ def tearDown(self):
+ pass
+
+ def test_set_dt_av(self):
+ # Test with a Python integer
+ dt_av = 3
+ self.fcav.set_dt_av(dt_av)
+ self.assertEqual(self.fcav.get_dt_av(),dt_av)
+ # Test with a Python string
+ dt_av = 'Sound'
+ self.fcav.set_dt_av(dt_av)
+ self.assertEqual(self.fcav.get_dt_av(),4)
+
+ def test_set_access(self):
+ # Test with a Python integer
+ access = 1
+ self.fcav.set_access(access)
+ self.assertEqual(self.fcav.get_access(),access)
+
+ def test_set_snid(self):
+ # Test with a Python integer
+ snid = 0x0F
+ self.fcav.set_snid(snid)
+ self.assertEqual(self.fcav.get_snid(),snid)
+
+ def test_set_vf_av(self):
+ # Test with a Python integer
+ vf_av = 123456789123456789
+ self.fcav.set_vf_av(vf_av)
+ self.assertEqual(self.fcav.get_vf_av(),vf_av)
+ # Test with a Python string
+ vf_av = 'ABCDEFGHIJKL'
+ self.fcav.set_vf_av(vf_av)
+ self.assertEqual(self.fcav.get_vf_av(),0x4C4B4A494847464544434241)
+
+ def test_set_fccs_av(self):
+ # Test with a Python integer
+ fccs_av = 0x123
+ self.fcav.set_fccs_av(fccs_av)
+ self.assertEqual(self.fcav.get_fccs_av(),fccs_av)
+ # Test with a Python string
+ fccs_av = 'ABC'
+ self.fcav.set_fccs_av(fccs_av)
+ self.assertEqual(self.fcav.get_fccs_av(),0x434241)
+
+ def test_get(self):
+ fcav = FC_AV(DT_AV=7, ACCESS=0, SNID=4, VF_AV=0xFFFF)
+ self.assertEqual(fcav.get(),(0x47000000, 0, 0x000000FF,\
+ 0xFF000000 + crc24(htohp32(0x47000000) + htohp32(0) + htohp32(0x000000FF) + htohp8(0xFF))))
+ fcav.set_fccs_av(15)
+ self.assertEqual(fcav.get(),(0x47000000, 0, 0x000000FF, 0xFF00000F))
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestFC_AVFunctions))
+
+class TestMACFrameFunctions(unittest.TestCase):
+
+ def setUp(self):
+
+ self.macframe = MACFrame()
+ self.assertEqual(self.macframe.get_fc_10(), 0)
+ self.assertNotEqual(self.macframe.get_fc_av(), None)
+ self.assertNotEqual(self.macframe.get_macframeheader(), None)
+ self.assertEqual(self.macframe.get_ats(), None)
+ self.assertEqual(self.macframe.get_confounder(), None)
+ self.assertEqual(self.macframe.get_icv(), None)
+ self.assertEqual(self.macframe.get_msdu(), '')
+ self.assertEqual(self.macframe.get_iv(), 3*4*'0')
+ self.assertEqual(self.macframe.get_nek(), 4*4*'0')
+
+ self.m = m
+ self.sta = self.m.create_sta()
+ fcall = self.m.create_fcall('set_tonemask')
+ fcall.send(self.sta)
+
+ def tearDown(self):
+ self.sta.remove()
+
+ def test_set_macframeheader(self):
+ # Test with a MAC Frame Header object
+ header = MACFrameHeader()
+ self.macframe.set_macframeheader(header)
+ self.assertEqual(self.macframe.get_macframeheader(),header.get())
+ # Test with a Python integer
+ header = 0x1234
+ self.macframe.set_macframeheader(header)
+ self.assertEqual(self.macframe.get_macframeheader(),pack('H',header))
+ # Test with a Python string
+ header = 'AB'
+ self.macframe.set_macframeheader(header)
+ self.assertEqual(self.macframe.get_macframeheader(),header)
+
+ def test_set_ats(self):
+ # Test with a Python long
+ ats = 0x12345678
+ self.macframe.set_ats(ats)
+ self.assertEqual(self.macframe.get_ats(),pack('I',ats))
+ # Test with a Python string
+ ats = 'ABCD'
+ self.macframe.set_ats(ats)
+ self.assertEqual(self.macframe.get_ats(),ats)
+
+ def test_set_confounder(self):
+ # Test with a Python long
+ confounder = 0x12345678
+ self.macframe.set_confounder(confounder)
+ self.assertEqual(self.macframe.get_confounder(),pack('I',confounder))
+ # Test with a Python string
+ confounder = 'ABCD'
+ self.macframe.set_confounder(confounder)
+ self.assertEqual(self.macframe.get_confounder(),confounder)
+
+ def test_set_icv(self):
+ # Test with a Python long
+ icv = 4294967295;
+ self.macframe.set_icv(icv)
+ self.assertEqual(self.macframe.get_icv(),pack('I',icv))
+ # Test with a Python string
+ icv = pack('I', 1)
+ self.macframe.set_icv(icv)
+ self.assertEqual(self.macframe.get_icv(),icv)
+
+ def test_set_msdu(self):
+ # Test with an MSDU object
+ msdu = MME()
+ self.macframe.set_msdu(msdu)
+ self.assertEqual(self.macframe.get_msdu(),msdu.get())
+ # Test with a Python string
+ msdu = '0123456789ABCDEF'
+ self.macframe.set_msdu(msdu)
+ self.assertEqual(self.macframe.get_msdu(),msdu)
+
+ def test_sendnrecv(self):
+ # Tested in 'py/test_tx_rx.py' because another station is needed for this test
+ # Here, just test the timeout
+ prepare_rx(self.sta)
+ self.macframe.set_fc_10(123)
+ self.macframe.set_fc_av(pack('IIII', 123, 456, 789, 10))
+ self.macframe.set_msdu('This is the MPDU payload')
+ t = (self.m.get_date() + 250000 - 1) / 250000
+ d = 250000
+ rsp = self.macframe.sendnrecv(self.m, timeout=d)
+ self.assertEqual(rsp, None)
+ self.assertEqual(self.m.get_date(), (t + 1) * 250000)
+
+ def test_send(self):
+ prepare_rx(self.sta)
+ self.macframe.set_fc_10(123)
+ self.macframe.set_fc_av(pack('IIII', 123, 456, 789, 10))
+ self.macframe.set_msdu('This is the MPDU payload')
+ self.macframe.send(self.m)
+
+ def test_fill_mpdu_attr(self):
+ payload = 'ABCDEFGHIJKL'
+ header = MACFrameHeader(MFL=len(payload)-1)
+ self.macframe.set_macframeheader(header)
+ self.macframe.set_msdu(payload)
+ self.macframe.fill_mpdu_attr(0, 0, 0)
+ expected_payload = header.get() + payload + htohp32(crc32(payload))
+ self.assertEqual(self.macframe.payload, expected_payload)
+ icv = '1234'
+ self.macframe.set_icv(icv)
+ self.macframe.fill_mpdu_attr(0, 0, 0)
+ expected_payload = header.get() + payload + icv
+ self.assertEqual(self.macframe.payload, expected_payload)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestMACFrameFunctions))
+
+class TestMACFrameHeaderFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.header = MACFrameHeader()
+
+ def tearDown(self):
+ pass
+
+ def test_set_mft(self):
+ # Test with a Python integer
+ mft = 0x01
+ self.header.set_mft(mft)
+ self.assertEqual(self.header.get_mft(),mft)
+
+ def test_set_mfl(self):
+ # Test with a Python integer
+ mfl = 0x1234
+ self.header.set_mfl(mfl)
+ self.assertEqual(self.header.get_mfl(),mfl)
+
+ def test_set(self):
+ mft = 0x02
+ header = MACFrameHeader(MFT=mft)
+ mfl = 0x2345
+ self.header.set(mft,mfl)
+ self.assertEqual(self.header.get_mft(),mft)
+ self.assertEqual(self.header.get_mfl(),mfl)
+
+ def test_get(self):
+ mft = 0x03
+ mfl = 0x3123
+ get = pack('H', (mfl << 2) + mft)
+ header = MACFrameHeader(MFT=mft, MFL=mfl)
+ self.assertEqual(header.get(),get)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestMACFrameHeaderFunctions))
+
+class TestMACFrameQueueFunctions(unittest.TestCase):
+
+ def setUp(self):
+
+ self.macframequeue = MACFrameQueue()
+ self.assertEqual(self.macframequeue.get_fc_10(), 0)
+ self.assertNotEqual(self.macframequeue.get_fc_av(), None)
+ self.assertEqual(self.macframequeue.get_iv(), 3*4*'0')
+ self.assertEqual(self.macframequeue.get_nek(), 4*4*'0')
+ self.assertEqual(self.macframequeue.get_macframelist(), [])
+
+ self.m = m
+ self.sta = self.m.create_sta()
+ fcall = self.m.create_fcall('set_tonemask')
+ fcall.send(self.sta)
+
+ def tearDown(self):
+ self.sta.remove()
+
+ def test_set_macframelist(self):
+ # Test with an Python list
+ list = [MACFrame(), MACFrame(), MACFrame()]
+ self.macframequeue.set_macframelist(list)
+ self.assertEqual(self.macframequeue.get_macframelist(), list)
+
+ def test_add(self):
+ self.macframequeue.set_macframelist([MACFrame()])
+ # Test with a a MAC Frame
+ self.macframequeue.add(MACFrame())
+ self.assertEqual(len(self.macframequeue.get_macframelist()), 2)
+ # Test with a Python list of MAC Frames
+ self.macframequeue.add([MACFrame(), MACFrame(), MACFrame()])
+ self.assertEqual(len(self.macframequeue.get_macframelist()), 5)
+
+ def test_sendnrecv(self):
+ # Tested in 'py/test_tx_rx.py' because another station is needed for this test
+ # Here, just test the timeout
+ prepare_rx(self.sta, pb_nb=3)
+ self.macframequeue.set_fc_10(123)
+ self.macframequeue.set_fc_av(pack('IIII', 123, 456, 789, 10))
+ list = [MACFrame(), MACFrame(), MACFrame()]
+ self.macframequeue.set_macframelist(list)
+ t = (self.m.get_date() + 250000 - 1) / 250000
+ d = 250000
+ rsp = self.macframequeue.sendnrecv(self.m, timeout=d)
+ self.assertEqual(rsp, None)
+ self.assertEqual(self.m.get_date(), (t + 1) * 250000)
+
+ def test_send(self):
+ prepare_rx(self.sta, pb_nb=3)
+ self.macframequeue.set_fc_10(123)
+ self.macframequeue.set_fc_av(pack('IIII', 123, 456, 789, 10))
+ list = [MACFrame(), MACFrame(), MACFrame()]
+ self.macframequeue.set_macframelist(list)
+ self.macframequeue.send(self.m)
+ self.assertEqual(self.macframequeue.get_macframelist(), [])
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestMACFrameQueueFunctions))
+
+class TestMPDUFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.mpdu = MPDU()
+
+ def tearDown(self):
+ pass
+
+ def test_set_fc_10(self):
+ # Test with an FC 1.0 object
+ fc10 = FC_10()
+ self.mpdu.set_fc_10(fc10)
+ self.assertEqual(self.mpdu.get_fc_10(), fc10.get())
+ # Test with a Python long
+ fc10 = 0x12345678
+ self.mpdu.set_fc_10(fc10)
+ self.assertEqual(self.mpdu.get_fc_10(), fc10)
+ # Test with a Python string
+ fc10 = 'ABCD'
+ self.mpdu.set_fc_10(fc10)
+ self.assertEqual(self.mpdu.get_fc_10(),unpack('I', fc10)[0])
+
+ def test_set_fc_av(self):
+ # Test with an FC AV object
+ fcav = FC_AV()
+ self.mpdu.set_fc_av(fcav)
+ self.assertEqual(self.mpdu.get_fc_av(), fcav.get())
+ # Test with a Python string
+ fcav = 4*'ABCD'
+ self.mpdu.set_fc_av(fcav)
+ self.assertEqual(self.mpdu.get_fc_av(), unpack('IIII',fcav))
+ # Test with a tuple of 4 Python longs
+ fcav = (0, 1, 2, 3)
+ self.mpdu.set_fc_av(fcav)
+ self.assertEqual(self.mpdu.get_fc_av(), fcav)
+
+ def test_set_iv(self):
+ # Test with a Python string
+ iv = 3*'0123'
+ self.mpdu.set_iv(iv)
+ self.assertEqual(self.mpdu.get_iv(), iv)
+
+ def test_set_nek(self):
+ # Test with a Python string
+ nek = 4*'0123'
+ self.mpdu.set_nek(nek)
+ self.assertEqual(self.mpdu.get_nek(), nek)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestMPDUFunctions))
+
+class TestMSDUFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.msdu = MSDU()
+
+ def tearDown(self):
+ pass
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestMSDUFunctions))
+
+class TestPBFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.pb = PB()
+
+ def tearDown(self):
+ pass
+
+ def test_set_mpdu_attr(self):
+ fc10 = 10
+ fcav = (0, 1, 2, 3)
+ data = 'ABCDEFGH'
+ payload = MAX_PB_NB_PER_MPDU * data * (SIZE_OF_PB520 / len(data))
+ self.pb.set_mpdu_attr(fc10, fcav, payload)
+ self.assertEqual(self.pb.get_fc_10(), fc10)
+ self.assertEqual(self.pb.get_fc_av(), fcav)
+ self.assertEqual(len(self.pb.get_pblist()), MAX_PB_NB_PER_MPDU)
+
+ def test_create_pb(self):
+ self.assertNotEqual(create_pb(), None)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestPBFunctions))
+
+class TestPBHeaderFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.header = PBHeader()
+
+ def tearDown(self):
+ pass
+
+ def test_get(self):
+ self.assertEqual(self.header.get(), 0x0A000000)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestPBHeaderFunctions))
+
+try:
+ suite.addTest(doctest.DocTestSuite(create))
+ suite.addTest(doctest.DocTestSuite(fc_10))
+ suite.addTest(doctest.DocTestSuite(fc_av))
+ suite.addTest(doctest.DocTestSuite(macframe))
+ suite.addTest(doctest.DocTestSuite(macframeheader))
+ suite.addTest(doctest.DocTestSuite(mpdu))
+ suite.addTest(doctest.DocTestSuite(msdu))
+ suite.addTest(doctest.DocTestSuite(pb))
+ suite.addTest(doctest.DocTestSuite(pbheader))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_maximus.py b/cesar/maximus/python/test/test_maximus.py
new file mode 100644
index 0000000000..9164b7676c
--- /dev/null
+++ b/cesar/maximus/python/test/test_maximus.py
@@ -0,0 +1,47 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import startup
+
+
+print
+print "MAXIMUS TEST"
+import test_channel
+import test_cli
+import test_ethernet
+import test_fsm
+import test_interface
+import test_macframe
+import test_mme
+import test_result
+import test_simu
+import test_station
+import test_utils
+
+print
+print "PY DOC"
+import pydoc, maximus
+pydoc.getdoc(maximus)
+
+
+print
+print "DOC TEST"
+import doctest
+doctest.testmod(maximus)
+doctest.testfile("test.txt")
+
+
+print
+print "UNIT TEST"
+import unittest
+allTests = unittest.TestSuite([test_channel.suite, test_cli.suite, test_ethernet.suite, test_fsm.suite, test_interface.suite, test_macframe.suite, test_mme.suite, test_result.suite, test_simu.suite, test_station.suite, test_utils.suite])
+testResult = unittest.TextTestRunner(verbosity=2).run(allTests)
+
+
+print
+print "TEST SUPPORT"
+from test import test_support
+def test_main():
+ test_support.run_suite(allTests)
+
diff --git a/cesar/maximus/python/test/test_mme.py b/cesar/maximus/python/test/test_mme.py
new file mode 100644
index 0000000000..f33c5615b8
--- /dev/null
+++ b/cesar/maximus/python/test/test_mme.py
@@ -0,0 +1,304 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys, startup
+
+from maximus.mme import *
+from maximus.mme.create import create_mme
+from maximus.utils.exception import OutOfRangeError
+from interface import *
+from struct import pack
+
+
+# MME TEST
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+# Create the destination station
+staRx = m.create_sta()
+staRx.debug()
+
+# Create an MME
+mme1 = MME(MMHeader=MMHeader(MMV=0x01), MMEntry=MMEntry('This is the MM Entry'))
+
+# Send the MME asynchronously
+mme1.send(m, staRx)
+
+# Create an MME
+mme2 = MME()
+
+# Send the MME asynchronously
+rsp = mme2.sendnrecv(m, staRx, timeout=250000)
+
+# Remove the destination station
+staRx.remove()
+
+
+# DOC TEST
+
+import doctest
+doctest.testmod(mme)
+doctest.testmod(mmentry)
+doctest.testmod(mmheader)
+doctest.testmod(mmtype)
+
+
+# UNIT TEST
+
+import unittest
+
+class TestMMHeaderFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.mmheader = MMHeader()
+
+ def tearDown(self):
+ pass
+
+ def test_set_oda(self):
+ # Test with a Python long
+ oda = 0x112233445566
+ self.mmheader.set_oda(oda)
+ self.assertEqual(self.mmheader.get_oda(), oda)
+ # Test with a Python string of length equals to 6 octets
+ oda = '123456'
+ self.mmheader.set_oda(oda)
+ self.assertEqual(self.mmheader.get_oda(), oda)
+
+ def test_set_osa(self):
+ # Test with a Python long
+ osa = 0xFFFFFFFFFFFF
+ self.mmheader.set_osa(osa)
+ self.assertEqual(self.mmheader.get_osa(), osa)
+ # Test with a Python string of length equals to 6 octets
+ osa = pack('Q', 0x112233445566)[0:6]
+ self.mmheader.set_osa(osa)
+ self.assertEqual(self.mmheader.get_osa(), osa)
+
+ def test_set_vlantag(self):
+ # Test with a Python integer
+ #
+ vlantag = 0x8100FFFF
+ self.mmheader.set_vlantag(vlantag)
+ self.assertEqual(self.mmheader.get_vlantag(), vlantag)
+
+ # Test with a bad vlantag
+ test = False
+ vlantag = 0xFFFFFFFF
+ try:
+ self.mmheader.set_vlantag(vlantag)
+ except OutOfRangeError:
+ test = True
+ self.assert_(test)
+
+ # Test with a Python string of length equals to 4 octets
+ #
+ vlantag = pack('!I', 0x81000000)
+ self.mmheader.set_vlantag(vlantag)
+ self.assertEqual(self.mmheader.get_vlantag(), vlantag)
+
+ # Test with a bad vlantag
+ test = False
+ vlantag = pack('!I', 0x00000000)
+ try:
+ self.mmheader.set_vlantag(vlantag)
+ except OutOfRangeError:
+ test = True
+ self.assert_(test)
+
+ def test_set_mtype(self):
+ # Test with a Python integer
+ mtype = 0xFFFF
+ self.mmheader.set_mtype(mtype)
+ self.assertEqual(self.mmheader.get_mtype(), mtype)
+ # Test with a Python string of length equals to 2 octets
+ mtype = '12'
+ self.mmheader.set_mtype(mtype)
+ self.assertEqual(self.mmheader.get_mtype(), mtype)
+ mtype = pack('H', 0x1122)
+ self.mmheader.set_mtype(mtype)
+ self.assertEqual(self.mmheader.get_mtype(), mtype)
+
+ def test_set_mmv(self):
+ # Test with a Python integer
+ mmv = 0xFF
+ self.mmheader.set_mmv(mmv)
+ self.assertEqual(self.mmheader.get_mmv(), mmv)
+ # Test with a Python string of length equals to 1 octet
+ mmv = '1'
+ self.mmheader.set_mmv(mmv)
+ self.assertEqual(self.mmheader.get_mmv(), mmv)
+ mmv = pack('B', 0x01)
+ self.mmheader.set_mmv(mmv)
+ self.assertEqual(self.mmheader.get_mmv(), mmv)
+
+ def test_set_mmtype(self):
+ # Test with a Python integer
+ mmtype = 0x1234
+ self.mmheader.set_mmtype(mmtype)
+ self.assertEqual(self.mmheader.get_mmtype(), mmtype)
+ # Test with a Python string of length equals to 2 octets
+ mmtype = 'ab'
+ self.mmheader.set_mmtype(mmtype)
+ self.assertEqual(self.mmheader.get_mmtype(), mmtype)
+ mmtype = pack('H', 0x1234)
+ self.mmheader.set_mmtype(mmtype)
+ self.assertEqual(self.mmheader.get_mmtype(), mmtype)
+
+ def test_set_fmi(self):
+ # Test with a Python integer
+ fmi = 0xFEDC
+ self.mmheader.set_fmi(fmi)
+ self.assertEqual(self.mmheader.get_fmi(), fmi)
+ # Test with a Python string of length equals to 2 octets
+ fmi = 'AB'
+ self.mmheader.set_fmi(fmi)
+ self.assertEqual(self.mmheader.get_fmi(), fmi)
+ fmi = pack('H', 0xFEDC)
+ self.mmheader.set_fmi(fmi)
+ self.assertEqual(self.mmheader.get_fmi(), fmi)
+
+ def test_get(self):
+ # Test without vlantag
+ mmheader = MMHeader(ODA=0x616263646566, OSA=0x6768696A6B6C, MTYPE=0x6D6E, MMV=0x6F, MMTYPE=0x7170, FMI=0x7372)
+ self.assertEqual(mmheader.get(), 'abcdefghijklmnopqrs')
+
+ # Test with vlantag
+ mmheader = MMHeader(ODA=0x616263646566, OSA=0x6768696A6B6C, VLANTag=0x81006D6E, MTYPE=0x6F70, MMV=0x71, MMTYPE=0x7372, FMI=0x7574)
+ self.assertEqual(mmheader.get(), 'abcdefghijkl' + pack('!I', 0x81006D6E) + 'opqrstu')
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestMMHeaderFunctions)
+
+class TestMMEntryFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.mmentry = MMEntry()
+
+ def tearDown(self):
+ pass
+
+ def test_set_data(self):
+ # Test with a Python string of length smaller than 1518 - 23 = 1495
+ data = 1495*'M'
+ self.mmentry.set_data(data)
+ self.assertEqual(self.mmentry.get_data(), data)
+
+ def test_get(self):
+ data = 'This is the Management Message Entry Data'
+ mmentry = MMEntry(data)
+ self.assertEqual(mmentry.get(), data)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestMMEntryFunctions))
+
+class TestMMEFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.mme = MME()
+ self.m = m
+
+ def tearDown(self):
+ pass
+
+ def test_set_mmheader(self):
+ # Test with an MM Header object with VLAN Tag
+ mmheader = MMHeader(VLANTag=0x81000000)
+ self.mme.set_mmheader(mmheader)
+ self.assertEqual(self.mme.get_mmheader(), mmheader)
+
+ # Test with an MM Header object without VLAN Tag
+ mmheader = MMHeader()
+ self.mme.set_mmheader(mmheader)
+ self.assertEqual(self.mme.get_mmheader(), mmheader)
+
+ # Test with a Python string of length equals to 19 octets
+ mmheader = 'abcdefghijklmnopqrs'
+ self.mme.set_mmheader(mmheader)
+ self.assertEqual(self.mme.get_mmheader(), mmheader)
+
+ # Test with a Python string of length equals to 23 octets
+ mmheader = 'abcdefghijklmnopqrstuvw'
+ self.mme.set_mmheader(mmheader)
+ self.assertEqual(self.mme.get_mmheader(), mmheader)
+
+ def test_set_mmentry(self):
+ # Test with a Python string of length smaller than 1500 octets
+ mmentry = 'test'
+ self.mme.set_mmentry(mmentry)
+ self.assertEqual(self.mme.get_mmentry(), mmentry)
+
+ def test_set_msdu_attr(self):
+ # Test with VLAN Tag
+ payload = 12*'H' + pack('!I', 0x81000000) + 7*'H' + 'Payload'
+ self.mme.set_msdu_attr(payload)
+ self.assertEqual(self.mme.get_mmheader(), 12*'H' + pack('!I', 0x81000000) + 7*'H')
+ self.assertEqual(self.mme.get_mmentry(), 'Payload')
+
+ # Test without VLAN Tag
+ payload = 19*'H' + 'Payload'
+ self.mme.set_msdu_attr(payload)
+ self.assertEqual(self.mme.get_mmheader(), 19*'H')
+ self.assertEqual(self.mme.get_mmentry(), 'Payload')
+
+ def test_sendnrecv(self):
+ # Tested in 'py/test_ether.py' because another station is needed for this test
+ # Here, just test the timeout
+ sta = self.m.create_sta()
+ t = self.m.get_date()
+ d = 250000
+ rsp = self.mme.sendnrecv(self.m, sta, timeout=d)
+ self.assertEqual(rsp, None)
+ self.assertEqual(self.m.get_date(), t + d)
+ sta.remove()
+
+ def test_send(self):
+ sta = self.m.create_sta()
+ self.mme.send(self.m, sta)
+ sta.remove()
+
+ def test_get(self):
+ # Test with VLAN Tag
+ mme1 = MME(MMHeader=23*'A', MMEntry='B')
+ self.assertEqual(mme1.get(), 23*'A'+'B'+36*pack('B',0))
+ mme2 = MME(MMHeader=23*'A', MMEntry=36*'B')
+ self.assertEqual(mme2.get(), 23*'A'+36*'B'+pack('B',0))
+ mme3 = MME(MMHeader=23*'A', MMEntry=37*'B')
+ self.assertEqual(mme3.get(), 23*'A'+37*'B')
+ mme4 = MME(MMHeader=23*'A', MMEntry=1000*'B')
+ self.assertEqual(mme4.get(), 23*'A'+1000*'B')
+
+ # Test without VLAN Tag
+ mme1 = MME(MMHeader=19*'A', MMEntry='B')
+ self.assertEqual(mme1.get(), 19*'A'+'B'+40*pack('B',0))
+ mme2 = MME(MMHeader=19*'A', MMEntry=40*'B')
+ self.assertEqual(mme2.get(), 19*'A'+40*'B'+pack('B',0))
+ mme3 = MME(MMHeader=19*'A', MMEntry=41*'B')
+ self.assertEqual(mme3.get(), 19*'A'+41*'B')
+ mme4 = MME(MMHeader=19*'A', MMEntry=1000*'B')
+ self.assertEqual(mme4.get(), 19*'A'+1000*'B')
+
+ def test_get_ether_type(self):
+ self.assertEqual(self.mme.get_ether_type(), 2)
+
+ def test_get_type(self):
+ self.assertEqual(self.mme.get_type(), 'ETHERNET_TYPE_MME')
+
+ def test_create_mme(self):
+ self.assertNotEqual(create_mme(), None)
+
+suite.addTests(unittest.TestLoader().loadTestsFromTestCase(TestMMEFunctions))
+
+try:
+ suite.addTest(doctest.DocTestSuite(mme))
+ suite.addTest(doctest.DocTestSuite(mmentry))
+ suite.addTest(doctest.DocTestSuite(mmheader))
+ suite.addTest(doctest.DocTestSuite(mmtype))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_result.py b/cesar/maximus/python/test/test_result.py
new file mode 100644
index 0000000000..5fa7a969bf
--- /dev/null
+++ b/cesar/maximus/python/test/test_result.py
@@ -0,0 +1,26 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import startup
+
+from maximus.result import *
+
+
+# RESULT TEST
+
+
+# DOC TEST
+
+import doctest
+#doctest.testmod()
+
+
+# UNIT TEST
+
+import unittest
+suite = unittest.TestSuite()
+#try:
+# suite.addTest(doctest.DocTestSuite())
+#except ValueError:
+# print "has no tests"
diff --git a/cesar/maximus/python/test/test_simu.py b/cesar/maximus/python/test/test_simu.py
new file mode 100644
index 0000000000..e30c2e8e80
--- /dev/null
+++ b/cesar/maximus/python/test/test_simu.py
@@ -0,0 +1,120 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import sys, startup
+
+from maximus.simu import *
+from maximus.simu.rx import Rx
+from interface import *
+
+
+# SIMU TEST
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+# Transmission
+rsp = sendnrecv(file='data', timeout=5000)
+send(file='data')
+
+# Define a filter function
+def my_filter(rx_macframe):
+ print "=> my_filter"
+ return True
+
+# Reception
+rsp = recv(maximus=m, timeout=10000, filter=my_filter, count=0)
+
+# Get the current date
+t = m.get_date()
+
+
+# DOC TEST
+
+import doctest
+doctest.testmod(rx)
+doctest.testmod(tx)
+
+
+# UNIT TEST
+
+import unittest
+
+class TestRxFunctions(unittest.TestCase):
+
+ def setUp(self):
+ print "setUp"
+ self.reception = Rx(m)
+
+ def tearDown(self):
+ print "tearDown"
+
+ def test_init(self):
+ reception = Rx(maximus=m, filter_fc=my_filter)
+
+ def test_recv(self):
+ reception = Rx(maximus=m, filter_fc=my_filter, counter=2)
+ class MACFrame:
+ pass
+ macframe1 = MACFrame()
+ macframe2 = MACFrame()
+ reception.cb(macframe1)
+ reception.cb(macframe2)
+ self.assertEqual(reception.recv(), [macframe1, macframe2])
+
+ def test_add_frame(self):
+ class MACFrame:
+ pass
+ macframe1 = MACFrame()
+ macframe2 = MACFrame()
+ self.reception.add_frame(macframe1)
+ self.assertEqual(len(self.reception.get_frame_list()), 1)
+ self.assertEqual(self.reception.get_frame_list()[0], macframe1)
+ self.reception.add_frame(macframe2)
+ self.assertEqual(len(self.reception.get_frame_list()), 2)
+ self.assertEqual(self.reception.get_frame_list()[0], macframe1)
+ self.assertEqual(self.reception.get_frame_list()[1], macframe2)
+
+ def test_set_counter(self):
+ counter = 10
+ self.reception.set_counter(counter)
+ self.assertEqual(self.reception.get_counter(), counter)
+
+ def test_decr_counter(self):
+ self.reception.decr_counter()
+ self.assertEqual(self.reception.get_counter(), 0)
+ counter = 10
+ self.reception.set_counter(counter)
+ self.reception.decr_counter()
+ self.assertEqual(self.reception.get_counter(), counter-1)
+
+ def test_call_filter_fc(self):
+ def filter_fc(macframe):
+ print "=> filter_fc"
+ self.reception.set_filter_fc(filter_fc)
+ class MACFrame:
+ pass
+ macframe = MACFrame()
+ self.reception.call_filter_fc(macframe)
+
+ def test_recv(self):
+ self.assertEqual(recv(maximus=m, timeout=None, filter=None, count=0), None)
+ t = m.get_date()
+ d = 750001
+ recv(maximus=m, timeout=d)
+ self.assertEqual(m.get_date(), t + 1000000)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestRxFunctions)
+
+try:
+ suite.addTest(doctest.DocTestSuite(rx))
+ suite.addTest(doctest.DocTestSuite(tx))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_station.py b/cesar/maximus/python/test/test_station.py
new file mode 100644
index 0000000000..bfc1c71331
--- /dev/null
+++ b/cesar/maximus/python/test/test_station.py
@@ -0,0 +1,268 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import startup, sys
+
+from maximus.station import *
+from maximus.ethernet.buffer import realloc_buffer
+from maximus.utils.exception import Error
+from maximus.utils.format import *
+from interface import *
+
+
+# STATION TEST
+
+# Create a Maximus instance
+m = Maximus()
+
+# Initialize Maximus with command line arguments
+m.init(sys.argv)
+
+station_nb = 0
+file_desc_nb = 3 # number of file descriptors per station (3 for pipe, 2 for socket)
+
+# Disable the automatic buffer allocation
+realloc_buffer(False)
+
+sta1 = STA(m, name="my_sta")
+station_nb += 1
+sta1.debug()
+sta1.set_mac_address(0x123456789ABC)
+m.create_fcall("uninit_ether").send(sta1.get())
+sta1.remove()
+
+sta2 = STA(m, config=Config(mac_address='12:34:56:78:9A:BC'))
+station_nb += 1
+sta2.debug()
+sta2.set_cco_preference(False)
+m.create_fcall("uninit_ether").send(sta2.get())
+sta2.remove()
+
+sta3 = STA(m, name="my_sta", executable='../stationtest/obj/test_station.elf')
+station_nb += 1
+sta3.debug()
+m.create_fcall("uninit_ether").send(sta3.get())
+sta3.remove()
+
+conf4 = Config(cco_preference=True)
+sta4 = STA(m, name="my_sta", config=conf4)
+station_nb += 1
+sta4.debug()
+m.create_fcall("uninit_ether").send(sta4.get())
+sta4.remove()
+
+conf5 = Config(was_cco=True, npw="network_password", sl=2)
+sta5 = STA(m, name="This is the name of my station", config=conf5)
+station_nb += 1
+sta5.debug()
+m.create_fcall("uninit_ether").send(sta5.get())
+sta5.remove()
+
+conf = Config()
+conf.mac_address = '12:34:56:78:9A:BC'
+conf.cco_preference = True
+conf.was_cco = False
+conf.npw = "a Python string of length from 8 to 64 octets"
+conf.dpw = "a Python string of length from 0 to 64 octets"
+conf.m_sta_hfid = "a Python string of length from 0 to 64 octets"
+conf.u_sta_hfid = "a Python string of length from 0 to 64 octets"
+conf.avln_hfid = "a Python string of length from 0 to 64 octets"
+conf.sl = 2
+conf.tonemask = (85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535)
+conf.snid = 15
+
+sta6 = STA(m, debug=True, name="sta6", config_mode='fcall_cp_station', config=conf)
+station_nb += 1
+m.create_fcall("uninit_ether").send(sta6.get())
+sta6.remove()
+
+sta7 = STA(m)
+station_nb += 1
+try:
+ bad_conf = Config(was_cco="this is a mistake")
+ sta7.set_config(bad_conf)
+except TypeError:
+ m.create_fcall("uninit_ether").send(sta7.get())
+ sta7.remove()
+
+sta8 = STA(m, name="sta8", config_mode='fcall_process_drv', config=conf)
+station_nb += 1
+m.create_fcall("uninit_ether").send(sta8.get())
+sta8.remove()
+
+sta9 = STA(m, name="sta9", config_mode='MME', config=conf)
+station_nb += 1
+m.create_fcall("uninit_ether").send(sta9.get())
+sta9.remove()
+
+# Test with the maximum number of stations,
+# which is limited by the maximum number of open file descriptors (1024)
+station_max_nb = (1024 + (file_desc_nb - 1)) / file_desc_nb - station_nb * file_desc_nb
+station_list = []
+for i in range (0, station_max_nb):
+ station_list.append(STA(m))
+for i in range (0, len(station_list)):
+ m.create_fcall("uninit_ether").send(station_list[i].get())
+ station_list[i].remove()
+if len(station_list) != station_max_nb:
+ print "length of list of stations =", len(station_list)
+ print "number of created stations =", station_max_nb
+ raise Error("incorrect length of list of stations")
+
+
+# DOC TEST
+
+import doctest
+doctest.testmod(config)
+doctest.testmod(sta)
+
+
+# UNIT TEST
+
+import unittest
+
+class TestSTAFunctions(unittest.TestCase):
+
+ def setUp(self):
+ # Create station
+ self.station = STA(m)
+
+ def tearDown(self):
+ # Remove station
+ m.create_fcall("uninit_ether").send(self.station.get())
+ self.station.remove()
+
+ def test_stop(self):
+ self.station.stop()
+
+ def test_set_name(self):
+ name = "Name of my station"
+ self.station.set_name(name)
+ self.assertEqual(self.station.get_name(), name)
+
+ def test_set_mme_buffer_nb(self):
+ mme_buffer_nb = 4
+ self.station.set_mme_buffer_nb(mme_buffer_nb)
+ self.assertEqual(self.station.get_mme_buffer_nb(), mme_buffer_nb)
+
+ def test_set_config_mode(self):
+ config_mode = 'fcall_process_drv'
+ self.station.set_config_mode(config_mode)
+ self.assertEqual(self.station.get_config_mode(), config_mode)
+
+ def test_set_config(self):
+ test_conf = Config()
+ test_conf.mac_address = (0x11, 0x22, 0x33, 0x44, 0x55, 0x66)
+ test_conf.cco_preference = True
+ self.station.set_config(test_conf)
+ self.assertEqual(self.station.get_config().mac_address, test_conf.mac_address)
+ self.assertEqual(self.station.get_config().cco_preference, test_conf.cco_preference)
+
+ def test_set_mac_address(self):
+ mac_address = (0x41, 0x42, 0x43, 0x44, 0x45, 0x46)
+ # Test with a Python tuple of 6 Python integers
+ self.station.set_mac_address((0x41, 0x42, 0x43, 0x44, 0x45, 0x46))
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python long (decimal or hexadecimal value)
+ self.station.set_mac_address(0x414243444546)
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python string of length equals to 6 octets
+ self.station.set_mac_address(pack(n + u64, 0x414243444546)[SIZE_OF_U16:])
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+ # Test with a Python string of length equals to 17 octets ('XX:XX:XX:XX:XX:XX')
+ self.station.set_mac_address('41:42:43:44:45:46')
+ self.assertEqual(self.station.get_mac_address(), mac_address)
+
+ def test_set_cco_preference(self):
+ cco_preference = False
+ self.station.set_cco_preference(cco_preference)
+ self.assertEqual(self.station.get_cco_preference(), cco_preference)
+
+ def test_set_was_cco(self):
+ was_cco = True
+ self.station.set_was_cco(was_cco)
+ self.assertEqual(self.station.get_was_cco(), was_cco)
+
+ def test_set_npw(self):
+ npw = "This is the network password"
+ self.station.set_npw(npw)
+ self.assertEqual(self.station.get_npw(), npw)
+
+ def test_set_dpw(self):
+ dpw = "This is the device password"
+ self.station.set_dpw(dpw)
+ self.assertEqual(self.station.get_dpw(), dpw)
+
+ def test_set_m_sta_hfid(self):
+ m_sta_hfid = "This is the manufacturer sta hfid"
+ self.station.set_m_sta_hfid(m_sta_hfid)
+ self.assertEqual(self.station.get_m_sta_hfid(), m_sta_hfid)
+
+ def test_set_u_sta_hfid(self):
+ u_sta_hfid = "This is the user sta hfid"
+ self.station.set_u_sta_hfid(u_sta_hfid)
+ self.assertEqual(self.station.get_u_sta_hfid(), u_sta_hfid)
+
+ def test_set_avln_hfid(self):
+ avln_hfid = "This is the avln hfid"
+ self.station.set_avln_hfid(avln_hfid)
+ self.assertEqual(self.station.get_avln_hfid(), avln_hfid)
+
+ def test_set_sl(self):
+ sl = 0x02
+ self.station.set_sl(sl)
+ self.assertEqual(self.station.get_sl(), sl)
+
+ def test_set_snid(self):
+ snid = 0x02
+ self.station.set_snid(snid)
+ self.assertEqual(self.station.get_snid(), snid)
+
+ def test_set_tonemask(self):
+ tonemask = 85,139,167,214,225,282,302,409,419,569,591,736,748,856,882,1015,1027,1143,1535
+ self.station.set_tonemask(tonemask)
+ self.assertEqual(self.station.get_tonemask()[0 / 8], pack('B', 0)) # 74
+ self.assertEqual(self.station.get_tonemask()[11 / 8], pack('B', 0xf0)) # 85
+ self.assertEqual(self.station.get_tonemask()[345 / 8], pack('B', 0xfc)) # 419
+ self.assertEqual(self.station.get_tonemask()[495 / 8], pack('B', 0xff)) # 569
+ self.assertEqual(self.station.get_tonemask()[782 / 8], pack('B', 0x7f)) # 856
+ self.assertEqual(self.station.get_tonemask()[1069 / 8], pack('B', 0x3f)) # 1143
+ self.assertEqual(self.station.get_tonemask()[1070 / 8], pack('B', 0x3f)) # 1144
+ self.assertEqual(self.station.get_tonemask()[1155 / 8], pack('B', 0x00)) # 1229
+
+ def test_remove(self):
+ m.create_fcall("uninit_ether").send(self.station.get())
+ self.station.remove()
+ self.station = STA(m)
+
+ def test_deactivate(self):
+ self.station.deactivate()
+ self.station.activate()
+
+ def test_activate(self):
+ self.station.activate()
+
+ def test_debug(self):
+ self.station.debug()
+
+ def test_is_idle(self):
+ m.wait(1) # to process the system IDLE message coming from the station
+ self.assert_(self.station.is_idle())
+ self.station.deactivate()
+ self.assert_(not self.station.is_idle())
+ self.station.activate()
+
+ def test_get_station_id(self):
+ self.assertNotEqual(self.station.get_station_id(), 0)
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestSTAFunctions)
+
+try:
+ suite.addTest(doctest.DocTestSuite(config))
+ suite.addTest(doctest.DocTestSuite(sta))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/python/test/test_utils.py b/cesar/maximus/python/test/test_utils.py
new file mode 100644
index 0000000000..20a35f5a15
--- /dev/null
+++ b/cesar/maximus/python/test/test_utils.py
@@ -0,0 +1,107 @@
+#! usr/bin/env python
+
+print "\n*** " + __file__ + " ***\n"
+
+import startup
+
+from maximus.utils import *
+from unicodedata import *
+
+# CONVERTER TEST
+
+# Create data 1 from an hexadecimal value
+data1 = Data('0x41424344',16)
+print "data 1 =", data1.data
+print "base 2 =", data1.base2
+print "base 10 =", data1.base10
+print "base 16 =", data1.base16
+print "bin =", data1.get_bin(32)
+print "int =", data1.get_int()
+print "hex = ", data1.get_hex(4)
+print "str = ", data1.get_str()
+
+# Create data 2 from a string value
+data2 = Data(s='ABCD')
+print "data 2 =", data2.data
+print "base 2 =", data2.base2
+print "base 10 =", data2.base10
+print "base 16 =", data2.base16
+print "bin =", data2.get_bin(32)
+print "int =", data2.get_int()
+print "hex =", data2.get_hex(4)
+print "str =", data2.get_str()
+
+A = unichr(0x41)
+print "unichr =", A
+B = unicode(0x42)
+print "unicode =", B
+print "decimal =", decimal(unicode(9))
+print "digit =", digit(unicode(8))
+print "numeric =", numeric(unicode(7))
+
+# CRC TEST
+
+data = "123456789"
+if crc8(data) != 0xf4:
+ print "crc8 =", hex(crc8(data))
+ raise Error("crc8")
+if crc24(data) != 0x21cf02:
+ print "crc24 =", hex(crc24(data))
+ raise Error("crc24")
+if crc32(data) != 0xcbf43926: # 0xfc891918 0x5c0ac4 0x200fa5 0x29b1 0x0c73 0x89 0xf3 0x0ea0b1d3 0x78a26f6f 0xe0b759a4
+ print "crc32 =", hex(crc32(data))
+ raise Error("crc32")
+
+
+# DOC TEST
+
+import doctest
+doctest.testmod(converter)
+doctest.testmod(crc)
+doctest.testmod(exception)
+doctest.testmod(format)
+
+
+# UNIT TEST
+
+import unittest
+
+class TestDataFunctions(unittest.TestCase):
+
+ def setUp(self):
+ self.data = Data('0x41424344',16)
+ self.assertEqual(self.data.base2,"1000001010000100100001101000100")
+ self.assertEqual(self.data.base10,1094861636)
+ self.assertEqual(self.data.base16,"0x41424344")
+ self.assertEqual(self.data.data,"ABCD")
+
+ def tearDown(self):
+ pass
+
+ def test_get_bin(self):
+ self.assertEqual(self.data.get_bin(32),"01000001010000100100001101000100")
+
+ def test_get_int(self):
+ i=0x41424344
+ self.assertEqual(self.data.get_int(),1094861636)
+ self.assertEqual(self.data.get_int(),i)
+
+ def test_get_hex(self):
+ self.assertEqual(self.data.get_hex(4),"41424344")
+ self.assertEqual(self.data.get_hex(),"41424344")
+
+ def test_get_str(self):
+ self.assertEqual(self.data.get_str(),"ABCD")
+
+suite = unittest.TestLoader().loadTestsFromTestCase(TestDataFunctions)
+
+try:
+ suite.addTest(doctest.DocTestSuite(converter))
+ suite.addTest(doctest.DocTestSuite(crc))
+ suite.addTest(doctest.DocTestSuite(exception))
+ suite.addTest(doctest.DocTestSuite(format))
+except ValueError:
+ print "has no tests"
+
+if __name__ == '__main__':
+ testResult = unittest.TextTestRunner(verbosity=2).run(suite)
diff --git a/cesar/maximus/sci/Module b/cesar/maximus/sci/Module
new file mode 100644
index 0000000000..b9b574b21c
--- /dev/null
+++ b/cesar/maximus/sci/Module
@@ -0,0 +1,5 @@
+SOURCES := SciMsg.cpp SciServer.cpp
+ifdef UNITTEST
+SOURCES += SciServerTest.cpp SciMsgTest.cpp
+endif
+HOST_INCLUDES += maximus/sci/inc
diff --git a/cesar/maximus/sci/inc/ISci.h b/cesar/maximus/sci/inc/ISci.h
new file mode 100644
index 0000000000..cea7f4b954
--- /dev/null
+++ b/cesar/maximus/sci/inc/ISci.h
@@ -0,0 +1,143 @@
+/************************************************************************
+ ISci.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/sci/inc/ISci.h
+**************************************************************************/
+
+#ifndef ISCI_H
+#define ISCI_H
+
+#include "ISystem.h"
+
+#include "networkclock_types.h"
+#include "sci_types.h"
+
+#include <string>
+#include <vector>
+
+class SciMsg;
+
+typedef std::vector<Sci_Msg_Station_Id> DestStationsList;
+
+
+/**
+ * class ISci
+ */
+
+class ISci
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ ISci ( ) { }
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~ISci ( ) { }
+
+ // public methods
+ //
+
+ /**
+ * @return bool
+ * @param station_log_file
+ */
+ virtual bool init ( const std::string station_log ) = 0;
+
+ /**
+ * @return bool
+ */
+ virtual bool process ( ) = 0;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ virtual bool fillSciMsg ( SciMsg & sci_msg_to_send ) const = 0;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ virtual bool sendSciMsg ( const SciMsg & sci_msg_to_send ) const = 0;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ virtual bool sendSciMsgToAllActiveStations ( SciMsg & sci_msg_to_send ) const = 0;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ * @param list_of_dest_stations
+ */
+ virtual bool sendSciMsgToDestStations ( SciMsg & sci_msg_to_send, DestStationsList & list_of_dest_stations ) const = 0;
+
+ /**
+ * Set a value into mpSpecializedSciMsgArray
+ * @return bool
+ * @param sci_msg_type the array position to set
+ * @param sci_msg the new value of mpSpecializedSciMsgArray[sci_msg_type]
+ */
+ virtual bool registerSpecializedSciMsg ( const Sci_Msg_Type sci_msg_type, SciMsg * sci_msg ) = 0;
+
+ /**
+ * @return bool
+ * @param header
+ * @param data_length
+ * @param received_data
+ */
+ virtual bool receiveMsg ( const Sci_Msg_Header * header,
+ const unsigned long data_length,
+ const unsigned char * received_data ) const = 0;
+
+ virtual void displaySpecializedSciMsgArray ( ) const = 0;
+
+ /**
+ * @return bool
+ * @param p_list_of_stations
+ */
+ virtual bool setStationsList ( StationsList * p_list_of_stations ) = 0;
+
+ /**
+ * @return bool
+ * @param current_tick_value
+ */
+ virtual bool updateTickValue ( const Network_Clock_Tick current_tick_value ) = 0;
+
+};
+
+
+#endif // ISCI_H
diff --git a/cesar/maximus/sci/inc/SciMsg.h b/cesar/maximus/sci/inc/SciMsg.h
new file mode 100644
index 0000000000..7ed2608be5
--- /dev/null
+++ b/cesar/maximus/sci/inc/SciMsg.h
@@ -0,0 +1,333 @@
+/************************************************************************
+ SciMsg.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/sci/inc/SciMsg.h
+**************************************************************************/
+
+#ifndef SCIMSG_H
+#define SCIMSG_H
+
+#include "sci_types.h"
+
+
+/**
+ * class SciMsg
+ */
+
+class SciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ Sci_Msg_Status mSciMsgStatus; // NOT USED YET
+
+ // Values of SCI message header
+ //
+ Sci_Msg_Type mSciMsgType;
+ Sci_Msg_Station_Id mSciMsgStationId;
+ static Sci_Msg_Id mSciMsgId; // to send to station
+ Sci_Msg_Flag mSciMsgFlag;
+
+ // SCI message header, SCI message data length, and SCI message data
+ //
+ Sci_Msg_Header mSciMsgHeader;
+ unsigned long mSciMsgDataLength;
+ unsigned char * mpSciMsgData;
+
+protected:
+
+ // protected attributes
+ //
+
+ // Specialized SCI message header size, specialized SCI message data length, and specialized SCI message data
+ //
+ unsigned long mSpecializedSciMsgHeaderSize;
+ unsigned long mSpecializedSciMsgDataLength;
+ unsigned char * mpSpecializedSciMsgData;
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ SciMsg ( );
+
+ /**
+ * Copy Constructors
+ */
+ SciMsg ( const SciMsg & sci_msg );
+ SciMsg ( const SciMsg * p_sci_msg );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~SciMsg ( );
+
+ // public methods
+ //
+
+ /**
+ * @return SciMsg *
+ */
+ virtual SciMsg * create ( ) const = 0;
+
+ /**
+ * @return bool
+ */
+ virtual bool dispatchMsg ( ) = 0;
+
+ /**
+ * @return bool
+ */
+ virtual bool identifySpecializedSciMsgHeader ( ) = 0;
+
+ /**
+ * @return bool
+ */
+ virtual bool checkCompatibility ( ) const;
+
+ /**
+ * @return bool
+ */
+ virtual bool checkValidity ( ) const;
+
+ /**
+ * @return bool
+ */
+ bool identifySpecializedSciMsgData ( );
+
+ void displaySciMsgHeader ( ) const;
+
+ void displaySciMsgData ( ) const;
+
+ virtual void displaySpecializedSciMsgHeader ( ) const = 0;
+
+ /**
+ * Display the specialized SCI message type.
+ */
+ virtual void displaySpecializedSciMsgType ( int log_level ) const = 0;
+
+ void displaySpecializedSciMsgData ( ) const;
+
+ /**
+ * @return SCI_MSG_MAGIC converted to uint32_t
+ */
+ uint32_t getDefinedSciMsgMagicId ( ) const;
+
+ /**
+ * @return SCI_MSG_VERSION
+ */
+ uint8_t getDefinedSciMsgVersion ( ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return mSciMsgStatus
+ */
+ Sci_Msg_Status getSciMsgStatus ( ) const;
+
+ /**
+ * @return bool
+ * @param status the new value of mSciMsgStatus
+ */
+ bool setSciMsgStatus ( const Sci_Msg_Status status );
+
+ /**
+ * @return the value of mSciMsgType
+ */
+ Sci_Msg_Type getSciMsgType ( ) const;
+
+ /**
+ * @return bool
+ * @param type the new value of mSciMsgType
+ */
+ bool setSciMsgType ( const Sci_Msg_Type type );
+
+ /**
+ * Get the value of mSciMsgStationId
+ * @return the value of mSciMsgStationId
+ */
+ Sci_Msg_Station_Id getSciMsgStationId ( ) const;
+
+ /**
+ * Set the value of mSciMsgStationId
+ * @return bool
+ * @param station_id the new value of mSciMsgStationId
+ */
+ bool setSciMsgStationId ( const Sci_Msg_Station_Id station_id );
+
+ /**
+ * Get the value of mSciMsgId
+ * @return the value of mSciMsgId
+ */
+ Sci_Msg_Id getSciMsgId ( ) const;
+
+ /**
+ * Increment the value of mSciMsgId
+ * @return bool
+ */
+ bool incrementSciMsgId ( );
+
+ /**
+ * @return the value of mSciMsgFlag
+ */
+ Sci_Msg_Flag getSciMsgFlag ( ) const;
+
+ /**
+ * @return bool
+ * @param flag the new value of mSciMsgFlag
+ */
+ bool setSciMsgFlag ( const Sci_Msg_Flag flag );
+
+ /**
+ * @return a pointer to mSciMsgHeader
+ */
+ Sci_Msg_Header * getSciMsgHeader ( ) const;
+
+ /**
+ * @return bool
+ * @param sci_msg_header the new value of mSciMsgHeader
+ */
+ bool setSciMsgHeader ( const Sci_Msg_Header & sci_msg_header );
+
+ /**
+ * Get the value of mSciMsgDataLength
+ * @return the value of mSciMsgDataLength
+ */
+ unsigned long getSciMsgDataLength ( ) const;
+
+ /**
+ * Set the value of mSciMsgDataLength
+ * @return bool
+ * @param data_length the new value of mSciMsgDataLength
+ */
+ bool setSciMsgDataLength ( const unsigned long data_length );
+
+ /**
+ * Get the value of mpSciMsgData
+ * @return the value of mpSciMsgData
+ */
+ unsigned char * getSciMsgData ( ) const;
+
+ /**
+ * Set the value of mpSciMsgData
+ * @return bool
+ * @param p_data the new value of mpSciMsgData
+ */
+ bool setSciMsgData ( const unsigned char * p_data );
+
+ // protected attribute accessor methods
+ //
+
+ /**
+ * Get the value of mSpecializedSciMsgHeaderSize
+ * @return the value of mSpecializedSciMsgHeaderSize
+ */
+ virtual unsigned long getSpecializedSciMsgHeaderSize ( ) const;
+
+ /**
+ * Set the value of mSpecializedSciMsgHeaderSize
+ * @return bool
+ * @param header_size the new value of mSpecializedSciMsgHeaderSize
+ */
+ virtual bool setSpecializedSciMsgHeaderSize ( const unsigned long header_size );
+
+ /**
+ * Get the value of mpSpecializedSciMsgHeader
+ * @return the value of mpSpecializedSciMsgHeader into a void pointer
+ */
+ virtual void * returnSpecializedSciMsgHeader ( ) const = 0;
+
+ /**
+ * Get the value of mSpecializedSciMsgDataLength
+ * @return the value of mSpecializedSciMsgDataLength
+ */
+ virtual unsigned long getSpecializedSciMsgDataLength ( ) const;
+
+ /**
+ * Set the value of mSpecializedSciMsgDataLength
+ * @return bool
+ * @param data_length the new value of mSpecializedSciMsgDataLength
+ */
+ virtual bool setSpecializedSciMsgDataLength ( const unsigned long data_length );
+
+ /**
+ * Get the value of mpSpecializedSciMsgData
+ * @return the value of mpSpecializedSciMsgData
+ */
+ virtual unsigned char * getSpecializedSciMsgData ( ) const;
+
+ /**
+ * Set the value of mpSpecializedSciMsgData
+ * @return bool
+ * @param p_data the new value of mpSpecializedSciMsgData
+ */
+ virtual bool setSpecializedSciMsgData ( const unsigned char * p_data );
+
+ void displaySciMsgType ( ) const;
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( ) ;
+
+ void displaySciMsgFlag ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+ /**
+ * @return bool
+ * @param data_length_to_remove
+ * @param data_length
+ * @param pp_data
+ */
+ bool removeData ( const unsigned long data_length_to_remove, unsigned long & data_length, unsigned char ** pp_data );
+
+};
+
+
+#endif // SCIMSG_H
diff --git a/cesar/maximus/sci/inc/SciMsgTest.h b/cesar/maximus/sci/inc/SciMsgTest.h
new file mode 100644
index 0000000000..d588f55ce7
--- /dev/null
+++ b/cesar/maximus/sci/inc/SciMsgTest.h
@@ -0,0 +1,50 @@
+
+#ifndef SCIMSGTEST_H
+#define SCIMSGTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class SciMsg;
+class IFunctionCall;
+class ISci;
+class ISystem;
+class IPhy;
+class IEthernet;
+class INetworkClock;
+
+
+class SciMsgTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (SciMsgTest);
+ CPPUNIT_TEST (simpleTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void simpleTest (void);
+
+private:
+
+ SciMsg * mpFunctionSciMsg;
+ SciMsg * mpClockSciMsg;
+ SciMsg * mpSystemSciMsg;
+ SciMsg * mpPhySciMsg;
+ SciMsg * mpEtherSciMsg;
+ IFunctionCall * mpFunctionCallManager;
+ ISci * mpSciServer;
+ ISystem * mpSystemManager;
+ IPhy * mpPhyProcessor;
+ IEthernet * mpEthernet;
+ INetworkClock * mpNetworkClock;
+
+};
+
+
+#endif // SCIMSGTEST_H
diff --git a/cesar/maximus/sci/inc/SciServer.h b/cesar/maximus/sci/inc/SciServer.h
new file mode 100644
index 0000000000..1aa49b8964
--- /dev/null
+++ b/cesar/maximus/sci/inc/SciServer.h
@@ -0,0 +1,248 @@
+/************************************************************************
+ SciServer.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/sci/inc/SciServer.h
+**************************************************************************/
+
+#ifndef SCISERVER_H
+#define SCISERVER_H
+
+#include "ISci.h"
+#include "SystemManager.h" // for 'StationsList'
+
+#include "networkclock_types.h"
+#include "system_types.h"
+
+class Station;
+class SciMsg;
+
+
+/**
+ * class SciServer
+ */
+
+class SciServer : public ISci
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ std::string mStationLog;
+ SciMsg ** mpSpecializedSciMsgArray;
+ unsigned int mArraySize;
+ StationsList * mpListOfStations;
+ Network_Clock_Tick mNetworkClockTick;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ SciServer ( );
+
+ /**
+ * Copy Constructor
+ */
+ SciServer ( const SciServer & );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~SciServer ( );
+
+ // public methods
+ //
+
+ /**
+ * @return bool
+ * @param station_log_file
+ */
+ bool init ( const std::string station_log );
+
+ /**
+ * @return bool
+ */
+ bool process ( );
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ bool fillSciMsg ( SciMsg & sci_msg_to_send ) const;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ bool sendSciMsg ( const SciMsg & sci_msg_to_send ) const;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ */
+ bool sendSciMsgToAllActiveStations ( SciMsg & sci_msg_to_send ) const;
+
+ /**
+ * @return bool
+ * @param sci_msg_to_send
+ * @param
+ */
+ bool sendSciMsgToDestStations ( SciMsg & sci_msg_to_send, DestStationsList & list_of_dest_stations ) const;
+
+ /**
+ * Set a value into mpSpecializedSciMsgArray
+ * @return bool
+ * @param sci_msg_type the array position to set
+ * @param sci_msg the new value of mpSpecializedSciMsgArray[sci_msg_type]
+ */
+ bool registerSpecializedSciMsg ( const Sci_Msg_Type sci_msg_type, SciMsg * sci_msg );
+
+ /**
+ * @return bool
+ * @param header
+ * @param data_length
+ * @param received_data
+ */
+ bool receiveMsg ( const Sci_Msg_Header * header,
+ const unsigned long data_length,
+ const unsigned char * received_data ) const;
+
+ void displaySpecializedSciMsgArray ( ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return StationsList *
+ */
+ StationsList * getStationsList ( ) const;
+
+ /**
+ * @return bool
+ * @param p_list_of_stations
+ */
+ bool setStationsList ( StationsList * p_list_of_stations );
+
+ /**
+ * Get the value of mArraySize
+ * @return the value of mArraySize
+ */
+ unsigned int getArraySize ( ) const;
+
+ /**
+ * Get the value of mpSpecializedSciMsgArray
+ * @return the value of mpSpecializedSciMsgArray
+ */
+ SciMsg ** getSpecializedSciMsgArray ( ) const;
+
+ /**
+ * @return bool
+ * @param current_tick_value
+ */
+ bool updateTickValue ( const Network_Clock_Tick current_tick_value );
+
+ /**
+ * @return Network_Clock_Tick
+ */
+ Network_Clock_Tick getNetworkClockTick ( ) const;
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ bool log ( ) const;
+
+ /**
+ * @return bool
+ * @param type
+ * @param received_sci_msg
+ */
+ bool createSciMsg ( const Sci_Msg_Type type, SciMsg ** received_sci_msg ) const;
+
+ /**
+ * @return bool
+ * @param msg_header
+ * @param data_length
+ * @param remaining_data
+ * @param received_sci_msg
+ */
+ bool fillSciMsg ( const Sci_Msg_Header * msg_header,
+ const unsigned long data_length,
+ const unsigned char * received_data,
+ SciMsg ** created_sci_msg ) const;
+
+ /**
+ * @return bool
+ * @param received_sci_msg
+ */
+ bool processSciMsg ( SciMsg * received_sci_msg ) const;
+
+ std::string displaySciMsgType ( uint8_t sci_msg_type ) const;
+
+ void displayStatus ( ) const;
+
+ void initAttributes ( );
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return std::string
+ */
+ std::string getStationLog ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // SCISERVER_H
diff --git a/cesar/maximus/sci/inc/SciServerTest.h b/cesar/maximus/sci/inc/SciServerTest.h
new file mode 100644
index 0000000000..e92eac8abc
--- /dev/null
+++ b/cesar/maximus/sci/inc/SciServerTest.h
@@ -0,0 +1,62 @@
+
+#ifndef SCISERVERTEST_H
+#define SCISERVERTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+#include "sci_types.h" // for 'Sci_Msg_Header'
+
+class SciServer;
+class FunctionCallManager;
+class SystemManager;
+class PhyProcessor;
+class NetworkClockProcessor;
+class FunctionSciMsg;
+class IEthernet;
+
+void functionSciMsgCallback ( const FunctionSciMsg & function_sci_msg );
+
+
+class SciServerTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (SciServerTest);
+ CPPUNIT_TEST (registerSpecializedSciMsgTest);
+ CPPUNIT_TEST (receiveMsgTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void registerSpecializedSciMsgTest (void);
+ void receiveMsgTest (void);
+
+private:
+
+ SciServer * mpSciServer;
+ FunctionCallManager * mpFunctionCallManager;
+ SystemManager * mpSystemManager;
+ PhyProcessor * mpPhyProcessor;
+ NetworkClockProcessor * mpNetworkClockProcessor;
+ IEthernet * mpEthernet;
+
+ void registerClockSciMsgTest (void);
+ void registerPhySciMsgTest (void);
+ void registerSystemSciMsgTest (void);
+ void registerFunctionSciMsgTest (void);
+ void registerEtherSciMsgTest (void);
+ void receiveClockSciMsgTest ( Sci_Msg_Header & msg_header );
+ void receivePhySciMsgTest ( Sci_Msg_Header & msg_header );
+ void receiveSystemSciMsgTest ( Sci_Msg_Header & msg_header );
+ void receiveFunctionSciMsgTest ( Sci_Msg_Header & msg_header );
+ void receiveEtherSciMsgTest ( Sci_Msg_Header & msg_header );
+
+};
+
+
+#endif // SCISERVERTEST_H
diff --git a/cesar/maximus/sci/src/SciMsg.cpp b/cesar/maximus/sci/src/SciMsg.cpp
new file mode 100644
index 0000000000..cf31f0b69a
--- /dev/null
+++ b/cesar/maximus/sci/src/SciMsg.cpp
@@ -0,0 +1,711 @@
+/************************************************************************
+ SciMsg.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/sci/src/SciMsg.cpp
+**************************************************************************/
+
+#include "SciMsg.h"
+
+#include "Station.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <sstream> // for 'ostringstream'
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+Sci_Msg_Id SciMsg::mSciMsgId = 0;
+
+
+SciMsg::SciMsg ( ):
+mSciMsgStatus(MAXIMUS_SCI_MSG_STATUS_NONE),
+mSciMsgType(SCI_MSG_TYPE_NONE),
+mSciMsgStationId(0),
+mSciMsgFlag(SCI_MSG_FLAG_NONE),
+mSciMsgDataLength(0),
+mpSciMsgData(NULL),
+mSpecializedSciMsgHeaderSize(0),
+mSpecializedSciMsgDataLength(0),
+mpSpecializedSciMsgData(NULL)
+{
+ logFunction();
+
+ initAttributes();
+}
+
+
+void SciMsg::initAttributes ( )
+{
+ logFunction();
+
+ mSciMsgHeader.magic_id = 0x00000000;
+ mSciMsgHeader.version = 0x00;
+ mSciMsgHeader.type = 0x00;
+ mSciMsgHeader.length = 0x0000;
+ mSciMsgHeader.station_id = 0x0000;
+ mSciMsgHeader.msg_id = 0x0000;
+ mSciMsgHeader.netclock_high = 0x00000000;
+ mSciMsgHeader.netclock_low = 0x00000000;
+ mSciMsgHeader.flags = 0x0000;
+ mSciMsgHeader.reserved = 0x0000;
+}
+
+
+SciMsg::SciMsg ( const SciMsg & sci_msg )
+{
+ logFunction();
+
+ initAttributes();
+
+ mSciMsgStatus = sci_msg.getSciMsgStatus();
+
+ mSciMsgType = sci_msg.getSciMsgType();
+ mSciMsgStationId = sci_msg.getSciMsgStationId();
+ mSciMsgFlag = sci_msg.getSciMsgFlag();
+
+ setSciMsgHeader(*(sci_msg.getSciMsgHeader()));
+ mSciMsgDataLength = sci_msg.getSciMsgDataLength();
+ mpSciMsgData = sci_msg.getSciMsgData();
+
+ mSpecializedSciMsgHeaderSize = sci_msg.getSpecializedSciMsgHeaderSize();
+ mSpecializedSciMsgDataLength = sci_msg.getSpecializedSciMsgDataLength();
+ mpSpecializedSciMsgData = sci_msg.getSpecializedSciMsgData();
+}
+
+
+SciMsg::SciMsg ( const SciMsg * p_sci_msg )
+{
+ logFunction();
+
+ initAttributes();
+
+ if (NULL != p_sci_msg)
+ {
+ mSciMsgStatus = p_sci_msg->getSciMsgStatus();
+
+ mSciMsgType = p_sci_msg->getSciMsgType();
+ mSciMsgStationId = p_sci_msg->getSciMsgStationId();
+ mSciMsgFlag = p_sci_msg->getSciMsgFlag();
+
+ setSciMsgHeader(*(p_sci_msg->getSciMsgHeader()));
+ mSciMsgDataLength = p_sci_msg->getSciMsgDataLength();
+ mpSciMsgData = p_sci_msg->getSciMsgData();
+
+ mSpecializedSciMsgHeaderSize = p_sci_msg->getSpecializedSciMsgHeaderSize();
+ mSpecializedSciMsgDataLength = p_sci_msg->getSpecializedSciMsgDataLength();
+ mpSpecializedSciMsgData = p_sci_msg->getSpecializedSciMsgData();
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI message pointer is NULL", errno);
+ }
+}
+
+
+SciMsg::~SciMsg ( )
+{
+ logFunction();
+
+ if (NULL != mpSciMsgData)
+ {
+ delete [] mpSciMsgData;
+ mpSciMsgData = NULL;
+ }
+ if (NULL != mpSpecializedSciMsgData)
+ {
+ delete [] mpSpecializedSciMsgData;
+ mpSpecializedSciMsgData = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+// Check SCI msg compatibility (check SCI msg version)
+//
+bool SciMsg::checkCompatibility ( ) const
+{
+ logFunction();
+
+ return (getDefinedSciMsgVersion() == getSciMsgHeader()->version);
+}
+
+
+// Check SCI msg validity (check SCI msg magic id and SCI msg id)
+//
+bool SciMsg::checkValidity ( ) const
+{
+ logFunction();
+ bool bCheck = false;
+
+ if ( (getDefinedSciMsgMagicId() == getSciMsgHeader()->magic_id)
+ && (SCI_MSG_ID_STATION <= getSciMsgHeader()->msg_id) )
+ {
+ bCheck = true;
+ }
+
+ return bCheck;
+}
+
+
+// Remove specialized SCI message header from specialized SCI msg data
+// Then, set specialized SCI message data length, and specialized SCI msg data
+//
+bool SciMsg::identifySpecializedSciMsgData ( )
+{
+ logFunction();
+ bool bIdentifyData = false;
+
+ if (NULL != getSciMsgData())
+ {
+ // Check data lengths coherence
+ //
+ if (getSciMsgDataLength() == getSciMsgHeader()->length)
+ {
+ // Create temporary variables
+ //
+ unsigned long tempDataLength = getSciMsgDataLength();
+ unsigned char * pTempData = new unsigned char [tempDataLength];
+
+ if (NULL != pTempData)
+ {
+ for (unsigned long i=0; i<tempDataLength; i++)
+ {
+ *(pTempData+i) = *(getSciMsgData()+i);
+ }
+
+ bIdentifyData = removeData (getSpecializedSciMsgHeaderSize(), tempDataLength, &pTempData);
+
+ if (0 != bIdentifyData)
+ {
+ bIdentifyData &= setSpecializedSciMsgDataLength (tempDataLength);
+ bIdentifyData &= setSpecializedSciMsgData (pTempData);
+ }
+
+ // Free temporary allocated memory
+ //
+ delete [] pTempData;
+ pTempData = NULL;
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Initialized data pointer is NULL");
+ }
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "Incoherent data lengths between SCI message header and set data length", errno);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Received data pointer is NULL");
+ }
+
+ return bIdentifyData;
+}
+
+
+void SciMsg::displaySciMsgHeader ( ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "SCI msg header = " << endl;
+ clog << logger(LOG_INFO) << "\tmagic_id = 0x" << setfill('0') << setw(8) << uppercase << hex << getSciMsgHeader()->magic_id << endl;
+ clog << logger(LOG_INFO) << "\tversion = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSciMsgHeader()->version) << endl;
+ displaySciMsgType();
+ clog << logger(LOG_INFO) << "\tlength = " << dec << getSciMsgHeader()->length << " bytes (0x" << setfill('0') << setw(4) << uppercase << hex << getSciMsgHeader()->length << ")" << endl;
+ clog << logger(LOG_INFO) << "\tstation_id = " << dec << getSciMsgHeader()->station_id << " (0x" << setfill('0') << setw(4) << uppercase << hex << getSciMsgHeader()->station_id << ")" << endl;
+ clog << logger(LOG_INFO) << "\tmsg_id = 0x" << setfill('0') << setw(4) << uppercase << hex << getSciMsgHeader()->msg_id << endl;
+ clog << logger(LOG_INFO) << "\tnetclock = 0x" << setfill('0') << setw(8) << uppercase << hex << getSciMsgHeader()->netclock_high \
+ << setfill('0') << setw(8) << uppercase << hex << getSciMsgHeader()->netclock_low << endl;
+ displaySciMsgFlag();
+ clog << logger(LOG_INFO) << "\treserved = 0x" << setfill('0') << setw(4) << uppercase << hex << getSciMsgHeader()->reserved << dec << endl;
+}
+
+
+void SciMsg::displaySciMsgData ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "SCI msg data = ";
+ if (NULL != getSciMsgData())
+ {
+ for (unsigned long i=0; i<getSciMsgDataLength(); i++)
+ {
+ if ( '\0' == *(getSciMsgData()+i) )
+ {
+ oss << "\\0";
+ }
+ else
+ {
+ oss << *(getSciMsgData()+i);
+ }
+ }
+ }
+ else
+ {
+ oss << "NULL!";
+ }
+ oss << endl;
+ oss.flush();
+ clog << logger(LOG_INFO) << oss.str();
+}
+
+
+void SciMsg::displaySpecializedSciMsgData ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "specialized SCI msg data = ";
+ if (NULL != getSpecializedSciMsgData())
+ {
+ for (unsigned long i=0; i<getSpecializedSciMsgDataLength(); i++)
+ {
+ if ( '\0' == *(getSpecializedSciMsgData()+i) )
+ {
+ oss << "\\0";
+ }
+ else
+ {
+ oss << *(getSpecializedSciMsgData()+i);
+ }
+ }
+ }
+ else
+ {
+ oss << "NULL!";
+ }
+ oss << endl;
+ oss.flush();
+ clog << logger(LOG_INFO) << oss.str();
+}
+
+
+uint32_t SciMsg::getDefinedSciMsgMagicId ( ) const
+{
+ logFunction();
+
+ // Convert char * to uint32_t
+ //
+ char * pMagicId = SCI_MSG_MAGIC;
+ uint32_t magicId = (static_cast<uint8_t>(*(pMagicId))<<24) + (static_cast<uint8_t>(*(pMagicId+1))<<16) + (static_cast<uint8_t>(*(pMagicId+2))<<8) + static_cast<uint8_t>(*(pMagicId+3));
+
+ return magicId;
+}
+
+
+uint8_t SciMsg::getDefinedSciMsgVersion ( ) const
+{
+ return SCI_MSG_VERSION;
+}
+
+
+void SciMsg::displaySciMsgType ( ) const
+{
+ logFunction();
+
+ switch (getSciMsgHeader()->type)
+ {
+ case 0:
+ clog << logger(LOG_INFO) << "\ttype = SCI_MSG_TYPE_NONE" << endl;
+ break;
+ case 1:
+ clog << logger(LOG_INFO) << "\ttype = SCI_MSG_TYPE_NETWORK_CLOCK" << endl;
+ break;
+ case 2:
+ clog << logger(LOG_INFO) << "\ttype = SCI_MSG_TYPE_FUNCTION_CALL" << endl;
+ break;
+ case 3:
+ clog << logger(LOG_INFO) << "\ttype = SCI_MSG_TYPE_PHY" << endl;
+ break;
+ case 4:
+ clog << logger(LOG_INFO) << "\ttype = SCI_MSG_TYPE_SYSTEM" << endl;
+ break;
+ case 5:
+ clog << logger(LOG_INFO) << "\ttype = SCI_MSG_TYPE_ETHERNET" << endl;
+ break;
+ default:
+ clog << logger(LOG_INFO) << "\ttype = unknown!" << endl;
+ break;
+ }
+}
+
+
+// private methods
+//
+
+
+void SciMsg::displaySciMsgFlag ( ) const
+{
+ logFunction();
+
+ switch (getSciMsgHeader()->flags)
+ {
+ case 0:
+ clog << logger(LOG_INFO) << "\tflags = SCI_MSG_FLAG_NONE" << endl;
+ break;
+ case 1:
+ clog << logger(LOG_INFO) << "\tflags = SCI_MSG_FLAG_RESP" << endl;
+ break;
+ case 2:
+ clog << logger(LOG_INFO) << "\tflags = SCI_MSG_FLAG_ACK" << endl;
+ break;
+ case 3:
+ clog << logger(LOG_INFO) << "\tflags = SCI_MSG_FLAG_NEEDACK" << endl;
+ break;
+ case 4:
+ clog << logger(LOG_INFO) << "\tflags = SCI_MSG_FLAG_SYNC" << endl;
+ break;
+ default:
+ clog << logger(LOG_INFO) << "\tflags = unknown!" << endl;
+ break;
+ }
+}
+
+
+// protected methods
+//
+
+
+// Remove required data length from data, and update data length
+//
+bool SciMsg::removeData ( const unsigned long data_length_to_remove, unsigned long & data_length, unsigned char ** pp_data )
+{
+ logFunction();
+ bool bRemoveData = false;
+
+ if ( (data_length >= data_length_to_remove) // check that there are enough data to remove the required data length
+ && (NULL != *pp_data) )
+ {
+ // Create temporary variable and copy data
+ //
+ unsigned char * remainingData = new unsigned char [data_length-data_length_to_remove];
+ for (unsigned long i=data_length_to_remove; i<data_length; i++)
+ {
+ *(remainingData+i-data_length_to_remove) = *((*pp_data)+i);
+ }
+
+ // Update data length
+ //
+ data_length -= data_length_to_remove;
+
+ // Fill data
+ //
+ for (unsigned long i=0; i<data_length; i++)
+ {
+ *((*pp_data)+i) = *(remainingData+i);
+ }
+
+ // Free temporary allocated memory
+ //
+ delete [] remainingData;
+ remainingData = NULL;
+
+ bRemoveData = true;
+ }
+ else
+ {
+ errno = ENODATA;
+ throw Error(__PRETTY_FUNCTION__, "Not enough data", errno);
+ }
+
+ return bRemoveData;
+}
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+Sci_Msg_Status SciMsg::getSciMsgStatus ( ) const
+{
+ return mSciMsgStatus;
+}
+
+
+bool SciMsg::setSciMsgStatus ( const Sci_Msg_Status status )
+{
+ mSciMsgStatus = status;
+
+ return true;
+}
+
+
+Sci_Msg_Type SciMsg::getSciMsgType ( ) const
+{
+ return mSciMsgType;
+}
+
+
+bool SciMsg::setSciMsgType ( const Sci_Msg_Type type )
+{
+ mSciMsgType = type;
+
+ return true;
+}
+
+
+Sci_Msg_Station_Id SciMsg::getSciMsgStationId ( ) const
+{
+ return mSciMsgStationId;
+}
+
+
+bool SciMsg::setSciMsgStationId ( const Sci_Msg_Station_Id station_id )
+{
+ mSciMsgStationId = station_id;
+
+ return true;
+}
+
+
+Sci_Msg_Id SciMsg::getSciMsgId ( ) const
+{
+ return mSciMsgId;
+}
+
+
+bool SciMsg::incrementSciMsgId ( )
+{
+ logFunction();
+
+ if ( SCI_MSG_ID_STATION > (mSciMsgId+1) )
+ {
+ mSciMsgId++;
+ }
+ else
+ {
+ mSciMsgId = 0x0001;
+ }
+
+ return true;
+}
+
+
+Sci_Msg_Flag SciMsg::getSciMsgFlag ( ) const
+{
+ return mSciMsgFlag;
+}
+
+
+bool SciMsg::setSciMsgFlag ( const Sci_Msg_Flag flag )
+{
+ mSciMsgFlag = flag;
+
+ return true;
+}
+
+
+Sci_Msg_Header * SciMsg::getSciMsgHeader ( ) const
+{
+ return (Sci_Msg_Header *)&mSciMsgHeader;
+}
+
+
+bool SciMsg::setSciMsgHeader ( const Sci_Msg_Header & sci_msg_header )
+{
+ logFunction();
+ bool bSetHeader = false;
+
+ mSciMsgHeader = sci_msg_header;
+
+ // Set SCI msg attributes from SCI msg header
+ //
+ setSciMsgType (static_cast<Sci_Msg_Type>(getSciMsgHeader()->type));
+ setSciMsgStationId (static_cast<Sci_Msg_Station_Id>(getSciMsgHeader()->station_id));
+ setSciMsgFlag (static_cast<Sci_Msg_Flag>(getSciMsgHeader()->flags));
+
+ displaySciMsgHeader();
+ bSetHeader = true;
+
+ return bSetHeader;
+}
+
+
+unsigned long SciMsg::getSciMsgDataLength ( ) const
+{
+ return mSciMsgDataLength;
+}
+
+
+bool SciMsg::setSciMsgDataLength ( const unsigned long data_length )
+{
+ logFunction();
+
+ if ( SCI_MSG_MAX_SIZE >= data_length )
+ {
+ mSciMsgDataLength = data_length;
+ }
+ else
+ {
+ errno = EMSGSIZE;
+ throw Error(__PRETTY_FUNCTION__, "Data length exceeds max size", errno);
+ }
+
+ return true;
+}
+
+
+unsigned char * SciMsg::getSciMsgData ( ) const
+{
+ return mpSciMsgData;
+}
+
+
+bool SciMsg::setSciMsgData ( const unsigned char * p_data )
+{
+ logFunction();
+ bool bSetData = false;
+
+ if (NULL != mpSciMsgData)
+ {
+ delete [] mpSciMsgData;
+ mpSciMsgData = NULL;
+ }
+
+ if (NULL != p_data)
+ {
+ mpSciMsgData = new unsigned char [getSciMsgDataLength()];
+ if (NULL != mpSciMsgData)
+ {
+ for (unsigned int i=0; i<getSciMsgDataLength(); i++)
+ {
+ *(mpSciMsgData+i) = *(p_data+i);
+ }
+
+ displaySciMsgData();
+ bSetData = true;
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI message data pointer is NULL");
+ }
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Received data pointer is NULL", errno);
+ }
+
+ return bSetData;
+}
+
+
+// protected attribute accessor methods
+//
+
+
+unsigned long SciMsg::getSpecializedSciMsgHeaderSize ( ) const
+{
+ return mSpecializedSciMsgHeaderSize;
+}
+
+
+bool SciMsg::setSpecializedSciMsgHeaderSize ( const unsigned long header_size )
+{
+ mSpecializedSciMsgHeaderSize = header_size;
+
+ return true;
+}
+
+
+unsigned long SciMsg::getSpecializedSciMsgDataLength ( ) const
+{
+ return mSpecializedSciMsgDataLength;
+}
+
+
+bool SciMsg::setSpecializedSciMsgDataLength ( const unsigned long data_length )
+{
+ mSpecializedSciMsgDataLength = data_length;
+
+ return true;
+}
+
+
+unsigned char * SciMsg::getSpecializedSciMsgData ( ) const
+{
+ return mpSpecializedSciMsgData;
+}
+
+
+bool SciMsg::setSpecializedSciMsgData ( const unsigned char * p_data )
+{
+ logFunction();
+
+ if (NULL != mpSpecializedSciMsgData)
+ {
+ delete [] mpSpecializedSciMsgData;
+ mpSpecializedSciMsgData = NULL;
+ }
+
+ if (NULL != p_data)
+ {
+ mpSpecializedSciMsgData = new unsigned char [getSpecializedSciMsgDataLength()];
+ if (NULL != mpSpecializedSciMsgData)
+ {
+ for (unsigned long i=0; i<getSpecializedSciMsgDataLength(); i++)
+ {
+ *(mpSpecializedSciMsgData+i) = *(p_data+i);
+ }
+ }
+ }
+
+ return true;
+}
+
diff --git a/cesar/maximus/sci/src/SciMsgTest.cpp b/cesar/maximus/sci/src/SciMsgTest.cpp
new file mode 100644
index 0000000000..a45f3b5f28
--- /dev/null
+++ b/cesar/maximus/sci/src/SciMsgTest.cpp
@@ -0,0 +1,129 @@
+
+#include "SciMsgTest.h"
+
+#include "SciMsg.h"
+#include "FunctionSciMsg.h"
+#include "SystemSciMsg.h"
+#include "PhySciMsg.h"
+#include "ClockSciMsg.h"
+#include "EtherSciMsg.h"
+#include "FunctionCallManager.h"
+#include "SciServer.h"
+#include "SystemManager.h"
+#include "PhyProcessor.h"
+#include "EthernetProcessor.h"
+#include "NetworkClockProcessor.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (SciMsgTest);
+
+
+void SciMsgTest::setUp (void)
+{
+ logTest();
+
+ try
+ {
+ mpSciServer = new SciServer();
+ mpFunctionCallManager = new FunctionCallManager(mpSciServer);
+ mpPhyProcessor = new PhyProcessor(mpSciServer);
+ mpSystemManager = new SystemManager(mpSciServer);
+ mpEthernet = new EthernetProcessor(mpSciServer);
+ mpNetworkClock = new NetworkClockProcessor(mpSciServer, mpSystemManager, mpFunctionCallManager, mpPhyProcessor, mpEthernet);
+ mpFunctionSciMsg = new FunctionSciMsg (mpFunctionCallManager);
+ mpPhySciMsg = new PhySciMsg (mpPhyProcessor);
+ mpSystemSciMsg = new SystemSciMsg(mpSystemManager);
+ mpEtherSciMsg = new EtherSciMsg(mpEthernet);
+ mpClockSciMsg = new ClockSciMsg (mpNetworkClock);
+ }
+ catch ( Error &e )
+ {
+ e.display();
+
+ CPPUNIT_FAIL ( "setUp failed" );
+ }
+}
+
+
+void SciMsgTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpFunctionSciMsg)
+ {
+ delete mpFunctionSciMsg;
+ mpFunctionSciMsg = NULL;
+ }
+ if (NULL != mpClockSciMsg)
+ {
+ delete mpClockSciMsg;
+ mpClockSciMsg = NULL;
+ }
+ if (NULL != mpPhySciMsg)
+ {
+ delete mpPhySciMsg;
+ mpPhySciMsg = NULL;
+ }
+ if (NULL != mpSystemSciMsg)
+ {
+ delete mpSystemSciMsg;
+ mpSystemSciMsg = NULL;
+ }
+ if (NULL != mpEtherSciMsg)
+ {
+ delete mpEtherSciMsg;
+ mpEtherSciMsg = NULL;
+ }
+
+ if (NULL != mpSciServer)
+ {
+ delete mpSciServer;
+ mpSciServer = NULL;
+ }
+ if (NULL != mpFunctionCallManager)
+ {
+ delete mpFunctionCallManager;
+ mpFunctionCallManager = NULL;
+ }
+ if (NULL != mpPhyProcessor)
+ {
+ delete mpPhyProcessor;
+ mpPhyProcessor = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ delete mpSystemManager;
+ mpSystemManager = NULL;
+ }
+ if (NULL != mpEthernet)
+ {
+ delete mpEthernet;
+ mpEthernet = NULL;
+ }
+ if (NULL != mpNetworkClock)
+ {
+ delete mpNetworkClock;
+ mpNetworkClock = NULL;
+ }
+}
+
+
+void SciMsgTest::simpleTest (void)
+{
+ logTest();
+
+ if ( (NULL == mpClockSciMsg)
+ || (NULL == mpFunctionSciMsg)
+ || (NULL == mpPhySciMsg)
+ || (NULL == mpSystemSciMsg)
+ || (NULL == mpEtherSciMsg) )
+ {
+ CPPUNIT_FAIL ( "At least one of the initialized SciMsg pointers is NULL" );
+ }
+}
+
diff --git a/cesar/maximus/sci/src/SciServer.cpp b/cesar/maximus/sci/src/SciServer.cpp
new file mode 100644
index 0000000000..daea096581
--- /dev/null
+++ b/cesar/maximus/sci/src/SciServer.cpp
@@ -0,0 +1,1005 @@
+/************************************************************************
+ SciServer.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/sci/src/SciServer.cpp
+**************************************************************************/
+
+#include "SciServer.h"
+
+#include "Station.h"
+#include "SciMsg.h"
+#include "ClockSciMsg.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <sstream> // for 'ostringstream'
+#include <fstream> // for 'ofstream'
+#include <stdlib.h>
+#include <errno.h>
+#include <sys/select.h>
+#include <iomanip>
+#include <netinet/in.h> // for 'ntohl()' and 'ntohs()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+SciServer::SciServer ( ) :
+mpSpecializedSciMsgArray(NULL),
+mArraySize(0),
+mpListOfStations(NULL),
+mNetworkClockTick(0)
+{
+ logFunction();
+
+ initAttributes();
+}
+
+
+void SciServer::initAttributes ( )
+{
+ logFunction();
+
+ // Init array
+ //
+ mArraySize = 10;
+ mpSpecializedSciMsgArray = new SciMsg * [mArraySize];
+ if (NULL != mpSpecializedSciMsgArray)
+ {
+ for (unsigned int i=0; i<mArraySize; i++)
+ {
+ *(mpSpecializedSciMsgArray+i) = NULL;
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Specialized SCI message array pointer is NULL");
+ }
+}
+
+
+SciServer::~SciServer ( )
+{
+ logFunction();
+
+ // Do not free stations list
+ // Station list is deleted when SystemManager is deleted
+ // Only set pointer to NULL
+ //
+ if (NULL != mpListOfStations)
+ {
+ mpListOfStations = NULL;
+ }
+
+ // Free array
+ //
+ if (NULL != mpSpecializedSciMsgArray)
+ {
+ for (unsigned int i=0; i<mArraySize; i++)
+ {
+ if (NULL != (*(mpSpecializedSciMsgArray+i)))
+ {
+ delete(*(mpSpecializedSciMsgArray+i));
+ (*(mpSpecializedSciMsgArray+i)) = NULL;
+ }
+ }
+ delete [] mpSpecializedSciMsgArray;
+ mpSpecializedSciMsgArray = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool SciServer::init ( const std::string station_log )
+{
+ logFunction();
+
+ mStationLog = station_log;
+
+ return true;
+}
+
+
+bool SciServer::process ( )
+{
+ logFunction();
+ bool bProcess = false;
+
+ int fd_max, fd_index;
+ fd_set read_fds;
+ struct timeval timeout;
+ int result;
+ Station *station;
+ StationsList::iterator it;
+
+ // timeout set to 1s
+ timeout.tv_sec = 1;
+ timeout.tv_usec = 0;
+
+ // Read input pipes
+ //
+ FD_ZERO(&read_fds);
+ fd_max = 0;
+ for(it = getStationsList()->begin() ; it != getStationsList()->end(); it++)
+ {
+ station = *it;
+
+ FD_SET(station->getInputFileDescriptor(), &read_fds);
+ if(station->getInputFileDescriptor() > fd_max)
+ fd_max = station->getInputFileDescriptor();
+ }
+
+ result = select(fd_max + 1, &read_fds, NULL, NULL, &timeout);
+
+ if(result > 0)
+ {
+ // skim through the list...
+ for(fd_index = 0; fd_index <= fd_max; fd_index++)
+ {
+ if(FD_ISSET(fd_index, &read_fds))
+ {
+ int len, header_len;
+ struct Sci_Msg_Header header;
+ unsigned char *buffer;
+ header_len = sizeof(struct Sci_Msg_Header);
+ if((len = read(fd_index, &header, sizeof(struct Sci_Msg_Header))) < header_len)
+ {
+ clog << logger(LOG_ERROR) << "header read error: len = " << dec << len << ", errno = " << errno << endl;
+ throw Error(__PRETTY_FUNCTION__, "Header read error: len < header_len", errno);
+ }
+ else
+ {
+ // check for header
+ if(memcmp(&header.magic_id, SCI_MSG_MAGIC, 4))
+ {
+ clog << logger(LOG_ERROR) << "bad magic id: 0x" << hex << htonl(header.magic_id) << endl;
+ continue;
+ }
+ header.length = ntohs (header.length);
+ if((header.type <= SCI_MSG_TYPE_NONE)
+ || (header.type >= SCI_MSG_TYPE_NB))
+ {
+ clog << logger(LOG_ERROR) << "bad type: " << dec << header.type << endl;
+ continue;
+ }
+ if(header.version != SCI_MSG_VERSION)
+ {
+ clog << logger(LOG_ERROR) << "bad version: " << dec << header.version << endl;
+ continue;
+ }
+ header.magic_id = ntohl(header.magic_id);
+ header.msg_id = ntohs (header.msg_id);
+ header.station_id = ntohs(header.station_id);
+ header.netclock_high = ntohl(header.netclock_high);
+ header.netclock_low = ntohl(header.netclock_low);
+ header.reserved = ntohs(header.reserved);
+ header.flags = ntohs(header.flags);
+
+ buffer = (unsigned char *)malloc(header.length);
+ if((len = read(fd_index, buffer, header.length)) != header.length)
+ {
+ clog << logger(LOG_ERROR) << "data read error: len = " << dec << len << ", errno = " << errno << endl;
+ free(buffer);
+ if (0 == len)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Data read error: len = 0", errno);
+ }
+ continue;
+ }
+ receiveMsg(&header, header.length, buffer);
+ free(buffer);
+ }
+ }
+ }
+ }
+ station = NULL;
+
+ // Read log pipes
+ //
+ log();
+
+ return bProcess;
+}
+
+
+bool SciServer::log ( ) const
+{
+ logFunction();
+ bool bLog;
+
+ ofstream stationLogFile;
+ if ( (!getStationLog().empty()) && (getStationLog().compare("-")) )
+ {
+ stationLogFile.open(getStationLog().c_str(), ios_base::app | ios_base::ate | ios_base::out);
+ }
+
+ // Skim through stations list
+ //
+ if ( (NULL != mpListOfStations) && (!mpListOfStations->empty()) )
+ {
+ int length;
+ int maxLength = 1024;
+ char * pBuffer = new char [maxLength];
+
+ for (StationsList::const_iterator it = mpListOfStations->begin(); it != mpListOfStations->end(); ++it)
+ {
+ if (NULL != *it)
+ {
+ // Read logs coming from all stations (from log pipes)
+ //
+ length = 0;
+ memset(pBuffer, '\0', maxLength);
+
+ length = read((*it)->getLogFileDescriptor(), pBuffer, maxLength);
+ if (-1 != length)
+ {
+ if (stationLogFile.is_open())
+ {
+ stationLogFile.write(pBuffer, length);
+ }
+ else
+ {
+ cout << dec << pBuffer;
+ }
+ bLog = true;
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "A station pointer is NULL");
+ }
+ }
+
+ delete [] pBuffer;
+ }
+
+ stationLogFile.close();
+
+ return bLog;
+}
+
+bool SciServer::fillSciMsg ( SciMsg & sci_msg_to_send ) const
+{
+ logFunction();
+ bool bFill = false;
+
+ // Fill SCI msg data length
+ //
+ bFill = sci_msg_to_send.setSciMsgDataLength(sci_msg_to_send.getSpecializedSciMsgHeaderSize() + sci_msg_to_send.getSpecializedSciMsgDataLength());
+
+ // Decompose current tick value into two uint32_t values
+ //
+ uint32_t netclockHigh=0, netclockLow=0;
+ netclockLow = (uint32_t)(getNetworkClockTick());
+ netclockHigh = (uint32_t)(((uint64_t)(getNetworkClockTick()) >> 32));
+
+ // Fill SCI msg header
+ //
+ bFill &= sci_msg_to_send.incrementSciMsgId(); // to have an updated msg id
+ struct Sci_Msg_Header sciMsgHeader = { sci_msg_to_send.getDefinedSciMsgMagicId(),
+ sci_msg_to_send.getDefinedSciMsgVersion(),
+ static_cast<uint8_t>(sci_msg_to_send.getSciMsgType()),
+ static_cast<uint16_t>(sci_msg_to_send.getSciMsgDataLength()),
+ sci_msg_to_send.getSciMsgStationId(),
+ sci_msg_to_send.getSciMsgId(),
+ netclockHigh,
+ netclockLow,
+ 0, // flags
+ 0 }; // reserved
+ bFill &= sci_msg_to_send.setSciMsgHeader(sciMsgHeader);
+
+ // As SCI msg header will be sent on an output pipe, 'hton' functions have to be called
+ //
+ sci_msg_to_send.getSciMsgHeader()->magic_id = htonl(sci_msg_to_send.getSciMsgHeader()->magic_id);
+ sci_msg_to_send.getSciMsgHeader()->length = htons(sci_msg_to_send.getSciMsgHeader()->length);
+ sci_msg_to_send.getSciMsgHeader()->station_id = htons(sci_msg_to_send.getSciMsgHeader()->station_id);
+ sci_msg_to_send.getSciMsgHeader()->msg_id = htons(sci_msg_to_send.getSciMsgHeader()->msg_id);
+ sci_msg_to_send.getSciMsgHeader()->netclock_high = htonl(sci_msg_to_send.getSciMsgHeader()->netclock_high);
+ sci_msg_to_send.getSciMsgHeader()->netclock_low = htonl(sci_msg_to_send.getSciMsgHeader()->netclock_low);
+
+ // Fill SCI msg data length
+ // When sending a SCI msg, SCI msg data contain:
+ // - SCI msg header,
+ // - specialized SCI msg header,
+ // - and specialized SCI msg data
+ //
+ bFill = sci_msg_to_send.setSciMsgDataLength(static_cast<unsigned long>(sizeof(struct Sci_Msg_Header)) + sci_msg_to_send.getSpecializedSciMsgHeaderSize() + sci_msg_to_send.getSpecializedSciMsgDataLength());
+
+ // Fill SCI msg data
+ // When sending a SCI msg, since only SCI msg data will be sent on an output pipe,
+ // SCI msg header and specialized SCI msg header have to be copied into SCI msg data
+ // Then, specialized SCI msg data have to be copied into SCI msg data
+ //
+ unsigned char * pTempData = new unsigned char [sci_msg_to_send.getSciMsgDataLength()];
+ if (NULL != pTempData)
+ {
+ memcpy(pTempData, (unsigned char *)sci_msg_to_send.getSciMsgHeader(), sizeof(struct Sci_Msg_Header));
+ memcpy(pTempData+sizeof(Sci_Msg_Header), (unsigned char *)sci_msg_to_send.returnSpecializedSciMsgHeader(), sci_msg_to_send.getSpecializedSciMsgHeaderSize());
+ memcpy(pTempData+sizeof(Sci_Msg_Header)+sci_msg_to_send.getSpecializedSciMsgHeaderSize(), sci_msg_to_send.getSpecializedSciMsgData(), sci_msg_to_send.getSpecializedSciMsgDataLength());
+ }
+ bFill &= sci_msg_to_send.setSciMsgData(pTempData);
+
+ // Free temporary allocated memory
+ //
+ if (NULL != pTempData)
+ {
+ delete [] pTempData;
+ pTempData = NULL;
+ }
+
+ return bFill;
+}
+
+
+bool SciServer::sendSciMsg ( const SciMsg & sci_msg_to_send ) const
+{
+ logFunction();
+ bool bSend = false;
+
+ // Retrieve destination station
+ //
+ if (NULL != mpListOfStations)
+ {
+ // Skim through stations list
+ //
+ for (StationsList::const_iterator it = mpListOfStations->begin(); it != mpListOfStations->end(); ++it)
+ {
+ // Before sending a SCI msg, check that station status is 'IDLE'
+ //
+ if ( (NULL != *it)
+ && ((*it)->getStationId() == sci_msg_to_send.getSciMsgStationId())
+ && (MAXIMUS_STATION_STATUS_IDLE == (*it)->getStationStatus()) )
+ {
+ bSend = true;
+
+ // Write data into output pipe
+ //
+ int length = 0;
+ int totalLength = 0;
+ while(totalLength < (int)sci_msg_to_send.getSciMsgDataLength())
+ {
+ length = write((*it)->getOutputFileDescriptor(), sci_msg_to_send.getSciMsgData() + totalLength, sci_msg_to_send.getSciMsgDataLength()-totalLength);
+ if(length < 0)
+ {
+ if (EAGAIN != errno)
+ {
+ throw Error(__PRETTY_FUNCTION__, "write data failed", errno);
+ }
+ else
+ {
+ length = 0;
+ }
+ }
+ totalLength += length;
+ }
+
+ // Station status is set to 'BUSY'
+ // Station status will stay 'BUSY' until all system 'IDLE' msgs will be received
+ //
+ (*it)->setStationStatus(MAXIMUS_STATION_STATUS_BUSY);
+ (*it)->incrementStationIdleCounter();
+
+ break;
+ }
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Stations list pointer is NULL");
+ }
+
+ if (bSend)
+ {
+ clog << logger(LOG_COM) << "<--- send " << displaySciMsgType(sci_msg_to_send.getSciMsgHeader()->type) \
+ << " SCI message to station " << dec << sci_msg_to_send.getSciMsgStationId() \
+ << " (0x" << setfill('0') << setw(4) << uppercase << hex << sci_msg_to_send.getSciMsgStationId() << ")" << dec << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_COM);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "--- did not send " << displaySciMsgType(sci_msg_to_send.getSciMsgHeader()->type) \
+ << " SCI message to station " << dec << sci_msg_to_send.getSciMsgStationId() \
+ << " (0x" << setfill('0') << setw(4) << uppercase << hex << sci_msg_to_send.getSciMsgStationId() << ")" << dec << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_ERROR);
+ }
+
+ return bSend;
+}
+
+
+bool SciServer::sendSciMsgToAllActiveStations ( SciMsg & sci_msg_to_send ) const
+{
+ logFunction();
+ bool bSend = false;
+
+ if (NULL != mpListOfStations)
+ {
+ const Sci_Msg_Station_Id txStationId = sci_msg_to_send.getSciMsgStationId(); // get id of the transmitting station
+ int length;
+ int totalLength;
+ bool bWrite;
+
+ // Skim through stations list
+ //
+ for (StationsList::const_iterator it = mpListOfStations->begin(); it != mpListOfStations->end(); ++it)
+ {
+ // Send message to all active stations except the sender
+ //
+ if ( (NULL != *it)
+ && (MAXIMUS_STATION_STATUS_DEACTIVATED != (*it)->getStationStatus())
+ && fillSciMsg(sci_msg_to_send) )
+ {
+ bSend = true;
+ }
+
+ if (txStationId != (*it)->getStationId())
+ {
+ // Write data into output pipe
+ //
+ length = 0;
+ totalLength = 0;
+ bWrite = true;
+ while(totalLength < (int)sci_msg_to_send.getSciMsgDataLength())
+ {
+ length = write((*it)->getOutputFileDescriptor(), sci_msg_to_send.getSciMsgData() + totalLength, sci_msg_to_send.getSciMsgDataLength()-totalLength);
+ if(length < 0)
+ {
+ if (EAGAIN != errno)
+ {
+ throw Error(__PRETTY_FUNCTION__, "write data failed", errno);
+ }
+ else
+ {
+ length = 0;
+ }
+ }
+ totalLength += length;
+ }
+
+ if (bWrite)
+ {
+ // Station status is set to 'BUSY'
+ // Station status will stay 'BUSY' until all system 'IDLE' msgs will be received
+ //
+ (*it)->setStationStatus(MAXIMUS_STATION_STATUS_BUSY);
+ (*it)->incrementStationIdleCounter();
+ }
+
+ clog << logger(LOG_INFO) << "--- send " << displaySciMsgType(sci_msg_to_send.getSciMsgHeader()->type) \
+ << " SCI message to station " << dec << (*it)->getStationId() \
+ << " (0x" << setfill('0') << setw(4) << uppercase << hex << (*it)->getStationId() << ")" << dec << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_INFO);
+ }
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Stations list pointer is NULL");
+ }
+
+ if (bSend)
+ {
+ clog << logger(LOG_COM) << "<--- send " << displaySciMsgType(sci_msg_to_send.getSciMsgHeader()->type) \
+ << " SCI message to all stations" << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_COM);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "--- did not send " << displaySciMsgType(sci_msg_to_send.getSciMsgHeader()->type) \
+ << " SCI message to all stations!" << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_ERROR);
+ }
+
+ return bSend;
+}
+
+
+bool SciServer::sendSciMsgToDestStations ( SciMsg & sci_msg_to_send, DestStationsList & list_of_dest_stations ) const
+{
+ logFunction();
+ bool bSend = list_of_dest_stations.empty();
+
+ if (bSend)
+ {
+ clog << logger(LOG_COM) << "--- did not send " << displaySciMsgType(sci_msg_to_send.getSciMsgType()) \
+ << " SCI message because no station requested it" << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_COM);
+ }
+ else
+ {
+ if (NULL != mpListOfStations)
+ {
+ Sci_Msg_Station_Id txStationId;
+ while (!list_of_dest_stations.empty())
+ {
+ txStationId = list_of_dest_stations.back();
+ int length;
+ int totalLength;
+ bool bWrite;
+
+ // Skim through stations list
+ //
+ for (StationsList::const_iterator it = mpListOfStations->begin(); it != mpListOfStations->end(); ++it)
+ {
+ // Send message to destination stations
+ //
+ if ( (NULL != *it)
+ && (txStationId == (*it)->getStationId())
+ && (MAXIMUS_STATION_STATUS_DEACTIVATED != (*it)->getStationStatus())
+ && fillSciMsg(sci_msg_to_send) )
+ {
+ bSend = true;
+
+ // Write data into output pipe
+ //
+ length = 0;
+ totalLength = 0;
+ bWrite = true;
+ while(totalLength < (int)sci_msg_to_send.getSciMsgDataLength())
+ {
+ length = write((*it)->getOutputFileDescriptor(), sci_msg_to_send.getSciMsgData() + totalLength, sci_msg_to_send.getSciMsgDataLength()-totalLength);
+ if(length < 0)
+ {
+ if (EAGAIN != errno)
+ {
+ throw Error(__PRETTY_FUNCTION__, "write data failed", errno);
+ }
+ else
+ {
+ length = 0;
+ }
+ }
+ totalLength += length;
+ }
+
+ if (bWrite)
+ {
+ // Station status is set to 'BUSY'
+ // Station status will stay 'BUSY' until all system 'IDLE' msgs will be received
+ //
+ (*it)->setStationStatus(MAXIMUS_STATION_STATUS_BUSY);
+ (*it)->incrementStationIdleCounter();
+ }
+
+ clog << logger(LOG_INFO) << "--- send " << displaySciMsgType(sci_msg_to_send.getSciMsgHeader()->type) \
+ << " SCI message to station " << dec << (*it)->getStationId() \
+ << " (0x" << setfill('0') << setw(4) << uppercase << hex << (*it)->getStationId() << ")" << dec << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_INFO);
+ }
+ }
+ list_of_dest_stations.pop_back();
+ }
+ if (bSend)
+ {
+ clog << logger(LOG_COM) << "<--- send " << displaySciMsgType(sci_msg_to_send.getSciMsgHeader()->type) \
+ << " SCI message to destination stations" << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_COM);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "--- did not send " << displaySciMsgType(sci_msg_to_send.getSciMsgHeader()->type) \
+ << " SCI message to destination stations!" << endl;
+ sci_msg_to_send.displaySpecializedSciMsgType(LOG_ERROR);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Stations list pointer is NULL");
+ }
+ }
+
+ return bSend;
+}
+
+
+bool SciServer::registerSpecializedSciMsg ( const Sci_Msg_Type sci_msg_type, SciMsg * sci_msg )
+{
+ logFunction();
+ bool bRegister = false;
+
+ if (NULL != sci_msg)
+ {
+ if (getArraySize() > (unsigned int)sci_msg_type)
+ {
+ if (NULL != getSpecializedSciMsgArray())
+ {
+ if (NULL != *(mpSpecializedSciMsgArray + (unsigned int)sci_msg_type))
+ {
+ delete(*(mpSpecializedSciMsgArray + (unsigned int)sci_msg_type));
+ *(mpSpecializedSciMsgArray + (unsigned int)sci_msg_type) = NULL;
+ }
+ *(mpSpecializedSciMsgArray + (unsigned int)sci_msg_type) = sci_msg; // set mpSpecializedSciMsgArray
+ bRegister = true;
+ }
+ }
+ else
+ {
+ errno = ENOMSG;
+ throw Error(__PRETTY_FUNCTION__, "SCI message type exceeds specialized SCI message array size", errno);
+ }
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI message pointer is NULL", errno);
+ }
+
+ return bRegister;
+}
+
+
+bool SciServer::receiveMsg ( const Sci_Msg_Header * header,
+ const unsigned long data_length,
+ const unsigned char * received_data ) const
+{
+ logFunction();
+ bool bReceiveMsg = false;
+
+ if (NULL != header)
+ {
+ clog << logger(LOG_COM) << "---> receive " << displaySciMsgType(header->type) << " SCI message from station " << dec << header->station_id << " (" << setfill('0') << setw(4) << uppercase << hex << header->station_id << ")" << dec << endl;
+
+ // Create a specialized SCI message according to the message header type
+ //
+ SciMsg * sciMsg = NULL;
+ Sci_Msg_Type type = static_cast<Sci_Msg_Type>(header->type);
+ bReceiveMsg = createSciMsg (type, &sciMsg);
+
+ // Process the created specialized SCI message
+ //
+ if ( (NULL != sciMsg) && (0 != bReceiveMsg) )
+ {
+ if (NULL != received_data)
+ {
+ // Fill SCI msg
+ //
+ bReceiveMsg = fillSciMsg (header, data_length, received_data, &sciMsg);
+ sciMsg->displaySpecializedSciMsgData();
+ sciMsg->displaySpecializedSciMsgType(LOG_COM);
+
+ // Check msg compatibility (check msg versions)
+ // Check msg validity
+ //
+ if (0 != bReceiveMsg)
+ {
+ bReceiveMsg = sciMsg->checkCompatibility();
+ bReceiveMsg &= sciMsg->checkValidity();
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI message not correctly filled in");
+ }
+
+ // Process SCI msg
+ //
+ if (0 != bReceiveMsg)
+ {
+ bReceiveMsg = processSciMsg (sciMsg);
+ }
+ else
+ {
+ errno = EPROTO;
+ throw Error(__PRETTY_FUNCTION__, "SCI message not valid", errno);
+ }
+
+ // Free allocated memory
+ //
+ if (NULL != sciMsg)
+ {
+ clog << logger(LOG_INFO) << "delete SCI message" << endl;
+ delete (sciMsg);
+ sciMsg = NULL;
+ }
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Data pointer is NULL", errno);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Error when creating SCI message");
+ }
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI message header pointer is NULL", errno);
+ }
+
+ return bReceiveMsg;
+}
+
+
+void SciServer::displaySpecializedSciMsgArray ( ) const
+{
+ logFunction();
+
+ ostringstream oss;
+ oss << "specialized SCI msg array = " << endl;
+ for (unsigned int i=0; i<getArraySize(); i++)
+ {
+ if (NULL != *(getSpecializedSciMsgArray()+i))
+ {
+ oss << "\t" << hex << setfill('0') << setw(8) << uppercase << *(getSpecializedSciMsgArray()+i) << endl;
+ }
+ else
+ {
+ oss << "\tNULL" << endl;
+ }
+ }
+ oss.flush();
+ clog << logger(LOG_INFO) << oss.str() << dec;
+}
+
+
+// private methods
+//
+
+
+bool SciServer::createSciMsg ( const Sci_Msg_Type type, SciMsg ** received_sci_msg ) const
+{
+ logFunction();
+ bool bCreateMsg = false;
+
+ // Create a specialized SCI message according to the header type
+ //
+ if (NULL != received_sci_msg)
+ {
+ if ( (getArraySize() > (unsigned int)type) && (NULL != *(getSpecializedSciMsgArray() + (unsigned int)type)) )
+ {
+ *received_sci_msg = (*(getSpecializedSciMsgArray() + type))->create();
+ }
+ else
+ {
+ errno = ENOMSG;
+ throw Error(__PRETTY_FUNCTION__, "SCI message type is invalid: no corresponding SCI message", errno);
+ }
+
+ // Check if the just created SCI msg is valid
+ //
+ if (NULL != *received_sci_msg)
+ {
+ bCreateMsg = true;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI message pointer is invalid", errno);
+ }
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI message pointer is invalid", errno);
+ }
+
+ return bCreateMsg;
+}
+
+
+bool SciServer::fillSciMsg ( const Sci_Msg_Header * p_msg_header,
+ const unsigned long data_length,
+ const unsigned char * p_received_data,
+ SciMsg ** created_sci_msg ) const
+{
+ logFunction();
+ bool bFillMsg = false;
+
+ // Fill SCI message contents
+ //
+ if (NULL != created_sci_msg)
+ {
+ if (NULL != p_msg_header)
+ {
+ // Set SCI message header
+ // Set SCI message attributes
+ //
+ bFillMsg = (*created_sci_msg)->setSciMsgHeader(*p_msg_header);
+
+ bFillMsg &= (*created_sci_msg)->setSciMsgDataLength(data_length);
+ if (NULL != p_received_data)
+ {
+ bFillMsg &= (*created_sci_msg)->setSciMsgData(p_received_data);
+
+ // Set specialized SCI message header
+ // Set specialized attributes
+ //
+ bFillMsg &= (*created_sci_msg)->identifySpecializedSciMsgHeader();
+
+ // Remove specialized SCI message header from specialized SCI msg data
+ // Then, set specialized SCI message data length, and specialized SCI message data
+ //
+ bFillMsg &= (*created_sci_msg)->identifySpecializedSciMsgData();
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Data pointer is NULL", errno);
+ }
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI message header pointer is NULL", errno);
+ }
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI message pointer is NULL", errno);
+ }
+
+ return bFillMsg;
+}
+
+
+bool SciServer::processSciMsg ( SciMsg * received_sci_msg ) const
+{
+ logFunction();
+ bool bProcessMsg = false;
+
+ if (NULL != received_sci_msg)
+ {
+ bProcessMsg = received_sci_msg->dispatchMsg();
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI message pointer is NULL", errno);
+ }
+
+ return bProcessMsg;
+}
+
+
+string SciServer::displaySciMsgType ( uint8_t sci_msg_type ) const
+{
+ logFunction();
+ string type;
+
+ switch (sci_msg_type)
+ {
+ case 1:
+ type.assign("network clock");
+ break;
+ case 2:
+ type.assign("function call");
+ break;
+ case 3:
+ type.assign("PHY");
+ break;
+ case 4:
+ type.assign("system");
+ break;
+ case 5:
+ type.assign("ethernet");
+ break;
+ case 0:
+ default:
+ type.assign("unknown");
+ break;
+ }
+
+ return type;
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+StationsList * SciServer::getStationsList ( ) const
+{
+ return mpListOfStations;
+}
+
+
+bool SciServer::setStationsList ( StationsList * p_list_of_stations )
+{
+ logFunction();
+ bool bSetList = false;
+
+ if (NULL != p_list_of_stations)
+ {
+ mpListOfStations = p_list_of_stations;
+ bSetList = true;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "List of stations pointer is NULL", errno);
+ }
+
+ return bSetList;
+}
+
+
+SciMsg ** SciServer::getSpecializedSciMsgArray ( ) const
+{
+ return mpSpecializedSciMsgArray;
+}
+
+
+unsigned int SciServer::getArraySize ( ) const
+{
+ return mArraySize;
+}
+
+
+Network_Clock_Tick SciServer::getNetworkClockTick ( ) const
+{
+ return mNetworkClockTick;
+}
+
+
+bool SciServer::updateTickValue ( const Network_Clock_Tick current_tick_value )
+{
+ mNetworkClockTick = current_tick_value;
+
+ return true;
+}
+
+
+std::string SciServer::getStationLog ( ) const
+{
+ return mStationLog;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/sci/src/SciServerTest.cpp b/cesar/maximus/sci/src/SciServerTest.cpp
new file mode 100644
index 0000000000..d5a2e59dde
--- /dev/null
+++ b/cesar/maximus/sci/src/SciServerTest.cpp
@@ -0,0 +1,510 @@
+
+#include "SciServerTest.h"
+
+#include "SciServer.h"
+#include "FunctionCallManager.h"
+#include "SystemManager.h"
+#include "PhyProcessor.h"
+#include "NetworkClockProcessor.h"
+#include "ClockSciMsg.h"
+#include "SystemSciMsg.h"
+#include "PhySciMsg.h"
+#include "FunctionSciMsg.h"
+#include "EthernetProcessor.h"
+#include "EtherSciMsg.h"
+
+#include "networkclock_types.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <string>
+#include <iomanip>
+#include <netinet/in.h> // for 'htonl()' and 'htons()'
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (SciServerTest);
+
+
+void SciServerTest::setUp (void)
+{
+ logTest();
+
+ mpSciServer = new SciServer ();
+ mpFunctionCallManager = new FunctionCallManager(mpSciServer);
+ mpSystemManager = new SystemManager(mpSciServer);
+ mpPhyProcessor = new PhyProcessor(mpSciServer);
+ mpEthernet = new EthernetProcessor(mpSciServer);
+ mpNetworkClockProcessor = new NetworkClockProcessor(mpSciServer, mpSystemManager, mpFunctionCallManager, mpPhyProcessor, mpEthernet);
+}
+
+
+void SciServerTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpNetworkClockProcessor)
+ {
+ delete mpNetworkClockProcessor;
+ mpNetworkClockProcessor = NULL;
+ }
+ if (NULL != mpPhyProcessor)
+ {
+ delete mpPhyProcessor;
+ mpPhyProcessor = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ delete mpSystemManager;
+ mpSystemManager = NULL;
+ }
+ if (NULL != mpFunctionCallManager)
+ {
+ delete mpFunctionCallManager;
+ mpFunctionCallManager = NULL;
+ }
+ if (NULL != mpSciServer)
+ {
+ delete mpSciServer;
+ mpSciServer = NULL;
+ }
+ if (NULL != mpEthernet)
+ {
+ delete mpEthernet;
+ mpEthernet = NULL;
+ }
+}
+
+
+void SciServerTest::registerSpecializedSciMsgTest (void)
+{
+ logTest();
+
+ if (NULL != mpSciServer)
+ {
+ try
+ {
+ registerFunctionSciMsgTest ();
+ registerSystemSciMsgTest ();
+ registerPhySciMsgTest ();
+ registerClockSciMsgTest ();
+ registerEtherSciMsgTest ();
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ CPPUNIT_FAIL ("Catch exception");
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ("SciServer pointer is NULL");
+ }
+}
+
+
+void SciServerTest::receiveMsgTest (void)
+{
+ logTest();
+
+ if (NULL != mpSciServer)
+ {
+ // Before receiving a message, SCI messages have to be registered
+ //
+ try
+ {
+ registerFunctionSciMsgTest ();
+ registerSystemSciMsgTest ();
+ registerPhySciMsgTest ();
+ registerClockSciMsgTest ();
+ registerEtherSciMsgTest ();
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ CPPUNIT_FAIL ("Catch exception");
+ }
+
+ mpSciServer->displaySpecializedSciMsgArray();
+
+ // Create a station
+ //
+ Sci_Msg_Station_Id stationId = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+
+ // Convert char * to uint32_t
+ //
+ char * pMagicId = SCI_MSG_MAGIC;
+ uint32_t magicId = (static_cast<uint8_t>(*(pMagicId))<<24) + (static_cast<uint8_t>(*(pMagicId+1))<<16) + (static_cast<uint8_t>(*(pMagicId+2))<<8) + static_cast<uint8_t>(*(pMagicId+3));
+
+ Sci_Msg_Header msgHeader = { magicId, // uint32_t magic_id
+ SCI_MSG_VERSION, // uint8_t version = 0x01
+ SCI_MSG_TYPE_NONE, // uint8_t type = 0x00
+ 0x0000, // uint16_t length
+ stationId, // uint16_t station_id
+ SCI_MSG_ID_STATION, // uint16_t msg_id
+ 0x01234567, // uint32_t netclock_high
+ 0x89101112, // uint32_t netclock_low
+ 0xFFFF, //uint16_t flags
+ 0xFFFF }; // uint16_t reserved
+
+ mpSystemManager->updateStationStatus ( stationId, MAXIMUS_STATION_STATUS_IDLE );
+
+ try
+ {
+ receiveClockSciMsgTest (msgHeader);
+ receivePhySciMsgTest (msgHeader);
+ receiveSystemSciMsgTest (msgHeader);
+ receiveFunctionSciMsgTest (msgHeader);
+ receiveEtherSciMsgTest (msgHeader);
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ CPPUNIT_FAIL ("Catch exception");
+ }
+
+ // Remove station
+ //
+ mpSystemManager->removeStation(stationId);
+ }
+ else
+ {
+ CPPUNIT_FAIL ("SciServer pointer is NULL");
+ }
+}
+
+
+void SciServerTest::registerClockSciMsgTest (void)
+{
+ logTest();
+
+ // Test a network clock SCI message registration
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "registerSpecializedSciMsg failed",
+ mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_NETWORK_CLOCK, new ClockSciMsg(mpNetworkClockProcessor)) );
+
+ // Check results
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "KO",
+ (*((mpSciServer->getSpecializedSciMsgArray())+(unsigned int)SCI_MSG_TYPE_NETWORK_CLOCK)) != NULL );
+}
+
+
+void SciServerTest::registerFunctionSciMsgTest (void)
+{
+ logTest();
+
+ // Test a function call SCI message registration
+ //
+ if (NULL != mpFunctionCallManager)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "registerSpecializedSciMsg failed",
+ mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_FUNCTION_CALL, new FunctionSciMsg(mpFunctionCallManager)) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("FunctionCallManager pointer is NULL");
+ }
+
+ // Check results
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "KO",
+ (*((mpSciServer->getSpecializedSciMsgArray())+(unsigned int)SCI_MSG_TYPE_FUNCTION_CALL)) != NULL );
+}
+
+
+void SciServerTest::registerPhySciMsgTest (void)
+{
+ logTest();
+
+ // Test a PHY SCI message registration
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "registerSpecializedSciMsg failed",
+ mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_PHY, new PhySciMsg(mpPhyProcessor)) );
+
+ // Check results
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "KO",
+ (*((mpSciServer->getSpecializedSciMsgArray())+(unsigned int)SCI_MSG_TYPE_PHY)) != NULL );
+}
+
+
+void SciServerTest::registerSystemSciMsgTest (void)
+{
+ logTest();
+
+ // Test a system SCI message registration
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "registerSpecializedSciMsg failed",
+ mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_SYSTEM, new SystemSciMsg(mpSystemManager)) );
+
+ // Check results
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "KO",
+ (*((mpSciServer->getSpecializedSciMsgArray())+(unsigned int)SCI_MSG_TYPE_SYSTEM)) != NULL );
+}
+
+
+void SciServerTest::registerEtherSciMsgTest (void)
+{
+ logTest();
+
+ // Test an Ether SCI message registration
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "registerSpecializedSciMsg failed",
+ mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_ETHERNET, new EtherSciMsg(mpEthernet)) );
+
+ // Check results
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "KO",
+ (*((mpSciServer->getSpecializedSciMsgArray())+(unsigned int)SCI_MSG_TYPE_ETHERNET)) != NULL );
+}
+
+
+void SciServerTest::receiveClockSciMsgTest ( Sci_Msg_Header & msg_header )
+{
+ logTest();
+
+ // Message header type and length have to be set to the corresponding specialized SCI message
+ //
+ msg_header.type = SCI_MSG_TYPE_NETWORK_CLOCK; // uint8_t type = 0x01
+
+ unsigned long dataLength = (unsigned long)sizeof(Network_Clock_Header);
+ msg_header.length = (uint16_t)dataLength;
+
+ unsigned char * pData = new unsigned char [dataLength];
+ if (NULL != pData)
+ {
+ *pData = static_cast<unsigned char>(NETWORK_CLOCK_VERSION); // uint8_t version = 0x01
+ *(pData+1) = static_cast<unsigned char>(NETWORK_CLOCK_TYPE_STATION); // uint8_t type = 0x02
+ *(pData+2) = static_cast<unsigned char>(0x01); // uint16_t id
+ *(pData+3) = static_cast<unsigned char>(0x23);
+ *(pData+4) = static_cast<unsigned char>(0x45); // uint16_t flags
+ *(pData+5) = static_cast<unsigned char>(0x67);
+ *(pData+6) = static_cast<unsigned char>(0x89); // uint16_t reserved
+ *(pData+7) = static_cast<unsigned char>(0x12);
+ *(pData+8) = static_cast<unsigned char>(0x01); // uint32_t tick_high
+ *(pData+9) = static_cast<unsigned char>(0x23);
+ *(pData+10) = static_cast<unsigned char>(0x45);
+ *(pData+11) = static_cast<unsigned char>(0x67);
+ *(pData+12) = static_cast<unsigned char>(0x89); // uint32_t tick_low
+ *(pData+13) = static_cast<unsigned char>(0x10);
+ *(pData+14) = static_cast<unsigned char>(0x11);
+ *(pData+15) = static_cast<unsigned char>(0x13);
+ }
+
+ // Test the receiveMsg method
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMsg ClockSciMsg failed",
+ mpSciServer->receiveMsg (&msg_header, dataLength, pData) );
+
+ // Free allocated memory
+ //
+ if (NULL != pData)
+ {
+ delete [] pData;
+ pData = NULL;
+ }
+}
+
+
+void SciServerTest::receiveSystemSciMsgTest ( Sci_Msg_Header & msg_header )
+{
+ logTest();
+
+ // Message header type and length have to be set to the corresponding specialized SCI message
+ //
+ msg_header.type = SCI_MSG_TYPE_SYSTEM; // uint8_t type = 0x04
+
+ unsigned long dataLength = sizeof(struct System_Header);
+ msg_header.length = (uint16_t)dataLength;
+
+ unsigned char * pData = new unsigned char [dataLength];
+ if (NULL != pData)
+ {
+ *pData = static_cast<unsigned char>(SYSTEM_VERSION); // uint8_t version = 0x01
+ *(pData+1) = static_cast<unsigned char>(SYSTEM_TYPE_IDLE); // uint8_t type = 0x01
+ *(pData+2) = static_cast<unsigned char>(0xFF); // uint16_t flags
+ *(pData+3) = static_cast<unsigned char>(0xFF);
+ }
+
+ // Test the receiveMsg method
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMsg SystemSciMsg failed",
+ mpSciServer->receiveMsg (&msg_header, dataLength, pData) );
+
+ // Free allocated memory
+ //
+ if (NULL != pData)
+ {
+ delete [] pData;
+ pData = NULL;
+ }
+}
+
+
+void SciServerTest::receivePhySciMsgTest ( Sci_Msg_Header & msg_header )
+{
+ logTest();
+
+ // Message header type and length have to be set to the corresponding specialized SCI message
+ //
+ msg_header.type = SCI_MSG_TYPE_PHY; // uint8_t type = 0x03
+
+ uint32_t iv[3];
+ memset(iv, 'z', 3*sizeof(uint32_t));
+ uint32_t nek[4];
+ memset(nek, 'a', 4*sizeof(uint32_t));
+ uint32_t pbMeasurement [PHY_PB_MAX_NB];
+ memset(pbMeasurement, 'b', PHY_PB_MAX_NB*sizeof(uint32_t));
+ uint32_t pbHeader [PHY_PB_MAX_NB];
+ memset(pbHeader, 'c', PHY_PB_MAX_NB*sizeof(uint32_t));
+
+ Phy_Header phyHeader;
+ phyHeader.version = PHY_VERSION;
+ phyHeader.type = PHY_TYPE_PREAMBLE;
+ phyHeader.mpdu_format = PHY_MPDU_FORMAT_NONE;
+ phyHeader.pb_nb = 0x00;
+ phyHeader.msg_nb = 0x01;
+ phyHeader.fc_mode = 0x01;
+ phyHeader.short_ppdu = 0x01;
+ phyHeader.mod = 0x01;
+ phyHeader.fecrate = 0x01;
+ phyHeader.gil = 0x01;
+ phyHeader.tonemap_index = 0x02;
+ phyHeader.reserved = 0xFF;
+ phyHeader.tx_id = htons(0x0001);
+ phyHeader.flags = htons(PHY_FLAG_CRC_OK);
+ phyHeader.symbol_nb = htonl(0x00000010);
+
+ memcpy(phyHeader.iv, iv, 3*sizeof(uint32_t));
+ memcpy(phyHeader.nek, nek, 4*sizeof(uint32_t));
+ memcpy(phyHeader.pb_measurement, pbMeasurement, PHY_PB_MAX_NB*sizeof(uint32_t));
+ memcpy(phyHeader.pb_header, pbHeader, PHY_PB_MAX_NB*sizeof(uint32_t));
+
+ unsigned long dataLength = sizeof(struct Phy_Header);
+ msg_header.length = (uint16_t)dataLength;
+
+ unsigned char * pData = new unsigned char [dataLength];
+ if (NULL != pData)
+ {
+ memcpy(pData, (unsigned char *)&phyHeader, sizeof(struct Phy_Header));
+ }
+
+ //Test the receiveMsg method
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMsg PhySciMsg failed",
+ mpSciServer->receiveMsg (&msg_header, dataLength, pData) );
+
+ // Free allocated memory
+ //
+ if (NULL != pData)
+ {
+ delete [] pData;
+ pData = NULL;
+ }
+}
+
+
+void SciServerTest::receiveFunctionSciMsgTest ( Sci_Msg_Header & msg_header )
+{
+ logTest();
+
+ // Message header type and length have to be set to the corresponding specialized SCI message
+ //
+ msg_header.type = SCI_MSG_TYPE_FUNCTION_CALL;
+
+ stringstream ioss;
+ ioss << static_cast<unsigned char>(FUNCTION_CALL_VERSION); // uint8_t version = 0x01
+ ioss << static_cast<unsigned char>(FUNCTION_CALL_TYPE_RSP); // uint8_t type = 0x01
+ ioss << static_cast<unsigned char>(0x00); // uint16_t msg_id = 0x0001
+ ioss << static_cast<unsigned char>(0x01);
+ ioss << static_cast<unsigned char>(0x02); // uint8_t param_nb
+ ioss << static_cast<unsigned char>(0xFF); // uint8_t flags
+ ioss << static_cast<unsigned char>(0x00); // uint16_t reserved = 0x0000
+ ioss << static_cast<unsigned char>(0x00);
+ ioss << "functionSciMsgCallback"; // function call id: null terminated string; id of the called function
+ ioss << '\0';
+ // parameter list: for each parameter inside the function call message
+ ioss << "parameter1"; // parameter id: null terminated string; id of the parameter
+ ioss << '\0';
+ ioss << static_cast<unsigned char>(0x00); // parameter length: 2 bytes; length of parameter data
+ ioss << static_cast<unsigned char>(0x01);
+ ioss << static_cast<unsigned char>(0x02); // parameter data: binary content of parameter data
+ ioss << "parameter2"; // parameter id: null terminated string; id of the parameter
+ ioss << '\0';
+ ioss << static_cast<unsigned char>(0x00); // parameter length: 2 bytes; length of parameter data
+ ioss << static_cast<unsigned char>(0x02);
+ ioss << static_cast<unsigned char>(0x01); // parameter data: binary content of parameter data
+ ioss << static_cast<unsigned char>(0x23);
+
+ unsigned long dataLength = ioss.str().length();
+ msg_header.length = (uint16_t)dataLength;
+
+ unsigned char * pData = new unsigned char [dataLength+1];
+ if (NULL != pData)
+ {
+ ioss >> pData;
+ }
+
+ // Register callback
+ //
+ if (NULL != mpFunctionCallManager)
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "registerCallback failed",
+ mpFunctionCallManager->registerCallback (0x0001, &functionSciMsgCallback) );
+ }
+ else
+ {
+ CPPUNIT_FAIL ("FunctionCallManager pointer is NULL");
+ }
+
+ // Test the receiveMsg method
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMsg FunctionSciMsg failed",
+ mpSciServer->receiveMsg (&msg_header, dataLength, pData) );
+
+ // Free allocated memory
+ //
+ if (NULL != pData)
+ {
+ delete [] pData;
+ pData = NULL;
+ }
+}
+
+
+void SciServerTest::receiveEtherSciMsgTest ( Sci_Msg_Header & msg_header )
+{
+ logTest();
+
+ // Message header type and length have to be set to the corresponding specialized SCI message
+ //
+ msg_header.type = SCI_MSG_TYPE_ETHERNET; // uint8_t type = 0x05
+
+ Ethernet_Header ethernetHeader;
+ ethernetHeader.version = ETHERNET_VERSION;
+ ethernetHeader.type = ETHERNET_TYPE_DATA;
+ ethernetHeader.sniffer_type = 0;
+ ethernetHeader.flags = 0x00;
+ ethernetHeader.reserved = 0xFFFFFFFF;
+
+ unsigned long dataLength = 1500;
+ unsigned char data[sizeof(struct Ethernet_Header) + dataLength];
+ memcpy(data, (unsigned char *)&ethernetHeader, sizeof(struct Ethernet_Header));
+ memset(data + sizeof(struct Ethernet_Header), 'D', dataLength);
+ dataLength += sizeof(struct Ethernet_Header);
+ msg_header.length = (uint16_t)dataLength;
+
+ // Test the receiveMsg method
+ //
+ CPPUNIT_ASSERT_MESSAGE ( "receiveMsg EtherSciMsg failed",
+ mpSciServer->receiveMsg (&msg_header, dataLength, data) );
+}
+
+
+void functionSciMsgCallback ( const FunctionSciMsg & function_sci_msg )
+{
+ logTest();
+}
+
diff --git a/cesar/maximus/stationtest/Config b/cesar/maximus/stationtest/Config
new file mode 100644
index 0000000000..20950daa9a
--- /dev/null
+++ b/cesar/maximus/stationtest/Config
@@ -0,0 +1,2 @@
+CONFIG_DEBUG = y
+CONFIG_DEBUG_FATAL_CATCH = y \ No newline at end of file
diff --git a/cesar/maximus/stationtest/Makefile b/cesar/maximus/stationtest/Makefile
new file mode 100644
index 0000000000..14d797579d
--- /dev/null
+++ b/cesar/maximus/stationtest/Makefile
@@ -0,0 +1,47 @@
+BASE = ../..
+
+ECOS = y
+
+TARGET_PROGRAMS = exception hello_world one_thread threaddelay \
+ stationtest \
+ test_cb test_ether test_false_alarm test_lib_cesar test_send test_station test_tx_rx
+
+exception_SOURCES = exception.c
+exception_MODULES = lib host
+
+hello_world_SOURCES = hello_world.c
+hello_world_MODULES = lib host
+
+one_thread_SOURCES = one_thread.c
+one_thread_MODULES = lib host
+
+threaddelay_SOURCES = threaddelay.c
+threaddelay_MODULES = lib host
+
+stationtest_SOURCES = main_example.c
+stationtest_MODULES = lib host hal/phy/maximus
+
+test_cb_SOURCES = test_cb.c
+test_cb_MODULES = lib host
+
+test_ether_SOURCES = test_ether.c
+test_ether_MODULES = lib host hal/hle/maximus
+
+test_false_alarm_SOURCES = test_false_alarm.c
+test_false_alarm_MODULES = lib host hal/phy/maximus
+
+cp_beacon_MODULE_SOURCES = beacons.c bentry.c
+test_lib_cesar_SOURCES = test_lib_cesar.c
+test_lib_cesar_MODULES = lib host hal/hle/maximus hal/phy/maximus/dur/maximus interface cp/station/maximus
+
+test_send_SOURCES = test_send.c
+test_send_MODULES = lib host hal/phy/maximus
+
+cp_beacon_MODULE_SOURCES = beacons.c bentry.c
+test_station_SOURCES = test_station.c
+test_station_MODULES = lib host hal/hle/maximus hal/phy/maximus/dur/maximus interface cp/station/maximus
+
+test_tx_rx_SOURCES = test_tx_rx.c
+test_tx_rx_MODULES = lib host hal/phy/maximus
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/maximus/stationtest/ecos.ecc.sh b/cesar/maximus/stationtest/ecos.ecc.sh
new file mode 100644
index 0000000000..19597e4621
--- /dev/null
+++ b/cesar/maximus/stationtest/ecos.ecc.sh
@@ -0,0 +1,104 @@
+config=${1:-ecos-gen.ecc}
+ecosconfig --config=$config new maximus default
+cat >> $config <<'EOF'
+cdl_option CYGPKG_HAL_MAXIMUS_CFLAGS_ADD {
+ user_value "-I\$(BASE) -I\$(OBJ_DIR)/inc"
+ # value_source user
+ # Default value: "-I\$(REPOSITORY)/../.."
+}
+cdl_option CYGBLD_GLOBAL_CFLAGS {
+ user_value "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority -finline"
+ # value_source user
+ # Default value: "-Wall -Wpointer-arith -Wstrict-prototypes -Winline -Wundef -Woverloaded-virtual -g -O2 -ffunction-sections -fdata-sections -fno-rtti -fno-exceptions -fvtable-gc -finit-priority"
+}
+cdl_option CYGDBG_KERNEL_DEBUG_GDB_THREAD_SUPPORT {
+ user_value 0
+ inferred_value 0
+}
+cdl_option CYGBLD_ISO_CTYPE_HEADER {
+ inferred_value 1 <cyg/libc/i18n/ctype.inl>
+}
+cdl_option CYGBLD_ISO_ERRNO_CODES_HEADER {
+ inferred_value 1 <cyg/error/codes.h>
+}
+cdl_option CYGBLD_ISO_ERRNO_HEADER {
+ inferred_value 1 <cyg/error/errno.h>
+}
+cdl_option CYGBLD_ISO_STDIO_FILETYPES_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDIO_STREAMS_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDIO_FILEOPS_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDIO_FILEACCESS_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDIO_FORMATTED_IO_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDIO_CHAR_IO_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDIO_DIRECT_IO_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDIO_FILEPOS_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDIO_ERROR_HEADER {
+ inferred_value 1 <cyg/libc/stdio/stdio.h>
+}
+cdl_option CYGBLD_ISO_STDLIB_STRCONV_HEADER {
+ inferred_value 1 <cyg/libc/stdlib/atox.inl>
+}
+cdl_option CYGBLD_ISO_STDLIB_ABS_HEADER {
+ inferred_value 1 <cyg/libc/stdlib/abs.inl>
+}
+cdl_option CYGBLD_ISO_STDLIB_DIV_HEADER {
+ inferred_value 1 <cyg/libc/stdlib/div.inl>
+}
+cdl_option CYGBLD_ISO_STRERROR_HEADER {
+ inferred_value 1 <cyg/error/strerror.h>
+}
+cdl_option CYGBLD_ISO_STRTOK_R_HEADER {
+ inferred_value 1 <cyg/libc/string/string.h>
+}
+cdl_option CYGBLD_ISO_STRING_LOCALE_FUNCS_HEADER {
+ inferred_value 1 <cyg/libc/string/string.h>
+}
+cdl_option CYGBLD_ISO_STRING_BSD_FUNCS_HEADER {
+ inferred_value 1 <cyg/libc/string/bsdstring.h>
+}
+cdl_option CYGBLD_ISO_STRING_MEMFUNCS_HEADER {
+ inferred_value 1 <cyg/libc/string/string.h>
+}
+cdl_option CYGBLD_ISO_STRING_STRFUNCS_HEADER {
+ inferred_value 1 <cyg/libc/string/string.h>
+}
+cdl_option CYGBLD_ISO_C_TIME_TYPES_HEADER {
+ inferred_value 1 <cyg/libc/time/time.h>
+}
+cdl_option CYGBLD_ISO_C_CLOCK_FUNCS_HEADER {
+ inferred_value 1 <cyg/libc/time/time.h>
+}
+cdl_option CYGBLD_ISO_SIGNAL_NUMBERS_HEADER {
+ inferred_value 1 <cyg/libc/signals/signal.h>
+}
+cdl_option CYGBLD_ISO_SIGNAL_IMPL_HEADER {
+ inferred_value 1 <cyg/libc/signals/signal.h>
+}
+cdl_option CYGBLD_ISO_SETJMP_HEADER {
+ inferred_value 1 <cyg/libc/setjmp/setjmp.h>
+}
+cdl_option CYGNUM_LIBC_MAIN_DEFAULT_STACK_SIZE {
+ user_value 16384
+ inferred_value 16384
+}
+cdl_option CYGSEM_ERROR_PER_THREAD_ERRNO {
+ user_value 0
+}
+EOF
+ecosconfig --config=$config check
diff --git a/cesar/maximus/stationtest/src/exception.c b/cesar/maximus/stationtest/src/exception.c
new file mode 100644
index 0000000000..cbd0129cd1
--- /dev/null
+++ b/cesar/maximus/stationtest/src/exception.c
@@ -0,0 +1,74 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file exception.c
+ * \brief how to catch an exception
+ * \ingroup
+ *
+ * this is a test program to check eCos well work
+ */
+
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+#include <cyg/hal/hal_intr.h>
+#include "common/std.h"
+#include <host/station.h>
+
+extern station_ctx_t my_station;
+
+void system_call_exception(cyg_addrword_t data, cyg_code_t number, cyg_addrword_t info)
+{
+ switch(number)
+ {
+ case CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION:
+ diag_printf("eCos: Exception Error (Illegal Instruction)!!!\n");
+ break;
+
+ case CYGNUM_HAL_EXCEPTION_DATA_ACCESS:
+ diag_printf("eCos: Exception Error (Data Access)!!!\n");
+ break;
+
+ case CYGNUM_HAL_EXCEPTION_FPU:
+ diag_printf("eCos: Exception Error (FPU)!!!\n");
+ break;
+ }
+// station_down(&my_station);
+// cyg_hal_sys_exit(1);
+}
+
+void cyg_user_start(void)
+{
+ char *ptr = 0x0000;
+ cyg_exception_handler_t *oldHandler;
+ cyg_addrword_t oldData;
+
+ diag_write_string("debut du main\n");
+
+ cyg_exception_set_handler(CYGNUM_HAL_EXCEPTION_ILLEGAL_INSTRUCTION,
+ &system_call_exception,
+ 0,
+ &oldHandler,
+ &oldData);
+ cyg_exception_set_handler(CYGNUM_HAL_EXCEPTION_DATA_ACCESS,
+ &system_call_exception,
+ 0,
+ &oldHandler,
+ &oldData);
+ cyg_exception_set_handler(CYGNUM_HAL_EXCEPTION_FPU,
+ &system_call_exception,
+ 0,
+ &oldHandler,
+ &oldData);
+
+ diag_write_string("exception enregistrees\n");
+
+// cyg_thread_delay(10);
+ *ptr = 12;
+ diag_write_string("fin du main\n");
+}
+
diff --git a/cesar/maximus/stationtest/src/hello_world.c b/cesar/maximus/stationtest/src/hello_world.c
new file mode 100644
index 0000000000..2a118d5f2d
--- /dev/null
+++ b/cesar/maximus/stationtest/src/hello_world.c
@@ -0,0 +1,28 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file hello_world.c
+ * \brief hello world program
+ * \ingroup
+ */
+
+#include <cyg/infra/diag.h>
+#include "common/std.h"
+#include "host/station.h"
+
+extern station_ctx_t my_station;
+
+int main(void)
+{
+ station_log_set_level(&my_station, STATION_LOG_DEBUG);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+ diag_write_string("hello by eCos\n");
+ return 0;
+}
+
diff --git a/cesar/maximus/stationtest/src/main_example.c b/cesar/maximus/stationtest/src/main_example.c
new file mode 100644
index 0000000000..c9b5b133f7
--- /dev/null
+++ b/cesar/maximus/stationtest/src/main_example.c
@@ -0,0 +1,392 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file main_example.c
+ * \brief example of a main program of a station executable
+ * \ingroup
+ */
+
+#include <cyg/infra/diag.h>
+#include <cyg/kernel/kapi.h>
+#include <errno.h>
+#include "common/std.h"
+#include "host/station.h"
+#include "hal/phy/phy.h"
+#include "hal/phy/maximus/inc/maximus_phy_ctx.h" // for 'phy_t'
+
+extern station_ctx_t my_station;
+phy_t * phy;
+
+bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av)
+{
+ diag_write_string("=> phy_rx_fc_cb\n");
+
+ phy_rx_prepare(phy, false, PHY_MOD_MINI_ROBO,
+ PHY_FEC_RATE_1_2, PHY_PB_SIZE_136, PHY_GIL_567,
+ 0 /* tonemap_index */, 0 /* symbol_nb */);
+
+ return true;
+}
+
+bool phy_access_cb (void *user)
+{
+ return true;
+}
+
+bool phy_access_conf_cb (void *user)
+{
+ return true;
+}
+
+bool phy_pbdma_cb (void *user, u32 status_word)
+{
+ return true;
+}
+
+bool phy_tx_false_alarm_cb (void *user)
+{
+ return true;
+}
+
+bool phy_zero_cross_cb (void *user, u32 zero_cross_date)
+{
+ return true;
+}
+
+void phy_deferred_cb (void *user)
+{
+ return;
+}
+
+bool phy_extra_timer_cb (void *user)
+{
+ return true;
+}
+
+typedef struct my_struct
+{
+ int i1;
+ int i2;
+ bool b;
+} my_struct_t;
+
+typedef long long my_type_t;
+
+my_type_t my_param4;
+
+unsigned int my_param6 = 123; // 0x0000007B
+unsigned int my_param7 = 456; // 0x000001C8
+bool my_param8 = false;
+bool my_param9 = true;
+unsigned short my_param10 = 0xFFEE;
+unsigned long my_param11 = 0xFFEEDDCC;
+
+
+void my_return_function (void *data)
+{
+ static fcall_param_t return_param;
+ static sci_msg_t return_msg;
+ static unsigned char return_buffer[1024];
+ unsigned short *return_msg_id = (unsigned short *)data;
+
+ /* init structures */
+ fcall_param_init(&return_param, "function_1_rsp", *return_msg_id);
+ if (0 != sci_msg_init(&return_msg, return_buffer, 1024))
+ {
+ station_log(&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_SCI,
+ "%s: errno = %d", __FUNCTION__, errno);
+ }
+
+ /* do other tasks ... */
+ diag_write_string("=> my_return_function\n");
+
+ /* now make the return parameter list */
+ fcall_param_reset(&return_param);
+ fcall_param_add(&return_param, &return_msg, "result_2", sizeof(my_type_t), &my_param4);
+ fcall_return(my_station.fcall, &return_param, &return_msg);
+
+ return;
+}
+
+
+int my_function1 (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ static unsigned short asynchronous_msg_id = 0;
+ my_struct_t my_param1;
+ int my_param2[10];
+ char my_param3[6];
+ int i;
+
+ // for netclock message
+ netclock_id_t id;
+ static netclock_callback_t my_return_function_cb;
+
+ /* get parameters content */
+ fcall_param_bind(*param, *msg, "param_1", sizeof(my_struct_t), &my_param1);
+ fcall_param_bind(*param, *msg, "param_2", 10*sizeof(int), my_param2);
+ fcall_param_bind(*param, *msg, "param_3", 6, (char*)my_param3);
+ fcall_param_bind(*param, *msg, "param_4", sizeof(my_type_t), &my_param4);
+
+ /* do other tasks ... */
+ diag_write_string("=> my_function1\n");
+ diag_printf("param 1 . i1 = %d\n", my_param1.i1);
+ diag_printf("param 1 . i2 = %d\n", my_param1.i2);
+ diag_printf("param 1 . b = %d\n", my_param1.b);
+ diag_write_string("param 2 = ");
+ for (i=0; i<10; i++)
+ {
+ diag_printf(" %d", my_param2[i]);
+ }
+ diag_write_string("\n");
+ diag_printf("param 3 = %s\n", my_param3);
+ diag_printf("param 4 = %lld\n", my_param4);
+
+ /* prepare the future asynchronous return */
+ fcall_param_set_async(*param, 1);
+ asynchronous_msg_id = (*param)->msg_id;
+
+ /* schedule the future my_return_function() call */
+ // send netclock message to Maximus to call my_return_function()
+ if (-1 == netclock_schedule(my_station.netclock,
+ &my_return_function_cb,
+ NETWORK_CLOCK_TYPE_STATION,
+ my_station.current_tick_tck+10,
+ &my_return_function,
+ (void*)&asynchronous_msg_id,
+ &id))
+ {
+ diag_printf("errno = %d\n", errno);
+ }
+
+ /* now return */
+ return 0;
+}
+
+
+int my_function2 (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ bool my_param5;
+ char my_result1[] = "this is result 1\0";
+
+ /* get parameters content */
+ if (-1 == fcall_param_bind(*param, *msg, "param_5", sizeof(bool), &my_param5))
+ {
+ diag_printf("errno = %d\n", errno);
+ diag_printf("param nb = %d\n", (*param)->param_nb);
+ }
+
+ /* do other tasks ... */
+ diag_write_string("=> my_function2\n");
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+ fcall_param_add(*param, *msg, "result_1", strlen(my_result1)+1, &my_result1);
+
+ return 0;
+}
+
+
+void my_function_rsp (void *data)
+{
+ static fcall_param_t return_param;
+ static sci_msg_t return_msg;
+ static unsigned char return_buffer[1024];
+ unsigned short *return_msg_id = (unsigned short *)data;
+
+ /* init structures */
+ fcall_param_init(&return_param, "function_rsp", *return_msg_id);
+ if (0 != sci_msg_init(&return_msg, return_buffer, 1024))
+ {
+ station_log(&my_station, STATION_LOG_ERROR, STATION_LOGTYPE_SCI,
+ "%s: errno = %d", __FUNCTION__, errno);
+ }
+
+ /* do other tasks ... */
+ diag_write_string("=> my_function_rsp\n");
+
+ /* now make the return parameter list */
+ fcall_param_reset(&return_param);
+ fcall_return(my_station.fcall, &return_param, &return_msg);
+
+ return;
+}
+
+
+int my_function3 (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ static unsigned short asynchronous_msg_id = 0;
+
+ /* do other tasks ... */
+ diag_write_string("=> my_function3\n");
+
+ /* prepare the future asynchronous return */
+ fcall_param_set_async(*param, 1);
+ asynchronous_msg_id = (*param)->msg_id;
+
+ /* call my_function_rsp() */
+ my_function_rsp((void*)&asynchronous_msg_id);
+
+ return 0;
+}
+
+
+int my_function4 (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ static unsigned short asynchronous_msg_id = 0;
+
+ /* do other tasks ... */
+ diag_write_string("=> my_function4\n");
+
+ /* prepare the future asynchronous return */
+ fcall_param_set_async(*param, 1);
+ asynchronous_msg_id = (*param)->msg_id;
+
+ /* call my_function_rsp() */
+ my_function_rsp((void*)&asynchronous_msg_id);
+
+ return 0;
+}
+
+
+int my_function5 (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ static unsigned short asynchronous_msg_id = 0;
+
+ /* do other tasks ... */
+ diag_write_string("=> my_function5\n");
+
+ /* prepare the future asynchronous return */
+ fcall_param_set_async(*param, 1);
+ asynchronous_msg_id = (*param)->msg_id;
+
+ /* call my_function_rsp() */
+ my_function_rsp((void*)&asynchronous_msg_id);
+
+ return 0;
+}
+
+
+int set_tonemask (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ int i = 0;
+ u8 tonemask[(PHY_CARRIER_NB+7)/8];
+
+ diag_write_string("=> set_tonemask\n");
+
+ // Initialize the HAL PHY
+ phy = phy_init ((void*)&my_param4, &phy_rx_fc_cb, &phy_access_cb, &phy_access_conf_cb, &phy_pbdma_cb, &phy_tx_false_alarm_cb, &phy_deferred_cb);
+ phy_zero_cross_init (phy, &phy_zero_cross_cb);
+
+ // Enable assertions on warnings
+ phy->warning_assert = true;
+
+ // Set TONEMASK
+ for (i=0; i<(PHY_CARRIER_NB+7)/8; i++)
+ {
+ tonemask[i] = 0xEE;
+ }
+ phy_set_tonemask(phy, tonemask, PHY_CARRIER_NB);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int prepare_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ // Test with one PB of 128 octets
+ static u8 first_pb_data[128];
+ static phy_pb_t first_pb;
+ static u32 iv[3];
+ static u32 nek[4];
+ int i = 0;
+
+ diag_write_string("=> prepare_rx\n");
+
+ // Activate RX
+ phy_rx_activate(phy, true, my_station.current_tick_tck, true);
+
+ // Set RX parameters
+ phy_rx_param(phy, PHY_FC_MODE_HYBRID_1);
+
+ // Start PBDMA
+ memset(first_pb_data, '1', 128);
+ first_pb.pb_rx.blk.data = first_pb_data;
+ first_pb.pb_rx.blk.next = NULL;
+ for (i=0; i<3; i++)
+ {
+ iv[i] = i;
+ }
+ for (i=0; i<4; i++)
+ {
+ nek[i] = i;
+ }
+ phy_pbdma_start(phy, true /* bypass_aes */, iv,
+ nek, 1 /* nb_total */, 1 /* nb_ready */,
+ 1 /* nb_pb_it */, &first_pb);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int uninit_phy (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> uninit_phy\n");
+
+ // Uninitialize the HAL PHY
+ phy_uninit (phy);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int function_to_call (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> function_to_call\n");
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int main (void)
+{
+ station_log_set_level(&my_station, STATION_LOG_DEBUG);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ fcall_register(my_station.fcall, "function_1", (void*)&my_function1, NULL);
+ fcall_register(my_station.fcall, "function_2", (void*)&my_function2, NULL);
+ fcall_register(my_station.fcall, "function_3", (void*)&my_function3, NULL);
+ fcall_register(my_station.fcall, "function_4", (void*)&my_function4, NULL);
+ fcall_register(my_station.fcall, "function_5", (void*)&my_function5, NULL);
+ fcall_register(my_station.fcall, "set_tonemask", (void*)&set_tonemask, NULL);
+ fcall_register(my_station.fcall, "prepare_rx", (void*)&prepare_rx, NULL);
+ fcall_register(my_station.fcall, "uninit_phy", (void*)&uninit_phy, NULL);
+ fcall_register(my_station.fcall, "function_to_call", (void*)&function_to_call, NULL);
+
+ probe_register(my_station.probe, "param_6", sizeof(unsigned int), &my_param6);
+ probe_register(my_station.probe, "param_7", sizeof(unsigned int), &my_param7);
+ probe_register(my_station.probe, "param_8", sizeof(bool), &my_param8);
+ probe_register(my_station.probe, "param_9", sizeof(bool), &my_param9);
+ probe_register(my_station.probe, "param_10", sizeof(unsigned short), &my_param10);
+ probe_register(my_station.probe, "param_11", sizeof(unsigned long), &my_param11);
+
+ return 0;
+}
+
diff --git a/cesar/maximus/stationtest/src/one_thread.c b/cesar/maximus/stationtest/src/one_thread.c
new file mode 100644
index 0000000000..794bacfcb8
--- /dev/null
+++ b/cesar/maximus/stationtest/src/one_thread.c
@@ -0,0 +1,47 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file one_thread.c
+ * \brief test program with only one thread
+ * \ingroup
+ *
+ * this is a test program to check eCos well work
+ */
+
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+
+#define MY_THREAD_STACK_SIZE (2048 / sizeof(int))
+
+int my_thread_stack[MY_THREAD_STACK_SIZE];
+cyg_handle_t my_thread_handle;
+cyg_thread my_thread_obj;
+
+void my_thread(cyg_addrword_t index)
+{
+ unsigned int my_counter = 0;
+ while(1)
+ {
+ diag_printf("hello, count=%d\n",my_counter);
+ my_counter++;
+ }
+}
+
+void cyg_user_start(void)
+{
+
+ cyg_thread_create(12, my_thread, (cyg_addrword_t) 0,
+ "My Thread", &my_thread_stack, MY_THREAD_STACK_SIZE,
+ &my_thread_handle, &my_thread_obj);
+
+ cyg_thread_resume(my_thread_handle);
+ diag_write_string("scheduler starting...\n");
+
+ cyg_scheduler_start();
+}
+
diff --git a/cesar/maximus/stationtest/src/test_cb.c b/cesar/maximus/stationtest/src/test_cb.c
new file mode 100644
index 0000000000..83e9f4ce10
--- /dev/null
+++ b/cesar/maximus/stationtest/src/test_cb.c
@@ -0,0 +1,41 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_cb.c
+ * \brief station executable used for test cb program
+ * \ingroup
+ */
+
+#include <cyg/infra/diag.h>
+#include <cyg/kernel/kapi.h>
+#include <errno.h>
+#include "common/std.h"
+#include "host/station.h"
+
+extern station_ctx_t my_station;
+
+int get_seg (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> get_seg\n");
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int main(void)
+{
+ station_log_set_level(&my_station, STATION_LOG_DEBUG);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ fcall_register(my_station.fcall, "get_seg", (void*)&get_seg, NULL);
+
+ return 0;
+}
diff --git a/cesar/maximus/stationtest/src/test_ether.c b/cesar/maximus/stationtest/src/test_ether.c
new file mode 100644
index 0000000000..87a00ecebe
--- /dev/null
+++ b/cesar/maximus/stationtest/src/test_ether.c
@@ -0,0 +1,143 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_ether.c
+ * \brief test ether program
+ * \ingroup
+ */
+
+#include <cyg/infra/diag.h>
+#include <cyg/kernel/kapi.h>
+#include <errno.h>
+#include "common/std.h"
+#include "host/station.h"
+#include "hal/hle/ipmbox.h"
+#include "hal/hle/defs.h" // for 'HLE_MSG_TYPE_...' and 'ipmbox_msg_hdr_t'
+#include "hal/hle/maximus/inc/maximus_ipmbox_ctx.h" // for 'ipmbox_t'
+#include "hal/hle/maximus/inc/maximus_interrupts.h" // for 'HAL_HLE_INTERRUPT_IPMBOX'
+#include "maximus/common/types/ethernet_types.h" // for 'ETHERNET_TYPE_...'
+#include <stdlib.h> // for 'malloc()'
+
+extern station_ctx_t my_station;
+ipmbox_t * ctx;
+int user_data = 123;
+
+
+void ipmbox_rx_cb (void *user_data, u32 *first_msg, uint length)
+{
+ diag_write_string("=> ipmbox_rx_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << HAL_HLE_INTERRUPT_IPMBOX);
+
+ ipmbox_msg_hdr_t *hdr = (ipmbox_msg_hdr_t *)&ctx->rx.mailbox[0];
+ if (HLE_MSG_TYPE_DATA == hdr->type)
+ {
+ /* When receiving an Ether SCI message of type DATA or MME from Maximus,
+ * answer by sending a first Ether SCI message of type DATA,
+ * with an Ether SCI message of type BUFFER_RELEASED,
+ * and a second one of type MME,
+ * with an Ether SCI message of type BUFFER_RELEASED. */
+
+ uint data_length = (uint)(hdr->param >> 1);
+ memcpy(ctx->first_buffer->next->data, (u32 *)ctx->rx.mailbox[1], data_length);
+ memcpy(ctx->first_buffer->next->next->data, (u32 *)ctx->rx.mailbox[1], data_length);
+
+ // Release allocated buffer
+ hdr->type = HLE_MSG_TYPE_SEND_DONE;
+ ipmbox_tx (ctx, ctx->rx.mailbox, 2);
+
+ hdr->type = HLE_MSG_TYPE_DATA;
+ hdr->param &= 0xFFE;
+ ctx->rx.mailbox[1] = (u32)ctx->first_buffer->next->data;
+ ipmbox_tx (ctx, ctx->rx.mailbox, ctx->rx.length);
+
+ hdr->param |= 0x001;
+ ctx->rx.mailbox[1] = (u32)ctx->first_buffer->next->data;
+ ipmbox_tx (ctx, ctx->rx.mailbox, ctx->rx.length);
+ }
+ else if (HLE_MSG_TYPE_BUFFER_ADD == hdr->type)
+ {
+ if (2 == hdr->param)
+ {
+ /* When receiving an Ether SCI message of type INTERFACE_BUFFER_ADD from Maximus,
+ * answer by sending an Ether SCI message of type SNIFFER,
+ * with an Ether SCI message of type BUFFER_RELEASED. */
+
+ uint data_length = 64;
+ char * p_data = malloc(data_length);
+ memset(p_data, '\0', data_length);
+ strcpy(p_data, "This is a sniffed packet coming from the station");
+
+ maximus_hle_buffer_t *p_buffer = (maximus_hle_buffer_t *)malloc(sizeof(maximus_hle_buffer_t));
+ u32 id = ctx->last_buffer->id;
+ ctx->last_buffer->next = p_buffer;
+ ctx->last_buffer = p_buffer;
+ ctx->last_buffer->next = NULL;
+ ctx->last_buffer->id = id;
+ ctx->last_buffer->data = (u32 *)p_data;
+
+ hdr->type = HLE_MSG_TYPE_INTERFACE;
+ hdr->length = 2;
+ hdr->param = ((data_length << 8) & 0x7FF00) | 0x00001;
+ ctx->rx.mailbox[1] = 0x00000007;
+ ctx->rx.mailbox[2] = (u32)p_data;
+ ipmbox_tx (ctx, ctx->rx.mailbox, 3);
+ }
+ }
+
+ return;
+}
+
+
+int init_ether (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> init_ether\n");
+
+ // Initialize the HAL HLE ipmbox
+ ctx = ipmbox_init ((void *)&user_data, &ipmbox_rx_cb);
+
+ // Enable assertions on warnings
+ ctx->warning_assert = true;
+
+ // Activate ipmbox interruptions
+ ipmbox_activate (ctx, true);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int uninit_ether (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> uninit_ether\n");
+
+ // Uninitialize the HAL HLE ipmbox
+ ipmbox_uninit (ctx);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int main(void)
+{
+ station_log_set_level(&my_station, STATION_LOG_DEBUG);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ fcall_register(my_station.fcall, "init_ether", (void*)&init_ether, NULL);
+ fcall_register(my_station.fcall, "uninit_ether", (void*)&uninit_ether, NULL);
+
+ return 0;
+}
+
diff --git a/cesar/maximus/stationtest/src/test_false_alarm.c b/cesar/maximus/stationtest/src/test_false_alarm.c
new file mode 100644
index 0000000000..bba0472d79
--- /dev/null
+++ b/cesar/maximus/stationtest/src/test_false_alarm.c
@@ -0,0 +1,158 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_false_alarm.c
+ * \brief station executable used for test false alarm program
+ * \ingroup
+ */
+
+#include <cyg/infra/diag.h>
+#include <cyg/kernel/kapi.h>
+#include <errno.h>
+#include "common/std.h"
+#include "host/station.h"
+#include "hal/phy/phy.h"
+#include "hal/phy/maximus/inc/maximus_phy_ctx.h" // for 'phy_t'
+#include "hal/phy/maximus/inc/maximus_interrupts.h" // for 'PHY_HAL_INTERRUPT_...'
+
+extern station_ctx_t my_station;
+phy_t * ctx;
+
+bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av)
+{
+ diag_write_string("=> phy_rx_fc_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ phy_rx_prepare(ctx, false, PHY_MOD_MINI_ROBO,
+ PHY_FEC_RATE_1_2, PHY_PB_SIZE_136, PHY_GIL_567,
+ 0 /* tonemap_index */, 0 /* symbol_nb */);
+
+ return true;
+}
+
+bool phy_access_cb (void *user)
+{
+ diag_write_string("=> phy_access_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ return true;
+}
+
+bool phy_access_conf_cb (void *user)
+{
+ diag_write_string("=> phy_access_conf_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ return true;
+}
+
+bool phy_pbdma_cb (void *user, u32 status_word)
+{
+ diag_write_string("=> phy_pbdma_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PBDMA);
+
+ return true;
+}
+
+bool phy_tx_false_alarm_cb (void *user)
+{
+ diag_write_string("=> phy_tx_false_alarm_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ return true;
+}
+
+void phy_deferred_cb (void *user)
+{
+ diag_write_string("=> phy_deferred_cb\n");
+
+ return;
+}
+
+int init_phy (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> init_phy\n");
+
+ // Initialize the HAL PHY
+ ctx = phy_init ((void*)&my_station, &phy_rx_fc_cb, &phy_access_cb,
+ &phy_access_conf_cb, &phy_pbdma_cb,
+ &phy_tx_false_alarm_cb, &phy_deferred_cb);
+
+ // Enable assertions on warnings
+ ctx->warning_assert = true;
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int activate_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ unsigned short fc_mode = 0;
+ bool pre_detection = false;
+
+ diag_write_string("=> activate_rx\n");
+
+ /* get parameters content */
+ fcall_param_bind_short(*param, *msg, "fc_mode", &fc_mode);
+ fcall_param_bind(*param, *msg, "pre_detection", 1, &pre_detection);
+
+ // Set medium state
+ ctx->access.medium_state = MAXIMUS_PHY_MEDIUM_IDLE;
+
+ // Activate RX
+ phy_rx_activate(ctx, true /* now */, my_station.current_tick_tck, pre_detection);
+
+ // Set RX parameters
+ phy_rx_param(ctx, (phy_fc_mode_t)fc_mode);
+
+ // Set TX blocked
+ ctx->control.tx_blocked_on_false_alarm = true;
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int uninit_phy (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> uninit_phy\n");
+
+ // Uninitialize the HAL PHY
+ phy_uninit (ctx);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int main(void)
+{
+ station_log_set_level(&my_station, STATION_LOG_DEBUG);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ fcall_register(my_station.fcall, "init_phy", (void*)&init_phy, NULL);
+ fcall_register(my_station.fcall, "activate_rx", (void*)&activate_rx, NULL);
+ fcall_register(my_station.fcall, "uninit_phy", (void*)&uninit_phy, NULL);
+
+ return 0;
+}
diff --git a/cesar/maximus/stationtest/src/test_lib_cesar.c b/cesar/maximus/stationtest/src/test_lib_cesar.c
new file mode 100644
index 0000000000..ca3b5d6d65
--- /dev/null
+++ b/cesar/maximus/stationtest/src/test_lib_cesar.c
@@ -0,0 +1,93 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_lib_cesar.c
+ * \brief station executable used for the test lib cesar program
+ * \ingroup
+ */
+
+#include "common/std.h"
+#include "host/station.h" // for 'station_ctx_t'
+#include "cp/beacon/beacons.h" // for 'cp_sta_t'
+#include "cp/station/maximus/inc/maximus_cp_station.h" // for 'maximus_cp_station_init()'
+#include "hal/phy/maximus/dur/maximus/inc/maximus_phy_dur.h" // for 'maximus_phy_dur_init()'
+#include "hal/hle/ipmbox.h"
+#include "hal/hle/defs.h" // for 'HLE_MSG_TYPE_...' and 'ipmbox_msg_hdr_t'
+#include "hal/hle/maximus/inc/maximus_ipmbox_ctx.h" // for 'ipmbox_t'
+#include "hal/hle/maximus/inc/maximus_interrupts.h" // for 'HAL_HLE_INTERRUPT_IPMBOX'
+#include "maximus/common/types/ethernet_types.h" // for 'ETHERNET_TYPE_...'
+
+cp_sta_t cp_sta_global;
+extern station_ctx_t my_station;
+ipmbox_t *ctx;
+int user_data = 123;
+
+void ipmbox_rx_cb (void *user_data, u32 *first_msg, uint length)
+{
+ // Reset IT
+ maximus_pending_isrs &= (0 << HAL_HLE_INTERRUPT_IPMBOX);
+
+ ipmbox_msg_hdr_t *hdr = (ipmbox_msg_hdr_t *)&ctx->rx.mailbox[0];
+ if (HLE_MSG_TYPE_DATA == hdr->type)
+ {
+ /* When receiving an Ether SCI message of type MME REQ from Maximus,
+ * send the answer (an Ether SCI message of type MME CNF). */
+
+ uint data_length = (uint)(hdr->param >> 1);
+ memcpy(ctx->first_buffer->next->data, (u32 *)ctx->rx.mailbox[1], data_length);
+ char *data = (char *)ctx->first_buffer->next->data;
+ *(data + 15) = *(data + 15) + 1; // REQ => CNF
+ *(data + 19) = 0x01; // Success
+ memset(data + 20, '\0', data_length - 20);
+
+ // Release allocated buffer
+ hdr->type = HLE_MSG_TYPE_SEND_DONE;
+ ipmbox_tx (ctx, ctx->rx.mailbox, 2);
+
+ hdr->type = HLE_MSG_TYPE_DATA;
+ hdr->param |= 0x001;
+ ctx->rx.mailbox[1] = (u32)ctx->first_buffer->next->data;
+ ipmbox_tx (ctx, ctx->rx.mailbox, ctx->rx.length);
+ }
+
+ return;
+}
+
+int uninit_ether (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ // Uninitialize the HAL HLE ipmbox
+ ipmbox_uninit (ctx);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int main (void)
+{
+ station_log_set_level(&my_station, STATION_LOG_WARNING);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ maximus_cp_station_init(&my_station);
+ maximus_phy_dur_init(&my_station);
+
+ // Initialize the HAL HLE ipmbox
+ ctx = ipmbox_init ((void *)&user_data, &ipmbox_rx_cb);
+
+ // Enable assertions on warnings
+ ctx->warning_assert = true;
+
+ // Activate ipmbox interruptions
+ ipmbox_activate (ctx, true);
+
+ fcall_register(my_station.fcall, "uninit_ether", (void*)&uninit_ether, NULL);
+
+ return 0;
+}
diff --git a/cesar/maximus/stationtest/src/test_send.c b/cesar/maximus/stationtest/src/test_send.c
new file mode 100644
index 0000000000..ac9541bb9e
--- /dev/null
+++ b/cesar/maximus/stationtest/src/test_send.c
@@ -0,0 +1,231 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_send.c
+ * \brief station executable used for the test send program
+ * \ingroup
+ */
+
+#include <cyg/infra/diag.h>
+#include <cyg/kernel/kapi.h>
+#include <errno.h>
+#include "common/std.h"
+#include "host/station.h"
+#include "hal/phy/phy.h"
+#include "mac/common/defs.h"
+#include "hal/phy/maximus/inc/maximus_phy_ctx.h" // for 'phy_t'
+
+extern station_ctx_t my_station;
+phy_t * ctx;
+int user_data = 123;
+bool short_ppdu = false;
+unsigned short mod = 0;
+unsigned short fecrate = 0;
+unsigned short pb_size = 0;
+unsigned short gil = 0;
+
+// For noise
+phy_chandata_t freq_chan[6];
+phy_chandata_t time_chan;
+u8 freq_chan_data[6][MAC_PB520_BYTES];
+u8 time_chan_data[MAC_PB520_BYTES];
+
+bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av)
+{
+ diag_write_string("=> phy_rx_fc_cb\n");
+
+ // When the FC is received, prepare RX
+ phy_rx_prepare(ctx, short_ppdu, (phy_mod_t)mod,
+ (phy_fecrate_t)fecrate, (phy_pb_size_t)pb_size, (phy_gil_t)gil,
+ 0 /* tonemap_index */, 0 /* symbol_nb */);
+
+ return true;
+}
+
+bool phy_access_cb (void *user)
+{
+ return true;
+}
+
+bool phy_access_conf_cb (void *user)
+{
+ return true;
+}
+
+bool phy_pbdma_cb (void *user, u32 status_word)
+{
+ return true;
+}
+
+bool phy_tx_false_alarm_cb (void *user)
+{
+ return true;
+}
+
+void phy_deferred_cb (void *user)
+{
+ return;
+}
+
+bool phy_extra_timer_cb (void *user)
+{
+ return true;
+}
+
+int set_tonemask (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ u8 tonemask[(PHY_CARRIER_NB+7)/8];
+ int i = 0;
+
+ diag_write_string("=> set_tonemask\n");
+
+ // Initialize the HAL PHY
+ ctx = phy_init ((void *)&user_data, &phy_rx_fc_cb, &phy_access_cb, &phy_access_conf_cb, &phy_pbdma_cb, &phy_tx_false_alarm_cb, &phy_deferred_cb);
+
+ // Enable assertions on warnings
+ ctx->warning_assert = true;
+
+ // Set TONEMASK
+ for (i=0; i<(PHY_CARRIER_NB+7)/8; i++)
+ {
+ tonemask[i] = 0xEE;
+ }
+ phy_set_tonemask(ctx, tonemask, PHY_CARRIER_NB);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int prepare_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ unsigned short fc_mode = 0;
+ unsigned short pb_nb = 0;
+ int i = 0;
+ char c = 0;
+ static u32 iv[3];
+ static u32 nek[4];
+
+ // Test with maximum 10 PBs of 512 octets
+ int pb_length = MAC_MAX_PB_PER_MPDU;
+ static u8 pb_data[MAC_MAX_PB_PER_MPDU][MAC_PB520_BYTES];
+ static phy_pb_t pb[MAC_MAX_PB_PER_MPDU];
+
+ // For noise
+ int transfer_size = 128;
+ int chan_length = ((PHY_CARRIER_NB * sizeof(u16)) + ((4 * transfer_size) - 1 )) / (4 * transfer_size);
+
+ diag_write_string("=> prepare_rx\n");
+
+ /* get parameters content */
+ fcall_param_bind_short(*param, *msg, "fc_mode", &fc_mode);
+ fcall_param_bind(*param, *msg, "short_ppdu", sizeof(bool), &short_ppdu);
+ if (!short_ppdu)
+ {
+ fcall_param_bind_short(*param, *msg, "mod", &mod);
+ fcall_param_bind_short(*param, *msg, "fecrate", &fecrate);
+ fcall_param_bind_short(*param, *msg, "pb_size", &pb_size);
+ fcall_param_bind_short(*param, *msg, "gil", &gil);
+ fcall_param_bind_short(*param, *msg, "pb_nb", &pb_nb);
+ }
+
+ // Activate RX
+ phy_rx_activate(ctx, true /* now */, my_station.current_tick_tck, true /* pre_detection */);
+
+ // Set RX parameters
+ phy_rx_param(ctx, (phy_fc_mode_t)fc_mode);
+
+ // Start PBDMA
+ for (i=0; i<pb_length; i++)
+ {
+ memset(&pb_data[i][0], c, MAC_PB520_BYTES);
+ pb[i].pb_rx.blk.data = &pb_data[i][0];
+ if (i != pb_length-1)
+ {
+ pb[i].pb_rx.blk.next = &pb[i+1].pb_rx.blk;
+ }
+ else
+ {
+ pb[i].pb_rx.blk.next = NULL;
+ }
+ c++;
+ }
+ for (i=0; i<3; i++)
+ {
+ iv[i] = i;
+ }
+ for (i=0; i<4; i++)
+ {
+ nek[i] = i;
+ }
+ phy_pbdma_start(ctx, true /* bypass_aes */, iv,
+ nek, (uint)pb_nb /* nb_total */, (uint)pb_nb /* nb_ready */,
+ (uint)pb_nb /* nb_pb_it */, &pb[0]);
+
+ // Start chandata
+ for (i=0; i<chan_length; i++)
+ {
+ memset(&freq_chan_data[i][0], c, MAC_PB520_BYTES);
+ freq_chan[i].blk.data = &freq_chan_data[i][0];
+ if (i != chan_length-1)
+ {
+ freq_chan[i].blk.next = &freq_chan[i+1].blk;
+ }
+ else
+ {
+ freq_chan[i].blk.next = &time_chan.blk;
+ }
+ freq_chan[i].size = transfer_size;
+ freq_chan[i].last = 0;
+ freq_chan[i].type = PHY_CHANDATA_TYPE_NRJ;
+ freq_chan[i].address = 0;
+ c++;
+ }
+ memset(time_chan_data, c, MAC_PB520_BYTES);
+ time_chan.blk.data = time_chan_data;
+ time_chan.blk.next = NULL;
+ time_chan.size = transfer_size;
+ time_chan.last = 1;
+ time_chan.type = PHY_CHANDATA_TYPE_NRJ_SYMBOL;
+ time_chan.address = 0;
+
+ phy_pbdma_start_chandata(ctx, freq_chan);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int uninit_phy (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> uninit_phy\n");
+
+ // Uninitialize the HAL PHY
+ phy_uninit (ctx);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int main (void)
+{
+ station_log_set_level(&my_station, STATION_LOG_DEBUG);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ fcall_register(my_station.fcall, "set_tonemask", (void*)&set_tonemask, NULL);
+ fcall_register(my_station.fcall, "prepare_rx", (void*)&prepare_rx, NULL);
+ fcall_register(my_station.fcall, "uninit_phy", (void*)&uninit_phy, NULL);
+
+ return 0;
+}
+
diff --git a/cesar/maximus/stationtest/src/test_station.c b/cesar/maximus/stationtest/src/test_station.c
new file mode 100644
index 0000000000..73fe7fcb54
--- /dev/null
+++ b/cesar/maximus/stationtest/src/test_station.c
@@ -0,0 +1,91 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_station.c
+ * \brief station executable used for the test station program
+ * \ingroup
+ */
+
+#include "common/std.h"
+#include "host/station.h" // for 'station_ctx_t'
+#include "cp/beacon/beacons.h" // for 'cp_sta_t'
+#include "cp/station/maximus/inc/maximus_cp_station.h" // for 'maximus_cp_station_init()'
+#include "hal/hle/ipmbox.h"
+#include "hal/hle/defs.h" // for 'HLE_MSG_TYPE_...' and 'ipmbox_msg_hdr_t'
+#include "hal/hle/maximus/inc/maximus_ipmbox_ctx.h" // for 'ipmbox_t'
+#include "hal/hle/maximus/inc/maximus_interrupts.h" // for 'HAL_HLE_INTERRUPT_IPMBOX'
+#include "maximus/common/types/ethernet_types.h" // for 'ETHERNET_TYPE_...'
+
+cp_sta_t cp_sta_global;
+extern station_ctx_t my_station;
+ipmbox_t *ctx;
+int user_data = 123;
+
+void ipmbox_rx_cb (void *user_data, u32 *first_msg, uint length)
+{
+ // Reset IT
+ maximus_pending_isrs &= (0 << HAL_HLE_INTERRUPT_IPMBOX);
+
+ ipmbox_msg_hdr_t *hdr = (ipmbox_msg_hdr_t *)&ctx->rx.mailbox[0];
+ if (HLE_MSG_TYPE_DATA == hdr->type)
+ {
+ /* When receiving an Ether SCI message of type MME REQ from Maximus,
+ * send the answer (an Ether SCI message of type MME CNF). */
+
+ uint data_length = (uint)(hdr->param >> 1);
+ memcpy(ctx->first_buffer->next->data, (u32 *)ctx->rx.mailbox[1], data_length);
+ char *data = (char *)ctx->first_buffer->next->data;
+ *(data + 15) = *(data + 15) + 1; // REQ => CNF
+ *(data + 19) = 0x01; // Success
+ memset(data + 20, '\0', data_length - 20);
+
+ // Release allocated buffer
+ hdr->type = HLE_MSG_TYPE_SEND_DONE;
+ ipmbox_tx (ctx, ctx->rx.mailbox, 2);
+
+ hdr->type = HLE_MSG_TYPE_DATA;
+ hdr->param |= 0x001;
+ ctx->rx.mailbox[1] = (u32)ctx->first_buffer->next->data;
+ ipmbox_tx (ctx, ctx->rx.mailbox, ctx->rx.length);
+ }
+
+ return;
+}
+
+int uninit_ether (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ // Uninitialize the HAL HLE ipmbox
+ ipmbox_uninit (ctx);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+int main (void)
+{
+ station_log_set_level(&my_station, STATION_LOG_WARNING);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ maximus_cp_station_init(&my_station);
+
+ // Initialize the HAL HLE ipmbox
+ ctx = ipmbox_init ((void *)&user_data, &ipmbox_rx_cb);
+
+ // Enable assertions on warnings
+ ctx->warning_assert = true;
+
+ // Activate ipmbox interruptions
+ ipmbox_activate (ctx, true);
+
+ fcall_register(my_station.fcall, "uninit_ether", (void*)&uninit_ether, NULL);
+
+ return 0;
+}
diff --git a/cesar/maximus/stationtest/src/test_tx_rx.c b/cesar/maximus/stationtest/src/test_tx_rx.c
new file mode 100644
index 0000000000..ddd3661f87
--- /dev/null
+++ b/cesar/maximus/stationtest/src/test_tx_rx.c
@@ -0,0 +1,339 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file test_tx_rx.c
+ * \brief station executable used for the test tx rx program
+ * \ingroup
+ */
+
+#include <cyg/infra/diag.h>
+#include <cyg/kernel/kapi.h>
+#include <errno.h>
+#include "common/std.h"
+#include "host/station.h"
+#include "hal/phy/phy.h"
+#include "mac/common/defs.h"
+#include "hal/phy/maximus/inc/maximus_phy_ctx.h" // for 'phy_t'
+#include "hal/phy/maximus/inc/maximus_interrupts.h" // for 'PHY_HAL_INTERRUPT_...'
+
+extern station_ctx_t my_station;
+phy_t * ctx;
+int user_data = 123;
+
+unsigned short fc_mode = 0;
+bool short_ppdu = false;
+unsigned short mod = 0;
+unsigned short fecrate = 0;
+unsigned short pb_size = 0;
+unsigned short gil = 0;
+unsigned short pb_nb = 0;
+
+// For noise
+phy_chandata_t freq_chan[6];
+phy_chandata_t time_chan;
+u8 freq_chan_data[6][MAC_PB520_BYTES];
+u8 time_chan_data[MAC_PB520_BYTES];
+
+
+void start_pbdma (void)
+{
+ diag_write_string("=> start_pbdma\n");
+
+ int i = 0;
+ char c = 0;
+
+ static u32 iv[3];
+ static u32 nek[4];
+
+ // Test with maximum 10 PBs of 512 octets
+ int pb_length = MAC_MAX_PB_PER_MPDU;
+ static u8 pb_data[MAC_MAX_PB_PER_MPDU][MAC_PB520_BYTES];
+ static phy_pb_t pb[MAC_MAX_PB_PER_MPDU];
+
+ // Start PBDMA
+ for (i=0; i<pb_length; i++)
+ {
+ memset(&pb_data[i][0], c, MAC_PB520_BYTES);
+ pb[i].pb_rx.blk.data = &pb_data[i][0];
+ if (i != pb_length-1)
+ {
+ pb[i].pb_rx.blk.next = &pb[i+1].pb_rx.blk;
+ }
+ else
+ {
+ pb[i].pb_rx.blk.next = NULL;
+ }
+ c++;
+ }
+ for (i=0; i<3; i++)
+ {
+ iv[i] = i;
+ }
+ for (i=0; i<4; i++)
+ {
+ nek[i] = i;
+ }
+ phy_pbdma_start(ctx, true /* bypass_aes */, iv,
+ nek, (uint)pb_nb /* nb_total */, (uint)pb_nb /* nb_ready */,
+ (uint)pb_nb /* nb_pb_it */, &pb[0]);
+}
+
+
+void start_pbdma_chandata (void)
+{
+ diag_write_string("=> start_pbdma_chandata\n");
+
+ int i = 0;
+ char c = 0;
+
+ // For noise
+ int transfer_size = 128;
+ int chan_length = ((PHY_CARRIER_NB * sizeof(u16)) + ((4 * transfer_size) - 1 )) / (4 * transfer_size);
+
+ // Time noise
+ memset(time_chan_data, c, MAC_PB520_BYTES);
+ time_chan.blk.data = time_chan_data;
+ time_chan.blk.next = &freq_chan[0].blk;
+ time_chan.size = transfer_size;
+ time_chan.last = 0;
+ time_chan.type = PHY_CHANDATA_TYPE_NRJ_SYMBOL;
+ time_chan.address = 0;
+
+ // Frequency noise
+ for (i=0; i<chan_length; i++)
+ {
+ memset(&freq_chan_data[i][0], c, MAC_PB520_BYTES);
+ freq_chan[i].blk.data = &freq_chan_data[i][0];
+ if (i != chan_length-1)
+ {
+ freq_chan[i].blk.next = &freq_chan[i+1].blk;
+ freq_chan[i].last = 0;
+ }
+ else
+ {
+ freq_chan[i].blk.next = NULL;
+ freq_chan[i].last = 1;
+ }
+ freq_chan[i].size = transfer_size;
+ freq_chan[i].type = PHY_CHANDATA_TYPE_NRJ;
+ freq_chan[i].address = 0;
+ c++;
+ }
+
+ phy_pbdma_start_chandata(ctx, &time_chan);
+}
+
+
+bool phy_rx_fc_cb (void *user, u32 rx_date, const u32 *fc_av)
+{
+ diag_write_string("=> phy_rx_fc_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ // When the FC is received, prepare RX
+ phy_rx_prepare(ctx, short_ppdu, (phy_mod_t)mod,
+ (phy_fecrate_t)fecrate, (phy_pb_size_t)pb_size, (phy_gil_t)gil,
+ 0 /* tonemap_index */, 0 /* symbol_nb */);
+
+ return true;
+}
+
+
+bool phy_access_cb (void *user)
+{
+ diag_write_string("=> phy_access_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ return true;
+}
+
+
+bool phy_access_conf_cb (void *user)
+{
+ diag_write_string("=> phy_access_conf_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ return true;
+}
+
+
+bool phy_pbdma_cb (void *user, u32 status_word)
+{
+ diag_write_string("=> phy_pbdma_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PBDMA);
+
+ phy_pbdma_status_t status = *((phy_pbdma_status_t*)&status_word);
+ if (status.end_rx_pb)
+ {
+ // Set TX parameters
+ phy_tx_param (ctx, ctx->control.rx_param.fc_mode, ctx->control.rx_param.short_ppdu,
+ ctx->control.rx_param.mod, ctx->control.rx_param.fecrate, ctx->control.rx_param.pb_size,
+ ctx->control.rx_param.gil, ctx->control.rx_param.tonemap_index);
+ if (0 != ctx->control.rx_param.fc_10)
+ {
+ phy_tx_fc10 (ctx, ctx->control.rx_param.fc_10);
+ }
+
+ if (!ctx->control.rx_param.short_ppdu)
+ {
+ // Start PBDMA
+ phy_pbdma_start(ctx, ctx->pbdma.bypass_aes, ctx->pbdma.iv,
+ ctx->pbdma.nek, (uint)pb_nb /* nb_total */, (uint)pb_nb /* nb_ready */,
+ (uint)pb_nb /* nb_pb_it */, ctx->pbdma.first_pb);
+ }
+
+ phy_tx_frame (ctx, (u32)my_station.current_tick_tck + PHY_FC_10_PREPARATION_DELAY_TCK,
+ false /* want_conf */, false /* stop_tx_on_prp_lost */, ctx->control.rx_param.fc_av);
+ }
+
+ return true;
+}
+
+
+bool phy_tx_false_alarm_cb (void *user)
+{
+ diag_write_string("=> phy_tx_false_alarm_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ return true;
+}
+
+
+void phy_deferred_cb (void *user)
+{
+ diag_write_string("=> phy_deferred_cb\n");
+
+ return;
+}
+
+
+bool phy_extra_timer_cb (void *user)
+{
+ diag_write_string("=> phy_extra_timer_cb\n");
+
+ // Reset IT
+ maximus_pending_isrs &= (0 << PHY_HAL_INTERRUPT_PHY);
+
+ return true;
+}
+
+
+int set_tonemask (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ u8 tonemask[(PHY_CARRIER_NB+7)/8];
+ blk_t tonemap1;
+ blk_t tonemap2;
+ u8 tonemap1_data[MAC_PB520_BYTES];
+ u8 tonemap2_data[(PHY_CARRIER_NB+1)/2-MAC_PB520_BYTES];
+ int i = 0;
+
+ diag_write_string("=> set_tonemask\n");
+
+ // Initialize the HAL PHY
+ ctx = phy_init ((void *)&user_data, &phy_rx_fc_cb, &phy_access_cb, &phy_access_conf_cb, &phy_pbdma_cb, &phy_tx_false_alarm_cb, &phy_deferred_cb);
+
+ // Enable assertions on warnings
+ ctx->warning_assert = true;
+
+ // Set TONEMASK
+ for (i=0; i<(PHY_CARRIER_NB+7)/8; i++)
+ {
+ tonemask[i] = 0xEE;
+ }
+ phy_set_tonemask(ctx, tonemask, PHY_CARRIER_NB);
+
+ // Set TONEMAP
+ memset(tonemap1_data, 'b', MAC_PB520_BYTES*sizeof(u8));
+ memset(tonemap2_data, 'c', ((PHY_CARRIER_NB+1)/2-MAC_PB520_BYTES)*sizeof(u8));
+ tonemap2.next = NULL;
+ tonemap2.data = tonemap2_data;
+ tonemap1.next = &tonemap2;
+ tonemap1.data = tonemap1_data;
+ phy_set_tonemap(ctx, 0 /* tonemap_index */, &tonemap1);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int prepare_rx (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> prepare_rx\n");
+
+ /* get parameters content */
+ fcall_param_bind_short(*param, *msg, "fc_mode", &fc_mode);
+ fcall_param_bind(*param, *msg, "short_ppdu", sizeof(bool), &short_ppdu);
+ if (!short_ppdu)
+ {
+ fcall_param_bind_short(*param, *msg, "mod", &mod);
+ fcall_param_bind_short(*param, *msg, "fecrate", &fecrate);
+ fcall_param_bind_short(*param, *msg, "pb_size", &pb_size);
+ fcall_param_bind_short(*param, *msg, "gil", &gil);
+ fcall_param_bind_short(*param, *msg, "pb_nb", &pb_nb);
+ }
+
+ // Activate RX
+ phy_rx_activate(ctx, true /* now */, my_station.current_tick_tck, true /* pre_detection */);
+
+ // Set RX parameters
+ phy_rx_param(ctx, (phy_fc_mode_t)fc_mode);
+
+ if (!short_ppdu)
+ {
+ // Start PBDMA
+ start_pbdma();
+
+ // Start PBDMA chandata
+ start_pbdma_chandata();
+ }
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int uninit_phy (fcall_ctx_t *fcall, fcall_param_t **param, sci_msg_t **msg, void *data)
+{
+ diag_write_string("=> uninit_phy\n");
+
+ // Uninitialize the HAL PHY
+ phy_uninit (ctx);
+
+ /* now make the return parameter list */
+ fcall_param_reset(*param);
+
+ return 0;
+}
+
+
+int main (void)
+{
+ station_log_set_level(&my_station, STATION_LOG_DEBUG);
+ station_log_set_mask(&my_station, STATION_LOGTYPE_ALL);
+ my_station.pipe_log_fd = 1;
+
+ fcall_register(my_station.fcall, "set_tonemask", (void*)&set_tonemask, NULL);
+ fcall_register(my_station.fcall, "prepare_rx", (void*)&prepare_rx, NULL);
+ fcall_register(my_station.fcall, "uninit_phy", (void*)&uninit_phy, NULL);
+
+ return 0;
+}
+
diff --git a/cesar/maximus/stationtest/src/threaddelay.c b/cesar/maximus/stationtest/src/threaddelay.c
new file mode 100644
index 0000000000..f03a12f7ad
--- /dev/null
+++ b/cesar/maximus/stationtest/src/threaddelay.c
@@ -0,0 +1,50 @@
+/* Cesar project {{{
+ *
+ * Copyright (C) 2007 Spidcom
+ *
+ * <<<Licence>>>
+ *
+ * }}} */
+/**
+ * \file threaddelay.c
+ * \brief test program for eCos compilation
+ * \ingroup
+ *
+ * this is a test program to check eCos well work with the tick timer
+ */
+
+#include <cyg/kernel/kapi.h>
+#include <cyg/infra/diag.h>
+
+#define MY_THREAD_STACK_SIZE (2048 / sizeof(int))
+
+int my_thread_stack[MY_THREAD_STACK_SIZE];
+cyg_handle_t my_thread_handle;
+cyg_thread my_thread_obj;
+
+void my_thread(cyg_addrword_t index)
+{
+ unsigned long my_counter = 0;
+ diag_write_string("my thread started\n");
+ while(1)
+ {
+ diag_printf("count=%ld, time=%lld\n",my_counter, cyg_current_time());
+ cyg_thread_delay(1000); //wait 10 seconds (1000 ecos ticks)
+ my_counter++;
+ }
+}
+
+void cyg_user_start(void)
+{
+
+ cyg_thread_create(12, my_thread, (cyg_addrword_t) 0,
+ "My Thread", &my_thread_stack, MY_THREAD_STACK_SIZE,
+ &my_thread_handle, &my_thread_obj);
+
+ cyg_thread_resume(my_thread_handle);
+
+ diag_write_string("Starting Scheduler... ");
+
+ cyg_scheduler_start();
+}
+
diff --git a/cesar/maximus/system/Module b/cesar/maximus/system/Module
new file mode 100644
index 0000000000..e911dbaf21
--- /dev/null
+++ b/cesar/maximus/system/Module
@@ -0,0 +1,5 @@
+SOURCES := Station.cpp StationConfiguration.cpp SystemManager.cpp SystemSciMsg.cpp
+ifdef UNITTEST
+SOURCES += SystemManagerTest.cpp StationTest.cpp StationConfigurationTest.cpp SystemSciMsgTest.cpp
+endif
+HOST_INCLUDES += maximus/system/inc
diff --git a/cesar/maximus/system/inc/ISystem.h b/cesar/maximus/system/inc/ISystem.h
new file mode 100644
index 0000000000..4d1ef885c2
--- /dev/null
+++ b/cesar/maximus/system/inc/ISystem.h
@@ -0,0 +1,158 @@
+/************************************************************************
+ ISystem.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/common/interfaces/ISystem.h
+**************************************************************************/
+
+#ifndef ISYSTEM_H
+#define ISYSTEM_H
+
+#include "sci_types.h"
+#include "system_types.h"
+
+#include <list>
+
+class Station;
+class INetworkClock;
+class SystemSciMsg;
+
+typedef std::list<Station*> StationsList;
+
+
+/**
+ * class ISystem
+ */
+
+class ISystem
+{
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Empty Constructor
+ */
+ ISystem ( ) { }
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~ISystem ( ) { }
+
+ // public methods
+ //
+
+ /**
+ * Indicate the default station executable to run when creating a station
+ * @return bool
+ * @param default_station_executable the new value of mDefaultStationExecutable
+ * @param debugger the new value of mDebugger
+ */
+ virtual bool init ( const std::string & default_station_executable, const std::string & debugger ) = 0;
+
+ /**
+ * @return Sci_Msg_Station_Id
+ */
+ virtual Sci_Msg_Station_Id createStation ( const std::string & station_executable ) = 0;
+
+ /**
+ * @return bool
+ * @param system_sci_msg
+ */
+ virtual bool receiveIdleMsg ( const SystemSciMsg & system_sci_msg ) const = 0;
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ virtual bool removeStation ( Sci_Msg_Station_Id station_id ) = 0;
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ virtual bool deactivateStation ( Sci_Msg_Station_Id station_id ) = 0;
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ virtual bool activateStation ( Sci_Msg_Station_Id station_id ) = 0;
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ virtual bool debugStation ( const Sci_Msg_Station_Id station_id ) = 0;
+
+ /**
+ * @return bool
+ */
+ virtual bool isStationIdle ( Sci_Msg_Station_Id station_id ) const = 0;
+
+ /**
+ * @return bool
+ * @param station_id
+ * @param new_status
+ */
+ virtual bool updateStationStatus ( const Sci_Msg_Station_Id station_id, const Station_Status new_status ) = 0;
+
+ /**
+ * Get the value of mListOfStations
+ * @return the value of mListOfStations
+ */
+ virtual StationsList * getListOfStations ( ) = 0;
+
+ /**
+ * @return bool
+ */
+ virtual bool areAllActiveStationsIdle ( ) const = 0;
+
+ /**
+ * @return bool
+ * @param p_network_clock the new value of mpNetworkClock
+ */
+ virtual bool setNetworkClock ( INetworkClock * p_network_clock ) = 0;
+
+ /**
+ * @return mDefaultStationExecutable
+ */
+ virtual const std::string & getDefaultStationExecutable ( ) const = 0;
+
+ /**
+ * @return bool
+ * @param station_id the station ID
+ * @param station_name the new value of the station name
+ */
+ virtual bool setStationName ( const Sci_Msg_Station_Id station_id, const std::string & station_name ) = 0;
+
+};
+
+
+#endif // ISYSTEM_H
diff --git a/cesar/maximus/system/inc/Station.h b/cesar/maximus/system/inc/Station.h
new file mode 100644
index 0000000000..f3f9954cb5
--- /dev/null
+++ b/cesar/maximus/system/inc/Station.h
@@ -0,0 +1,233 @@
+/************************************************************************
+ Station.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/inc/Station.h
+**************************************************************************/
+
+#ifndef STATION_H
+#define STATION_H
+
+#include "system_types.h"
+#include "sci_types.h"
+#include "networkclock_types.h" // for 'Network_Clock_Tick'
+
+#include <exception>
+#include <string>
+#include <iostream> // for 'cout', 'cerr', 'clog' and 'pid_t'
+
+#define STATION_PIPE_PATH "/tmp"
+#define STATION_PIPE_PREFIX "station"
+#define STATION_SOCK_PATH STATION_PIPE_PATH
+#define STATION_SOCK_PREFIX STATION_PIPE_PREFIX
+#define STATION_WAIT_LOOP_NB 10
+#define STATION_WAIT_TIMEOUT_MS 100
+#define STATION_MAX_SOCK_BUFFER_SIZE (256*1024)
+
+class StationConfiguration;
+
+
+/**
+ * class Station
+ */
+
+class Station
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ File_Descriptor mInputFileDescriptor, mOutputFileDescriptor;
+ File_Descriptor mLogPipe;
+ pid_t mPid;
+ Station_Status mStationStatus;
+ unsigned short int mStationIdleCounter;
+ StationConfiguration * mpStationConfiguration;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ Station ( const std::string & station_executable, const Network_Clock_Tick current_tick_value );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~Station ( );
+
+ // public methods
+ //
+
+ bool operator== ( const Station & station ) const;
+
+ Station & operator= ( const Station & station );
+
+ /**
+ * @return void
+ */
+ void displayStation ( ) const;
+
+ bool launchDebugger ( const std::string & command_line ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return Sci_Station_Id
+ */
+ const Sci_Msg_Station_Id getStationId ( ) const;
+
+ /**
+ * @return pid_t
+ */
+ const pid_t getPid ( ) const;
+
+ /**
+ * @return bool
+ * @param input_file_descriptor
+ */
+ bool setInputFileDescriptor ( const File_Descriptor input_file_descriptor );
+
+ /**
+ * @return bool
+ * @param output_file_descriptor
+ */
+ bool setOutputFileDescriptor ( const File_Descriptor output_file_descriptor );
+
+ /**
+ * @return bool
+ * @param log_file_descriptor
+ */
+ bool setLogFileDescriptor ( const File_Descriptor log_file_descriptor );
+
+ /**
+ * @return File_Descriptor
+ */
+ const File_Descriptor getInputFileDescriptor ( ) const;
+
+ /**
+ * @return File_Descriptor
+ */
+ const File_Descriptor getOutputFileDescriptor ( ) const;
+
+ /**
+ * @return File_Descriptor
+ */
+ const File_Descriptor getLogFileDescriptor ( ) const;
+
+ /**
+ * @return Station_Status
+ */
+ Station_Status getStationStatus ( ) const;
+
+ /**
+ * @return bool
+ * @param status
+ */
+ bool setStationStatus ( const Station_Status status );
+
+ /**
+ * @return mStationIdleCounter
+ */
+ const unsigned short int getStationIdleCounter ( ) const;
+
+ /**
+ * @return bool
+ */
+ bool incrementStationIdleCounter ( );
+
+ /**
+ * @return bool
+ */
+ bool decrementStationIdleCounter ( );
+
+ /**
+ * @return bool
+ * @param p_station_configuration
+ */
+ bool setStationConfiguration ( StationConfiguration * p_station_configuration );
+
+ /**
+ * @return StationConfiguration
+ */
+ StationConfiguration * getStationConfiguration ( ) const;
+
+ /**
+ * @return bool
+ * @param station_name the new value of mpStationConfiguration->mStationName
+ */
+ bool setStationName ( const std::string & station_name );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ /**
+ * @return void
+ */
+ void startProcess ( const Network_Clock_Tick current_tick_value );
+
+ /**
+ * @return void
+ */
+ void stopProcess ( );
+
+ void initAttributes ( );
+
+ void displayStationStatus ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // STATION_H
diff --git a/cesar/maximus/system/inc/StationConfiguration.h b/cesar/maximus/system/inc/StationConfiguration.h
new file mode 100644
index 0000000000..2525ec116f
--- /dev/null
+++ b/cesar/maximus/system/inc/StationConfiguration.h
@@ -0,0 +1,130 @@
+/************************************************************************
+ StationConfiguration.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/inc/StationConfiguration.h
+**************************************************************************/
+
+#ifndef STATIONCONFIGURATION_H
+#define STATIONCONFIGURATION_H
+
+#include "system_types.h"
+
+#include <string>
+
+
+/**
+ * class StationConfiguration
+ */
+
+class StationConfiguration
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ std::string mStationExecutable;
+ std::string mStationName;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ StationConfiguration ( std::string & station_executable, std::string station_name = std::string("station") );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~StationConfiguration ( );
+
+ // public methods
+ //
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Set the station executable.
+ * @param station_executable the new value of mStationExecutable
+ */
+ bool setStationExecutable ( const std::string & station_executable );
+
+ /**
+ * Get the station executable.
+ * @return mStationExecutable
+ */
+ const std::string & getStationExecutable ( ) const;
+
+ /**
+ * Set the station name.
+ * @param station_name the new vale of mStationName
+ */
+ bool setStationName ( const std::string & station_name );
+
+ /**
+ * Get the station name.
+ * @return mStationName
+ */
+ const std::string & getStationName ( ) const;
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( );
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // STATIONCONFIGURATION_H
diff --git a/cesar/maximus/system/inc/StationConfigurationTest.h b/cesar/maximus/system/inc/StationConfigurationTest.h
new file mode 100644
index 0000000000..958857ffce
--- /dev/null
+++ b/cesar/maximus/system/inc/StationConfigurationTest.h
@@ -0,0 +1,34 @@
+
+#ifndef STATIONCONFIGURATIONTEST_H
+#define STATIONCONFIGURATIONTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class StationConfiguration;
+
+
+class StationConfigurationTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (StationConfigurationTest);
+ CPPUNIT_TEST (setStationNameTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void setStationNameTest (void);
+
+private:
+
+ StationConfiguration * mpStationConfiguration;
+
+};
+
+
+#endif // STATIONCONFIGURATIONTEST_H
diff --git a/cesar/maximus/system/inc/StationTest.h b/cesar/maximus/system/inc/StationTest.h
new file mode 100644
index 0000000000..67eb7b874f
--- /dev/null
+++ b/cesar/maximus/system/inc/StationTest.h
@@ -0,0 +1,34 @@
+
+#ifndef STATIONTEST_H
+#define STATIONTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class Station;
+
+
+class StationTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (StationTest);
+ CPPUNIT_TEST (setStationNameTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void setStationNameTest (void);
+
+private:
+
+ Station * mpStation;
+
+};
+
+
+#endif // STATIONCONFIGURATIONTEST_H
diff --git a/cesar/maximus/system/inc/SystemManager.h b/cesar/maximus/system/inc/SystemManager.h
new file mode 100644
index 0000000000..8ba84e94d9
--- /dev/null
+++ b/cesar/maximus/system/inc/SystemManager.h
@@ -0,0 +1,229 @@
+/************************************************************************
+ SystemManager.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/inc/SystemManager.h
+**************************************************************************/
+
+#ifndef SYSTEMMANAGER_H
+#define SYSTEMMANAGER_H
+
+#include "ISystem.h"
+
+#include "sci_types.h"
+#include "system_types.h"
+
+#include <string>
+
+class Station;
+class ISci;
+class SystemSciMsg;
+class INetworkClock;
+
+
+/**
+ * class SystemManager
+ */
+
+class SystemManager : public ISystem
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ StationsList mListOfStations;
+ ISci * mpSciServer;
+ std::string mDefaultStationExecutable;
+ std::string mDebugger;
+
+ INetworkClock * mpNetworkClock;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ SystemManager ( ISci * p_sci_server );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~SystemManager ( );
+
+ // public methods
+ //
+
+ /**
+ * Indicate the default station executable to run when creating a station
+ * @return bool
+ * @param default_station_executable the new value of mDefaultStationExecutable
+ * @param debugger the new value of mDebugger
+ */
+ bool init ( const std::string & default_station_executable, const std::string & debugger );
+
+ /**
+ * @return Sci_Msg_Station_Id
+ */
+ Sci_Msg_Station_Id createStation ( const std::string & station_executable );
+
+ /**
+ * @return bool
+ * @param system_sci_msg
+ */
+ bool receiveIdleMsg ( const SystemSciMsg & system_sci_msg ) const;
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ bool removeStation ( const Sci_Msg_Station_Id station_id );
+
+ /**
+ * @return bool
+ */
+ bool removeAllStations ( );
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ bool deactivateStation ( const Sci_Msg_Station_Id station_id );
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ bool activateStation ( const Sci_Msg_Station_Id station_id );
+
+ /**
+ * @return bool
+ * @param station_id
+ */
+ bool debugStation ( const Sci_Msg_Station_Id station_id );
+
+ /**
+ * @return bool
+ */
+ bool isStationIdle ( Sci_Msg_Station_Id station_id ) const;
+
+ /**
+ * @return bool
+ */
+ bool areAllActiveStationsIdle ( ) const;
+
+ /**
+ * @return Station_Status
+ * @param station_id
+ */
+ Station_Status getStationStatus ( const Sci_Msg_Station_Id station_id ) const;
+
+ /**
+ * @return bool
+ * @param station_id
+ * @param new_status
+ */
+ bool updateStationStatus ( const Sci_Msg_Station_Id station_id, const Station_Status new_status );
+
+ /**
+ * @return bool
+ * @param p_network_clock the new value of mpNetworkClock
+ */
+ bool setNetworkClock ( INetworkClock * p_network_clock );
+
+ /**
+ * @return mDefaultStationExecutable
+ */
+ const std::string & getDefaultStationExecutable ( ) const;
+
+ /**
+ * @return bool
+ * @param station_id the station ID
+ * @param station_name the new value of the station name
+ */
+ bool setStationName ( const Sci_Msg_Station_Id station_id, const std::string & station_name );
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * Get the value of mListOfStations
+ * @return the value of mListOfStations
+ */
+ StationsList * getListOfStations ( );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void displayListOfStations ( ) const;
+
+ void initAttributes ( ) ;
+
+ void registerSystemSciMsg ( );
+
+ Station * findStation ( const Sci_Msg_Station_Id station_id ) const;
+
+ /**
+ * @return mDebugger
+ */
+ const std::string getDebugger ( ) const;
+
+ /**
+ * @return a pointer to Network Clock Processor
+ */
+ INetworkClock * getNetworkClock ( ) const;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // SYSTEMMANAGER_H
diff --git a/cesar/maximus/system/inc/SystemManagerTest.h b/cesar/maximus/system/inc/SystemManagerTest.h
new file mode 100644
index 0000000000..6c902dc679
--- /dev/null
+++ b/cesar/maximus/system/inc/SystemManagerTest.h
@@ -0,0 +1,52 @@
+
+#ifndef SYSTEMMANAGERTEST_H
+#define SYSTEMMANAGERTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class SystemManager;
+class SciServer;
+class IFunctionCall;
+class IPhy;
+class IEthernet;
+class INetworkClock;
+
+
+class SystemManagerTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (SystemManagerTest);
+ CPPUNIT_TEST (createStationTest);
+ CPPUNIT_TEST (removeStationTest);
+ CPPUNIT_TEST (areAllActiveStationsIdleTest);
+ CPPUNIT_TEST (setNetworkClockTest);
+ CPPUNIT_TEST (setStationNameTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void createStationTest (void);
+ void removeStationTest (void);
+ void areAllActiveStationsIdleTest (void);
+ void setNetworkClockTest (void);
+ void setStationNameTest (void);
+
+ private:
+
+ SystemManager * mpSystemManager;
+ SciServer * mpSciServer;
+ IFunctionCall * mpFunctionCall;
+ IPhy * mpPhy;
+ IEthernet * mpEthernet;
+ INetworkClock * mpNetworkClock;
+
+};
+
+
+#endif // SYSTEMMANAGERTEST_H
diff --git a/cesar/maximus/system/inc/SystemSciMsg.h b/cesar/maximus/system/inc/SystemSciMsg.h
new file mode 100644
index 0000000000..c525c12896
--- /dev/null
+++ b/cesar/maximus/system/inc/SystemSciMsg.h
@@ -0,0 +1,170 @@
+/************************************************************************
+ SystemSciMsg.h - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.h
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/inc/SystemSciMsg.h
+**************************************************************************/
+
+#ifndef SYSTEMSCIMSG_H
+#define SYSTEMSCIMSG_H
+
+#include "SciMsg.h"
+
+#include "system_types.h"
+
+class ISystem;
+
+
+/**
+ * class SystemSciMsg
+ */
+
+class SystemSciMsg : public SciMsg
+{
+
+public:
+
+ // public attributes
+ //
+
+private:
+
+ // private attributes
+ //
+
+ // For specialized SCI msg header
+ //
+ System_Type mSpecializedSciMsgType;
+
+ // Specialized SCI msg header
+ //
+ System_Header mSpecializedSciMsgHeader;
+
+ ISystem * mpSystemManager;
+
+protected:
+
+ // protected attributes
+ //
+
+public:
+
+ // Constructors/Destructors
+ //
+
+ /**
+ * Constructor
+ */
+ SystemSciMsg ( ISystem * p_system_manager );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~SystemSciMsg ( );
+
+ // public methods
+ //
+
+ /**
+ * @return SciMsg *
+ */
+ SciMsg * create ( ) const;
+
+ /**
+ * @return bool
+ */
+ bool dispatchMsg ( );
+
+ /**
+ * @return bool
+ */
+ bool identifySpecializedSciMsgHeader ( );
+
+ /**
+ * @return bool
+ */
+ bool checkCompatibility ( ) const;
+
+ void displaySpecializedSciMsgHeader ( ) const;
+
+ /**
+ * Display the specialized SCI message type.
+ */
+ void displaySpecializedSciMsgType ( int log_level ) const;
+
+ // public attribute accessor methods
+ //
+
+ // private attribute accessor methods
+ //
+
+ /**
+ * @return mSpecializedSciMsgType
+ */
+ System_Type getSpecializedSciMsgType ( ) const;
+
+ /**
+ * @return bool
+ * @param type the new value of mSpecializedSciMsgType
+ */
+ bool setSpecializedSciMsgType ( const System_Type type );
+
+ /**
+ * Get the value of mSpecializedSciMsgHeader
+ * @return the value of mSpecializedSciMsgHeader into a void pointer
+ */
+ void * returnSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * @return mSpecializedSciMsgHeader
+ */
+ const System_Header & getSpecializedSciMsgHeader ( ) const;
+
+ /**
+ * @return bool
+ * @param specialized_sci_msg_header the new value of mSpecializedSciMsgHeader
+ */
+ bool setSpecializedSciMsgHeader ( const System_Header & specialized_sci_msg_header );
+
+ // protected attribute accessor methods
+ //
+
+private:
+
+ // private methods
+ //
+
+ void initAttributes ( ) ;
+
+protected:
+
+ // protected methods
+ //
+
+};
+
+
+#endif // SYSTEMSCIMSG_H
diff --git a/cesar/maximus/system/inc/SystemSciMsgTest.h b/cesar/maximus/system/inc/SystemSciMsgTest.h
new file mode 100644
index 0000000000..0a94179f3a
--- /dev/null
+++ b/cesar/maximus/system/inc/SystemSciMsgTest.h
@@ -0,0 +1,38 @@
+
+#ifndef SYSTEMSCIMSGTEST_H
+#define SYSTEMSCIMSGTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class SystemSciMsg;
+class SystemManager;
+class SciServer;
+
+
+class SystemSciMsgTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (SystemSciMsgTest);
+ CPPUNIT_TEST (dispatchMsgTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void dispatchMsgTest (void);
+
+private:
+
+ SystemSciMsg * mpSystemSciMsg;
+ SystemManager * mpSystemManager;
+ SciServer * mpSciServer;
+
+};
+
+
+#endif // SYSTEMSCIMSGTEST_H
diff --git a/cesar/maximus/system/src/Station.cpp b/cesar/maximus/system/src/Station.cpp
new file mode 100644
index 0000000000..91792630f1
--- /dev/null
+++ b/cesar/maximus/system/src/Station.cpp
@@ -0,0 +1,555 @@
+/************************************************************************
+ Station.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/src/Station.cpp
+**************************************************************************/
+
+#include "Station.h"
+
+#include "StationConfiguration.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include "host/socket.h" // for 'STATION_SOCK'
+
+#include <sys/types.h> // for 'waitpid()'
+#include <sys/wait.h> // for 'waitpid()'
+#include <fcntl.h>
+#include <unistd.h> // for 'exec()' and 'system()'
+#include <sys/signal.h>
+#include <sys/socket.h>
+#include <sys/un.h>
+#include <errno.h>
+#include <iomanip> // for 'setfill()' and 'setw()'
+using namespace std;
+
+extern bool UNITTEST;
+extern string stationTest;
+
+
+// Constructors/Destructors
+//
+
+
+Station::Station ( const string & station_executable, const Network_Clock_Tick current_tick_value ):
+mInputFileDescriptor(-1),
+mOutputFileDescriptor(-1),
+mLogPipe(-1),
+mPid(0),
+mStationStatus(MAXIMUS_STATION_STATUS_NONE),
+mStationIdleCounter(1), // once a station has been launched, Maximus has to wait for a system IDLE message
+mpStationConfiguration(NULL)
+{
+ logFunction();
+ string stationExecutable = station_executable;
+
+ if (UNITTEST)
+ {
+ stationExecutable = stationTest;
+ }
+
+ mpStationConfiguration = new StationConfiguration (stationExecutable);
+ if (NULL == mpStationConfiguration)
+ {
+ throw Error(__PRETTY_FUNCTION__ , "Station configuration pointer is NULL");
+ }
+
+ initAttributes();
+
+ startProcess(current_tick_value);
+}
+
+
+void Station::initAttributes ( )
+{
+ logFunction();
+}
+
+
+Station::~Station ( )
+{
+ logFunction();
+ clog << logger(LOG_COM) << "delete station " \
+ << getStationId() << " (0x" << setfill('0') << setw(4) << uppercase << hex << getStationId() << ")" << dec << endl;
+
+ stopProcess();
+ if (NULL != mpStationConfiguration)
+ {
+ delete (mpStationConfiguration);
+ mpStationConfiguration = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool Station::operator== ( const Station & station ) const
+{
+ logFunction();
+ bool bOperator = false;
+
+ if ( (getStationStatus() == station.getStationStatus())
+ && (getStationConfiguration() == station.getStationConfiguration())
+ && (getInputFileDescriptor() == station.getInputFileDescriptor())
+ && (getOutputFileDescriptor() == station.getOutputFileDescriptor())
+ && (getLogFileDescriptor() == station.getLogFileDescriptor())
+ && (getStationId() == station.getStationId()) )
+ {
+ bOperator = true;
+ }
+
+ return bOperator;
+}
+
+
+Station & Station::operator= ( const Station & station )
+{
+ logFunction();
+
+ if ( (!setInputFileDescriptor (station.getInputFileDescriptor()))
+ || (!setOutputFileDescriptor (station.getOutputFileDescriptor()))
+ || (!setLogFileDescriptor (station.getLogFileDescriptor()))
+ || (!setStationStatus (station.getStationStatus()))
+ || (!setStationConfiguration (station.getStationConfiguration())) )
+ {
+ throw Error(__PRETTY_FUNCTION__ , "Error when setting attributes");
+ }
+
+ return *this;
+}
+
+
+void Station::displayStation ( ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "\t[input file descriptor = " << dec << getInputFileDescriptor() \
+ << ", output file descriptor = " << getOutputFileDescriptor() \
+ << ", log file descriptor = " << getLogFileDescriptor() \
+ << ", process id = " << getStationId() << " (0x" << setfill('0') << setw(4) << uppercase << hex << getStationId() << ")" \
+ << ", executable = " << getStationConfiguration()->getStationExecutable() \
+ << ", name = " << getStationConfiguration()->getStationName() << "]" << dec << endl;
+}
+
+
+bool Station::launchDebugger ( const string & command_line ) const
+{
+ logFunction();
+ bool bLaunch = false;
+
+ string commandLine(command_line);
+ size_t found = 0;
+
+ do
+ {
+ found = commandLine.find("%n", found, 2);
+ if (string::npos != found)
+ {
+ commandLine.replace(found, 2, getStationConfiguration()->getStationName());
+ }
+ }
+ while (found != string::npos);
+
+ found = 0;
+ do
+ {
+ found = commandLine.find("%e", found, 2);
+ if (string::npos != found)
+ {
+ commandLine.replace(found, 2, getStationConfiguration()->getStationExecutable());
+ }
+ }
+ while (found != string::npos);
+
+ found = 0;
+ do
+ {
+ found = commandLine.find("%p", found, 2);
+ if (string::npos != found)
+ {
+ char processId[6];
+ sprintf(processId, "%d", getPid());
+ commandLine.replace(found, 2, processId);
+ }
+ }
+ while (found != string::npos);
+
+ clog << logger(LOG_INFO) << "debugger command line = " << commandLine << endl;
+
+ system(commandLine.c_str());
+
+ return bLaunch;
+}
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+const Sci_Msg_Station_Id Station::getStationId ( ) const
+{
+ return static_cast<Sci_Msg_Station_Id>(mPid);
+}
+
+
+const pid_t Station::getPid ( ) const
+{
+ return mPid;
+}
+
+
+bool Station::setInputFileDescriptor ( const File_Descriptor input_file_descriptor )
+{
+ mInputFileDescriptor = input_file_descriptor;
+
+ return true;
+}
+
+
+bool Station::setOutputFileDescriptor ( const File_Descriptor output_file_descriptor )
+{
+ mOutputFileDescriptor = output_file_descriptor;
+
+ return true;
+}
+
+
+bool Station::setLogFileDescriptor ( const File_Descriptor log_file_descriptor )
+{
+ mLogPipe = log_file_descriptor;
+
+ return true;
+}
+
+
+const File_Descriptor Station::getInputFileDescriptor ( ) const
+{
+ return mInputFileDescriptor;
+}
+
+
+const File_Descriptor Station::getOutputFileDescriptor ( ) const
+{
+ return mOutputFileDescriptor;
+}
+
+
+const File_Descriptor Station::getLogFileDescriptor ( ) const
+{
+ return mLogPipe;
+}
+
+
+Station_Status Station::getStationStatus ( ) const
+{
+ return mStationStatus;
+}
+
+
+bool Station::setStationStatus ( const Station_Status status )
+{
+ mStationStatus = status;
+
+ return true;
+}
+
+
+const unsigned short int Station::getStationIdleCounter ( ) const
+{
+ return mStationIdleCounter;
+}
+
+
+bool Station::incrementStationIdleCounter ( )
+{
+ mStationIdleCounter++;
+
+ return true;
+}
+
+
+bool Station::decrementStationIdleCounter ( )
+{
+ logFunction();
+ bool bDecrement = false;
+
+ if (0 < mStationIdleCounter)
+ {
+ mStationIdleCounter--;
+ bDecrement = true;
+ }
+ else
+ {
+ clog << logger(LOG_WARNING) << "station with id " << dec << getStationId() \
+ << " (0x" << setfill('0') << setw(4) << uppercase << hex << getStationId() \
+ << ") is already IDLE" << dec << endl;
+ }
+
+ return bDecrement;
+}
+
+
+bool Station::setStationConfiguration ( StationConfiguration * p_station_configuration )
+{
+ logFunction();
+ bool bSetConfig = false;
+
+ if (NULL != p_station_configuration)
+ {
+ mpStationConfiguration = p_station_configuration;
+ bSetConfig = true;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__ , "Station configuration pointer is NULL", errno);
+ }
+
+ return bSetConfig;
+}
+
+
+StationConfiguration * Station::getStationConfiguration ( ) const
+{
+ if (NULL == mpStationConfiguration)
+ {
+ throw Error(__PRETTY_FUNCTION__ , "Station configuration pointer is NULL");
+ }
+
+ return mpStationConfiguration;
+}
+
+
+bool Station::setStationName ( const std::string & station_name )
+{
+ return getStationConfiguration()->setStationName(station_name);
+}
+
+
+// private methods
+//
+
+
+void Station::startProcess ( const Network_Clock_Tick current_tick_value )
+{
+ logFunction();
+
+ // Start the station process
+ //
+ if(getStationConfiguration()->getStationExecutable().empty())
+ {
+ throw Error(__PRETTY_FUNCTION__, "Executable not set", errno);
+ }
+ if(0 == (mPid = fork()))
+ {
+ char stationExecutable[getStationConfiguration()->getStationExecutable().size()+1];
+ size_t stringLength = getStationConfiguration()->getStationExecutable().copy(stationExecutable, getStationConfiguration()->getStationExecutable().size());
+ stationExecutable[stringLength] = '\0';
+
+ char currentTickValue[32];
+ sprintf(currentTickValue, "%llu", current_tick_value);
+
+ if (-1 == execlp(stationExecutable, stationExecutable, currentTickValue, NULL))
+ {
+ throw Error(__PRETTY_FUNCTION__, "Cannot launch station executable", errno);
+ }
+ exit(1);
+ }
+
+ // Loop until pipe creation: max = STATION_WAIT_LOOP_NB * STATION_WAIT_TIMEOUT_MS ms
+ //
+ int loop;
+ int fd_status;
+ char nameBuffer[256];
+
+ #ifdef STATION_SOCK
+
+ struct sockaddr_un sockaddr;
+ int bufsize = STATION_MAX_SOCK_BUFFER_SIZE;
+ sprintf(nameBuffer, "%s/%s_sock_%d", STATION_SOCK_PATH, STATION_SOCK_PREFIX, getPid());
+ // open the socket
+ if((mInputFileDescriptor = socket (PF_UNIX, SOCK_STREAM, 0)) < 0)
+ {
+ throw Error(__FUNCTION__ , "Cannot create socket", errno);
+ }
+
+ // avoid other stations to inherit the socket
+ fd_status = fcntl(mInputFileDescriptor, F_GETFD);
+ fcntl(mInputFileDescriptor, F_SETFD, fd_status | FD_CLOEXEC);
+
+ // extend send buffer size
+ if(setsockopt (mInputFileDescriptor, SOL_SOCKET, SO_SNDBUF, &bufsize, sizeof(bufsize)) < 0)
+ {
+ throw Error(__FUNCTION__ , "Cannot increase buffer size", errno);
+ }
+ sockaddr.sun_family = AF_UNIX;
+ strcpy (sockaddr.sun_path, nameBuffer);
+
+ for(loop = 0; loop < STATION_WAIT_LOOP_NB; loop++)
+ {
+ // Connect to server
+ //
+ if((connect(mInputFileDescriptor, (struct sockaddr *)&sockaddr, sizeof(sockaddr))) >= 0)
+ {
+ break;
+ }
+ usleep(STATION_WAIT_TIMEOUT_MS * 1000);
+ }
+
+ if(loop >= STATION_WAIT_LOOP_NB)
+ {
+ stopProcess();
+ throw Error(__FUNCTION__ , "Cannot connect to station", errno);
+ }
+ else
+ {
+ setOutputFileDescriptor(mInputFileDescriptor);
+ }
+
+ #else /* !STATION_SOCK */
+
+ // Open input pipe
+ sprintf(nameBuffer, "%s/%s_out_%d", STATION_PIPE_PATH, STATION_PIPE_PREFIX, getPid());
+ for(loop = 0; loop < STATION_WAIT_LOOP_NB; loop++)
+ {
+ // Connect to server
+ //
+ if((mInputFileDescriptor = open(nameBuffer, O_RDONLY | O_NONBLOCK)) >= 0)
+ {
+ break;
+ }
+ usleep(STATION_WAIT_TIMEOUT_MS * 1000);
+ }
+ if(loop >= STATION_WAIT_LOOP_NB)
+ {
+ stopProcess();
+ throw Error(__FUNCTION__ , "Cannot connect to station", errno);
+ }
+
+ // avoid other stations to inherit the pipe
+ fd_status = fcntl(mInputFileDescriptor, F_GETFD);
+ fcntl(mInputFileDescriptor, F_SETFD, fd_status | FD_CLOEXEC);
+
+ // Open output pipe
+ sprintf(nameBuffer, "%s/%s_in_%d", STATION_PIPE_PATH, STATION_PIPE_PREFIX, getPid());
+ if((mOutputFileDescriptor = open(nameBuffer, O_WRONLY | O_NONBLOCK)) < 0)
+ {
+ stopProcess();
+ throw Error(__PRETTY_FUNCTION__, "Cannot open output pipe", errno);
+ }
+ // avoid other stations to inherit the pipe
+ fd_status = fcntl(mOutputFileDescriptor, F_GETFD);
+ fcntl(mOutputFileDescriptor, F_SETFD, fd_status | FD_CLOEXEC);
+
+ #endif /* STATION_SOCK */
+
+ // Open log pipe
+ //
+ sprintf(nameBuffer, "%s/%s_log_%d", STATION_PIPE_PATH, STATION_PIPE_PREFIX, getPid());
+ if((mLogPipe = open(nameBuffer, O_RDONLY | O_NONBLOCK)) < 0)
+ {
+ stopProcess();
+ throw Error(__PRETTY_FUNCTION__, "Cannot open log pipe", errno);
+ }
+
+ // avoid other stations to inherit the pipe
+ fd_status = fcntl(mLogPipe, F_GETFD);
+ fcntl(mLogPipe, F_SETFD, fd_status | FD_CLOEXEC);
+}
+
+
+void Station::stopProcess ( )
+{
+ logFunction();
+ if(mInputFileDescriptor >= 0)
+ {
+ close(mInputFileDescriptor);
+ }
+ if(mOutputFileDescriptor >= 0)
+ {
+ close(mOutputFileDescriptor);
+ }
+ if(mLogPipe >= 0)
+ {
+ close(mLogPipe);
+ }
+ if(mPid > 0)
+ {
+ kill(mPid, SIGTERM);
+ waitpid(mPid, NULL, 0);
+ }
+}
+
+
+void Station::displayStationStatus ( ) const
+{
+ logFunction();
+
+ switch (getStationStatus())
+ {
+ case 0:
+ clog << logger(LOG_INFO) << "MAXIMUS_STATION_STATUS_NONE" << endl;
+ break;
+ case 1:
+ clog << logger(LOG_INFO) << "MAXIMUS_STATION_STATUS_IDLE" << endl;
+ break;
+ case 2:
+ clog << logger(LOG_INFO) << "MAXIMUS_STATION_STATUS_BUSY" << endl;
+ break;
+ case 3:
+ clog << logger(LOG_INFO) << "MAXIMUS_STATION_STATUS_DEACTIVATED" << endl;
+ break;
+ default:
+ clog << logger(LOG_INFO) << "unknown!" << endl;
+ break;
+ }
+}
+
+
+// protected methods
+//
+
diff --git a/cesar/maximus/system/src/StationConfiguration.cpp b/cesar/maximus/system/src/StationConfiguration.cpp
new file mode 100644
index 0000000000..6d1a9c8308
--- /dev/null
+++ b/cesar/maximus/system/src/StationConfiguration.cpp
@@ -0,0 +1,142 @@
+/************************************************************************
+ StationConfiguration.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/src/StationConfiguration.cpp
+**************************************************************************/
+
+#include "StationConfiguration.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+StationConfiguration::StationConfiguration ( string & station_executable, string station_name )
+{
+ logFunction();
+
+ if ( !setStationExecutable(station_executable) || !setStationName(station_name) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "Error during initialization");
+ }
+ initAttributes();
+}
+
+
+void StationConfiguration::initAttributes ( )
+{
+ logFunction();
+}
+
+
+StationConfiguration::~StationConfiguration ( )
+{
+ logFunction();
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+bool StationConfiguration::setStationExecutable ( const string & station_executable )
+{
+ if (station_executable.empty())
+ {
+ throw Error(__PRETTY_FUNCTION__, "Station executable is an empty string");
+ }
+ else
+ {
+ mStationExecutable = station_executable;
+ }
+
+ return true;
+}
+
+
+const string & StationConfiguration::getStationExecutable ( ) const
+{
+ if (mStationExecutable.empty())
+ {
+ throw Error(__PRETTY_FUNCTION__, "Station executable is an empty string");
+ }
+ return mStationExecutable;
+}
+
+
+bool StationConfiguration::setStationName ( const string & station_name )
+{
+ mStationName = station_name;
+
+ return true;
+}
+
+
+const string & StationConfiguration::getStationName ( ) const
+{
+ return mStationName;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/system/src/StationConfigurationTest.cpp b/cesar/maximus/system/src/StationConfigurationTest.cpp
new file mode 100644
index 0000000000..00c982d20e
--- /dev/null
+++ b/cesar/maximus/system/src/StationConfigurationTest.cpp
@@ -0,0 +1,51 @@
+
+#include "StationConfigurationTest.h"
+
+#include "StationConfiguration.h"
+
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (StationConfigurationTest);
+
+
+void StationConfigurationTest::setUp (void)
+{
+ logTest();
+
+ string station_executable = "../stationtest/obj/stationtest.elf";
+ mpStationConfiguration = new StationConfiguration (station_executable);
+}
+
+
+void StationConfigurationTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpStationConfiguration)
+ {
+ delete mpStationConfiguration;
+ mpStationConfiguration = NULL;
+ }
+}
+
+
+void StationConfigurationTest::setStationNameTest (void)
+{
+ logTest();
+
+ if (NULL == mpStationConfiguration)
+ {
+ CPPUNIT_FAIL ( "The initialized StationConfiguration pointer is NULL" );
+ }
+ else
+ {
+ string stationName = "This is my station name";
+
+ CPPUNIT_ASSERT_MESSAGE ( "setStationName failed",
+ mpStationConfiguration->setStationName(stationName) );
+ }
+}
+
diff --git a/cesar/maximus/system/src/StationTest.cpp b/cesar/maximus/system/src/StationTest.cpp
new file mode 100644
index 0000000000..d0ca985293
--- /dev/null
+++ b/cesar/maximus/system/src/StationTest.cpp
@@ -0,0 +1,61 @@
+
+#include "StationTest.h"
+
+#include "Station.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream>
+#include <string>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (StationTest);
+
+
+void StationTest::setUp (void)
+{
+ logTest();
+
+ try
+ {
+ mpStation = NULL;
+ string stationExecutable;
+ mpStation = new Station(stationExecutable, 0);
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+}
+
+
+void StationTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpStation)
+ {
+ delete (mpStation);
+ mpStation = NULL;
+ }
+}
+
+
+void StationTest::setStationNameTest (void)
+{
+ logTest();
+
+ if (NULL == mpStation)
+ {
+ CPPUNIT_FAIL ( "The initialized Station pointer is NULL" );
+ }
+ else
+ {
+ string stationName = "This is my station name";
+
+ CPPUNIT_ASSERT_MESSAGE ( "setStationName failed",
+ mpStation->setStationName(stationName) );
+ }
+}
+
diff --git a/cesar/maximus/system/src/SystemManager.cpp b/cesar/maximus/system/src/SystemManager.cpp
new file mode 100644
index 0000000000..4c40ae88ea
--- /dev/null
+++ b/cesar/maximus/system/src/SystemManager.cpp
@@ -0,0 +1,546 @@
+/************************************************************************
+ SystemManager.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/src/SystemManager.cpp
+**************************************************************************/
+
+#include "SystemManager.h"
+
+#include "Station.h"
+#include "ISci.h"
+#include "SystemSciMsg.h"
+#include "INetworkClock.h"
+
+#include "sci_types.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+SystemManager::SystemManager ( ISci * p_sci_server ):
+mpSciServer(NULL),
+mpNetworkClock(NULL)
+{
+ logFunction();
+
+ if (NULL != p_sci_server)
+ {
+ mpSciServer = p_sci_server;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL", errno);
+ }
+ initAttributes();
+}
+
+
+void SystemManager::initAttributes ( )
+{
+ logFunction();
+
+ if (NULL != mpSciServer)
+ {
+ if ( (!mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_SYSTEM, new SystemSciMsg(this)))
+ || (!mpSciServer->setStationsList(&mListOfStations)) )
+ {
+ throw Error(__PRETTY_FUNCTION__, "Error when initializing SCI server");
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+}
+
+
+SystemManager::~SystemManager ( )
+{
+ logFunction();
+
+ removeAllStations();
+ if (NULL != mpSciServer)
+ {
+ mpSciServer = NULL;
+ }
+ if (NULL != mpNetworkClock)
+ {
+ mpNetworkClock = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+bool SystemManager::init ( const string & station_executable, const string & debugger )
+{
+ logFunction();
+
+ mDefaultStationExecutable = station_executable;
+ mDebugger = debugger;
+
+ return true;
+}
+
+
+Sci_Msg_Station_Id SystemManager::createStation ( const string & station_executable )
+{
+ logFunction();
+ Sci_Msg_Station_Id stationId = 0;
+
+ Station * createdStation = new Station(station_executable, getNetworkClock()->getCurrentTickValue());
+
+ if (NULL != createdStation)
+ {
+ mListOfStations.push_back(createdStation);
+ stationId = createdStation->getStationId();
+ createdStation = NULL;
+ }
+ clog << logger(LOG_COM) << "create station " \
+ << stationId << " (0x" << setfill('0') << setw(4) << uppercase << hex << stationId << ")" << dec << endl;
+
+ displayListOfStations();
+
+ return stationId;
+}
+
+
+bool SystemManager::receiveIdleMsg ( const SystemSciMsg & system_sci_msg ) const
+{
+ bool bReceive = false;
+
+ Station * pStation = findStation(system_sci_msg.getSciMsgStationId());
+ if (NULL != pStation)
+ {
+ pStation->decrementStationIdleCounter();
+ if ( (0 == pStation->getStationIdleCounter())
+ && (MAXIMUS_STATION_STATUS_DEACTIVATED != pStation->getStationStatus()) )
+ {
+ pStation->setStationStatus(MAXIMUS_STATION_STATUS_IDLE);
+ }
+ bReceive = true;
+ }
+ pStation = NULL;
+
+ return bReceive;
+}
+
+
+bool SystemManager::removeStation ( const Sci_Msg_Station_Id station_id )
+{
+ logFunction();
+ bool bRemove = false;
+
+ if (!mListOfStations.empty())
+ {
+ for (StationsList::iterator it = mListOfStations.begin(); it != mListOfStations.end(); ++it)
+ {
+ StationsList::iterator pos = it;
+ Station * pStation = *pos;
+ if ( (NULL != pStation) && (station_id == pStation->getStationId()) )
+ {
+ delete(pStation);
+ mListOfStations.erase(pos);
+ bRemove = true;
+ break;
+ }
+ }
+ }
+ displayListOfStations();
+
+ // Remove events that should be sent to the removed station
+ getNetworkClock()->removeEvts(station_id);
+
+ return bRemove;
+}
+
+
+bool SystemManager::isStationIdle ( Sci_Msg_Station_Id station_id ) const
+{
+ logFunction();
+ bool bIdle = false;
+
+ Station * pStation = findStation(station_id);
+ if ( (NULL != pStation) && (MAXIMUS_STATION_STATUS_IDLE == pStation->getStationStatus()) )
+ {
+ bIdle = true;
+ }
+ pStation = NULL;
+
+ return bIdle;
+}
+
+
+bool SystemManager::areAllActiveStationsIdle ( ) const
+{
+ logFunction();
+ bool bIdle = true;
+
+ if (!mListOfStations.empty())
+ {
+ for (StationsList::const_iterator it = mListOfStations.begin(); it != mListOfStations.end(); ++it)
+ {
+ if (NULL != *it)
+ {
+ if ( (MAXIMUS_STATION_STATUS_DEACTIVATED != (*it)->getStationStatus())
+ && (MAXIMUS_STATION_STATUS_IDLE != (*it)->getStationStatus()) )
+ {
+ bIdle = false;
+ it = mListOfStations.end();
+ --it;
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "Station pointer is NULL");
+ }
+ }
+ }
+
+ return bIdle;
+}
+
+
+bool SystemManager::deactivateStation ( const Sci_Msg_Station_Id station_id )
+{
+ logFunction();
+ bool bDeactivate = false;
+
+ Station * pStation = findStation(station_id);
+ if (NULL != pStation)
+ {
+ bDeactivate = pStation->setStationStatus(MAXIMUS_STATION_STATUS_DEACTIVATED);
+ }
+ pStation = NULL;
+
+ return bDeactivate;
+}
+
+
+bool SystemManager::activateStation ( const Sci_Msg_Station_Id station_id )
+{
+ logFunction();
+ bool bActivate = false;
+
+ Station * pStation = findStation(station_id);
+ if (NULL != pStation)
+ {
+ bActivate = pStation->setStationStatus(MAXIMUS_STATION_STATUS_IDLE);
+ }
+ pStation = NULL;
+
+ return bActivate;
+}
+
+
+bool SystemManager::debugStation ( const Sci_Msg_Station_Id station_id )
+{
+ logFunction();
+ bool bDebug = false;
+
+ Station * pStation = findStation(station_id);
+ if (NULL != pStation)
+ {
+ bDebug = pStation->launchDebugger(getDebugger());
+ }
+ pStation = NULL;
+
+ return bDebug;
+}
+
+
+Station_Status SystemManager::getStationStatus ( const Sci_Msg_Station_Id station_id ) const
+{
+ logFunction();
+ Station_Status status = MAXIMUS_STATION_STATUS_NONE;
+
+ Station * pStation = findStation(station_id);
+ if (NULL != pStation)
+ {
+ status = pStation->getStationStatus();
+ }
+
+ return status;
+}
+
+
+bool SystemManager::updateStationStatus ( const Sci_Msg_Station_Id station_id, const Station_Status new_status )
+{
+ logFunction();
+ bool bSetIdle = false;
+
+ Station * pStation = findStation(station_id);
+ if (NULL != pStation)
+ {
+ bSetIdle = pStation->setStationStatus(new_status);
+ }
+
+ return bSetIdle;
+}
+
+
+bool SystemManager::removeAllStations ( )
+{
+ logFunction();
+ bool bRemove = false;
+ unsigned short int nbOfStations = 0;
+
+ if (!mListOfStations.empty())
+ {
+ for (StationsList::const_iterator it = mListOfStations.begin(); it != mListOfStations.end(); ++it)
+ {
+ if (NULL != *it)
+ {
+ delete (*it);
+ nbOfStations++;
+ }
+ }
+ mListOfStations.clear();
+ }
+ if (mListOfStations.empty())
+ {
+ bRemove = true;
+ clog << logger(LOG_COM) << "delete " << nbOfStations << " station(s)" << endl;
+ }
+
+ return bRemove;
+}
+
+
+bool SystemManager::setNetworkClock ( INetworkClock * p_network_clock )
+{
+ if (NULL == p_network_clock)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Network Clock pointer is NULL", errno);
+ }
+ mpNetworkClock = p_network_clock;
+
+ return true;
+}
+
+
+const string & SystemManager::getDefaultStationExecutable ( ) const
+{
+ return mDefaultStationExecutable;
+}
+
+
+bool SystemManager::setStationName ( const Sci_Msg_Station_Id station_id, const std::string & station_name )
+{
+ logFunction();
+ bool bSetName = false;
+
+ Station * pStation = findStation(station_id);
+ if (NULL != pStation)
+ {
+ bSetName = pStation->setStationName(station_name);
+ }
+
+ /* Send a System SCI message to the station to configure its name. */
+
+ SystemSciMsg systemSciMsg(this);
+
+ // Fill specialized SCI msg data length and specialized SCI msg data
+ //
+ bSetName &= systemSciMsg.setSpecializedSciMsgDataLength(station_name.length() + 1);
+ bSetName &= systemSciMsg.setSpecializedSciMsgData((unsigned char *)station_name.c_str());
+
+ // Fill specialized SCI msg header
+ //
+ struct System_Header header = { SYSTEM_VERSION,
+ SYSTEM_TYPE_STATION_NAME,
+ 0x0000 }; // flags
+
+ // Set specialized SCI msg header
+ //
+ bSetName &= systemSciMsg.setSpecializedSciMsgHeader(header);
+
+ // Fill specialized SCI msg attributes:
+ // - header size
+ //
+ bSetName &= systemSciMsg.setSpecializedSciMsgHeaderSize(sizeof(struct System_Header));
+
+ // Fill SCI msg attributes:
+ // - type
+ // - station ID
+ //
+ bSetName &= systemSciMsg.setSciMsgType(SCI_MSG_TYPE_SYSTEM);
+ bSetName &= systemSciMsg.setSciMsgStationId(station_id);
+
+ if (bSetName)
+ {
+ if (NULL != mpSciServer)
+ {
+ bSetName = mpSciServer->fillSciMsg(systemSciMsg);
+ bSetName &= mpSciServer->sendSciMsg(systemSciMsg);
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "system SCI message cannot be sent because it is not correctly filled in!" << endl;
+ }
+
+ return bSetName;
+}
+
+
+// private methods
+//
+
+
+void SystemManager::displayListOfStations ( ) const
+{
+ logFunction();
+ clog << logger(LOG_INFO) << "list of stations = " << endl;
+
+ if (!mListOfStations.empty())
+ {
+ for (StationsList::const_iterator it = mListOfStations.begin(); it != mListOfStations.end(); ++it)
+ {
+ if (NULL != *it)
+ {
+ const_cast<Station *>(*it)->displayStation();
+ }
+ }
+ }
+ else
+ {
+ clog << logger(LOG_INFO) << "\tempty!" << endl;
+ }
+}
+
+
+void SystemManager::registerSystemSciMsg ( )
+{
+ logFunction();
+
+ if (NULL != mpSciServer)
+ {
+ mpSciServer->registerSpecializedSciMsg(SCI_MSG_TYPE_SYSTEM, new SystemSciMsg(this));
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI server pointer is NULL");
+ }
+}
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+StationsList * SystemManager::getListOfStations ( )
+{
+ return &mListOfStations;
+}
+
+
+Station * SystemManager::findStation ( const Sci_Msg_Station_Id station_id ) const
+{
+ logFunction();
+ Station * pStation = NULL;
+
+ if (!mListOfStations.empty())
+ {
+ for (StationsList::const_iterator it = mListOfStations.begin(); it != mListOfStations.end(); ++it)
+ {
+ if ( (NULL != *it) && (station_id == (*it)->getStationId()) )
+ {
+ pStation = *it;
+ it = mListOfStations.end();
+ --it;
+ }
+ }
+ }
+ if (NULL == pStation)
+ {
+ clog << logger(LOG_FATAL) << "station with id " << dec << station_id << " (0x" << setfill('0') << setw(4) << uppercase << hex << station_id << ") does not exist" << dec << endl;
+ errno = ENONET;
+ throw Error(__PRETTY_FUNCTION__, "Station does not exist", errno);
+ }
+
+ return pStation;
+}
+
+
+const string SystemManager::getDebugger ( ) const
+{
+ return mDebugger;
+}
+
+
+INetworkClock * SystemManager::getNetworkClock ( ) const
+{
+ if (NULL == mpNetworkClock)
+ {
+ throw Error(__PRETTY_FUNCTION__, "Network Clock pointer is NULL");
+ }
+
+ return mpNetworkClock;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/system/src/SystemManagerTest.cpp b/cesar/maximus/system/src/SystemManagerTest.cpp
new file mode 100644
index 0000000000..6b71009730
--- /dev/null
+++ b/cesar/maximus/system/src/SystemManagerTest.cpp
@@ -0,0 +1,202 @@
+
+#include "SystemManagerTest.h"
+
+#include "SystemManager.h"
+#include "SciServer.h"
+#include "PhyProcessor.h"
+#include "NetworkClockProcessor.h"
+#include "FunctionCallManager.h"
+#include "EthernetProcessor.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (SystemManagerTest);
+
+
+void SystemManagerTest::setUp (void)
+{
+ logTest();
+
+ mpSciServer = new SciServer ();
+ mpSystemManager = new SystemManager (mpSciServer);
+
+ mpFunctionCall = new FunctionCallManager (mpSciServer);
+ mpPhy = new PhyProcessor (mpSciServer);
+ mpEthernet = new EthernetProcessor (mpSciServer);
+ mpNetworkClock = new NetworkClockProcessor (mpSciServer, mpSystemManager, mpFunctionCall, mpPhy, mpEthernet);
+ mpSystemManager->setNetworkClock(mpNetworkClock);
+}
+
+
+void SystemManagerTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpSystemManager)
+ {
+ delete mpSystemManager;
+ mpSystemManager = NULL;
+ }
+ if (NULL != mpSciServer)
+ {
+ delete mpSciServer;
+ mpSciServer = NULL;
+ }
+ if (NULL != mpFunctionCall)
+ {
+ delete mpFunctionCall;
+ mpFunctionCall = NULL;
+ }
+ if (NULL != mpPhy)
+ {
+ delete mpPhy;
+ mpPhy = NULL;
+ }
+ if (NULL != mpEthernet)
+ {
+ delete mpEthernet;
+ mpEthernet = NULL;
+ }
+ if (NULL != mpNetworkClock)
+ {
+ delete mpNetworkClock;
+ mpNetworkClock = NULL;
+ }
+}
+
+
+void SystemManagerTest::createStationTest (void)
+{
+ logTest();
+
+ try
+ {
+ Sci_Msg_Station_Id stationId = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable()); // will be deleted in 'tearDown()'
+ CPPUNIT_ASSERT_MESSAGE ( "createStation failed",
+ 0 != stationId );
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+}
+
+
+void SystemManagerTest::removeStationTest (void)
+{
+ logTest();
+
+ try
+ {
+ // Create Station 1
+ //
+ Sci_Msg_Station_Id stationId1 = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+
+ // Create Station 2
+ //
+ Sci_Msg_Station_Id stationId2 = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+
+ // Create Station 3
+ //
+ Sci_Msg_Station_Id stationId3 = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+
+ INetworkClock * pNetworkClock = new NetworkClockProcessor();
+ mpSystemManager->setNetworkClock(pNetworkClock);
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeStation failed",
+ mpSystemManager->removeStation (stationId2) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeStation failed",
+ mpSystemManager->removeStation (stationId1) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeStation failed",
+ mpSystemManager->removeStation (stationId3) );
+
+ if (NULL != pNetworkClock)
+ {
+ delete (pNetworkClock);
+ pNetworkClock = NULL;
+ }
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+}
+
+
+void SystemManagerTest::areAllActiveStationsIdleTest (void)
+{
+ logTest();
+
+ try
+ {
+ // Create Station 1
+ //
+ mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+
+ // Create Station 2
+ //
+ mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+
+ // Create Station 3
+ //
+ mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+
+ CPPUNIT_ASSERT_MESSAGE ( "areAllActiveStationsIdle failed",
+ !mpSystemManager->areAllActiveStationsIdle() );
+
+ CPPUNIT_ASSERT_MESSAGE ( "removeAllStations failed",
+ mpSystemManager->removeAllStations() );
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+}
+
+
+void SystemManagerTest::setNetworkClockTest (void)
+{
+ logTest();
+
+ INetworkClock * pNetworkClock = new NetworkClockProcessor();
+
+ CPPUNIT_ASSERT_MESSAGE ( "setNetworkClock failed",
+ mpSystemManager->setNetworkClock(pNetworkClock) );
+
+ if (NULL != pNetworkClock)
+ {
+ delete (pNetworkClock);
+ pNetworkClock = NULL;
+ }
+}
+
+
+void SystemManagerTest::setStationNameTest (void)
+{
+ logTest();
+
+ if (NULL == mpSystemManager)
+ {
+ CPPUNIT_FAIL ( "The initialized System Manager pointer is NULL" );
+ }
+ else
+ {
+ string stationName = "This is my station name";
+
+ Sci_Msg_Station_Id stationId = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+ mpSystemManager->updateStationStatus(stationId, MAXIMUS_STATION_STATUS_IDLE);
+ NetworkClockProcessor networkClock;
+ mpSystemManager->setNetworkClock((INetworkClock *)&networkClock);
+
+ CPPUNIT_ASSERT_MESSAGE ( "setStationName failed",
+ mpSystemManager->setStationName(stationId, stationName) );
+
+ mpSystemManager->removeStation(stationId);
+ }
+}
+
diff --git a/cesar/maximus/system/src/SystemSciMsg.cpp b/cesar/maximus/system/src/SystemSciMsg.cpp
new file mode 100644
index 0000000000..048924b8da
--- /dev/null
+++ b/cesar/maximus/system/src/SystemSciMsg.cpp
@@ -0,0 +1,285 @@
+/************************************************************************
+ SystemSciMsg.cpp - Copyright buret
+
+Here you can write a license for your code, some comments or any other
+information you want to have in your generated code. To to this simply
+configure the "headings" directory in uml to point to a directory
+where you have your heading files.
+
+or you can just replace the contents of this file with your own.
+If you want to do this, this file is located at
+
+/usr/share/apps/umbrello/headings/heading.cpp
+
+-->Code Generators searches for heading files based on the file extension
+ i.e. it will look for a file name ending in ".h" to include in C++ header
+ files, and for a file name ending in ".java" to include in all generated
+ java code.
+ If you name the file "heading.<extension>", Code Generator will always
+ choose this file even if there are other files with the same extension in the
+ directory. If you name the file something else, it must be the only one with that
+ extension in the directory to guarantee that Code Generator will choose it.
+
+you can use variables in your heading files which are replaced at generation
+time. possible variables are : author, date, time, filename and filepath.
+just write %variable_name%
+
+This file was generated on %date% at %time%
+The original location of this file is /home/buret/eclipse/maximus/system/src/SystemSciMsg.cpp
+**************************************************************************/
+
+#include "SystemSciMsg.h"
+
+#include "ISystem.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iomanip> // for 'setfill()' and 'setw()'
+#include <netinet/in.h> // for 'ntohl()' and 'ntohs()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+// Constructors/Destructors
+//
+
+
+SystemSciMsg::SystemSciMsg ( ISystem * p_system_manager ):
+mSpecializedSciMsgType(SYSTEM_TYPE_NONE),
+mpSystemManager(NULL)
+{
+ logFunction();
+
+ initAttributes ();
+ if (NULL != p_system_manager)
+ {
+ mpSystemManager = p_system_manager;
+ }
+ else
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "System manager pointer is NULL", errno);
+ }
+}
+
+
+void SystemSciMsg::initAttributes ( )
+{
+ logFunction();
+
+ mSpecializedSciMsgHeader.version = 0x00;
+ mSpecializedSciMsgHeader.type = 0x00;
+ mSpecializedSciMsgHeader.flags = 0x0000;
+}
+
+
+SystemSciMsg::~SystemSciMsg ( )
+{
+ logFunction();
+
+ if (NULL != mpSystemManager)
+ {
+ mpSystemManager = NULL;
+ }
+}
+
+
+//
+// Methods
+//
+
+
+// Other methods
+//
+
+
+// public methods
+//
+
+
+SciMsg * SystemSciMsg::create ( ) const
+{
+ logFunction();
+
+ return new SystemSciMsg (mpSystemManager);
+}
+
+
+bool SystemSciMsg::dispatchMsg ( )
+{
+ logFunction();
+ bool bDispatch = false;
+
+ if (NULL != mpSystemManager)
+ {
+ if ( SYSTEM_TYPE_IDLE == getSpecializedSciMsgType() )
+ {
+ bDispatch = mpSystemManager->receiveIdleMsg(*this);
+ }
+ else
+ {
+ clog << logger(LOG_ERROR) << "type is not SYSTEM_TYPE_IDLE!" << endl;
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "System manager pointer is NULL");
+ }
+
+ return bDispatch;
+}
+
+
+// When receiving a SCI msg, specialized SCI msg header has to be extracted from received SCI msg data
+//
+bool SystemSciMsg::identifySpecializedSciMsgHeader ( )
+{
+ logFunction();
+ bool bIdentifyHeader = false;
+
+ if (NULL != SciMsg::getSciMsgData())
+ {
+ // Set specialized SCI msg header size
+ //
+ SciMsg::setSpecializedSciMsgHeaderSize(static_cast<unsigned long>(sizeof(struct System_Header)));
+
+ // Get specialized SCI message header contents
+ //
+ if (SciMsg::getSciMsgDataLength() >= SciMsg::getSpecializedSciMsgHeaderSize()) // check that there are enough data to get the specialized SCI message header
+ {
+ mSpecializedSciMsgHeader = *((System_Header*)SciMsg::getSciMsgData());
+ mSpecializedSciMsgHeader.flags = ntohs(getSpecializedSciMsgHeader().flags);
+
+ bIdentifyHeader = setSpecializedSciMsgType (static_cast<System_Type>(getSpecializedSciMsgHeader().type));
+
+ displaySpecializedSciMsgHeader();
+ }
+ else
+ {
+ errno = ENODATA;
+ throw Error(__PRETTY_FUNCTION__, "Not enough data to get the system SCI message header", errno);
+ }
+ }
+ else
+ {
+ throw Error(__PRETTY_FUNCTION__, "SCI message data pointer is NULL");
+ }
+
+ return bIdentifyHeader;
+}
+
+
+// Check specialized SCI msg compatibility (check specialized SCI msg version)
+//
+bool SystemSciMsg::checkCompatibility ( ) const
+{
+ logFunction();
+ bool bCheck = false;
+
+ if (SYSTEM_VERSION == getSpecializedSciMsgHeader().version)
+ {
+ bCheck = SciMsg::checkCompatibility();
+ }
+
+ return bCheck;
+}
+
+
+void SystemSciMsg::displaySpecializedSciMsgHeader ( ) const
+{
+ logFunction();
+
+ clog << logger(LOG_INFO) << "system SCI msg header = " << endl;
+ clog << logger(LOG_INFO) << "\tversion = 0x" << setfill('0') << setw(2) << uppercase << hex << static_cast<unsigned short int>(getSpecializedSciMsgHeader().version) << endl;
+ displaySpecializedSciMsgType(LOG_INFO);
+ clog << logger(LOG_INFO) << "\tflags = 0x" << setfill('0') << setw(4) << uppercase << hex << getSpecializedSciMsgHeader().flags << dec << endl;
+}
+
+
+void SystemSciMsg::displaySpecializedSciMsgType ( int log_level ) const
+{
+ logFunction();
+
+ switch (getSpecializedSciMsgType())
+ {
+ case 0:
+ clog << logger(log_level) << "\ttype = SYSTEM_TYPE_NONE" << endl;
+ break;
+ case 1:
+ clog << logger(log_level) << "\ttype = SYSTEM_TYPE_IDLE" << endl;
+ break;
+ case 2:
+ clog << logger(log_level) << "\ttype = SYSTEM_TYPE_STATION_NAME" << endl;
+ break;
+ default:
+ clog << logger(log_level) << "\ttype = unknown!" << endl;
+ break;
+ }
+}
+
+
+// private methods
+//
+
+
+// protected methods
+//
+
+
+// Accessor methods
+//
+
+
+// public attribute accessor methods
+//
+
+
+// private attribute accessor methods
+//
+
+
+System_Type SystemSciMsg::getSpecializedSciMsgType ( ) const
+{
+ return mSpecializedSciMsgType;
+}
+
+
+bool SystemSciMsg::setSpecializedSciMsgType ( const System_Type type )
+{
+ mSpecializedSciMsgType = type;
+
+ return true;
+}
+
+
+void * SystemSciMsg::returnSpecializedSciMsgHeader ( ) const
+{
+ return (void*)&mSpecializedSciMsgHeader;
+}
+
+
+const System_Header & SystemSciMsg::getSpecializedSciMsgHeader ( ) const
+{
+ return mSpecializedSciMsgHeader;
+}
+
+
+bool SystemSciMsg::setSpecializedSciMsgHeader ( const System_Header & specialized_sci_msg_header )
+{
+ logFunction();
+ bool bSetHeader = false;
+
+ mSpecializedSciMsgHeader = specialized_sci_msg_header;
+
+ bSetHeader = setSpecializedSciMsgType (static_cast<System_Type>(getSpecializedSciMsgHeader().type));
+
+ displaySpecializedSciMsgHeader();
+
+ return bSetHeader;
+}
+
+
+// protected attribute accessor methods
+//
+
diff --git a/cesar/maximus/system/src/SystemSciMsgTest.cpp b/cesar/maximus/system/src/SystemSciMsgTest.cpp
new file mode 100644
index 0000000000..b8015ffee7
--- /dev/null
+++ b/cesar/maximus/system/src/SystemSciMsgTest.cpp
@@ -0,0 +1,108 @@
+
+#include "SystemSciMsgTest.h"
+
+#include "SystemSciMsg.h"
+#include "SciServer.h"
+#include "SystemManager.h"
+#include "PhyProcessor.h"
+#include "NetworkClockProcessor.h"
+#include "FunctionCallManager.h"
+#include "EthernetProcessor.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream>
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (SystemSciMsgTest);
+
+
+void SystemSciMsgTest::setUp (void)
+{
+ logTest();
+
+ mpSciServer = new SciServer();
+ mpSystemManager = new SystemManager (mpSciServer);
+ mpSystemSciMsg = new SystemSciMsg (mpSystemManager);
+}
+
+
+void SystemSciMsgTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpSystemSciMsg)
+ {
+ delete mpSystemSciMsg;
+ mpSystemSciMsg = NULL;
+ }
+ if (NULL != mpSystemManager)
+ {
+ delete (mpSystemManager);
+ mpSystemManager = NULL;
+ }
+ if (NULL != mpSciServer)
+ {
+ delete (mpSciServer);
+ mpSciServer = NULL;
+ }
+}
+
+
+void SystemSciMsgTest::dispatchMsgTest (void)
+{
+ logTest();
+
+ if (NULL != mpSystemSciMsg)
+ {
+ try
+ {
+ CPPUNIT_ASSERT_MESSAGE ( "setSpecializedSciMsgType failed",
+ mpSystemSciMsg->setSpecializedSciMsgType(SYSTEM_TYPE_IDLE) );
+
+ IFunctionCall * pFunctionCall = new FunctionCallManager (mpSciServer);
+ IPhy * pPhy = new PhyProcessor (mpSciServer);
+ IEthernet * pEthernet = new EthernetProcessor (mpSciServer);
+ INetworkClock * pNetworkClock = new NetworkClockProcessor (mpSciServer, mpSystemManager, pFunctionCall, pPhy, pEthernet);
+ mpSystemManager->setNetworkClock(pNetworkClock);
+ Sci_Msg_Station_Id stationId = mpSystemManager->createStation(mpSystemManager->getDefaultStationExecutable());
+
+ CPPUNIT_ASSERT_MESSAGE ( "setSciMsgStationId failed",
+ mpSystemSciMsg->setSciMsgStationId(stationId) );
+
+ CPPUNIT_ASSERT_MESSAGE ( "dispatchMsg failed",
+ mpSystemSciMsg->dispatchMsg() );
+
+ if (NULL != pFunctionCall)
+ {
+ delete (pFunctionCall);
+ pFunctionCall = NULL;
+ }
+ if (NULL != pPhy)
+ {
+ delete (pPhy);
+ pPhy = NULL;
+ }
+ if (NULL != pEthernet)
+ {
+ delete (pEthernet);
+ pEthernet = NULL;
+ }
+ if (NULL != pNetworkClock)
+ {
+ delete (pNetworkClock);
+ pNetworkClock = NULL;
+ }
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+ }
+ else
+ {
+ CPPUNIT_FAIL ( "Initialized SystemSciMsg pointer is NULL" );
+ }
+}
+
diff --git a/cesar/maximus/test/test.sh b/cesar/maximus/test/test.sh
new file mode 100755
index 0000000000..f08eb69ad9
--- /dev/null
+++ b/cesar/maximus/test/test.sh
@@ -0,0 +1,71 @@
+#! /bin/bash
+
+WORKSPACE='/home/buret/workspace/maximus'
+
+echo
+echo "*** HAL Leon Timer Maximus tests ***"
+echo
+cd $WORKSPACE/hal/leon/maximus/test
+make clean; make
+obj/test_maximus_timer
+
+echo
+echo "*** HAL HLE Maximus tests ***"
+echo
+cd $WORKSPACE/hal/hle/maximus/test
+make clean; make
+obj/test_maximus_hle
+
+echo
+echo "*** HAL PHY Maximus tests ***"
+echo
+cd $WORKSPACE/hal/phy/maximus/test
+make clean; make
+obj/test_phy_maximus
+
+echo
+echo "*** HAL PHY tests ***"
+echo
+cd $WORKSPACE/hal/phy/test/phy
+make clean; make
+obj/host_test_phy -e obj/test_phy.elf -d false -t 2500000000
+
+echo
+echo "*** SAR tests ***"
+echo
+cd $WORKSPACE/mac/sar/test/maximus_test
+make clean; make
+obj/Maximus_sar -e obj/Sta_sar.elf -d false -t 2500000000
+
+echo
+echo "*** Compile stations executables ***"
+echo
+cd $WORKSPACE/maximus/stationtest
+make clean; make
+
+echo
+echo "*** Maximus unitary tests ***"
+echo
+cd $WORKSPACE/maximus/unittest
+make clean; make
+obj/unittest -e ../stationtest/obj/stationtest.elf
+
+echo
+echo "*** Maximus user tests ***"
+echo
+cd $WORKSPACE/maximus/usertest
+make clean; make
+obj/usertest -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+
+echo
+echo "*** Host unitary tests ***"
+echo
+cd $WORKSPACE/host/test
+make clean; make
+obj/test_host
+
+echo
+echo "=> Python tests"
+echo
+cd $WORKSPACE/maximus/test
+test_python.sh
diff --git a/cesar/maximus/test/test_python.sh b/cesar/maximus/test/test_python.sh
new file mode 100755
index 0000000000..ad4884f94a
--- /dev/null
+++ b/cesar/maximus/test/test_python.sh
@@ -0,0 +1,110 @@
+#! /bin/bash
+
+WORKSPACE='/home/buret/workspace/maximus'
+
+echo
+echo "*** Compile stations executables ***"
+echo
+cd $WORKSPACE/maximus/stationtest
+make clean; make
+
+# Maximus Python unitary tests
+echo
+echo "*** Compile Python interface ***"
+echo
+cd $WORKSPACE/maximus/python
+make clean; make
+python test/test_channel.py -e ../stationtest/obj/test_station.elf -d false -t 2500000000
+python test/test_cli.py
+python test/test_ethernet.py -e ../stationtest/obj/test_ether.elf -d false -t 2500000000
+python test/test_fsm.py
+python test/test_interface.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python test/test_lib_cesar.py -e ../stationtest/obj/test_lib_cesar.elf -d false -t 2500000000
+python test/test_lib_proto.py
+python test/test_macframe.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
+python test/test_mme.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python test/test_result.py
+python test/test_simu.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python test/test_station.py -e ../stationtest/obj/test_station.elf -d false -t 2500000000
+python test/test_utils.py
+#python test/test_maximus.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+
+# Maximus Python scripts tests
+python py/script_example.py -e ../stationtest/obj/stationtest.elf -d false -t 2500000000
+python py/test_cb.py -e ../stationtest/obj/test_cb.elf -d false -t 2500000000
+python py/test_send_mpdu.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
+python py/test_send_noise.py -e ../stationtest/obj/test_send.elf -d false -t 2500000000
+python py/test_tx_rx.py -e ../stationtest/obj/test_tx_rx.elf -d false -t 2500000000
+python py/test_ether.py -e ../stationtest/obj/test_ether.elf -d false -t 2500000000
+python py/test_false_alarm.py -e ../stationtest/obj/test_false_alarm.elf -d false -t 2500000000
+
+echo
+echo "*** PB proc tests ***"
+echo
+cd $WORKSPACE/mac/pbproc/test/maximus
+make clean; make
+python py/host_test_pbproc.py -e obj/test_pbproc.elf -d false -t 2500000000
+python py/test_coll.py -e obj/test_pbproc.elf -d false -t 2500000000
+
+echo
+echo "*** CE tests ***"
+echo
+cd $WORKSPACE/ce/test/rx/maximus
+make clean; make
+python send_noise.py -e obj/test_rx.elf -d false -t 2500000000
+
+echo
+echo "*** CL - SAR - PB proc tests ***"
+echo
+cd $WORKSPACE/test_general/integration/cl-sar-pbproc
+make clean; make
+python src/Maximus.py -e obj/cl-sar-pbproc.elf -d false -t 2500000000
+
+echo
+echo "*** CP BEACON - DP tests ***"
+echo
+cd $WORKSPACE/test_general/integration/cp_beacon-dp
+make clean; make
+python src/max.py -e obj/cp_beacon.elf -d false -t 2500000000
+python src/max_ucco.py -e obj/cp_beacon.elf -d false -t 2500000000
+python cco_alone.py -e obj/cp_beacon.elf -d false -t 2500000000
+python cco_with_sta.py -e obj/cp_beacon.elf -d false -t 2500000000
+python ucco_alone.py -e obj/cp_beacon.elf -d false -t 2500000000
+python ucco_with_sta.py -e obj/cp_beacon.elf -d false -t 2500000000
+
+echo
+echo "*** HLE - CL - SAR - PB proc tests ***"
+echo
+cd $WORKSPACE/test_general/integration/hle-cl-sar-pbproc
+make clean; make
+python src/Maximus.py -e obj/hle-cl-sar-pbproc.elf -d false -t 2500000000
+
+echo
+echo "*** IPMBOX - HLE - CL - SAR - PB proc tests ***"
+echo
+cd $WORKSPACE/test_general/integration/ipmbox-hle-cl-sar-pbproc
+make clean; make
+python src/Maximus.py -e obj/ipmbox-hle-cl-sar-pbproc.elf -d false -t 2500000000
+python src/Maximus_mme.py -e obj/ipmbox-hle-cl-sar-pbproc.elf -d false -t 2500000000
+
+echo
+echo "*** SAR - PB proc tests ***"
+echo
+cd $WORKSPACE/test_general/integration/sar-pbproc
+make clean; make
+python src/Maximus.py -e obj/sar-pbproc.elf -d false -t 2500000000
+
+echo
+echo "*** INTERFACE - DP tests ***"
+echo
+cd $WORKSPACE/test_general/integration/interface-dp
+make clean; make
+python test1.py -d false -t 2500000000
+
+echo
+echo "*** STATION - CP - DP tests ***"
+echo
+cd $WORKSPACE/test_general/integration/station-cp-dp
+make clean; make
+cd src
+python Maximus.py -d false -t 500000000
diff --git a/cesar/maximus/unittest/Makefile b/cesar/maximus/unittest/Makefile
new file mode 100644
index 0000000000..1f35a1a498
--- /dev/null
+++ b/cesar/maximus/unittest/Makefile
@@ -0,0 +1,12 @@
+BASE = ../..
+
+UNITTEST = y
+
+HOST_PROGRAMS = unittest
+unittest_SOURCES = main.cpp
+unittest_MODULES = maximus lib
+
+EXTRA_HOST_CFLAGS := $(shell cppunit-config --cflags)
+EXTRA_HOST_LDLIBS := $(shell cppunit-config --libs)
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/maximus/unittest/src/main.cpp b/cesar/maximus/unittest/src/main.cpp
new file mode 100644
index 0000000000..3a3a01f582
--- /dev/null
+++ b/cesar/maximus/unittest/src/main.cpp
@@ -0,0 +1,99 @@
+
+#include <cppunit/CompilerOutputter.h>
+#include <cppunit/extensions/TestFactoryRegistry.h>
+#include <cppunit/TestResult.h>
+#include <cppunit/TestResultCollector.h>
+#include <cppunit/TestRunner.h>
+
+#include "Error.h"
+
+#include <string>
+#include <getopt.h> // for 'getopt()'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+#include <fstream> // for 'ofstream'
+using namespace std;
+
+extern bool UNITTEST;
+extern string stationTest;
+
+
+int main (int argc, char * argv[])
+{
+ UNITTEST = true;
+ int returnValue = -1;
+
+ try
+ {
+ // Create a file for logging
+ //
+ ofstream logFile("unittest_log");
+ if (logFile)
+ {
+ clog.rdbuf(logFile.rdbuf());
+ }
+ else
+ {
+ cerr << "Error while opening log file" << endl;
+ clog.rdbuf(cout.rdbuf());
+ }
+
+ cout << endl << "*** Welcome to Fulminata Maximus simulator unitary tests ***" << endl;
+
+ bool isStationExecutableSet = false;
+ int optionChar = 0;
+ while (EOF != optionChar)
+ {
+ optionChar = getopt(argc, argv, "e:");
+
+ switch (optionChar)
+ {
+ case 'e':
+ cout << "station executable = " << optarg << endl;
+ stationTest = optarg;
+ isStationExecutableSet = true;
+ break;
+ case '?':
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Usage: -e station_executable", errno);
+ break;
+ }
+ }
+ if (!isStationExecutableSet)
+ {
+ errno = EINVAL;
+ throw Error(__PRETTY_FUNCTION__, "Usage: -e station_executable", errno);
+ }
+
+ cout << "\ttestresult" << endl;
+ CPPUNIT_NS :: TestResult testresult;
+
+ cout << "\tcollectedresults" << endl;
+ CPPUNIT_NS :: TestResultCollector collectedresults;
+ testresult.addListener (&collectedresults);
+
+ cout << "\ttestrunner" << endl;
+ CPPUNIT_NS :: TestRunner testrunner;
+ testrunner.addTest (CPPUNIT_NS :: TestFactoryRegistry :: getRegistry ().makeTest ());
+ testrunner.run (testresult);
+
+ cout << "\tcompileroutputter" << endl;
+ CPPUNIT_NS :: CompilerOutputter compileroutputter (&collectedresults, std::cerr);
+ compileroutputter.write ();
+
+ returnValue = collectedresults.wasSuccessful () ? 0 : 1;
+
+ cout << endl << "*** END ***" << endl;
+
+ // Close the created file for logging
+ //
+ logFile.flush();
+ logFile.close();
+ }
+ catch ( Error &e )
+ {
+ e.display();
+ }
+
+ return returnValue;
+}
+
diff --git a/cesar/maximus/usertest/Makefile b/cesar/maximus/usertest/Makefile
new file mode 100644
index 0000000000..b20cb789db
--- /dev/null
+++ b/cesar/maximus/usertest/Makefile
@@ -0,0 +1,7 @@
+BASE = ../..
+
+HOST_PROGRAMS = usertest
+usertest_SOURCES = main_example.cpp
+usertest_MODULES = maximus lib
+
+include $(BASE)/common/make/top.mk
diff --git a/cesar/maximus/usertest/src/main_example.cpp b/cesar/maximus/usertest/src/main_example.cpp
new file mode 100644
index 0000000000..90e2ba570e
--- /dev/null
+++ b/cesar/maximus/usertest/src/main_example.cpp
@@ -0,0 +1,166 @@
+
+#include "Maximus.h"
+#include "Sta.h"
+#include "Msg.h"
+
+#include <signal.h> // for 'raise()' and 'SIGTERM'
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+typedef struct my_struct
+{
+ int i1;
+ int i2;
+ bool b;
+} my_struct_t;
+
+typedef long long my_type_t;
+
+bool receive_fc1_rsp;
+
+void
+my_cb (Msg & msg)
+{
+ cout << __PRETTY_FUNCTION__ << endl;
+
+ unsigned long length = sizeof(my_type_t);
+ my_type_t result2;
+ my_type_t * p_result2 = &result2;
+ if (NULL != msg.bind_param("result_2", length, (unsigned char *)p_result2))
+ {
+ cout << "result 2 = " << result2 << endl;
+ }
+ receive_fc1_rsp = true;
+
+ p_result2 = NULL;
+}
+
+int
+main ( int argc, char * argv[] )
+{
+ try
+ {
+ /* Instantiate a Maximus object and initialize it. */
+ Maximus maximus;
+ maximus.init(argc, argv);
+
+ /* Create three stations. */
+ Sta stationA = maximus.create_sta();
+ Sta stationB = maximus.create_sta();
+ Sta stationC = maximus.create_sta();
+
+ /* Launch a debugger attached to station B. */
+ stationB.debug();
+
+ /* Send an asynchronous function message to station A. */
+
+ /** Create a function message and set the name of the function to call of station A. **/
+ Msg fc1 = maximus.create_fc("function_1");
+
+ /** Add a first parameter to the created message. **/
+ my_struct_t param1 = { 1, 2, true };
+ fc1.add_param("param_1", sizeof(my_struct_t), (unsigned char *)&param1);
+
+ /** Add a second parameter to the created message. **/
+ int param2[10] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ fc1.add_param("param_2", 10*sizeof(int), (unsigned char *)param2);
+
+ /** Add a third parameter to the created message. **/
+ string param3("hello");
+ fc1.add_param("param_3", param3);
+
+ /** Add a fourth parameter to the created message. **/
+ my_type_t param4 = 123;
+ fc1.add_param("param_4", sizeof(my_type_t), (unsigned char *)&param4);
+
+ /** Register a callback function which will be called at message response reception. **/
+ fc1.set_cb(&my_cb);
+
+ /** Set destination station of message 1. **/
+ fc1.set_sta(stationA);
+
+ /** Send the configured message in an asynchronous mode. **/
+ receive_fc1_rsp = false;
+ fc1.send_async();
+
+ /* Send a synchronous function message to station B. */
+
+ /** Create a function message and set the name of the function to call into station B. **/
+ Msg fc2 = maximus.create_fc("function_2");
+
+ /** Add a first parameter to the created message. **/
+ fc2.add_param("param_5", true);
+
+ /** Send the configured message to station B in a synchronous mode. **/
+ fc2.send(stationB);
+
+ /** Get the function result. **/
+ char result1[FUNCTION_CALL_PARAM_MAX_SIZE];
+ unsigned long length = FUNCTION_CALL_PARAM_MAX_SIZE*sizeof(char);
+ fc2.bind_param("result_1", length, (unsigned char *)result1);
+ cout << "result1 = " << result1 << endl;
+
+ /* Set a parameter value of station B. */
+ Msg probe1 = maximus.create_probe();
+ unsigned int param6 = 789;
+ probe1.add_param("param_6", param6);
+ probe1.send(stationB);
+
+ /* Get a parameter value from station B. */
+ Msg probe2 = maximus.create_probe()
+ .add_param("param_7")
+ .send(stationB);
+ unsigned int param7 = probe2.bind_param<unsigned int>("param_7");
+ cout << "param 7 = " << param7 << endl;
+
+ /* Get the same parameter value from station C, re-using existing message. */
+ probe2.send(stationC);
+
+ /* Send asynchronous function message(s) to station B. */
+ if (456 == param7)
+ {
+ Msg fc3 = maximus.create_fc("function_3");
+ fc3.send_async(stationC);
+ }
+ Msg fc4 = maximus.create_fc("function_4");
+ fc4.send_async(stationC);
+
+ /* Wait for station A response. */
+ while(!receive_fc1_rsp)
+ {
+ maximus.process();
+ }
+
+ /* Send an asynchronous function message to station C. */
+ Msg fc5 = maximus.create_fc("function_5");
+ fc5.send_async(stationC);
+
+ /* Wait for responses to all sent messages in asynchronous mode. */
+ maximus.wait();
+
+ /* Get list of all registered parameters of stations C. */
+ Msg probe3 = maximus.create_probe();
+ probe3.send(stationC);
+ if (probe3.is_param("param_8"))
+ {
+ /* Get parameter 8 value and set parameter 9 value of station C. */
+ Msg probe4 = maximus.create_probe();
+ probe4.add_param("param_8");
+ probe4.add_param("param_9", false);
+ probe4.send(stationC);
+ bool param8 = probe4.bind_param<bool>("param_8");
+ cout << "param 8 = " << param8 << endl;
+ }
+
+ /* Wait during 10000 ticks before terminating the program. */
+ maximus.wait(10000);
+ }
+ catch (...)
+ {
+ cerr << "Catch an exception" << endl;
+ raise(SIGTERM);
+ }
+
+ cout << endl << "*** END ***" << endl;
+ return 0;
+}
diff --git a/cesar/maximus/utils/Module b/cesar/maximus/utils/Module
new file mode 100644
index 0000000000..1a70f6d551
--- /dev/null
+++ b/cesar/maximus/utils/Module
@@ -0,0 +1,5 @@
+SOURCES := Error.cpp Logger.cpp
+ifdef UNITTEST
+SOURCES += ErrorTest.cpp LoggerTest.cpp
+endif
+HOST_INCLUDES += maximus/utils/inc
diff --git a/cesar/maximus/utils/inc/Error.h b/cesar/maximus/utils/inc/Error.h
new file mode 100644
index 0000000000..3754f88d93
--- /dev/null
+++ b/cesar/maximus/utils/inc/Error.h
@@ -0,0 +1,36 @@
+
+#ifndef ERROR_H
+#define ERROR_H
+
+#include <iostream>
+#include <stdexcept>
+#include <errno.h>
+using namespace std;
+
+
+class Error : public runtime_error
+{
+
+public:
+
+ Error ( const string & function, const string & msg, const error_t error = ENOTRECOVERABLE );
+
+ virtual ~Error ( ) throw ( );
+
+ inline string getFunction ( ) const { return mFunction; }
+
+ inline error_t getErrno ( ) const { return mErrorId; }
+
+ inline string getMessage ( ) const { return what(); }
+
+ void display ( ) const;
+
+private:
+
+ error_t mErrorId;
+ string mFunction;
+
+};
+
+
+#endif // ERROR_H
diff --git a/cesar/maximus/utils/inc/ErrorTest.h b/cesar/maximus/utils/inc/ErrorTest.h
new file mode 100644
index 0000000000..048cbd3ed2
--- /dev/null
+++ b/cesar/maximus/utils/inc/ErrorTest.h
@@ -0,0 +1,34 @@
+
+#ifndef ERRORTEST_H
+#define ERRORTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class Error;
+
+
+class ErrorTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (ErrorTest);
+ CPPUNIT_TEST (simpleTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void simpleTest (void);
+
+private:
+
+ Error * mpError;
+
+};
+
+
+#endif // ERRORTEST_H
diff --git a/cesar/maximus/utils/inc/Logger.h b/cesar/maximus/utils/inc/Logger.h
new file mode 100644
index 0000000000..414c918640
--- /dev/null
+++ b/cesar/maximus/utils/inc/Logger.h
@@ -0,0 +1,104 @@
+
+#ifndef LOGGER_H
+#define LOGGER_H
+
+#include "networkclock_types.h" // for 'Network_Clock_Tick'
+
+#include <fstream> // for 'std::ostream' and 'std::ofstream'
+
+// Constants defining the six different importance levels of the log messages
+#define LOG_DEBUG 0
+#define LOG_INFO 1
+#define LOG_COM 2
+#define LOG_WARNING 3
+#define LOG_ERROR 4
+#define LOG_FATAL 5
+#define LOG_NONE 6
+
+#define logFunction() clog << logger(LOG_DEBUG) << __PRETTY_FUNCTION__ << endl
+#define logTest() clog << endl << "---" << endl << __PRETTY_FUNCTION__ << endl
+
+
+class Logger
+{
+
+ public:
+
+ // Constructors:
+
+ /**
+ * Empty Constructor
+ * Logs to cout, log level LOG_DEBUG
+ */
+ Logger ( );
+
+ /**
+ * Constructor
+ * Logs to cout, log level specified
+ */
+ Logger ( int log_level );
+
+ /**
+ * Constructor
+ * Logs to a specified stream, log level specified
+ */
+ Logger ( std::ofstream & log_file, int log_level );
+
+ /**
+ * Empty Destructor
+ */
+ virtual ~Logger ( );
+
+ /**
+ * Operator to set the level of a message
+ */
+ Logger & operator() ( int msg_level );
+
+ /**
+ * Operator to pass the message to the stream
+ */
+ friend std::ostream & operator<< ( std::ostream & os, const Logger & logger );
+
+ /**
+ * Function to set the stream
+ */
+ void setLogFile ( std::ofstream & log_file );
+
+ /**
+ * Functions to get and set the log level
+ */
+ int getLogLevel ( ) const;
+ void setLogLevel ( int log_level );
+
+ /**
+ * Functions to get and set the msg level
+ */
+ int getMsgLevel ( ) const;
+ void setMsgLevel ( int msg_level );
+
+ /**
+ * @return Network_Clock_Tick
+ */
+ Network_Clock_Tick getCurrentTickValue ( ) const;
+
+ /**
+ * @return bool
+ * @param current_tick_value
+ */
+ bool updateTickValue ( const Network_Clock_Tick current_tick_value );
+
+private:
+
+ // Current log level
+ int mLogLevel;
+ // Level of message (as set by operator)
+ int mMsgLevel;
+
+ Network_Clock_Tick mCurrentTickValue;
+
+};
+
+
+extern Logger logger;
+
+#endif // LOGGER_H
diff --git a/cesar/maximus/utils/inc/LoggerTest.h b/cesar/maximus/utils/inc/LoggerTest.h
new file mode 100644
index 0000000000..13353a9259
--- /dev/null
+++ b/cesar/maximus/utils/inc/LoggerTest.h
@@ -0,0 +1,34 @@
+
+#ifndef LOGGERTEST_H
+#define LOGGERTEST_H
+
+#include <cppunit/TestFixture.h>
+#include <cppunit/extensions/HelperMacros.h>
+
+class Logger;
+
+
+class LoggerTest : public CPPUNIT_NS::TestFixture
+{
+
+ CPPUNIT_TEST_SUITE (LoggerTest);
+ CPPUNIT_TEST (simpleTest);
+ CPPUNIT_TEST_SUITE_END ();
+
+public:
+
+ void setUp (void);
+ void tearDown (void);
+
+protected:
+
+ void simpleTest (void);
+
+private:
+
+ Logger * mpLogger;
+
+};
+
+
+#endif // LOGGERTEST_H
diff --git a/cesar/maximus/utils/src/Error.cpp b/cesar/maximus/utils/src/Error.cpp
new file mode 100644
index 0000000000..36bff330b4
--- /dev/null
+++ b/cesar/maximus/utils/src/Error.cpp
@@ -0,0 +1,27 @@
+
+#include "Error.h"
+
+#include "Logger.h"
+
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+
+
+Error::Error ( const string & my_function, const string & msg, const error_t my_errno ) : runtime_error(msg)
+{
+ mErrorId = my_errno;
+ mFunction = my_function;
+}
+
+
+void Error::display ( ) const
+{
+ cerr << endl << "*** Error in " << mFunction << endl << "\t" << what() << " (" << strerror(mErrorId) << ") ***" << endl;
+ clog << endl << logger(LOG_FATAL) << "*** Error in " << mFunction << endl << "\t" << what() << " (" << strerror(mErrorId) << ") ***" << endl;
+}
+
+
+Error::~Error ( ) throw()
+{
+
+}
+
diff --git a/cesar/maximus/utils/src/ErrorTest.cpp b/cesar/maximus/utils/src/ErrorTest.cpp
new file mode 100644
index 0000000000..21613009f8
--- /dev/null
+++ b/cesar/maximus/utils/src/ErrorTest.cpp
@@ -0,0 +1,46 @@
+
+#include "ErrorTest.h"
+
+#include "Error.h"
+#include "Logger.h"
+
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (ErrorTest);
+
+
+void ErrorTest::setUp (void)
+{
+ logTest();
+
+ mpError = new Error ("test", "test");
+}
+
+
+void ErrorTest::tearDown (void)
+{
+ logTest();
+
+ if (NULL != mpError)
+ {
+ delete (mpError);
+ mpError = NULL;
+ }
+}
+
+
+void ErrorTest::simpleTest (void)
+{
+ logTest();
+
+ if (NULL != mpError)
+ {
+ // ...
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Error pointer is NULL");
+ }
+}
+
diff --git a/cesar/maximus/utils/src/Logger.cpp b/cesar/maximus/utils/src/Logger.cpp
new file mode 100644
index 0000000000..e445673a05
--- /dev/null
+++ b/cesar/maximus/utils/src/Logger.cpp
@@ -0,0 +1,130 @@
+
+#include "Logger.h"
+
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+
+Logger::Logger ( ):
+mLogLevel(LOG_DEBUG),
+mMsgLevel(LOG_DEBUG)
+{
+ clog.rdbuf(cout.rdbuf());
+}
+
+
+Logger::Logger ( int log_level ):
+mLogLevel(LOG_DEBUG),
+mMsgLevel(LOG_DEBUG)
+{
+ clog.rdbuf(cout.rdbuf());
+ setLogLevel(log_level);
+}
+
+
+Logger::Logger ( ofstream & log_file, int log_level ):
+mLogLevel(LOG_DEBUG),
+mMsgLevel(LOG_DEBUG)
+{
+ if (log_file)
+ {
+ clog.rdbuf(log_file.rdbuf());
+ }
+ else
+ {
+ clog.rdbuf(cout.rdbuf());
+ }
+ setLogLevel(log_level);
+}
+
+
+Logger::~Logger ( )
+{
+ clog.rdbuf(cout.rdbuf());
+}
+
+
+Logger & Logger::operator() ( int msg_level )
+{
+ setMsgLevel(msg_level);
+
+ return (*this);
+}
+
+
+ostream & operator<< ( ostream & os, const Logger & logger )
+{
+ static ofstream bin ("/dev/null");
+
+ if (logger.getMsgLevel() >= logger.getLogLevel())
+ {
+ os << "Maximus(" << dec << logger.getCurrentTickValue() << "): ";
+ if (LOG_WARNING ==logger.getMsgLevel())
+ {
+ os << "WARNING ";
+ }
+ else if (LOG_ERROR ==logger.getMsgLevel())
+ {
+ os << "ERROR ";
+ }
+ return os;
+ }
+ else
+ {
+ return bin;
+ }
+}
+
+
+void Logger::setLogFile ( ofstream & log_file )
+{
+ if (log_file)
+ {
+ clog.rdbuf(log_file.rdbuf());
+ }
+}
+
+
+int Logger::getLogLevel ( ) const
+{
+ return mLogLevel;
+}
+
+
+void Logger::setLogLevel ( int log_level )
+{
+ if ( (LOG_DEBUG <= log_level) && (LOG_NONE >= log_level) )
+ {
+ mLogLevel = log_level;
+ }
+}
+
+
+int Logger::getMsgLevel ( ) const
+{
+ return mMsgLevel;
+}
+
+
+void Logger::setMsgLevel ( int msg_level )
+{
+ if ( (LOG_DEBUG <= msg_level) && (LOG_NONE >= msg_level) )
+ {
+ mMsgLevel = msg_level;
+ }
+}
+
+
+Network_Clock_Tick Logger::getCurrentTickValue ( ) const
+{
+ return mCurrentTickValue;
+}
+
+
+bool Logger::updateTickValue ( const Network_Clock_Tick current_tick_value )
+{
+ mCurrentTickValue = current_tick_value;
+
+ return true;
+}
+
diff --git a/cesar/maximus/utils/src/LoggerTest.cpp b/cesar/maximus/utils/src/LoggerTest.cpp
new file mode 100644
index 0000000000..43d72a9b6e
--- /dev/null
+++ b/cesar/maximus/utils/src/LoggerTest.cpp
@@ -0,0 +1,39 @@
+
+#include "LoggerTest.h"
+
+#include "Logger.h"
+
+#include <iostream> // for 'cout', 'cerr' and 'clog'
+using namespace std;
+
+CPPUNIT_TEST_SUITE_REGISTRATION (LoggerTest);
+
+
+void LoggerTest::setUp (void)
+{
+ mpLogger = new Logger ();
+}
+
+
+void LoggerTest::tearDown (void)
+{
+ if (NULL != mpLogger)
+ {
+ delete (mpLogger);
+ mpLogger = NULL;
+ }
+}
+
+
+void LoggerTest::simpleTest (void)
+{
+ if (NULL != mpLogger)
+ {
+ // ...
+ }
+ else
+ {
+ CPPUNIT_FAIL ("Logger pointer is NULL");
+ }
+}
+