mirror of
https://github.com/Ylianst/MeshAgent
synced 2026-01-21 11:53:26 +00:00
Added new command 'MeshCommand_AgentCommitDate'
This commit is contained in:
@@ -28,6 +28,7 @@ limitations under the License.
|
||||
#include "signcheck.h"
|
||||
#include "meshdefines.h"
|
||||
#include "meshinfo.h"
|
||||
#include "microscript/ILibDuktape_Commit.h"
|
||||
#include "microscript/ILibDuktape_Polyfills.h"
|
||||
#include "microscript/ILibDuktape_Helpers.h"
|
||||
#include "microscript/ILibDuktape_SHA256.h"
|
||||
@@ -199,7 +200,6 @@ typedef struct MeshCommand_BinaryPacket_CoreModule
|
||||
}MeshCommand_BinaryPacket_CoreModule;
|
||||
#pragma pack(pop)
|
||||
|
||||
|
||||
#define ScriptContainerSettingsKey "\xFF_ScriptContainerSettings"
|
||||
|
||||
ScriptContainerSettings* ScriptEngine_GetSettings(duk_context *ctx)
|
||||
@@ -3407,6 +3407,12 @@ void MeshServer_OnResponse(ILibWebClient_StateObject WebStateObject, int Interru
|
||||
ILibWebClient_SetTimeout(WebStateObject, agent->controlChannel_idleTimeout_seconds, MeshServer_ControlChannel_IdleTimeout, agent);
|
||||
ILibWebClient_WebSocket_SetPingPongHandler(WebStateObject, MeshServer_ControlChannel_PingSink, MeshServer_ControlChannel_PongSink, agent);
|
||||
|
||||
// Send Agent Commit Date to server. This is useful in case the server needs to adjust control flow based on agent build
|
||||
char commitPacket[sizeof(uint16_t) + sizeof(SOURCE_COMMIT_DATE)] = { 0 };
|
||||
((uint16_t*)commitPacket)[0] = htons(MeshCommand_AgentCommitDate);
|
||||
strcpy_s(commitPacket + sizeof(uint16_t), sizeof(SOURCE_COMMIT_DATE), SOURCE_COMMIT_DATE);
|
||||
ILibWebClient_WebSocket_Send(WebStateObject, ILibWebClient_WebSocket_DataType_BINARY, (char*)commitPacket, sizeof(commitPacket), ILibAsyncSocket_MemoryOwnership_USER, ILibWebClient_WebSocket_FragmentFlag_Complete);
|
||||
|
||||
#ifndef MICROSTACK_NOTLS
|
||||
X509* peer = ILibWebClient_SslGetCert(WebStateObject);
|
||||
agent->serverAuthState = 0; // We are not authenticated. Bitmask: 1 = Server Auth, 2 = Agent Auth.
|
||||
|
||||
@@ -114,6 +114,7 @@ typedef enum MeshCommands_Binary
|
||||
MeshCommand_CoreModule = 10, // New core modules to be used instead of the old one, if empty, remove the core module
|
||||
MeshCommand_CompressedCoreModule = 20,
|
||||
MeshCommand_CoreModuleHash = 11, // Request/return the SHA384 hash of the core module
|
||||
MeshCommand_AgentCommitDate = 30, // Commit Date that the agent was built with
|
||||
MeshCommand_AgentHash = 12, // Request/return the SHA384 hash of the agent executable
|
||||
MeshCommand_AgentUpdate = 13, // Indicate the start and end of the mesh agent binary transfer
|
||||
MeshCommand_AgentUpdateBlock = 14, // Part of the mesh agent sent from the server to the agent, confirmation/flowcontrol from agent to server
|
||||
|
||||
Reference in New Issue
Block a user