Annotation of kernel/bsd/netat/aurp_rd.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1999 Apple Computer, Inc. All rights reserved.
        !             3:  *
        !             4:  * @APPLE_LICENSE_HEADER_START@
        !             5:  * 
        !             6:  * Portions Copyright (c) 1999 Apple Computer, Inc.  All Rights
        !             7:  * Reserved.  This file contains Original Code and/or Modifications of
        !             8:  * Original Code as defined in and that are subject to the Apple Public
        !             9:  * Source License Version 1.1 (the "License").  You may not use this file
        !            10:  * except in compliance with the License.  Please obtain a copy of the
        !            11:  * License at http://www.apple.com/publicsource and read it before using
        !            12:  * this file.
        !            13:  * 
        !            14:  * The Original Code and all software distributed under the License are
        !            15:  * distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY KIND, EITHER
        !            16:  * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
        !            17:  * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
        !            18:  * FITNESS FOR A PARTICULAR PURPOSE OR NON-INFRINGEMENT.  Please see the
        !            19:  * License for the specific language governing rights and limitations
        !            20:  * under the License.
        !            21:  * 
        !            22:  * @APPLE_LICENSE_HEADER_END@
        !            23:  */
        !            24: 
        !            25: /*
        !            26:  *     Copyright (c) 1996 Apple Computer, Inc. 
        !            27:  *
        !            28:  *     The information contained herein is subject to change without
        !            29:  *     notice and  should not be  construed as a commitment by Apple
        !            30:  *     Computer, Inc. Apple Computer, Inc. assumes no responsibility
        !            31:  *     for any errors that may appear.
        !            32:  *
        !            33:  *     Confidential and Proprietary to Apple Computer, Inc.
        !            34:  *
        !            35:  *     File: rd.c
        !            36:  */
        !            37: #include <sysglue.h>
        !            38: #include <at/appletalk.h>
        !            39: #include <lap.h>
        !            40: #include <routing_tables.h>
        !            41: #define _AURP
        !            42: #include <at_aurp.h>
        !            43: #include <at/aurp.h>
        !            44: 
        !            45: /* */
        !            46: void AURPsndRDReq(state)
        !            47:        aurp_state_t *state;
        !            48: {
        !            49:        int msize;
        !            50:        gbuf_t *m;
        !            51:        aurp_hdr_t *hdrp;
        !            52: 
        !            53:        if ((state->rcv_state == AURPSTATE_Unconnected) ||
        !            54:                        (state->snd_state == AURPSTATE_Unconnected))
        !            55:                return;
        !            56: 
        !            57:        /* update state info */
        !            58:        state->rcv_state = AURPSTATE_Unconnected;
        !            59:        state->snd_state = AURPSTATE_Unconnected;
        !            60: 
        !            61:        /* notify tunnel peer of router going-down for the data receiver side */
        !            62:        msize = sizeof(aurp_hdr_t) + sizeof(short);
        !            63:        if ((m = (gbuf_t *)gbuf_alloc(msize, PRI_MED)) != 0) {
        !            64:                gbuf_wset(m,msize);
        !            65: 
        !            66:                /* construct the router down packet */
        !            67:                hdrp = (aurp_hdr_t *)gbuf_rptr(m);
        !            68:                hdrp->connection_id = state->rcv_connection_id;
        !            69:                hdrp->sequence_number = 0;
        !            70:                hdrp->command_code = AURPCMD_RDReq;
        !            71:                hdrp->flags = 0;
        !            72:                *(short *)(hdrp+1) = AURPERR_NormalConnectionClose;
        !            73: 
        !            74:                /* send the packet */
        !            75:                AURPsend(m, AUD_AURP, state->rem_node);
        !            76:        }
        !            77: 
        !            78:        /* notify tunnel peer of router going-down for the data sender side */
        !            79:        msize = sizeof(aurp_hdr_t) + sizeof(short);
        !            80:        if ((m = (gbuf_t *)gbuf_alloc(msize, PRI_MED)) != 0) {
        !            81:                gbuf_wset(m,msize);
        !            82: 
        !            83:                /* construct the router down packet */
        !            84:                hdrp = (aurp_hdr_t *)gbuf_rptr(m);
        !            85:                hdrp->connection_id = state->snd_connection_id;
        !            86:                hdrp->sequence_number = state->snd_sequence_number;
        !            87:                hdrp->command_code = AURPCMD_RDReq;
        !            88:                hdrp->flags = 0;
        !            89:                *(short *)(hdrp+1) = AURPERR_NormalConnectionClose;
        !            90: 
        !            91:                /* send the packet */
        !            92:                AURPsend(m, AUD_AURP, state->rem_node);
        !            93:        }
        !            94: }
        !            95: 
        !            96: /* */
        !            97: void AURPrcvRDReq(state, m)
        !            98:        aurp_state_t *state;
        !            99:        gbuf_t *m;
        !           100: {
        !           101:        /* update state info */
        !           102:        state->rcv_state = AURPSTATE_Unconnected;
        !           103:        state->snd_state = AURPSTATE_Unconnected;
        !           104:        AURPcleanup(state);
        !           105: 
        !           106:        /* purge all routes associated with the tunnel peer going-down */
        !           107:        AURPpurgeri(state->rem_node);
        !           108: 
        !           109:        /* respond to the going-down peer with an RI Ack packet */
        !           110:        AURPsndRIAck(state, m, 0);
        !           111: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.