Panoptes 1.0.0
Endpoint Detection and Response
Loading...
Searching...
No Matches
Classes | Functions
service_ipc.h File Reference
#include <Windows.h>
#include <string>
#include <queue>
#include <mutex>
#include <condition_variable>
#include <thread>

Go to the source code of this file.

Classes

class  PanoptesContainerClient
 

Functions

VOID RunServiceServer (LPVOID lpParam)
 

Function Documentation

◆ RunServiceServer()

VOID RunServiceServer ( LPVOID  lpParam)

Definition at line 371 of file grpc.cpp.

372{
373 serviceContext = reinterpret_cast<PanoptesContext*>(lpParam);
374 PanoptesImpl service;
375 grpc::ServerBuilder builder;
376 int selected_port = 0;
377 std::string server_url = "localhost:0";
378
379 //Setting the server address to localhost:0 will allow the OS to assign an available port
380 builder.AddListeningPort(server_url, grpc::InsecureServerCredentials(), &selected_port);
381 builder.RegisterService(&service);
382
383 std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
384 if (server == nullptr) {
385 auto threadError = &serviceContext->threadError;
386 bool threadState = threadError->load();
387 threadError->store(true);
388 }
389
390 bool updatedReg = CreateRegistryEntryWithPort(selected_port);
391 if (!updatedReg) {
392 auto threadError = &serviceContext->threadError;
393 bool threadState = threadError->load();
394 threadError->store(true);
395 }
396
397 server->Wait();
398}
The PanoptesImpl class is a class that implements the PanoptesExtensibility::Service interface from t...
PanoptesContext * serviceContext
Definition grpc.cpp:27
bool CreateRegistryEntryWithPort(DWORD dwPort)
Definition grpc.cpp:127
std::atomic< bool > threadError