-bool receive_meta(connection_t *c)
-{
- int oldlen, i;
- int lenin, reqlen;
- bool decrypted = false;
- char inbuf[MAXBUFSIZE];
+bool receive_meta_sptps(void *handle, uint8_t type, const char *data, uint16_t length) {
+ connection_t *c = handle;
+
+ if(!c) {
+ logger(DEBUG_ALWAYS, LOG_ERR, "receive_meta_sptps() called with NULL pointer!");
+ abort();
+ }
+
+ logger(DEBUG_META, LOG_DEBUG, "receive_meta_sptps(%s, %d, %p, %hu)", c->name, type, data, length);
+
+ if(type == SPTPS_HANDSHAKE) {
+ if(c->allow_request == ACK)
+ return send_ack(c);
+ else
+ return true;
+ }
+
+ if(!data)
+ return true;
+
+ /* Are we receiving a TCPpacket? */
+
+ if(c->tcplen) {
+ if(length != c->tcplen)
+ return false;
+ receive_tcppacket(c, data, length);
+ c->tcplen = 0;
+ return true;
+ }
+
+ /* Otherwise we are waiting for a request */