rustls/msgs/
ccs.rs

1use crate::msgs::codec::{Codec, Reader};
2
3#[derive(Debug)]
4pub struct ChangeCipherSpecPayload;
5
6impl Codec for ChangeCipherSpecPayload {
7    fn encode(&self, bytes: &mut Vec<u8>) {
8        1u8.encode(bytes);
9    }
10
11    fn read(r: &mut Reader) -> Option<ChangeCipherSpecPayload> {
12        let typ = u8::read(r)?;
13
14        if typ == 1 && !r.any_left() {
15            Some(ChangeCipherSpecPayload {})
16        } else {
17            None
18        }
19    }
20}
21
22impl ChangeCipherSpecPayload {
23    pub fn length(&self) -> usize {
24        1
25    }
26}