capsules_extra/net/tcp.rs
1// Licensed under the Apache License, Version 2.0 or the MIT License.
2// SPDX-License-Identifier: Apache-2.0 OR MIT
3// Copyright Tock Contributors 2022.
4
5/* Though TCP has not yet been implemented for the Tock Networking stackm
6this file defines the structure of the TCPHeader and TCPPacket structs
7so that TCPPacket can be included for clarity as part of the
8TransportPacket enum */
9
10#[derive(Copy, Clone)]
11pub struct TCPHeader {
12 pub src_port: u16,
13 pub dst_port: u16,
14 pub seq_num: u32,
15 pub ack_num: u32,
16 pub offset_and_control: u16,
17 pub window: u16,
18 pub cksum: u16,
19 pub urg_ptr: u16,
20}
21
22/*
23impl TCPPacket<'a> {
24 pub fn new(buf: &mut [u8]) -> TCPPacket<'a> {
25 let header = TCPHeader {
26 src_port: 0,
27 dst_port: 0,
28 seq_num: 0,
29 ack_num: 0,
30 offset_and_control: 0,
31 window: 0,
32 cksum: 0,
33 urg_ptr: 0,
34 };
35 TCPPacket {
36 head: header,
37 payload: buf,
38 len: 0,
39 }
40 }
41}
42*/