github.com/inspektor-gadget/inspektor-gadget@v0.28.1/pkg/gadgets/trace/tcpconnect/tracer/bpf/tcpconnect.h (about)

     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 dport;
    18  };
    19  
    20  struct ipv6_flow_key {
    21  	__u8 saddr[16];
    22  	__u8 daddr[16];
    23  	__u16 dport;
    24  };
    25  
    26  struct event {
    27  	union {
    28  		__u8 saddr_v6[16];
    29  		__u32 saddr_v4;
    30  	};
    31  	union {
    32  		__u8 daddr_v6[16];
    33  		__u32 daddr_v4;
    34  	};
    35  	__u8 task[TASK_COMM_LEN];
    36  	__u64 timestamp;
    37  	__u32 pid;
    38  	__u32 uid;
    39  	__u32 gid;
    40  	__u16 af; // AF_INET or AF_INET6
    41  	__u16 dport;
    42  	__u16 sport;
    43  	__u64 mntns_id;
    44  	__u64 latency;
    45  };
    46  
    47  #endif /* __TCPCONNECT_H */