From aa04e0c64f58a7bb399361821e26cf089482a37b Mon Sep 17 00:00:00 2001 From: roleo Date: Mon, 9 Sep 2024 19:45:23 +0200 Subject: [PATCH] Rename pull and push --- README.md | 2 +- conf.c | 6 +- device_service.c | 68 +++++++++---------- .../GetCapabilities_no_ptz.xml | 4 +- device_service_files/GetCapabilities_ptz.xml | 4 +- .../GetEventsCapabilities.xml | 4 +- .../GetServices_with_capabilities_no_ptz.xml | 4 +- .../GetServices_with_capabilities_ptz.xml | 4 +- events_service.c | 22 +++--- .../GetServiceCapabilities.xml | 4 +- utils.h | 6 +- 11 files changed, 64 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index 6feca90..666172c 100644 --- a/README.md +++ b/README.md @@ -195,7 +195,7 @@ Brief explanation of some parameters: | ptz | 1 if onvif_simple_server can control PTZ, 0 otherwise | | max_step_* | max values of x and y movements reported by the cam (min = 0) | | move_* | the binary that moves the PTZ controls, onvif_simple_server will run it with a system call | -| events | set to 1 to enable ONVIF PullPoint, 2 to enable WS Base Notification or 3 to enable both | +| events | set to 1 to enable PullPoint, 2 to enable Base Subscription or 3 to enable both | | topic | the topic of the event | | source_name | the source name inside the Notify message | | source_value | the source value inside the Notify message | diff --git a/conf.c b/conf.c index 290cc8a..74783a3 100644 --- a/conf.c +++ b/conf.c @@ -371,11 +371,11 @@ int process_conf_file(char *file) //Events Profile for ONVIF Events Service } else if (strcasecmp(param, "events") == 0) { if (strcasecmp(value, "1") == 0) { - service_ctx.events_enable = EVENTS_PULL; // Pull + service_ctx.events_enable = EVENTS_PULLPOINT; // PullPoint } else if (strcasecmp(value, "2") == 0) { - service_ctx.events_enable = EVENTS_PUSH; // WS Base + service_ctx.events_enable = EVENTS_BASESUBSCRIPTION; // Base Subscription } else if (strcasecmp(value, "3") == 0) { - service_ctx.events_enable = EVENTS_BOTH; // Pull and WS Base + service_ctx.events_enable = EVENTS_BOTH; // PullPoint and Base Subscription } } else if (strcasecmp(param, "topic") == 0) { if (service_ctx.events_enable != EVENTS_NONE) { diff --git a/device_service.c b/device_service.c index ffeabf9..5ccc8c4 100644 --- a/device_service.c +++ b/device_service.c @@ -43,7 +43,7 @@ int device_get_services() char port[8]; const char *cap; - char epush[8], epull[8]; + char ebasesubscription[8], epullpoint[8]; port[0] = '\0'; if (service_ctx.port != 80) @@ -53,15 +53,15 @@ int device_get_services() sprintf(ptz_service_address, "http://%s%s/onvif/ptz_service", address, port); sprintf(events_service_address, "http://%s%s/onvif/events_service", address, port); - if ((service_ctx.events_enable == EVENTS_PULL) || (service_ctx.events_enable == EVENTS_BOTH)) { - strcpy(epull, "true"); + if ((service_ctx.events_enable == EVENTS_PULLPOINT) || (service_ctx.events_enable == EVENTS_BOTH)) { + strcpy(epullpoint, "true"); } else { - strcpy(epull, "false"); + strcpy(epullpoint, "false"); } - if ((service_ctx.events_enable == EVENTS_PUSH) || (service_ctx.events_enable == EVENTS_BOTH)) { - strcpy(epush, "true"); + if ((service_ctx.events_enable == EVENTS_BASESUBSCRIPTION) || (service_ctx.events_enable == EVENTS_BOTH)) { + strcpy(ebasesubscription, "true"); } else { - strcpy(epush, "false"); + strcpy(ebasesubscription, "false"); } cap = get_element("IncludeCapability", "Body"); @@ -71,8 +71,8 @@ int device_get_services() "%DEVICE_SERVICE_ADDRESS%", device_service_address, "%MEDIA_SERVICE_ADDRESS%", media_service_address, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); fprintf(stdout, "Content-type: application/soap+xml\r\n"); fprintf(stdout, "Content-Length: %ld\r\n\r\n", size); @@ -81,16 +81,16 @@ int device_get_services() "%DEVICE_SERVICE_ADDRESS%", device_service_address, "%MEDIA_SERVICE_ADDRESS%", media_service_address, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); } else { long size = cat(NULL, "device_service_files/GetServices_with_capabilities_ptz.xml", 12, "%DEVICE_SERVICE_ADDRESS%", device_service_address, "%MEDIA_SERVICE_ADDRESS%", media_service_address, "%PTZ_SERVICE_ADDRESS%", ptz_service_address, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); fprintf(stdout, "Content-type: application/soap+xml\r\n"); fprintf(stdout, "Content-Length: %ld\r\n\r\n", size); @@ -100,8 +100,8 @@ int device_get_services() "%MEDIA_SERVICE_ADDRESS%", media_service_address, "%PTZ_SERVICE_ADDRESS%", ptz_service_address, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); } } else { if (service_ctx.ptz_node.enable == 0) { @@ -292,7 +292,7 @@ int device_get_capabilities() int icategory; const char *category; - char epush[8], epull[8]; + char ebasesubscription[8], epullpoint[8]; category = get_element("Category", "Body"); if (category != NULL) { @@ -322,15 +322,15 @@ int device_get_capabilities() sprintf(ptz_service_address, "http://%s%s/onvif/ptz_service", address, port); sprintf(events_service_address, "http://%s%s/onvif/events_service", address, port); - if ((service_ctx.events_enable == EVENTS_PULL) || (service_ctx.events_enable == EVENTS_BOTH)) { - strcpy(epull, "true"); + if ((service_ctx.events_enable == EVENTS_PULLPOINT) || (service_ctx.events_enable == EVENTS_BOTH)) { + strcpy(epullpoint, "true"); } else { - strcpy(epull, "false"); + strcpy(epullpoint, "false"); } - if ((service_ctx.events_enable == EVENTS_PUSH) || (service_ctx.events_enable == EVENTS_BOTH)) { - strcpy(epush, "true"); + if ((service_ctx.events_enable == EVENTS_BASESUBSCRIPTION) || (service_ctx.events_enable == EVENTS_BOTH)) { + strcpy(ebasesubscription, "true"); } else { - strcpy(epush, "false"); + strcpy(ebasesubscription, "false"); } if (icategory == 1) { @@ -368,24 +368,24 @@ int device_get_capabilities() } else if (icategory == 8) { long size = cat(NULL, "device_service_files/GetEventsCapabilities.xml", 6, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); fprintf(stdout, "Content-type: application/soap+xml\r\n"); fprintf(stdout, "Content-Length: %ld\r\n\r\n", size); return cat("stdout", "device_service_files/GetEventsCapabilities.xml", 6, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); } else { if (service_ctx.ptz_node.enable == 0) { long size = cat(NULL, "device_service_files/GetCapabilities_no_ptz.xml", 10, "%DEVICE_SERVICE_ADDRESS%", device_service_address, "%MEDIA_SERVICE_ADDRESS%", media_service_address, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); fprintf(stdout, "Content-type: application/soap+xml\r\n"); fprintf(stdout, "Content-Length: %ld\r\n\r\n", size); @@ -394,16 +394,16 @@ int device_get_capabilities() "%DEVICE_SERVICE_ADDRESS%", device_service_address, "%MEDIA_SERVICE_ADDRESS%", media_service_address, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); } else { long size = cat(NULL, "device_service_files/GetCapabilities_ptz.xml", 12, "%DEVICE_SERVICE_ADDRESS%", device_service_address, "%MEDIA_SERVICE_ADDRESS%", media_service_address, "%PTZ_SERVICE_ADDRESS%", ptz_service_address, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); fprintf(stdout, "Content-type: application/soap+xml\r\n"); fprintf(stdout, "Content-Length: %ld\r\n\r\n", size); @@ -413,8 +413,8 @@ int device_get_capabilities() "%MEDIA_SERVICE_ADDRESS%", media_service_address, "%PTZ_SERVICE_ADDRESS%", ptz_service_address, "%EVENTS_SERVICE_ADDRESS%", events_service_address, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); } } } diff --git a/device_service_files/GetCapabilities_no_ptz.xml b/device_service_files/GetCapabilities_no_ptz.xml index 493c28a..32a6762 100644 --- a/device_service_files/GetCapabilities_no_ptz.xml +++ b/device_service_files/GetCapabilities_no_ptz.xml @@ -71,8 +71,8 @@ %EVENTS_SERVICE_ADDRESS% - %EVENTS_PUSH% - %EVENTS_PULL% + %EVENTS_BASESUBSCRIPTION% + %EVENTS_PULLPOINT% false diff --git a/device_service_files/GetCapabilities_ptz.xml b/device_service_files/GetCapabilities_ptz.xml index bb0e1d3..b9b39c9 100644 --- a/device_service_files/GetCapabilities_ptz.xml +++ b/device_service_files/GetCapabilities_ptz.xml @@ -71,8 +71,8 @@ %EVENTS_SERVICE_ADDRESS% - %EVENTS_PUSH% - %EVENTS_PULL% + %EVENTS_BASESUBSCRIPTION% + %EVENTS_PULLPOINT% false diff --git a/device_service_files/GetEventsCapabilities.xml b/device_service_files/GetEventsCapabilities.xml index 6247d5c..a519e3a 100644 --- a/device_service_files/GetEventsCapabilities.xml +++ b/device_service_files/GetEventsCapabilities.xml @@ -28,8 +28,8 @@ %EVENTS_SERVICE_ADDRESS% - %EVENTS_PUSH% - %EVENTS_PULL% + %EVENTS_BASESUBSCRIPTION% + %EVENTS_PULLPOINT% false diff --git a/device_service_files/GetServices_with_capabilities_no_ptz.xml b/device_service_files/GetServices_with_capabilities_no_ptz.xml index cc88fc5..1df58ad 100644 --- a/device_service_files/GetServices_with_capabilities_no_ptz.xml +++ b/device_service_files/GetServices_with_capabilities_no_ptz.xml @@ -111,8 +111,8 @@ xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - WSSubscriptionPolicySupport="%EVENTS_PUSH%" - WSPullPointSupport="%EVENTS_PULL%" + WSSubscriptionPolicySupport="%EVENTS_BASESUBSCRIPTION%" + WSPullPointSupport="%EVENTS_PULLPOINT%" WSPausableSubscriptionManagerInterfaceSupport="false"> diff --git a/device_service_files/GetServices_with_capabilities_ptz.xml b/device_service_files/GetServices_with_capabilities_ptz.xml index 38acf8c..1ea2ce6 100644 --- a/device_service_files/GetServices_with_capabilities_ptz.xml +++ b/device_service_files/GetServices_with_capabilities_ptz.xml @@ -113,8 +113,8 @@ xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - WSSubscriptionPolicySupport="%EVENTS_PUSH%" - WSPullPointSupport="%EVENTS_PULL%" + WSSubscriptionPolicySupport="%EVENTS_BASESUBSCRIPTION%" + WSPullPointSupport="%EVENTS_PULLPOINT%" WSPausableSubscriptionManagerInterfaceSupport="false"> diff --git a/events_service.c b/events_service.c index c977f48..2991eed 100644 --- a/events_service.c +++ b/events_service.c @@ -35,29 +35,29 @@ shm_t *subs_evts; int events_get_service_capabilities() { - char epush[8], epull[8]; + char ebasesubscription[8], epullpoint[8]; - if ((service_ctx.events_enable == EVENTS_PULL) || (service_ctx.events_enable == EVENTS_BOTH)) { - strcpy(epull, "true"); + if ((service_ctx.events_enable == EVENTS_PULLPOINT) || (service_ctx.events_enable == EVENTS_BOTH)) { + strcpy(epullpoint, "true"); } else { - strcpy(epull, "false"); + strcpy(epullpoint, "false"); } - if ((service_ctx.events_enable == EVENTS_PUSH) || (service_ctx.events_enable == EVENTS_BOTH)) { - strcpy(epush, "true"); + if ((service_ctx.events_enable == EVENTS_BASESUBSCRIPTION) || (service_ctx.events_enable == EVENTS_BOTH)) { + strcpy(ebasesubscription, "true"); } else { - strcpy(epush, "false"); + strcpy(ebasesubscription, "false"); } long size = cat(NULL, "events_service_files/GetServiceCapabilities.xml", 4, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); fprintf(stdout, "Content-type: application/soap+xml\r\n"); fprintf(stdout, "Content-Length: %ld\r\n\r\n", size); return cat("stdout", "events_service_files/GetServiceCapabilities.xml", 4, - "%EVENTS_PUSH%", epush, - "%EVENTS_PULL%", epull); + "%EVENTS_BASESUBSCRIPTION%", ebasesubscription, + "%EVENTS_PULLPOINT%", epullpoint); } int events_create_pull_point_subscription() diff --git a/events_service_files/GetServiceCapabilities.xml b/events_service_files/GetServiceCapabilities.xml index c5713b5..1a81df3 100644 --- a/events_service_files/GetServiceCapabilities.xml +++ b/events_service_files/GetServiceCapabilities.xml @@ -44,8 +44,8 @@ xmlns:xenc="http://www.w3.org/2001/04/xmlenc#" xmlns:wsc="http://docs.oasis-open.org/ws-sx/ws-secureconversation/200512" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" - WSSubscriptionPolicySupport="%EVENTS_PUSH%" - WSPullPointSupport="%EVENTS_PULL%" + WSSubscriptionPolicySupport="%EVENTS_BASESUBSCRIPTION%" + WSPullPointSupport="%EVENTS_PULLPOINT%" WSPausableSubscriptionManagerInterfaceSupport="false"> diff --git a/utils.h b/utils.h index 646506b..55a4bd2 100644 --- a/utils.h +++ b/utils.h @@ -31,9 +31,9 @@ #define CONSUMER_REFERENCE_MAX_SIZE 256 #define EVENTS_NONE 0 -#define EVENTS_PULL 1 -#define EVENTS_PUSH 2 -#define EVENTS_BOTH 3 +#define EVENTS_PULLPOINT 1 // PullPoint +#define EVENTS_BASESUBSCRIPTION 2 // Base Subscription +#define EVENTS_BOTH 3 // PullPoint and Base Subscription typedef enum { SUB_UNUSED,