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 /* 2210639SDarren.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, 79*10690SAlexandr.Nedvedicky@Sun.COM NE_LIF_DOWN, 80*10690SAlexandr.Nedvedicky@Sun.COM NE_IFINDEX_CHANGE 812958Sdr146992 } nic_event_t; 822958Sdr146992 832958Sdr146992 typedef void *nic_event_data_t; 842958Sdr146992 852958Sdr146992 /* 862958Sdr146992 * The hook_nic_event data structure is provided with all network interface 872958Sdr146992 * events. 882958Sdr146992 * 897513SDarren.Reed@Sun.COM * hne_protocol- network protocol for events, returned from net_lookup 902958Sdr146992 * hne_nic - physical interface associated with event 912958Sdr146992 * hne_lif - logical interface (if any) associated with event 922958Sdr146992 * hne_event - type of event occuring 932958Sdr146992 * hne_data - pointer to extra data about event or NULL if none 942958Sdr146992 * hne_datalen - size of data pointed to by hne_data (can be 0) 952958Sdr146992 */ 962958Sdr146992 typedef struct hook_nic_event { 977513SDarren.Reed@Sun.COM net_handle_t hne_protocol; 982958Sdr146992 phy_if_t hne_nic; 992958Sdr146992 lif_if_t hne_lif; 1002958Sdr146992 nic_event_t hne_event; 1012958Sdr146992 nic_event_data_t hne_data; 1022958Sdr146992 size_t hne_datalen; 1032958Sdr146992 } hook_nic_event_t; 1042958Sdr146992 1057513SDarren.Reed@Sun.COM /* 1067513SDarren.Reed@Sun.COM * This structure is used internally by ip to queue events. 1077513SDarren.Reed@Sun.COM */ 1087513SDarren.Reed@Sun.COM struct hook_nic_event_int { 1097513SDarren.Reed@Sun.COM netstackid_t hnei_stackid; 1107513SDarren.Reed@Sun.COM hook_nic_event_t hnei_event; 1117513SDarren.Reed@Sun.COM }; 1127513SDarren.Reed@Sun.COM typedef struct hook_nic_event_int hook_nic_event_int_t; 1137513SDarren.Reed@Sun.COM 11410639SDarren.Reed@Sun.COM /* 11510639SDarren.Reed@Sun.COM * This structure holds the data passed back from the ip module to 11610639SDarren.Reed@Sun.COM * observability consumers. 11710639SDarren.Reed@Sun.COM * 11810639SDarren.Reed@Sun.COM * Externally exposed fields, that must match the order and size of 11910639SDarren.Reed@Sun.COM * dl_ipnetinfo_t in <sys/dlpi.h> are: 12010639SDarren.Reed@Sun.COM * hpo_version Version number for this header 12110639SDarren.Reed@Sun.COM * hpo_family Address family of the attached packet 12210639SDarren.Reed@Sun.COM * hpo_htype IPobs hook type 12310639SDarren.Reed@Sun.COM * hpo_pktlen Length of the attached packet 12410639SDarren.Reed@Sun.COM * hpo_ifindex Interface index that the packet was received/sent over. 12510639SDarren.Reed@Sun.COM * For local packets, this is the index of the interface 12610639SDarren.Reed@Sun.COM * associated with the local destination address. 12710639SDarren.Reed@Sun.COM * hpo_grifindex IPMP group interface index (zero unless ihd_ifindex 12810639SDarren.Reed@Sun.COM * is an IPMP underlying interface). 12910639SDarren.Reed@Sun.COM * hpo_zsrc Source zoneid; set to ALL_ZONES when unknown. 13010639SDarren.Reed@Sun.COM * hpo_zdst Destination zoneid; set to ALL_ZONES when unknown. 13110639SDarren.Reed@Sun.COM * 13210639SDarren.Reed@Sun.COM * Fields used internally are: 13310639SDarren.Reed@Sun.COM * hpo_pkt Pointer to the mblk_t containig this structure with 13410639SDarren.Reed@Sun.COM * the real packet found at b_cont 13510639SDarren.Reed@Sun.COM */ 13610639SDarren.Reed@Sun.COM typedef struct hook_pkt_observe_s { 13710639SDarren.Reed@Sun.COM uint8_t hpo_version; 13810639SDarren.Reed@Sun.COM uint8_t hpo_family; 13910639SDarren.Reed@Sun.COM uint16_t hpo_htype; 14010639SDarren.Reed@Sun.COM uint32_t hpo_pktlen; 14110639SDarren.Reed@Sun.COM uint32_t hpo_ifindex; 14210639SDarren.Reed@Sun.COM uint32_t hpo_grifindex; 14310639SDarren.Reed@Sun.COM uint32_t hpo_zsrc; 14410639SDarren.Reed@Sun.COM uint32_t hpo_zdst; 14510639SDarren.Reed@Sun.COM /* 14610639SDarren.Reed@Sun.COM * Fields used internally are below. 14710639SDarren.Reed@Sun.COM */ 14810639SDarren.Reed@Sun.COM mblk_t *hpo_pkt; 14910639SDarren.Reed@Sun.COM void *hpo_ctx; 15010639SDarren.Reed@Sun.COM } hook_pkt_observe_t; 15110639SDarren.Reed@Sun.COM 15210639SDarren.Reed@Sun.COM /* 15310639SDarren.Reed@Sun.COM * ipobs_hooktype_t describes the hook types supported 15410639SDarren.Reed@Sun.COM * by the ip module. IPOBS_HOOK_LOCAL refers to packets 15510639SDarren.Reed@Sun.COM * which are looped back internally within the ip module. 15610639SDarren.Reed@Sun.COM */ 15710639SDarren.Reed@Sun.COM 15810639SDarren.Reed@Sun.COM typedef enum ipobs_hook_type { 15910639SDarren.Reed@Sun.COM IPOBS_HOOK_INBOUND = 0, 16010639SDarren.Reed@Sun.COM IPOBS_HOOK_OUTBOUND = 1, 16110639SDarren.Reed@Sun.COM IPOBS_HOOK_LOCAL = 2 16210639SDarren.Reed@Sun.COM } ipobs_hook_type_t; 16310639SDarren.Reed@Sun.COM 16410639SDarren.Reed@Sun.COM 1652958Sdr146992 #ifdef __cplusplus 1662958Sdr146992 } 1672958Sdr146992 #endif 1682958Sdr146992 1692958Sdr146992 #endif /* _SYS_HOOK_EVENT_H */ 170