1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40
|
/*
* Copyright (C) 2026 Intel Corporation
*
* SPDX-License-Identifier: MIT
*
*/
#pragma once
#include "shared/source/os_interface/linux/ipc_socket_server.h"
#include <string>
namespace NEO {
class IpcSocketClient {
public:
IpcSocketClient();
~IpcSocketClient();
bool connectToServer(const std::string &socketPath);
void disconnect();
int requestHandle(uint64_t handleId);
bool isConnected() const { return clientSocket != -1; }
protected:
int receiveFileDescriptor(void *data, size_t dataSize);
bool sendMessage(const IpcSocketMessage &msg, const void *payload = nullptr);
bool receiveMessage(IpcSocketMessage &msg, void *payload = nullptr, size_t maxPayloadSize = 0);
private:
int clientSocket = -1;
std::string serverSocketPath;
static constexpr int socketTimeout = 5000; // 5 seconds
};
} // namespace NEO
|