diff --git a/src/bridge/network/PeerNetwork.cpp b/src/bridge/network/PeerNetwork.cpp index 74595b9b..9d31b36f 100644 --- a/src/bridge/network/PeerNetwork.cpp +++ b/src/bridge/network/PeerNetwork.cpp @@ -189,7 +189,10 @@ bool PeerNetwork::writeConfig() rcon["port"].set(m_metadata->restApiPort); // REST API Port config["rcon"].set(rcon); - config["software"].set(std::string(software)); // Software ID + uint32_t peerClass = PEER_CONN_CLASS::PEER_CONN_CLASS_STANDARD; + config["peerClass"].set(peerClass); // Peer Connection Class + + config["software"].set(std::string(software)); // Software ID json::value v = json::value(config); std::string json = v.serialize(); diff --git a/src/common/network/BaseNetwork.h b/src/common/network/BaseNetwork.h index 6c54fd69..e6538f00 100644 --- a/src/common/network/BaseNetwork.h +++ b/src/common/network/BaseNetwork.h @@ -154,6 +154,26 @@ namespace network NET_CTRL_U2U = 0x01U, //!< Unit-to-Unit }; + /** + * @brief Peer Connection Class Enumerations + * @note These values define which connection class a peer connection belongs to. This is used for determining how + * to handle traffic from the peer. + * @ingroup network_core + */ + enum PEER_CONN_CLASS { + PEER_CONN_CLASS_UNKNOWN, //!< Unknown + + PEER_CONN_CLASS_NEIGHBOR, //!< Neighbor FNE Peer + + PEER_CONN_CLASS_STANDARD, //!< Standard Peer + + PEER_CONN_CLASS_SYSVIEW, //!< SysView Peer + PEER_CONN_CLASS_CONSOLE, //!< Console Peer + + // this should always be last + PEER_CONN_CLASS_INVALID + }; + /** * @brief RTP Stream Multiplex Validation Return Codes * @ingroup network_core diff --git a/src/common/network/Network.cpp b/src/common/network/Network.cpp index b5327148..b14dafc1 100644 --- a/src/common/network/Network.cpp +++ b/src/common/network/Network.cpp @@ -1531,6 +1531,9 @@ bool Network::writeConfig() rcon["port"].set(m_metadata->restApiPort); // REST API Port config["rcon"].set(rcon); + uint32_t peerClass = PEER_CONN_CLASS::PEER_CONN_CLASS_STANDARD; + config["peerClass"].set(peerClass); // Peer Connection Class + // Flags config["conventionalPeer"].set(m_metadata->isConventional); // Conventional Peer Marker diff --git a/src/fne/network/FNEPeerConnection.h b/src/fne/network/FNEPeerConnection.h index 50d1477a..602a1cfd 100644 --- a/src/fne/network/FNEPeerConnection.h +++ b/src/fne/network/FNEPeerConnection.h @@ -59,10 +59,9 @@ namespace network m_lastPing(0U), m_missedMetadataUpdates(0U), m_hasCallPriority(false), - m_isNeighborFNEPeer(false), + m_peerClass(PEER_CONN_CLASS_UNKNOWN), m_isReplica(false), - m_isConventionalPeer(false), - m_isSysView(false), + m_isConventional(false), m_config(), m_peerLockMtx(), m_jitterBuffers(), @@ -95,10 +94,9 @@ namespace network m_lastPing(0U), m_missedMetadataUpdates(0U), m_hasCallPriority(false), - m_isNeighborFNEPeer(false), + m_peerClass(PEER_CONN_CLASS_UNKNOWN), m_isReplica(false), - m_isConventionalPeer(false), - m_isSysView(false), + m_isConventional(false), m_config(), m_peerLockMtx(), m_jitterBuffers(), @@ -119,11 +117,13 @@ namespace network */ std::string identWithQualifier() const { - if (isSysView()) + if (m_peerClass == PEER_CONN_CLASS_CONSOLE) + return "!" + identity(); + if (m_peerClass == PEER_CONN_CLASS_SYSVIEW) return "@" + identity(); if (isReplica()) return "%" + identity(); - if (isNeighborFNEPeer()) + if (m_peerClass == PEER_CONN_CLASS_NEIGHBOR) return "+" + identity(); return " " + m_identity; @@ -245,22 +245,17 @@ namespace network DECLARE_PROPERTY_PLAIN(bool, hasCallPriority); /** - * @brief Flag indicating this connection is from an downstream neighbor FNE peer. + * @brief Peer class for this connection. */ - DECLARE_PROPERTY_PLAIN(bool, isNeighborFNEPeer); + DECLARE_PROPERTY_PLAIN(PEER_CONN_CLASS, peerClass); /** * @brief Flag indicating this connection is from a neighbor FNE peer that is replica enabled. */ DECLARE_PROPERTY_PLAIN(bool, isReplica); - /** * @brief Flag indicating this connection is from an conventional peer. */ - DECLARE_PROPERTY_PLAIN(bool, isConventionalPeer); - /** - * @brief Flag indicating this connection is from an SysView peer. - */ - DECLARE_PROPERTY_PLAIN(bool, isSysView); + DECLARE_PROPERTY_PLAIN(bool, isConventional); /** * @brief JSON objecting containing peer configuration information. diff --git a/src/fne/network/MetadataNetwork.cpp b/src/fne/network/MetadataNetwork.cpp index 3b71ad7a..560faaeb 100644 --- a/src/fne/network/MetadataNetwork.cpp +++ b/src/fne/network/MetadataNetwork.cpp @@ -210,7 +210,7 @@ void MetadataNetwork::taskNetworkRx(NetPacketRequest* req) if (network->m_peers.find(req->rtpHeader.getSSRC()) != network->m_peers.end()) { FNEPeerConnection* connection = network->m_peers[req->rtpHeader.getSSRC()]; if (connection != nullptr) { - if (connection->isNeighborFNEPeer() && connection->isReplica()) { + if (connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR && connection->isReplica()) { validPeerId = true; pktPeerId = req->rtpHeader.getSSRC(); } @@ -252,7 +252,7 @@ void MetadataNetwork::taskNetworkRx(NetPacketRequest* req) if (network->m_peers.size() > 0U) { for (auto peer : network->m_peers) { if (peer.second != nullptr) { - if (peer.second->isSysView()) { + if (peer.second->peerClass() == PEER_CONN_CLASS_SYSVIEW) { sockaddr_storage addr = peer.second->socketStorage(); uint32_t addrLen = peer.second->sockStorageLen(); @@ -338,7 +338,7 @@ void MetadataNetwork::taskNetworkRx(NetPacketRequest* req) // attempt to repeat status traffic to SysView clients for (auto peer : network->m_peers) { if (peer.second != nullptr) { - if (peer.second->isSysView()) { + if (peer.second->peerClass() == PEER_CONN_CLASS_SYSVIEW) { sockaddr_storage addr = peer.second->socketStorage(); uint32_t addrLen = peer.second->sockStorageLen(); @@ -391,7 +391,7 @@ void MetadataNetwork::taskNetworkRx(NetPacketRequest* req) std::string ip = udp::Socket::address(req->address); // validate peer (simple validation really) - if (connection->connected() && connection->address() == ip && connection->isNeighborFNEPeer() && + if (connection->connected() && connection->address() == ip && connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR && connection->isReplica()) { DECLARE_UINT8_ARRAY(rawPayload, req->length); ::memcpy(rawPayload, req->buffer, req->length); @@ -496,7 +496,7 @@ void MetadataNetwork::taskNetworkRx(NetPacketRequest* req) std::string ip = udp::Socket::address(req->address); // validate peer (simple validation really) - if (connection->connected() && connection->address() == ip && connection->isNeighborFNEPeer() && + if (connection->connected() && connection->address() == ip && connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR && connection->isReplica()) { DECLARE_UINT8_ARRAY(rawPayload, req->length); ::memcpy(rawPayload, req->buffer, req->length); @@ -581,7 +581,7 @@ void MetadataNetwork::taskNetworkRx(NetPacketRequest* req) std::string ip = udp::Socket::address(req->address); // validate peer (simple validation really) - if (connection->connected() && connection->address() == ip && connection->isNeighborFNEPeer()) { + if (connection->connected() && connection->address() == ip && connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR) { DECLARE_UINT8_ARRAY(rawPayload, req->length); ::memcpy(rawPayload, req->buffer, req->length); @@ -695,7 +695,7 @@ void MetadataNetwork::taskNetworkRx(NetPacketRequest* req) break; default: - // diagostic network ignores unknowns for everything else... + // metadata network ignores unknowns for everything else... break; } } diff --git a/src/fne/network/PeerNetwork.cpp b/src/fne/network/PeerNetwork.cpp index 3e853b9b..710c528f 100644 --- a/src/fne/network/PeerNetwork.cpp +++ b/src/fne/network/PeerNetwork.cpp @@ -521,13 +521,9 @@ bool PeerNetwork::writeConfig() rcon["port"].set(m_metadata->restApiPort); // REST API Port config["rcon"].set(rcon); - // Flags - /* - ** bryanb: don't change externalPeer to neighborPeer -- this will break backward - ** compat with older FNE versions (we're stuck with this naming :() - */ - bool external = true; - config["externalPeer"].set(external); // External FNE Neighbor Peer Marker + uint32_t peerClass = (uint32_t)PEER_CONN_CLASS::PEER_CONN_CLASS_NEIGHBOR; + config["peerClass"].set(peerClass); // Peer Connection Class + config["masterPeerId"].set(m_masterPeerId); // Master Peer ID config["software"].set(std::string(software)); // Software ID diff --git a/src/fne/network/TrafficNetwork.cpp b/src/fne/network/TrafficNetwork.cpp index 72904d04..b2cc57b5 100644 --- a/src/fne/network/TrafficNetwork.cpp +++ b/src/fne/network/TrafficNetwork.cpp @@ -559,7 +559,7 @@ void TrafficNetwork::clock(uint32_t ms) FNEPeerConnection* connection = peer.second; if (connection != nullptr) { uint64_t dt = 0U; - if (connection->isNeighborFNEPeer() || connection->isReplica()) + if (connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR || connection->isReplica()) dt = connection->lastPing() + ((m_host->m_pingTime * 1000) * (m_host->m_maxMissedPings * 2U)); else dt = connection->lastPing() + ((m_host->m_pingTime * 1000) * m_host->m_maxMissedPings); @@ -1405,12 +1405,67 @@ void TrafficNetwork::taskNetworkRx(NetPacketRequest* req) LogInfoEx(LOG_MASTER, "PEER %u >> Software Version [%s]", peerId, software.c_str()); } - // is the peer reporting it is a SysView peer? - if (peerConfig["sysView"].is()) { - bool sysView = peerConfig["sysView"].get(); - connection->isSysView(sysView); - if (sysView) + /* + ** bryanb: this is support for older configuration structs, newer peers should + ** send the peerClass value + */ + { + // is the peer reporting it is a SysView peer? + if (peerConfig["sysView"].is()) { + bool sysView = peerConfig["sysView"].get(); + if (sysView) + connection->peerClass(PEER_CONN_CLASS_SYSVIEW); + if (sysView) + LogInfoEx(LOG_MASTER, "PEER %u >> SysView Peer", peerId); + } + + // is the peer reporting it is a downstream FNE neighbor peer? + if (peerConfig["externalPeer"].is()) { + bool externalPeer = peerConfig["externalPeer"].get(); + if (externalPeer) + connection->peerClass(PEER_CONN_CLASS_NEIGHBOR); + } + } + + // determine the peer class + if (peerConfig["peerClass"].is()) { + uint32_t peerClass = peerConfig["peerClass"].get(); + if (peerClass >= PEER_CONN_CLASS_INVALID) + peerClass = PEER_CONN_CLASS_STANDARD; + connection->peerClass((PEER_CONN_CLASS)peerClass); + } else { + if (connection->peerClass() == PEER_CONN_CLASS_UNKNOWN) { + connection->peerClass(PEER_CONN_CLASS_STANDARD); + } + } + + // is the peer reporting it is a conventional peer? + if (peerConfig["conventionalPeer"].is()) { + if (network->m_allowConvSiteAffOverride) { + bool convPeer = peerConfig["conventionalPeer"].get(); + connection->isConventional(convPeer); + } + } + + // report peer class in log + switch (connection->peerClass()) { + case PEER_CONN_CLASS_NEIGHBOR: + LogInfoEx(LOG_MASTER, "PEER %u >> Downstream Neighbor FNE Peer", peerId); + break; + case PEER_CONN_CLASS_SYSVIEW: LogInfoEx(LOG_MASTER, "PEER %u >> SysView Peer", peerId); + connection->isReplica(true); + break; + case PEER_CONN_CLASS_CONSOLE: + LogInfoEx(LOG_MASTER, "PEER %u >> Console Peer", peerId); + break; + case PEER_CONN_CLASS_STANDARD: + default: + if (connection->isConventional()) + LogInfoEx(LOG_MASTER, "PEER %u >> Conventional Peer", peerId); + else + LogInfoEx(LOG_MASTER, "PEER %u >> Standard Peer", peerId); + break; } // is the peer reporting it is an downstream FNE neighbor peer? @@ -1418,12 +1473,7 @@ void TrafficNetwork::taskNetworkRx(NetPacketRequest* req) ** bryanb: don't change externalPeer to neighborPeer -- this will break backward ** compat with older FNE versions (we're stuck with this naming :() */ - if (peerConfig["externalPeer"].is()) { - bool neighbor = peerConfig["externalPeer"].get(); - connection->isNeighborFNEPeer(neighbor); - if (neighbor) - LogInfoEx(LOG_MASTER, "PEER %u >> Downstream Neighbor FNE Peer", peerId); - + if (connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR) { uint32_t masterPeerId = 0U; if (peerConfig["masterPeerId"].is()) { masterPeerId = peerConfig["masterPeerId"].get(); @@ -1442,12 +1492,11 @@ void TrafficNetwork::taskNetworkRx(NetPacketRequest* req) if (!peerEntry.peerDefault()) { if (peerEntry.peerReplica()) { connection->isReplica(true); - if (neighbor) - LogInfoEx(LOG_MASTER, "PEER %u >> Participates in Peer Replication", peerId); + LogInfoEx(LOG_MASTER, "PEER %u >> Participates in Peer Replication", peerId); } } - if (network->m_enableSpanningTree && !connection->isSysView()) { + if (network->m_enableSpanningTree) { network->m_treeLock.lock(); // check if this peer is already connected via another peer @@ -1486,16 +1535,6 @@ void TrafficNetwork::taskNetworkRx(NetPacketRequest* req) network->writePeerACK(peerId, streamId, buffer, 1U); LogInfoEx(LOG_MASTER, "PEER %u RPTC ACK, completed the configuration exchange", peerId); - // is the peer reporting it is a conventional peer? - if (peerConfig["conventionalPeer"].is()) { - if (network->m_allowConvSiteAffOverride) { - bool convPeer = peerConfig["conventionalPeer"].get(); - connection->isConventionalPeer(convPeer); - if (convPeer) - LogInfoEx(LOG_MASTER, "PEER %u >> Conventional Peer", peerId); - } - } - // setup the affiliations list for this peer std::stringstream peerName; peerName << "PEER " << peerId; @@ -1587,7 +1626,7 @@ void TrafficNetwork::taskNetworkRx(NetPacketRequest* req) // ensure STP sanity, when we receive a ping from a downstream leaf // this check ensures a STP entry for a downstream leaf isn't accidentally blown off // the tree during a fast reconnect - if (network->m_enableSpanningTree && connection->isNeighborFNEPeer() && !connection->isSysView()) { + if (network->m_enableSpanningTree && connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR) { std::lock_guard guard(network->m_treeLock); if ((connection->masterId() != peerId) && (connection->masterId() != 0U)) { @@ -2211,7 +2250,7 @@ void TrafficNetwork::erasePeer(uint32_t peerId) { auto it = std::find_if(m_peers.begin(), m_peers.end(), [&](PeerMapPair x) { return x.first == peerId; }); if (it != m_peers.end()) { - neighborFNE = it->second->isNeighborFNEPeer(); + neighborFNE = it->second->peerClass() == PEER_CONN_CLASS_NEIGHBOR; m_peers.erase(peerId); } } @@ -2481,7 +2520,7 @@ void TrafficNetwork::processInCallCtrl(network::NET_ICC::ENUM command, network:: continue; } - if (conn->isNeighborFNEPeer()) { + if (conn->peerClass() == PEER_CONN_CLASS_NEIGHBOR) { LogInfoEx(LOG_MASTER, "PEER %u In-Call Control Request to Neighbors, peerId = %u, dstId = %u, slot = %u, ssrc = %u, streamId = %u", peerId, peer.first, dstId, slotNo, ssrc, streamId); // send ICC request to local peer @@ -2567,7 +2606,7 @@ void TrafficNetwork::taskMetadataUpdate(MetadataUpdateRequest* req) // if the connection is a downstream neighbor FNE peer, and peer is participating in peer link, // send the peer proper configuration data - if (connection->isNeighborFNEPeer() && connection->isReplica()) { + if (connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR && connection->isReplica()) { LogInfoEx(LOG_MASTER, "PEER %u (%s) sending replica network metadata updates", req->peerId, peerIdentity.c_str()); network->writeWhitelistRIDs(req->peerId, streamId, true); @@ -3213,7 +3252,7 @@ bool TrafficNetwork::writePeerQueue(udp::BufferQueue* buffers, uint32_t peerId, if (m_maskOutboundPeerID) ssrc = m_peerId; // mask the source SSRC to our own peer ID else { - if ((connection->isNeighborFNEPeer() && !connection->isReplica()) && m_maskOutboundPeerIDForNonPL) { + if ((connection->peerClass() == PEER_CONN_CLASS_NEIGHBOR && !connection->isReplica()) && m_maskOutboundPeerIDForNonPL) { // if the peer is a downstream FNE neighbor peer, and not a replica peer, we need to send the packet // to the neighbor FNE peer with our peer ID as the source instead of the originating peer // because we have routed it diff --git a/src/fne/network/callhandler/TagAnalogData.cpp b/src/fne/network/callhandler/TagAnalogData.cpp index 427e6e87..6ad3d13c 100644 --- a/src/fne/network/callhandler/TagAnalogData.cpp +++ b/src/fne/network/callhandler/TagAnalogData.cpp @@ -609,18 +609,18 @@ bool TagAnalogData::isPeerPermitted(uint32_t peerId, data::NetData& data, uint32 // is this peer a conventional peer? if (m_network->m_allowConvSiteAffOverride) { if (connection != nullptr) { - if (connection->isConventionalPeer()) { + if (connection->peerClass() == PEER_CONN_CLASS_STANDARD && connection->isConventional()) { fromUpstream = true; // we'll just set the fromUpstream flag to disable the affiliation check // for conventional peers } } } - // is this peer a SysView peer? + // is this peer a SysView or console peer? if (connection != nullptr) { - if (connection->isSysView()) { + if (connection->peerClass() == PEER_CONN_CLASS_SYSVIEW || connection->peerClass() == PEER_CONN_CLASS_CONSOLE) { fromUpstream = true; // we'll just set the fromUpstream flag to disable the affiliation check - // for SysView peers + // for SysView or console peers } } diff --git a/src/fne/network/callhandler/TagDMRData.cpp b/src/fne/network/callhandler/TagDMRData.cpp index 886bebba..504084af 100644 --- a/src/fne/network/callhandler/TagDMRData.cpp +++ b/src/fne/network/callhandler/TagDMRData.cpp @@ -481,7 +481,7 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId if (peerId != peer.first) { FNEPeerConnection* conn = peer.second; if (conn != nullptr) { - if (conn->isNeighborFNEPeer()) { + if (conn->peerClass() == PEER_CONN_CLASS_NEIGHBOR) { continue; } } @@ -521,7 +521,7 @@ bool TagDMRData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId // is this peer an upstream neighbor peer? bool neighbor = false; if (conn != nullptr) { - neighbor = conn->isNeighborFNEPeer(); + neighbor = conn->peerClass() == PEER_CONN_CLASS_NEIGHBOR; } // is this a private call? @@ -1018,18 +1018,18 @@ bool TagDMRData::isPeerPermitted(uint32_t peerId, data::NetData& data, uint32_t // is this peer a conventional peer? if (m_network->m_allowConvSiteAffOverride) { if (connection != nullptr) { - if (connection->isConventionalPeer()) { + if (connection->peerClass() == PEER_CONN_CLASS_STANDARD && connection->isConventional()) { fromUpstream = true; // we'll just set the fromUpstream flag to disable the affiliation check // for conventional peers } } } - // is this peer a SysView peer? + // is this peer a SysView or console peer? if (connection != nullptr) { - if (connection->isSysView()) { + if (connection->peerClass() == PEER_CONN_CLASS_SYSVIEW || connection->peerClass() == PEER_CONN_CLASS_CONSOLE) { fromUpstream = true; // we'll just set the fromUpstream flag to disable the affiliation check - // for SysView peers + // for SysView or console peers } } diff --git a/src/fne/network/callhandler/TagNXDNData.cpp b/src/fne/network/callhandler/TagNXDNData.cpp index 25aaf790..79dab8e3 100644 --- a/src/fne/network/callhandler/TagNXDNData.cpp +++ b/src/fne/network/callhandler/TagNXDNData.cpp @@ -500,7 +500,7 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI if (peerId != peer.first) { FNEPeerConnection* conn = peer.second; if (conn != nullptr) { - if (conn->isNeighborFNEPeer()) { + if (conn->peerClass() == PEER_CONN_CLASS_NEIGHBOR) { continue; } } @@ -540,7 +540,7 @@ bool TagNXDNData::processFrame(const uint8_t* data, uint32_t len, uint32_t peerI // is this peer an upstream neighbor peer? bool neighbor = false; if (conn != nullptr) { - neighbor = conn->isNeighborFNEPeer(); + neighbor = conn->peerClass() == PEER_CONN_CLASS_NEIGHBOR; } // is this a private call? @@ -892,18 +892,18 @@ bool TagNXDNData::isPeerPermitted(uint32_t peerId, lc::RTCH& lc, uint8_t message // is this peer a conventional peer? if (m_network->m_allowConvSiteAffOverride) { if (connection != nullptr) { - if (connection->isConventionalPeer()) { + if (connection->peerClass() == PEER_CONN_CLASS_STANDARD && connection->isConventional()) { fromUpstream = true; // we'll just set the fromUpstream flag to disable the affiliation check // for conventional peers } } } - // is this peer a SysView peer? + // is this peer a SysView or console peer? if (connection != nullptr) { - if (connection->isSysView()) { + if (connection->peerClass() == PEER_CONN_CLASS_SYSVIEW || connection->peerClass() == PEER_CONN_CLASS_CONSOLE) { fromUpstream = true; // we'll just set the fromUpstream flag to disable the affiliation check - // for SysView peers + // for SysView or console peers } } diff --git a/src/fne/network/callhandler/TagP25Data.cpp b/src/fne/network/callhandler/TagP25Data.cpp index b8079f7b..1b3d28f5 100644 --- a/src/fne/network/callhandler/TagP25Data.cpp +++ b/src/fne/network/callhandler/TagP25Data.cpp @@ -580,7 +580,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId if (peerId != peer.first) { FNEPeerConnection* conn = peer.second; if (conn != nullptr) { - if (conn->isNeighborFNEPeer()) { + if (conn->peerClass() == PEER_CONN_CLASS_NEIGHBOR) { continue; } } @@ -620,7 +620,7 @@ bool TagP25Data::processFrame(const uint8_t* data, uint32_t len, uint32_t peerId // is this peer an upstream neighbor peer? bool neighbor = false; if (conn != nullptr) { - neighbor = conn->isNeighborFNEPeer(); + neighbor = conn->peerClass() == PEER_CONN_CLASS_NEIGHBOR; } // is this a private call? @@ -1460,18 +1460,18 @@ bool TagP25Data::isPeerPermitted(uint32_t peerId, lc::LC& control, DUID::E duid, // is this peer a conventional peer? if (m_network->m_allowConvSiteAffOverride) { if (connection != nullptr) { - if (connection->isConventionalPeer()) { + if (connection->peerClass() == PEER_CONN_CLASS_STANDARD && connection->isConventional()) { fromUpstream = true; // we'll just set the fromUpstream flag to disable the affiliation check // for conventional peers } } } - // is this peer a SysView peer? + // is this peer a SysView or console peer? if (connection != nullptr) { - if (connection->isSysView()) { + if (connection->peerClass() == PEER_CONN_CLASS_SYSVIEW || connection->peerClass() == PEER_CONN_CLASS_CONSOLE) { fromUpstream = true; // we'll just set the fromUpstream flag to disable the affiliation check - // for SysView peers + // for SysView or console peers } } diff --git a/src/fne/restapi/RESTAPI.cpp b/src/fne/restapi/RESTAPI.cpp index 60a023be..65d9f236 100644 --- a/src/fne/restapi/RESTAPI.cpp +++ b/src/fne/restapi/RESTAPI.cpp @@ -1833,8 +1833,12 @@ void RESTAPI::restAPI_GetStats(const HTTPPayload& request, HTTPPayload& reply, c uint32_t missedMetadataUpdates = peer->missedMetadataUpdates(); peerObj["missedMetadataUpdates"].set(missedMetadataUpdates); - bool isNeighbor = peer->isNeighborFNEPeer(); + bool isNeighbor = (peer->peerClass() == PEER_CONN_CLASS_NEIGHBOR); bool isReplica = peer->isReplica(); + bool isSysView = (peer->peerClass() == PEER_CONN_CLASS_SYSVIEW); + bool isConsole = (peer->peerClass() == PEER_CONN_CLASS_CONSOLE); + peerObj["isConsole"].set(isConsole); + peerObj["isSysView"].set(isSysView); peerObj["isNeighbor"].set(isNeighbor); peerObj["isReplica"].set(isReplica); diff --git a/src/patch/network/PeerNetwork.cpp b/src/patch/network/PeerNetwork.cpp index a9235748..03f2d912 100644 --- a/src/patch/network/PeerNetwork.cpp +++ b/src/patch/network/PeerNetwork.cpp @@ -189,7 +189,10 @@ bool PeerNetwork::writeConfig() rcon["port"].set(m_metadata->restApiPort); // REST API Port config["rcon"].set(rcon); - config["software"].set(std::string(software)); // Software ID + uint32_t peerClass = PEER_CONN_CLASS::PEER_CONN_CLASS_STANDARD; + config["peerClass"].set(peerClass); // Peer Connection Class + + config["software"].set(std::string(software)); // Software ID json::value v = json::value(config); std::string json = v.serialize(); diff --git a/src/sysview/network/PeerNetwork.cpp b/src/sysview/network/PeerNetwork.cpp index a1069f3c..1092bf5a 100644 --- a/src/sysview/network/PeerNetwork.cpp +++ b/src/sysview/network/PeerNetwork.cpp @@ -277,14 +277,8 @@ bool PeerNetwork::writeConfig() rcon["port"].set(m_metadata->restApiPort); // REST API Port config["rcon"].set(rcon); - // Flags - bool external = true; - config["externalPeer"].set(external); // External Peer Marker - config["masterPeerId"].set(m_peerId); // Master Peer ID - bool convPeer = true; - config["conventionalPeer"].set(convPeer); // Conventional Peer Marker - bool sysView = true; - config["sysView"].set(sysView); // SysView Peer Marker + uint32_t peerClass = PEER_CONN_CLASS::PEER_CONN_CLASS_SYSVIEW; + config["peerClass"].set(peerClass); // Peer Connection Class config["software"].set(std::string(software)); // Software ID