1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21
22 /*
23 * Copyright 2015 Mohamed A. Khalfella <khalfella@gmail.com>
24 */
25 #ifndef _SYS_PIDNODE_H
26 #define _SYS_PIDNODE_H
27
28 #include <sys/list.h>
29
30 #ifdef __cplusplus
31 extern "C" {
32 #endif
33
34 #define CONN_PID_NODE_LIST_HDR_MAGIC 0x5A7A0B1D
35
36 #define CONN_PID_NODE_LIST_HDR_NON 0
37 #define CONN_PID_NODE_LIST_HDR_SOC 1
38 #define CONN_PID_NODE_LIST_HDR_XTI 2
39 #define CONN_PID_NODE_LIST_HDR_UNX 3
40
41 typedef struct conn_pid_node_s {
42 uint32_t cpn_pid;
43 } conn_pid_node_t;
44
45 typedef struct conn_pid_node_list_hdr_s {
46 uint32_t cph_magic; /* CONN_PID_NODE_LIST_HDR_MAGIC */
47 uint32_t cph_contents; /* CONN_PID_NODE_LIST_HDR_* */
48 uint64_t cph_pn_cnt; /* # of conn_pid_node_t(s) */
49 uint64_t cph_tot_size; /* total size of hdr + nodes */
50 uint32_t cph_flags; /* not used yet */
51 uint32_t cph_optional1; /* an optional field, not used yet */
52 uint64_t cph_optional2; /* an optional field, not used yet */
53 conn_pid_node_t cph_cpns[1]; /* arrary of conn_pid_node_t */
54 } conn_pid_node_list_hdr_t;
55
56 #if defined(_KERNEL)
57
58 typedef struct pid_node_s {
59 list_node_t pn_ref_link;
60 uint32_t pn_count;
61 uint32_t pn_pid;
62 } pid_node_t;
63
64 #endif /* defined(_KERNEL) */
65
66 #define PIDNODE2CONNPIDNODE(pn, cpn) (cpn)->cpn_pid = (pn)->pn_pid
67
68 #ifdef __cplusplus
69 }
70 #endif
71
72 #endif /* _SYS_PIDNODE_H */