]> git.meshlink.io Git - meshlink-tiny/blobdiff - src/node.h
Add an example chat application.
[meshlink-tiny] / src / node.h
index 63f3c2c8bad55132aa694981c702d760777d2b1e..90e0c29bc09a6814579605fc15b54a95b2c2f175 100644 (file)
 */
 
 #include "event.h"
+#include "meshlink_internal.h"
 #include "sockaddr.h"
 #include "sptps.h"
-#include "utcp.h"
-#include "submesh.h"
 
 typedef struct node_status_t {
        uint16_t validkey: 1;               /* 1 if we currently have a valid key for him */
@@ -49,34 +48,12 @@ typedef struct node_t {
 
        // Private member variables
        node_status_t status;
-       uint16_t minmtu;                        /* Probed minimum MTU */
        dev_class_t devclass;
 
-       // Used for packet I/O
-       int sock;                               /* Socket to use for outgoing UDP packets */
        uint32_t session_id;                    /* Unique ID for this node's currently running process */
-       sptps_t sptps;
-       sockaddr_t address;                     /* his real (internet) ip to send UDP packets to */
-
-       struct utcp *utcp;
-
-       // Traffic counters
-       uint64_t in_packets;
-       uint64_t in_bytes;
-       uint64_t out_packets;
-       uint64_t out_bytes;
-
-       // MTU probes
-       timeout_t mtutimeout;                   /* Probe event */
-       int mtuprobes;                          /* Number of probes */
-       uint16_t mtu;                           /* Maximum size of packets to send to this node */
-       uint16_t maxmtu;                        /* Probed maximum MTU */
 
        // Used for meta-connection I/O, timeouts
        struct meshlink_handle *mesh;           /* The mesh this node belongs to */
-       struct submesh_t *submesh;              /* Nodes Sub-Mesh Handle*/
-
-       time_t last_req_key;
 
        struct ecdsa *ecdsa;                    /* His public ECDSA key */
 
@@ -86,17 +63,8 @@ typedef struct node_t {
 
        char *canonical_address;                /* The canonical address of this node, if known */
        sockaddr_t recent[MAX_RECENT];          /* Recently seen addresses */
-       sockaddr_t catta_address;               /* Latest address seen by Catta */
-
-       // Graph-related member variables
-       time_t last_reachable;
-       time_t last_unreachable;
 
-       int distance;
        struct node_t *nexthop;                 /* nearest node from us to him */
-       struct edge_t *prevedge;                /* nearest node from him to us */
-
-       struct splay_tree_t *edge_tree;         /* Edges with this node as one of the endpoints */
 } node_t;
 
 void init_nodes(struct meshlink_handle *mesh);
@@ -106,8 +74,6 @@ void free_node(node_t *n);
 void node_add(struct meshlink_handle *mesh, node_t *n);
 void node_del(struct meshlink_handle *mesh, node_t *n);
 node_t *lookup_node(struct meshlink_handle *mesh, const char *name) __attribute__((__warn_unused_result__));
-node_t *lookup_node_udp(struct meshlink_handle *mesh, const sockaddr_t *sa) __attribute__((__warn_unused_result__));
-void update_node_udp(struct meshlink_handle *mesh, node_t *n, const sockaddr_t *sa);
 bool node_add_recent_address(struct meshlink_handle *mesh, node_t *n, const sockaddr_t *addr);
 
 #endif