libcamera v0.5.1
Supporting cameras in Linux since 2019
Loading...
Searching...
No Matches
ipc_pipe.h
Go to the documentation of this file.
1/* SPDX-License-Identifier: LGPL-2.1-or-later */
2/*
3 * Copyright (C) 2020, Google Inc.
4 *
5 * Image Processing Algorithm IPC module for IPA proxies
6 */
7
8#pragma once
9
10#include <stdint.h>
11#include <vector>
12
15
17
18namespace libcamera {
19
21{
22public:
23 struct Header {
24 uint32_t cmd;
25 uint32_t cookie;
26 };
27
28 IPCMessage();
29 IPCMessage(uint32_t cmd);
30 IPCMessage(const Header &header);
32
34
35 Header &header() { return header_; }
36 std::vector<uint8_t> &data() { return data_; }
37 std::vector<SharedFD> &fds() { return fds_; }
38
39 const Header &header() const { return header_; }
40 const std::vector<uint8_t> &data() const { return data_; }
41 const std::vector<SharedFD> &fds() const { return fds_; }
42
43private:
44 Header header_;
45
46 std::vector<uint8_t> data_;
47 std::vector<SharedFD> fds_;
48};
49
51{
52public:
53 IPCPipe();
54 virtual ~IPCPipe();
55
56 bool isConnected() const { return connected_; }
57
58 virtual int sendSync(const IPCMessage &in,
59 IPCMessage *out) = 0;
60
61 virtual int sendAsync(const IPCMessage &data) = 0;
62
64
65protected:
67};
68
69} /* namespace libcamera */
IPC message to be passed through IPC message pipe.
Definition ipc_pipe.h:21
IPCMessage()
Construct an empty IPCMessage instance.
Definition ipc_pipe.cpp:51
IPCUnixSocket::Payload payload() const
Create an IPCUnixSocket payload from the IPCMessage.
Definition ipc_pipe.cpp:100
const std::vector< SharedFD > & fds() const
Returns a const reference to the vector containing file descriptors.
Definition ipc_pipe.h:41
std::vector< SharedFD > & fds()
Returns a reference to the vector containing file descriptors.
Definition ipc_pipe.h:37
std::vector< uint8_t > & data()
Returns a reference to the byte vector containing data.
Definition ipc_pipe.h:36
Header & header()
Returns a reference to the header.
Definition ipc_pipe.h:35
const std::vector< uint8_t > & data() const
Returns a const reference to the byte vector containing data.
Definition ipc_pipe.h:40
const Header & header() const
Returns a const reference to the header.
Definition ipc_pipe.h:39
virtual int sendAsync(const IPCMessage &data)=0
Send a message over IPC asynchronously.
Signal< const IPCMessage & > recv
Signal to be emitted when a message is received over IPC.
Definition ipc_pipe.h:63
IPCPipe()
Construct an IPCPipe instance.
Definition ipc_pipe.cpp:163
bool connected_
Flag to indicate if the IPCPipe instance is connected.
Definition ipc_pipe.h:66
bool isConnected() const
Check if the IPCPipe instance is connected.
Definition ipc_pipe.h:56
virtual int sendSync(const IPCMessage &in, IPCMessage *out)=0
Send a message over IPC synchronously.
Generic signal and slot communication mechanism.
Definition signal.h:39
IPC mechanism based on Unix sockets.
Top-level libcamera namespace.
Definition backtrace.h:17
File descriptor wrapper.
Signal & slot implementation.
Container for an IPCMessage header.
Definition ipc_pipe.h:23
uint32_t cookie
Cookie to identify the message and a corresponding reply.
Definition ipc_pipe.h:25
uint32_t cmd
Type of IPCMessage.
Definition ipc_pipe.h:24
Container for an IPC payload.
Definition ipc_unixsocket.h:24