/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
* Copyright 2008 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*/
static net_handle_t
{
struct net_data *n;
/*
* If they're trying to find a protocol that is being
* shutdown, just ignore it..
*/
if (n->netd_condemned != 0)
continue;
break;
}
}
return (n);
}
{
return (NULL);
new->netd_condemned = 0;
if (n != NULL) {
return (NULL);
}
} else {
}
return (new);
}
int
{
(void) net_protocol_release(info);
return (0);
}
{
return (NULL);
return (nd);
}
/*
* Note: the man page specifies "returns -1 if the value passed in is unknown
* to this framework". We are not doing a lookup in this function, just a
* simply add to the netd_refcnt of the net_handle_t passed in, so -1 is never a
* return value.
*/
int
{
/*
* Is this safe? No hold on nts_lock? Consider that if the caller
* of net_protocol_release() is going to free this structure then
* it is now the only owner (refcnt==1) and it will have been
* removed from the nts_netd_head list on the neti_stack_t from a
* call to net_protocol_unregister already, so it is thus an orphan.
*/
}
return (0);
}
{
if (found) {
/*
* We are only interested in finding protocols that
* are not in some sort of shutdown state. There is
* no need to check for netd_stack==NULL because
* that implies it is no longer on this list.
*/
if (n->netd_condemned == 0)
continue;
break;
}
if (n == info)
}
(void) net_protocol_release(info);
if (n != NULL)
return (n);
}
/*
* Public accessor functions
*/
int
{
return (-1);
}
int
{
return (-1);
}
int
{
return (-1);
}
int
{
return (-1);
}
int
{
return (-1);
zoneid));
}
int
{
return (-1);
flags));
}
{
return ((phy_if_t)-1);
}
{
return ((phy_if_t)-1);
}
{
return ((lif_if_t)-1);
}
int
{
return (-1);
}
{
return ((phy_if_t)-1);
}
int
{
return (-1);
}
int
{
return (-1);
}
/*
* Hooks related functions
*/
/*
* Function: net_family_register
* Returns: int - 0 = Succ, Else = Fail
* Parameters: info(I) - protocol
* hf(I) - family pointer
*
* Call hook_family_add to register family
*
* There is no need to bump netd_refcnt in the two functions
* net_family_register and net_family_unregister because the caller of these
* two functions is assumed to "own" a reference on 'info' via an earlier
* call to net_protocol_register(). Thus the owner is expected to do a
* call to net_protocol_unregister() after having done a
* net_family_unregister() to make sure things are properly cleaned up.
* Passing a pointer to info->netd_hooks into hook_family_add is required
* so that this can be set before the notify functions are called. If this
* does not happen, the notify function may do something that seems fine,
* like add a notify function to the family but cause a panic because
* netd_hooks is NULL when we get to hook_family_notify_register.
*/
int
{
return (ESHUTDOWN);
return (EEXIST);
return (EEXIST);
return (0);
}
/*
* Function: net_family_unregister
* Returns: int - transparent value, explained by caller
* Parameters: info(I) - protocol
* hf(I) - family pointer
*
* Call hook_family_remove to unregister family
*/
int
{
int ret;
return (ENXIO);
return (EINVAL);
if (ret == 0)
return (ret);
}
int
{
return (ENXIO);
return (EINVAL);
}
/*
* Function: net_event_register
* Returns: internal event pointer - NULL = Fail
* Parameters: info(I) - protocol
* he(I) - event pointer
*
* Call hook_event_add to register event on specific family
* Internal event pointer is returned so caller can get
* handle to run hooks
*/
{
return (NULL);
return ((hook_event_token_t)hei);
}
/*
* Function: net_event_unregister
* Returns: int - transparent value, explained by caller
* Parameters: info(I) - protocol
* he(I) - event pointer
*
* Call hook_event_remove to unregister event on specific family
*/
int
{
return (ENXIO);
}
int
{
return (ENXIO);
}
/*
* Function: net_hook_register
* Returns: int - transparent value, explained by caller
* Parameters: info(I) - protocol
* event(I) - event name
* h(I) - hook pointer
*
*/
int
{
return (ESHUTDOWN);
return (ENXIO);
}
/*
* Function: net_hook_unregister
* Returns: int - transparent value, explained by caller
* Parameters: info(I) - protocol
* event(I) - event name
* h(I) - hook pointer
*
*/
int
{
return (ENXIO);
}
{
return (-1);
}
{
return (NULL);
return (ni);
}
void
{
}
kstat_t *
{
if (stackid == -1)
return (NULL);
}
void
{
if (stackid != -1)
}
int
{
int error;
return (ESHUTDOWN);
return (error);
}
int
{
int error;
callback);
return (error);
}
int
void *arg)
{
int error;
return (ESHUTDOWN);
arg);
return (error);
}
int
{
int error;
return (error);
}