3 Commits

10 changed files with 144 additions and 4 deletions
+1
View File
@@ -1,4 +1,5 @@
PREP(convertClientLocation); PREP(convertClientLocation);
PREP(extractClientPosition); PREP(extractClientPosition);
PREP(initCuratorRouterIndicators);
PREP(sendLaserRangeFinder); PREP(sendLaserRangeFinder);
PREP(startUDPSocket); PREP(startUDPSocket);
+2
View File
@@ -7,3 +7,5 @@ _local_address = "armatak" callExtension ["local_ip", []] select 0;
SETVAR(player,GVAR(localAddress),_local_address); SETVAR(player,GVAR(localAddress),_local_address);
SETVAR(player,GVAR(eudConnected),false); SETVAR(player,GVAR(eudConnected),false);
SETVAR(player,GVAR(lrfEnabled),false); SETVAR(player,GVAR(lrfEnabled),false);
call FUNC(initCuratorRouterIndicators);
@@ -0,0 +1,49 @@
#include "..\script_component.hpp"
/*
* Author: Codex
* Draws a Zeus-only visual border over entities routed by the ArmaTAK CoT Router.
*
* Arguments:
* None
*
* Return Value:
* Draw3D event handler id <NUMBER>
*
* Public: No
*/
if (!hasInterface) exitWith {-1};
private _existingEh = missionNamespace getVariable [QGVAR(curatorRouterIndicatorEh), -1];
if (_existingEh >= 0) exitWith {_existingEh};
private _eh = addMissionEventHandler ["Draw3D", {
if (isNull findDisplay 312) exitWith {};
private _curator = getAssignedCuratorLogic player;
if (isNull _curator) exitWith {};
private _routed = missionNamespace getVariable ["armatak_server_syncedUnits", []];
if (_routed isEqualTo []) exitWith {};
private _editableObjects = curatorEditableObjects _curator;
private _texture = "\a3\ui_f\data\IGUI\Cfg\Cursors\selected_ca.paa";
private _color = [0, 0.85, 1, 0.95];
private _camera = curatorCamera;
{
if (!isNull _x && {alive _x} && {_x in _editableObjects}) then {
private _pos = ASLToAGL (getPosASLVisual _x);
_pos set [2, (_pos select 2) + 0.12];
private _distance = _camera distance _x;
private _size = linearConversion [0, 2000, _distance, 0.8, 1.35, true];
private _textSize = linearConversion [0, 2000, _distance, 0.032, 0.05, true];
drawIcon3D [_texture, _color, _pos, _size, _size, 0, "TAK", 1, _textSize, "RobotoCondensed", "center"];
};
} forEach _routed;
}];
missionNamespace setVariable [QGVAR(curatorRouterIndicatorEh), _eh];
_eh
+3
View File
@@ -1,7 +1,10 @@
PREP(3denEnrollModuleConfig); PREP(3denEnrollModuleConfig);
PREP(3denTcpModuleConfig); PREP(3denTcpModuleConfig);
PREP(addRouterEntities);
PREP(removeRouterEntities);
PREP(routerEntityAdd); PREP(routerEntityAdd);
PREP(routerEntityRemove); PREP(routerEntityRemove);
PREP(setRouterEntities);
PREP(startCotRouter); PREP(startCotRouter);
PREP(ZeusEnrollModuleConfig); PREP(ZeusEnrollModuleConfig);
PREP(ZeusTcpModuleConfig); PREP(ZeusTcpModuleConfig);
@@ -0,0 +1,28 @@
#include "..\script_component.hpp"
/*
* Author: Valmo, Codex
* Adds entities to the server-side CoT router entity list.
*
* Arguments:
* 0: Entity or entities to publish through the CoT router <OBJECT|ARRAY>
*
* Return Value:
* Current routed entities <ARRAY>
*
* Public: Yes
*/
params [
["_entities", [], [objNull, []]]
];
private _toAdd = if (_entities isEqualType objNull) then {[_entities]} else {_entities};
private _routed = missionNamespace getVariable ["armatak_server_syncedUnits", []];
_routed append _toAdd;
_routed = _routed arrayIntersect _routed;
_routed = _routed select {!isNull _x && {alive _x}};
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
GVAR(syncedUnits) = _routed;
_routed
@@ -0,0 +1,26 @@
#include "..\script_component.hpp"
/*
* Author: Valmo, Codex
* Removes entities from the server-side CoT router entity list.
*
* Arguments:
* 0: Entity or entities to remove from the CoT router <OBJECT|ARRAY>
*
* Return Value:
* Current routed entities <ARRAY>
*
* Public: Yes
*/
params [
["_entities", [], [objNull, []]]
];
private _toRemove = if (_entities isEqualType objNull) then {[_entities]} else {_entities};
private _routed = missionNamespace getVariable ["armatak_server_syncedUnits", []];
_routed = (_routed - _toRemove) select {!isNull _x && {alive _x}};
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
GVAR(syncedUnits) = _routed;
_routed
@@ -36,7 +36,7 @@ switch (false) do {
GVAR(syncedUnits) pushBack _unit; GVAR(syncedUnits) pushBack _unit;
missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits)]; missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits), true];
SETVAR(_unit,GVAR(isRouting),true); SETVAR(_unit,GVAR(isRouting),true);
deleteVehicle _logic; deleteVehicle _logic;
@@ -34,7 +34,7 @@ switch (false) do {
}; };
} forEach GVAR(syncedUnits); } forEach GVAR(syncedUnits);
missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits)]; missionNamespace setVariable ["armatak_server_syncedUnits", GVAR(syncedUnits), true];
SETVAR(_unit,GVAR(isRouting),false); SETVAR(_unit,GVAR(isRouting),false);
deleteVehicle _logic; deleteVehicle _logic;
@@ -0,0 +1,25 @@
#include "..\script_component.hpp"
/*
* Author: Valmo, Codex
* Replaces the server-side CoT router entity list with a de-duplicated list.
*
* Arguments:
* 0: Entities to publish through the CoT router <ARRAY>
*
* Return Value:
* Current routed entities <ARRAY>
*
* Public: Yes
*/
params [
["_entities", [], [[]]]
];
private _routed = _entities arrayIntersect _entities;
_routed = _routed select {!isNull _x && {alive _x}};
missionNamespace setVariable ["armatak_server_syncedUnits", _routed, true];
GVAR(syncedUnits) = _routed;
_routed
+8 -2
View File
@@ -84,7 +84,12 @@ fn response_error_details(response: reqwest::blocking::Response) -> String {
} }
} }
fn fetch_enrollment_config(host: &str, enroll_port: &str) -> Result<EnrollmentConfig, String> { fn fetch_enrollment_config(
host: &str,
enroll_port: &str,
username: &str,
password: &str,
) -> Result<EnrollmentConfig, String> {
let url = format!( let url = format!(
"https://{}:{}/Marti/api/tls/config", "https://{}:{}/Marti/api/tls/config",
host.trim(), host.trim(),
@@ -94,6 +99,7 @@ fn fetch_enrollment_config(host: &str, enroll_port: &str) -> Result<EnrollmentCo
let response = enrollment_http_client()? let response = enrollment_http_client()?
.get(&url) .get(&url)
.basic_auth(username.trim(), Some(password.to_string()))
.send() .send()
.map_err(|e| format!("failed to fetch {}: {}", url, e))?; .map_err(|e| format!("failed to fetch {}: {}", url, e))?;
@@ -228,7 +234,7 @@ pub fn enroll_and_connect(
host, enroll_port, server_name, normalized_client_uid host, enroll_port, server_name, normalized_client_uid
); );
let enrollment_config = fetch_enrollment_config(host, enroll_port)?; let enrollment_config = fetch_enrollment_config(host, enroll_port, username, password)?;
let (ca_cert_pem, client_cert_pem, client_key_pem) = enroll_client_certificate( let (ca_cert_pem, client_cert_pem, client_key_pem) = enroll_client_certificate(
host, host,
enroll_port, enroll_port,