]> git.meshlink.io Git - meshlink/blobdiff - src/protocol.h
Handle connections from nodes using MeshLink-tiny.
[meshlink] / src / protocol.h
index 060d7dff8b201a4a923615652e6e1d50b708259c..05c2203bf70bc791bbb8657e3090191a8aa55e81 100644 (file)
@@ -36,7 +36,7 @@
 /* Request numbers */
 
 typedef enum request_t {
-       ALL = -1,                                       /* Guardian for allow_request */
+       ALL = -1, /* Guardian for allow_request */
        ID = 0, METAKEY, CHALLENGE, CHAL_REPLY, ACK,
        STATUS, ERROR, TERMREQ,
        PING, PONG,
@@ -44,11 +44,12 @@ typedef enum request_t {
        ADD_EDGE, DEL_EDGE,
        KEY_CHANGED, REQ_KEY, ANS_KEY,
        PACKET,
-       /* Tinc 1.1 requests */
+       /* Extended requests */
        CONTROL,
        REQ_PUBKEY, ANS_PUBKEY,
        REQ_SPTPS,
-       LAST                                            /* Guardian for the highest request number */
+       REQ_CANONICAL,
+       NUM_REQUESTS
 } request_t;
 
 typedef enum request_error_t {
@@ -61,6 +62,10 @@ typedef struct past_request_t {
        time_t firstseen;
 } past_request_t;
 
+/* Protocol support flags */
+
+static const uint32_t PROTOCOL_TINY = 1; // Peer is using meshlink-tiny
+
 /* Maximum size of strings in a request.
  * scanf terminates %2048s with a NUL character,
  * but the NUL character can be written after the 2048th non-NUL character.
@@ -94,6 +99,7 @@ bool send_pong(struct meshlink_handle *mesh, struct connection_t *);
 bool send_add_edge(struct meshlink_handle *mesh, struct connection_t *, const struct edge_t *, int contradictions);
 bool send_del_edge(struct meshlink_handle *mesh, struct connection_t *, const struct edge_t *, int contradictions);
 bool send_req_key(struct meshlink_handle *mesh, struct node_t *);
+bool send_canonical_address(struct meshlink_handle *mesh, struct node_t *);
 
 /* Request handlers  */