1use broadcast_common::error::BufferTooShort;
14use broadcast_common::len::need_in;
15use broadcast_common::{Parse, Serialize};
16
17use crate::RtmpError;
18use crate::chunk::Message;
19
20type Result<T> = core::result::Result<T, RtmpError>;
21
22pub mod msg_type {
28 pub const SET_CHUNK_SIZE: u8 = 1;
30 pub const ABORT: u8 = 2;
32 pub const ACKNOWLEDGEMENT: u8 = 3;
34 pub const USER_CONTROL: u8 = 4;
36 pub const WINDOW_ACK_SIZE: u8 = 5;
38 pub const SET_PEER_BANDWIDTH: u8 = 6;
40 pub const AUDIO: u8 = 8;
42 pub const VIDEO: u8 = 9;
44 pub const DATA_AMF3: u8 = 15;
46 pub const COMMAND_AMF3: u8 = 17;
48 pub const DATA_AMF0: u8 = 18;
50 pub const COMMAND_AMF0: u8 = 20;
52 pub const AGGREGATE: u8 = 22;
54}
55
56pub const CONTROL_CHUNK_STREAM_ID: u32 = 2;
59pub const CONTROL_MESSAGE_STREAM_ID: u32 = 0;
62
63const U32_LEN: usize = 4;
66const SET_PEER_BANDWIDTH_LEN: usize = U32_LEN + 1;
69
70const SET_CHUNK_SIZE_RESERVED_MASK: u32 = 0x8000_0000;
73const SET_CHUNK_SIZE_VALUE_MASK: u32 = 0x7FFF_FFFF;
76
77fn read_u32_be(b: &[u8]) -> u32 {
78 u32::from_be_bytes([b[0], b[1], b[2], b[3]])
79}
80
81fn need_u32(bytes: &[u8], what: &'static str) -> Result<u32> {
82 if bytes.len() < U32_LEN {
83 return Err(RtmpError::BufferTooShort(BufferTooShort {
84 need: U32_LEN,
85 have: bytes.len(),
86 what,
87 }));
88 }
89 Ok(read_u32_be(bytes))
90}
91
92#[derive(Debug, Clone, Copy, PartialEq, Eq)]
96#[non_exhaustive]
97pub enum LimitType {
98 Hard,
100 Soft,
103 Dynamic,
106}
107
108impl LimitType {
109 #[must_use]
111 pub fn name(&self) -> &'static str {
112 match self {
113 LimitType::Hard => "hard",
114 LimitType::Soft => "soft",
115 LimitType::Dynamic => "dynamic",
116 }
117 }
118
119 pub const fn from_u8(v: u8) -> core::result::Result<Self, RtmpError> {
124 match v {
125 0 => Ok(LimitType::Hard),
126 1 => Ok(LimitType::Soft),
127 2 => Ok(LimitType::Dynamic),
128 _ => Err(RtmpError::Malformed {
129 what: "set peer bandwidth limit type (must be 0..=2)",
130 }),
131 }
132 }
133
134 #[must_use]
136 pub const fn to_u8(self) -> u8 {
137 match self {
138 LimitType::Hard => 0,
139 LimitType::Soft => 1,
140 LimitType::Dynamic => 2,
141 }
142 }
143}
144
145broadcast_common::impl_spec_display!(LimitType);
146
147#[non_exhaustive]
158#[derive(Debug, Clone, Copy, PartialEq, Eq)]
159pub enum ProtocolControl {
160 SetChunkSize(u32),
162 Abort {
165 chunk_stream_id: u32,
168 },
169 Acknowledgement(u32),
171 WindowAckSize(u32),
174 SetPeerBandwidth {
176 ack_window_size: u32,
178 limit_type: LimitType,
180 },
181}
182
183impl ProtocolControl {
184 #[must_use]
186 pub fn name(&self) -> &'static str {
187 match self {
188 ProtocolControl::SetChunkSize(_) => "set chunk size",
189 ProtocolControl::Abort { .. } => "abort message",
190 ProtocolControl::Acknowledgement(_) => "acknowledgement",
191 ProtocolControl::WindowAckSize(_) => "window acknowledgement size",
192 ProtocolControl::SetPeerBandwidth { .. } => "set peer bandwidth",
193 }
194 }
195
196 #[must_use]
198 pub fn message_type_id(&self) -> u8 {
199 match self {
200 ProtocolControl::SetChunkSize(_) => msg_type::SET_CHUNK_SIZE,
201 ProtocolControl::Abort { .. } => msg_type::ABORT,
202 ProtocolControl::Acknowledgement(_) => msg_type::ACKNOWLEDGEMENT,
203 ProtocolControl::WindowAckSize(_) => msg_type::WINDOW_ACK_SIZE,
204 ProtocolControl::SetPeerBandwidth { .. } => msg_type::SET_PEER_BANDWIDTH,
205 }
206 }
207
208 pub fn from_message(message: &Message) -> Result<Option<Self>> {
220 Self::from_payload(message.message_type_id, &message.payload)
221 }
222
223 pub fn from_payload(message_type_id: u8, payload: &[u8]) -> Result<Option<Self>> {
233 match message_type_id {
234 msg_type::SET_CHUNK_SIZE => {
235 let raw = need_u32(payload, "set chunk size payload")?;
236 if raw & SET_CHUNK_SIZE_RESERVED_MASK != 0 {
237 return Err(RtmpError::Malformed {
238 what: "set chunk size reserved top bit (must be 0)",
239 });
240 }
241 let size = raw & SET_CHUNK_SIZE_VALUE_MASK;
242 if size == 0 {
243 return Err(RtmpError::Malformed {
244 what: "set chunk size value (must be >= 1)",
245 });
246 }
247 Ok(Some(ProtocolControl::SetChunkSize(size)))
248 }
249 msg_type::ABORT => {
250 let chunk_stream_id = need_u32(payload, "abort message payload")?;
251 Ok(Some(ProtocolControl::Abort { chunk_stream_id }))
252 }
253 msg_type::ACKNOWLEDGEMENT => {
254 let sequence_number = need_u32(payload, "acknowledgement payload")?;
255 Ok(Some(ProtocolControl::Acknowledgement(sequence_number)))
256 }
257 msg_type::WINDOW_ACK_SIZE => {
258 let window = need_u32(payload, "window acknowledgement size payload")?;
259 Ok(Some(ProtocolControl::WindowAckSize(window)))
260 }
261 msg_type::SET_PEER_BANDWIDTH => {
262 need_in(
263 payload,
264 SET_PEER_BANDWIDTH_LEN,
265 "set peer bandwidth payload",
266 )?;
267 let ack_window_size = read_u32_be(&payload[0..U32_LEN]);
268 let limit_type = LimitType::from_u8(payload[U32_LEN])?;
269 Ok(Some(ProtocolControl::SetPeerBandwidth {
270 ack_window_size,
271 limit_type,
272 }))
273 }
274 _ => Ok(None),
275 }
276 }
277
278 #[must_use]
290 pub fn to_message(&self) -> Message {
291 Message {
292 chunk_stream_id: CONTROL_CHUNK_STREAM_ID,
293 timestamp: 0,
294 message_type_id: self.message_type_id(),
295 message_stream_id: CONTROL_MESSAGE_STREAM_ID,
296 payload: self
297 .try_to_bytes()
298 .expect("documented panic: see `# Panics`; use try_to_message"),
299 }
300 }
301
302 pub fn try_to_message(&self) -> Result<Message> {
310 Ok(Message {
311 chunk_stream_id: CONTROL_CHUNK_STREAM_ID,
312 timestamp: 0,
313 message_type_id: self.message_type_id(),
314 message_stream_id: CONTROL_MESSAGE_STREAM_ID,
315 payload: self.try_to_bytes()?,
316 })
317 }
318}
319
320broadcast_common::impl_spec_display!(ProtocolControl);
321
322impl Serialize for ProtocolControl {
323 type Error = RtmpError;
324
325 fn serialized_len(&self) -> usize {
326 match self {
327 ProtocolControl::SetChunkSize(_)
328 | ProtocolControl::Abort { .. }
329 | ProtocolControl::Acknowledgement(_)
330 | ProtocolControl::WindowAckSize(_) => U32_LEN,
331 ProtocolControl::SetPeerBandwidth { .. } => SET_PEER_BANDWIDTH_LEN,
332 }
333 }
334
335 fn serialize_into(&self, buf: &mut [u8]) -> Result<usize> {
336 let written = self.serialized_len();
337 need_in(buf, written, "protocol control payload output")?;
338 match *self {
339 ProtocolControl::SetChunkSize(size) => {
340 if size == 0 || size & SET_CHUNK_SIZE_RESERVED_MASK != 0 {
341 return Err(RtmpError::Malformed {
342 what: "set chunk size value (must be 1..=0x7FFF_FFFF)",
343 });
344 }
345 buf[0..U32_LEN].copy_from_slice(&size.to_be_bytes());
346 }
347 ProtocolControl::Abort { chunk_stream_id } => {
348 buf[0..U32_LEN].copy_from_slice(&chunk_stream_id.to_be_bytes());
349 }
350 ProtocolControl::Acknowledgement(sequence_number) => {
351 buf[0..U32_LEN].copy_from_slice(&sequence_number.to_be_bytes());
352 }
353 ProtocolControl::WindowAckSize(window) => {
354 buf[0..U32_LEN].copy_from_slice(&window.to_be_bytes());
355 }
356 ProtocolControl::SetPeerBandwidth {
357 ack_window_size,
358 limit_type,
359 } => {
360 buf[0..U32_LEN].copy_from_slice(&ack_window_size.to_be_bytes());
361 buf[U32_LEN] = limit_type.to_u8();
362 }
363 }
364 Ok(written)
365 }
366}
367
368const EVENT_TYPE_LEN: usize = 2;
372
373mod event_type {
375 pub const STREAM_BEGIN: u16 = 0;
376 pub const STREAM_EOF: u16 = 1;
377 pub const STREAM_DRY: u16 = 2;
378 pub const SET_BUFFER_LENGTH: u16 = 3;
379 pub const STREAM_IS_RECORDED: u16 = 4;
380 pub const PING_REQUEST: u16 = 6;
382 pub const PING_RESPONSE: u16 = 7;
383}
384
385#[non_exhaustive]
394#[derive(Debug, Clone, Copy, PartialEq, Eq)]
395pub enum UserControl {
396 StreamBegin(u32),
400 StreamEof(u32),
403 StreamDry(u32),
406 SetBufferLength {
409 stream_id: u32,
411 buffer_ms: u32,
413 },
414 StreamIsRecorded(u32),
417 PingRequest(u32),
420 PingResponse(u32),
423}
424
425impl UserControl {
426 #[must_use]
428 pub fn name(&self) -> &'static str {
429 match self {
430 UserControl::StreamBegin(_) => "stream begin",
431 UserControl::StreamEof(_) => "stream eof",
432 UserControl::StreamDry(_) => "stream dry",
433 UserControl::SetBufferLength { .. } => "set buffer length",
434 UserControl::StreamIsRecorded(_) => "stream is recorded",
435 UserControl::PingRequest(_) => "ping request",
436 UserControl::PingResponse(_) => "ping response",
437 }
438 }
439
440 #[must_use]
442 pub fn event_type(&self) -> u16 {
443 match self {
444 UserControl::StreamBegin(_) => event_type::STREAM_BEGIN,
445 UserControl::StreamEof(_) => event_type::STREAM_EOF,
446 UserControl::StreamDry(_) => event_type::STREAM_DRY,
447 UserControl::SetBufferLength { .. } => event_type::SET_BUFFER_LENGTH,
448 UserControl::StreamIsRecorded(_) => event_type::STREAM_IS_RECORDED,
449 UserControl::PingRequest(_) => event_type::PING_REQUEST,
450 UserControl::PingResponse(_) => event_type::PING_RESPONSE,
451 }
452 }
453
454 #[must_use]
460 pub fn to_message(&self) -> Message {
461 Message {
462 chunk_stream_id: CONTROL_CHUNK_STREAM_ID,
463 timestamp: 0,
464 message_type_id: msg_type::USER_CONTROL,
465 message_stream_id: CONTROL_MESSAGE_STREAM_ID,
466 payload: self
467 .try_to_bytes()
468 .expect("UserControl serialize_into only fails on a short buffer; try_to_bytes sizes it exactly"),
469 }
470 }
471}
472
473broadcast_common::impl_spec_display!(UserControl);
474
475impl<'a> Parse<'a> for UserControl {
476 type Error = RtmpError;
477
478 fn parse(bytes: &'a [u8]) -> Result<Self> {
479 need_in(bytes, EVENT_TYPE_LEN, "user control event type")?;
480 let event = u16::from_be_bytes([bytes[0], bytes[1]]);
481 let data = &bytes[EVENT_TYPE_LEN..];
482 match event {
483 event_type::STREAM_BEGIN => Ok(UserControl::StreamBegin(need_u32(
484 data,
485 "stream begin event data",
486 )?)),
487 event_type::STREAM_EOF => Ok(UserControl::StreamEof(need_u32(
488 data,
489 "stream eof event data",
490 )?)),
491 event_type::STREAM_DRY => Ok(UserControl::StreamDry(need_u32(
492 data,
493 "stream dry event data",
494 )?)),
495 event_type::SET_BUFFER_LENGTH => {
496 need_in(data, 2 * U32_LEN, "set buffer length event data")?;
497 Ok(UserControl::SetBufferLength {
498 stream_id: read_u32_be(&data[0..U32_LEN]),
499 buffer_ms: read_u32_be(&data[U32_LEN..2 * U32_LEN]),
500 })
501 }
502 event_type::STREAM_IS_RECORDED => Ok(UserControl::StreamIsRecorded(need_u32(
503 data,
504 "stream is recorded event data",
505 )?)),
506 event_type::PING_REQUEST => Ok(UserControl::PingRequest(need_u32(
507 data,
508 "ping request event data",
509 )?)),
510 event_type::PING_RESPONSE => Ok(UserControl::PingResponse(need_u32(
511 data,
512 "ping response event data",
513 )?)),
514 _ => Err(RtmpError::Unsupported {
515 what: "user control event type (unrecognised)",
516 }),
517 }
518 }
519}
520
521impl Serialize for UserControl {
522 type Error = RtmpError;
523
524 fn serialized_len(&self) -> usize {
525 let data_len = match self {
526 UserControl::SetBufferLength { .. } => 2 * U32_LEN,
527 _ => U32_LEN,
528 };
529 EVENT_TYPE_LEN + data_len
530 }
531
532 fn serialize_into(&self, buf: &mut [u8]) -> Result<usize> {
533 let written = self.serialized_len();
534 need_in(buf, written, "user control event output")?;
535 buf[0..EVENT_TYPE_LEN].copy_from_slice(&self.event_type().to_be_bytes());
536 let data = &mut buf[EVENT_TYPE_LEN..written];
537 match *self {
538 UserControl::StreamBegin(stream_id)
539 | UserControl::StreamEof(stream_id)
540 | UserControl::StreamDry(stream_id)
541 | UserControl::StreamIsRecorded(stream_id)
542 | UserControl::PingRequest(stream_id)
543 | UserControl::PingResponse(stream_id) => {
544 data[0..U32_LEN].copy_from_slice(&stream_id.to_be_bytes());
545 }
546 UserControl::SetBufferLength {
547 stream_id,
548 buffer_ms,
549 } => {
550 data[0..U32_LEN].copy_from_slice(&stream_id.to_be_bytes());
551 data[U32_LEN..2 * U32_LEN].copy_from_slice(&buffer_ms.to_be_bytes());
552 }
553 }
554 Ok(written)
555 }
556}
557
558#[cfg(test)]
559mod tests {
560 use super::*;
561
562 fn message(message_type_id: u8, payload: Vec<u8>) -> Message {
563 Message {
564 chunk_stream_id: CONTROL_CHUNK_STREAM_ID,
565 timestamp: 0,
566 message_type_id,
567 message_stream_id: CONTROL_MESSAGE_STREAM_ID,
568 payload,
569 }
570 }
571
572 #[test]
575 fn try_to_message_rejects_invalid_chunk_size() {
576 assert!(matches!(
577 ProtocolControl::SetChunkSize(0).try_to_message(),
578 Err(RtmpError::Malformed { .. })
579 ));
580 assert!(
581 ProtocolControl::SetChunkSize(0x8000_0000)
582 .try_to_message()
583 .is_err()
584 );
585 assert_eq!(
586 ProtocolControl::SetChunkSize(4096)
587 .try_to_message()
588 .unwrap(),
589 ProtocolControl::SetChunkSize(4096).to_message()
590 );
591 }
592
593 #[test]
594 fn limit_type_round_trip_and_name() {
595 for (byte, lt, name) in [
596 (0u8, LimitType::Hard, "hard"),
597 (1, LimitType::Soft, "soft"),
598 (2, LimitType::Dynamic, "dynamic"),
599 ] {
600 let parsed = LimitType::from_u8(byte).unwrap();
601 assert_eq!(parsed, lt);
602 assert_eq!(parsed.to_u8(), byte);
603 assert_eq!(parsed.name(), name);
604 assert_eq!(parsed.to_string(), name);
605 }
606 }
607
608 #[test]
609 fn limit_type_out_of_range_is_malformed() {
610 assert!(matches!(
611 LimitType::from_u8(3),
612 Err(RtmpError::Malformed { .. })
613 ));
614 }
615
616 fn protocol_control_round_trip(pc: ProtocolControl) {
619 let bytes = pc.try_to_bytes().unwrap();
620 let parsed = ProtocolControl::from_payload(pc.message_type_id(), &bytes)
621 .unwrap()
622 .expect("known protocol control type id");
623 assert_eq!(parsed, pc);
624
625 let msg = message(pc.message_type_id(), bytes.clone());
627 let via_message = ProtocolControl::from_message(&msg).unwrap().unwrap();
628 assert_eq!(via_message, pc);
629 assert_eq!(via_message.try_to_bytes().unwrap(), bytes);
630 }
631
632 #[test]
633 fn set_chunk_size_round_trips() {
634 protocol_control_round_trip(ProtocolControl::SetChunkSize(4096));
635 }
636
637 #[test]
638 fn abort_round_trips() {
639 protocol_control_round_trip(ProtocolControl::Abort { chunk_stream_id: 7 });
640 }
641
642 #[test]
643 fn acknowledgement_round_trips() {
644 protocol_control_round_trip(ProtocolControl::Acknowledgement(1_048_576));
645 }
646
647 #[test]
648 fn window_ack_size_round_trips() {
649 protocol_control_round_trip(ProtocolControl::WindowAckSize(2_500_000));
650 }
651
652 #[test]
653 fn set_peer_bandwidth_round_trips_every_limit_type() {
654 for limit_type in [LimitType::Hard, LimitType::Soft, LimitType::Dynamic] {
655 protocol_control_round_trip(ProtocolControl::SetPeerBandwidth {
656 ack_window_size: 2_500_000,
657 limit_type,
658 });
659 }
660 }
661
662 #[test]
663 fn set_chunk_size_reserved_top_bit_rejected_on_parse() {
664 let bytes = 0x8000_1000u32.to_be_bytes().to_vec();
665 assert!(matches!(
666 ProtocolControl::from_payload(msg_type::SET_CHUNK_SIZE, &bytes),
667 Err(RtmpError::Malformed { .. })
668 ));
669 }
670
671 #[test]
672 fn set_chunk_size_zero_rejected() {
673 let bytes = 0u32.to_be_bytes().to_vec();
674 assert!(matches!(
675 ProtocolControl::from_payload(msg_type::SET_CHUNK_SIZE, &bytes),
676 Err(RtmpError::Malformed { .. })
677 ));
678 assert!(matches!(
679 ProtocolControl::SetChunkSize(0).serialize_into(&mut [0u8; 4]),
680 Err(RtmpError::Malformed { .. })
681 ));
682 }
683
684 #[test]
685 fn set_chunk_size_serialize_layout_matches_spec() {
686 let bytes = ProtocolControl::SetChunkSize(1).try_to_bytes().unwrap();
688 assert_eq!(bytes, vec![0x00, 0x00, 0x00, 0x01]);
689 }
690
691 #[test]
692 fn set_peer_bandwidth_serialize_layout_matches_spec() {
693 let bytes = ProtocolControl::SetPeerBandwidth {
694 ack_window_size: 0x0002_5000,
695 limit_type: LimitType::Dynamic,
696 }
697 .try_to_bytes()
698 .unwrap();
699 assert_eq!(bytes, vec![0x00, 0x02, 0x50, 0x00, 0x02]);
700 }
701
702 #[test]
703 fn set_peer_bandwidth_wrong_limit_type_mapping_would_fail() {
704 assert_eq!(LimitType::Hard.to_u8(), 0);
706 assert_eq!(LimitType::Dynamic.to_u8(), 2);
707 assert_ne!(LimitType::Hard.to_u8(), LimitType::Dynamic.to_u8());
708 }
709
710 #[test]
711 fn from_message_none_for_non_control_type_id() {
712 let msg = message(msg_type::AUDIO, vec![0u8; 4]);
713 assert!(ProtocolControl::from_message(&msg).unwrap().is_none());
714 }
715
716 #[test]
717 fn from_message_some_for_control_type_id() {
718 let msg = message(
719 msg_type::WINDOW_ACK_SIZE,
720 1_000_000u32.to_be_bytes().to_vec(),
721 );
722 assert!(ProtocolControl::from_message(&msg).unwrap().is_some());
723 }
724
725 #[test]
726 fn to_message_uses_control_csid_and_stream_id() {
727 let msg = ProtocolControl::SetChunkSize(4096).to_message();
728 assert_eq!(msg.chunk_stream_id, CONTROL_CHUNK_STREAM_ID);
729 assert_eq!(msg.message_stream_id, CONTROL_MESSAGE_STREAM_ID);
730 assert_eq!(msg.message_type_id, msg_type::SET_CHUNK_SIZE);
731 }
732
733 #[test]
734 fn protocol_control_display_matches_name() {
735 assert_eq!(
736 ProtocolControl::Acknowledgement(1).to_string(),
737 ProtocolControl::Acknowledgement(1).name()
738 );
739 }
740
741 fn user_control_round_trip(uc: UserControl) {
744 let bytes = uc.try_to_bytes().unwrap();
745 let parsed = UserControl::parse(&bytes).unwrap();
746 assert_eq!(parsed, uc);
747 assert_eq!(parsed.try_to_bytes().unwrap(), bytes);
748 }
749
750 #[test]
751 fn stream_begin_round_trips() {
752 user_control_round_trip(UserControl::StreamBegin(1));
753 }
754
755 #[test]
756 fn stream_begin_serialize_layout_matches_spec() {
757 let bytes = UserControl::StreamBegin(1).try_to_bytes().unwrap();
759 assert_eq!(bytes, vec![0x00, 0x00, 0x00, 0x00, 0x00, 0x01]);
760 }
761
762 #[test]
763 fn stream_eof_round_trips() {
764 user_control_round_trip(UserControl::StreamEof(1));
765 }
766
767 #[test]
768 fn stream_dry_round_trips() {
769 user_control_round_trip(UserControl::StreamDry(1));
770 }
771
772 #[test]
773 fn set_buffer_length_round_trips() {
774 user_control_round_trip(UserControl::SetBufferLength {
775 stream_id: 1,
776 buffer_ms: 3000,
777 });
778 }
779
780 #[test]
781 fn stream_is_recorded_round_trips() {
782 user_control_round_trip(UserControl::StreamIsRecorded(1));
783 }
784
785 #[test]
786 fn ping_request_round_trips() {
787 user_control_round_trip(UserControl::PingRequest(0x1234_5678));
788 }
789
790 #[test]
791 fn ping_response_round_trips() {
792 user_control_round_trip(UserControl::PingResponse(0x1234_5678));
793 }
794
795 #[test]
796 fn unrecognised_event_type_is_unsupported() {
797 let bytes = [0x00, 0x05, 0x00, 0x00, 0x00, 0x01];
799 assert!(matches!(
800 UserControl::parse(&bytes),
801 Err(RtmpError::Unsupported { .. })
802 ));
803 }
804
805 #[test]
806 fn user_control_event_type_wrong_mapping_would_fail() {
807 assert_eq!(UserControl::StreamBegin(0).event_type(), 0);
810 assert_eq!(UserControl::StreamEof(0).event_type(), 1);
811 }
812
813 #[test]
814 fn user_control_display_matches_name() {
815 assert_eq!(
816 UserControl::StreamBegin(1).to_string(),
817 UserControl::StreamBegin(1).name()
818 );
819 }
820
821 #[test]
822 fn to_message_uses_control_csid_and_user_control_type_id() {
823 let msg = UserControl::StreamBegin(1).to_message();
824 assert_eq!(msg.chunk_stream_id, CONTROL_CHUNK_STREAM_ID);
825 assert_eq!(msg.message_stream_id, CONTROL_MESSAGE_STREAM_ID);
826 assert_eq!(msg.message_type_id, msg_type::USER_CONTROL);
827 }
828}