libivon 0.1.0
Voice-over-IP library
Loading...
Searching...
No Matches
ivon::IServer Class Referenceabstract

Pure virtual interface for the libivon server. More...

#include <ivon_server_interface.hpp>

Inheritance diagram for ivon::IServer:
ivon::ServerWrapper

Public Types

using ConnectionAdmissionCallback = std::function< bool(const std::string &remote_ip, uint16_t remote_port)>
 Gate: accept/reject raw TCP connections by IP and port.
 
using ClientIdCheckCallback = std::function< bool(const std::string &client_id)>
 Gate: validate a client's self-declared ID.
 
using PasswordValidateCallback = std::function< bool(const std::string &client_id, const std::string &password)>
 Gate: custom password validation (replaces built-in == check).
 
using ClientApproveCallback = std::function< bool(const std::string &client_id, const std::string &remote_ip)>
 Gate: final approval before a client becomes visible to peers.
 
using ClientConnectedCallback = std::function< void(const std::string &client_id, uint64_t session_id)>
 Event: fired when a client is registered and visible.
 
using ClientDisconnectedCallback = std::function< void(const std::string &client_id, uint64_t session_id, bool graceful)>
 Event: fired when a client is removed from the session.
 
using GroupJoinAuthorizeCallback = std::function< bool(const std::string &client_id, const std::string &group_id)>
 Gate: authorize a group join request.
 

Public Member Functions

virtual ~IServer ()=default
 
virtual void run ()=0
 Run the server (blocks until stop() is called from another thread).
 
virtual void stop ()=0
 Stop the server (thread-safe, causes run() to return).
 
virtual bool create_group (const std::string &group_id)=0
 Create a new group at runtime. Returns false if it already exists.
 
virtual void delete_group (const std::string &group_id, std::function< void(bool)> callback)=0
 Delete a group (asynchronous). Optional completion callback.
 
virtual bool has_group (const std::string &group_id) const =0
 Check if a group exists.
 
virtual std::vector< std::string > group_ids () const =0
 Get all group IDs as a vector.
 
virtual std::optional< uint32_t > rotate_group_key (const std::string &group_id)=0
 Rotate the encryption key for a group.
 
virtual void kick_client (const std::string &client_id, const std::string &reason)=0
 Kick a client from the server entirely.
 
virtual void kick_client_from_group (const std::string &group_id, const std::string &client_id, const std::string &reason, std::function< void(bool)> callback)=0
 Kick a client from a specific group (asynchronous). Optional completion callback.
 
virtual void send_message_to_client (const std::string &client_id, const std::string &data_type, const uint8_t *data, size_t data_len)=0
 Send a message from the server to a specific client.
 
virtual void send_message_to_group (const std::string &group_id, const std::string &data_type, const uint8_t *data, size_t data_len)=0
 Send a message from the server to all members of a group.
 
virtual void send_message_to_all (const std::string &data_type, const uint8_t *data, size_t data_len)=0
 Broadcast a message from the server to all connected clients.
 
virtual void set_property (const std::string &key, const uint8_t *value, size_t value_len)=0
 Set a server-level property (pushed to all connected clients).
 
virtual void set_group_property (const std::string &group_id, const std::string &key, const uint8_t *value, size_t value_len)=0
 Set a group-level property (pushed to all group members).
 
virtual void on_connection_admission (ConnectionAdmissionCallback cb)=0
 Set the connection admission gate callback.
 
virtual void on_client_id_check (ClientIdCheckCallback cb)=0
 Set the client ID validation callback.
 
virtual void on_password_validate (PasswordValidateCallback cb)=0
 Set the password validation callback.
 
virtual void on_client_approve (ClientApproveCallback cb)=0
 Set the client approval callback.
 
virtual void on_client_connected (ClientConnectedCallback cb)=0
 Set the client connected event callback.
 
virtual void on_client_disconnected (ClientDisconnectedCallback cb)=0
 Set the client disconnected event callback.
 
virtual void on_group_join_authorize (GroupJoinAuthorizeCallback cb)=0
 Set the group join authorization callback.
 

Detailed Description

Pure virtual interface for the libivon server.

Every method here must have a corresponding C ABI function in ivon_server.h and a wrapper in ivon_server_wrapper.hpp. Adding a new pure virtual here will cause a compile error in any class that inherits IServer but hasn't implemented the new method, ensuring the C ABI stays synchronized with the C++ API.

Member Typedef Documentation

◆ ClientApproveCallback

using ivon::IServer::ClientApproveCallback = std::function<bool(const std::string &client_id, const std::string &remote_ip)>

Gate: final approval before a client becomes visible to peers.

◆ ClientConnectedCallback

using ivon::IServer::ClientConnectedCallback = std::function<void(const std::string &client_id, uint64_t session_id)>

Event: fired when a client is registered and visible.

◆ ClientDisconnectedCallback

using ivon::IServer::ClientDisconnectedCallback = std::function<void(const std::string &client_id, uint64_t session_id, bool graceful)>

Event: fired when a client is removed from the session.

◆ ClientIdCheckCallback

using ivon::IServer::ClientIdCheckCallback = std::function<bool(const std::string &client_id)>

Gate: validate a client's self-declared ID.

◆ ConnectionAdmissionCallback

using ivon::IServer::ConnectionAdmissionCallback = std::function<bool(const std::string &remote_ip, uint16_t remote_port)>

Gate: accept/reject raw TCP connections by IP and port.

◆ GroupJoinAuthorizeCallback

using ivon::IServer::GroupJoinAuthorizeCallback = std::function<bool(const std::string &client_id, const std::string &group_id)>

Gate: authorize a group join request.

◆ PasswordValidateCallback

using ivon::IServer::PasswordValidateCallback = std::function<bool(const std::string &client_id, const std::string &password)>

Gate: custom password validation (replaces built-in == check).

Constructor & Destructor Documentation

◆ ~IServer()

virtual ivon::IServer::~IServer ( )
virtualdefault

Member Function Documentation

◆ create_group()

virtual bool ivon::IServer::create_group ( const std::string &  group_id)
pure virtual

Create a new group at runtime. Returns false if it already exists.

Implemented in ivon::ServerWrapper.

◆ delete_group()

virtual void ivon::IServer::delete_group ( const std::string &  group_id,
std::function< void(bool)>  callback 
)
pure virtual

Delete a group (asynchronous). Optional completion callback.

Implemented in ivon::ServerWrapper.

◆ group_ids()

virtual std::vector< std::string > ivon::IServer::group_ids ( ) const
pure virtual

Get all group IDs as a vector.

Implemented in ivon::ServerWrapper.

◆ has_group()

virtual bool ivon::IServer::has_group ( const std::string &  group_id) const
pure virtual

Check if a group exists.

Implemented in ivon::ServerWrapper.

◆ kick_client()

virtual void ivon::IServer::kick_client ( const std::string &  client_id,
const std::string &  reason 
)
pure virtual

Kick a client from the server entirely.

Implemented in ivon::ServerWrapper.

◆ kick_client_from_group()

virtual void ivon::IServer::kick_client_from_group ( const std::string &  group_id,
const std::string &  client_id,
const std::string &  reason,
std::function< void(bool)>  callback 
)
pure virtual

Kick a client from a specific group (asynchronous). Optional completion callback.

Implemented in ivon::ServerWrapper.

◆ on_client_approve()

virtual void ivon::IServer::on_client_approve ( ClientApproveCallback  cb)
pure virtual

Set the client approval callback.

See also
ClientApproveCallback

Implemented in ivon::ServerWrapper.

◆ on_client_connected()

virtual void ivon::IServer::on_client_connected ( ClientConnectedCallback  cb)
pure virtual

Set the client connected event callback.

See also
ClientConnectedCallback

Implemented in ivon::ServerWrapper.

◆ on_client_disconnected()

virtual void ivon::IServer::on_client_disconnected ( ClientDisconnectedCallback  cb)
pure virtual

Set the client disconnected event callback.

See also
ClientDisconnectedCallback

Implemented in ivon::ServerWrapper.

◆ on_client_id_check()

virtual void ivon::IServer::on_client_id_check ( ClientIdCheckCallback  cb)
pure virtual

Set the client ID validation callback.

See also
ClientIdCheckCallback

Implemented in ivon::ServerWrapper.

◆ on_connection_admission()

virtual void ivon::IServer::on_connection_admission ( ConnectionAdmissionCallback  cb)
pure virtual

Set the connection admission gate callback.

See also
ConnectionAdmissionCallback

Implemented in ivon::ServerWrapper.

◆ on_group_join_authorize()

virtual void ivon::IServer::on_group_join_authorize ( GroupJoinAuthorizeCallback  cb)
pure virtual

Set the group join authorization callback.

See also
GroupJoinAuthorizeCallback

Implemented in ivon::ServerWrapper.

◆ on_password_validate()

virtual void ivon::IServer::on_password_validate ( PasswordValidateCallback  cb)
pure virtual

Set the password validation callback.

See also
PasswordValidateCallback

Implemented in ivon::ServerWrapper.

◆ rotate_group_key()

virtual std::optional< uint32_t > ivon::IServer::rotate_group_key ( const std::string &  group_id)
pure virtual

Rotate the encryption key for a group.

Returns
New epoch, or nullopt on failure.

Implemented in ivon::ServerWrapper.

◆ run()

virtual void ivon::IServer::run ( )
pure virtual

Run the server (blocks until stop() is called from another thread).

Implemented in ivon::ServerWrapper.

◆ send_message_to_all()

virtual void ivon::IServer::send_message_to_all ( const std::string &  data_type,
const uint8_t *  data,
size_t  data_len 
)
pure virtual

Broadcast a message from the server to all connected clients.

Implemented in ivon::ServerWrapper.

◆ send_message_to_client()

virtual void ivon::IServer::send_message_to_client ( const std::string &  client_id,
const std::string &  data_type,
const uint8_t *  data,
size_t  data_len 
)
pure virtual

Send a message from the server to a specific client.

Implemented in ivon::ServerWrapper.

◆ send_message_to_group()

virtual void ivon::IServer::send_message_to_group ( const std::string &  group_id,
const std::string &  data_type,
const uint8_t *  data,
size_t  data_len 
)
pure virtual

Send a message from the server to all members of a group.

Implemented in ivon::ServerWrapper.

◆ set_group_property()

virtual void ivon::IServer::set_group_property ( const std::string &  group_id,
const std::string &  key,
const uint8_t *  value,
size_t  value_len 
)
pure virtual

Set a group-level property (pushed to all group members).

Implemented in ivon::ServerWrapper.

◆ set_property()

virtual void ivon::IServer::set_property ( const std::string &  key,
const uint8_t *  value,
size_t  value_len 
)
pure virtual

Set a server-level property (pushed to all connected clients).

Implemented in ivon::ServerWrapper.

◆ stop()

virtual void ivon::IServer::stop ( )
pure virtual

Stop the server (thread-safe, causes run() to return).

Implemented in ivon::ServerWrapper.


The documentation for this class was generated from the following file: