18 #ifndef IOX_POSH_RUNTIME_IPC_INTERFACE_BASE_HPP
19 #define IOX_POSH_RUNTIME_IPC_INTERFACE_BASE_HPP
21 #include "iceoryx_posh/iceoryx_posh_types.hpp"
22 #include "iceoryx_posh/internal/runtime/ipc_message.hpp"
23 #include "iceoryx_utils/cxx/deadline_timer.hpp"
24 #include "iceoryx_utils/cxx/optional.hpp"
25 #include "iceoryx_utils/internal/posix_wrapper/unix_domain_socket.hpp"
26 #include "iceoryx_utils/internal/relocatable_pointer/relative_pointer.hpp"
27 #include "iceoryx_utils/internal/units/duration.hpp"
28 #include "iceoryx_utils/platform/fcntl.hpp"
29 #include "iceoryx_utils/platform/stat.hpp"
30 #include "iceoryx_utils/platform/types.hpp"
31 #include "iceoryx_utils/platform/unistd.hpp"
40 #if defined(QNX) || defined(QNX__) || defined(__QNX__)
48 enum class IpcMessageType : int32_t
57 CREATE_SUBSCRIBER_ACK,
61 CREATE_APPLICATION_ACK,
62 CREATE_CONDITION_VARIABLE,
63 CREATE_CONDITION_VARIABLE_ACK,
70 PREPARE_APP_TERMINATION,
71 PREPARE_APP_TERMINATION_ACK,
76 SERVICE_REGISTRY_CHANGE_COUNTER,
77 MESSAGE_NOT_SUPPORTED,
83 enum class IpcMessageErrorType : int32_t
90 REQUEST_PUBLISHER_WRONG_IPC_MESSAGE_RESPONSE,
91 REQUEST_PUBLISHER_NO_WRITABLE_SHM_SEGMENT,
92 REQUEST_SUBSCRIBER_WRONG_IPC_MESSAGE_RESPONSE,
93 REQUEST_CONDITION_VARIABLE_WRONG_IPC_MESSAGE_RESPONSE,
94 REQUEST_EVENT_VARIABLE_WRONG_IPC_MESSAGE_RESPONSE,
97 CONDITION_VARIABLE_LIST_FULL,
98 EVENT_VARIABLE_LIST_FULL,
106 IpcMessageType stringToIpcMessageType(
const char* str) noexcept;
110 std::string IpcMessageTypeToString(
const IpcMessageType msg) noexcept;
114 IpcMessageErrorType stringToIpcMessageErrorType(
const char* str) noexcept;
117 std::string IpcMessageErrorTypeToString(
const IpcMessageErrorType msg) noexcept;
119 class IpcInterfaceUser;
120 class IpcInterfaceCreator;
203 IpcInterfaceBase(const RuntimeName_t& runtimeName, const uint64_t maxMessages, const uint64_t messageSize) noexcept;
241 RuntimeName_t m_runtimeName;
242 uint64_t m_maxMessageSize{0U};
243 uint64_t m_maxMessages{0U};
244 iox::posix::IpcChannelSide m_channelSide{posix::IpcChannelSide::CLIENT};
Base-Class should never be used by the end-user. Handles the common properties and methods for the ch...
Definition: ipc_interface_base.hpp:127
bool receive(IpcMessage &answer) const noexcept
Receives a message from the IPC channel and stores it in answer.
static bool setMessageFromString(const char *buffer, IpcMessage &answer) noexcept
Set the content of answer from buffer.
bool openIpcChannel(const posix::IpcChannelSide channelSide) noexcept
Opens a IPC channel and default permissions stored in m_perms and stores the descriptor.
bool hasClosableIpcChannel() const noexcept
If a IPC channel was moved then m_runtimeName was cleared and this object gave up the control of that...
bool reopen() noexcept
Closes and opens an existing IPC channel using the same parameters as before. If the queue was not op...
bool send(const IpcMessage &msg) const noexcept
Tries to send the message specified in msg.
bool ipcChannelMapsToFile() noexcept
Checks if the IPC channel has its counterpart in the file system.
bool closeIpcChannel() noexcept
Closes a IPC channel.
bool isInitialized() const noexcept
If the IPC channel could not be opened or linked in the constructor it will return false,...
const RuntimeName_t & getRuntimeName() const noexcept
Returns the interface name, the unique char string which explicitly identifies the IPC channel.
bool timedReceive(const units::Duration timeout, IpcMessage &answer) const noexcept
Tries to receive a message from the IPC channel within a specified timeout. It stores the message in ...
static void cleanupOutdatedIpcChannel(const RuntimeName_t &name) noexcept
Since there might be an outdated IPC channel due to an unclean temination this function closes the IP...
bool timedSend(const IpcMessage &msg, const units::Duration timeout) const noexcept
Tries to send the message specified in msg to the message queue within a specified timeout.
Class for creating and handling a IPC channel.
Definition: ipc_interface_creator.hpp:31
Class for using a IPC channel.
Definition: ipc_interface_user.hpp:29
Definition: ipc_message.hpp:43
Definition: ipc_runtime_interface.hpp:29
Definition: service_description.hpp:29
iox::posix::UnixDomainSocket IpcChannelType
The socket is created in the current path if no absolute path is given hence we need an absolut path ...
Definition: iceoryx_posh_types.hpp:60