Annotation of 43BSDReno/sys/netiso/clnp_timer.c, revision 1.1.1.1

1.1       root        1: /***********************************************************
                      2:                Copyright IBM Corporation 1987
                      3: 
                      4:                       All Rights Reserved
                      5: 
                      6: Permission to use, copy, modify, and distribute this software and its 
                      7: documentation for any purpose and without fee is hereby granted, 
                      8: provided that the above copyright notice appear in all copies and that
                      9: both that copyright notice and this permission notice appear in 
                     10: supporting documentation, and that the name of IBM not be
                     11: used in advertising or publicity pertaining to distribution of the
                     12: software without specific, written prior permission.  
                     13: 
                     14: IBM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
                     15: ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
                     16: IBM BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
                     17: ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
                     18: WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
                     19: ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
                     20: SOFTWARE.
                     21: 
                     22: ******************************************************************/
                     23: 
                     24: /*
                     25:  * ARGO Project, Computer Sciences Dept., University of Wisconsin - Madison
                     26:  */
                     27: /* $Header: clnp_timer.c,v 4.2 88/06/29 14:59:05 hagens Exp $ */
                     28: /* $Source: /usr/argo/sys/netiso/RCS/clnp_timer.c,v $ */
                     29: /*     @(#)clnp_timer.c        7.4 (Berkeley) 9/22/89 */
                     30: 
                     31: #ifndef lint
                     32: static char *rcsid = "$Header: clnp_timer.c,v 4.2 88/06/29 14:59:05 hagens Exp $";
                     33: #endif lint
                     34: 
                     35: #include "param.h"
                     36: #include "mbuf.h"
                     37: #include "domain.h"
                     38: #include "protosw.h"
                     39: #include "socket.h"
                     40: #include "socketvar.h"
                     41: #include "errno.h"
                     42: 
                     43: #include "../net/if.h"
                     44: #include "../net/route.h"
                     45: 
                     46: #include "iso.h"
                     47: #include "clnp.h"
                     48: #include "clnp_stat.h"
                     49: #include "argo_debug.h"
                     50: 
                     51: extern struct clnp_fragl *clnp_frags;
                     52: 
                     53: /*
                     54:  * FUNCTION:           clnp_freefrags
                     55:  *
                     56:  * PURPOSE:                    Free the resources associated with a fragment
                     57:  *
                     58:  * RETURNS:                    pointer to next fragment in list of fragments
                     59:  *
                     60:  * SIDE EFFECTS:       
                     61:  *
                     62:  * NOTES:                      
                     63:  *                     TODO: send ER back to source
                     64:  */
                     65: struct clnp_fragl *
                     66: clnp_freefrags(cfh)
                     67: register struct clnp_fragl     *cfh;   /* fragment header to delete */
                     68: {
                     69:        struct clnp_fragl       *next = cfh->cfl_next;
                     70:        struct clnp_frag        *cf;
                     71: 
                     72:        /* free any frags hanging around */
                     73:        cf = cfh->cfl_frags;
                     74:        while (cf != NULL) {
                     75:                struct clnp_frag        *cf_next = cf->cfr_next;
                     76:                INCSTAT(cns_fragdropped);
                     77:                m_freem(cf->cfr_data);
                     78:                cf = cf_next;
                     79:        }
                     80: 
                     81:        /* free the copy of the header */
                     82:        INCSTAT(cns_fragdropped);
                     83:        m_freem(cfh->cfl_orighdr);
                     84: 
                     85:        if (clnp_frags == cfh) {
                     86:                clnp_frags = cfh->cfl_next;
                     87:        } else {
                     88:                struct clnp_fragl       *scan;
                     89: 
                     90:                for (scan = clnp_frags; scan != NULL; scan = scan->cfl_next) {
                     91:                        if (scan->cfl_next == cfh) {
                     92:                                scan->cfl_next = cfh->cfl_next;
                     93:                                break;
                     94:                        }
                     95:                }
                     96:        }
                     97: 
                     98:        /* free the fragment header */
                     99:        m_freem(dtom(cfh));
                    100: 
                    101:        return(next);
                    102: }
                    103: 
                    104: /*
                    105:  * FUNCTION:           clnp_slowtimo
                    106:  *
                    107:  * PURPOSE:                    clnp timer processing; if the ttl expires on a 
                    108:  *                                     packet on the reassembly queue, discard it.
                    109:  *
                    110:  * RETURNS:                    none
                    111:  *
                    112:  * SIDE EFFECTS:       
                    113:  *
                    114:  * NOTES:                      
                    115:  */
                    116: clnp_slowtimo()
                    117: {
                    118:        register struct clnp_fragl      *cfh = clnp_frags;
                    119:        int s = splnet();
                    120: 
                    121:        while (cfh != NULL) {
                    122:                if (--cfh->cfl_ttl == 0) {
                    123:                        cfh = clnp_freefrags(cfh);
                    124:                        INCSTAT(cns_fragtimeout);
                    125:                } else {
                    126:                        cfh = cfh->cfl_next;
                    127:                }
                    128:        }
                    129:        splx(s);
                    130: }
                    131: 
                    132: /*
                    133:  * FUNCTION:           clnp_drain
                    134:  *
                    135:  * PURPOSE:                    drain off all datagram fragments
                    136:  *
                    137:  * RETURNS:                    none
                    138:  *
                    139:  * SIDE EFFECTS:       
                    140:  *
                    141:  * NOTES:                      
                    142:  *     TODO: should send back ER
                    143:  */
                    144: clnp_drain()
                    145: {
                    146:        register struct clnp_fragl      *cfh = clnp_frags;
                    147: 
                    148:        while (cfh != NULL)
                    149:                cfh = clnp_freefrags(cfh);
                    150: }

unix.superglobalmegacorp.com

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