X-Git-Url: https://git.saurik.com/apple/xnu.git/blobdiff_plain/8ad349bb6ed4a0be06e34c92be0d98b92e078db4..6d2010ae8f7a6078e10b361c6962983bab233e0f:/bsd/net/kpi_protocol.h diff --git a/bsd/net/kpi_protocol.h b/bsd/net/kpi_protocol.h index 60dee09d5..46877b8be 100644 --- a/bsd/net/kpi_protocol.h +++ b/bsd/net/kpi_protocol.h @@ -1,31 +1,29 @@ /* - * Copyright (c) 2006 Apple Computer, Inc. All Rights Reserved. + * Copyright (c) 2008 Apple Computer, Inc. All rights reserved. + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_START@ * - * @APPLE_LICENSE_OSREFERENCE_HEADER_START@ + * This file contains Original Code and/or Modifications of Original Code + * as defined in and that are subject to the Apple Public Source License + * Version 2.0 (the 'License'). You may not use this file except in + * compliance with the License. The rights granted to you under the License + * may not be used to create, or enable the creation or redistribution of, + * unlawful or unlicensed copies of an Apple operating system, or to + * circumvent, violate, or enable the circumvention or violation of, any + * terms of an Apple operating system software license agreement. * - * This file contains Original Code and/or Modifications of Original Code - * as defined in and that are subject to the Apple Public Source License - * Version 2.0 (the 'License'). You may not use this file except in - * compliance with the License. The rights granted to you under the - * License may not be used to create, or enable the creation or - * redistribution of, unlawful or unlicensed copies of an Apple operating - * system, or to circumvent, violate, or enable the circumvention or - * violation of, any terms of an Apple operating system software license - * agreement. - * - * Please obtain a copy of the License at - * http://www.opensource.apple.com/apsl/ and read it before using this - * file. - * - * The Original Code and all software distributed under the License are - * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER - * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, - * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, - * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. - * Please see the License for the specific language governing rights and + * Please obtain a copy of the License at + * http://www.opensource.apple.com/apsl/ and read it before using this file. + * + * The Original Code and all software distributed under the License are + * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER + * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES, + * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT. + * Please see the License for the specific language governing rights and * limitations under the License. - * - * @APPLE_LICENSE_OSREFERENCE_HEADER_END@ + * + * @APPLE_OSREFERENCE_LICENSE_HEADER_END@ */ /*! @header kpi_protocol.h @@ -44,9 +42,9 @@ __BEGIN_DECLS -/****************************************************************************/ -/* Protocol input/inject */ -/****************************************************************************/ +/******************************************************************************/ +/* Protocol input/inject */ +/******************************************************************************/ #ifdef KERNEL_PRIVATE /*! @@ -76,10 +74,12 @@ typedef void (*proto_input_detached_handler)(protocol_family_t protocol); @param protocol The protocol family these functions will receive packets for. @param input The function called when a packet is input. + @param chains Input function supports packet chains. @result A errno error on failure. */ -errno_t proto_register_input(protocol_family_t protocol, proto_input_handler input, - proto_input_detached_handler detached); +extern errno_t proto_register_input(protocol_family_t protocol, + proto_input_handler input, proto_input_detached_handler detached, + int chains); /*! @function proto_unregister_input @@ -96,8 +96,8 @@ errno_t proto_register_input(protocol_family_t protocol, proto_input_handler inp on the normal input path). @result A errno error on failure. */ -void proto_unregister_input(protocol_family_t protocol); -#endif +extern void proto_unregister_input(protocol_family_t protocol); +#endif /* KERNEL_PRIVATE */ /*! @function proto_input @@ -108,7 +108,7 @@ void proto_unregister_input(protocol_family_t protocol); @result A errno error on failure. Unless proto_input returns zero, the caller is responsible for freeing the mbuf. */ -errno_t proto_input(protocol_family_t protocol, mbuf_t packet); +extern errno_t proto_input(protocol_family_t protocol, mbuf_t packet); /*! @function proto_inject @@ -120,12 +120,12 @@ errno_t proto_input(protocol_family_t protocol, mbuf_t packet); @result A errno error on failure. Unless proto_inject returns zero, the caller is responsible for freeing the mbuf. */ -errno_t proto_inject(protocol_family_t protocol, mbuf_t packet); +extern errno_t proto_inject(protocol_family_t protocol, mbuf_t packet); -/****************************************************************************/ -/* Protocol plumbing */ -/****************************************************************************/ +/******************************************************************************/ +/* Protocol plumbing */ +/******************************************************************************/ /*! @typedef proto_plumb_handler @@ -153,9 +153,9 @@ typedef void (*proto_unplumb_handler)(ifnet_t ifp, protocol_family_t protocol); /*! @function proto_register_plumber - @discussion Allows the caller to specify the functions called when a protocol - is attached to an interface belonging to the specified family and when - that protocol is detached. + @discussion Allows the caller to specify the functions called when a + protocol is attached to an interface belonging to the specified + family and when that protocol is detached. @param proto_fam The protocol family these plumbing functions will handle. @param if_fam The interface family these plumbing functions will @@ -167,8 +167,9 @@ typedef void (*proto_unplumb_handler)(ifnet_t ifp, protocol_family_t protocol); be used to detach the protocol. @result A non-zero value of the attach failed. */ -errno_t proto_register_plumber(protocol_family_t proto_fam, ifnet_family_t if_fam, - proto_plumb_handler plumb, proto_unplumb_handler unplumb); +extern errno_t proto_register_plumber(protocol_family_t proto_fam, + ifnet_family_t if_fam, proto_plumb_handler plumb, + proto_unplumb_handler unplumb); /*! @function proto_unregister_plumber @@ -177,8 +178,43 @@ errno_t proto_register_plumber(protocol_family_t proto_fam, ifnet_family_t if_fa handle. @param if_fam The interface family these plumbing functions handle. */ -void proto_unregister_plumber(protocol_family_t proto_fam, ifnet_family_t if_fam); +extern void proto_unregister_plumber(protocol_family_t proto_fam, + ifnet_family_t if_fam); +#ifdef KERNEL_PRIVATE +/* + @function proto_plumb + @discussion Plumbs a protocol to an actual interface. This will find + a registered protocol module and call its attach function. + The module will typically call dlil_attach_protocol() with the + appropriate parameters. + @param protocol_family The protocol family. + @param ifp The interface to plumb the protocol to. + @result 0: No error. + ENOENT: No module was registered. + Other: Error returned by the attach_proto function +*/ +extern errno_t proto_plumb(protocol_family_t protocol_family, ifnet_t ifp); + +/* + @function proto_unplumb + @discussion Unplumbs a protocol from an interface. This will find + a registered protocol module and call its detach function. + The module will typically call dlil_detach_protocol() with + the appropriate parameters. If no module is found, this + function will call dlil_detach_protocol directly(). + @param protocol_family The protocol family. + @param ifp The interface to unplumb the protocol from. + @result 0: No error. + ENOENT: No module was registered. + Other: Error returned by the attach_proto function +*/ +extern errno_t proto_unplumb(protocol_family_t protocol_family, ifnet_t ifp); + +__private_extern__ void +proto_kpi_init(void) __attribute__((section("__TEXT, initcode"))); + +#endif /* KERNEL_PRIVATE */ __END_DECLS -#endif +#endif /* __KPI_PROTOCOL__ */