static void mupnp_ssdpresponse_server_thread(mUpnpThread* thread) { mUpnpSSDPResponseServer* server; mUpnpSSDPPacket* ssdpPkt; void* userData; mupnp_log_debug_l4("Entering...\n"); server = (mUpnpSSDPResponseServer*)mupnp_thread_getuserdata(thread); userData = mupnp_ssdpresponse_server_getuserdata(server); if (mupnp_ssdpresponse_server_isopened(server) == false) return; ssdpPkt = mupnp_ssdp_packet_new(); mupnp_ssdp_packet_setuserdata(ssdpPkt, userData); while (mupnp_thread_isrunnable(thread) == true) { if (mupnp_httpu_socket_recv(server->httpuSock, ssdpPkt) <= 0) break; mupnp_ssdp_packet_print(ssdpPkt); mupnp_ssdpresponse_server_performlistener(server, ssdpPkt); mupnp_ssdp_packet_clear(ssdpPkt); } mupnp_ssdp_packet_delete(ssdpPkt); mupnp_log_debug_l4("Leaving...\n"); }
void mupnp_ssdp_packet_delete(mUpnpSSDPPacket *ssdpPkt) { mupnp_log_debug_l4("Entering...\n"); mupnp_ssdp_packet_clear(ssdpPkt); mupnp_socket_datagram_packet_delete(ssdpPkt->dgmPkt); mupnp_http_headerlist_delete(ssdpPkt->headerList); free(ssdpPkt->timestamps); free(ssdpPkt); mupnp_log_debug_l4("Leaving...\n"); }
void mupnp_ssdp_packet_copy(mUpnpSSDPPacket *dstSsdpPkt, mUpnpSSDPPacket *srcSsdpPkt) { mUpnpHttpHeader *srcHeader; mUpnpHttpHeader *destHeader; mupnp_log_debug_l4("Entering...\n"); mupnp_socket_datagram_packet_copy(dstSsdpPkt->dgmPkt, srcSsdpPkt->dgmPkt); /**** copy headers ****/ mupnp_ssdp_packet_clear(dstSsdpPkt); for (srcHeader = mupnp_ssdp_packet_getheaders(srcSsdpPkt); srcHeader != NULL; srcHeader = mupnp_http_header_next(srcHeader)) { destHeader = mupnp_http_header_new(); mupnp_http_header_setname(destHeader, mupnp_http_header_getname(srcHeader)); mupnp_http_header_setvalue(destHeader, mupnp_http_header_getvalue(srcHeader)); mupnp_ssdp_packet_addheader(dstSsdpPkt, destHeader); } /* Set timestamp */ mupnp_ssdp_packet_settimestamp(dstSsdpPkt, mupnp_getcurrentsystemtime()); mupnp_log_debug_l4("Leaving...\n"); }