netstack.h revision 854956ce2a18fd37e3f6160d38ffb87fdbc2edc4
0N/A * The contents of this file are subject to the terms of the 0N/A * Common Development and Distribution License (the "License"). 0N/A * You may not use this file except in compliance with the License. 0N/A * See the License for the specific language governing permissions 0N/A * and limitations under the License. 0N/A * When distributing Covered Code, include this CDDL HEADER in each 0N/A * If applicable, add the following below this CDDL HEADER, with the 0N/A * fields enclosed by brackets "[]" replaced with your own identifying 0N/A * information: Portions Copyright [yyyy] [name of copyright owner] 0N/A * Copyright 2009 Sun Microsystems, Inc. All rights reserved. 0N/A * Use is subject to license terms. 0N/A * Copyright (c) 2016, Joyent, Inc. All rights reserved. 0N/A * This allows various pieces in and around IP to have a separate instance 0N/A * for each instance of IP. This is used to support zones that have an 0N/A * Pieces of software far removed from IP (e.g., kernel software 0N/A * sitting on top of TCP or UDP) probably should not use the netstack 0N/A * support; if such software wants to support separate zones it 0N/A * can do that using the zones framework (zone_key_create() etc) 0N/A * whether there is a shared IP stack or and exclusive IP stack underneath. 0N/A * Each netstack has an identifier. We reuse the zoneid allocation for 0N/A * this but have a separate typedef. Thus the shared stack (used by 0N/A * the global zone and other shared stack zones) have a zero ID, and 0N/A * the exclusive stacks have a netstackid that is the same as their zoneid. 0N/A * One for each module which uses netstack support. 0N/A * Used in netstack_register(). 0N/A * The order of these is important for some modules both for 0N/A * the creation (which done in ascending order) and destruction (which is 0N/A * done in in decending order). 0N/A * State maintained for each module which tracks the state of 0N/A * the create, shutdown and destroy callbacks. 0N/A * Keeps track of pending actions to avoid holding locks when 0N/A/* User-level compile like IP Filter needs a netstack_t. Dummy */ 0N/A * One for every netstack in the system. 0N/A * We use a union so that the compilar and lint can provide type checking - 0N/A * in principle we could have 0N/A * #define netstack_arp netstack_modules[NS_ARP] 0N/A * etc, but that would imply void * types hence no type checking by the 0N/A * All the fields in netstack_t except netstack_next are protected by 0N/A * netstack_lock. netstack_next is protected by netstack_g_lock. 0N/A /* Needed to ensure that we run the callback functions in order */ 0N/A/* netstack_flags values */ 0N/A * One for each of the NS_* values. 0N/A/* nr_flags values */ 0N/A * To support kstat_create_netstack() using kstat_add_zone we need 0N/A * - all kstats that have been added for the shared stack 0N/A * Register interest in changes to the set of netstacks. 0N/A * The createfn and destroyfn are required, but the shutdownfn can be 0N/A * Note that due to the current zsd implementation, when the create 0N/A * function is called the zone isn't fully present, thus functions 0N/A * like zone_find_by_* will fail, hence the create function can not 0N/A * use many zones kernel functions including zcmn_err(). 0N/A * Simple support for walking all the netstacks. 0N/A * The caller of netstack_next() needs to call netstack_rele() when 0N/A * done with a netstack. 0N/A#
endif /* _SYS_NETSTACK_H */