ICE-lite Manager for NAT traversal. More...
#include <ice.h>
Public Member Functions | |
| IceManager () | |
| IceManager (const IceConfig &config) | |
| ~IceManager () | |
| IceManager (const IceManager &)=delete | |
| IceManager & | operator= (const IceManager &)=delete |
| void | set_config (const IceConfig &config) |
| Set ICE configuration. | |
| const IceConfig & | config () const |
| Get current configuration. | |
| void | add_stun_server (const std::string &host, uint16_t port=STUN_DEFAULT_PORT) |
| Add a STUN server. | |
| void | add_turn_server (const std::string &host, uint16_t port, const std::string &username, const std::string &password) |
| Add a TURN server with credentials. | |
| void | clear_ice_servers () |
| Clear all ICE servers. | |
| bool | gather_candidates () |
| Start gathering ICE candidates. | |
| std::vector< IceCandidate > | get_local_candidates () const |
| Get local candidates. | |
| IceGatheringState | get_gathering_state () const |
| Get gathering state. | |
| bool | is_gathering_complete () const |
| Check if gathering is complete. | |
| void | add_remote_candidate (const IceCandidate &candidate) |
| Add a remote candidate. | |
| void | add_remote_candidates_from_sdp (const std::vector< std::string > &sdp_lines) |
| Add remote candidates from SDP. | |
| std::vector< IceCandidate > | get_remote_candidates () const |
| Get remote candidates. | |
| void | end_of_remote_candidates () |
| Signal end of remote candidates (for trickle ICE) | |
| void | start_checks () |
| Start connectivity checks. | |
| void | stop_checks () |
| Stop connectivity checks. | |
| std::vector< IceCandidatePair > | get_candidate_pairs () const |
| Get candidate pairs. | |
| std::optional< IceCandidatePair > | get_selected_pair () const |
| Get the selected (best) candidate pair. | |
| IceConnectionState | get_connection_state () const |
| Get connection state. | |
| bool | is_connected () const |
| Check if connected. | |
| std::optional< std::pair< std::string, uint16_t > > | get_public_address () const |
| Get our public address (from server-reflexive candidate) | |
| socket_t | get_socket () const |
| Get the UDP socket used for ICE Can be used for data transfer after ICE completes. | |
| uint16_t | get_local_port () const |
| Get local port. | |
| void | set_on_candidates_gathered (IceCandidatesCallback callback) |
| void | set_on_new_candidate (IceNewCandidateCallback callback) |
| void | set_on_gathering_state_changed (IceGatheringStateCallback callback) |
| void | set_on_connection_state_changed (IceConnectionStateCallback callback) |
| void | set_on_selected_pair (IceSelectedPairCallback callback) |
| void | close () |
| Close ICE manager and release resources. | |
| void | restart () |
| Restart ICE (gather new candidates and start checks) | |
ICE-lite Manager for NAT traversal.
Provides:
Example usage:
| librats::IceManager::IceManager | ( | ) |
|
explicit |
| librats::IceManager::~IceManager | ( | ) |
|
delete |
| void librats::IceManager::add_remote_candidate | ( | const IceCandidate & | candidate | ) |
Add a remote candidate.
| candidate | Remote candidate to add |
| void librats::IceManager::add_remote_candidates_from_sdp | ( | const std::vector< std::string > & | sdp_lines | ) |
Add remote candidates from SDP.
| sdp_lines | SDP attribute lines (a=candidate:...) |
| void librats::IceManager::add_stun_server | ( | const std::string & | host, |
| uint16_t | port = STUN_DEFAULT_PORT |
||
| ) |
Add a STUN server.
| void librats::IceManager::add_turn_server | ( | const std::string & | host, |
| uint16_t | port, | ||
| const std::string & | username, | ||
| const std::string & | password | ||
| ) |
Add a TURN server with credentials.
| void librats::IceManager::clear_ice_servers | ( | ) |
Clear all ICE servers.
| void librats::IceManager::close | ( | ) |
Close ICE manager and release resources.
|
inline |
| void librats::IceManager::end_of_remote_candidates | ( | ) |
Signal end of remote candidates (for trickle ICE)
| bool librats::IceManager::gather_candidates | ( | ) |
Start gathering ICE candidates.
| std::vector< IceCandidatePair > librats::IceManager::get_candidate_pairs | ( | ) | const |
Get candidate pairs.
|
inline |
|
inline |
| std::vector< IceCandidate > librats::IceManager::get_local_candidates | ( | ) | const |
Get local candidates.
|
inline |
| std::optional< std::pair< std::string, uint16_t > > librats::IceManager::get_public_address | ( | ) | const |
Get our public address (from server-reflexive candidate)
| std::vector< IceCandidate > librats::IceManager::get_remote_candidates | ( | ) | const |
Get remote candidates.
| std::optional< IceCandidatePair > librats::IceManager::get_selected_pair | ( | ) | const |
Get the selected (best) candidate pair.
|
inline |
|
inline |
Check if connected.
Definition at line 450 of file ice.h.
References librats::Completed, and librats::Connected.
|
inline |
|
delete |
| void librats::IceManager::restart | ( | ) |
Restart ICE (gather new candidates and start checks)
| void librats::IceManager::set_config | ( | const IceConfig & | config | ) |
Set ICE configuration.
| void librats::IceManager::set_on_candidates_gathered | ( | IceCandidatesCallback | callback | ) |
| void librats::IceManager::set_on_connection_state_changed | ( | IceConnectionStateCallback | callback | ) |
| void librats::IceManager::set_on_gathering_state_changed | ( | IceGatheringStateCallback | callback | ) |
| void librats::IceManager::set_on_new_candidate | ( | IceNewCandidateCallback | callback | ) |
| void librats::IceManager::set_on_selected_pair | ( | IceSelectedPairCallback | callback | ) |
| void librats::IceManager::start_checks | ( | ) |
Start connectivity checks.
| void librats::IceManager::stop_checks | ( | ) |
Stop connectivity checks.