1#include <grpcpp/grpcpp.h>
2#include "panoptes.pb.h"
3#include "panoptes.grpc.pb.h"
14 InitializeCriticalSection(&cs_);
15 InitializeConditionVariable(&cv_);
22 EnterCriticalSection(&cs_);
24 std::cout <<
"Enqueued item. Queue size: " << queue_.size() << std::endl;
25 LeaveCriticalSection(&cs_);
26 WakeConditionVariable(&cv_);
32 EnterCriticalSection(&cs_);
33 while (queue_.empty()) {
34 std::cout <<
"Queue empty, waiting..." << std::endl;
35 SleepConditionVariableCS(&cv_, &cs_, INFINITE);
37 PeScan message = queue_.front();
40 LeaveCriticalSection(&cs_);
52 ::grpc::Status PEScan(::grpc::ServerContext* context, const ::PeScanInfo* request, ::AckMessage* response)
override {
54 scanInfo.
PePath = request->portable_executable_path();
55 scanInfo.
FileHash = request->file_hash();
61 response->set_ack_type(AckType::SUCCESS);
62 return ::grpc::Status::OK;
70 int* ContainerPort = (
int*)(lpParam);
73 grpc::ServerBuilder builder;
74 std::string server_url =
"localhost:" + std::to_string(*ContainerPort);
75 builder.AddListeningPort(server_url, grpc::InsecureServerCredentials(), ContainerPort);
76 builder.RegisterService(&service);
77 std::unique_ptr<grpc::Server> server(builder.BuildAndStart());
The PanoptesImpl class is a class that implements the PanoptesExtensibility::Service interface from t...
PeMessageQueue()
The PeMessageQueue class is a thread-safe queue for PeScan messages.
PeScan dequeue()
The dequeue function dequeues a PeScan messages from the queue.
void enqueue(const PeScan &message)
The enqueue function is a function that enqueues a PeScan message to the queue.
PeMessageQueue * message_queue_pe_
void RunContainerServer(LPVOID lpParam)
The RunContainerServer function is a function that runs the container server.
The information about the file to be scanned that passed between the container, extensibility and the...