-static bool sptps_receive_data_datagram(sptps_t *s, const char *data, size_t len) {
- if(len < (s->instate ? 21 : 5))
- return error(s, EIO, "Received short packet");
+static bool sptps_receive_data_datagram(sptps_t *s, const void *vdata, size_t len) {
+ const char *data = vdata;
+
+ if(len < 21)
+ return error(s, EIO, "Received short packet in sptps_receive_data_datagram");
+
+ if (!s->instate)
+ return error(s, EIO, "SPTPS state not ready to verify this datagram");