Skip to main content

ua_client/
types.rs

1use opcua::types::{NodeClass, NodeId};
2
3#[derive(Debug, Clone)]
4pub struct TreeChild {
5    pub node_id: NodeId,
6    pub browse_name: String,
7    pub display_name: String,
8    pub node_class: NodeClass,
9    pub has_children: bool,
10}
11
12#[derive(Debug, Clone)]
13pub struct NodeSummary {
14    pub node_id: NodeId,
15    pub attributes: Vec<NodeAttribute>,
16}
17
18#[derive(Debug, Clone)]
19pub struct NodeAttribute {
20    pub name: String,
21    pub value: ValueTree,
22}
23
24#[derive(Debug, Clone)]
25pub enum ValueTree {
26    Null,
27    Leaf(String),
28    Array(Vec<ValueTree>),
29    Object(Vec<(String, ValueTree)>),
30}
31
32#[derive(Debug, Clone)]
33pub struct AuthSpec {
34    pub mode: AuthMode,
35    pub username: String,
36    pub password: String,
37    pub cert_path: String,
38    pub key_path: String,
39}
40
41#[derive(Debug, Clone, Copy, PartialEq, Eq, Default)]
42pub enum AuthMode {
43    #[default]
44    Anonymous,
45    UserName,
46    Certificate,
47}
48
49#[derive(Debug, Clone, Copy, PartialEq, Eq)]
50pub enum SecurityMode {
51    None,
52    Sign,
53    SignAndEncrypt,
54}
55
56impl SecurityMode {
57    pub fn label(self) -> &'static str {
58        match self {
59            SecurityMode::None => "None",
60            SecurityMode::Sign => "Sign",
61            SecurityMode::SignAndEncrypt => "SignAndEncrypt",
62        }
63    }
64}
65
66#[derive(Debug, Clone)]
67pub struct EndpointInfo {
68    pub endpoint_url: String,
69    pub security_policy: String,
70    pub security_policy_uri: String,
71    pub security_mode: SecurityMode,
72    pub security_level: u8,
73    pub supports_anonymous: bool,
74    pub supports_username: bool,
75    pub supports_certificate: bool,
76}
77
78#[derive(Debug, Clone)]
79pub struct ReferenceRow {
80    pub reference_type: String,
81    pub is_forward: bool,
82    pub target_node_id: NodeId,
83    pub target_browse_name: String,
84    pub target_display_name: String,
85    pub target_node_class: NodeClass,
86}
87
88#[derive(Debug, Clone, Copy, PartialEq, Eq)]
89pub enum LogLevel {
90    Error,
91    Warn,
92    Info,
93    Debug,
94    Trace,
95}
96
97#[derive(Debug, Clone)]
98pub struct LogLine {
99    pub level: LogLevel,
100    pub target: String,
101    pub message: String,
102}