libivon 0.1.0
Voice-over-IP library
Loading...
Searching...
No Matches
ivon_types.hpp File Reference
#include <array>
#include <cstdint>
#include <functional>
#include <optional>
#include <span>
#include <string>
#include <type_traits>
#include <unordered_map>
#include <utility>
#include <vector>

Classes

class  ivon::NegotiationError
 Composite error type for key negotiation failures. More...
 
class  ivon::expected_void< E >
 Lightweight C++20-compatible replacement for std::expected<void, E>. More...
 
struct  ivon::GroupInfo
 Information about a group available on the server. More...
 
struct  ivon::GroupJoinResult
 Result of a group join operation. More...
 
struct  ivon::GroupLeaveResult
 Result of a group leave operation. More...
 
struct  ivon::GroupMuteResult
 Result of a mute operation. More...
 
struct  ivon::AudioOutputFrame
 Structured output frame info returned by audio read operations. More...
 

Namespaces

namespace  ivon
 Public C++ type definitions shared across libivon interfaces and consumer-side wrappers.
 

Typedefs

using ivon::TofuVerifyCallback = std::function< bool(const std::string &server_id, TofuVerifyResult result, const std::array< uint8_t, PUBLIC_KEY_SIZE > &server_public_key, const std::optional< std::array< uint8_t, PUBLIC_KEY_SIZE > > &stored_key)>
 Called when a new or changed server key is encountered (TOFU).
 
using ivon::PasswordCallback = std::function< std::optional< std::string >(uint32_t remaining_attempts)>
 Called when the server requires password authentication.
 
using ivon::ConnectionStateCallback = std::function< void(ConnectionState new_state)>
 Called when the connection lifecycle state changes.
 
using ivon::ClientMessageCallback = std::function< void(const std::string &sender_id, const std::string &data_type, std::span< const uint8_t > data)>
 Called when a direct or broadcast message arrives from another client.
 
using ivon::ClientJoinedCallback = std::function< void(const std::string &client_id)>
 Called when a remote client joins the server session.
 
using ivon::ClientLeftCallback = std::function< void(const std::string &client_id, bool was_kicked)>
 Called when a remote client leaves the server session.
 
using ivon::KickedCallback = std::function< void(const std::string &reason)>
 Called when THIS client is kicked from the server.
 
using ivon::DisconnectedCallback = std::function< void(const std::string &reason)>
 Called when the connection to the server is lost or closed.
 
using ivon::GroupJoinCallback = std::function< void(const GroupJoinResult &result)>
 Called when a join_group() request completes.
 
using ivon::GroupLeaveCallback = std::function< void(const GroupLeaveResult &result)>
 Called when a leave_group() request completes.
 
using ivon::GroupKeyUpdateCallback = std::function< void(const std::string &group_id, uint64_t new_epoch)>
 Called when a group's encryption key is rotated.
 
using ivon::GroupMemberJoinedCallback = std::function< void(const std::string &group_id, const std::string &client_id, uint64_t fanout_sender_id)>
 Called when another client joins a group we are a member of.
 
using ivon::GroupMemberLeftCallback = std::function< void(const std::string &group_id, const std::string &client_id, uint64_t fanout_sender_id, bool was_kicked)>
 Called when another client leaves a group we are a member of.
 
using ivon::GroupKickedCallback = std::function< void(const std::string &group_id, const std::string &reason)>
 Called when THIS client is kicked from a group by the server.
 
using ivon::GroupListCallback = std::function< void(const std::vector< GroupInfo > &groups)>
 Called when the server responds to a request_group_list() call.
 
using ivon::GroupMuteCallback = std::function< void(const GroupMuteResult &result)>
 Called when a set_mute() request completes.
 
using ivon::FanoutDataCallback = std::function< void(const std::string &group_id, uint64_t sender_id, uint64_t seq, const unsigned char *data, size_t len)>
 Called when decrypted fanout data arrives from a group member.
 
using ivon::FanoutErrorCallback = std::function< void(const std::string &group_id, const std::string &error_message)>
 Called when a fanout client encounters a fatal error.
 
using ivon::PcmSourceCallback = std::function< bool(std::span< float > pcm_out)>
 Callback type for pulling PCM audio during transmission.
 
using ivon::ServerPropertiesCallback = std::function< void(const std::unordered_map< std::string, std::vector< uint8_t > > &properties)>
 Called when all server-level properties are received during sync.
 
using ivon::ServerPropertyUpdateCallback = std::function< void(const std::string &key, const std::vector< uint8_t > &value)>
 Called when a single server-level property changes.
 
using ivon::GroupPropertyUpdateCallback = std::function< void(const std::string &group_id, const std::string &key, const std::vector< uint8_t > &value)>
 Called when a single group-level property changes.
 

Enumerations

enum class  ivon::ConnectionState : uint8_t {
  ivon::disconnected = 0 , ivon::connecting = 1 , ivon::negotiating = 2 , ivon::synchronizing = 3 ,
  ivon::connected = 4 , ivon::disconnecting = 5
}
 Lifecycle states of a Client connection. More...
 
enum class  ivon::ConnectionErrorCode : uint8_t {
  ivon::success = 0 , ivon::connection_closed = 1 , ivon::connection_timeout = 2 , ivon::connection_reset = 3 ,
  ivon::network_error = 4 , ivon::connection_canceled = 5 , ivon::invalid_message_format = 20 , ivon::unexpected_message = 21 ,
  ivon::message_too_large = 22 , ivon::message_too_small = 23 , ivon::encryption_failed = 40 , ivon::decryption_failed = 41 ,
  ivon::signature_invalid = 42 , ivon::mac_verification_failed = 43 , ivon::internal_error = 60 , ivon::out_of_memory = 61 ,
  ivon::state_error = 62 , ivon::unknown = 255
}
 Error codes for general connection/communication failures. More...
 
enum class  ivon::NegotiationErrorCode : uint8_t {
  ivon::success = 0 , ivon::protocol_version_mismatch = 1 , ivon::invalid_public_key = 20 , ivon::key_generation_failed = 21 ,
  ivon::key_derivation_failed = 22 , ivon::invalid_key_size = 23 , ivon::nonce_reuse_detected = 24 , ivon::authentication_failed = 40 ,
  ivon::unknown_peer = 41 , ivon::peer_rejected = 42 , ivon::certificate_expired = 43 , ivon::certificate_revoked = 44 ,
  ivon::client_id_rejected = 50 , ivon::client_not_approved = 51 , ivon::unknown = 255
}
 Error codes specific to the key negotiation/handshake phase. More...
 
enum class  ivon::TofuVerifyResult { ivon::trusted , ivon::new_key , ivon::key_changed , ivon::verification_error }
 Result of TOFU (Trust-On-First-Use) key verification. More...
 
enum class  ivon::GroupOperationStatus : uint8_t {
  ivon::Success , ivon::GroupNotFound , ivon::GroupFull , ivon::PermissionDenied ,
  ivon::AlreadyMember , ivon::NotMember , ivon::InvalidGroupId , ivon::ConnectionError ,
  ivon::InternalError , ivon::Kicked
}
 Status codes for group operations. More...
 

Functions

constexpr const char * ivon::connection_error_message (ConnectionErrorCode code) noexcept
 Get a human-readable description of a connection error code.
 
constexpr const char * ivon::negotiation_error_message (NegotiationErrorCode code) noexcept
 Get a human-readable description of a negotiation error code.
 

Variables

constexpr size_t ivon::PUBLIC_KEY_SIZE = 32
 Size of a public key in bytes.