From 8c25bb98b7007f980d729f65f7e2910ab397dff3 Mon Sep 17 00:00:00 2001 From: Loenja Selter Date: Wed, 24 Jun 2015 00:49:05 +0100 Subject: [PATCH] reinit: create udp funcs. --- .gitattributes | 17 + .gitignore | 217 + .idea/.name | 1 + .idea/encodings.xml | 4 + .idea/misc.xml | 14 + .idea/modules.xml | 8 + .idea/python.iml | 8 + .idea/scopes/scope_settings.xml | 5 + .idea/vcs.xml | 6 + .idea/workspace.xml | 38356 ++++++++++++++++ README.md | 2 + arma-to-socket/arma-to-socket.sln | 45 + arma-to-socket/arma-to-socket/ReadMe.txt | 48 + arma-to-socket/arma-to-socket/Socket.cpp | 252 + arma-to-socket/arma-to-socket/Socket.h | 73 + .../arma-to-socket/arma-to-socket.cpp | 788 + .../arma-to-socket/arma-to-socket.vcxproj | 117 + .../arma-to-socket.vcxproj.filters | 45 + arma-to-socket/arma-to-socket/dllmain.cpp | 19 + arma-to-socket/arma-to-socket/stdafx.cpp | 8 + arma-to-socket/arma-to-socket/stdafx.h | 25 + arma-to-socket/arma-to-socket/targetver.h | 8 + .../description.ext | 32 + .../arma-to-socketTest.Stratis/functions.h | 10 + .../functions/tirp_fnc/fn_Tirp_callPlugin.sqf | 19 + .../functions/tirp_fnc/fn_Tirp_callback.sqf | 4 + .../arma-to-socketTest.Stratis/init.sqf | 0 .../arma-to-socketTest.Stratis/mission.sqm | 147 + arma-to-socket/debugconsole/ReadMe.txt | 40 + arma-to-socket/debugconsole/debugconsole.cpp | 86 + .../debugconsole/debugconsole.vcxproj | 101 + .../debugconsole/debugconsole.vcxproj.filters | 36 + arma-to-socket/debugconsole/stdafx.cpp | 8 + arma-to-socket/debugconsole/stdafx.h | 15 + arma-to-socket/debugconsole/targetver.h | 8 + arma-to-socket/testApp/ReadMe.txt | 40 + arma-to-socket/testApp/stdafx.cpp | 8 + arma-to-socket/testApp/stdafx.h | 15 + arma-to-socket/testApp/targetver.h | 8 + arma-to-socket/testApp/testApp.cpp | 554 + arma-to-socket/testApp/testApp.vcxproj | 107 + .../testApp/testApp.vcxproj.filters | 42 + python/client.py | 41 + python/hello_world.py | 8 + python/main.py | 147 + python/udp.py | 22 + 46 files changed, 41564 insertions(+) create mode 100644 .gitattributes create mode 100644 .gitignore create mode 100644 .idea/.name create mode 100644 .idea/encodings.xml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/python.iml create mode 100644 .idea/scopes/scope_settings.xml create mode 100644 .idea/vcs.xml create mode 100644 .idea/workspace.xml create mode 100644 README.md create mode 100644 arma-to-socket/arma-to-socket.sln create mode 100644 arma-to-socket/arma-to-socket/ReadMe.txt create mode 100644 arma-to-socket/arma-to-socket/Socket.cpp create mode 100644 arma-to-socket/arma-to-socket/Socket.h create mode 100644 arma-to-socket/arma-to-socket/arma-to-socket.cpp create mode 100644 arma-to-socket/arma-to-socket/arma-to-socket.vcxproj create mode 100644 arma-to-socket/arma-to-socket/arma-to-socket.vcxproj.filters create mode 100644 arma-to-socket/arma-to-socket/dllmain.cpp create mode 100644 arma-to-socket/arma-to-socket/stdafx.cpp create mode 100644 arma-to-socket/arma-to-socket/stdafx.h create mode 100644 arma-to-socket/arma-to-socket/targetver.h create mode 100644 arma-to-socket/arma-to-socketTest.Stratis/description.ext create mode 100644 arma-to-socket/arma-to-socketTest.Stratis/functions.h create mode 100644 arma-to-socket/arma-to-socketTest.Stratis/functions/tirp_fnc/fn_Tirp_callPlugin.sqf create mode 100644 arma-to-socket/arma-to-socketTest.Stratis/functions/tirp_fnc/fn_Tirp_callback.sqf create mode 100644 arma-to-socket/arma-to-socketTest.Stratis/init.sqf create mode 100644 arma-to-socket/arma-to-socketTest.Stratis/mission.sqm create mode 100644 arma-to-socket/debugconsole/ReadMe.txt create mode 100644 arma-to-socket/debugconsole/debugconsole.cpp create mode 100644 arma-to-socket/debugconsole/debugconsole.vcxproj create mode 100644 arma-to-socket/debugconsole/debugconsole.vcxproj.filters create mode 100644 arma-to-socket/debugconsole/stdafx.cpp create mode 100644 arma-to-socket/debugconsole/stdafx.h create mode 100644 arma-to-socket/debugconsole/targetver.h create mode 100644 arma-to-socket/testApp/ReadMe.txt create mode 100644 arma-to-socket/testApp/stdafx.cpp create mode 100644 arma-to-socket/testApp/stdafx.h create mode 100644 arma-to-socket/testApp/targetver.h create mode 100644 arma-to-socket/testApp/testApp.cpp create mode 100644 arma-to-socket/testApp/testApp.vcxproj create mode 100644 arma-to-socket/testApp/testApp.vcxproj.filters create mode 100644 python/client.py create mode 100644 python/hello_world.py create mode 100644 python/main.py create mode 100644 python/udp.py diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..bdb0cab --- /dev/null +++ b/.gitattributes @@ -0,0 +1,17 @@ +# Auto detect text files and perform LF normalization +* text=auto + +# Custom for Visual Studio +*.cs diff=csharp + +# Standard to msysgit +*.doc diff=astextplain +*.DOC diff=astextplain +*.docx diff=astextplain +*.DOCX diff=astextplain +*.dot diff=astextplain +*.DOT diff=astextplain +*.pdf diff=astextplain +*.PDF diff=astextplain +*.rtf diff=astextplain +*.RTF diff=astextplain diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..4e173eb --- /dev/null +++ b/.gitignore @@ -0,0 +1,217 @@ +################# +## Eclipse +################# + +*.pydevproject +.project +.metadata +bin/ +tmp/ +*.tmp +*.bak +*.swp +*~.nib +local.properties +.classpath +.settings/ +.loadpath + +# External tool builders +.externalToolBuilders/ + +# Locally stored "Eclipse launch configurations" +*.launch + +# CDT-specific +.cproject + +# PDT-specific +.buildpath + +arma-to-socket/boost_1_58_0/** +arma-to-socket/poco-1.6.0/** +################# +## Visual Studio +################# + +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results + +[Dd]ebug/ +[Rr]elease/ +x64/ +build/ +[Bb]in/ +[Oo]bj/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +*_i.c +*_p.c +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.log +*.scc + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +*.ncrunch* +.*crunch*.local.xml + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.Publish.xml +*.pubxml +*.publishproj + +# NuGet Packages Directory +## TODO: If you have NuGet Package Restore enabled, uncomment the next line +#packages/ + +# Windows Azure Build Output +csx +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.[Pp]ublish.xml +*.pfx +*.publishsettings + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file to a newer +# Visual Studio version. Backup files are not needed, because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +App_Data/*.mdf +App_Data/*.ldf + +############# +## Windows detritus +############# + +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Mac crap +.DS_Store + + +############# +## Python +############# + +*.py[cod] + +# Packages +*.egg +*.egg-info +dist/ +build/ +eggs/ +parts/ +var/ +sdist/ +develop-eggs/ +.installed.cfg + +# Installer logs +pip-log.txt + +# Unit test / coverage reports +.coverage +.tox + +#Translations +*.mo + +#Mr Developer +.mr.developer.cfg diff --git a/.idea/.name b/.idea/.name new file mode 100644 index 0000000..977f1d8 --- /dev/null +++ b/.idea/.name @@ -0,0 +1 @@ +arma-to-socket Python \ No newline at end of file diff --git a/.idea/encodings.xml b/.idea/encodings.xml new file mode 100644 index 0000000..d821048 --- /dev/null +++ b/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..f33e4ab --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..614b3c1 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/python.iml b/.idea/python.iml new file mode 100644 index 0000000..b16a194 --- /dev/null +++ b/.idea/python.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/scopes/scope_settings.xml b/.idea/scopes/scope_settings.xml new file mode 100644 index 0000000..922003b --- /dev/null +++ b/.idea/scopes/scope_settings.xml @@ -0,0 +1,5 @@ + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/workspace.xml b/.idea/workspace.xml new file mode 100644 index 0000000..31b4ae1 --- /dev/null +++ b/.idea/workspace.xml @@ -0,0 +1,38356 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + Python + + + + + Buildout + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 1426601155141 + + + 1434193625179 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/README.md b/README.md new file mode 100644 index 0000000..0479e1c --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# arma-to-socket +Communicate between arma 3 and other processes/languages. using TCP sockets. diff --git a/arma-to-socket/arma-to-socket.sln b/arma-to-socket/arma-to-socket.sln new file mode 100644 index 0000000..449407e --- /dev/null +++ b/arma-to-socket/arma-to-socket.sln @@ -0,0 +1,45 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 2013 +VisualStudioVersion = 12.0.31101.0 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "arma-to-socket", "arma-to-socket\arma-to-socket.vcxproj", "{E976B34A-CEC7-40BB-A2E3-0C9881104F99}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testApp", "testApp\testApp.vcxproj", "{8620790B-1432-473C-90E9-4AE77195595B}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "testdll", "testdll\testdll.vcxproj", "{D5A47F77-B920-45D8-B765-6F1333142C88}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "debugconsole", "debugconsole\debugconsole.vcxproj", "{4E4121C5-C889-4F3F-87B8-15C28EBC6A96}" + ProjectSection(ProjectDependencies) = postProject + {E976B34A-CEC7-40BB-A2E3-0C9881104F99} = {E976B34A-CEC7-40BB-A2E3-0C9881104F99} + {D5A47F77-B920-45D8-B765-6F1333142C88} = {D5A47F77-B920-45D8-B765-6F1333142C88} + EndProjectSection +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Release|Win32 = Release|Win32 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {E976B34A-CEC7-40BB-A2E3-0C9881104F99}.Debug|Win32.ActiveCfg = Debug|Win32 + {E976B34A-CEC7-40BB-A2E3-0C9881104F99}.Debug|Win32.Build.0 = Debug|Win32 + {E976B34A-CEC7-40BB-A2E3-0C9881104F99}.Release|Win32.ActiveCfg = Release|Win32 + {E976B34A-CEC7-40BB-A2E3-0C9881104F99}.Release|Win32.Build.0 = Release|Win32 + {E976B34A-CEC7-40BB-A2E3-0C9881104F99}.Release|Win32.Deploy.0 = Release|Win32 + {8620790B-1432-473C-90E9-4AE77195595B}.Debug|Win32.ActiveCfg = Debug|Win32 + {8620790B-1432-473C-90E9-4AE77195595B}.Debug|Win32.Build.0 = Debug|Win32 + {8620790B-1432-473C-90E9-4AE77195595B}.Release|Win32.ActiveCfg = Release|Win32 + {8620790B-1432-473C-90E9-4AE77195595B}.Release|Win32.Build.0 = Release|Win32 + {D5A47F77-B920-45D8-B765-6F1333142C88}.Debug|Win32.ActiveCfg = Debug|Win32 + {D5A47F77-B920-45D8-B765-6F1333142C88}.Debug|Win32.Build.0 = Debug|Win32 + {D5A47F77-B920-45D8-B765-6F1333142C88}.Release|Win32.ActiveCfg = Release|Win32 + {D5A47F77-B920-45D8-B765-6F1333142C88}.Release|Win32.Build.0 = Release|Win32 + {4E4121C5-C889-4F3F-87B8-15C28EBC6A96}.Debug|Win32.ActiveCfg = Debug|Win32 + {4E4121C5-C889-4F3F-87B8-15C28EBC6A96}.Debug|Win32.Build.0 = Debug|Win32 + {4E4121C5-C889-4F3F-87B8-15C28EBC6A96}.Release|Win32.ActiveCfg = Release|Win32 + {4E4121C5-C889-4F3F-87B8-15C28EBC6A96}.Release|Win32.Build.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/arma-to-socket/arma-to-socket/ReadMe.txt b/arma-to-socket/arma-to-socket/ReadMe.txt new file mode 100644 index 0000000..91ef8d5 --- /dev/null +++ b/arma-to-socket/arma-to-socket/ReadMe.txt @@ -0,0 +1,48 @@ +======================================================================== + DYNAMIC LINK LIBRARY : arma-to-socket Project Overview +======================================================================== + +AppWizard has created this arma-to-socket DLL for you. + +This file contains a summary of what you will find in each of the files that +make up your arma-to-socket application. + + +arma-to-socket.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +arma-to-socket.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +arma-to-socket.cpp + This is the main DLL source file. + + When created, this DLL does not export any symbols. As a result, it + will not produce a .lib file when it is built. If you wish this project + to be a project dependency of some other project, you will either need to + add code to export some symbols from the DLL so that an export library + will be produced, or you can set the Ignore Input Library property to Yes + on the General propert page of the Linker folder in the project's Property + Pages dialog box. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named arma-to-socket.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/arma-to-socket/arma-to-socket/Socket.cpp b/arma-to-socket/arma-to-socket/Socket.cpp new file mode 100644 index 0000000..4a03883 --- /dev/null +++ b/arma-to-socket/arma-to-socket/Socket.cpp @@ -0,0 +1,252 @@ + + +#include "stdafx.h" +#include +#include "Socket.h" + + + +Socket::Socket(){ + status = -1; + connected = false; + statusMsg = *"Socket Created"; +} + +int Socket::Prepare(CHAR *address, int sockType = 1, char* port = "9999", int timeout= 1000) +{ + if (status != -1){ + status = -1; + } + + sockPort = port; + protocol = sockType; + addressPtr = address; + s = INVALID_SOCKET; + result = NULL, + ptr = NULL, + hints; + sendbuf = "this is a test"; + + // Validate the parameters + + // Initialize Winsock + initWinsock(); + + //set timout + int nTimeout = timeout; // ms + setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, (const char*)&nTimeout, sizeof(int)); + + + ZeroMemory(&hints, sizeof(hints)); + //set sock type + hints.ai_family = AF_UNSPEC; + + hints.ai_socktype = sockType; + //set protocol + switch (sockType){ + + case 1: + hints.ai_protocol = IPPROTO_TCP; + break; + case 2: + hints.ai_protocol = IPPROTO_UDP; + break; + default: + hints.ai_protocol = IPPROTO_TCP; + + }; + + status = 0; + statusMsg = *"Socket Prepped"; + return 0; + +} + +int Socket::Init() { + + // Resolve the server address and port + iResult = getaddrinfo(addressPtr, sockPort, &hints, &result); + if (iResult != 0) { + statusMsg = ("getaddrinfo failed with error: %d\n", iResult); + + return 1; + } + + // Attempt to connect to an address until one succeeds + for (ptr = result; ptr != NULL; ptr = ptr->ai_next) { + + // Create a SOCKET for connecting to server + s = socket(ptr->ai_family, ptr->ai_socktype, + ptr->ai_protocol); + if (s == INVALID_SOCKET) { + statusMsg = ("socket failed with error: %ld\n", WSAGetLastError()); + + return 1; + } + + //sendbuf = "this is a test"; + //iResult = sendto(s, sendbuf, strlen(sendbuf), 0, ptr->ai_addr, ptr->ai_addrlen); + // Connect to server. + if (protocol == 1){ + + + if (connected != true){ + + iResult = connect(s, ptr->ai_addr, (int)ptr->ai_addrlen); + + if (iResult == SOCKET_ERROR) { + closesocket(s); + s = INVALID_SOCKET; + continue; + } + connected = true; + } + } + + address = *new(struct sockaddr); + address = *ptr->ai_addr; + addressLen = *new(int); + addressLen = ptr->ai_addrlen; + + + break; + } + + freeaddrinfo(result); + + if (s == INVALID_SOCKET) { + statusMsg = *("Unable to connect to server!\n"); + + return 1; + } + + return 0; +}; + +int Socket::Send(string input){ + if (status != 0){ + return status; + } + sendbuf = (char*)input.c_str(); + + switch (protocol){ + case 1: + // Send an initial buffer + iResult = send(s, sendbuf, (int)strlen(sendbuf), 0); + break; + case 2: + iResult = sendto(s, sendbuf, strlen(sendbuf), 0, &address, addressLen); + break; + + default: + iResult = -1; + + }; + if (iResult == SOCKET_ERROR) { + statusMsg = ("send failed with error: %d\n", WSAGetLastError()); + closesocket(s); + + return 1; + } + memset(sendbuf, '\0', DEFAULT_BUFLEN); + + statusMsg = ("Bytes Sent: %ld\n", iResult); + return 0; + + +}; + +string Socket::Recieve() { + if (status != 0){ + return to_string(status); + } + string rtn = ""; + //statusMsg = ((rtn.c_str())); + //memset(recvbuf, '\0', DEFAULT_BUFLEN); + statusMsg = *("\nwiped buffer\n"); + // Receive data until the server closes the connection + do { + + iResult = recv(s, recvbuf, recvbuflen, 0); + + statusMsg = *((to_string(iResult)).c_str()); + + if (iResult > 0){ + + rtn += recvbuf; + statusMsg = *(recvbuf); + + + return rtn; + } + + else{ + statusMsg = ("recv failed: %d\n", WSAGetLastError()); + + } + } while (iResult > 0); + + return to_string(WSAGetLastError()); +}; + +int Socket::Disconnect(){ + freeaddrinfo(result); + // shutdown the send half of the connection since no more data will be sent + iResult = shutdown(s, SD_SEND); + if (iResult == SOCKET_ERROR) { + //printf("shutdown failed: %d\n", WSAGetLastError()); + closesocket(s); + + status = 1; + } + return 0; + +}; + +string Socket::SendRecieve(string input){ + Send(input); + return Recieve(); + +}; + +int Socket::getStatus(){ + + return status; +} +char Socket::getStatusMsg(){ + return statusMsg; +} +Socket::~Socket() +{ + // cleanup + closesocket(s); + + + status = 0; +}; + +bool Socket::WinsockInitialized() +{ + SOCKET s = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP); + if (s == INVALID_SOCKET && WSAGetLastError() == WSANOTINITIALISED){ + return false; + } + + closesocket(s); + return true; +} + + +int Socket::initWinsock(){ + if (!WinsockInitialized()){ + iResult = WSAStartup(MAKEWORD(2, 2), &wsaData); + if (iResult != 0) { + statusMsg = ("WSAStartup failed with error: %d\n", iResult); + status = 1; + return 1; + } + + } + return 0; + +} \ No newline at end of file diff --git a/arma-to-socket/arma-to-socket/Socket.h b/arma-to-socket/arma-to-socket/Socket.h new file mode 100644 index 0000000..ab3786a --- /dev/null +++ b/arma-to-socket/arma-to-socket/Socket.h @@ -0,0 +1,73 @@ +#pragma once + +#define WIN32_LEAN_AND_MEAN +#include "stdafx.h" +#include +#include +#include +#include +#include +#include + + + + +// Need to link with Ws2_32.lib, Mswsock.lib, and Advapi32.lib +#pragma comment (lib, "Ws2_32.lib") +#pragma comment (lib, "Mswsock.lib") +#pragma comment (lib, "AdvApi32.lib") + +#define DEFAULT_BUFLEN 1024 +#define DEFAULT_PORT "9999" + +using namespace std; + +/* +Status Codes: +-1: initialised but not connected +0:ready to connect +1: errror occured + + + +*/ +class Socket +{ +public: + Socket(); + Socket(char*, int); + int Prepare(char*, int, char*, int); + int Init(); + int Send(string input); + string Recieve(); + int Disconnect(); + string SendRecieve(string input); + int getStatus(); + char getStatusMsg(); + ~Socket(); + bool WinsockInitialized(); + int initWinsock(); + +private: + struct addrinfo *result = NULL, + *ptr = NULL, + hints; + //addrinfo address; + sockaddr address; + int addressLen; + char *sendbuf; + char recvbuf[DEFAULT_BUFLEN]; + int iResult; + int recvbuflen = DEFAULT_BUFLEN; + int status; + CHAR statusMsg; + SOCKET s; + CHAR addressChar; + CHAR *addressPtr; + WSADATA wsaData; + int protocol; + bool connected; + char * sockPort; + + +}; diff --git a/arma-to-socket/arma-to-socket/arma-to-socket.cpp b/arma-to-socket/arma-to-socket/arma-to-socket.cpp new file mode 100644 index 0000000..db693c1 --- /dev/null +++ b/arma-to-socket/arma-to-socket/arma-to-socket.cpp @@ -0,0 +1,788 @@ +// threaded_example.cpp : Defines the exported functions for the DLL application. +// + +#include "stdafx.h" +#include +#include +#include +#include +#include + +#include + +#include + +#include +#include +#include +#include +#include +#include "Poco/Net/DNS.h" +#include + +#include +#include +#include +#include + +#include + +using std::endl; +using std::string; +using std::vector; +using std::pair; +using std::make_pair; +using std::exception; +using Poco::Exception; +using Poco::NoThreadAvailableException; +using Poco::Net::StreamSocket; +using Poco::Net::DatagramSocket; +using Poco::Net::SocketAddress; +using Poco::ThreadPool; +using Poco::Thread; +using Poco::Runnable; +using Poco::Mutex; +using Poco::FIFOBuffer; +using Poco::Net::Socket; + + +#define BUFFERLEN 8192 +//using namespace std; + + +// mySockets: Map containing Identifier & socketPointer pair. +// +std::map mySockets; +std::map myUDPSockets; + +struct Data { + bool ready = false; + std::string params = ""; + std::string result = ""; + std::vector resultsArray; + bool isLong = false; + int lastSent = -1; + int PacketCount = 0; +}; + +std::unordered_map tickets; +std::mutex mtx; +std::mutex UDPMtx; +std::mutex scktsMtx; +//deliminator: Function call deliminator, escaped by "\" +char* deliminator = ":"; +int loadOptions(std::string, std::string*, int*, int*); +std::vector& split(const std::string &s, char delim, std::vector &elems); +std::vector split(const std::string &s, char delim); +std::atomic worker_working(false); +long int id = 0; // global ticket id +long int cur_id = 0;// current ticket id +std::string newSocket(std::vector&); +std::string TCPSend(std::vector&); +std::string TCPRecv(std::vector&); +std::string TCPSRecv(std::vector&); +std::string TCPClose(std::vector&); + +std::string UDPNew(std::vector&); +std::string UDPSend(std::vector&); +std::string UDPRecv(std::vector&); +std::string UDPSRecv(std::vector&); +std::string UDPClose(std::vector&); +int maxLen; + +extern "C" { __declspec (dllexport) void __stdcall RVExtension(char *output, int outputSize, const char *function); } + +void worker() { + while (worker_working = id > cur_id) // next ticket exists? + { + mtx.lock(); + Data ticket = tickets[++cur_id];// copy ticket + mtx.unlock(); + string input = ticket.params; // get input + string output = "output: " + input; // process input + //Sleep(10); //sleep for 0.01 sec (FOR TESTING PURPOSES ONLY) + + + std::map < std::string, int > systemCalls; + systemCalls.insert(pair("version", 1)); + systemCalls.insert(pair("APIVersion", 2)); + systemCalls.insert(pair("tcp", 3)); + systemCalls.insert(pair("udp", 4)); + + std::map < std::string, int > mgmntCalls; + + mgmntCalls.insert(pair("count", 1)); + mgmntCalls.insert(pair("list", 2)); + mgmntCalls.insert(pair("cleanup", 3)); + mgmntCalls.insert(pair("rmall", 4)); + + std::map < std::string, int > useCalls; + useCalls.insert(pair("send", 1)); + useCalls.insert(pair("recv", 2)); + useCalls.insert(pair("sRecv", 3)); + + std::map < std::string, int > tcp; + tcp.insert(pair("new", 1)); + tcp.insert(pair("send", 2)); + tcp.insert(pair("recv", 3)); + tcp.insert(pair("srecv", 4)); + tcp.insert(pair("close", 5)); + tcp.insert(pair("srecv", 6)); + + vector vect; + vect = split(input, *A2S_DELIMINATOR); + //std::transform(vect[1].begin(), vect[1].end(), vect[1].begin(), ::tolower); + //try { + int length = vect.size(); + //std::cout << length << std::endl; + switch (systemCalls[vect[0]]){ + case 1: + { + //std::wcout << "version....." << std::endl; + output = A2S_VERSION; + break; + } + case 2: + { + output = A2S_API_VERSION; + break; + } + //TCP + case 3: + { + if (length < 3){ + output = "TCP calls requires at least 3 arguments. You tried: '" + input + "'"; + break; + } + else {} + + switch (tcp[vect[1]]) + { + //create new socket + case 1: + { + //std::cout << "creating socket" << std::endl; + if (length < 3){ + output = "create call requires at least 3 arguments. You tried: '" + input + "'"; + break; + } + else + { + output = newSocket(vect); + } + + break; + } + //send + case 2: + { + if (length < 4){ + output = "send requires at least 4 arguments. You tried: '" + input + "'"; + break; + } + else{ + output = TCPSend(vect); + } + + + break; + + } + //recieve + case 3: + { + + if (length < 3){ + output = "recieve requires at least 2 arguments. You tried: '" + input + "'"; + break; + } + else { + output = TCPRecv(vect); + } + + break; + } + + //send recieve + case 4: + { + //std::cout << "recieving" << std::endl; + if (length < 4){ + output = "recieve requires at least 4 arguments. You tried: '" + input + "'"; + break; + } + else { + TCPSend(vect); + output = TCPRecv(vect); + } + break; + } + + //close + case 5: + { + if (length < 2){ + output = "recieve requires at least 2 arguments. You tried: '" + input + "'"; + break; + } + + + break; + } + + default: + { + break; + } + + break; + } + break; + + default: + { + output = "error:invalid call was made"; + break; + } + + } + + } + + + //} + /*catch (...){ + output = "an error occured unrecognized call was made please check the wiki for help. You tried: '" + input + "'"; + }*/ + //output = "unhandled call as of yet"; + int outLength = output.length(); + int bodyLength = maxLen - A2S_HEADER_SIZE; + if (outLength > maxLen){ + ticket.PacketCount = 1 + ((outLength - 1) / bodyLength); + ticket.isLong = true; + + for (int x = 0; x < ticket.PacketCount; x ++){ + + ticket.resultsArray.push_back(output.substr(x*bodyLength, bodyLength)); + + } + + } + else + { + ticket.PacketCount = 1; + } + ticket.result = output; // prepare result + ticket.ready = true; // notify about result + + mtx.lock(); + tickets[cur_id] = ticket; // copy back the result + mtx.unlock(); + } +}; + +//loadOptions: loads options for selected socket +//std::string name: socket identifier. +//std::string* address: socket address pointer. +//int* timeout: timeout pointer. +//int* protocol: protocol identifier pointer. +int loadOptions(std::string name, std::string* address, int* timeout, int* protocol){ + char cName = *name.c_str(); + + //unsigned int timeout = 0; + //std::string address = "address"; + //std::string port = "port"; + //unsigned int protocol = 10000; + namespace po = boost::program_options; + std::string timeoutStr = ".timeout"; + std::string addressStr = ".address"; + std::string portStr = ".port"; + std::string protocolStr = ".protocol"; + timeoutStr = name + timeoutStr; + char *timeoutCStr = &timeoutStr[0u]; + addressStr = name + addressStr; + char *addressCStr = &addressStr[0u]; + portStr = name + portStr; + char *portCStr = &portStr[0u]; + protocolStr = name + protocolStr; + char *protocolCStr = &protocolStr[0u]; + + typedef std::vector< std::string > plugin_names_t; + plugin_names_t plugin_names; + std::string settings_type; + + //std::cout << protocolCStr << "\n"; + // Setup options. + po::options_description desc("Options"); + desc.add_options() + (timeoutCStr, + po::value(timeout), + "Socket timeout (ms)") + + (addressCStr, + po::value< std::string >(address), + "Socket address (uri)") + + /*(portCStr, + po::value< std::string >(&port), + "Socket port") +*/ + (protocolCStr, + po::value< int >(protocol), + "Socket protocol (1:TCP,2:UDP)") + ; + // Load setting file. + po::variables_map vm; + std::ifstream settings_file("a32s.ini", std::ifstream::in); + po::store(po::parse_config_file(settings_file, desc, true), vm); + settings_file.close(); + po::notify(vm); + + // Print settings. + //typedef std::vector< std::string >::iterator iterator; + /*for (plugin_names_t::iterator iterator = plugin_names.begin(), + end = plugin_names.end(); + iterator < end; + ++iterator) + { + std::cout << "plugin.name: " << *iterator << std::endl; + }*/ +// std::cout << name << "\n"; +// std::cout << std::to_string(*protocol) << "\n"; + //std::cout << port << "\n"; +// std::cout << *address << "\n"; +// std::cout << *timeout << "\n"; + return 0; + +}; + +std::vector &split(const std::string &s, char delim, std::vector &elems) { + std::stringstream ss(s); + std::string item; + while (std::getline(ss, item, delim)) { + elems.push_back(item); + } + return elems; +} + +std::vector split(const std::string &s, char delim) { + std::vector elems; + split(s, delim, elems); + return elems; +}; + +//RVExtension: Function called by arma, contains core threading framework, +//Parameters: +// char *output: pointer to output character array +// int outputSize: maximum output length +// const char *function: string input from arma +void __stdcall RVExtension(char *output, int outputSize, const char *function) +{ + maxLen = outputSize; + std::string str(function); + std::string v = "version"; + std::string av = "APIVersion"; + std::string ol = "maxLength"; + if (str == v){ + strncpy_s(output, outputSize, A2S_VERSION, _TRUNCATE); + return; + } + else if (str == av){ + strncpy_s(output, outputSize, A2S_API_VERSION, _TRUNCATE); + return; + + } + else if (str == ol){ + + strncpy_s(output, outputSize, std::to_string(outputSize).c_str(), _TRUNCATE); + return; + + } + + + if (!strncmp(function, "r:", 2)) // detect checking for result + { + long int num = atol(&function[2]); // ticket number or 0 + if (tickets.find(num) != tickets.end()) // ticket exists + { + mtx.lock(); + if (tickets[num].ready) // result is ready + { + std::string header; + if (!tickets[num].isLong){ + header = "0:"; + std::string rtn = header + tickets[num].result; + strncpy_s(output, outputSize, (rtn.c_str()), _TRUNCATE);// result + tickets.erase(num); // get rid of the read ticket + + } + else + { + header = "1:" + + std::to_string(tickets[num].PacketCount) + A2S_DELIMINATOR + + std::to_string(tickets[num].lastSent + 2) + A2S_DELIMINATOR; + std::string rtn = header + tickets[num].resultsArray[tickets[num].lastSent + 1].c_str(); + strncpy_s(output, outputSize, rtn.c_str(), _TRUNCATE);// result + tickets[num].lastSent++; + if (tickets[num].lastSent >= (tickets[num].PacketCount-1)){ + tickets.erase(num); // get rid of the read ticket + + } + } + mtx.unlock(); + return; + } + mtx.unlock(); + strncpy_s(output, outputSize, "WAIT", _TRUNCATE); // result is not ready + return; + } + strncpy_s(output, outputSize, "EMPTY", _TRUNCATE); // no such ticket + } + else if (!strncmp(function, "s:", 2)) // detect ticket submission + { + Data data; data.params = string(&function[2]); // extract params + mtx.lock(); tickets.insert(pair(++id, data)); // add ticket to the queue + mtx.unlock(); if (!worker_working) // if worker thread is finished, start another one + { + worker_working = true; + std::thread worker(worker); + worker.detach(); // start parallel process + } + strncpy_s(output, outputSize, std::to_string(id).c_str(), _TRUNCATE); // ticket number + } + else + { + strncpy_s(output, outputSize, "INVALID COMMAND", _TRUNCATE); // other input + } +} + +std::string newSocket(std::vector& vect) +{ + std::string rtn; + try { + scktsMtx.lock(); + if (mySockets.find(vect[2]) == mySockets.end()) { + scktsMtx.unlock(); +// std::cout << "Socket Not found...creating" << std::endl; + std::string addrStr = "127.0.0.1:9999"; + int timeout; + int protocol; + int iResult = loadOptions(vect[2], &addrStr, &timeout, &protocol); + if (iResult == 0){ +// std::cout << timeout; + SocketAddress address(addrStr); +// std::cout << addrStr; + StreamSocket* mySocket = new StreamSocket(address); + Poco::Timespan timeoutSpan(timeout); + mySocket->setReceiveTimeout(timeoutSpan); + scktsMtx.lock(); + mySockets.insert(pair(vect[2], mySocket)); + scktsMtx.unlock(); + rtn = "socket created"; + } + else + { + rtn = "There was an error loading config file"; + } + + + } + else { + rtn = "the socket specified already exists"; + } + } + catch (Poco::Exception &e){ + rtn = e.displayText(); + } + catch (boost::program_options::validation_error &e) + { + rtn = e.what(); + } + catch (...){ + + rtn = "Error: an unhandled error occured"; + } + return rtn; + +} + +std::string TCPSend(std::vector& vect) +{ + std::string rtn; + + try{ + + Poco::FIFOBuffer sendData(BUFFERLEN, false); + sendData.copy(vect[3].c_str(), vect[3].size()); + int iResult = mySockets[vect[2]]->sendBytes(sendData); + rtn = "data sent, sendBytes returned: " + std::to_string(iResult); + } + catch (Poco::Exception &e){ + rtn = e.displayText(); + } + + catch (boost::program_options::validation_error &e) + { + rtn = e.what(); + } + catch (...){ + + rtn = "Error: an unhandled error occured"; + } + return rtn; +} + +std::string TCPRecv(std::vector& vect) +{ + std::string rtn; + +// std::cout << "Recieving data" << std::endl; + //Recieve + if (mySockets.find(vect[2]) == mySockets.end()) { + rtn = "socket Not found"; + + } + else { + try { + + Poco::FIFOBuffer recvData(BUFFERLEN); + + int iResult = mySockets[vect[2]]->receiveBytes(recvData); + char result[A2S_PACKET_SIZE] = ""; + + recvData.read(result, recvData.size()); + rtn = result; + + + } + catch (Poco::Exception &e) + { + rtn = e.displayText(); +// std::cout << e.displayText() << std::endl; + + } + + + + catch (boost::program_options::validation_error &e) + { + rtn = e.what(); + } + catch (std::exception &e){ + rtn = e.what(); + } + catch (...){ + + rtn = "Error: an unhandled error occured"; + } + + + } + return rtn; +} + +std::string TCPClose(std::vector& vect) +{ + std::string rtn; +// std::cout << "closing data" << std::endl; + //Recieve + if (mySockets.find(vect[2]) == mySockets.end()) { + rtn = "socket Not found"; + + } + else { + try { + mySockets[vect[2]]->shutdown(); + mySockets.erase(vect[2]); + + } + catch (Poco::Exception &e) + { + mySockets[vect[2]]->close(); + mySockets.erase(vect[2]); + rtn = e.displayText(); +// std::cout << e.displayText() << std::endl; + + + } + + + catch (boost::program_options::validation_error &e) + { + rtn = e.what(); + } + catch (std::exception &e){ + rtn = e.what(); + } + catch (...){ + + rtn = "Error: an unhandled error occured"; + } + } + return rtn; +} + +std::string UDPNew(std::vector& vect) +{ + std::string rtn; + try { + scktsMtx.lock(); + if (myUDPSockets.find(vect[2]) == myUDPSockets.end()) { + scktsMtx.unlock(); + // std::cout << "Socket Not found...creating" << std::endl; + std::string addrStr = "127.0.0.1:9999"; + int timeout; + int protocol; + int iResult = loadOptions(vect[2], &addrStr, &timeout, &protocol); + if (iResult == 0){ + // std::cout << timeout; + SocketAddress address(addrStr); + // std::cout << addrStr; + DatagramSocket* mySocket = new DatagramSocket(address); + Poco::Timespan timeoutSpan(timeout); + mySocket->setReceiveTimeout(timeoutSpan); + scktsMtx.lock(); + myUDPSockets.insert(pair(vect[2], mySocket)); + scktsMtx.unlock(); + rtn = "socket created"; + } + else + { + rtn = "There was an error loading config file"; + + } + + } + + else { + rtn = "the socket specified already exists"; + } + } + catch (Poco::Exception &e){ + rtn = e.displayText(); + } + catch (boost::program_options::validation_error &e) + { + rtn = e.what(); + } + catch (...){ + + rtn = "Error: an unhandled error occured"; + } + return rtn; + } + +std::string UDPSend(std::vector& vect) +{ + std::string rtn; + + try{ + + Poco::FIFOBuffer sendData(BUFFERLEN, false); + sendData.copy(vect[3].c_str(), vect[3].size()); + int iResult = mySockets[vect[2]]->sendBytes(sendData); + rtn = "data sent, sendBytes returned: " + std::to_string(iResult); + } + catch (Poco::Exception &e){ + rtn = e.displayText(); + } + + catch (boost::program_options::validation_error &e) + { + rtn = e.what(); + } + catch (...){ + + rtn = "Error: an unhandled error occured"; + } + return rtn; +} +std::string UDPRecv(std::vector& vect) +{ + std::string rtn; + + // std::cout << "Recieving data" << std::endl; + //Recieve + if (mySockets.find(vect[2]) == mySockets.end()) { + rtn = "socket Not found"; + + } + else { + try { + + Poco::FIFOBuffer recvData(BUFFERLEN); + + int iResult = mySockets[vect[2]]->receiveBytes(recvData); + char result[A2S_PACKET_SIZE] = ""; + + recvData.read(result, recvData.size()); + rtn = result; + + + } + catch (Poco::Exception &e) + { + rtn = e.displayText(); + // std::cout << e.displayText() << std::endl; + + } + + + + catch (boost::program_options::validation_error &e) + { + rtn = e.what(); + } + catch (std::exception &e){ + rtn = e.what(); + } + catch (...){ + + rtn = "Error: an unhandled error occured"; + } + + + } + return rtn; +} + +std::string UDPClose(std::vector& vect) +{ + std::string rtn; + // std::cout << "closing data" << std::endl; + //Recieve + if (mySockets.find(vect[2]) == mySockets.end()) { + rtn = "socket Not found"; + + } + else { + try { + mySockets[vect[2]]->shutdown(); + mySockets.erase(vect[2]); + + } + catch (Poco::Exception &e) + { + mySockets[vect[2]]->close(); + mySockets.erase(vect[2]); + rtn = e.displayText(); + // std::cout << e.displayText() << std::endl; + + + } + + + catch (boost::program_options::validation_error &e) + { + rtn = e.what(); + } + catch (std::exception &e){ + rtn = e.what(); + } + catch (...){ + + rtn = "Error: an unhandled error occured"; + } + } + return rtn; +} \ No newline at end of file diff --git a/arma-to-socket/arma-to-socket/arma-to-socket.vcxproj b/arma-to-socket/arma-to-socket/arma-to-socket.vcxproj new file mode 100644 index 0000000..46e59be --- /dev/null +++ b/arma-to-socket/arma-to-socket/arma-to-socket.vcxproj @@ -0,0 +1,117 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {E976B34A-CEC7-40BB-A2E3-0C9881104F99} + Win32Proj + armatosocket + + + + DynamicLibrary + true + v120 + Unicode + + + DynamicLibrary + false + v120 + true + Unicode + + + + + + + + + + + + + true + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)boost_1_58_0;$(SolutionDir)\poco-1.6.0\;$(SolutionDir)\poco-1.6.0\Net\include;$(SolutionDir)\poco-1.6.0\Foundation\include + $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)boost_1_58_0\lib32-msvc-12.0;$(SolutionDir)\poco-1.6.0\lib; + $(WindowsSDK_MetadataPath);$(SolutionDir)boost_1_58_0;$(SolutionDir)\poco-1.6.0\lib; + $(SolutionDir)\arma-to-socket\release\ + a32s + + + false + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)boost_1_58_0;$(SolutionDir)\poco-1.6.0\;$(SolutionDir)\poco-1.6.0\Net\include;$(SolutionDir)\poco-1.6.0\Foundation\include + $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)boost_1_58_0\lib32-msvc-12.0;$(SolutionDir)\poco-1.6.0\lib; + $(WindowsSDK_MetadataPath);$(SolutionDir)boost_1_58_0;$(SolutionDir)\poco-1.6.0\lib; + $(SolutionDir)\arma-to-socket\release\ + a32s + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS;_USRDLL;ARMATOSOCKET_EXPORTS;%(PreprocessorDefinitions) + true + C:\Users\Lonja\Downloads\boost\boost_1_58_0 + + + Windows + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_WINDOWS;_USRDLL;ARMATOSOCKET_EXPORTS;%(PreprocessorDefinitions) + true + C:\Users\Lonja\Downloads\boost\boost_1_58_0 + + + Windows + true + true + true + + + + + + + + + + + + + + false + + + false + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/arma-to-socket/arma-to-socket/arma-to-socket.vcxproj.filters b/arma-to-socket/arma-to-socket/arma-to-socket.vcxproj.filters new file mode 100644 index 0000000..0998c15 --- /dev/null +++ b/arma-to-socket/arma-to-socket/arma-to-socket.vcxproj.filters @@ -0,0 +1,45 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/arma-to-socket/arma-to-socket/dllmain.cpp b/arma-to-socket/arma-to-socket/dllmain.cpp new file mode 100644 index 0000000..69b5891 --- /dev/null +++ b/arma-to-socket/arma-to-socket/dllmain.cpp @@ -0,0 +1,19 @@ +// dllmain.cpp : Defines the entry point for the DLL application. +#include "stdafx.h" + +BOOL APIENTRY DllMain( HMODULE hModule, + DWORD ul_reason_for_call, + LPVOID lpReserved + ) +{ + switch (ul_reason_for_call) + { + case DLL_PROCESS_ATTACH: + case DLL_THREAD_ATTACH: + case DLL_THREAD_DETACH: + case DLL_PROCESS_DETACH: + break; + } + return TRUE; +} + diff --git a/arma-to-socket/arma-to-socket/stdafx.cpp b/arma-to-socket/arma-to-socket/stdafx.cpp new file mode 100644 index 0000000..4d9365e --- /dev/null +++ b/arma-to-socket/arma-to-socket/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// arma-to-socket.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/arma-to-socket/arma-to-socket/stdafx.h b/arma-to-socket/arma-to-socket/stdafx.h new file mode 100644 index 0000000..0e8f651 --- /dev/null +++ b/arma-to-socket/arma-to-socket/stdafx.h @@ -0,0 +1,25 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once +#define POCO_STATIC + +#include "targetver.h" + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include + + +// A2S_VERSION: core version +#define A2S_VERSION "1" +//A2S_API_VERSION: API Version +#define A2S_API_VERSION "1" +#define A2S_PACKET_SIZE 8192 +# define A2S_HEADER_SIZE 20 +#define _CRT_SECURE_NO_WARNINGS +#define A2S_DELIMINATOR ":" + +// TODO: reference additional headers your program requires here diff --git a/arma-to-socket/arma-to-socket/targetver.h b/arma-to-socket/arma-to-socket/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/arma-to-socket/arma-to-socket/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/arma-to-socket/arma-to-socketTest.Stratis/description.ext b/arma-to-socket/arma-to-socketTest.Stratis/description.ext new file mode 100644 index 0000000..b85c089 --- /dev/null +++ b/arma-to-socket/arma-to-socketTest.Stratis/description.ext @@ -0,0 +1,32 @@ +OnLoadName = "plugin test"; +Author = "Lönja 'Tirpitz' Selter"; +OnLoadMission = "plugin test"; + +disabledAI = 1; +enableDebugConsole = 1; +allowFunctionsRecompile = 1; +Respawn = 2; +RespawnDelay = 2; + +class Header +{ + gameType=COOP; + minPlayers=1; + maxPlayers=12; +}; + +class CfgFunctions +{ + #include "functions.h" +}; + +class Params { + // 0 - Time Of Day + class tirp_debug { + title="Debug"; + values[]={1, 1}; + texts[]={"On", "Off" }; + default=0; + }; + +}; \ No newline at end of file diff --git a/arma-to-socket/arma-to-socketTest.Stratis/functions.h b/arma-to-socket/arma-to-socketTest.Stratis/functions.h new file mode 100644 index 0000000..28e83dc --- /dev/null +++ b/arma-to-socket/arma-to-socketTest.Stratis/functions.h @@ -0,0 +1,10 @@ +class tirp +{ + tag = "tirp"; + class tirp_fnc + { + file = ""; + class Tirp_callPlugin {}; + class Tirp_callback{}; + }; +}; diff --git a/arma-to-socket/arma-to-socketTest.Stratis/functions/tirp_fnc/fn_Tirp_callPlugin.sqf b/arma-to-socket/arma-to-socketTest.Stratis/functions/tirp_fnc/fn_Tirp_callPlugin.sqf new file mode 100644 index 0000000..cdfaf42 --- /dev/null +++ b/arma-to-socket/arma-to-socketTest.Stratis/functions/tirp_fnc/fn_Tirp_callPlugin.sqf @@ -0,0 +1,19 @@ +//thanks to killzone kid: http://killzonekid.com/ + +[format [ + "r:%1", + "arma-to-socket" callExtension format [ + "s:%1", + _this select 0 + ] + ], + _this select 1] spawn { + waitUntil { + _res = "arma-to-socket" callExtension (_this select 0); + + if (_res != "WAIT") exitWith { _res call (_this select 1); + true + }; + false + }; + }; \ No newline at end of file diff --git a/arma-to-socket/arma-to-socketTest.Stratis/functions/tirp_fnc/fn_Tirp_callback.sqf b/arma-to-socket/arma-to-socketTest.Stratis/functions/tirp_fnc/fn_Tirp_callback.sqf new file mode 100644 index 0000000..d2ce187 --- /dev/null +++ b/arma-to-socket/arma-to-socketTest.Stratis/functions/tirp_fnc/fn_Tirp_callback.sqf @@ -0,0 +1,4 @@ +//thanks to killzone kid: http://killzonekid.com/ + +//dummy callback function hints the output. +hint _this; // output: myparam \ No newline at end of file diff --git a/arma-to-socket/arma-to-socketTest.Stratis/init.sqf b/arma-to-socket/arma-to-socketTest.Stratis/init.sqf new file mode 100644 index 0000000..e69de29 diff --git a/arma-to-socket/arma-to-socketTest.Stratis/mission.sqm b/arma-to-socket/arma-to-socketTest.Stratis/mission.sqm new file mode 100644 index 0000000..2fa7dea --- /dev/null +++ b/arma-to-socket/arma-to-socketTest.Stratis/mission.sqm @@ -0,0 +1,147 @@ +version=12; +class Mission +{ + addOns[]= + { + "A3_Characters_F_BLUFOR", + "a3_characters_f", + "a3_map_stratis" + }; + addOnsAuto[]= + { + "A3_Characters_F_BLUFOR", + "a3_characters_f", + "a3_map_stratis" + }; + randomSeed=5412815; + class Intel + { + timeOfChanges=1800.0002; + startWeather=0.30000001; + startWind=0.1; + startWaves=0.1; + forecastWeather=0.30000001; + forecastWind=0.1; + forecastWaves=0.1; + forecastLightnings=0.1; + year=2035; + month=7; + day=6; + hour=12; + minute=0; + startFogDecay=0.013; + forecastFogDecay=0.013; + }; + class Groups + { + items=1; + class Item0 + { + side="WEST"; + class Vehicles + { + items=1; + class Item0 + { + position[]={1747.5541,5.5,5842.1128}; + id=0; + side="WEST"; + vehicle="B_Soldier_F"; + player="PLAYER COMMANDER"; + leader=1; + skill=0.60000002; + }; + }; + }; + }; +}; +class Intro +{ + addOns[]= + { + "a3_map_stratis" + }; + addOnsAuto[]= + { + "a3_map_stratis" + }; + randomSeed=5654624; + class Intel + { + timeOfChanges=1800.0002; + startWeather=0.30000001; + startWind=0.1; + startWaves=0.1; + forecastWeather=0.30000001; + forecastWind=0.1; + forecastWaves=0.1; + forecastLightnings=0.1; + year=2035; + month=7; + day=6; + hour=12; + minute=0; + startFogDecay=0.013; + forecastFogDecay=0.013; + }; +}; +class OutroWin +{ + addOns[]= + { + "a3_map_stratis" + }; + addOnsAuto[]= + { + "a3_map_stratis" + }; + randomSeed=2451180; + class Intel + { + timeOfChanges=1800.0002; + startWeather=0.30000001; + startWind=0.1; + startWaves=0.1; + forecastWeather=0.30000001; + forecastWind=0.1; + forecastWaves=0.1; + forecastLightnings=0.1; + year=2035; + month=7; + day=6; + hour=12; + minute=0; + startFogDecay=0.013; + forecastFogDecay=0.013; + }; +}; +class OutroLoose +{ + addOns[]= + { + "a3_map_stratis" + }; + addOnsAuto[]= + { + "a3_map_stratis" + }; + randomSeed=13827661; + class Intel + { + timeOfChanges=1800.0002; + startWeather=0.30000001; + startWind=0.1; + startWaves=0.1; + forecastWeather=0.30000001; + forecastWind=0.1; + forecastWaves=0.1; + forecastLightnings=0.1; + year=2035; + month=7; + day=6; + hour=12; + minute=0; + startFogDecay=0.013; + forecastFogDecay=0.013; + }; +}; diff --git a/arma-to-socket/debugconsole/ReadMe.txt b/arma-to-socket/debugconsole/ReadMe.txt new file mode 100644 index 0000000..81146bf --- /dev/null +++ b/arma-to-socket/debugconsole/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : debugconsole Project Overview +======================================================================== + +AppWizard has created this debugconsole application for you. + +This file contains a summary of what you will find in each of the files that +make up your debugconsole application. + + +debugconsole.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +debugconsole.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +debugconsole.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named debugconsole.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/arma-to-socket/debugconsole/debugconsole.cpp b/arma-to-socket/debugconsole/debugconsole.cpp new file mode 100644 index 0000000..699cceb --- /dev/null +++ b/arma-to-socket/debugconsole/debugconsole.cpp @@ -0,0 +1,86 @@ +// debugconsole.cpp : Defines the entry point for the console application. +// + +#include "stdafx.h" +//A2S_PACKET_SIZE: maximum return size for extension +#define A2S_PACKET_SIZE 80 +#include +#include +#include + + + + +/* Define a function pointer for our imported +* function. +* This reads as "introduce the new type f_funci as the type: +* pointer to a function returning an int and +* taking no arguments. +* +* Make sure to use matching calling convention (__cdecl, __stdcall, ...) +* with the exported function. __stdcall is the convention used by the WinAPI +*/ +typedef int(*f_funci)(); +//extern "C" int funci(); +typedef void(__stdcall *RVExtension_f)(char*, int , const char* ); + +int main() +{ + std::cout << "============================================" << std::endl; + std::cout << "Arma-to-socket debug console" << std::endl; + std::cout << "============================================" << std::endl; + + char output[A2S_PACKET_SIZE] = "nothing here"; + //system("pause"); + HINSTANCE hGetProcIDDLL = LoadLibrary(L".\\a32s.dll"); + + if (!hGetProcIDDLL) { + std::cout << "Could not load the Extension" << std::endl; + system("pause"); + return EXIT_FAILURE; + + } + else + { + std::cout << "Extension Loaded..." << std::endl; + } + + + RVExtension_f extension = (RVExtension_f)GetProcAddress(hGetProcIDDLL, "_RVExtension@12"); + + if (!extension) { + std::cout << "Could not locate the function: RVExtension (_RVExtension@12)" << std::endl; + std::cout << GetLastError(); + + system("pause"); + return EXIT_FAILURE; + } + else + { + std::cout << "Function loaded..." << std::endl; + } + + + extension(output, A2S_PACKET_SIZE, "version"); + std::cout << "Extension version: " << output << std::endl; + + extension(output, A2S_PACKET_SIZE, "APIVersion"); + std::cout << "API Version: " << output << std::endl; + std::cout << "============================================" << std::endl; + std::cout << "============================================" << std::endl; + + while (true){ + std::string function; + std::cout << "===========Please Enter API Call============" << std::endl; + getline(std::cin, function); + extension(output, A2S_PACKET_SIZE, function.c_str()); + char* test = output; + + std::cout << "A32s returned:" << std::endl + << "--------------" << std::endl + << output << std::endl + << "--------------" << std::endl; + //system("pause"); + } + return EXIT_SUCCESS; +} \ No newline at end of file diff --git a/arma-to-socket/debugconsole/debugconsole.vcxproj b/arma-to-socket/debugconsole/debugconsole.vcxproj new file mode 100644 index 0000000..6f54fca --- /dev/null +++ b/arma-to-socket/debugconsole/debugconsole.vcxproj @@ -0,0 +1,101 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {4E4121C5-C889-4F3F-87B8-15C28EBC6A96} + Win32Proj + debugconsole + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + $(SolutionDir)\arma-to-socket\Release\ + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\boost_1_58_0;$(SolutionDir)\poco-1.6.0\Net\include;$(SolutionDir)\poco-1.6.0\Foundation\include + $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)\boost_1_58_0\lib32-msvc-12.0;$(SolutionDir)\poco-1.6.0\lib; + + + false + $(SolutionDir)\arma-to-socket\Release\ + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\boost_1_58_0;$(SolutionDir)\poco-1.6.0\Net\include;$(SolutionDir)\poco-1.6.0\Foundation\include + $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)\boost_1_58_0\lib32-msvc-12.0;$(SolutionDir)\poco-1.6.0\lib; + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + + + Console + true + true + true + + + + + + + + + + + + + Create + Create + + + + + + \ No newline at end of file diff --git a/arma-to-socket/debugconsole/debugconsole.vcxproj.filters b/arma-to-socket/debugconsole/debugconsole.vcxproj.filters new file mode 100644 index 0000000..c2e96d7 --- /dev/null +++ b/arma-to-socket/debugconsole/debugconsole.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/arma-to-socket/debugconsole/stdafx.cpp b/arma-to-socket/debugconsole/stdafx.cpp new file mode 100644 index 0000000..baeda09 --- /dev/null +++ b/arma-to-socket/debugconsole/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// debugconsole.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/arma-to-socket/debugconsole/stdafx.h b/arma-to-socket/debugconsole/stdafx.h new file mode 100644 index 0000000..b005a83 --- /dev/null +++ b/arma-to-socket/debugconsole/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include + + + +// TODO: reference additional headers your program requires here diff --git a/arma-to-socket/debugconsole/targetver.h b/arma-to-socket/debugconsole/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/arma-to-socket/debugconsole/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/arma-to-socket/testApp/ReadMe.txt b/arma-to-socket/testApp/ReadMe.txt new file mode 100644 index 0000000..8bca094 --- /dev/null +++ b/arma-to-socket/testApp/ReadMe.txt @@ -0,0 +1,40 @@ +======================================================================== + CONSOLE APPLICATION : testApp Project Overview +======================================================================== + +AppWizard has created this testApp application for you. + +This file contains a summary of what you will find in each of the files that +make up your testApp application. + + +testApp.vcxproj + This is the main project file for VC++ projects generated using an Application Wizard. + It contains information about the version of Visual C++ that generated the file, and + information about the platforms, configurations, and project features selected with the + Application Wizard. + +testApp.vcxproj.filters + This is the filters file for VC++ projects generated using an Application Wizard. + It contains information about the association between the files in your project + and the filters. This association is used in the IDE to show grouping of files with + similar extensions under a specific node (for e.g. ".cpp" files are associated with the + "Source Files" filter). + +testApp.cpp + This is the main application source file. + +///////////////////////////////////////////////////////////////////////////// +Other standard files: + +StdAfx.h, StdAfx.cpp + These files are used to build a precompiled header (PCH) file + named testApp.pch and a precompiled types file named StdAfx.obj. + +///////////////////////////////////////////////////////////////////////////// +Other notes: + +AppWizard uses "TODO:" comments to indicate parts of the source code you +should add to or customize. + +///////////////////////////////////////////////////////////////////////////// diff --git a/arma-to-socket/testApp/stdafx.cpp b/arma-to-socket/testApp/stdafx.cpp new file mode 100644 index 0000000..2f96826 --- /dev/null +++ b/arma-to-socket/testApp/stdafx.cpp @@ -0,0 +1,8 @@ +// stdafx.cpp : source file that includes just the standard includes +// testApp.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/arma-to-socket/testApp/stdafx.h b/arma-to-socket/testApp/stdafx.h new file mode 100644 index 0000000..21afffc --- /dev/null +++ b/arma-to-socket/testApp/stdafx.h @@ -0,0 +1,15 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +#include "targetver.h" + +#include +#include +#define POCO_STATIC + + +// TODO: reference additional headers your program requires here diff --git a/arma-to-socket/testApp/targetver.h b/arma-to-socket/testApp/targetver.h new file mode 100644 index 0000000..87c0086 --- /dev/null +++ b/arma-to-socket/testApp/targetver.h @@ -0,0 +1,8 @@ +#pragma once + +// Including SDKDDKVer.h defines the highest available Windows platform. + +// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and +// set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h. + +#include diff --git a/arma-to-socket/testApp/testApp.cpp b/arma-to-socket/testApp/testApp.cpp new file mode 100644 index 0000000..0776ca8 --- /dev/null +++ b/arma-to-socket/testApp/testApp.cpp @@ -0,0 +1,554 @@ +// testApp.cpp : Defines the entry point for the console application. +// + +#pragma once +//#pragma comment (lib, "boost_math_c99-vc120-mt-1_58") +#pragma comment (lib, "ssleay32") +#pragma comment (lib, "libeay32") +#pragma comment (lib, "PocoFoundation") + +//#pragma comment (lib, "PocoFoundationd") +#include "stdafx.h" +//#include "Socket.h" +#define WIN32_LEAN_AND_MEAN +#include "stdafx.h" +#include +#include +#include +#include +#include +#include +//#include +//#include +#include +#include +// DatagramSocket send example + +#include +#include +#include +#include +#include +#include +#include + + +#include +#include "Poco/Net/DNS.h" +#include +//#include +//#include +//#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + + +using std::cout; +using std::endl; +using std::string; +using std::vector; +using std::pair; +using std::make_pair; +using std::exception; +using Poco::Exception; +using Poco::NoThreadAvailableException; +using Poco::Net::StreamSocket; +using Poco::Net::DatagramSocket; +using Poco::Net::SocketAddress; +using Poco::ThreadPool; +using Poco::Thread; +using Poco::Runnable; +using Poco::Mutex; +using Poco::FIFOBuffer; + + +/** +Makes random requests to the server. +**/ + + + + +//std::string default_timeout; +//std::string local_address; +//std::string local_timeout; +//std::string test_address; +//std::vector fifth; +//char* deliminator = ":"; +//char address[] = "127.0.0.1"; +// +//static char version[] = "0.2"; +//std::map mySockets; +//int loadOptions(std::string); +std::vector &split(const std::string &s, char delim, std::vector &elems); +std::vector split(const std::string &s, char delim); +//std::string parseCall(std::string); +//void create(std::string); +//int getConfig(std::string, char*, char*, int*, int*); + +int _tmain(int argc, _TCHAR* argv[]) +{ + std::size_t bufLen = 1024; + SocketAddress address("127.0.0.1:9999"); + StreamSocket mySocket(address); + std::cout << mySocket.getReceiveTimeout().totalSeconds() << std::endl; + std::cout << mySocket.getSendTimeout().totalSeconds() << std::endl; + Poco::FIFOBuffer sendData(bufLen, false); + sendData.copy( "hello world", 12); + std::cout << mySocket.sendBytes(sendData) << std::endl; + + system("pause"); + return EXIT_SUCCESS; + + //namespace po = boost::program_options; + + //typedef std::vector< std::string > plugin_names_t; + //plugin_names_t plugin_names; + //std::string settings_type; + + //// setup options. + //po::options_description desc("options"); + //desc.add_options() + // ("default.timeout", po::value< std::string >(&default_timeout), + // "default_timeout"); + + //// load setting file. + //po::variables_map vm; + //std::ifstream settings_file("a32s.ini", std::ifstream::in); + //po::store(po::parse_config_file(settings_file, desc,true), vm); + //settings_file.close(); + //po::notify(vm); + // + //// print settings. + ///*typedef std::vector< std::string >::iterator iterator; + //for (plugin_names_t::iterator iterator = plugin_names.begin(), + // end = plugin_names.end(); + // iterator < end; + //++iterator) + //{ + // std::cout << "plugin.name: " << *iterator << std::endl; + //}*/ + //std::cout << "settings.type: " << default_timeout << std::endl; + //loadoptions("test"); + + //while (true){ + // std::string function; + // + // std::cout << "please enter extension call"; + // getline(std::cin, function); + // std::cout << "you entered: " << function << "!\n"; + // + // std::cout << parsecall(function); + + //}; + //return 0; +} +// +//int loadOptions(std::string name){ +// char cName = *name.c_str(); +// +// unsigned int timeout = 0; +// std::string address = "address"; +// std::string port = "port"; +// unsigned int protocol = 10000; +// namespace po = boost::program_options; +// std::string timeoutStr = ".timeout"; +// std::string addressStr = ".address"; +// std::string portStr = ".port"; +// std::string protocolStr = ".protocol"; +// timeoutStr = name + timeoutStr; +// char *timeoutCStr = &timeoutStr[0u]; +// addressStr = name + addressStr; +// char *addressCStr = &addressStr[0u]; +// portStr = name + portStr; +// char *portCStr = &portStr[0u]; +// protocolStr = name + protocolStr; +// char *protocolCStr = &protocolStr[0u]; +// +// typedef std::vector< std::string > plugin_names_t; +// plugin_names_t plugin_names; +// std::string settings_type; +// +// //std::cout << protocolCStr << "\n"; +// // Setup options. +// po::options_description desc("Options"); +// desc.add_options() +// (timeoutCStr, +// po::value(&timeout), +// "Socket timeout (ms)") +// +// (addressCStr, +// po::value< std::string >(&address), +// "Socket address (uri)") +// +// (portCStr, +// po::value< std::string >(&port), +// "Socket port") +// +// (protocolCStr, +// po::value(&protocol), +// "Socket protocol (1:TCP,2:UDP)") +// ; +// // Load setting file. +// po::variables_map vm; +// std::ifstream settings_file("a32s.ini", std::ifstream::in); +// po::store(po::parse_config_file(settings_file, desc, true), vm); +// settings_file.close(); +// po::notify(vm); +// +// // Print settings. +// typedef std::vector< std::string >::iterator iterator; +// for (plugin_names_t::iterator iterator = plugin_names.begin(), +// end = plugin_names.end(); +// iterator < end; +// ++iterator) +// { +// std::cout << "plugin.name: " << *iterator << std::endl; +// } +// std::cout << name << "\n"; +// std::cout << std::to_string(protocol) << "\n"; +// std::cout << port << "\n"; +// std::cout << address << "\n"; +// std::cout << timeout << "\n"; +// return 0; +// +//}; + +//std::string parseCall(std::string input){ +// using namespace std; +// map < string, int > systemCalls; +// systemCalls.insert(pair("version", 1)); +// systemCalls.insert(pair("dump", 2)); +// +// map < string, int > mgmntCalls; +// +// mgmntCalls.insert(pair("count", 1)); +// mgmntCalls.insert(pair("list", 2)); +// mgmntCalls.insert(pair("cleanup", 3)); +// mgmntCalls.insert(pair("rmall", 4)); +// +// +// +// +// map < string, int > useCalls; +// useCalls.insert(pair("send", 1)); +// useCalls.insert(pair("recv", 2)); +// useCalls.insert(pair("sRecv", 3)); +// +// +// map < string, int > maintCalls; +// maintCalls.insert(pair("create", 1)); +// maintCalls.insert(pair("destroy", 2)); +// maintCalls.insert(pair("shutdown", 3)); +// maintCalls.insert(pair("init", 4)); +// string::size_type sz; +// +// vector vect; +// vect = split(input, *deliminator); +// std::transform(vect[1].begin(), vect[1].end(), vect[1].begin(), ::tolower); +// try{ +// +// int length = vect.size(); +// +// switch (stoi(vect[0], &sz)){ +// +// case 0:{ +// +// if (length < 2){ +// return "unrecognized call was made please check the wiki for help. Management call requires 2 arguments. You tried: '" + input + "'"; +// break; +// } +// +// //managemnt calls eg clean array, count +// switch (mgmntCalls[vect[1]]){ +// +// case 1:{ +// //count // count open sockets +// +// return "0:" + to_string(mySockets.size()); +// +// break; +// } +// case 2:{ +// //list sockets and destinations +// break; +// } +// case 3:{ +// //cleanup +// if (mySockets.find(vect[2]) == mySockets.end()) { +// std::cout << "Socket Not socket"; +// std::cout << "\n"; +// } +// else { +// std::cout << "socket found"; +// } +// +// break; +// } +// case 4:{ +// //rmall // crash all open sockets and call cleanup +// if (mySockets.find(vect[2]) == mySockets.end()) { +// std::cout << "Socket Not socket"; +// std::cout << "\n"; +// } +// else { +// std::cout << "socket found"; +// } +// +// break; +// } +// default: +// break; +// } +// break; +// } +// case 1:{ +// if (length < 3){ +// return "unrecognized call was made please check the wiki for help. Use calls require 3 arguments. You tried: '" + input + "'"; +// break; +// } +// //use calls: eg send, recieve, sendRecieve (listen)/ (accept) +// switch (useCalls[vect[1]]){ +// +// case 1: { +// //send +// if (mySockets.find(vect[2]) == mySockets.end()) { +// std::cout << "Socket Not found"; +// std::cout << "\n"; +// } +// else { +// std::cout << "socket found"; +// std::cout << "\n"; +// } +// +// break; } +// case 2: { +// //recieve +// if (mySockets.find(vect[2]) == mySockets.end()) { +// std::cout << "Socket Not found"; +// std::cout << "\n"; +// } +// else { +// std::cout << "socket found"; +// std::cout << "\n"; +// } +// +// break; +// } +// case 3: { +// //send + recieve +// if (mySockets.find(vect[2]) == mySockets.end()) { +// std::cout << "Socket Not found"; +// std::cout << "\n"; +// } +// else { +// std::cout << "socket found"; +// std::cout << "\n"; +// } +// } +// } +// } +// case 2:{ +// if (length < 3){ +// return "unrecognized call was made please check the wiki for help. Maintenance call requires 3 arguments. You tried: '" + input + "'"; +// break; +// } +// switch (maintCalls[vect[1]]){ +// +// case 1:{ +// //create +// +// break; +// } +// case 2:{ +// //destroy // crash +// if (mySockets.find(vect[2]) == mySockets.end()) { +// std::cout << "Socket Not socket"; +// std::cout << "\n"; +// } +// else { +// std::cout << "socket found"; +// } +// +// break; +// } +// case 3:{ +// //shutdown // gracefull/ finish recieve +// if (mySockets.find(vect[2]) == mySockets.end()) { +// std::cout << "Socket Not socket"; +// std::cout << "\n"; +// } +// else { +// std::cout << "socket found"; +// } +// +// break; +// } +// case 4:{ +// //init +// if (mySockets.find(vect[2]) == mySockets.end()) { +// std::cout << "Socket Not socket"; +// std::cout << "\n"; +// } +// else { +// std::cout << "socket found"; +// } +// +// break; +// } +// +// default: +// break; +// } +// } +// +// case 9:{ +// if (length < 2){ +// return "unrecognized call was made please check the wiki for help. Management call requires 2 arguments. You tried: '" + input + "'"; +// break; +// } +// switch (systemCalls[vect[1]]){ +// case 1: +// //version: return version number +// +// +// std::cout << version; +// std::cout << "\n"; +// break; +// case 2:{ +// +// std::cout << local_address; +// +// break; +// } +// +// default: +// +// break; +// } +// break; +// default: +// +// break; +// } +// } +// } +// catch (...){ +// return "unrecognized call was made please check the wiki for help. You tried: '" + input +"'"; +// } +// return "unhandled call as of yet"; +//}; +// +// +std::vector &split(const std::string &s, char delim, std::vector &elems) { + std::stringstream ss(s); + std::string item; + while (std::getline(ss, item, delim)) { + elems.push_back(item); + } + return elems; +} + +std::vector split(const std::string &s, char delim) { + std::vector elems; + split(s, delim, elems); + return elems; +}; + +//void create(std::string name){ +// char cName = *name.c_str(); +// +// int timeout; +// std::string address; +// std::string port; +// int protocol; +// namespace po = boost::program_options; +// +// typedef std::vector< std::string > plugin_names_t; +// plugin_names_t plugin2_names; +// +// // Setup options. +// po::options_description desc("Options"); +// desc.add_options() +// (cName + ".timeout", +// po::value< int >(&timeout), +// "Socket timeout (ms)") +// +// (cName + ".address", +// po::value< std::string >(&address), +// "Socket address (uri)") +// +// (cName + ".port", +// po::value< std::string >(&port), +// "Socket port") +// +// (cName + ".protocol", +// po::value< int >(&protocol), +// "Socket protocol (1:TCP,2:UDP)") +// ; +// // Load setting file. +// po::variables_map vm; +// std::ifstream settings_file("a32s.ini", std::ifstream::in); +// po::store(po::parse_config_file(settings_file, desc), vm); +// settings_file.close(); +// po::notify(vm); +// +// +// +// +//} +// +//int getConfig(std::string name, char* address, char* port, int* protocol, int* timeout){ +// +// char cName = *name.c_str(); +// +// +// namespace po = boost::program_options; +// +// typedef std::vector< std::string > plugin_names_t; +// plugin_names_t plugin2_names; +// +// // Setup options. +// try { +// +// po::options_description desc("Options"); +// desc.add_options() +// (cName + ".timeout", +// po::value< int* >(&timeout), +// "Socket timeout (ms)") +// +// (cName + ".address", +// po::value< char* >(&address), +// "Socket address (uri)") +// +// (cName + ".port", +// po::value< char* >(&port), +// "Socket port") +// +// (cName + ".protocol", +// po::value< int* >(&protocol), +// "Socket protocol (1:TCP,2:UDP)") +// ; +// // Load setting file. +// po::variables_map vm; +// std::ifstream settings_file("a32s.ini", std::ifstream::in); +// po::store(po::parse_config_file(settings_file, desc), vm); +// settings_file.close(); +// po::notify(vm); +// return 0; +// } +// catch (...){ +// return 1; +// } +// +//} \ No newline at end of file diff --git a/arma-to-socket/testApp/testApp.vcxproj b/arma-to-socket/testApp/testApp.vcxproj new file mode 100644 index 0000000..1af6e16 --- /dev/null +++ b/arma-to-socket/testApp/testApp.vcxproj @@ -0,0 +1,107 @@ + + + + + Debug + Win32 + + + Release + Win32 + + + + {8620790B-1432-473C-90E9-4AE77195595B} + Win32Proj + testApp + + + + Application + true + v120 + Unicode + + + Application + false + v120 + true + Unicode + + + + + + + + + + + + + true + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\boost_1_58_0;$(SolutionDir)\poco-1.6.0\Net\include;$(SolutionDir)\poco-1.6.0\Foundation\include + $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)\boost_1_58_0\lib32-msvc-12.0;$(SolutionDir)\poco-1.6.0\lib; + $(WindowsSDK_MetadataPath);$(SolutionDir)\boost_1_58_0;$(SolutionDir)\poco-1.6.0\lib; + + + false + $(VC_IncludePath);$(WindowsSDK_IncludePath);$(SolutionDir)\boost_1_58_0;$(SolutionDir)\poco-1.6.0\Net\include;$(SolutionDir)\poco-1.6.0\Foundation\include + $(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(SolutionDir)\boost_1_58_0\lib32-msvc-12.0;$(SolutionDir)\poco-1.6.0\lib; + $(WindowsSDK_MetadataPath);$(SolutionDir)\boost_1_58_0;$(SolutionDir)\poco-1.6.0\lib; + + + + Use + Level3 + Disabled + WIN32;_DEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + C:\Users\Lonja\Downloads\boost\boost_1_58_0 + + + Console + true + C:\Users\Lonja\Downloads\boost\boost_1_58_0 + + + + + Level3 + Use + MaxSpeed + true + true + WIN32;NDEBUG;_CONSOLE;_LIB;%(PreprocessorDefinitions) + true + C:\Users\Lonja\Downloads\boost\boost_1_58_0 + + + Console + true + true + true + C:\Users\Lonja\Downloads\boost\boost_1_58_0 + + + + + + + + + + + + + + Create + Create + + + + + + + \ No newline at end of file diff --git a/arma-to-socket/testApp/testApp.vcxproj.filters b/arma-to-socket/testApp/testApp.vcxproj.filters new file mode 100644 index 0000000..b64cedf --- /dev/null +++ b/arma-to-socket/testApp/testApp.vcxproj.filters @@ -0,0 +1,42 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + + + + Header Files + + + Header Files + + + Header Files + + + + + Source Files + + + Source Files + + + Source Files + + + \ No newline at end of file diff --git a/python/client.py b/python/client.py new file mode 100644 index 0000000..44718b4 --- /dev/null +++ b/python/client.py @@ -0,0 +1,41 @@ +__author__ = 'Lonja' +import socket +import sys +import time + +HOST, PORT = "localhost", 9999 +data = " ".join(sys.argv[1:]) + +# Create a socket (SOCK_STREAM means a TCP socket) +sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +try: + sock.connect((HOST, PORT)) +except: + pass + print("could not connect to socket") + + +while True: + data = {} + data["sysTime"] = time.strftime("%H:%M:%S") + + try: + + for key, value in data: + sock.sendall((str(key) + "," + str(value)).encode("utf-8")) + + + # Connect to server and send data + + #sock.sendall((data + "\n").encode('utf-8')) + + # Receive data from the server + received = sock.recv(1024) + + except: + print("could not send data") + + + +print("Sent: {}".format(data)) +print("Received: {}".format(received)) diff --git a/python/hello_world.py b/python/hello_world.py new file mode 100644 index 0000000..a4ee8b1 --- /dev/null +++ b/python/hello_world.py @@ -0,0 +1,8 @@ +__author__ = 'Lonja' + +def main(): + print("hello World!") + + +main() +main() diff --git a/python/main.py b/python/main.py new file mode 100644 index 0000000..4f924c0 --- /dev/null +++ b/python/main.py @@ -0,0 +1,147 @@ +__author__ = 'Lonja' +#todo, impliment heartbeat +#todo impliment system properties when not in game +import time +#print('hello world') + +app = "" +import socket +import socketserver +import serial +import time +import math +# +# data_Names = {"altASL": "ALT:", "TOT": "TOT:", "tgt_alt": "TGT:", "rel_tgt_alt": "REL:", "tfarFreqLr":"FR:"} +# data = { +# "altASL":800, +# "TOT": 60, +# "tgt_alt": 254, +# +# } +# +# current_LCD_Data = ["alt_ASL", "tgt_alt"] +# +# packet_Template = "\x01%s\x02%s\x04" +# lcd = [] +# try: +# ser = serial.Serial('COM5', 500000, timeout=0) +# +# except: +# pass +# +# testMsg = "\x01\x00\x02\x20\x20\x20\x30\x31\x32\x32\x34\x35\x04".encode("utf-8") +# #print(testMsg) +# #content2 = data_Names["tfarFreqsw"] + str(data["tfarFreqsw"]).rjust(4) +# #content2 = content2.ljust(8) +# #content2 += data_Names["rel_tgt_alt"] + str(data["alt_ASL"] - data["tgt_alt"]).rjust(4) +# #content2 = content2.ljust(16) +# #packet2 = packet_Template % ("\x01", content2) +# #print(content2.encode()) +# #print( str(data["alt_ASL"] - data["tgt_alt"])) +# +# +# +# class MyTCPHandler(socketserver.BaseRequestHandler): +# """ +# The RequestHandler class for our server. +# +# It is instantiated once per connection to the server, and must +# override the handle() method to implement communication to the +# client. +# """ +# +# +# +# def sendData(self): +# try: +# +# #print(ser.readline().decode("utf-8")) +# content = data_Names["TOT"] + str(data["TOT"]).rjust(4) +# content = content.ljust(8) +# content += data_Names["altASL"] + str(int(math.floor(float(data["altASL"])))).rjust(4) +# content = content.ljust(16) +# +# #content2 = data_Names["tfarFreqLr"] + str(data["tfarFreqLr"]).rjust(4)w +# #content2 = content2.ljust(8) +# # content2 += data_Names["rel_tgt_alt"] + str(int(data["alt_ASL"]) - int(data["tgt_alt"])).rjust(4) +# #content2 = content2.ljust(16) +# #packet2 = packet_Template % ("\x01", content2) +# #print(packet2.encode()) +# packet = packet_Template % ("\x00", content) +# print(packet.encode()) +# if ser: +# ser.write(packet.encode("utf-8")) #test message +# #ser.write(packet2.encode("utf-8")) #test message +# +# except: +# print('Data could not be read') +# +# +# +# +# def handle(self): +# # self.request is the TCP socket connected to the client +# self.incoming = self.request.recv(1024).strip() +# self.request.sendall("Python has heard\n\0".rjust(1024).encode("utf-8")) +# print("{} wrote:".format(self.client_address)) +# +# # do stuff with data +# print(self.incoming) +# self.finish() +# #category, content = self.incoming.split(",", 1) +# +# #data[category] = content +# #print() +# #print(data["altASL"]) +# +# #self.sendData() +# +# # just send back the same data, but upper-cased +# +# # send return data back +# #self.request.sendall("Python has heard\n\0".encode("utf-8")) +# +# +# if __name__ == "__main__": +# HOST, PORT = "localhost", 9999 +# +# # Create the server, binding to localhost on port 9999 +# server = socketserver.TCPServer((HOST, PORT), MyTCPHandler) +# +# # Activate the server; this will keep running until you +# # interrupt the program with Ctrl-C +# print('server running') +# server.serve_forever() + + +#!/usr/bin/env python + +""" +A simple echo server +""" + +import socket + +host = '' +port = 9999 +backlog = 5 +size = 1024 +s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) +s.bind((host,port)) +s.listen(backlog) +client, address = s.accept() +while 1: + try: + data = "" + #client, address = s.accept() + data = client.recv(size) + if data: + print("data recieved: ") + #time.sleep(3) + client.send((("python heard: " +data.decode()+"\0")).encode("utf-8")) + print (data.decode().encode("utf-8")) + print(address) + print(data) + #client.close() + except: + pass \ No newline at end of file diff --git a/python/udp.py b/python/udp.py new file mode 100644 index 0000000..ca25577 --- /dev/null +++ b/python/udp.py @@ -0,0 +1,22 @@ +__author__ = 'Lonja' +import socket, time + +UDP_IP = "127.0.0.1" +UDP_PORT = 9999 + + +sock = socket.socket(socket.AF_INET, # Internet + socket.SOCK_DGRAM) # UDP +sock.bind((UDP_IP, UDP_PORT)) + +while True: + try: + data, addr = sock.recvfrom(1024) # buffer size is 1024 bytes + print ("received message:", data) + print (addr) + #data = b'hello:'+ data + rtnStr = "python has heard".ljust(1024) + time.sleep(3) + sock.sendto((rtnStr.encode("utf-8") ), addr) + except : + pass \ No newline at end of file