Annotation of embedaddon/libpdel/ppp/ppp_manager.h, revision 1.1

1.1     ! misho       1: 
        !             2: /*
        !             3:  * Copyright (c) 2001-2002 Packet Design, LLC.
        !             4:  * All rights reserved.
        !             5:  * 
        !             6:  * Subject to the following obligations and disclaimer of warranty,
        !             7:  * use and redistribution of this software, in source or object code
        !             8:  * forms, with or without modifications are expressly permitted by
        !             9:  * Packet Design; provided, however, that:
        !            10:  * 
        !            11:  *    (i)  Any and all reproductions of the source or object code
        !            12:  *         must include the copyright notice above and the following
        !            13:  *         disclaimer of warranties; and
        !            14:  *    (ii) No rights are granted, in any manner or form, to use
        !            15:  *         Packet Design trademarks, including the mark "PACKET DESIGN"
        !            16:  *         on advertising, endorsements, or otherwise except as such
        !            17:  *         appears in the above copyright notice or in the software.
        !            18:  * 
        !            19:  * THIS SOFTWARE IS BEING PROVIDED BY PACKET DESIGN "AS IS", AND
        !            20:  * TO THE MAXIMUM EXTENT PERMITTED BY LAW, PACKET DESIGN MAKES NO
        !            21:  * REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED, REGARDING
        !            22:  * THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY AND ALL IMPLIED
        !            23:  * WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE,
        !            24:  * OR NON-INFRINGEMENT.  PACKET DESIGN DOES NOT WARRANT, GUARANTEE,
        !            25:  * OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF, OR THE RESULTS
        !            26:  * OF THE USE OF THIS SOFTWARE IN TERMS OF ITS CORRECTNESS, ACCURACY,
        !            27:  * RELIABILITY OR OTHERWISE.  IN NO EVENT SHALL PACKET DESIGN BE
        !            28:  * LIABLE FOR ANY DAMAGES RESULTING FROM OR ARISING OUT OF ANY USE
        !            29:  * OF THIS SOFTWARE, INCLUDING WITHOUT LIMITATION, ANY DIRECT,
        !            30:  * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, PUNITIVE, OR CONSEQUENTIAL
        !            31:  * DAMAGES, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES, LOSS OF
        !            32:  * USE, DATA OR PROFITS, HOWEVER CAUSED AND UNDER ANY THEORY OF
        !            33:  * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
        !            34:  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
        !            35:  * THE USE OF THIS SOFTWARE, EVEN IF PACKET DESIGN IS ADVISED OF
        !            36:  * THE POSSIBILITY OF SUCH DAMAGE.
        !            37:  *
        !            38:  * Author: Archie Cobbs <archie@freebsd.org>
        !            39:  */
        !            40: 
        !            41: #ifndef _PDEL_PPP_PPP_MANAGER_H_
        !            42: #define _PDEL_PPP_PPP_MANAGER_H_
        !            43: 
        !            44: /*
        !            45:  * This is an interface that the PPP library expects to be
        !            46:  * implemented by the code using the library.
        !            47:  */
        !            48: 
        !            49: struct ppp_manager;
        !            50: struct ppp_bundle;
        !            51: struct ppp_link;
        !            52: struct ppp_bundle_config;
        !            53: 
        !            54: /********************************************************************
        !            55:                        MANAGER METHODS
        !            56: ********************************************************************/
        !            57: 
        !            58: /*
        !            59:  * A new bundle is being created for a new link. The link didn't match
        !            60:  * any existing bundles. The PPP engine needs to know the configuration
        !            61:  * for the new bundle.
        !            62:  *
        !            63:  * The link has already reached the OPENED state and authenticated,
        !            64:  * so the local and remote authentication names, etc. are available.
        !            65:  *
        !            66:  * This function will be called in a thread that may be canceled at
        !            67:  * any cancellation point. It should be prepared to clean up if so.
        !            68:  *
        !            69:  * If successful, the IP address contained in conf->ip[PPP_PEER] is
        !            70:  * compared to 0.0.0.0. If not equal, then it is guaranteed that
        !            71:  * the 'release_ip' function will be called exactly once in the future
        !            72:  * with the with the same bundle and IP address.
        !            73:  *
        !            74:  * This method should return NULL on error, otherwise it should return
        !            75:  * a non-NULL cookie which will be available from ppp_bundle_get_cookie().
        !            76:  */
        !            77: typedef void   *ppp_manager_bundle_config_t(struct ppp_manager *manager,
        !            78:                        struct ppp_link *link, struct ppp_bundle_config *conf);
        !            79: 
        !            80: /*
        !            81:  * A bundle that was successfully configured by the 'bundle_config' callback
        !            82:  * has reached the IPCP OPENED state and the IP traffic netgraph hook
        !            83:  * needs to be plumbed. If successful, this method should return a non-NULL
        !            84:  * cookie, and then the 'bundle_unplumb' method is guaranteed to be called
        !            85:  * exactly once.
        !            86:  *
        !            87:  * 'ips' points to the local and remote IP address negotiated for the link.
        !            88:  * 'dns' points to the 2 peer-supplied DNS IP addresses (or 0.0.0.0).
        !            89:  * 'nbns' points to the 2 peer-supplied NBNS IP addresses (or 0.0.0.0).
        !            90:  * 'mtu' is the MTU that should be configured for the interface
        !            91:  */
        !            92: typedef void   *ppp_manager_bundle_plumb_t(struct ppp_manager *manager,
        !            93:                        struct ppp_bundle *bundle,
        !            94:                        const char *path, const char *hook,
        !            95:                        struct in_addr *ips, struct in_addr *dns,
        !            96:                        struct in_addr *nbns, u_int mtu);
        !            97: 
        !            98: /*
        !            99:  * A bundle that was successfully plumbed by the 'bundle_plumb' callback
        !           100:  * is now being shutdown. The 'arg' parameter was returned by the
        !           101:  * 'bundle_plumb' callback.
        !           102:  *
        !           103:  * Note: calling 'ppp_engine_destroy' can cause this method to be called.
        !           104:  */
        !           105: typedef void   ppp_manager_bundle_unplumb_t(struct ppp_manager *manager,
        !           106:                        void *arg, struct ppp_bundle *bundle);
        !           107: 
        !           108: /*
        !           109:  * Callback to release an IP address assigned to the remote peer for a bundle.
        !           110:  *
        !           111:  * Note: calling 'ppp_engine_destroy' can cause this method to be called.
        !           112:  */
        !           113: typedef void   ppp_manager_release_ip_t(struct ppp_manager *manager,
        !           114:                        struct ppp_bundle *bundle, struct in_addr ip);
        !           115: 
        !           116: /* PPP manager methods */
        !           117: struct ppp_manager_meth {
        !           118:        ppp_manager_bundle_config_t     *bundle_config;
        !           119:        ppp_manager_bundle_plumb_t      *bundle_plumb;
        !           120:        ppp_manager_bundle_unplumb_t    *bundle_unplumb;
        !           121:        ppp_manager_release_ip_t        *release_ip;
        !           122: };
        !           123: 
        !           124: /* PPP manager structure */
        !           125: struct ppp_manager {
        !           126:        struct ppp_manager_meth *meth;
        !           127:        void                    *priv;
        !           128: };
        !           129: 
        !           130: __BEGIN_DECLS
        !           131: 
        !           132: /* Functions */
        !           133: extern ppp_manager_bundle_config_t     ppp_manager_bundle_config;
        !           134: extern ppp_manager_bundle_plumb_t      ppp_manager_bundle_plumb;
        !           135: extern ppp_manager_bundle_unplumb_t    ppp_manager_bundle_unplumb;
        !           136: extern ppp_manager_release_ip_t                ppp_manager_release_ip;
        !           137: 
        !           138: __END_DECLS
        !           139: 
        !           140: #endif /* _PDEL_PPP_PPP_MANAGER_H_ */

FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>