mirror of
https://github.com/meshtastic/firmware.git
synced 2025-09-20 08:41:41 +00:00
added actual Routing e.g. forwarding to correct Neighbor
This commit is contained in:
parent
fc207c3d5c
commit
c197c9f8f9
@ -19,6 +19,7 @@
|
||||
#include "power.h"
|
||||
#include <assert.h>
|
||||
#include <string>
|
||||
#include "modules/FishEyeStateRoutingModule.h"
|
||||
|
||||
#if ARCH_PORTDUINO
|
||||
#include "PortduinoGlue.h"
|
||||
@ -232,6 +233,10 @@ ErrorCode MeshService::sendQueueStatusToPhone(const meshtastic_QueueStatus &qs,
|
||||
|
||||
void MeshService::sendToMesh(meshtastic_MeshPacket *p, RxSource src, bool ccToPhone)
|
||||
{
|
||||
if(config.network.routingAlgorithm == meshtastic_Config_RoutingConfig_FishEyeState && moduleConfig.fish_eye_state_routing.enabled && p->decoded.dest != 0 && p->decoded.dest != NODENUM_BROADCAST){
|
||||
p->to = fishEyeStateRoutingModule->getNextHopForID(p->decoded.dest);
|
||||
}
|
||||
|
||||
uint32_t mesh_packet_id = p->id;
|
||||
nodeDB->updateFrom(*p); // update our local DB for this packet (because phone might have sent position packets etc...)
|
||||
|
||||
|
@ -11,6 +11,7 @@
|
||||
#include "mesh-pb-constants.h"
|
||||
#include "meshUtils.h"
|
||||
#include "modules/RoutingModule.h"
|
||||
#include "modules/FishEyeStateRoutingModule.h"
|
||||
#if !MESHTASTIC_EXCLUDE_MQTT
|
||||
#include "mqtt/MQTT.h"
|
||||
#endif
|
||||
@ -652,6 +653,14 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
||||
if (!skipHandle) {
|
||||
MeshModule::callModules(*p, src);
|
||||
|
||||
if(config.network.routingAlgorithm == meshtastic_Config_RoutingConfig_FishEyeState && moduleConfig.fish_eye_state_routing.enabled == true && ((isToUs(p) || isBroadcast(p->to)) && p->decoded.dest != 0 && !isBroadcast(p->decoded.dest))){
|
||||
meshtastic_MeshPacket *copy = allocForSending();
|
||||
copy = p;
|
||||
copy->to = fishEyeStateRoutingModule->getNextHopForID(copy->decoded.dest);
|
||||
copy->from = nodeDB->getNodeNum();
|
||||
service->sendToMesh(copy);
|
||||
}
|
||||
|
||||
#if !MESHTASTIC_EXCLUDE_MQTT
|
||||
// Mark as pki_encrypted if it is not yet decoded and MQTT encryption is also enabled, hash matches and it's a DM not to
|
||||
// us (because we would be able to decrypt it)
|
||||
@ -665,6 +674,8 @@ void Router::handleReceived(meshtastic_MeshPacket *p, RxSource src)
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
|
||||
packetPool.release(p_encrypted); // Release the encrypted packet
|
||||
}
|
||||
|
||||
|
@ -104,6 +104,7 @@ bool FishEyeStateRoutingModule::isequal(const meshtastic_FishEyeStateRouting &s1
|
||||
* returns next-Hop for a Message to a given NodeID, if Node is unknwon BroadcastID is returned
|
||||
*/
|
||||
uint32_t FishEyeStateRoutingModule::getNextHopForID(uint32_t dest){
|
||||
if (dest == nodeDB->getNodeNum()){return dest;}
|
||||
auto it = NextHopTable.find(dest);
|
||||
if(it == NextHopTable.end()){
|
||||
return NODENUM_BROADCAST;
|
||||
|
Loading…
Reference in New Issue
Block a user