Annotation of embedaddon/libpdel/ppp/ppp_channel.c, 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: #include "ppp/ppp_defs.h"
        !            42: #include "ppp/ppp_channel.h"
        !            43: 
        !            44: void
        !            45: ppp_channel_open(struct ppp_channel *chan)
        !            46: {
        !            47:        if (chan->meth->open != NULL)
        !            48:                (*chan->meth->open)(chan);
        !            49: }
        !            50: 
        !            51: void
        !            52: ppp_channel_close(struct ppp_channel *chan)
        !            53: {
        !            54:        if (chan->meth->close != NULL)
        !            55:                (*chan->meth->close)(chan);
        !            56: }
        !            57: 
        !            58: void
        !            59: ppp_channel_destroy(struct ppp_channel **chanp)
        !            60: {
        !            61:        struct ppp_channel *chan = *chanp;
        !            62: 
        !            63:        if (chan == NULL)
        !            64:                return;
        !            65:        *chanp = NULL;
        !            66:        (*chan->meth->destroy)(&chan);
        !            67: }
        !            68: 
        !            69: struct mesg_port *
        !            70: ppp_channel_get_outport(struct ppp_channel *chan)
        !            71: {
        !            72:        return (chan->outport);
        !            73: }
        !            74: 
        !            75: void
        !            76: ppp_channel_free_output(struct ppp_channel *chan,
        !            77:        struct ppp_channel_output *output)
        !            78: {
        !            79:        (*chan->meth->free_output)(chan, output);
        !            80: }
        !            81: 
        !            82: void
        !            83: ppp_channel_set_link_info(struct ppp_channel *chan, u_int32_t accm)
        !            84: {
        !            85:        if (chan->meth->set_link_info != NULL)
        !            86:                (*chan->meth->set_link_info)(chan, accm);
        !            87: }
        !            88: 
        !            89: int
        !            90: ppp_channel_get_origination(struct ppp_channel *chan)
        !            91: {
        !            92:        return ((*chan->meth->get_origination)(chan));
        !            93: }
        !            94: 
        !            95: const char *
        !            96: ppp_channel_get_node(struct ppp_channel *chan)
        !            97: {
        !            98:        if (chan->meth->get_node == NULL)
        !            99:                return (NULL);
        !           100:        return ((*chan->meth->get_node)(chan));
        !           101: }
        !           102: 
        !           103: const char *
        !           104: ppp_channel_get_hook(struct ppp_channel *chan)
        !           105: {
        !           106:        if (chan->meth->get_hook == NULL)
        !           107:                return (NULL);
        !           108:        return ((*chan->meth->get_hook)(chan));
        !           109: }
        !           110: 
        !           111: int
        !           112: ppp_channel_is_async(struct ppp_channel *chan)
        !           113: {
        !           114:        if (chan->meth->is_async == NULL)
        !           115:                return (0);
        !           116:        return ((*chan->meth->is_async)(chan));
        !           117: }
        !           118: 
        !           119: u_int
        !           120: ppp_channel_get_mtu(struct ppp_channel *chan)
        !           121: {
        !           122:        if (chan->meth->get_mtu == NULL)
        !           123:                return (0);
        !           124:        return ((*chan->meth->get_mtu)(chan));
        !           125: }
        !           126: 
        !           127: int
        !           128: ppp_channel_get_acfcomp(struct ppp_channel *chan)
        !           129: {
        !           130:        if (chan->meth->get_acfcomp == NULL)
        !           131:                return (0);
        !           132:        return ((*chan->meth->get_acfcomp)(chan));
        !           133: }
        !           134: 
        !           135: int
        !           136: ppp_channel_get_pfcomp(struct ppp_channel *chan)
        !           137: {
        !           138:        if (chan->meth->get_pfcomp == NULL)
        !           139:                return (0);
        !           140:        return ((*chan->meth->get_pfcomp)(chan));
        !           141: }
        !           142: 
        !           143: 

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