1 /* 2 * This file and its contents are supplied under the terms of the 3 * Common Development and Distribution License ("CDDL"), version 1.0. 4 * You may only use this file in accordance with the terms of version 5 * 1.0 of the CDDL. 6 * 7 * A full copy of the text of the CDDL should have accompanied this 8 * source. A copy of the CDDL is also available via the Internet at 9 * http://www.illumos.org/license/CDDL. 10 */ 11 12 /* 13 * Copyright 2015 Mohamed A. Khalfella <khalfella@gmail.com> 14 */ 15 16 #ifndef _SYS_PIDNODE_H 17 #define _SYS_PIDNODE_H 18 19 #include <sys/avl.h> 20 21 #ifdef __cplusplus 22 extern "C" { 23 #endif 24 25 /* 26 * Network connections initiated/accepted by user processes are either 27 * socket based connections or stream-bases connections. conn_pid_info_t 28 * expose the type of the connection in the cpi_contents field. 29 */ 30 31 #define CONN_PID_INFO_NON 0 /* terminated process/kernel sockets */ 32 #define CONN_PID_INFO_SOC 1 /* socket netwrok connection */ 33 #define CONN_PID_INFO_XTI 2 /* stream network connection */ 34 35 typedef struct conn_pid_info_s { 36 uint16_t cpi_contents; /* CONN_PID_INFO_* */ 37 uint32_t cpi_pids_cnt; /* # of elements in cpi_pids */ 38 uint32_t cpi_tot_size; /* total size of hdr + pids */ 39 pid_t cpi_pids[1]; /* variable length array of pids */ 40 } conn_pid_info_t; 41 42 #if defined(_KERNEL) 43 44 typedef struct pid_node_s { 45 avl_node_t pn_ref_link; 46 uint32_t pn_count; 47 pid_t pn_pid; 48 } pid_node_t; 49 50 extern int pid_node_comparator(const void *, const void *); 51 52 #endif /* defined(_KERNEL) */ 53 54 #ifdef __cplusplus 55 } 56 #endif 57 58 #endif /* _SYS_PIDNODE_H */