A non-transitory computer-readable medium for use in a system operable in any of several system states, each of which is indicated by a current system state indication, the non-transitory computer-readable medium including instructions that, when executed by a processor in the system, cause the processor to: accept incoming messages, bound for a control device, at a first communication interface in data communication with the processor, when the processor has been programmed with a rule-set that includes rules for qualifying and validating the accepted incoming messages for message size and message type, and for validating message contents in the accepted incoming messages, wherein the rule-set includes a system state-dependent rule; process each accepted incoming message by operating the processor to implement the rule-set so as to qualify and validate, on a byte-by-byte basis, each accepted incoming message in accordance with the rule-set, wherein each accepted incoming message is further validated by the system state dependent rule in the rule-set, based on the current system state indication; send only the incoming messages that are qualified and validated based on the rule-set to a second communication interface that is in data communication with the processor for transmission to the control device; accept outgoing messages from the control device at the second communication interface in data communication with the processor; process each accepted outgoing message from the control device by operating the processor to implement the rule-set so as to qualify and validate, on a byte-by-byte basis, wherein each accepted outgoing message in accordance with the rule-set, is further validated by the system state dependent rule in the rule-set, based on the current system state indication; send only the outgoing messages that are qualified and validated based on the rule-set to the first communication interface; update the current system state indication based on any system state information in any validated message; and sanitize incoming messages and outgoing messages that cannot be qualified and validated in accordance with the rule-set by replacing data that are non-compliant with the rule-set with data known to be compliant with the rule-set. accept incoming messages, bound for a control device, at a first communication interface in data communication with the processor, when the processor has been programmed with a rule-set that includes rules for qualifying and validating the accepted incoming messages for message size and message type, and for validating message contents in the accepted incoming messages, wherein the rule-set includes a system state-dependent rule; process each accepted incoming message by operating the processor to implement the rule-set so as to qualify and validate, on a byte-by-byte basis, each accepted incoming message in accordance with the rule-set, wherein each accepted incoming message is further validated by the system state dependent rule in the rule-set, based on the current system state indication; send only the incoming messages that are qualified and validated based on the rule-set to a second communication interface that is in data communication with the processor for transmission to the control device; accept outgoing messages from the control device at the second communication interface in data communication with the processor; process each accepted outgoing message from the control device by operating the processor to implement the rule-set so as to qualify and validate, on a byte-by-byte basis, wherein each accepted outgoing message in accordance with the rule-set, is further validated by the system state dependent rule in the rule-set, based on the current system state indication; send only the outgoing messages that are qualified and validated based on the rule-set to the first communication interface; update the current system state indication based on any system state information in any validated message; and sanitize incoming messages and outgoing messages that cannot be qualified and validated in accordance with the rule-set by replacing data that are non-compliant with the rule-set with data known to be compliant with the rule-set.