1 diff -ur mediastreamer-2.16.1/src/upnp/upnp_igd.c mediastreamer-2.16.1-upnp-1.14/src/upnp/upnp_igd.c
2 --- mediastreamer-2.16.1/src/upnp/upnp_igd.c 2017-04-06 11:27:56.000000000 +0200
3 +++ mediastreamer-2.16.1-upnp-1.14/src/upnp/upnp_igd.c 2020-10-23 14:04:57.300609331 +0200
5 * d_event -- event associated with the new device
7 ********************************************************************************/
8 -void upnp_igd_add_device(upnp_igd_context *igd_ctxt, IXML_Document *desc_doc, struct Upnp_Discovery *d_event) {
9 +void upnp_igd_add_device(upnp_igd_context *igd_ctxt, IXML_Document *desc_doc, UpnpDiscovery *d_event) {
10 upnp_igd_device_node *deviceNode, *tmpdevnode;
14 baseURL = upnp_igd_get_first_document_item(igd_ctxt, desc_doc, "URLBase");
15 relURL = upnp_igd_get_first_document_item(igd_ctxt, desc_doc, "presentationURL");
17 - ret = UpnpResolveURL((baseURL ? baseURL : d_event->Location), relURL, presURL);
18 + ret = UpnpResolveURL((baseURL ? baseURL : UpnpDiscovery_get_Location_cstr(d_event)), relURL, presURL);
20 if (UPNP_E_SUCCESS != ret) {
21 upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error generating presURL from %s + %s", baseURL, relURL);
24 /* The device is already there, so just update */
25 /* the advertisement timeout field */
26 - tmpdevnode->device.advr_time_out = d_event->Expires;
27 + tmpdevnode->device.advr_time_out = UpnpDiscovery_get_Expires(d_event);
28 upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "IGD device: %s[%s] | Update expires(%d)", friendlyName, UDN, tmpdevnode->device.advr_time_out);
30 upnp_igd_print(igd_ctxt, UPNP_IGD_MESSAGE, "Add IGD device: %s[%s]", friendlyName, UDN);
32 deviceNode = (upnp_igd_device_node *) malloc(sizeof(upnp_igd_device_node));
33 memset(deviceNode->device.services, '\0', sizeof(upnp_igd_service) * IGD_SERVICE_SERVCOUNT);
34 strncpy(deviceNode->device.udn, UDN, sizeof(deviceNode->device.udn));
35 - strncpy(deviceNode->device.desc_doc_url, d_event->Location, sizeof(deviceNode->device.desc_doc_url));
36 + strncpy(deviceNode->device.desc_doc_url, UpnpDiscovery_get_Location_cstr(d_event), sizeof(deviceNode->device.desc_doc_url));
37 strncpy(deviceNode->device.friendly_name, friendlyName, sizeof(deviceNode->device.friendly_name));
38 strncpy(deviceNode->device.model_name, modelName, sizeof(deviceNode->device.model_name));
39 strncpy(deviceNode->device.model_number, modelNumber, sizeof(deviceNode->device.model_number));
40 strncpy(deviceNode->device.pres_url, presURL, sizeof(deviceNode->device.pres_url));
41 - deviceNode->device.advr_time_out = d_event->Expires;
42 + deviceNode->device.advr_time_out = UpnpDiscovery_get_Expires(d_event);
48 for (service = 0; service < IGD_SERVICE_SERVCOUNT;
50 - if (upnp_igd_get_find_and_parse_service(igd_ctxt, desc_doc, d_event->Location,
51 + if (upnp_igd_get_find_and_parse_service(igd_ctxt, desc_doc, UpnpDiscovery_get_Location_cstr(d_event),
52 IGDServiceType[service], &serviceId, &event_url, &controlURL)) {
53 upnp_igd_print(igd_ctxt, UPNP_IGD_DEBUG, "Subscribing to EventURL %s...",event_url);
57 case UPNP_DISCOVERY_ADVERTISEMENT_ALIVE:
58 case UPNP_DISCOVERY_SEARCH_RESULT: {
59 - struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)event;
60 + UpnpDiscovery *d_event = (UpnpDiscovery *)event;
61 IXML_Document *desc_doc = NULL;
64 - if (d_event->ErrCode != UPNP_E_SUCCESS) {
65 - upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery Callback -- %d", d_event->ErrCode);
66 + if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS) {
67 + upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery Callback -- %d", UpnpDiscovery_get_ErrCode(d_event));
69 - ret = UpnpDownloadXmlDoc(d_event->Location, &desc_doc);
70 + ret = UpnpDownloadXmlDoc(UpnpDiscovery_get_Location_cstr(d_event), &desc_doc);
71 if (ret != UPNP_E_SUCCESS) {
72 - upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error obtaining device description from %s -- error = %d", d_event->Location, ret);
73 + upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error obtaining device description from %s -- error = %d", UpnpDiscovery_get_Location_cstr(d_event), ret);
75 upnp_igd_add_device(igd_ctxt, desc_doc, d_event);
80 case UPNP_DISCOVERY_ADVERTISEMENT_BYEBYE: {
81 - struct Upnp_Discovery *d_event = (struct Upnp_Discovery *)event;
82 - if (d_event->ErrCode != UPNP_E_SUCCESS) {
83 - upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery ByeBye Callback -- %d", d_event->ErrCode);
84 + UpnpDiscovery *d_event = (UpnpDiscovery *)event;
85 + if (UpnpDiscovery_get_ErrCode(d_event) != UPNP_E_SUCCESS) {
86 + upnp_igd_print(igd_ctxt, UPNP_IGD_ERROR, "Error in Discovery ByeBye Callback -- %d", UpnpDiscovery_get_ErrCode(d_event));
88 - upnp_igd_remove_device(igd_ctxt, d_event->DeviceId);
89 + upnp_igd_remove_device(igd_ctxt, UpnpDiscovery_get_DeviceID_cstr(d_event));