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
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
use super::*;
impl<T: TransportPort + 'static> ClientBuilder<T> {
/// Set the independent event notification broadcast channel capacity.
pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
self.options.event_channel_capacity = capacity;
self
}
/// 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 least time, in milliseconds, from the latest confirmed
/// request to a destination finishing to the next being sent (default
/// 0: no pacing; at most an hour). See
/// [`ClientConfig::min_request_interval_ms`].
pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
self.config.min_request_interval_ms = ms;
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 independent event notification broadcast channel capacity.
pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
self.options.event_channel_capacity = capacity;
self
}
/// 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 least time, in milliseconds, from the latest confirmed
/// request to a destination finishing to the next being sent (default
/// 0: no pacing; at most an hour). See
/// [`ClientConfig::min_request_interval_ms`].
pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
self.config.min_request_interval_ms = ms;
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 {
/// Make the client a foreign device of a B/IPv6 BBMD (Annex U.4.5),
/// which then carries its broadcasts. Needs
/// [`Self::device_instance`]; the build fails without one, or when the
/// registration fails [`Bip6ForeignDeviceConfig::check`].
pub fn foreign_device(mut self, config: Bip6ForeignDeviceConfig) -> Self {
self.foreign_device = Some(config);
self
}
/// Set the independent event notification broadcast channel capacity.
pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
self.options.event_channel_capacity = capacity;
self
}
/// 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 least time, in milliseconds, from the latest confirmed
/// request to a destination finishing to the next being sent (default
/// 0: no pacing; at most an hour). See
/// [`ClientConfig::min_request_interval_ms`].
pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
self.config.min_request_interval_ms = ms;
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 independent event notification broadcast channel capacity.
pub fn event_channel_capacity(mut self, capacity: usize) -> Self {
self.options.event_channel_capacity = capacity;
self
}
/// 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 least time, in milliseconds, from the latest confirmed
/// request to a destination finishing to the next being sent (default
/// 0: no pacing; at most an hour). See
/// [`ClientConfig::min_request_interval_ms`].
pub fn min_request_interval_ms(mut self, ms: u64) -> Self {
self.config.min_request_interval_ms = ms;
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
}
}