xref: /aosp_15_r20/external/bcc/libbpf-tools/tcpconnect.h (revision 387f9dfdfa2baef462e92476d413c7bc2470293e)
1 // SPDX-License-Identifier: GPL-2.0
2 // Copyright (c) 2020 Anton Protopopov
3 #ifndef __TCPCONNECT_H
4 #define __TCPCONNECT_H
5 
6 /* The maximum number of items in maps */
7 #define MAX_ENTRIES 8192
8 
9 /* The maximum number of ports to filter */
10 #define MAX_PORTS 64
11 
12 #define TASK_COMM_LEN 16
13 
14 struct ipv4_flow_key {
15 	__u32 saddr;
16 	__u32 daddr;
17 	__u16 sport;
18 	__u16 dport;
19 };
20 
21 struct ipv6_flow_key {
22 	__u8 saddr[16];
23 	__u8 daddr[16];
24 	__u16 sport;
25 	__u16 dport;
26 };
27 
28 struct event {
29 	union {
30 		__u32 saddr_v4;
31 		__u8 saddr_v6[16];
32 	};
33 	union {
34 		__u32 daddr_v4;
35 		__u8 daddr_v6[16];
36 	};
37 	char task[TASK_COMM_LEN];
38 	__u64 ts_us;
39 	__u32 af; // AF_INET or AF_INET6
40 	__u32 pid;
41 	__u32 uid;
42 	__u16 sport;
43 	__u16 dport;
44 };
45 
46 #endif /* __TCPCONNECT_H */
47