X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=src%2Fprotocol.h;h=94f760f1e2cb0cf51b5d786b93eedb4de994e314;hb=HEAD;hp=794b0515dec1205cff55d5408d6be127c952d7d3;hpb=8d4b96efb7955eaa96174af4804597f92e124041;p=meshlink diff --git a/src/protocol.h b/src/protocol.h index 794b0515..94f760f1 100644 --- a/src/protocol.h +++ b/src/protocol.h @@ -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,18 +44,28 @@ 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 { + NONE = 0, + BLACKLISTED = 1, +} request_error_t; + typedef struct past_request_t { const char *request; 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. @@ -83,11 +93,14 @@ bool seen_request(struct meshlink_handle *mesh, const char *); bool send_id(struct meshlink_handle *mesh, struct connection_t *); bool send_ack(struct meshlink_handle *mesh, struct connection_t *); +bool send_error(struct meshlink_handle *mesh, struct connection_t *, request_error_t, const char *); bool send_ping(struct meshlink_handle *mesh, struct connection_t *); 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 *); +bool send_raw_packet(struct meshlink_handle *mesh, struct connection_t *, const vpn_packet_t *); /* Request handlers */ @@ -104,5 +117,6 @@ bool key_changed_h(struct meshlink_handle *mesh, struct connection_t *, const ch bool req_key_h(struct meshlink_handle *mesh, struct connection_t *, const char *); bool ans_key_h(struct meshlink_handle *mesh, struct connection_t *, const char *); bool tcppacket_h(struct meshlink_handle *mesh, struct connection_t *, const char *); +bool raw_packet_h(struct meshlink_handle *mesh, struct connection_t *, const char *); #endif