mUpnpTime mupnp_event_subscription_gettimeout(const char* headerValue) { ssize_t minusIdx; long timeout; mupnp_log_debug_l4("Entering...\n"); minusIdx = mupnp_strstr(headerValue, "-"); if (minusIdx < 0) return MUPNP_SUBSCRIPTION_INFINITE_VALUE; timeout = mupnp_str2long(headerValue + minusIdx + 1); if (timeout == 0) return MUPNP_SUBSCRIPTION_INFINITE_VALUE; if (timeout < 0) timeout = -timeout; return timeout; mupnp_log_debug_l4("Leaving...\n"); }
long mupnp_ssdp_packet_getmaxage(mUpnpSSDPPacket *ssdpPkt) { const char *cachecontrol = NULL; ssize_t maxageIdx = 0; mupnp_log_debug_l4("Entering...\n"); cachecontrol = mupnp_ssdp_packet_getcachecontrol(ssdpPkt); if (cachecontrol == NULL) return 0; maxageIdx = mupnp_strstr(cachecontrol, MUPNP_HTTP_MAX_AGE); if (maxageIdx < 0) return 0; maxageIdx = mupnp_strstr(cachecontrol+maxageIdx, "="); if (maxageIdx <= 0) return 0; maxageIdx++; return mupnp_str2long(cachecontrol+maxageIdx); mupnp_log_debug_l4("Leaving...\n"); }