• 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 // Skb IPV4 Protocol Definition, from include/uapi/linux/if_ether.h.
30 constexpr int kEthPIp = 0x800;
31 // Skb IPV6 Protocol Definition, from include/uapi/linux/if_ether.h.
32 constexpr int kEthPIp6 = 0x86DD;
33 // TCP protocol states, from include/net/tcp_states.h.
34 enum {
35   TCP_ESTABLISHED = 1,
36   TCP_SYN_SENT,
37   TCP_SYN_RECV,
38   TCP_FIN_WAIT1,
39   TCP_FIN_WAIT2,
40   TCP_TIME_WAIT,
41   TCP_CLOSE,
42   TCP_CLOSE_WAIT,
43   TCP_LAST_ACK,
44   TCP_LISTEN,
45   TCP_CLOSING,
46   TCP_NEW_SYN_RECV,
47   TCP_MAX_STATES
48 };
49 // TCP protocol state to string mapping.
50 static constexpr const char* const kTcpStateNames[] = {
51     "TCP_UNKNOWN", "TCP_ESTABLISHED", "TCP_SYN_SENT", "TCP_SYN_RECV",
52     "TCP_FIN_WAIT1", "TCP_FIN_WAIT2","TCP_TIME_WAIT", "TCP_CLOSE",
53     "TCP_CLOSE_WAIT","TCP_LAST_ACK", "TCP_LISTEN", "TCP_CLOSING",
54     "TCP_NEW_SYN_RECV","TCP_MAX_STATES"};
55 
56 }  // namespace trace_processor
57 }  // namespace perfetto
58 
59 #endif  // SRC_TRACE_PROCESSOR_TYPES_TCP_STATE_H_
60