12958Sdr146992 /* 22958Sdr146992 * CDDL HEADER START 32958Sdr146992 * 42958Sdr146992 * The contents of this file are subject to the terms of the 52958Sdr146992 * Common Development and Distribution License (the "License"). 62958Sdr146992 * You may not use this file except in compliance with the License. 72958Sdr146992 * 82958Sdr146992 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 92958Sdr146992 * or http://www.opensolaris.org/os/licensing. 102958Sdr146992 * See the License for the specific language governing permissions 112958Sdr146992 * and limitations under the License. 122958Sdr146992 * 132958Sdr146992 * When distributing Covered Code, include this CDDL HEADER in each 142958Sdr146992 * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 152958Sdr146992 * If applicable, add the following below this CDDL HEADER, with the 162958Sdr146992 * fields enclosed by brackets "[]" replaced with your own identifying 172958Sdr146992 * information: Portions Copyright [yyyy] [name of copyright owner] 182958Sdr146992 * 192958Sdr146992 * CDDL HEADER END 202958Sdr146992 */ 212958Sdr146992 /* 22*10639SDarren.Reed@Sun.COM * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 232958Sdr146992 * Use is subject to license terms. 242958Sdr146992 */ 252958Sdr146992 262958Sdr146992 /* 272958Sdr146992 * This file include definition of message passed from hook provider 282958Sdr146992 * to hook consumer. If necessary, each hook provider can add its 292958Sdr146992 * own message definition here. 302958Sdr146992 */ 312958Sdr146992 322958Sdr146992 #ifndef _SYS_HOOK_EVENT_H 332958Sdr146992 #define _SYS_HOOK_EVENT_H 342958Sdr146992 352958Sdr146992 #include <sys/neti.h> 362958Sdr146992 #include <sys/hook.h> 372958Sdr146992 382958Sdr146992 #ifdef __cplusplus 392958Sdr146992 extern "C" { 402958Sdr146992 #endif 412958Sdr146992 422958Sdr146992 /* 432958Sdr146992 * The hook_pkt_event_t structure is supplied with packet events on 442958Sdr146992 * associated network interfaces. 452958Sdr146992 * 462958Sdr146992 * The members of this structure are defined as follows: 477513SDarren.Reed@Sun.COM * hpe_protocol - protocol identifier that indicates which protocol the 487513SDarren.Reed@Sun.COM * header data is associated with. 492958Sdr146992 * hpe_ifp - "in" interface for packets coming into the system or forwarded 502958Sdr146992 * hpe_ofp - "out" interface for packets being transmitted or forwarded 512958Sdr146992 * hpe_hdr - pointer to protocol header within the packet 522958Sdr146992 * hpe_mp - pointer to the mblk pointer starting the chain for this packet 532958Sdr146992 * hpe_mb - pointer to the mblk that contains hpe_hdr 542958Sdr146992 */ 552958Sdr146992 typedef struct hook_pkt_event { 567513SDarren.Reed@Sun.COM net_handle_t hpe_protocol; 572958Sdr146992 phy_if_t hpe_ifp; 582958Sdr146992 phy_if_t hpe_ofp; 592958Sdr146992 void *hpe_hdr; 602958Sdr146992 mblk_t **hpe_mp; 612958Sdr146992 mblk_t *hpe_mb; 625868Sdr146992 int hpe_flags; 637513SDarren.Reed@Sun.COM void *hpe_reserved[2]; 642958Sdr146992 } hook_pkt_event_t; 652958Sdr146992 665868Sdr146992 #define HPE_MULTICAST 0x01 675868Sdr146992 #define HPE_BROADCAST 0x02 685868Sdr146992 692958Sdr146992 /* 702958Sdr146992 * NIC events hook provider 712958Sdr146992 */ 722958Sdr146992 typedef enum nic_event { 732958Sdr146992 NE_PLUMB = 1, 742958Sdr146992 NE_UNPLUMB, 752958Sdr146992 NE_UP, 762958Sdr146992 NE_DOWN, 778023SPhil.Kirk@Sun.COM NE_ADDRESS_CHANGE, 788023SPhil.Kirk@Sun.COM NE_LIF_UP, 798023SPhil.Kirk@Sun.COM NE_LIF_DOWN 802958Sdr146992 } nic_event_t; 812958Sdr146992 822958Sdr146992 typedef void *nic_event_data_t; 832958Sdr146992 842958Sdr146992 /* 852958Sdr146992 * The hook_nic_event data structure is provided with all network interface 862958Sdr146992 * events. 872958Sdr146992 * 887513SDarren.Reed@Sun.COM * hne_protocol- network protocol for events, returned from net_lookup 892958Sdr146992 * hne_nic - physical interface associated with event 902958Sdr146992 * hne_lif - logical interface (if any) associated with event 912958Sdr146992 * hne_event - type of event occuring 922958Sdr146992 * hne_data - pointer to extra data about event or NULL if none 932958Sdr146992 * hne_datalen - size of data pointed to by hne_data (can be 0) 942958Sdr146992 */ 952958Sdr146992 typedef struct hook_nic_event { 967513SDarren.Reed@Sun.COM net_handle_t hne_protocol; 972958Sdr146992 phy_if_t hne_nic; 982958Sdr146992 lif_if_t hne_lif; 992958Sdr146992 nic_event_t hne_event; 1002958Sdr146992 nic_event_data_t hne_data; 1012958Sdr146992 size_t hne_datalen; 1022958Sdr146992 } hook_nic_event_t; 1032958Sdr146992 1047513SDarren.Reed@Sun.COM /* 1057513SDarren.Reed@Sun.COM * This structure is used internally by ip to queue events. 1067513SDarren.Reed@Sun.COM */ 1077513SDarren.Reed@Sun.COM struct hook_nic_event_int { 1087513SDarren.Reed@Sun.COM netstackid_t hnei_stackid; 1097513SDarren.Reed@Sun.COM hook_nic_event_t hnei_event; 1107513SDarren.Reed@Sun.COM }; 1117513SDarren.Reed@Sun.COM typedef struct hook_nic_event_int hook_nic_event_int_t; 1127513SDarren.Reed@Sun.COM 113*10639SDarren.Reed@Sun.COM /* 114*10639SDarren.Reed@Sun.COM * This structure holds the data passed back from the ip module to 115*10639SDarren.Reed@Sun.COM * observability consumers. 116*10639SDarren.Reed@Sun.COM * 117*10639SDarren.Reed@Sun.COM * Externally exposed fields, that must match the order and size of 118*10639SDarren.Reed@Sun.COM * dl_ipnetinfo_t in <sys/dlpi.h> are: 119*10639SDarren.Reed@Sun.COM * hpo_version Version number for this header 120*10639SDarren.Reed@Sun.COM * hpo_family Address family of the attached packet 121*10639SDarren.Reed@Sun.COM * hpo_htype IPobs hook type 122*10639SDarren.Reed@Sun.COM * hpo_pktlen Length of the attached packet 123*10639SDarren.Reed@Sun.COM * hpo_ifindex Interface index that the packet was received/sent over. 124*10639SDarren.Reed@Sun.COM * For local packets, this is the index of the interface 125*10639SDarren.Reed@Sun.COM * associated with the local destination address. 126*10639SDarren.Reed@Sun.COM * hpo_grifindex IPMP group interface index (zero unless ihd_ifindex 127*10639SDarren.Reed@Sun.COM * is an IPMP underlying interface). 128*10639SDarren.Reed@Sun.COM * hpo_zsrc Source zoneid; set to ALL_ZONES when unknown. 129*10639SDarren.Reed@Sun.COM * hpo_zdst Destination zoneid; set to ALL_ZONES when unknown. 130*10639SDarren.Reed@Sun.COM * 131*10639SDarren.Reed@Sun.COM * Fields used internally are: 132*10639SDarren.Reed@Sun.COM * hpo_pkt Pointer to the mblk_t containig this structure with 133*10639SDarren.Reed@Sun.COM * the real packet found at b_cont 134*10639SDarren.Reed@Sun.COM */ 135*10639SDarren.Reed@Sun.COM typedef struct hook_pkt_observe_s { 136*10639SDarren.Reed@Sun.COM uint8_t hpo_version; 137*10639SDarren.Reed@Sun.COM uint8_t hpo_family; 138*10639SDarren.Reed@Sun.COM uint16_t hpo_htype; 139*10639SDarren.Reed@Sun.COM uint32_t hpo_pktlen; 140*10639SDarren.Reed@Sun.COM uint32_t hpo_ifindex; 141*10639SDarren.Reed@Sun.COM uint32_t hpo_grifindex; 142*10639SDarren.Reed@Sun.COM uint32_t hpo_zsrc; 143*10639SDarren.Reed@Sun.COM uint32_t hpo_zdst; 144*10639SDarren.Reed@Sun.COM /* 145*10639SDarren.Reed@Sun.COM * Fields used internally are below. 146*10639SDarren.Reed@Sun.COM */ 147*10639SDarren.Reed@Sun.COM mblk_t *hpo_pkt; 148*10639SDarren.Reed@Sun.COM void *hpo_ctx; 149*10639SDarren.Reed@Sun.COM } hook_pkt_observe_t; 150*10639SDarren.Reed@Sun.COM 151*10639SDarren.Reed@Sun.COM /* 152*10639SDarren.Reed@Sun.COM * ipobs_hooktype_t describes the hook types supported 153*10639SDarren.Reed@Sun.COM * by the ip module. IPOBS_HOOK_LOCAL refers to packets 154*10639SDarren.Reed@Sun.COM * which are looped back internally within the ip module. 155*10639SDarren.Reed@Sun.COM */ 156*10639SDarren.Reed@Sun.COM 157*10639SDarren.Reed@Sun.COM typedef enum ipobs_hook_type { 158*10639SDarren.Reed@Sun.COM IPOBS_HOOK_INBOUND = 0, 159*10639SDarren.Reed@Sun.COM IPOBS_HOOK_OUTBOUND = 1, 160*10639SDarren.Reed@Sun.COM IPOBS_HOOK_LOCAL = 2 161*10639SDarren.Reed@Sun.COM } ipobs_hook_type_t; 162*10639SDarren.Reed@Sun.COM 163*10639SDarren.Reed@Sun.COM 1642958Sdr146992 #ifdef __cplusplus 1652958Sdr146992 } 1662958Sdr146992 #endif 1672958Sdr146992 1682958Sdr146992 #endif /* _SYS_HOOK_EVENT_H */ 169