SingingCat 0
application
Macros | Functions
routing.c File Reference

code to discover other nodes More...

#include "main-header.h"
#include "routing.h"
#include "espressif/esp8266_flash.h"
#include "user_app_exe.h"
#include "forwarding.h"
#include "networkif.h"

Go to the source code of this file.

Macros

#define HOSTROUTE_ENTRIES   40
 
#define MAX_ROUTE_AGE_SECONDS   600
 any route that has not been used or seen for longer than this is subject to removal (the garbage collector) More...
 
#define ROUTING_ANNOUNCE_INTERVAL   120
 
#define ROUTING_EVENT_LOOP_INTERVAL   30
 

Functions

void bridge_packet (struct command *com)
 
const char * decisionname (int decision)
 
byte get_hops_to_server ()
 how many hops to the server? More...
 
byte get_routing_debug ()
 
byte got_new_packet (struct command *com, uint8_t signal_indicator)
 stack received a new packet (signal indicator is a 0-255 byte value, interface specific) More...
 
int is_device_online (int device)
 return 1 if the specified device is online and routing More...
 
void remove_stale_routes ()
 "old" routes are being removed this is the route garbage collector More...
 
int routing_count_nodes ()
 determine number of nodes known More...
 
void routing_error (struct command *com, int errorcode)
 
void routing_event_loop ()
 
struct hostrouterouting_find_empty_slot ()
 finds an empty slot in our routing entry list More...
 
struct hostrouterouting_find_host (const long nodeid)
 find route to host or NULL if none known More...
 
struct hostrouterouting_find_route (const long nodeid, const byte sourcedev)
 find specific hostroute to target or NULL if none known special case, if we ask for a route to server, we get any intermediary routes which announce themselves to have a connection a server More...
 
struct hostrouterouting_get_node_by_index (const int index)
 finds a nodeid by index. [0...n] More...
 
void routing_init ()
 called when we power-up More...
 
void routing_print_table ()
 print routing table More...
 
void routing_request_reply (const struct command *com)
 we call this when we receive a reply to a routing request this adds or updates a new route More...
 
int send_command_one_arg (int command, long target, const byte *arg1, int arg1len)
 helper function to quickly and easily send a command somewhere return 0 if ok, else errorcode More...
 
void send_routing_update_now ()
 
void set_routing_debug (byte b)
 

Detailed Description

code to discover other nodes

com->recipient & com->target: for those familiar with ip over ethernet, it basically works like so: com->recipient == destination mac address com->target == destination ip address

see http://www.singingcat.net/sc/Main?linkid=routing for details.

Definition in file routing.c.

Macro Definition Documentation

◆ ROUTING_ANNOUNCE_INTERVAL

#define ROUTING_ANNOUNCE_INTERVAL   120

Definition at line 16 of file routing.c.

◆ ROUTING_EVENT_LOOP_INTERVAL

#define ROUTING_EVENT_LOOP_INTERVAL   30

Definition at line 15 of file routing.c.