• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2022 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 #ifndef SRC_TRACE_PROCESSOR_TYPES_TCP_STATE_H_
18 #define SRC_TRACE_PROCESSOR_TYPES_TCP_STATE_H_
19 
20 namespace perfetto {
21 namespace trace_processor {
22 
23 // Sock IPV4 Protocol Definition, from include/uapi/linux/in.h.
24 constexpr int kAfNet = 2;
25 // Sock IPV6 Protocol Definition, from include/uapi/linux/in.h.
26 constexpr int kAfNet6 = 10;
27 // Sock TCP protocol Definition, from include/uapi/linux/in.h.
28 constexpr int kIpprotoTcp = 6;
29 // Sock UDP protocol Definition, from include/uapi/linux/in.h.
30 constexpr int kIpprotoUdp = 17;
31 // Skb IPV4 Protocol Definition, from include/uapi/linux/if_ether.h.
32 constexpr int kEthPIp = 0x800;
33 // Skb IPV6 Protocol Definition, from include/uapi/linux/if_ether.h.
34 constexpr int kEthPIp6 = 0x86DD;
35 // TCP protocol states, from include/net/tcp_states.h.
36 enum {
37   TCP_ESTABLISHED = 1,
38   TCP_SYN_SENT,
39   TCP_SYN_RECV,
40   TCP_FIN_WAIT1,
41   TCP_FIN_WAIT2,
42   TCP_TIME_WAIT,
43   TCP_CLOSE,
44   TCP_CLOSE_WAIT,
45   TCP_LAST_ACK,
46   TCP_LISTEN,
47   TCP_CLOSING,
48   TCP_NEW_SYN_RECV,
49   TCP_MAX_STATES
50 };
51 // TCP protocol state to string mapping.
52 static constexpr const char* const kTcpStateNames[] = {
53     "TCP_UNKNOWN",      "TCP_ESTABLISHED", "TCP_SYN_SENT",  "TCP_SYN_RECV",
54     "TCP_FIN_WAIT1",    "TCP_FIN_WAIT2",   "TCP_TIME_WAIT", "TCP_CLOSE",
55     "TCP_CLOSE_WAIT",   "TCP_LAST_ACK",    "TCP_LISTEN",    "TCP_CLOSING",
56     "TCP_NEW_SYN_RECV", "TCP_MAX_STATES"};
57 
58 }  // namespace trace_processor
59 }  // namespace perfetto
60 
61 #endif  // SRC_TRACE_PROCESSOR_TYPES_TCP_STATE_H_
62