LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Protecting Shared Variable write access: only one VI can write to Shared Variable

Solved!
Go to solution

Hi folks,

 

Looking for some guidance for a security measure I am trying to implement for Shared Variables on our cRIO-9035. We only want 1 VI (a Supervisor VI) to be able to write sensitive data to a Shared Variable that will be used across other VIs. Other VIs may read the data and make copies of the data, but only the Supervisor has write access.

 

Has anyone implemented a structure like this before? I can't find many resources on protecting Shared Variables, was hoping for some guidance on this.

 

Thanks!

0 Kudos
Message 1 of 3
(286 Views)

@JVH8SLV wrote:

Has anyone implemented a structure like this before? I can't find many resources on protecting Shared Variables, was hoping for some guidance on this.


Assuming you are talking about only communications within a single application, your best bet would be to make a Global Variable that is set to private in the same library as your Supervisor VI.  Then only VIs within that library can read or write that variable.  You then make an accessor VI, still in the same library, that is public that the rest of the code and use to read the value.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 2 of 3
(276 Views)
Solution
Accepted by topic author JVH8SLV

If you're using a network shared variable I don't think there' s a way to prevent multiple writers. I think the best you could do in software was write some proxy which only exposes a read method and pass that to your other VIs.

 

Somewhat similar to what crossrulz was saying to do with the global, you would just need to create a class with the shared variable reference in its private data and only expose Open/Read/Close as public methods. Then any subVI which receives this class can read from the shared variable but it doesn't have direct access to the underlying reference to write to it.

Matt J | National Instruments | CLA
0 Kudos
Message 3 of 3
(264 Views)