-enum {
- ALL = -1, /* Guardian for allow_request */
- ID = 0, METAKEY, CHALLENGE, CHAL_REPLY, ACK,
- STATUS, ERROR, TERMREQ,
- PING, PONG,
-// ADD_NODE, DEL_NODE,
- ADD_SUBNET, DEL_SUBNET,
- ADD_EDGE, DEL_EDGE,
- KEY_CHANGED, REQ_KEY, ANS_KEY,
- PACKET,
- LAST /* Guardian for the highest request number */
-};
-
-/* Maximum size of strings in a request */
-
-#define MAX_STRING_SIZE 2048
+typedef enum request_t {
+ ALL = -1, /* Guardian for allow_request */
+ ID = 0, METAKEY, CHALLENGE, CHAL_REPLY, ACK,
+ STATUS, ERROR, TERMREQ,
+ PING, PONG,
+ ADD_SUBNET, DEL_SUBNET,
+ ADD_EDGE, DEL_EDGE,
+ KEY_CHANGED, REQ_KEY, ANS_KEY,
+ PACKET,
+ /* Tinc 1.1 requests */
+ CONTROL,
+ REQ_PUBKEY, ANS_PUBKEY,
+ SPTPS_PACKET,
+ UDP_INFO, MTU_INFO,
+ LAST /* Guardian for the highest request number */
+} request_t;
+
+typedef bool (request_handler_t)(connection_t *c, const char *request);
+
+typedef struct past_request_t {
+ const char *request;
+ time_t firstseen;
+} past_request_t;
+
+typedef struct {
+ request_handler_t *const handler;
+ const char *name;
+} request_entry_t;
+
+extern bool tunnelserver;
+extern bool strictsubnets;
+extern bool experimental;
+
+extern int invitation_lifetime;
+extern ecdsa_t *invitation_key;
+
+/* 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.
+ */
+
+#define MAX_STRING_SIZE 2049