#pragma once #include #include #include class ToxIPCClient : public ToxI, public ToxEventProviderBase { ipc_sharedmemory _mem_rpc; ipc_sharedsemaphore _sem_rpc_c; ipc_sharedsemaphore _sem_rpc_s; ipc_sharedmemory _mem_events; ipc_sharedsemaphore _sem_events_lock; public: ToxIPCClient(void); ~ToxIPCClient(void); bool connect(void); // pulls events and handles them void iterate(void); public: // ToxI Tox_Connection toxSelfGetConnectionStatus(void) override; uint32_t toxIterationInterval(void) override; std::vector toxSelfGetAddress(void) override; void toxSelfSetNospam(uint32_t nospam) override; uint32_t toxSelfGetNospam(void) override; std::vector toxSelfGetPublicKey(void) override; Tox_Err_Set_Info toxSelfSetName(std::string_view name) override; std::string toxSelfGetName(void) override; Tox_Err_Set_Info toxSelfSetStatusMessage(std::string_view status_message) override; std::string toxSelfGetStatusMessage(void) override; void toxSelfSetStatus(Tox_User_Status status) override; Tox_User_Status toxSelfGetStatus(void) override; std::tuple, Tox_Err_Friend_Add> toxFriendAdd(const std::vector& address, std::string_view message) override; std::tuple, Tox_Err_Friend_Add> toxFriendAddNorequest(const std::vector& public_key) override; Tox_Err_Friend_Delete toxFriendDelete(uint32_t friend_number) override; std::tuple, Tox_Err_Friend_By_Public_Key> toxFriendByPublicKey(const std::vector& public_key) override; bool toxFriendExists(uint32_t friend_number) override; std::optional> toxFriendGetPublicKey(uint32_t friend_number) override; std::optional toxFriendGetLastOnline(uint32_t friend_number) override; std::optional toxFriendGetName(uint32_t friend_number) override; std::optional toxFriendGetStatusMessage(uint32_t friend_number) override; std::optional toxFriendGetStatus(uint32_t friend_number) override; std::optional toxFriendGetConnectionStatus(uint32_t friend_number) override; std::optional toxFriendGetTyping(uint32_t friend_number) override; Tox_Err_Set_Typing toxSelfSetTyping(uint32_t friend_number, bool typing) override; std::tuple, Tox_Err_Friend_Send_Message> toxFriendSendMessage(uint32_t friend_number, Tox_Message_Type type, std::string_view message) override; // should this be virtual at all? // TODO: array? make it type agnostic? std::vector toxHash(const std::vector& data) override; // files Tox_Err_File_Control toxFileControl(uint32_t friend_number, uint32_t file_number, Tox_File_Control control) override; Tox_Err_File_Seek toxFileSeek(uint32_t friend_number, uint32_t file_number, uint64_t position) override; std::tuple>, Tox_Err_File_Get> toxFileGetFileID(uint32_t friend_number, uint32_t file_number) override; std::tuple, Tox_Err_File_Send> toxFileSend(uint32_t friend_number, uint32_t kind, uint64_t file_size, const std::vector& file_id, std::string_view filename) override; Tox_Err_File_Send_Chunk toxFileSendChunk(uint32_t friend_number, uint32_t file_number, uint64_t position, const std::vector& data) override; // conferece std::tuple, Tox_Err_Conference_Join> toxConferenceJoin(uint32_t friend_number, const std::vector& cookie) override; Tox_Err_Conference_Send_Message toxConferenceSendMessage(uint32_t conference_number, Tox_Message_Type type, std::string_view message) override; Tox_Err_Friend_Custom_Packet toxFriendSendLossyPacket(uint32_t friend_number, const std::vector& data) override; Tox_Err_Friend_Custom_Packet toxFriendSendLosslessPacket(uint32_t friend_number, const std::vector& data) override; // dht // udp // tcp // group std::tuple, Tox_Err_Group_New> toxGroupNew(Tox_Group_Privacy_State privacy_state, std::string_view group_name, std::string_view name) override; std::tuple, Tox_Err_Group_Join> toxGroupJoin(const std::vector& chat_id, std::string_view name, std::string_view password) override; std::optional toxGroupIsConnected(uint32_t group_number) override; Tox_Err_Group_Reconnect toxGroupReconnect(uint32_t group_number) override; Tox_Err_Group_Leave toxGroupLeave(uint32_t group_number, std::string_view part_message) override; std::optional toxGroupSelfGetName(uint32_t group_number) override; std::tuple, Tox_Err_Group_Peer_Query> toxGroupPeerGetName(uint32_t group_number, uint32_t peer_id) override; std::tuple, Tox_Err_Group_Peer_Query> toxGroupPeerGetConnectionStatus(uint32_t group_number, uint32_t peer_id) override; Tox_Err_Group_Topic_Set toxGroupSetTopic(uint32_t group_number, std::string_view topic) override; std::optional toxGroupGetTopic(uint32_t group_number) override; std::optional toxGroupGetName(uint32_t group_number) override; std::optional> toxGroupGetChatId(uint32_t group_number) override; // TODO: str std::tuple, Tox_Err_Group_Send_Message> toxGroupSendMessage(uint32_t group_number, Tox_Message_Type type, std::string_view message) override; Tox_Err_Group_Send_Private_Message toxGroupSendPrivateMessage(uint32_t group_number, uint32_t peer_id, Tox_Message_Type type, std::string_view message) override; Tox_Err_Group_Send_Custom_Packet toxGroupSendCustomPacket(uint32_t group_number, bool lossless, const std::vector& data) override; Tox_Err_Group_Send_Custom_Private_Packet toxGroupSendCustomPrivatePacket(uint32_t group_number, uint32_t peer_id, bool lossless, const std::vector& data) override; Tox_Err_Group_Invite_Friend toxGroupInviteFriend(uint32_t group_number, uint32_t friend_number) override; std::tuple, Tox_Err_Group_Invite_Accept> toxGroupInviteAccept(uint32_t friend_number, const std::vector& invite_data, std::string_view name, std::string_view password) override; };