ecdsa_t *ecdsa; /* his public ECDSA key */
int protocol_major; /* used protocol */
int protocol_minor; /* used protocol */
+ uint32_t flags; /* used protocol flags */
} connection_t;
void init_connections(struct meshlink_handle *mesh);
assert(length);
for list_each(connection_t, c, mesh->connections)
- if(c != from && c->status.active) {
+ if(c != from && c->status.active && !(c->flags & PROTOCOL_TINY)) {
send_meta(mesh, c, buffer, length);
}
}
assert(length);
for list_each(connection_t, c, mesh->connections)
- if(c != from && c->status.active) {
+ if(c != from && c->status.active && !(c->flags & PROTOCOL_TINY)) {
if(c->node && submesh_allows_node(s, c->node)) {
send_meta(mesh, c, buffer, length);
}
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.
extern bool node_write_devclass(meshlink_handle_t *mesh, node_t *n);
bool send_id(meshlink_handle_t *mesh, connection_t *c) {
- return send_request(mesh, c, NULL, "%d %s %d.%d %s", ID, mesh->self->name, PROT_MAJOR, PROT_MINOR, mesh->appname);
+ return send_request(mesh, c, NULL, "%d %s %d.%d %s %u", ID, mesh->self->name, PROT_MAJOR, PROT_MINOR, mesh->appname, 0);
}
static bool commit_invitation(meshlink_handle_t *mesh, connection_t *c, const void *data) {
char name[MAX_STRING_SIZE];
- if(sscanf(request, "%*d " MAX_STRING " %d.%d", name, &c->protocol_major, &c->protocol_minor) < 2) {
+ if(sscanf(request, "%*d " MAX_STRING " %d.%d %*s %u", name, &c->protocol_major, &c->protocol_minor, &c->flags) < 2) {
logger(mesh, MESHLINK_ERROR, "Got bad %s from %s", "ID", c->name);
return false;
}
/* Send him everything we know */
- send_everything(mesh, c);
+ if(!(c->flags & PROTOCOL_TINY)) {
+ send_everything(mesh, c);
+ }
/* Create an edge_t for this connection */