opcua_types/service_types/
endpoint_configuration.rs

1// OPCUA for Rust
2// SPDX-License-Identifier: MPL-2.0
3// Copyright (C) 2017-2022 Adam Lock
4//
5// This file was autogenerated from Opc.Ua.Types.bsd by tools/schema/gen_types.js
6//
7// DO NOT EDIT THIS FILE
8#![allow(unused_attributes)]
9use std::io::{Read, Write};
10#[allow(unused_imports)]
11use crate::{
12    encoding::*,
13    basic_types::*,
14    service_types::impls::MessageInfo,
15    node_ids::ObjectId,
16};
17
18#[derive(Debug, Clone, PartialEq)]
19pub struct EndpointConfiguration {
20    pub operation_timeout: i32,
21    pub use_binary_encoding: bool,
22    pub max_string_length: i32,
23    pub max_byte_string_length: i32,
24    pub max_array_length: i32,
25    pub max_message_size: i32,
26    pub max_buffer_size: i32,
27    pub channel_lifetime: i32,
28    pub security_token_lifetime: i32,
29}
30
31impl MessageInfo for EndpointConfiguration {
32    fn object_id(&self) -> ObjectId {
33        ObjectId::EndpointConfiguration_Encoding_DefaultBinary
34    }
35}
36
37impl BinaryEncoder<EndpointConfiguration> for EndpointConfiguration {
38    fn byte_len(&self) -> usize {
39        let mut size = 0;
40        size += self.operation_timeout.byte_len();
41        size += self.use_binary_encoding.byte_len();
42        size += self.max_string_length.byte_len();
43        size += self.max_byte_string_length.byte_len();
44        size += self.max_array_length.byte_len();
45        size += self.max_message_size.byte_len();
46        size += self.max_buffer_size.byte_len();
47        size += self.channel_lifetime.byte_len();
48        size += self.security_token_lifetime.byte_len();
49        size
50    }
51
52    #[allow(unused_variables)]
53    fn encode<S: Write>(&self, stream: &mut S) -> EncodingResult<usize> {
54        let mut size = 0;
55        size += self.operation_timeout.encode(stream)?;
56        size += self.use_binary_encoding.encode(stream)?;
57        size += self.max_string_length.encode(stream)?;
58        size += self.max_byte_string_length.encode(stream)?;
59        size += self.max_array_length.encode(stream)?;
60        size += self.max_message_size.encode(stream)?;
61        size += self.max_buffer_size.encode(stream)?;
62        size += self.channel_lifetime.encode(stream)?;
63        size += self.security_token_lifetime.encode(stream)?;
64        Ok(size)
65    }
66
67    #[allow(unused_variables)]
68    fn decode<S: Read>(stream: &mut S, decoding_options: &DecodingOptions) -> EncodingResult<Self> {
69        let operation_timeout = i32::decode(stream, decoding_options)?;
70        let use_binary_encoding = bool::decode(stream, decoding_options)?;
71        let max_string_length = i32::decode(stream, decoding_options)?;
72        let max_byte_string_length = i32::decode(stream, decoding_options)?;
73        let max_array_length = i32::decode(stream, decoding_options)?;
74        let max_message_size = i32::decode(stream, decoding_options)?;
75        let max_buffer_size = i32::decode(stream, decoding_options)?;
76        let channel_lifetime = i32::decode(stream, decoding_options)?;
77        let security_token_lifetime = i32::decode(stream, decoding_options)?;
78        Ok(EndpointConfiguration {
79            operation_timeout,
80            use_binary_encoding,
81            max_string_length,
82            max_byte_string_length,
83            max_array_length,
84            max_message_size,
85            max_buffer_size,
86            channel_lifetime,
87            security_token_lifetime,
88        })
89    }
90}