|
RunicVTT Open Source Virtual Tabletop for TTRPG using P2P
|
#include <PeerLink.h>
Public Member Functions | |
| PeerLink (const std::string &id, std::weak_ptr< NetworkManager > parent) | |
| PeerLink () | |
| void | close () |
| void | createChannels () |
| void | createDataChannel (const std::string &label) |
| rtc::Description | createOffer () |
| rtc::Description | createAnswer () |
| void | setRemoteDescription (const rtc::Description &desc) |
| void | addIceCandidate (const rtc::Candidate &candidate) |
| void | send (const std::string &msg) |
| bool | sendOn (const std::string &label, const std::vector< uint8_t > &bytes) |
| bool | sendOn (const std::string &label, std::string_view text) |
| bool | sendGame (const std::vector< uint8_t > &bytes) |
| bool | sendChat (const std::vector< uint8_t > &bytes) |
| bool | sendNote (const std::vector< uint8_t > &bytes) |
| bool | sendMarkerMove (const std::vector< uint8_t > &bytes) |
| void | sendChatJson (const std::string &jsonText) |
| void | setDisplayName (std::string n) |
| const std::string & | displayName () const |
| void | attachChannelHandlers (const std::shared_ptr< rtc::DataChannel > &ch, const std::string &label) |
| void | attachMarkerMoveChannelHandlers (const std::shared_ptr< rtc::DataChannel > &ch, const std::string &label) |
| bool | isDataChannelOpen () const |
| rtc::PeerConnection::State | pcState () const |
| const char * | pcStateString () const |
| bool | isClosedOrFailed () const |
| const char * | pcStateToStr (rtc::PeerConnection::State s) |
| bool | isConnected () const |
| bool | isPcConnectedOnly () const |
| void | setOpen (std::string label, bool open) |
| bool | allRequiredOpen () const |
| bool | bootstrapSent () const |
| void | markBootstrapSent () |
| void | markBootstrapReset () |
| std::shared_ptr< rtc::PeerConnection > | getPeerConnection () |
Private Member Functions | |
| void | setupCallbacks () |
Private Attributes | |
| std::string | peerId |
| std::string | displayName_ |
| std::shared_ptr< rtc::PeerConnection > | pc |
| std::unordered_map< std::string, std::shared_ptr< rtc::DataChannel > > | dcs_ |
| std::atomic< bool > | closing_ {false} |
| std::weak_ptr< NetworkManager > | network_manager |
| std::atomic< rtc::PeerConnection::State > | lastState_ {rtc::PeerConnection::State::New} |
| std::atomic< double > | lastStateAt_ {0.0} |
| std::atomic< bool > | remoteDescSet_ {false} |
| std::vector< rtc::Candidate > | pendingRemoteCandidates_ |
| std::mutex | candMx_ |
| bool | bootstrapSent_ = false |
| std::unordered_map< std::string, bool > | dcOpen_ |
Definition at line 8 of file PeerLink.h.
| PeerLink::PeerLink | ( | const std::string & | id, |
| std::weak_ptr< NetworkManager > | parent ) |
Definition at line 7 of file PeerLink.cpp.
| PeerLink::PeerLink | ( | ) |
| void PeerLink::addIceCandidate | ( | const rtc::Candidate & | candidate | ) |
Definition at line 115 of file PeerLink.cpp.
| bool PeerLink::allRequiredOpen | ( | ) | const |
Definition at line 235 of file PeerLink.cpp.
| void PeerLink::attachChannelHandlers | ( | const std::shared_ptr< rtc::DataChannel > & | ch, |
| const std::string & | label ) |
Definition at line 242 of file PeerLink.cpp.
| void PeerLink::attachMarkerMoveChannelHandlers | ( | const std::shared_ptr< rtc::DataChannel > & | ch, |
| const std::string & | label ) |
|
inline |
Definition at line 62 of file PeerLink.h.
| void PeerLink::close | ( | ) |
Definition at line 342 of file PeerLink.cpp.
| rtc::Description PeerLink::createAnswer | ( | ) |
Definition at line 91 of file PeerLink.cpp.
| void PeerLink::createChannels | ( | ) |
Definition at line 50 of file PeerLink.cpp.
| void PeerLink::createDataChannel | ( | const std::string & | label | ) |
| rtc::Description PeerLink::createOffer | ( | ) |
Definition at line 81 of file PeerLink.cpp.
| const std::string & PeerLink::displayName | ( | ) | const |
Definition at line 31 of file PeerLink.cpp.
|
inline |
Definition at line 75 of file PeerLink.h.
| bool PeerLink::isClosedOrFailed | ( | ) | const |
Definition at line 402 of file PeerLink.cpp.
| bool PeerLink::isConnected | ( | ) | const |
Definition at line 288 of file PeerLink.cpp.
| bool PeerLink::isDataChannelOpen | ( | ) | const |
Definition at line 295 of file PeerLink.cpp.
| bool PeerLink::isPcConnectedOnly | ( | ) | const |
|
inline |
Definition at line 70 of file PeerLink.h.
|
inline |
Definition at line 66 of file PeerLink.h.
| rtc::PeerConnection::State PeerLink::pcState | ( | ) | const |
| const char * PeerLink::pcStateString | ( | ) | const |
Definition at line 411 of file PeerLink.cpp.
| const char * PeerLink::pcStateToStr | ( | rtc::PeerConnection::State | s | ) |
| void PeerLink::send | ( | const std::string & | msg | ) |
| bool PeerLink::sendChat | ( | const std::vector< uint8_t > & | bytes | ) |
Definition at line 216 of file PeerLink.cpp.
| void PeerLink::sendChatJson | ( | const std::string & | jsonText | ) |
| bool PeerLink::sendGame | ( | const std::vector< uint8_t > & | bytes | ) |
| bool PeerLink::sendMarkerMove | ( | const std::vector< uint8_t > & | bytes | ) |
| bool PeerLink::sendNote | ( | const std::vector< uint8_t > & | bytes | ) |
| bool PeerLink::sendOn | ( | const std::string & | label, |
| const std::vector< uint8_t > & | bytes ) |
Definition at line 187 of file PeerLink.cpp.
| bool PeerLink::sendOn | ( | const std::string & | label, |
| std::string_view | text ) |
Definition at line 171 of file PeerLink.cpp.
| void PeerLink::setDisplayName | ( | std::string | n | ) |
Definition at line 26 of file PeerLink.cpp.
|
inline |
Definition at line 56 of file PeerLink.h.
| void PeerLink::setRemoteDescription | ( | const rtc::Description & | desc | ) |
Definition at line 101 of file PeerLink.cpp.
|
private |
Definition at line 128 of file PeerLink.cpp.
|
private |
Definition at line 96 of file PeerLink.h.
|
private |
Definition at line 94 of file PeerLink.h.
|
private |
Definition at line 86 of file PeerLink.h.
|
private |
Definition at line 97 of file PeerLink.h.
|
private |
Definition at line 85 of file PeerLink.h.
|
private |
Definition at line 82 of file PeerLink.h.
|
private |
Definition at line 89 of file PeerLink.h.
|
private |
Definition at line 90 of file PeerLink.h.
|
private |
Definition at line 87 of file PeerLink.h.
|
private |
Definition at line 83 of file PeerLink.h.
|
private |
Definition at line 81 of file PeerLink.h.
|
private |
Definition at line 93 of file PeerLink.h.
|
private |
Definition at line 92 of file PeerLink.h.