Mac Developer Library

Developer

kpi_protocol.h Reference

Options
Deployment Target:

On This Page

kpi_protocol.h Reference

This header defines an API to interact with protocols in the kernel. The KPIs in this header file can be used to interact with protocols that already exist in the stack. These KPIs can be used to support existing protocols over media types that are not natively supported in the kernel, such as ATM.

Included Headers

  • <sys/kernel_types.h>

  • <net/kpi_interface.h>

Functions

  • Declaration

    Objective-C

    errno_t proto_inject ( protocol_family_t protocol, mbuf_t packet );

    Parameters

    protocol

    The protocol of the packet.

    packet

    The first packet in a chain of packets to be injected.

    Return Value

    A errno error on failure. Unless proto_inject returns zero, the caller is responsible for freeing the mbuf.

    Discussion

    Injects a packet on the specified protocol from anywhere. To avoid recursion, the protocol may need to queue the packet to be handled later.

    Import Statement

    Objective-C

    #include <kpi_protocol.h>;

    Availability

    Available in OS X v10.4 and later.

  • Declaration

    Objective-C

    errno_t proto_input ( protocol_family_t protocol, mbuf_t packet );

    Parameters

    protocol

    The protocol of the packet.

    packet

    The first packet in a chain of packets to be input.

    Return Value

    A errno error on failure. Unless proto_input returns zero, the caller is responsible for freeing the mbuf.

    Discussion

    Inputs a packet on the specified protocol from the input path.

    Import Statement

    Objective-C

    #include <kpi_protocol.h>;

    Availability

    Available in OS X v10.4 and later.

  • Declaration

    Objective-C

    errno_t proto_register_plumber ( protocol_family_t proto_fam, ifnet_family_t if_fam, proto_plumb_handler plumb, proto_unplumb_handler unplumb );

    Parameters

    proto_fam

    The protocol family these plumbing functions will handle.

    if_fam

    The interface family these plumbing functions will handle.

    plumb

    The function to call to attach the protocol to an interface.

    unplumb

    The function to call to detach the protocol to an interface, may be NULL in which case ifnet_detach_protocol will be used to detach the protocol.

    Return Value

    A non-zero value of the attach failed.

    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.

    Import Statement

    Objective-C

    #include <kpi_protocol.h>;

    Availability

    Available in OS X v10.4 and later.

  • Declaration

    Objective-C

    void proto_unregister_plumber ( protocol_family_t proto_fam, ifnet_family_t if_fam );

    Parameters

    proto_fam

    The protocol family these plumbing functions handle.

    if_fam

    The interface family these plumbing functions handle.

    Discussion

    Unregisters a previously registered plumbing function.

    Import Statement

    Objective-C

    #include <kpi_protocol.h>;

    Availability

    Available in OS X v10.4 and later.

Callbacks

  • Declaration

    Objective-C

    typedef errno_t ( *proto_plumb_handler)( ifnet_t ifp, protocol_family_t protocol);

    Parameters

    ifp

    The interface the protocol should be attached to.

    protocol_family

    The protocol that should be attached to the interface.

    Return Value

    A non-zero value of the attach failed.

    Discussion

    proto_plumb_handler is called to attach a protocol to an interface. A typical protocol plumb function would fill out an ifnet_attach_proto_param and call ifnet_attach_protocol.

    Import Statement

    Objective-C

    #include <kpi_protocol.h>;

    Availability

    Available in OS X v10.4 and later.

  • Declaration

    Objective-C

    typedef void ( *proto_unplumb_handler)( ifnet_t ifp, protocol_family_t protocol);

    Parameters

    ifp

    The interface the protocol should be detached from.

    protocol_family

    The protocol that should be detached from the interface.

    Discussion

    proto_unplumb_handler is called to detach a protocol from an interface. A typical unplumb function would call ifnet_detach_protocol and perform any necessary cleanup.

    Import Statement

    Objective-C

    #include <kpi_protocol.h>;

    Availability

    Available in OS X v10.4 and later.