The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/netisdn/i4b_l3timer.c

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 /*
    2  * Copyright (c) 1997, 2000 Hellmuth Michaelis. All rights reserved.
    3  *
    4  * Redistribution and use in source and binary forms, with or without
    5  * modification, are permitted provided that the following conditions
    6  * are met:
    7  * 1. Redistributions of source code must retain the above copyright
    8  *    notice, this list of conditions and the following disclaimer.
    9  * 2. Redistributions in binary form must reproduce the above copyright
   10  *    notice, this list of conditions and the following disclaimer in the
   11  *    documentation and/or other materials provided with the distribution.
   12  *
   13  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
   14  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
   15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
   16  * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
   17  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
   18  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
   19  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
   20  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
   21  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
   22  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
   23  * SUCH DAMAGE.
   24  *
   25  *---------------------------------------------------------------------------
   26  *
   27  *      i4b_l3timer.c - timer and timeout handling for layer 3
   28  *      ------------------------------------------------------
   29  *
   30  *      $Id: i4b_l3timer.c,v 1.4 2001/11/13 01:06:22 lukem Exp $ 
   31  *
   32  * $FreeBSD$
   33  *
   34  *      last edit-date: [Fri Jan  5 11:33:47 2001]
   35  *
   36  *---------------------------------------------------------------------------*/
   37 
   38 #include <sys/cdefs.h>
   39 __KERNEL_RCSID(0, "$NetBSD: i4b_l3timer.c,v 1.4 2001/11/13 01:06:22 lukem Exp $");
   40 
   41 #ifdef __FreeBSD__
   42 #include "i4bq931.h"
   43 #else
   44 #define NI4BQ931        1
   45 #endif
   46 #if NI4BQ931 > 0
   47 
   48 #include <sys/param.h>
   49 #include <sys/kernel.h>
   50 #include <sys/systm.h>
   51 #include <sys/mbuf.h>
   52 #include <sys/socket.h>
   53 #include <net/if.h>
   54 
   55 #if defined(__NetBSD__) && __NetBSD_Version__ >= 104230000
   56 #include <sys/callout.h>
   57 #endif
   58 
   59 #ifdef __FreeBSD__
   60 #include <machine/i4b_debug.h>
   61 #include <machine/i4b_ioctl.h>
   62 #else
   63 #include <netisdn/i4b_debug.h>
   64 #include <netisdn/i4b_ioctl.h>
   65 #endif
   66 
   67 #include <netisdn/i4b_global.h>
   68 #include <netisdn/i4b_isdnq931.h>
   69 #include <netisdn/i4b_l3l4.h>
   70 #include <netisdn/i4b_mbuf.h>
   71 
   72 #include <netisdn/i4b_l3.h>
   73 #include <netisdn/i4b_l3fsm.h>
   74 #include <netisdn/i4b_q931.h>
   75 
   76 #include <netisdn/i4b_l4.h>
   77 
   78 /*---------------------------------------------------------------------------*
   79  *      stop all layer 3 timers
   80  *---------------------------------------------------------------------------*/
   81 void i4b_l3_stop_all_timers(call_desc_t *cd)
   82 {
   83         T303_stop(cd);
   84         T305_stop(cd);
   85         T308_stop(cd);
   86         T309_stop(cd);
   87         T310_stop(cd);
   88         T313_stop(cd);  
   89 }
   90         
   91 /*---------------------------------------------------------------------------*
   92  *      timer T303 timeout function
   93  *---------------------------------------------------------------------------*/
   94 static void
   95 T303_timeout(call_desc_t *cd)
   96 {
   97         NDBGL3(L3_T_ERR, "SETUP not answered, cr = %d", cd->cr);
   98         next_l3state(cd, EV_T303EXP);
   99 }
  100 
  101 /*---------------------------------------------------------------------------*
  102  *      timer T303 start
  103  *---------------------------------------------------------------------------*/
  104 void
  105 T303_start(call_desc_t *cd)
  106 {
  107         if (cd->T303 == TIMER_ACTIVE)
  108                 return;
  109                 
  110         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  111         cd->T303 = TIMER_ACTIVE;
  112 
  113         START_TIMER(cd->T303_callout, T303_timeout, cd, T303VAL);
  114 }
  115 
  116 /*---------------------------------------------------------------------------*
  117  *      timer T303 stop
  118  *---------------------------------------------------------------------------*/
  119 void
  120 T303_stop(call_desc_t *cd)
  121 {
  122         int s;
  123         s = splnet();
  124         
  125         if(cd->T303 != TIMER_IDLE)
  126         {
  127                 STOP_TIMER(cd->T303_callout, T303_timeout, cd);
  128                 cd->T303 = TIMER_IDLE;
  129         }
  130         splx(s);
  131         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  132 }
  133 
  134 /*---------------------------------------------------------------------------*
  135  *      timer T305 timeout function
  136  *---------------------------------------------------------------------------*/
  137 static void
  138 T305_timeout(call_desc_t *cd)
  139 {
  140         NDBGL3(L3_T_ERR, "DISC not answered, cr = %d", cd->cr);
  141         next_l3state(cd, EV_T305EXP);
  142 }
  143 
  144 /*---------------------------------------------------------------------------*
  145  *      timer T305 start
  146  *---------------------------------------------------------------------------*/
  147 void
  148 T305_start(call_desc_t *cd)
  149 {
  150         if (cd->T305 == TIMER_ACTIVE)
  151                 return;
  152                 
  153         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  154         cd->T305 = TIMER_ACTIVE;
  155 
  156         START_TIMER(cd->T305_callout, T305_timeout, cd, T305VAL);
  157 }
  158 
  159 /*---------------------------------------------------------------------------*
  160  *      timer T305 stop
  161  *---------------------------------------------------------------------------*/
  162 void
  163 T305_stop(call_desc_t *cd)
  164 {
  165         int s;
  166         s = splnet();
  167         
  168         if(cd->T305 != TIMER_IDLE)
  169         {
  170                 STOP_TIMER(cd->T305_callout, T305_timeout, cd);
  171                 cd->T305 = TIMER_IDLE;
  172         }
  173         splx(s);
  174         
  175         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  176 }
  177 
  178 /*---------------------------------------------------------------------------*
  179  *      timer T308 timeout function
  180  *---------------------------------------------------------------------------*/
  181 static void
  182 T308_timeout(call_desc_t *cd)
  183 {
  184         NDBGL3(L3_T_ERR, "REL not answered, cr = %d", cd->cr);
  185         next_l3state(cd, EV_T308EXP);
  186 }
  187 
  188 /*---------------------------------------------------------------------------*
  189  *      timer T308 start
  190  *---------------------------------------------------------------------------*/
  191 void
  192 T308_start(call_desc_t *cd)
  193 {
  194         if(cd->T308 == TIMER_ACTIVE)
  195                 return;
  196                 
  197         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  198         cd->T308 = TIMER_ACTIVE;
  199 
  200         START_TIMER(cd->T308_callout, T308_timeout, cd, T308VAL);
  201 }
  202 
  203 /*---------------------------------------------------------------------------*
  204  *      timer T308 stop
  205  *---------------------------------------------------------------------------*/
  206 void
  207 T308_stop(call_desc_t *cd)
  208 {
  209         int s;
  210         s = splnet();
  211         
  212         if(cd->T308 != TIMER_IDLE)
  213         {
  214                 STOP_TIMER(cd->T308_callout, T308_timeout, cd);
  215                 cd->T308 = TIMER_IDLE;
  216         }
  217         splx(s);
  218         
  219         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  220 }
  221 
  222 /*---------------------------------------------------------------------------*
  223  *      timer T309 timeout function
  224  *---------------------------------------------------------------------------*/
  225 static void
  226 T309_timeout(call_desc_t *cd)
  227 {
  228         NDBGL3(L3_T_ERR, "datalink not reconnected, cr = %d", cd->cr);
  229         next_l3state(cd, EV_T309EXP);
  230 }
  231 
  232 /*---------------------------------------------------------------------------*
  233  *      timer T309 start
  234  *---------------------------------------------------------------------------*/
  235 void
  236 T309_start(call_desc_t *cd)
  237 {
  238         if (cd->T309 == TIMER_ACTIVE)
  239                 return;
  240 
  241         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  242         cd->T309 = TIMER_ACTIVE;
  243 
  244         START_TIMER(cd->T309_callout, T309_timeout, cd, T309VAL);
  245 }
  246 
  247 /*---------------------------------------------------------------------------*
  248  *      timer T309 stop
  249  *---------------------------------------------------------------------------*/
  250 void
  251 T309_stop(call_desc_t *cd)
  252 {
  253         int s;
  254         s = splnet();
  255         
  256         if(cd->T309 != TIMER_IDLE)
  257         {
  258                 STOP_TIMER(cd->T309_callout, T309_timeout, cd);
  259                 cd->T309 = TIMER_IDLE;
  260         }
  261         splx(s);
  262         
  263         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  264 }
  265 
  266 /*---------------------------------------------------------------------------*
  267  *      timer T310 timeout function
  268  *---------------------------------------------------------------------------*/
  269 static void
  270 T310_timeout(call_desc_t *cd)
  271 {
  272         NDBGL3(L3_T_ERR, "CALL PROC timeout, cr = %d", cd->cr);
  273         next_l3state(cd, EV_T310EXP);
  274 }
  275 
  276 /*---------------------------------------------------------------------------*
  277  *      timer T310 start
  278  *---------------------------------------------------------------------------*/
  279 void
  280 T310_start(call_desc_t *cd)
  281 {
  282         if (cd->T310 == TIMER_ACTIVE)
  283                 return;
  284                 
  285         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  286         cd->T310 = TIMER_ACTIVE;
  287 
  288         START_TIMER(cd->T310_callout, T310_timeout, cd, T310VAL);
  289 }
  290 
  291 /*---------------------------------------------------------------------------*
  292  *      timer T310 stop
  293  *---------------------------------------------------------------------------*/
  294 void
  295 T310_stop(call_desc_t *cd)
  296 {
  297         int s;
  298         s = splnet();
  299         
  300         if(cd->T310 != TIMER_IDLE)
  301         {
  302                 STOP_TIMER(cd->T310_callout, T310_timeout, cd);
  303                 cd->T310 = TIMER_IDLE;
  304         }
  305         splx(s);
  306 
  307         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  308 }
  309 
  310 /*---------------------------------------------------------------------------*
  311  *      timer T313 timeout function
  312  *---------------------------------------------------------------------------*/
  313 static void
  314 T313_timeout(call_desc_t *cd)
  315 {
  316         NDBGL3(L3_T_ERR, "CONN ACK not received, cr = %d", cd->cr);
  317         next_l3state(cd, EV_T313EXP);
  318 }
  319 
  320 /*---------------------------------------------------------------------------*
  321  *      timer T313 start
  322  *---------------------------------------------------------------------------*/
  323 void
  324 T313_start(call_desc_t *cd)
  325 {
  326         if (cd->T313 == TIMER_ACTIVE)
  327                 return;
  328                 
  329         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  330         cd->T313 = TIMER_ACTIVE;
  331 
  332         START_TIMER(cd->T313_callout, T313_timeout, cd, T313VAL);
  333 }
  334 
  335 /*---------------------------------------------------------------------------*
  336  *      timer T313 stop
  337  *---------------------------------------------------------------------------*/
  338 void
  339 T313_stop(call_desc_t *cd)
  340 {
  341         int s;
  342         s = splnet();
  343         
  344         if(cd->T313 != TIMER_IDLE)
  345         {
  346                 cd->T313 = TIMER_IDLE;
  347                 STOP_TIMER(cd->T313_callout, T313_timeout, cd);
  348         }
  349         splx(s);
  350         
  351         NDBGL3(L3_T_MSG, "cr = %d", cd->cr);
  352 }
  353 
  354 #endif /* NI4BQ931 > 0 */
  355 

Cache object: dce37b45adc94f6a16a5d53cd0f39c62


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.