1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
use super::*;
impl<T: TransportPort + 'static> ClientBuilder<T> {
/// Set the number of APDU retries before a confirmed request times out.
pub fn apdu_retries(mut self, retries: u8) -> Self {
self.config.apdu_retries = retries;
self
}
/// Set the maximum number of APDU segments this client accepts.
///
/// Values 0 and 1 fail at build time. Other finite non-rung values are
/// conservatively rounded down in Confirmed-Request headers.
pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
self.config.max_segments = max_segments;
self
}
/// Set whether this client accepts segmented responses.
pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
self.config.segmented_response_accepted = accepted;
self
}
/// Set the proposed segmented-transfer window size.
pub fn proposed_window_size(mut self, window_size: u8) -> Self {
self.config.proposed_window_size = window_size;
self
}
/// Set the response policy for decoded ConfirmedCOVNotifications.
pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
where
F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
{
self.options = self
.options
.with_confirmed_cov_notification_ack_policy(policy);
self
}
}
impl BipClientBuilder {
/// Set the number of APDU retries before a confirmed request times out.
pub fn apdu_retries(mut self, retries: u8) -> Self {
self.config.apdu_retries = retries;
self
}
/// Set the maximum number of APDU segments this client accepts.
///
/// Values 0 and 1 fail at build time. Other finite non-rung values are
/// conservatively rounded down in Confirmed-Request headers.
pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
self.config.max_segments = max_segments;
self
}
/// Set whether this client accepts segmented responses.
pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
self.config.segmented_response_accepted = accepted;
self
}
/// Set the proposed segmented-transfer window size.
pub fn proposed_window_size(mut self, window_size: u8) -> Self {
self.config.proposed_window_size = window_size;
self
}
/// Set the response policy for decoded ConfirmedCOVNotifications.
pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
where
F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
{
self.options = self
.options
.with_confirmed_cov_notification_ack_policy(policy);
self
}
}
#[cfg(feature = "ipv6")]
impl Bip6ClientBuilder {
/// Set the number of APDU retries before a confirmed request times out.
pub fn apdu_retries(mut self, retries: u8) -> Self {
self.config.apdu_retries = retries;
self
}
/// Set the maximum number of APDU segments this client accepts.
///
/// Values 0 and 1 fail at build time. Other finite non-rung values are
/// conservatively rounded down in Confirmed-Request headers.
pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
self.config.max_segments = max_segments;
self
}
/// Set whether this client accepts segmented responses.
pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
self.config.segmented_response_accepted = accepted;
self
}
/// Set the proposed segmented-transfer window size.
pub fn proposed_window_size(mut self, window_size: u8) -> Self {
self.config.proposed_window_size = window_size;
self
}
/// Set the response policy for decoded ConfirmedCOVNotifications.
pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
where
F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
{
self.options = self
.options
.with_confirmed_cov_notification_ack_policy(policy);
self
}
}
#[cfg(feature = "sc-tls")]
impl ScClientBuilder {
/// Set the number of APDU retries before a confirmed request times out.
pub fn apdu_retries(mut self, retries: u8) -> Self {
self.config.apdu_retries = retries;
self
}
/// Set the maximum number of APDU segments this client accepts.
///
/// Values 0 and 1 fail at build time. Other finite non-rung values are
/// conservatively rounded down in Confirmed-Request headers.
pub fn max_segments(mut self, max_segments: Option<u8>) -> Self {
self.config.max_segments = max_segments;
self
}
/// Set whether this client accepts segmented responses.
pub fn segmented_response_accepted(mut self, accepted: bool) -> Self {
self.config.segmented_response_accepted = accepted;
self
}
/// Set the proposed segmented-transfer window size.
pub fn proposed_window_size(mut self, window_size: u8) -> Self {
self.config.proposed_window_size = window_size;
self
}
/// Set the response policy for decoded ConfirmedCOVNotifications.
pub fn confirmed_cov_notification_ack_policy<F>(mut self, policy: F) -> Self
where
F: Fn(&ReceivedCOVNotification) -> ConfirmedCOVNotificationResponse + Send + Sync + 'static,
{
self.options = self
.options
.with_confirmed_cov_notification_ack_policy(policy);
self
}
}