+static bool receive_invitation_sptps(void *handle, uint8_t type, const void *data, uint16_t len) {
+ connection_t *c = handle;
+ meshlink_handle_t *mesh = c->mesh;
+
+ if(type == SPTPS_HANDSHAKE) {
+ // The peer should send its cookie first.
+ return true;
+ }
+
+ if(mesh->inviter_commits_first) {
+ if(type == 2 && len == 18 + 32 && !c->status.invitation_used) {
+ return process_invitation(mesh, c, data);
+ }
+ } else {
+ if(type == 0 && len == 18 && !c->status.invitation_used) {
+ return process_invitation(mesh, c, data);
+ } else if(type == 1 && len == 32 && c->status.invitation_used) {
+ return commit_invitation(mesh, c, data);
+ }
+ }
+
+ return false;
+}
+