mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
Integrate obuspa 8.0.1.9.
This commit is contained in:
parent
f161417d64
commit
834921f50b
1 changed files with 10 additions and 10 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
||||||
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_reply_to_t *mrt);
|
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_conn_t *mpc);
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
#ifndef REMOVE_USP_BROKER
|
#ifndef REMOVE_USP_BROKER
|
||||||
|
|
@ -26,12 +26,12 @@
|
||||||
+** This function is used by ValidateUspRecord() to determine whether to process a received USP message
|
+** This function is used by ValidateUspRecord() to determine whether to process a received USP message
|
||||||
+**
|
+**
|
||||||
+** \param endpoint_id - Endpoint ID of controller that sent a USP message
|
+** \param endpoint_id - Endpoint ID of controller that sent a USP message
|
||||||
+** \param mrt - pointer to structure specifying on which MTP the message was received
|
+** \param mpc - pointer to structure specifying on which MTP the message was received
|
||||||
+**
|
+**
|
||||||
+** \return true if the MTP is allowed, false otherwise
|
+** \return true if the MTP is allowed, false otherwise
|
||||||
+**
|
+**
|
||||||
+**************************************************************************/
|
+**************************************************************************/
|
||||||
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_reply_to_t *mrt)
|
+bool DEVICE_CONTROLLER_IsMTPAllowed(char *endpoint_id, mtp_conn_t *mpc)
|
||||||
+{
|
+{
|
||||||
+ controller_t *cont = FindEnabledControllerByEndpointId(endpoint_id);
|
+ controller_t *cont = FindEnabledControllerByEndpointId(endpoint_id);
|
||||||
+ controller_mtp_t *mtp;
|
+ controller_mtp_t *mtp;
|
||||||
|
|
@ -42,18 +42,18 @@
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
+
|
+
|
||||||
+ mtp = FindFirstEnabledMtp(cont, mrt->protocol);
|
+ mtp = FindFirstEnabledMtp(cont, mpc->protocol);
|
||||||
+
|
+
|
||||||
+#ifdef ENABLE_WEBSOCKETS
|
+#ifdef ENABLE_WEBSOCKETS
|
||||||
+ // Allow websocket server if no other MTP is configured
|
+ // Allow websocket server if no other MTP is configured
|
||||||
+ if ((mrt->protocol == kMtpProtocol_WebSockets) && (mrt->wsserv_conn_id != INVALID))
|
+ if ((mpc->protocol == kMtpProtocol_WebSockets) && (mpc->ws.serv_conn_id != INVALID))
|
||||||
+ {
|
+ {
|
||||||
+ return mtp == NULL;
|
+ return mtp == NULL;
|
||||||
+ }
|
+ }
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
+ // Disallow if there is no MTP configured with matching protocol
|
+ // Disallow if there is no MTP configured with matching protocol
|
||||||
+ if ((mtp == NULL) || (mtp->protocol != mrt->protocol))
|
+ if ((mtp == NULL) || (mtp->protocol != mpc->protocol))
|
||||||
+ {
|
+ {
|
||||||
+ return false;
|
+ return false;
|
||||||
+ }
|
+ }
|
||||||
|
|
@ -63,7 +63,7 @@
|
||||||
+ {
|
+ {
|
||||||
+#ifndef DISABLE_STOMP
|
+#ifndef DISABLE_STOMP
|
||||||
+ case kMtpProtocol_STOMP:
|
+ case kMtpProtocol_STOMP:
|
||||||
+ return mtp->stomp_connection_instance == mrt->stomp_instance;
|
+ return mtp->stomp_connection_instance == mpc->stomp.instance;
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
+#ifdef ENABLE_COAP
|
+#ifdef ENABLE_COAP
|
||||||
|
|
@ -73,12 +73,12 @@
|
||||||
+
|
+
|
||||||
+#ifdef ENABLE_MQTT
|
+#ifdef ENABLE_MQTT
|
||||||
+ case kMtpProtocol_MQTT:
|
+ case kMtpProtocol_MQTT:
|
||||||
+ return mtp->mqtt_connection_instance == mrt->mqtt_instance;
|
+ return mtp->mqtt_connection_instance == mpc->mqtt.instance;
|
||||||
+#endif
|
+#endif
|
||||||
+
|
+
|
||||||
+#ifdef ENABLE_WEBSOCKETS
|
+#ifdef ENABLE_WEBSOCKETS
|
||||||
+ case kMtpProtocol_WebSockets:
|
+ case kMtpProtocol_WebSockets:
|
||||||
+ return (mrt->wsclient_cont_instance == cont->instance) && (mrt->wsclient_mtp_instance == mtp->instance);
|
+ return (mpc->ws.client_cont_instance == cont->instance) && (mpc->ws.client_mtp_instance == mtp->instance);
|
||||||
+#endif
|
+#endif
|
||||||
+ default:
|
+ default:
|
||||||
+ TERMINATE_BAD_CASE(mtp->protocol);
|
+ TERMINATE_BAD_CASE(mtp->protocol);
|
||||||
|
|
@ -100,7 +100,7 @@
|
||||||
|
|
||||||
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
+#ifdef OBUSPA_CONTROLLER_MTP_VERIFY
|
||||||
+ // Exit if the controller is not allowed to use the MTP on which the message was received
|
+ // Exit if the controller is not allowed to use the MTP on which the message was received
|
||||||
+ if (DEVICE_CONTROLLER_IsMTPAllowed(rec->from_id, mrt) == false)
|
+ if (DEVICE_CONTROLLER_IsMTPAllowed(rec->from_id, mtpc) == false)
|
||||||
+ {
|
+ {
|
||||||
+ USP_ERR_SetMessage("%s: Ignoring message from endpoint_id=%s (unauthorized MTP)", __FUNCTION__, rec->from_id);
|
+ USP_ERR_SetMessage("%s: Ignoring message from endpoint_id=%s (unauthorized MTP)", __FUNCTION__, rec->from_id);
|
||||||
+ return USP_ERR_PERMISSION_DENIED;
|
+ return USP_ERR_PERMISSION_DENIED;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue