blob: a9b6fe07aab276275b0df045aab89dedaef47a00 [file] [log] [blame]
Elliott Hughesb4a9b172023-11-28 15:41:54 -08001/*
2 * Copyright (C) 2008 The Android Open Source Project
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
7 * are met:
8 * * Redistributions of source code must retain the above copyright
9 * notice, this list of conditions and the following disclaimer.
10 * * Redistributions in binary form must reproduce the above copyright
11 * notice, this list of conditions and the following disclaimer in
12 * the documentation and/or other materials provided with the
13 * distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
16 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
17 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
18 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
19 * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
20 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
21 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
22 * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
23 * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
24 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
25 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE.
27 */
28
29#pragma once
30
31#include <sys/cdefs.h>
32#include <stdint.h>
33
34__BEGIN_DECLS
35
36struct tcphdr {
37 __extension__ union {
38 struct {
39 uint16_t th_sport;
40 uint16_t th_dport;
41 uint32_t th_seq;
42 uint32_t th_ack;
43 uint8_t th_x2:4;
44 uint8_t th_off:4;
45 uint8_t th_flags;
46 uint16_t th_win;
47 uint16_t th_sum;
48 uint16_t th_urp;
49 };
50 struct {
51 uint16_t source;
52 uint16_t dest;
53 uint32_t seq;
54 uint32_t ack_seq;
55 uint16_t res1:4;
56 uint16_t doff:4;
57 uint16_t fin:1;
58 uint16_t syn:1;
59 uint16_t rst:1;
60 uint16_t psh:1;
61 uint16_t ack:1;
62 uint16_t urg:1;
63 uint16_t res2:2;
64 uint16_t window;
65 uint16_t check;
66 uint16_t urg_ptr;
67 };
68 };
69};
70
71__END_DECLS