Splitted Connection Module

This commit is contained in:
2026-03-26 01:05:54 -03:00
parent c35b7f0268
commit e32aadda4e
13 changed files with 448 additions and 536 deletions

View File

@@ -35,7 +35,12 @@ addMissionEventHandler ["ExtensionCallback", {
[_function, "success", _name] call FUNC(notify); [_function, "success", _name] call FUNC(notify);
}; };
case "TCP SOCKET ERROR": { case "TCP SOCKET ERROR": {
[_function, "error", _name] call FUNC(notify); _message = _function;
if (_data isNotEqualTo "") then {
_message = format ["%1: %2", _function, _data];
};
[_message, "error", _name] call FUNC(notify);
}; };
case "VIDEO": { case "VIDEO": {
[_function, "success", _name] call FUNC(notify); [_function, "success", _name] call FUNC(notify);

View File

@@ -1,35 +1,28 @@
class CfgVehicles { class CfgVehicles {
class Logic; class Logic;
class Module_F : Logic class Module_F : Logic {
{ class AttributesBase {
class AttributesBase class Edit;
{ class ModuleDescription;
class Edit; };
class Combo;
class ModuleDescription;
};
class ModuleDescription; class ModuleDescription;
}; };
class GVAR(moduleBase): Module_F { class GVAR(moduleBase): Module_F {
author = PROJECT_AUTHOR; author = PROJECT_AUTHOR;
category = QEGVAR(main,moduleCategory); category = QEGVAR(main,moduleCategory);
function = QUOTE({}); function = QUOTE({});
functionPriority = 1; functionPriority = 1;
isGlobal = 1; isGlobal = 1;
isTriggerActivated = 0; isTriggerActivated = 0;
scope = 1; scope = 1;
scopeCurator = 2; scopeCurator = 2;
}; };
class GVAR(coreModule): GVAR(moduleBase) { class GVAR(connectionModuleBase): GVAR(moduleBase) {
scope = 2; scopeCurator = 0;
scopeCurator = 0;
displayname = "CoT Router";
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa"; icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
category = QEGVAR(main,moduleCategory); category = QEGVAR(main,moduleCategory);
function = QFUNC(3denCoreModuleConfig);
functionPriority = 1; functionPriority = 1;
isGlobal = 0; isGlobal = 0;
isTriggerActivated = 1; isTriggerActivated = 1;
@@ -40,122 +33,101 @@ class CfgVehicles {
canSetArea = 0; canSetArea = 0;
canSetAreaShape = 0; canSetAreaShape = 0;
canSetAreaHeight = 0; canSetAreaHeight = 0;
};
class Attributes: AttributesBase { class GVAR(tcpModule): GVAR(connectionModuleBase) {
class GVAR(moduleTransportMode): Combo { scope = 2;
property = QGVAR(moduleTransportMode); displayName = "CoT Router (TCP)";
displayname = "Transport Mode"; function = QFUNC(3denTcpModuleConfig);
tooltip = "Choose how ArmaTAK connects to the TAK or IronTAK server.";
typeName = "STRING"; class Attributes: AttributesBase {
defaultValue = "'tcp'"; class GVAR(moduleInstanceAddress): Edit {
class Values { property = QGVAR(moduleInstanceAddress);
class tcp { displayName = "TAK Server Address";
name = "TCP 8088 (Unauthenticated)"; tooltip = "Hostname or IP address for the TAK or IronTAK server.";
value = "tcp";
default = 1;
};
class manual_mtls {
name = "mTLS (Manual Certificate)";
value = "manual_mtls";
};
class enroll_mtls {
name = "mTLS (GET config + POST signClient)";
value = "enroll_mtls";
};
};
};
class GVAR(moduleInstanceAddress): Edit {
property = QGVAR(moduleInstanceAddress);
displayname = "TAK Server Address";
tooltip = "TAK Server Instance Address";
typeName = "STRING"; typeName = "STRING";
defaultValue = "localhost"; defaultValue = "'localhost'";
}; };
class GVAR(moduleInstancePort): Edit { class GVAR(moduleInstancePort): Edit {
property = QGVAR(moduleInstancePort); property = QGVAR(moduleInstancePort);
displayname = "TAK Server TCP Port"; displayName = "TAK Server TCP Port";
tooltip = "TAK Server instance Port for TCP connection"; tooltip = "Port for the unauthenticated TCP socket.";
typeName = "NUMBER"; typeName = "NUMBER";
defaultValue = "8088"; defaultValue = "8088";
};
class GVAR(moduleTlsServerName): Edit {
property = QGVAR(moduleTlsServerName);
displayname = "TLS Server Name";
tooltip = "Optional hostname used for TLS certificate validation. Leave blank to reuse the address host.";
typeName = "STRING";
defaultValue = "";
};
class GVAR(moduleTlsCaCertPath): Edit {
property = QGVAR(moduleTlsCaCertPath);
displayname = "TLS CA Cert Path";
tooltip = "PEM path for the CA that signs the IronTAK or TAK server certificate.";
typeName = "STRING";
defaultValue = "";
};
class GVAR(moduleTlsClientCertPath): Edit {
property = QGVAR(moduleTlsClientCertPath);
displayname = "TLS Client Cert Path";
tooltip = "PEM path for the client certificate used by this ArmaTAK session.";
typeName = "STRING";
defaultValue = "";
};
class GVAR(moduleTlsClientKeyPath): Edit {
property = QGVAR(moduleTlsClientKeyPath);
displayname = "TLS Client Key Path";
tooltip = "PEM path for the private key that matches the client certificate.";
typeName = "STRING";
defaultValue = "";
};
class GVAR(moduleEnrollmentPort): Edit {
property = QGVAR(moduleEnrollmentPort);
displayname = "Enrollment HTTPS Port";
tooltip = "Port used for GET /Marti/api/tls/config and POST /Marti/api/tls/signClient/v2.";
typeName = "NUMBER";
defaultValue = "8446";
};
class GVAR(moduleEnrollmentUsername): Edit {
property = QGVAR(moduleEnrollmentUsername);
displayname = "Enrollment Username";
tooltip = "Socket enrollment username for Basic Auth.";
typeName = "STRING";
defaultValue = "";
};
class GVAR(moduleEnrollmentPassword): Edit {
property = QGVAR(moduleEnrollmentPassword);
displayname = "Enrollment Password";
tooltip = "Socket enrollment password for Basic Auth.";
typeName = "STRING";
defaultValue = "";
};
class GVAR(moduleEnrollmentClientUid): Edit {
property = QGVAR(moduleEnrollmentClientUid);
displayname = "Enrollment Client UID";
tooltip = "Optional device identifier sent as clientUid. Leave blank to auto-generate.";
typeName = "STRING";
defaultValue = "";
};
class ModuleDescription: ModuleDescription {};
}; };
class ModuleDescription: ModuleDescription {};
};
class ModuleDescription: ModuleDescription { class ModuleDescription: ModuleDescription {
description = "Generate the initial ARMATAK configuration, syncronizing all players to the TAK server instance"; description = "Connect ArmaTAK to a TAK server over plain TCP.";
sync[] = {"LocationArea_F"}; sync[] = {"LocationArea_F"};
}; };
}; };
class GVAR(coreModuleCurator): GVAR(coreModule) { class GVAR(enrollModule): GVAR(connectionModuleBase) {
scope = 2;
displayName = "CoT Router (Authenticated)";
function = QFUNC(3denEnrollModuleConfig);
class Attributes: AttributesBase {
class GVAR(moduleInstanceAddress): Edit {
property = QGVAR(moduleInstanceAddress);
displayname = "TAK Server Address";
tooltip = "Hostname or IP address used for enrollment and the final TLS connection.";
typeName = "STRING";
defaultValue = "'localhost'";
};
class GVAR(moduleEnrollmentPort): Edit {
property = QGVAR(moduleEnrollmentPort);
displayName = "Enrollment HTTPS Port";
tooltip = "Port used for GET /Marti/api/tls/config and POST /Marti/api/tls/signClient/v2.";
typeName = "NUMBER";
defaultValue = "8446";
};
class GVAR(moduleEnrollmentUsername): Edit {
property = QGVAR(moduleEnrollmentUsername);
displayName = "Enrollment Username";
tooltip = "Username used in Basic Auth for client certificate enrollment.";
typeName = "STRING";
defaultValue = "''";
};
class GVAR(moduleEnrollmentPassword): Edit {
property = QGVAR(moduleEnrollmentPassword);
displayName = "Enrollment Password";
tooltip = "Password used in Basic Auth for client certificate enrollment.";
typeName = "STRING";
defaultValue = "''";
};
class ModuleDescription: ModuleDescription {};
};
class ModuleDescription: ModuleDescription {
description = "Enroll a client certificate and connect ArmaTAK over mTLS.";
sync[] = {"LocationArea_F"};
};
};
class GVAR(tcpModuleCurator): GVAR(tcpModule) {
scope = 1; scope = 1;
scopeCurator = 2; scopeCurator = 2;
function = ""; function = "";
displayName = "CoT Router (Zeus)"; displayName = "CoT Router (TCP, Zeus)";
curatorInfoType = "armatak_zeus_core_module_dialog"; curatorInfoType = "armatak_zeus_tcp_module_dialog";
};
class GVAR(enrollModuleCurator): GVAR(enrollModule) {
scope = 1;
scopeCurator = 2;
function = "";
displayName = "CoT Router (Authenticated, Zeus)";
curatorInfoType = "armatak_zeus_enroll_module_dialog";
}; };
class GVAR(markEntity): GVAR(moduleBase) { class GVAR(markEntity): GVAR(moduleBase) {
curatorCanAttach = 1; curatorCanAttach = 1;
category = QEGVAR(main,moduleCategory); category = QEGVAR(main,moduleCategory);
displayname = "Mark Entity"; displayname = "Mark Entity";
function = QFUNC(routerEntityAdd); function = QFUNC(routerEntityAdd);
icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa"; icon = "\a3\Modules_F_Curator\Data\iconRadio_ca.paa";
}; };
}; };

View File

@@ -1,4 +1,7 @@
PREP(3denCoreModuleConfig); PREP(3denEnrollModuleConfig);
PREP(3denTcpModuleConfig);
PREP(routerEntityAdd); PREP(routerEntityAdd);
PREP(routerEntityRemove); PREP(routerEntityRemove);
PREP(ZeusCoreModuleConfig); PREP(startCotRouter);
PREP(ZeusEnrollModuleConfig);
PREP(ZeusTcpModuleConfig);

View File

@@ -4,8 +4,10 @@ class CfgPatches {
class ADDON { class ADDON {
name = COMPONENT_NAME; name = COMPONENT_NAME;
units[] = { units[] = {
QGVAR(coreModule), QGVAR(tcpModule),
QGVAR(coreModuleCurator), QGVAR(tcpModuleCurator),
QGVAR(enrollModule),
QGVAR(enrollModuleCurator),
QGVAR(markEntity) QGVAR(markEntity)
}; };
weapons[] = {}; weapons[] = {};

View File

@@ -3,222 +3,172 @@ class RscBackground;
class RscButton; class RscButton;
class RscEdit; class RscEdit;
class armatak_zeus_core_module_dialog { class armatak_zeus_tcp_module_dialog {
idd = 999991; idd = 999991;
movingEnable = 0; movingEnable = 0;
class ControlsBackground { class ControlsBackground {
class armatak_gui_module_zeus_core_dialog_main_frame: RscBackground { class main_frame: RscBackground {
idc = 1800; idc = 1800;
x = "0.386562 * safezoneW + safezoneX"; x = "0.386562 * safezoneW + safezoneX";
y = "0.08 * safezoneH + safezoneY"; y = "0.29 * safezoneH + safezoneY";
w = "0.216563 * safezoneW"; w = "0.216563 * safezoneW";
h = "0.84 * safezoneH"; h = "0.32 * safezoneH";
colorBackground[]={0,0,0,0.45}; colorBackground[] = {0,0,0,0.45};
}; };
}; };
class Controls { class Controls {
class armatak_gui_module_zeus_core_dialog_address_edit: RscEdit { class address_text: RscText {
idc = 14000;
text = "localhost";
x = "0.391719 * safezoneW + safezoneX";
y = "0.185 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_address_port_edit: RscEdit {
idc = 14001;
text = "8088";
x = "0.391719 * safezoneW + safezoneX";
y = "0.255 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_transport_mode_edit: RscEdit {
idc = 14006;
text = "tcp";
x = "0.391719 * safezoneW + safezoneX";
y = "0.115 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_enrollment_port_edit: RscEdit {
idc = 14007;
text = "8446";
x = "0.391719 * safezoneW + safezoneX";
y = "0.325 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_enrollment_user_edit: RscEdit {
idc = 14008;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.395 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_tls_name_edit: RscEdit {
idc = 14002;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.465 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_tls_ca_edit: RscEdit {
idc = 14003;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.535 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_tls_client_cert_edit: RscEdit {
idc = 14004;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.605 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_tls_client_key_edit: RscEdit {
idc = 14005;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.675 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_enrollment_password_edit: RscEdit {
idc = 14009;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.745 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_enrollment_client_uid_edit: RscEdit {
idc = 14010;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.815 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[]={0,0,0,0.5};
};
class armatak_gui_module_zeus_core_dialog_transport_mode_text: RscText {
idc = 1006;
text = "Transport Mode (tcp/manual_mtls/enroll_mtls)";
x = "0.391719 * safezoneW + safezoneX";
y = "0.082 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class armatak_gui_module_zeus_core_dialog_address_text: RscText {
idc = 1000; idc = 1000;
text = "TAK Server Address"; text = "TAK Server Address";
x = "0.391719 * safezoneW + safezoneX"; x = "0.391719 * safezoneW + safezoneX";
y = "0.152 * safezoneH + safezoneY"; y = "0.332 * safezoneH + safezoneY";
w = "0.20625 * safezoneW"; w = "0.20625 * safezoneW";
h = "0.033 * safezoneH"; h = "0.033 * safezoneH";
}; };
class armatak_gui_module_zeus_core_dialog_address_port_text: RscText { class address_edit: RscEdit {
idc = 14000;
text = "localhost";
x = "0.391719 * safezoneW + safezoneX";
y = "0.365 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[] = {0,0,0,0.5};
};
class port_text: RscText {
idc = 1001; idc = 1001;
text = "TAK Server Port"; text = "TAK Server Port";
x = "0.391719 * safezoneW + safezoneX"; x = "0.391719 * safezoneW + safezoneX";
y = "0.222 * safezoneH + safezoneY"; y = "0.425 * safezoneH + safezoneY";
w = "0.20625 * safezoneW"; w = "0.20625 * safezoneW";
h = "0.033 * safezoneH"; h = "0.033 * safezoneH";
}; };
class armatak_gui_module_zeus_core_dialog_enrollment_port_text: RscText { class port_edit: RscEdit {
idc = 1007; idc = 14001;
text = "Enrollment HTTPS Port"; text = "8088";
x = "0.391719 * safezoneW + safezoneX"; x = "0.391719 * safezoneW + safezoneX";
y = "0.292 * safezoneH + safezoneY"; y = "0.458 * safezoneH + safezoneY";
w = "0.20625 * safezoneW"; w = "0.20625 * safezoneW";
h = "0.033 * safezoneH"; h = "0.044 * safezoneH";
colorBackground[] = {0,0,0,0.5};
}; };
class armatak_gui_module_zeus_core_dialog_enrollment_user_text: RscText { class button_cancel: RscButton {
idc = 1008;
text = "Enrollment Username";
x = "0.391719 * safezoneW + safezoneX";
y = "0.362 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class armatak_gui_module_zeus_core_dialog_tls_name_text: RscText {
idc = 1002;
text = "TLS Server Name";
x = "0.391719 * safezoneW + safezoneX";
y = "0.432 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class armatak_gui_module_zeus_core_dialog_tls_ca_text: RscText {
idc = 1003;
text = "TLS CA Cert Path";
x = "0.391719 * safezoneW + safezoneX";
y = "0.502 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class armatak_gui_module_zeus_core_dialog_tls_client_cert_text: RscText {
idc = 1004;
text = "TLS Client Cert Path";
x = "0.391719 * safezoneW + safezoneX";
y = "0.572 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class armatak_gui_module_zeus_core_dialog_tls_client_key_text: RscText {
idc = 1005;
text = "TLS Client Key Path";
x = "0.391719 * safezoneW + safezoneX";
y = "0.642 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class armatak_gui_module_zeus_core_dialog_enrollment_password_text: RscText {
idc = 1009;
text = "Enrollment Password";
x = "0.391719 * safezoneW + safezoneX";
y = "0.712 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class armatak_gui_module_zeus_core_dialog_enrollment_client_uid_text: RscText {
idc = 1010;
text = "Enrollment Client UID";
x = "0.391719 * safezoneW + safezoneX";
y = "0.782 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class armatak_gui_module_zeus_core_dialog_address_button_cancel: RscButton {
idc = 1601; idc = 1601;
text = "Cancel"; text = "Cancel";
action = "closeDialog 2;"; action = "closeDialog 2;";
x = "0.551563 * safezoneW + safezoneX"; x = "0.551563 * safezoneW + safezoneX";
y = "0.855 * safezoneH + safezoneY"; y = "0.535 * safezoneH + safezoneY";
w = "0.0464063 * safezoneW"; w = "0.0464063 * safezoneW";
h = "0.055 * safezoneH"; h = "0.055 * safezoneH";
}; };
class armatak_gui_module_zeus_core_dialog_address_button_ok: RscButton { class button_ok: RscButton {
idc = 1600; idc = 1600;
text = "Ok"; text = "Ok";
action = QUOTE(call FUNC(zeusCoreModuleConfig)); action = QUOTE(call FUNC(ZeusTcpModuleConfig));
x = "0.5 * safezoneW + safezoneX"; x = "0.5 * safezoneW + safezoneX";
y = "0.855 * safezoneH + safezoneY"; y = "0.535 * safezoneH + safezoneY";
w = "0.0464063 * safezoneW";
h = "0.055 * safezoneH";
};
};
};
class armatak_zeus_enroll_module_dialog {
idd = 999992;
movingEnable = 0;
class ControlsBackground {
class main_frame: RscBackground {
idc = 1810;
x = "0.386562 * safezoneW + safezoneX";
y = "0.2 * safezoneH + safezoneY";
w = "0.216563 * safezoneW";
h = "0.52 * safezoneH";
colorBackground[] = {0,0,0,0.45};
};
};
class Controls {
class address_text: RscText {
idc = 1010;
text = "TAK Server Address";
x = "0.391719 * safezoneW + safezoneX";
y = "0.242 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class address_edit: RscEdit {
idc = 14100;
text = "localhost";
x = "0.391719 * safezoneW + safezoneX";
y = "0.275 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[] = {0,0,0,0.5};
};
class enroll_port_text: RscText {
idc = 1011;
text = "Enrollment HTTPS Port";
x = "0.391719 * safezoneW + safezoneX";
y = "0.335 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class enroll_port_edit: RscEdit {
idc = 14101;
text = "8446";
x = "0.391719 * safezoneW + safezoneX";
y = "0.368 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[] = {0,0,0,0.5};
};
class username_text: RscText {
idc = 1012;
text = "Enrollment Username";
x = "0.391719 * safezoneW + safezoneX";
y = "0.428 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class username_edit: RscEdit {
idc = 14102;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.461 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[] = {0,0,0,0.5};
};
class password_text: RscText {
idc = 1013;
text = "Enrollment Password";
x = "0.391719 * safezoneW + safezoneX";
y = "0.521 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.033 * safezoneH";
};
class password_edit: RscEdit {
idc = 14103;
text = "";
x = "0.391719 * safezoneW + safezoneX";
y = "0.554 * safezoneH + safezoneY";
w = "0.20625 * safezoneW";
h = "0.044 * safezoneH";
colorBackground[] = {0,0,0,0.5};
};
class button_cancel: RscButton {
idc = 1611;
text = "Cancel";
action = "closeDialog 2;";
x = "0.551563 * safezoneW + safezoneX";
y = "0.645 * safezoneH + safezoneY";
w = "0.0464063 * safezoneW";
h = "0.055 * safezoneH";
};
class button_ok: RscButton {
idc = 1610;
text = "Ok";
action = QUOTE(call FUNC(ZeusEnrollModuleConfig));
x = "0.5 * safezoneW + safezoneX";
y = "0.645 * safezoneH + safezoneY";
w = "0.0464063 * safezoneW"; w = "0.0464063 * safezoneW";
h = "0.055 * safezoneH"; h = "0.055 * safezoneH";
}; };

View File

@@ -1,106 +0,0 @@
#include "..\script_component.hpp"
params [
["_logic", objNull, [objNull]],
["_units", [], [[]]],
["_activated", true, [true]]
];
if (isServer) exitWith {
["Connecting to TCP Socket", "success", "TCP Socket"] call EFUNC(main,notify);
_transport_mode = _logic getVariable [QGVAR(moduleTransportMode), "tcp"];
_tak_server_instance_address = _logic getVariable QGVAR(moduleInstanceAddress);
_tak_server_instance_port = _logic getVariable QGVAR(moduleInstancePort);
_tak_server_tls_name = _logic getVariable [QGVAR(moduleTlsServerName), ""];
_tak_server_tls_ca_cert_path = _logic getVariable [QGVAR(moduleTlsCaCertPath), ""];
_tak_server_tls_client_cert_path = _logic getVariable [QGVAR(moduleTlsClientCertPath), ""];
_tak_server_tls_client_key_path = _logic getVariable [QGVAR(moduleTlsClientKeyPath), ""];
_tak_server_enrollment_port = _logic getVariable [QGVAR(moduleEnrollmentPort), 8446];
_tak_server_enrollment_username = _logic getVariable [QGVAR(moduleEnrollmentUsername), ""];
_tak_server_enrollment_password = _logic getVariable [QGVAR(moduleEnrollmentPassword), ""];
_tak_server_enrollment_client_uid = _logic getVariable [QGVAR(moduleEnrollmentClientUid), ""];
_tak_server_fulladdress = _tak_server_instance_address + ":" + (str _tak_server_instance_port);
missionNamespace setVariable ["armatak_server_instance", _tak_server_fulladdress];
missionNamespace setVariable ["armatak_tcp_socket_is_running", true];
if (_tak_server_tls_name == "") then {
_tak_server_tls_name = _tak_server_instance_address;
};
switch (_transport_mode) do {
case "manual_mtls": {
"armatak" callExtension [
"tcp_socket:start_mtls",
[
_tak_server_fulladdress,
_tak_server_tls_name,
_tak_server_tls_ca_cert_path,
_tak_server_tls_client_cert_path,
_tak_server_tls_client_key_path
]
];
};
case "enroll_mtls": {
"armatak" callExtension [
"tcp_socket:start_enroll_mtls",
[
_tak_server_instance_address,
_tak_server_tls_name,
str _tak_server_enrollment_port,
_tak_server_enrollment_username,
_tak_server_enrollment_password,
_tak_server_enrollment_client_uid
]
];
};
default {
"armatak" callExtension ["tcp_socket:start", [_tak_server_fulladdress]];
};
};
_syncUnits = synchronizedObjects _logic;
missionNamespace setVariable ["armatak_server_syncedUnits", _syncUnits];
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
[{
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
{
_objectType = _x call BIS_fnc_objectType;
switch (true) do {
case ((_objectType select 0) == "Soldier"): {
_callsign = [_x] call armatak_fnc_extract_unit_callsign;
_group_name = [group _x] call armatak_fnc_extract_group_color;
_group_role = [_x] call armatak_fnc_extract_group_role;
[_x, _callsign, _group_name, _group_role] call armatak_fnc_send_eud_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
};
case ((_objectType select 0) == "Vehicle"): {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
_x call armatak_fnc_extract_sensor_data;
};
case ((_objectType select 0) == "VehicleAutonomous"): {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
_x call armatak_fnc_extract_sensor_data;
};
};
} forEach GVAR(syncedUnits);
}, 1, []] call CBA_fnc_addPerFrameHandler;
};
true;

View File

@@ -0,0 +1,37 @@
#include "..\script_component.hpp"
params [
["_logic", objNull, [objNull]],
["_units", [], [[]]],
["_activated", true, [true]]
];
if (isServer) exitWith {
if (missionNamespace getVariable ["armatak_tcp_socket_is_running", false]) exitWith {
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
};
["Connecting to authenticated TAK socket", "success", "TCP Socket"] call EFUNC(main,notify);
_tak_server_instance_address = _logic getVariable [QGVAR(moduleInstanceAddress), "localhost"];
_tak_server_enrollment_port = _logic getVariable [QGVAR(moduleEnrollmentPort), 8446];
_tak_server_enrollment_username = _logic getVariable [QGVAR(moduleEnrollmentUsername), ""];
_tak_server_enrollment_password = _logic getVariable [QGVAR(moduleEnrollmentPassword), ""];
"armatak" callExtension [
"tcp_socket:start_enroll_mtls",
[
_tak_server_instance_address,
_tak_server_instance_address,
str _tak_server_enrollment_port,
_tak_server_enrollment_username,
_tak_server_enrollment_password,
""
]
];
missionNamespace setVariable ["armatak_server_syncedUnits", synchronizedObjects _logic];
_tak_server_instance_address call FUNC(startCotRouter);
};
true

View File

@@ -0,0 +1,26 @@
#include "..\script_component.hpp"
params [
["_logic", objNull, [objNull]],
["_units", [], [[]]],
["_activated", true, [true]]
];
if (isServer) exitWith {
if (missionNamespace getVariable ["armatak_tcp_socket_is_running", false]) exitWith {
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
};
["Connecting to TCP Socket", "success", "TCP Socket"] call EFUNC(main,notify);
_tak_server_instance_address = _logic getVariable [QGVAR(moduleInstanceAddress), "localhost"];
_tak_server_instance_port = _logic getVariable [QGVAR(moduleInstancePort), 8088];
_tak_server_fulladdress = _tak_server_instance_address + ":" + (str _tak_server_instance_port);
"armatak" callExtension ["tcp_socket:start", [_tak_server_fulladdress]];
missionNamespace setVariable ["armatak_server_syncedUnits", synchronizedObjects _logic];
_tak_server_fulladdress call FUNC(startCotRouter);
};
true

View File

@@ -1,109 +0,0 @@
#include "..\script_component.hpp"
params ["_logic"];
_socket_is_running = missionNamespace getVariable ["armatak_tcp_socket_is_running", false];
if (_socket_is_running) exitWith {
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
closeDialog 1;
};
disableSerialization;
["Connecting to TCP Socket", "success", "TCP Socket"] call EFUNC(main,notify);
_transport_mode = toLower (ctrlText 14006);
_tak_server_instance_address = ctrlText 14000;
_tak_server_instance_port = ctrlText 14001;
_tak_server_tls_name = ctrlText 14002;
_tak_server_tls_ca_cert_path = ctrlText 14003;
_tak_server_tls_client_cert_path = ctrlText 14004;
_tak_server_tls_client_key_path = ctrlText 14005;
_tak_server_enrollment_port = ctrlText 14007;
_tak_server_enrollment_username = ctrlText 14008;
_tak_server_enrollment_password = ctrlText 14009;
_tak_server_enrollment_client_uid = ctrlText 14010;
_tak_server_fulladdress = ((_tak_server_instance_address) + ":" + (_tak_server_instance_port));
missionNamespace setVariable ["armatak_server_instance", _tak_server_fulladdress];
missionNamespace setVariable ["armatak_tcp_socket_is_running", true];
if (_tak_server_tls_name == "") then {
_tak_server_tls_name = _tak_server_instance_address;
};
switch (_transport_mode) do {
case "manual_mtls": {
"armatak" callExtension [
"tcp_socket:start_mtls",
[
_tak_server_fulladdress,
_tak_server_tls_name,
_tak_server_tls_ca_cert_path,
_tak_server_tls_client_cert_path,
_tak_server_tls_client_key_path
]
];
};
case "enroll_mtls": {
"armatak" callExtension [
"tcp_socket:start_enroll_mtls",
[
_tak_server_instance_address,
_tak_server_tls_name,
_tak_server_enrollment_port,
_tak_server_enrollment_username,
_tak_server_enrollment_password,
_tak_server_enrollment_client_uid
]
];
};
default {
"armatak" callExtension ["tcp_socket:start", [_tak_server_fulladdress]];
};
};
_syncUnits = [];
missionNamespace setVariable ["armatak_server_syncedUnits", _syncUnits];
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
[{
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
{
_objectType = _x call BIS_fnc_objectType;
switch (true) do {
case ((_objectType select 0) == "Soldier"): {
_callsign = [_x] call armatak_fnc_extract_unit_callsign;
_group_name = [group _x] call armatak_fnc_extract_group_color;
_group_role = [_x] call armatak_fnc_extract_group_role;
[_x, _callsign, _group_name, _group_role] call armatak_fnc_send_eud_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
};
case ((_objectType select 0) == "Vehicle"): {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
_x call armatak_fnc_extract_sensor_data;
};
case ((_objectType select 0) == "VehicleAutonomous"): {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
_x call armatak_fnc_extract_sensor_data;
};
};
} forEach GVAR(syncedUnits);
}, 1, []] call CBA_fnc_addPerFrameHandler;
deleteVehicle _logic;
closeDialog 1;

View File

@@ -0,0 +1,33 @@
#include "..\script_component.hpp"
params ["_logic"];
if (missionNamespace getVariable ["armatak_tcp_socket_is_running", false]) exitWith {
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
closeDialog 1;
};
disableSerialization;
["Connecting to authenticated TAK socket", "success", "TCP Socket"] call EFUNC(main,notify);
_tak_server_instance_address = ctrlText 14100;
_tak_server_enrollment_port = ctrlText 14101;
_tak_server_enrollment_username = ctrlText 14102;
_tak_server_enrollment_password = ctrlText 14103;
"armatak" callExtension [
"tcp_socket:start_enroll_mtls",
[
_tak_server_instance_address,
_tak_server_instance_address,
_tak_server_enrollment_port,
_tak_server_enrollment_username,
_tak_server_enrollment_password,
""
]
];
_tak_server_instance_address call FUNC(startCotRouter);
deleteVehicle _logic;
closeDialog 1;

View File

@@ -0,0 +1,22 @@
#include "..\script_component.hpp"
params ["_logic"];
if (missionNamespace getVariable ["armatak_tcp_socket_is_running", false]) exitWith {
["Socket was called twice", "error", "TCP Socket"] call EFUNC(main,notify);
closeDialog 1;
};
disableSerialization;
["Connecting to TCP Socket", "success", "TCP Socket"] call EFUNC(main,notify);
_tak_server_instance_address = ctrlText 14000;
_tak_server_instance_port = ctrlText 14001;
_tak_server_fulladdress = _tak_server_instance_address + ":" + _tak_server_instance_port;
"armatak" callExtension ["tcp_socket:start", [_tak_server_fulladdress]];
_tak_server_fulladdress call FUNC(startCotRouter);
deleteVehicle _logic;
closeDialog 1;

View File

@@ -0,0 +1,47 @@
#include "..\script_component.hpp"
params [["_server_instance", "", [""]]];
missionNamespace setVariable ["armatak_server_instance", _server_instance];
missionNamespace setVariable ["armatak_tcp_socket_is_running", true];
if (isNil { missionNamespace getVariable "armatak_server_syncedUnits" }) then {
missionNamespace setVariable ["armatak_server_syncedUnits", []];
};
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
[{
GVAR(syncedUnits) = missionNamespace getVariable "armatak_server_syncedUnits";
{
_objectType = _x call BIS_fnc_objectType;
switch (true) do {
case ((_objectType select 0) == "Soldier"): {
_callsign = [_x] call armatak_fnc_extract_unit_callsign;
_group_name = [group _x] call armatak_fnc_extract_group_color;
_group_role = [_x] call armatak_fnc_extract_group_role;
[_x, _callsign, _group_name, _group_role] call armatak_fnc_send_eud_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
};
case ((_objectType select 0) == "Vehicle"): {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
[_x, _atak_type, _callsign] call armatak_fnc_send_marker_cot;
_x call armatak_fnc_extract_sensor_data;
};
case ((_objectType select 0) == "VehicleAutonomous"): {
_atak_type = [_x] call armatak_fnc_extract_role;
_callsign = [_x] call armatak_fnc_extract_marker_callsign;
[_x, _atak_type, _callsign] call armatak_fnc_send_drone_cot;
[_x] call armatak_fnc_send_digital_pointer_cot;
_x call armatak_fnc_extract_sensor_data;
};
};
} forEach GVAR(syncedUnits);
}, 1, []] call CBA_fnc_addPerFrameHandler;
true

View File

@@ -51,6 +51,21 @@ fn enrollment_http_client() -> Result<Client, String> {
.map_err(|e| format!("failed to build enrollment HTTP client: {}", e)) .map_err(|e| format!("failed to build enrollment HTTP client: {}", e))
} }
fn response_error_details(response: reqwest::blocking::Response) -> String {
let status = response.status();
match response.text() {
Ok(body) => {
let trimmed = body.trim();
if trimmed.is_empty() {
status.to_string()
} else {
format!("{}: {}", status, trimmed)
}
}
Err(_) => status.to_string(),
}
}
fn fetch_enrollment_config(host: &str, enroll_port: &str) -> Result<EnrollmentConfig, String> { fn fetch_enrollment_config(host: &str, enroll_port: &str) -> Result<EnrollmentConfig, String> {
let url = format!( let url = format!(
"https://{}:{}/Marti/api/tls/config", "https://{}:{}/Marti/api/tls/config",
@@ -58,11 +73,20 @@ fn fetch_enrollment_config(host: &str, enroll_port: &str) -> Result<EnrollmentCo
enroll_port.trim() enroll_port.trim()
); );
let response_text = enrollment_http_client()? let response = enrollment_http_client()?
.get(&url) .get(&url)
.send() .send()
.and_then(|response| response.error_for_status()) .map_err(|e| format!("failed to fetch {}: {}", url, e))?;
.map_err(|e| format!("failed to fetch {}: {}", url, e))?
if !response.status().is_success() {
return Err(format!(
"failed to fetch {}: {}",
url,
response_error_details(response)
));
}
let response_text = response
.text() .text()
.map_err(|e| format!("failed to read config response from {}: {}", url, e))?; .map_err(|e| format!("failed to read config response from {}: {}", url, e))?;
@@ -99,9 +123,8 @@ fn enroll_client_certificate(
let csr = params let csr = params
.serialize_request(&key_pair) .serialize_request(&key_pair)
.map_err(|e| format!("failed to generate CSR: {}", e))? .map_err(|e| format!("failed to generate CSR: {}", e))?;
.pem() let csr_der = csr.der().as_ref().to_vec();
.map_err(|e| format!("failed to serialize CSR to PEM: {}", e))?;
let url = format!( let url = format!(
"https://{}:{}{}?clientUid={}", "https://{}:{}{}?clientUid={}",
@@ -115,12 +138,19 @@ fn enroll_client_certificate(
.post(&url) .post(&url)
.basic_auth(username.trim(), Some(password.to_string())) .basic_auth(username.trim(), Some(password.to_string()))
.header("Accept", "application/json") .header("Accept", "application/json")
.header("Content-Type", "application/x-pem-file") .header("Content-Type", "application/pkcs10")
.body(csr) .body(csr_der)
.send() .send()
.and_then(|response| response.error_for_status())
.map_err(|e| format!("failed to enroll client certificate at {}: {}", url, e))?; .map_err(|e| format!("failed to enroll client certificate at {}: {}", url, e))?;
if !response.status().is_success() {
return Err(format!(
"failed to enroll client certificate at {}: {}",
url,
response_error_details(response)
));
}
let enrollment: EnrollmentResponse = response let enrollment: EnrollmentResponse = response
.json() .json()
.map_err(|e| format!("failed to parse enrollment response: {}", e))?; .map_err(|e| format!("failed to parse enrollment response: {}", e))?;